Class Graph

  • Direct Known Subclasses:
    MultithreadedGraph

    public class Graph
    extends Object
    The scene's Graph basically stores the scene content and facilitate objects control. The graph may decompose all Composite into a list of their Drawables 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 Drawable to the scene Graph and updates all views' viewpoint in order to target the center of the scene.
    Author:
    Martin Pernollet
    • 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)
      • add

        public void add​(List<? extends Drawable> drawables,
                        boolean updateViews)
      • add

        public void add​(List<? extends Drawable> drawables)
      • 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)
      • mountAllGLBindedResources

        public void mountAllGLBindedResources​(IPainter painter)
      • fireMountAll

        protected void fireMountAll()
      • 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 all AbstractComposites instance into a list of atomic Drawable types and return all the current Graph primitives decomposition.
      • project

        public void project​(IPainter painter,
                            Camera camera)
        Update all interactive Drawable projections
      • 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.
      • setClipBox

        public void setClipBox​(BoundingBox3d clipBox,
                               boolean includeLimits)
      • hasLegends

        public int hasLegends()
        Return true if the Graph contains at least one Drawable that has AWTLegend that must be displayed.
      • toString

        public String toString()
        Print out information concerning all Drawable of this composite.
        Overrides:
        toString in class Object
      • 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()