00001 package de.tum.in.fipm.kipm.gui.visualisation.items; 00002 00003 import de.tum.in.fipm.kipm.gui.visualisation.applets.StandaloneKitchenVisApplet; 00004 import edu.tum.cs.vis.Canvas; 00005 import edu.tum.cs.vis.Drawable; 00006 import edu.tum.cs.vis.DrawableAnimated; 00007 import edu.tum.cs.vis.model.ItemModel; 00008 00014 public abstract class ItemBase implements Drawable, DrawableAnimated { 00015 public String name; 00019 public int defaultColor = StandaloneKitchenVisApplet.convertColor(220, 220, 220, 255); 00020 public int colorOverride = 0; 00021 00026 protected float[] trafoMatrix = null; 00027 00028 protected float xdim; 00029 protected float ydim; 00030 protected float zdim; 00031 00032 protected int color; 00033 00034 protected ItemModel model = null; 00035 00036 public void draw(Canvas c) { 00037 draw(c,0); 00038 } 00039 00040 public int getMaxStep() { 00041 return -1; 00042 } 00043 public static int convertColor(int red, int green, int blue, int alpha) { 00044 return (((((alpha << 8) + red) << 8) + green) << 8) + blue; 00045 } 00046 00047 public void setColor(int color){ 00048 this.color = color; 00049 } 00050 00051 public void setColor(int color,int start, int end){ 00052 this.color=color; 00053 } 00054 00055 public void setPose(float[] pose) { 00056 this.trafoMatrix = pose; 00057 } 00058 00059 public void setPose(float m00,float m01,float m02,float m03, 00060 float m10,float m11,float m12,float m13, 00061 float m20,float m21,float m22,float m23, 00062 float m30,float m31,float m32,float m33) { 00063 this.trafoMatrix = new float[] { 00064 m00, m01, m02, m03, 00065 m10, m11, m12, m13, 00066 m20, m21, m22, m23, 00067 m30, m31, m32, m33 }; 00068 } 00069 00070 public void setPosition(float x, float y, float z) { 00071 this.trafoMatrix[3]=x; 00072 this.trafoMatrix[7]=y; 00073 this.trafoMatrix[11]=z; 00074 } 00075 00076 public void setDimensions(float xdim, float ydim, float zdim) { 00077 this.xdim=xdim; 00078 this.ydim=ydim; 00079 this.zdim=zdim; 00080 } 00081 00082 public ItemModel getModel() { 00083 return model; 00084 } 00085 00086 public void setModel(ItemModel m) { 00087 model = m; 00088 } 00089 }