org.jcae.viewer3d.fd
Class PL02BranchGroup

java.lang.Object
  extended by javax.media.j3d.SceneGraphObject
      extended by javax.media.j3d.Node
          extended by javax.media.j3d.Group
              extended by javax.media.j3d.BranchGroup
                  extended by org.jcae.viewer3d.fd.PL02BranchGroup

public class PL02BranchGroup
extends javax.media.j3d.BranchGroup


Nested Class Summary
 class PL02BranchGroup.BehindShape
          Class named like this because the quads will always show behind the edges
protected static class PL02BranchGroup.EdgeLine
          Each EdgeLine object reports all edges along a particular infinite line This line is parallel to one of the axis, thus defined by: - Its direction: X, Y, or Z - The constant values in the other 2 directions Ex: X line defined by Y=5, Z=2 The values for the constants are indices in the grid array, thus integers Alongside each line, a certain number of edges can be defined.
protected static class PL02BranchGroup.NioLineArray
          Overloads the quad array and implements ref to double translation for Picking
protected static class PL02BranchGroup.NioQuadArray
          Overloads the quad array and implements ref to double translation for Picking
protected  class PL02BranchGroup.SelectionEdge
           
protected  class PL02BranchGroup.SelectionQuad
           
 
Field Summary
protected  java.util.ArrayList<javax.media.j3d.Shape3D> allEdgeShapes
           
protected  java.util.ArrayList<PL02BranchGroup.SelectionEdge> edgeSelection
           
protected  javax.media.j3d.Shape3D edgeSelectionShape
           
protected static int PICK_EDGES
           
protected static int PICK_FACES
           
protected static int PICK_VERTICES
           
protected  int pickType
           
protected  FDProvider provider
           
protected  java.util.ArrayList<PL02BranchGroup.SelectionQuad> selection
           
protected  javax.media.j3d.Shape3D selectionShape
           
 
Fields inherited from class javax.media.j3d.BranchGroup
ALLOW_DETACH
 
Fields inherited from class javax.media.j3d.Group
ALLOW_CHILDREN_EXTEND, ALLOW_CHILDREN_READ, ALLOW_CHILDREN_WRITE, ALLOW_COLLISION_BOUNDS_READ, ALLOW_COLLISION_BOUNDS_WRITE
 
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
 
Constructor Summary
PL02BranchGroup(FDProvider provider)
           
 
Method Summary
protected  void addEdge(java.util.HashMap<PL02BranchGroup.EdgeLine,PL02BranchGroup.EdgeLine> edges, PL02BranchGroup.EdgeLine line, int i, int j)
          Adds a new edge to a line, merging with other edges on this line if necessary
 float[] getColorForOrder(int order, int what)
          returns a color for a group/order and for a state
protected  int[] getGridCoordinate(float[] pt)
           
protected  PL02BranchGroup.EdgeLine getLine(Plate p, int dirnum, int idx)
          Gets the EdgeLine object corresponding to a plate edge
 void highlight(boolean on, java.lang.Object parameter)
          Handles highlighting for edges
protected  void makeGroups()
           
protected  void makeWires()
           
protected  void toggleSelectedEdge(boolean on, PL02BranchGroup.SelectionEdge se)
          Simple algorithm to add or remove an edge from the selection Ideas: 1.
protected  void toggleSelectedQuad(boolean on, PL02BranchGroup.SelectionQuad sq)
          Simple algorithm to add or remove a quad from the selection Ideas: 1.
 void update()
           
 
Methods inherited from class javax.media.j3d.BranchGroup
cloneNode, compile, detach, pickAll, pickAll, pickAllSorted, pickAllSorted, pickAny, pickAny, pickClosest, pickClosest
 
Methods inherited from class javax.media.j3d.Group
addChild, getAllChildren, getAlternateCollisionTarget, getChild, getCollisionBounds, indexOfChild, insertChild, moveTo, numChildren, removeAllChildren, removeChild, removeChild, setAlternateCollisionTarget, setChild, setCollisionBounds
 
Methods inherited from class javax.media.j3d.Node
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString, updateNodeReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

provider

protected FDProvider provider

allEdgeShapes

protected java.util.ArrayList<javax.media.j3d.Shape3D> allEdgeShapes

PICK_FACES

protected static final int PICK_FACES
See Also:
Constant Field Values

PICK_EDGES

protected static final int PICK_EDGES
See Also:
Constant Field Values

PICK_VERTICES

protected static final int PICK_VERTICES
See Also:
Constant Field Values

pickType

protected int pickType

selection

protected java.util.ArrayList<PL02BranchGroup.SelectionQuad> selection

edgeSelection

protected java.util.ArrayList<PL02BranchGroup.SelectionEdge> edgeSelection

selectionShape

protected javax.media.j3d.Shape3D selectionShape

edgeSelectionShape

protected javax.media.j3d.Shape3D edgeSelectionShape
Constructor Detail

PL02BranchGroup

public PL02BranchGroup(FDProvider provider)
Method Detail

update

public void update()

makeGroups

protected void makeGroups()

addEdge

protected void addEdge(java.util.HashMap<PL02BranchGroup.EdgeLine,PL02BranchGroup.EdgeLine> edges,
                       PL02BranchGroup.EdgeLine line,
                       int i,
                       int j)
Adds a new edge to a line, merging with other edges on this line if necessary

Parameters:
edges - : An EdgeLine map
a - line for this map, may already exist or not
i - first grid index for the nex edge on this line
j - second grid index for the nex edge on this line

getLine

protected PL02BranchGroup.EdgeLine getLine(Plate p,
                                           int dirnum,
                                           int idx)
Gets the EdgeLine object corresponding to a plate edge

Parameters:
p - : the plate for which an edge is wanted
dirnum - : the direction 1 or 2 of the plate
the - index in the other direction of the plate (p.min? and p.max? for the external edges)
Returns:
an EdgeLine with these characteristics

getColorForOrder

public float[] getColorForOrder(int order,
                                int what)
returns a color for a group/order and for a state

Parameters:
order - A color order number. This determines the base color (hue).
-2 => Wire
else group index
what - The goal for this color.
0 = unselected face.
1 = selected face.
2 = unselected internal edge
3 = selected internal edge
4 = unselected external edge
5 = selected external edge
6 = selected quad

toggleSelectedQuad

protected void toggleSelectedQuad(boolean on,
                                  PL02BranchGroup.SelectionQuad sq)
Simple algorithm to add or remove a quad from the selection Ideas: 1. Use one shape per quad => easy, but can become very fast too big to fit in memory. => pb: flicker when adding / removing because the scene is detached 2. Use only one shape, modify geometry TODO: pre-create an empty shape to avoid initial flicker

Parameters:
on -
p -
u -
v -
groupIdx2 -

toggleSelectedEdge

protected void toggleSelectedEdge(boolean on,
                                  PL02BranchGroup.SelectionEdge se)
Simple algorithm to add or remove an edge from the selection Ideas: 1. Use one shape per quad => easy, but can become very fast too big to fit in memory. => pb: flicker when adding / removing because the scene is detached 2. Use only one shape, modify geometry TODO: pre-create an empty shape to avoid initial flicker

Parameters:
on -
p -
u -
v -
groupIdx2 -

highlight

public void highlight(boolean on,
                      java.lang.Object parameter)
Handles highlighting for edges


getGridCoordinate

protected int[] getGridCoordinate(float[] pt)
Parameters:
pt -
Returns:
the grid coordinates for a given point

makeWires

protected void makeWires()