/*
|
* To change this template, choose Tools | Templates
|
* and open the template in the editor.
|
*/
|
import javax.media.opengl.GL;
|
import java.util.Hashtable;
|
|
/**
|
*
|
* @author nbriere
|
*/
|
public class PointFlow extends Object3D
|
{
|
static final long serialVersionUID = 0;
|
|
cList<cVector> points = new cList();
|
|
transient Hashtable<cVector, cVector> ht;
|
|
PointFlow()
|
{
|
super("Flow");
|
|
CreateMaterial();
|
|
live = true;
|
}
|
|
void CreateHT()
|
{
|
if (ht == null)
|
{
|
ht = new Hashtable();
|
|
cList<cVector> newpoints = new cList();
|
|
for (int i=0; i<points.size(); i++)
|
{
|
cVector w = points.get(i);
|
|
if (ht.get(w) != null)
|
continue;
|
|
newpoints.add(w);
|
ht.put(w, w);
|
}
|
|
points = newpoints;
|
}
|
}
|
|
void add(cVector v)
|
{
|
if (!live)
|
return;
|
|
CreateHT();
|
|
if (ht.get(v) != null)
|
return;
|
|
// if (points.size() > 0 && points.get(points.size()-1).equals(v))
|
// return;
|
|
System.err.println("new point = " + v);
|
points.add(v);
|
ht.put(v,v);
|
}
|
|
// void add(double x, double y, double z)
|
// {
|
// points.add(new cVector(x,y,z));
|
// }
|
|
void Reset()
|
{
|
if (points.size() > 0)
|
{
|
cVector v = points.get(0);
|
|
CameraPane.selectedpoint.toParent[3][0] = v.x;
|
CameraPane.selectedpoint.toParent[3][1] = v.y;
|
CameraPane.selectedpoint.toParent[3][2] = v.z;
|
}
|
|
points.clear();
|
ht.clear();
|
}
|
|
static Sphere geo = new Sphere();
|
|
static
|
{
|
geo.material = null;
|
geo.bRep.Stripify();
|
geo.bRep.colors = null;
|
}
|
|
float[] texmat = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };
|
|
double minimumSize = 0, maximumSize = 0.01;
|
double resizefactor = 1;
|
|
static cVector tmp = new cVector();
|
|
void createEditWindow(GroupEditor callee, boolean newWindow)
|
{
|
//editWindow = (new SphereEditor(this, deepCopy(), callee)).GetEditor();
|
if (newWindow)
|
{
|
objectUI = new PointFlowEditor(this, deepCopy(), callee);
|
} else
|
{
|
objectUI = new PointFlowEditor(this, callee);
|
}
|
editWindow = objectUI.GetEditor();
|
}
|
}
|