00001 package de.tum.in.fipm.kipm.gui.visualisation.items; 00002 00003 import javax.vecmath.Matrix4d; 00004 import javax.vecmath.Vector3d; 00005 00006 import edu.tum.cs.vis.Canvas; 00007 00011 public abstract class Item extends ItemBase { 00012 00013 Item(Matrix4d pose, Vector3d dim){ 00014 00015 this.trafoMatrix = new float[] { 00016 (float) pose.m00, (float) pose.m01, (float) pose.m02, (float) pose.m03, 00017 (float) pose.m10, (float) pose.m11, (float) pose.m12, (float) pose.m13, 00018 (float) pose.m20, (float) pose.m21, (float) pose.m22, (float) pose.m23, 00019 (float) pose.m30, (float) pose.m31, (float) pose.m32, (float) pose.m33 }; 00020 this.xdim=(float) dim.x; 00021 this.ydim=(float) dim.y; 00022 this.zdim=(float) dim.z; 00023 } 00024 00025 00026 public Item(float m00,float m01,float m02,float m03, 00027 float m10,float m11,float m12,float m13, 00028 float m20,float m21,float m22,float m23, 00029 float m30,float m31,float m32,float m33, 00030 float xdim, float ydim, float zdim){ 00031 00032 this.trafoMatrix = new float[] { 00033 m00, m01, m02, m03, 00034 m10, m11, m12, m13, 00035 m20, m21, m22, m23, 00036 m30, m31, m32, m33 }; 00037 this.xdim=xdim; 00038 this.ydim=ydim; 00039 this.zdim=zdim; 00040 } 00041 00042 00043 public Item(float m00,float m01,float m02,float m03, 00044 float m10,float m11,float m12,float m13, 00045 float m20,float m21,float m22,float m23, 00046 float m30,float m31,float m32,float m33, 00047 float xdim, float ydim, float zdim, int color){ 00048 00049 this( m00, m01, m02, m03, 00050 m10, m11, m12, m13, 00051 m20, m21, m22, m23, 00052 m30, m31, m32, m33, 00053 xdim, ydim, zdim); 00054 00055 this.color=color; 00056 } 00057 00058 00059 00060 @Override 00061 public void draw(Canvas c) { 00062 00063 c.noStroke(); 00064 c.pushMatrix(); 00065 00066 if(trafoMatrix != null) 00067 c.applyMatrix(trafoMatrix[0], trafoMatrix[1], trafoMatrix[2], trafoMatrix[3], 00068 trafoMatrix[4], trafoMatrix[5], trafoMatrix[6], trafoMatrix[7], 00069 trafoMatrix[8], trafoMatrix[9], trafoMatrix[10], trafoMatrix[11], 00070 trafoMatrix[12], trafoMatrix[13], trafoMatrix[14], trafoMatrix[15]); 00071 c.fill(colorOverride!=0 ? colorOverride : color); 00072 drawIt(c); 00073 00074 c.popMatrix(); 00075 } 00076 00077 00078 public void draw(Canvas c, int step) { 00079 draw(c); 00080 } 00081 00082 00083 protected abstract void drawIt(Canvas c); 00084 }