de.jreality.tutorial.util.polygon
Class DragPointSet

java.lang.Object
  extended by de.jreality.tutorial.util.polygon.DragPointSet
All Implemented Interfaces:
PointSequence

public class DragPointSet
extends java.lang.Object
implements PointSequence

A sequence of points that can be dragged. Reports any changes of the point positions to ChangeListeners that can be attached via addChangeListener(ChangeListener). The points are stored in an array of double-arrays with length 3. To use, create an instance and attach it's base (getBase() into the scene. Attach a ChangeListener to handle dragging.

Author:
Steffen Weissmann.

Constructor Summary
DragPointSet(double[][] initialVertices)
           
 
Method Summary
 void addChangeListener(javax.swing.event.ChangeListener cl)
           
 SceneGraphComponent getBase()
          Returns the SceneGraphComponent containing the point geometry as well as the tool to drag the points.
 double[][] getPoints()
          Returns the points as an array of 3-vectors (double arrays with length 3).
 boolean isClosed()
          true if the point sequence is periodic, false if not.
 void pointDragged(PointDragEvent e)
           
 void removeChangeListener(javax.swing.event.ChangeListener cl)
           
 void setClosed(boolean closed)
          set if the point sequence should be interpreted as periodic.
 void transform(double[] vertex)
          Override this method and do a transformation of the dragged vertex, e.g., projection to the sphere.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DragPointSet

public DragPointSet(double[][] initialVertices)
Parameters:
initialVertices - the initial points.
Method Detail

pointDragged

public void pointDragged(PointDragEvent e)

transform

public void transform(double[] vertex)
Override this method and do a transformation of the dragged vertex, e.g., projection to the sphere.

Parameters:
vertex -

getBase

public SceneGraphComponent getBase()
Returns the SceneGraphComponent containing the point geometry as well as the tool to drag the points.

Returns:
the base component

getPoints

public double[][] getPoints()
Returns the points as an array of 3-vectors (double arrays with length 3).

Specified by:
getPoints in interface PointSequence
Returns:
the points

isClosed

public boolean isClosed()
true if the point sequence is periodic, false if not. This is for instance used when rendering the point sequence as a line.

Specified by:
isClosed in interface PointSequence

setClosed

public void setClosed(boolean closed)
set if the point sequence should be interpreted as periodic.

Parameters:
closed -

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener cl)
Specified by:
addChangeListener in interface PointSequence
Parameters:
A - listener that gets notified whenever the points change.

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener cl)