00001 package de.tum.in.fipm.kipm.gui.visualisation.items;
00002
00003 import java.util.Vector;
00004 import edu.tum.cs.vis.Canvas;
00005 import edu.tum.cs.vis.items.Point;
00006
00007
00008
00009 public class Trajectories extends ItemBase{
00010 public float pointSize = 0.0f, sphereSize = 120.0f;
00011 public int pointColor = 0xffcbcbcb, sphereColor = 0x99ffff00;
00012 public int lineColor = 0xffffffff;
00013 public Vector<Point> pointsTraj;
00014 public Vector<Point> point;
00015 public int cont =0;
00016
00017 public Trajectories() {
00018 pointsTraj = new Vector<Point>();
00019 }
00020
00021 public void addTraj(float x, float y, float z) {
00022 pointsTraj.add(new Point(x, y, z, pointColor, pointSize));
00023 }
00024
00025 public void addPoint(float x, float y, float z, float radius){
00026 point.add(new Point(x,y,z,pointColor, pointSize));
00027 }
00028
00029 public void draw(Canvas c, int step) {
00030 c.pushMatrix();
00031
00032
00033 Point prev=null;
00034 c.sphereDetail(3);
00035
00036 for(Point p : pointsTraj) {
00037 p.draw(c);
00038
00039 if (cont<=0 && p.v.x!=0 ){
00040 prev=p;
00041
00042
00043 cont++;
00044 } else if (p.v.x !=0) {
00045
00046
00047 c.drawLine(prev.v, p.v, lineColor);
00048
00049
00050 prev = p;
00051
00052 } else if (p.v.x==0){
00053 cont=0;
00054
00055
00056 }
00057
00058 }
00059 c.sphereDetail(30);
00060 c.popMatrix();
00061 }
00062
00063 }