Package org.jzy3d.plot3d.primitives
Class Drawable
java.lang.Object
org.jzy3d.plot3d.primitives.Drawable
- All Implemented Interfaces:
IGLRenderer,ISortableDraw
- Direct Known Subclasses:
AbstractDrawableGraph2d,CoplanarityManager,DrawableImage,DrawableTextWrapper,DrawableVBO,MultiDrawable,Point,Scatter,ScatterMultiColor,ScatterMultiColorList,ScatterPoint,Texture3D,Volume,Wireframeable
A
function.
Note: A
Drawable defines objects that may be rendered into an OpenGL context provided by a
ICanvas.
A Drawable must 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.
A Drawable provides 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 a Drawable.
A good practice is to define a setData function for initializing a Drawable and 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, a Drawable may have
its data loaded by an
invalid @link
add(Drawable)
Drawable may last provide the information whether it is displayed or not,
according to a rendering into the FeedBack buffer. This is currently supported specifically for
the AxisBox object but could be extended with some few more algorithm for referencing all
GL2 polygons.- Author:
- Martin Pernollet
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BoundingBox3dprotected Colorprotected booleanprotected booleanprotected booleanprotected ILegendprotected booleanprotected List<IDrawableListener>protected SpaceTransformerprotected Transformprotected Transform -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDrawableListener(IDrawableListener listener) abstract voidapplyGeometryTransform(Transform transform) voiddispose()Performs all required operation to cleanup the Drawable.protected voiddoDrawBoundsIfDisplayed(IPainter painter) voiddoTransform(IPainter painter) abstract voidCall OpenGL2 routines for rendering the object.protected voidfireDrawableChanged(int eventType) protected voidReturn the barycentre of this object, which is computed as the center of its bounding box.Return the BoundingBox of this object.doublegetDistance(Camera camera) Return the distance of the object center to theCamera's eye.doublegetLongestDistance(Camera camera) doublegetShortestDistance(Camera camera) Get object's transformation that is applied at the beginning of a call todraw(IPainter).booleanbooleanbooleanReturn the display status of this object.booleanvoidremoveDrawableListener(IDrawableListener listener) voidsetBoundingBoxColor(Color boundingBoxColor) voidsetBoundingBoxDisplayed(boolean boundingBoxDisplayed) voidsetDisplayed(boolean status) Set to true or false the displayed status of this object.voidvoidsetLegendDisplayed(boolean status) voidsetSpaceTransformer(SpaceTransformer spaceTransformer) voidsetTransform(Transform transform) Set object's transformation that is applied at the beginning of a call todraw(IPainter).voidsetTransformBefore(Transform transformBefore) toString()toString(int depth) abstract void
-
Field Details
-
transform
-
transformBefore
-
bbox
-
legend
-
listeners
-
hasListeners
protected boolean hasListeners -
displayed
protected boolean displayed -
legendDisplayed
protected boolean legendDisplayed -
boundingBoxDisplayed
protected boolean boundingBoxDisplayed -
boundingBoxColor
-
spaceTransformer
-
-
Constructor Details
-
Drawable
public Drawable()
-
-
Method Details
-
dispose
public void dispose()Performs all required operation to cleanup the Drawable. -
draw
Call OpenGL2 routines for rendering the object.- Specified by:
drawin interfaceIGLRenderer
-
applyGeometryTransform
-
updateBounds
public abstract void updateBounds() -
doTransform
-
doDrawBoundsIfDisplayed
-
setTransform
Set object's transformation that is applied at the beginning of a call todraw(IPainter).- Parameters:
transform-
-
getTransform
Get object's transformation that is applied at the beginning of a call todraw(IPainter).- Returns:
- transform
-
getTransformBefore
-
setTransformBefore
-
getBounds
Return the BoundingBox of this object.- Returns:
- a bounding box
-
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 isinvalid @link
Coord3d.INVALID- Returns:
- the center of the bounding box, or
.
invalid @link
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
Return the distance of the object center to theCamera's eye.- Specified by:
getDistancein interfaceISortableDraw
-
getShortestDistance
- Specified by:
getShortestDistancein interfaceISortableDraw
-
getLongestDistance
- Specified by:
getLongestDistancein interfaceISortableDraw
-
setLegend
-
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
-
setBoundingBoxColor
-
getSpaceTransformer
-
setSpaceTransformer
-
addDrawableListener
-
removeDrawableListener
-
fireDrawableChanged
protected void fireDrawableChanged(int eventType) -
fireDrawableChanged
-
asWireframeable
-
toString
-
toString
-