org.jzy3d.plot3d.primitives
Class AbstractDrawable
- java.lang.Object
-
- org.jzy3d.plot3d.primitives.AbstractDrawable
-
- All Implemented Interfaces:
- IGLRenderer, ISortableDraw
- Direct Known Subclasses:
- AbstractDrawableGraph2d, AbstractWireframeable, DrawableTexture, DrawableTextWrapper, DrawableVBO, Point, Scatter, ScatterMultiColor, ScatterMultiColorList, ScatterPoint
public abstract class AbstractDrawable extends java.lang.Object implements IGLRenderer, ISortableDraw
AAbstractDrawabledefines objects that may be rendered into an OpenGL context provided by aICanvas.
AAbstractDrawablemust basically provide a rendering function called draw() that receives a reference to a GL2 and a GLU context. It may also use a reference to a Camera in order to implement specific behaviors according to the Camera position.
AAbstractDrawableprovides services for setting the transformation factor that is used inside the draw function, as well as a getter of the object's BoundingBox3d. Note that the BoundingBox must be set by a concrete descendant of aAbstractDrawable.
A good practice is to define a setData function for initializing aAbstractDrawableand building its polygons. Since each class may have its own inputs, setData is not part of the interface but should be used as a convention. When not defining a setData function, aAbstractDrawablemay have its data loaded by anadd(Drawable)function.Note: A
AbstractDrawablemay last provide the information whether it is displayed or not, according to a rendering into the FeedBack buffer. This is currently supported specifically for theAxeBoxobject but could be extended with some few more algorithm for referencing all GL2 polygons.
-
-
Constructor Summary
Constructors Constructor and Description AbstractDrawable()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidaddDrawableListener(IDrawableListener listener)abstract voidapplyGeometryTransform(Transform transform)voiddispose()Performs all required operation to cleanup the Drawable.voiddoTransform(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam)abstract voiddraw(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam)Call OpenGL2 routines for rendering the object.Coord3dgetBarycentre()Return the barycentre of this object, which is computed as the center of its bounding box.ColorgetBoundingBoxColor()BoundingBox3dgetBounds()Return the BoundingBox of this object.doublegetDistance(Camera camera)Return the distance of the object center to theCamera's eye.ILegendgetLegend()doublegetLongestDistance(Camera camera)doublegetShortestDistance(Camera camera)SpaceTransformergetSpaceTransformer()TransformgetTransform()Get object's transformation that is applied at the beginning of a call todraw(GL,GLU,Camera).TransformgetTransformBefore()booleanhasLegend()booleanisBoundingBoxDisplayed()booleanisDisplayed()Return the display status of this object.booleanisLegendDisplayed()voidremoveDrawableListener(IDrawableListener listener)voidsetBoundingBoxColor(Color boundingBoxColor)voidsetBoundingBoxDisplayed(boolean boundingBoxDisplayed)voidsetDisplayed(boolean status)Set to true or false the displayed status of this object.voidsetLegend(ILegend face)voidsetLegendDisplayed(boolean status)voidsetSpaceTransformer(SpaceTransformer spaceTransformer)voidsetTransform(Transform transform)Set object's transformation that is applied at the beginning of a call todraw(GL,GLU,Camera).voidsetTransformBefore(Transform transformBefore)java.lang.StringtoString()java.lang.StringtoString(int depth)abstract voidupdateBounds()
-
-
-
Method Detail
-
dispose
public void dispose()
Performs all required operation to cleanup the Drawable.
-
draw
public abstract void draw(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam)Call OpenGL2 routines for rendering the object.- Specified by:
drawin interfaceIGLRenderer- Parameters:
gl- GL2 contextglu- GLU contextcam- a reference to a shooting Camera.
-
applyGeometryTransform
public abstract void applyGeometryTransform(Transform transform)
-
updateBounds
public abstract void updateBounds()
-
doTransform
public void doTransform(com.jogamp.opengl.GL gl, com.jogamp.opengl.glu.GLU glu, Camera cam)
-
setTransform
public void setTransform(Transform transform)
Set object's transformation that is applied at the beginning of a call todraw(GL,GLU,Camera).- Parameters:
transform-
-
getTransform
public Transform getTransform()
Get object's transformation that is applied at the beginning of a call todraw(GL,GLU,Camera).- Returns:
- transform
-
getTransformBefore
public Transform getTransformBefore()
-
setTransformBefore
public void setTransformBefore(Transform transformBefore)
-
getBounds
public BoundingBox3d getBounds()
Return the BoundingBox of this object.- Returns:
- a bounding box
-
getBarycentre
public Coord3d getBarycentre()
Return the barycentre of this object, which is computed as the center of its bounding box. If the bounding box is not available, the returned value isCoord3d.INVALID- Returns:
- the center of the bounding box, or
Coord3d.INVALID.
-
setDisplayed
public void setDisplayed(boolean status)
Set to true or false the displayed status of this object.- Parameters:
status-
-
isDisplayed
public boolean isDisplayed()
Return the display status of this object.
-
getDistance
public double getDistance(Camera camera)
Return the distance of the object center to theCamera's eye.- Specified by:
getDistancein interfaceISortableDraw
-
getShortestDistance
public double getShortestDistance(Camera camera)
- Specified by:
getShortestDistancein interfaceISortableDraw
-
getLongestDistance
public double getLongestDistance(Camera camera)
- Specified by:
getLongestDistancein interfaceISortableDraw
-
setLegend
public void setLegend(ILegend face)
-
getLegend
public ILegend getLegend()
-
hasLegend
public boolean hasLegend()
-
setLegendDisplayed
public void setLegendDisplayed(boolean status)
-
isLegendDisplayed
public boolean isLegendDisplayed()
-
isBoundingBoxDisplayed
public boolean isBoundingBoxDisplayed()
-
setBoundingBoxDisplayed
public void setBoundingBoxDisplayed(boolean boundingBoxDisplayed)
-
getBoundingBoxColor
public Color getBoundingBoxColor()
-
setBoundingBoxColor
public void setBoundingBoxColor(Color boundingBoxColor)
-
getSpaceTransformer
public SpaceTransformer getSpaceTransformer()
-
setSpaceTransformer
public void setSpaceTransformer(SpaceTransformer spaceTransformer)
-
addDrawableListener
public void addDrawableListener(IDrawableListener listener)
-
removeDrawableListener
public void removeDrawableListener(IDrawableListener listener)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(int depth)
-
-
DMelt 3.0 © DataMelt by jWork.ORG