00001
00002
00003
00004
00005
00006
00007 package edu.tum.cs.ias.knowrob.vis.items;
00008
00009 import edu.tum.cs.ias.knowrob.vis.items.transform.PoseColor;
00010
00015 public abstract class GenericPoseColorItem extends GenericItem<PoseColor> {
00016
00017 public GenericPoseColorItem(PoseColor transform) {
00018 super(transform);
00019 }
00020
00021 public GenericPoseColorItem(float x, float y, float z, int color) {
00022 this(new PoseColor(x, y, z, 0.0f, 0.0f, 0.0f, 1.0f, color));
00023 }
00024
00028 public void setPosition(int frame, float x, float y, float z) {
00029 setPosition(frame, frame, x, y, z);
00030 }
00031
00036 public void setPosition(int firstFrame, int lastFrame, float x, float y, float z) {
00037 PoseColor replacement = new PoseColor(x,y,z,0,0,0,0,0);
00038 setFrames(firstFrame, lastFrame, new PartialTransformationReplacer<PoseColor>(replacement) {
00039
00040 @Override
00041 public PoseColor replace(PoseColor before) {
00042 return new PoseColor(replacement.pose.x, replacement.pose.y, replacement.pose.z, before.pose.xRot, before.pose.yRot, before.pose.zRot, before.pose.scale, before.color);
00043 }
00044
00045 });
00046 }
00047
00051 public void setPose(int frame, float x, float y, float z, float rotX, float rotY, float rotZ, float scale) {
00052 setPose(frame, frame, x, y, z, rotX, rotY, rotZ, scale);
00053 }
00054
00055
00059 public void setPose(int firstFrame, int lastFrame, float x, float y, float z, float rotX, float rotY, float rotZ, float scale) {
00060 PoseColor replacement = new PoseColor(x,y,z,rotX,rotY,rotZ,scale,0);
00061 setFrames(firstFrame, lastFrame, new PartialTransformationReplacer<PoseColor>(replacement) {
00062
00063 @Override
00064 public PoseColor replace(PoseColor before) {
00065 return new PoseColor(replacement.pose, before.color);
00066 }
00067
00068 });
00069 }
00070
00075 public void setColor(int color) {
00076 setColor(0, animation.size()-1, color);
00077 }
00078
00083 public void setColor(int from, int to, int color) {
00084 PoseColor replacement = new PoseColor(null, color);
00085 setFrames(from, to, new PartialTransformationReplacer<PoseColor>(replacement) {
00086
00087 @Override
00088 public PoseColor replace(PoseColor before) {
00089 return new PoseColor(before.pose, replacement.color);
00090 }
00091
00092 });
00093 }
00094 }