Package org.jzy3d.plot3d.rendering.scene
Class Graph
- java.lang.Object
-
- org.jzy3d.plot3d.rendering.scene.Graph
-
- Direct Known Subclasses:
MultithreadedGraph
public class Graph extends Object
The scene'sGraphbasically stores the scene content and facilitate objects control. The graph may decompose allCompositeinto a list of theirDrawables primitives if constructor is called with parameters enabling sorting. The list of primitives is ordered using either the providedDefaultOrderingStrategyor an other specifiedAbstractOrderingStrategy. Sorting is usefull for handling transparency properly. TheGraphmaintains a reference to its motherScenein order to inform theViews when its content has change and that repainting is required. The add() method allows adding aDrawableto the scene Graph and updates all views' viewpoint in order to target the center of the scene.- Author:
- Martin Pernollet
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGraph.GraphListener
-
Field Summary
Fields Modifier and Type Field Description protected static floatCLIP_MARGIN_RATIOprotected BoundingBox3dclipBoxprotected booleanclipIncludesLimitsprotected List<Drawable>componentsprotected List<Graph.GraphListener>graphListenerprotected Scenesceneprotected booleansortprotected AbstractOrderingStrategystrategyprotected Transformtransform
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(List<? extends Drawable> drawables)voidadd(List<? extends Drawable> drawables, boolean updateViews)voidadd(Drawable drawable)voidadd(Drawable 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).voidaddGraphListener(Graph.GraphListener graphListener)voiddispose()voiddraw(IPainter painter)Decompose allCompositeobjects, and sort the extracted monotype (i.e.voiddraw(IPainter painter, List<Drawable> components, boolean sort)voiddrawDecomposition(IPainter painter)render all items of the graph after decomposing all composite item into primitive drawablesvoiddrawSimple(IPainter painter, List<Drawable> components)render all items of the graphprotected voidfireMountAll()List<Drawable>getAll()List<IGLBindedResource>getAllGLBindedResources()BoundingBox3dgetBounds()Creates and return a BoundingBox3d that embed all Drawable bounds, among those that have a defined bounding box.BoundingBox3dgetClipBox()List<Drawable>getDecomposition()Expand allAbstractCompositesinstance into a list of atomicDrawabletypes and return all the current Graph primitives decomposition.List<Graph.GraphListener>getGraphListener()List<ILegend>getLegends()ScenegetScene()AbstractOrderingStrategygetStrategy()Get the {@link @Drawable} ordering strategy.TransformgetTransform()Return the transform that was affected to this composite.inthasLegends()booleanisSort()voidmountAllGLBindedResources(IPainter painter)voidproject(IPainter painter, Camera camera)Update all interactiveDrawableprojectionsbooleanremove(Drawable drawable)booleanremove(Drawable drawable, boolean updateViews)Delete a Drawable from the SceneGraph and update all views' viewpoint in order to target the center of the scene.voidsetClipBox(BoundingBox3d clipBox)voidsetClipBox(BoundingBox3d clipBox, boolean includeLimits)voidsetSort(boolean sort)Set sort to false to desactivate decomposition of drawable.voidsetStrategy(AbstractOrderingStrategy strategy)Set the {@link @Drawable} ordering strategy.voidsetTransform(Transform transform)Delegate transforming iteratively to all Drawable of this graph and stores the given transform for keeping the ability of retrieving it.StringtoString()Print out information concerning all Drawable of this composite.protected voidviewsShoot()protected voidviewsUpdateBounds()
-
-
-
Field Detail
-
scene
protected Scene scene
-
transform
protected Transform transform
-
strategy
protected AbstractOrderingStrategy strategy
-
sort
protected boolean sort
-
graphListener
protected List<Graph.GraphListener> graphListener
-
clipBox
protected BoundingBox3d clipBox
-
clipIncludesLimits
protected boolean clipIncludesLimits
-
CLIP_MARGIN_RATIO
protected static final float CLIP_MARGIN_RATIO
- See Also:
- Constant Field Values
-
-
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)
-
Graph
protected Graph()
-
-
Method Detail
-
dispose
public void dispose()
-
add
public void add(Drawable 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 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(Drawable drawable)
-
remove
public boolean remove(Drawable 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(Drawable drawable)
-
getAllGLBindedResources
public List<IGLBindedResource> getAllGLBindedResources()
-
mountAllGLBindedResources
public void mountAllGLBindedResources(IPainter painter)
-
fireMountAll
protected void fireMountAll()
-
getGraphListener
public List<Graph.GraphListener> getGraphListener()
-
addGraphListener
public void addGraphListener(Graph.GraphListener graphListener)
-
draw
public void draw(IPainter painter)
Decompose allCompositeobjects, and sort the extracted monotype (i.e. non-CompositeDrawables) in order to render them according to the default -or defined-AbstractOrderingStrategy.
-
drawSimple
public void drawSimple(IPainter painter, List<Drawable> components)
render all items of the graph
-
drawDecomposition
public void drawDecomposition(IPainter painter)
render all items of the graph after decomposing all composite item into primitive drawables
-
getDecomposition
public List<Drawable> getDecomposition()
Expand allAbstractCompositesinstance into a list of atomicDrawabletypes and return all the current Graph primitives decomposition.
-
project
public void project(IPainter painter, Camera camera)
Update all interactiveDrawableprojections
-
getStrategy
public AbstractOrderingStrategy getStrategy()
Get the {@link @Drawable} ordering strategy.
-
setStrategy
public void setStrategy(AbstractOrderingStrategy strategy)
Set the {@link @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.
-
getClipBox
public BoundingBox3d getClipBox()
-
setClipBox
public void setClipBox(BoundingBox3d clipBox)
-
setClipBox
public void setClipBox(BoundingBox3d clipBox, boolean includeLimits)
-
hasLegends
public int hasLegends()
-
toString
public String toString()
Print out information concerning all Drawable of this composite.
-
isSort
public boolean isSort()
-
setSort
public void setSort(boolean sort)
Set sort to false to desactivate decomposition of drawable. This bypass ranking polygons w.r.t. camera. This will produce visual cue if the scene is dynamic (changing the list of polygons or viewpoints).- Parameters:
sort-
-
getScene
public Scene getScene()
-
viewsUpdateBounds
protected void viewsUpdateBounds()
-
viewsShoot
protected void viewsShoot()
-
-