Class Composite

All Implemented Interfaces:
IMultiColorable, ISingleColorable, IGLBindedResource, IGLRenderer, ISortableDraw
Direct Known Subclasses:
Arrow, BarycenterAnnotation, Cone, ContourLevel, CubeComposite, Cylinder, EnlightableBar, FlatLine2d, HistogramBar, LineStripInterpolated, ParallelepipedComposite, Shape, TesselatedPolygon, TexturedCube, TexturedCylinder

public class Composite extends Wireframeable implements ISingleColorable, IMultiColorable, IGLBindedResource
A Composite gathers several Drawable and provides default methods managing them all in one call : drawing, getting bounds, setting face or wireframe colors, etc. Composites have the nice property of being decomposable (see Decomposition), meaning a scene
invalid @link
Graph
can take all items independently to sort them for optimized translucency rendering.
Author:
Martin Pernollet
  • Field Details

    • hasMountedOnce

      protected boolean hasMountedOnce
    • components

      protected List<Drawable> components
    • transform

      protected Transform transform
    • mapper

      protected ColorMapper mapper
    • color

      protected Color color
    • detailedToString

      protected boolean detailedToString
  • Constructor Details

    • Composite

      public Composite()
    • Composite

      public Composite(List<Drawable> drawables)
    • Composite

      public Composite(Drawable... drawables)
  • Method Details

    • canDecompose

      public boolean canDecompose()
      This indicate to a scene graph if the Composite consider it is worth being decomposed or not.
      Returns:
      will return true only if the Composite has face displayed (simply because decomposing wireframe-only drawable is useless)
    • mount

      public void mount(IPainter painter)
      Description copied from interface: IGLBindedResource
      Mount resources to gl context
      Specified by:
      mount in interface IGLBindedResource
    • hasMountedOnce

      public boolean hasMountedOnce()
      Description copied from interface: IGLBindedResource
      Return true if mount(...) has been called at least one time
      Specified by:
      hasMountedOnce in interface IGLBindedResource
    • add

      public void add(List<? extends Drawable> drawables)
      Append a list of Drawables to this composite.
    • add

      public void add(Drawable[] drawables)
    • clear

      public void clear()
      Clear the list of Drawables from this composite.
    • add

      public void add(Drawable drawable)
      Add a Drawable to this composite.
    • remove

      public void remove(Drawable drawable)
      Remove a Drawable from this composite.
    • get

      public Drawable get(int p)
      Get a Drawable stored by this composite.
    • getDrawables

      public List<Drawable> getDrawables()
    • size

      public int size()
      Return the number of Drawable stored by this composite.
    • draw

      public void draw(IPainter painter)
      Delegate rendering iteratively to all Drawable of this composite.
      Specified by:
      draw in interface IGLRenderer
      Specified by:
      draw in class Drawable
    • setTransform

      public void setTransform(Transform transform)
      Delegate transforming iteratively to all Drawable of this composite and stores the given transform for keeping the ability of retrieving it.
      Overrides:
      setTransform in class Drawable
    • setTransformBefore

      public void setTransformBefore(Transform transform)
      Overrides:
      setTransformBefore in class Drawable
    • setSpaceTransformer

      public void setSpaceTransformer(SpaceTransformer spaceTransformer)
      Overrides:
      setSpaceTransformer in class Drawable
    • getTransform

      public Transform getTransform()
      Return the transform that was affected to this composite.
      Overrides:
      getTransform in class Drawable
      Returns:
      transform
    • getBounds

      public BoundingBox3d getBounds()
      Creates and return a BoundingBox3d that embed all available Drawable bounds.
      Overrides:
      getBounds in class Drawable
      Returns:
      a bounding box
    • updateBounds

      public void updateBounds()
      Specified by:
      updateBounds in class Drawable
    • applyGeometryTransform

      public void applyGeometryTransform(Transform transform)
      Specified by:
      applyGeometryTransform in class Drawable
    • setWireframeColor

      public void setWireframeColor(Color color)
      Description copied from class: Wireframeable
      Set the wireframe color.
      Overrides:
      setWireframeColor in class Wireframeable
    • setWireframeColorFromPolygonPoints

      public void setWireframeColorFromPolygonPoints(boolean status)
      Overrides:
      setWireframeColorFromPolygonPoints in class Wireframeable
    • setWireframeDisplayed

      public void setWireframeDisplayed(boolean status)
      Description copied from class: Wireframeable
      Set the wireframe display status to on or off.
      Overrides:
      setWireframeDisplayed in class Wireframeable
    • setWireframeWidth

      public void setWireframeWidth(float width)
      Description copied from class: Wireframeable
      Set the wireframe width.
      Overrides:
      setWireframeWidth in class Wireframeable
    • setFaceDisplayed

      public void setFaceDisplayed(boolean status)
      Description copied from class: Wireframeable
      Set the face display status to on or off.
      Overrides:
      setFaceDisplayed in class Wireframeable
    • setDisplayed

      public void setDisplayed(boolean status)
      Description copied from class: Drawable
      Set to true or false the displayed status of this object.
      Overrides:
      setDisplayed in class Drawable
    • setPolygonOffsetFillEnable

      public void setPolygonOffsetFillEnable(boolean polygonOffsetFillEnable)
      A utility to change polygon offset fill status of a Composite containing Geometrys.
      Overrides:
      setPolygonOffsetFillEnable in class Wireframeable
      Parameters:
      polygonOffsetFillEnable - status
      composite -
    • setPolygonWireframeDepthTrick

      public void setPolygonWireframeDepthTrick(boolean polygonOffsetFillEnable)
      Description copied from class: Wireframeable
      May be used as alternative to Wireframeable.setPolygonOffsetFillEnable(boolean) in case it is not supported by underlying OpenGL version (Polygon offset appears as off version 2).
      Overrides:
      setPolygonWireframeDepthTrick in class Wireframeable
    • setReflectLight

      public void setReflectLight(boolean reflectLight)
      Description copied from class: Wireframeable
      If true, drawing this object will set ambient, diffuse, specular and shininess parameters. If the drawable has no normal defined, then the normal will be automatically processed.
      Overrides:
      setReflectLight in class Wireframeable
    • setMaterialAmbiantReflection

      public void setMaterialAmbiantReflection(Color materialAmbiantReflection)
      Overrides:
      setMaterialAmbiantReflection in class Wireframeable
    • setMaterialDiffuseReflection

      public void setMaterialDiffuseReflection(Color materialDiffuseReflection)
      Overrides:
      setMaterialDiffuseReflection in class Wireframeable
    • setMaterialSpecularReflection

      public void setMaterialSpecularReflection(Color materialSpecularReflection)
      Overrides:
      setMaterialSpecularReflection in class Wireframeable
    • setMaterialEmission

      public void setMaterialEmission(Color materialEmission)
      Overrides:
      setMaterialEmission in class Wireframeable
    • setMaterialShininess

      public void setMaterialShininess(float shininess)
      Overrides:
      setMaterialShininess in class Wireframeable
    • setColorMapper

      public void setColorMapper(ColorMapper mapper)
      Description copied from interface: IMultiColorable
      Set the colormapper that will be used by the Drawable, instead of using precomputed colors.
      Specified by:
      setColorMapper in interface IMultiColorable
    • getColorMapper

      public ColorMapper getColorMapper()
      Description copied from interface: IMultiColorable
      Get the colormapper.
      Specified by:
      getColorMapper in interface IMultiColorable
    • setColor

      public void setColor(Color color)
      Description copied from interface: ISingleColorable
      Set the color.
      Specified by:
      setColor in interface ISingleColorable
      Parameters:
      color - the color
    • getColor

      public Color getColor()
      Description copied from interface: ISingleColorable
      Get the color.
      Specified by:
      getColor in interface ISingleColorable
      Returns:
      color the color.
    • toString

      public String toString()
      Print out information concerning all Drawable of this composite.
      Overrides:
      toString in class Drawable
    • toString

      public String toString(int depth)
      Overrides:
      toString in class Drawable
    • isDetailedToString

      public boolean isDetailedToString()
    • setDetailedToString

      public void setDetailedToString(boolean detailedToString)
      When to true, the toString() method will give the detail of each element of this composite object in a tree like layout.