org.jzy3d.plot3d.rendering.scene
Class Graph

java.lang.Object
  extended by org.jzy3d.plot3d.rendering.scene.Graph

public class Graph
extends Object

The scene's Graph basically stores the scene content and facilitate objects control The graph may decompose all AbstractComposite into a list of their AbstractDrawables primitives if constructor is called with parameters enabling sorting. The list of primitives is ordered using either the provided DefaultOrderingStrategy or an other specified AbstractOrderingStrategy. Sorting is usefull for handling transparency properly. The Graph maintains a reference to its mother Scene in order to inform the Views when its content has change and that repainting is required. The add() method allows adding a AbstractDrawable to the scene Graph and updates all views' viewpoint in order to target the center of the scene.

Author:
Martin Pernollet

Field Summary
protected  List<AbstractDrawable> components
           
protected  Scene scene
           
protected  boolean sort
           
protected  AbstractOrderingStrategy strategy
           
protected  Transform transform
           
protected  boolean VERBOSE
           
 
Constructor Summary
Graph(Scene scene)
           
Graph(Scene scene, AbstractOrderingStrategy strategy)
           
Graph(Scene scene, AbstractOrderingStrategy strategy, boolean sort)
           
Graph(Scene scene, boolean sort)
           
 
Method Summary
 void add(AbstractDrawable drawable)
           
 void add(AbstractDrawable drawable, boolean updateViews)
          Add a Drawable to the graph and call all views' so that they update their bounds according to their mode (automatic or manual).
 void add(List<? extends AbstractDrawable> drawables)
           
 void add(List<? extends AbstractDrawable> drawables, boolean updateViews)
           
 void dispose()
           
 void draw(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Camera camera)
          Decompose all AbstractComposite objects, and sort the extracted monotype (i.e. non-AbstractComposite AbstractDrawables) in order to render them according to the default -or defined- AbstractOrderingStrategy.
protected  void draw(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Camera camera, List<AbstractDrawable> components, boolean sort)
           
 List<AbstractDrawable> getAll()
           
 List<IGLBindedResource> getAllGLBindedResources()
           
 BoundingBox3d getBounds()
          Creates and return a BoundingBox3d that embed all Drawable bounds, among those that have a defined bounding box.
 List<Legend> getLegends()
          Return the list of available AbstractDrawable's Legend.
 AbstractOrderingStrategy getStrategy()
          Get the @Drawable ordering strategy.
 Transform getTransform()
          Return the transform that was affected to this composite.
 int hasLegends()
          Return true if the Graph contains at least one AbstractDrawable that has Legend that must be displayed.
 void mountAllGLBindedResources(javax.media.opengl.GL2 gl)
           
 void project(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Camera camera)
          Update all interactive AbstractDrawable projections
 boolean remove(AbstractDrawable drawable)
           
 boolean remove(AbstractDrawable drawable, boolean updateViews)
          Delete a Drawable from the SceneGraph and update all views' viewpoint in order to target the center of the scene.
 void setStrategy(AbstractOrderingStrategy strategy)
          Set the @Drawable ordering strategy.
 void setTransform(Transform transform)
          Delegate transforming iteratively to all Drawable of this graph and stores the given transform for keeping the ability of retrieving it.
 String toString()
          Print out information concerning all Drawable of this composite.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

components

protected List<AbstractDrawable> components

scene

protected Scene scene

transform

protected Transform transform

VERBOSE

protected boolean VERBOSE

strategy

protected AbstractOrderingStrategy strategy

sort

protected boolean sort
Constructor Detail

Graph

public Graph(Scene scene)

Graph

public Graph(Scene scene,
             boolean sort)

Graph

public Graph(Scene scene,
             AbstractOrderingStrategy strategy)

Graph

public Graph(Scene scene,
             AbstractOrderingStrategy strategy,
             boolean sort)
Method Detail

dispose

public void dispose()

add

public void add(AbstractDrawable drawable,
                boolean updateViews)
Add a Drawable to the graph and call all views' so that they update their bounds according to their mode (automatic or manual). Addition is to the graph is synchronized.

Parameters:
drawable: - The drawable that must be added to the scene graph.
update: - should be true if you wish to have all the views updated with old bounds including drawable bounds

add

public void add(AbstractDrawable drawable)

add

public void add(List<? extends AbstractDrawable> drawables,
                boolean updateViews)

add

public void add(List<? extends AbstractDrawable> drawables)

remove

public boolean remove(AbstractDrawable drawable,
                      boolean updateViews)
Delete a Drawable from the SceneGraph and update all views' viewpoint in order to target the center of the scene.

Parameters:
drawable - The drawable that must be deleted from the scene graph.

remove

public boolean remove(AbstractDrawable drawable)

getAll

public List<AbstractDrawable> getAll()

getAllGLBindedResources

public List<IGLBindedResource> getAllGLBindedResources()

mountAllGLBindedResources

public void mountAllGLBindedResources(javax.media.opengl.GL2 gl)

draw

public void draw(javax.media.opengl.GL2 gl,
                 javax.media.opengl.glu.GLU glu,
                 Camera camera)
Decompose all AbstractComposite objects, and sort the extracted monotype (i.e. non-AbstractComposite AbstractDrawables) in order to render them according to the default -or defined- AbstractOrderingStrategy.


draw

protected void draw(javax.media.opengl.GL2 gl,
                    javax.media.opengl.glu.GLU glu,
                    Camera camera,
                    List<AbstractDrawable> components,
                    boolean sort)

project

public void project(javax.media.opengl.GL2 gl,
                    javax.media.opengl.glu.GLU glu,
                    Camera camera)
Update all interactive AbstractDrawable projections


getStrategy

public AbstractOrderingStrategy getStrategy()
Get the @Drawable ordering strategy.


setStrategy

public void setStrategy(AbstractOrderingStrategy strategy)
Set the @Drawable ordering strategy.


setTransform

public void setTransform(Transform transform)
Delegate transforming iteratively to all Drawable of this graph and stores the given transform for keeping the ability of retrieving it.


getTransform

public Transform getTransform()
Return the transform that was affected to this composite.


getBounds

public BoundingBox3d getBounds()
Creates and return a BoundingBox3d that embed all Drawable bounds, among those that have a defined bounding box.


getLegends

public List<Legend> getLegends()
Return the list of available AbstractDrawable's Legend.


hasLegends

public int hasLegends()
Return true if the Graph contains at least one AbstractDrawable that has Legend that must be displayed.


toString

public String toString()
Print out information concerning all Drawable of this composite.

Overrides:
toString in class Object