$search
00001 package edu.tum.cs.ias.knowrob.vis.items; 00002 00003 import java.awt.Color; 00004 00005 import javax.vecmath.Matrix4d; 00006 00007 import edu.tum.cs.ias.knowrob.vis.Canvas; 00008 import edu.tum.cs.ias.knowrob.vis.Drawable; 00009 import edu.tum.cs.ias.knowrob.vis.DrawableAnimated; 00010 import edu.tum.cs.ias.knowrob.vis.applets.SemanticMapVisApplet; 00011 00017 public abstract class ItemBase implements Drawable, DrawableAnimated { 00018 public String name; 00022 public int defaultColor = SemanticMapVisApplet.convertColor(220, 220, 220, 255); 00023 public Color colorOverride = null; 00024 00029 protected float[] trafoMatrix = null; 00030 00031 protected float xdim; 00032 protected float ydim; 00033 protected float zdim; 00034 00035 protected int color; 00036 00037 public void draw(Canvas c) { 00038 draw(c,0); 00039 } 00040 00041 public int getMaxStep() { 00042 return -1; 00043 } 00044 public static int convertColor(int red, int green, int blue, int alpha) { 00045 return (((((alpha << 8) + red) << 8) + green) << 8) + blue; 00046 } 00047 00048 public void setColor(int color){ 00049 this.color = color; 00050 } 00051 00052 public void setColor(int color,int start, int end){ 00053 this.color=color; 00054 } 00055 00056 public void setPose(Matrix4d pose) { 00057 if(pose!=null) { 00058 this.trafoMatrix = new float[] { 00059 (float)pose.m00, (float)pose.m01, (float)pose.m02, (float)pose.m03, 00060 (float)pose.m10, (float)pose.m11, (float)pose.m12, (float)pose.m13, 00061 (float)pose.m20, (float)pose.m21, (float)pose.m22, (float)pose.m23, 00062 (float)pose.m30, (float)pose.m31, (float)pose.m32, (float)pose.m33 }; 00063 } 00064 } 00065 00066 public void setPose(double[] pose) { 00067 this.setPose(new Matrix4d(pose)); 00068 } 00069 00070 public void setPose(float[] pose) { 00071 this.trafoMatrix = pose; 00072 } 00073 00074 public void setPose(float m00,float m01,float m02,float m03, 00075 float m10,float m11,float m12,float m13, 00076 float m20,float m21,float m22,float m23, 00077 float m30,float m31,float m32,float m33) { 00078 this.trafoMatrix = new float[] { 00079 m00, m01, m02, m03, 00080 m10, m11, m12, m13, 00081 m20, m21, m22, m23, 00082 m30, m31, m32, m33 }; 00083 } 00084 00085 public void setPosition(float x, float y, float z) { 00086 this.trafoMatrix[3]=x; 00087 this.trafoMatrix[7]=y; 00088 this.trafoMatrix[11]=z; 00089 } 00090 00091 public void setDimensions(float xdim, float ydim, float zdim) { 00092 this.xdim=xdim; 00093 this.ydim=ydim; 00094 this.zdim=zdim; 00095 } 00096 }