public class Graph extends Object
Graph
basically stores the scene content and facilitate
objects control
The graph may decompose all AbstractComposite
into a list of their
AbstractDrawable
s 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 View
s 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.Modifier and Type | Field and Description |
---|---|
protected List<AbstractDrawable> |
components |
protected Scene |
scene |
protected boolean |
sort |
protected AbstractOrderingStrategy |
strategy |
protected TicToc |
t |
protected Transform |
transform |
protected boolean |
VERBOSE |
Constructor and Description |
---|
Graph(Scene scene) |
Graph(Scene scene,
AbstractOrderingStrategy strategy) |
Graph(Scene scene,
AbstractOrderingStrategy strategy,
boolean sort) |
Graph(Scene scene,
boolean sort) |
Modifier and Type | Method and Description |
---|---|
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(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
Camera camera)
Decompose all
AbstractComposite objects, and sort the extracted
monotype (i.e. non-AbstractComposite AbstractDrawable s)
in order to render them according to the default -or defined-
AbstractOrderingStrategy . |
protected void |
draw(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
Camera camera,
List<AbstractDrawable> components,
boolean sort) |
void |
drawDecomposition(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
Camera camera) |
void |
drawSimple(com.jogamp.opengl.GL gl,
com.jogamp.opengl.glu.GLU glu,
Camera camera,
List<AbstractDrawable> components) |
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<AbstractDrawable> |
getDecomposition()
Expand all
AbstractComposites instance into a list of atomic
AbstractDrawable types and return all the current Graph
primitives decomposition. |
List<ILegend> |
getLegends()
Return the list of available
AbstractDrawable 's AWTLegend
. |
AbstractOrderingStrategy |
getStrategy()
Get the
@Drawable ordering strategy. |
Transform |
getTransform()
Return the transform that was affected to this composite.
|
void |
glMatrixMode(com.jogamp.opengl.GL gl) |
int |
hasLegends()
Return true if the
Graph contains at least one
AbstractDrawable that has AWTLegend that must be
displayed. |
void |
mountAllGLBindedResources(com.jogamp.opengl.GL gl) |
void |
project(com.jogamp.opengl.GL gl,
com.jogamp.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.
|
protected TicToc t
protected List<AbstractDrawable> components
protected Scene scene
protected Transform transform
protected boolean VERBOSE
protected AbstractOrderingStrategy strategy
protected boolean sort
public Graph(Scene scene)
public Graph(Scene scene, boolean sort)
public Graph(Scene scene, AbstractOrderingStrategy strategy)
public Graph(Scene scene, AbstractOrderingStrategy strategy, boolean sort)
public void dispose()
public void add(AbstractDrawable drawable, boolean updateViews)
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 boundspublic void add(AbstractDrawable drawable)
public void add(List<? extends AbstractDrawable> drawables, boolean updateViews)
public void add(List<? extends AbstractDrawable> drawables)
public boolean remove(AbstractDrawable drawable, boolean updateViews)
drawable
- The drawable that must be deleted from the scene graph.public boolean remove(AbstractDrawable drawable)
public List<AbstractDrawable> getAll()
public List<IGLBindedResource> getAllGLBindedResources()
public void mountAllGLBindedResources(com.jogamp.opengl.GL gl)
public void draw(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera camera)
AbstractComposite
objects, and sort the extracted
monotype (i.e. non-AbstractComposite
AbstractDrawable
s)
in order to render them according to the default -or defined-
AbstractOrderingStrategy
.protected void draw(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera camera, List<AbstractDrawable> components, boolean sort)
public void glMatrixMode(com.jogamp.opengl.GL gl)
public void drawSimple(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera camera, List<AbstractDrawable> components)
public void drawDecomposition(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera camera)
public List<AbstractDrawable> getDecomposition()
AbstractComposites
instance into a list of atomic
AbstractDrawable
types and return all the current Graph
primitives decomposition.public void project(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera camera)
AbstractDrawable
projectionspublic AbstractOrderingStrategy getStrategy()
@Drawable
ordering strategy.public void setStrategy(AbstractOrderingStrategy strategy)
@Drawable
ordering strategy.public void setTransform(Transform transform)
public Transform getTransform()
public BoundingBox3d getBounds()
public List<ILegend> getLegends()
AbstractDrawable
's AWTLegend
.public int hasLegends()
Graph
contains at least one
AbstractDrawable
that has AWTLegend
that must be
displayed.Copyright © 2016. All rights reserved.