MultiEllipse.java
Go to the documentation of this file.
00001 package edu.tum.cs.ias.knowrob.vis.items;
00002 
00003 import java.util.ArrayList;
00004 
00005 import edu.tum.cs.ias.knowrob.vis.Canvas;
00006 
00012 public class MultiEllipse extends ItemBase {
00013         private ArrayList<float[]> data;
00014         private ArrayList<Integer> colors;
00015         private float z;
00016         
00017         public MultiEllipse(float z)
00018         {
00019                 this.z = z;
00020                 colors = new ArrayList<Integer>();
00021                 data = new ArrayList<float[]>();
00022         }
00023         
00024         public void addEllipse(float x, float y, float xVar, float yVar, int color) {
00025                 this.colors.add(color);
00026                 this.data.add(new float[] {x,y,xVar,yVar});
00027         }
00028         
00029         public void addPoint(float x, float y, int color) {
00030                 this.colors.add(color);
00031                 this.data.add(new float[] {x,y,2.5f,2.5f});
00032         }
00033         
00034         @Override
00035         public void setColor(int color) {
00036         }
00037 
00038         @Override
00039         public void setColor(int color, int start, int end) {
00040         }
00041 
00042         public void draw(Canvas c, int step) {
00043                 c.pushMatrix();
00044                 if(trafoMatrix != null)
00045                         c.applyMatrix(trafoMatrix[0], trafoMatrix[1], trafoMatrix[2], trafoMatrix[3], 
00046                                         trafoMatrix[4], trafoMatrix[5], trafoMatrix[6], trafoMatrix[7], 
00047                                         trafoMatrix[8], trafoMatrix[9], trafoMatrix[10], trafoMatrix[11], 
00048                                         trafoMatrix[12], trafoMatrix[13], trafoMatrix[14], trafoMatrix[15]);
00049                 c.translate(0, 0, -z);
00050                 for(int i=0;i<colors.size();i++) {
00051                         if (drawSettings != null && drawSettings.getOverrideColor() != null)
00052                                 c.fill(drawSettings.getOverrideColor().getRed(), drawSettings.getOverrideColor().getGreen(), drawSettings.getOverrideColor().getBlue(), drawSettings.getOverrideColor().getAlpha());
00053                         else
00054                                 c.fill(colors.get(i));
00055                         c.ellipse(data.get(i)[0],data.get(i)[1],data.get(i)[2],data.get(i)[3]);
00056                 }
00057                 c.popMatrix();
00058         }
00059 
00060 }


mod_vis
Author(s): Moritz Tenorth, Jakob Engel
autogenerated on Mon Oct 6 2014 01:30:00