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
Modifier and TypeFieldDescriptionprotected BoundingBox3d
protected Color
protected boolean
protected boolean
protected boolean
protected ILegend
protected boolean
protected List<IDrawableListener>
protected SpaceTransformer
protected Transform
protected Transform
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDrawableListener
(IDrawableListener listener) abstract void
applyGeometryTransform
(Transform transform) void
dispose()
Performs all required operation to cleanup the Drawable.protected void
doDrawBoundsIfDisplayed
(IPainter painter) void
doTransform
(IPainter painter) abstract void
Call OpenGL2 routines for rendering the object.protected void
fireDrawableChanged
(int eventType) protected void
Return the barycentre of this object, which is computed as the center of its bounding box.Return the BoundingBox of this object.double
getDistance
(Camera camera) Return the distance of the object center to theCamera
's eye.double
getLongestDistance
(Camera camera) double
getShortestDistance
(Camera camera) Get object's transformation that is applied at the beginning of a call todraw(IPainter)
.boolean
boolean
boolean
Return the display status of this object.boolean
void
removeDrawableListener
(IDrawableListener listener) void
setBoundingBoxColor
(Color boundingBoxColor) void
setBoundingBoxDisplayed
(boolean boundingBoxDisplayed) void
setDisplayed
(boolean status) Set to true or false the displayed status of this object.void
void
setLegendDisplayed
(boolean status) void
setSpaceTransformer
(SpaceTransformer spaceTransformer) void
setTransform
(Transform transform) Set object's transformation that is applied at the beginning of a call todraw(IPainter)
.void
setTransformBefore
(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:
draw
in 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:
getDistance
in interfaceISortableDraw
-
getShortestDistance
- Specified by:
getShortestDistance
in interfaceISortableDraw
-
getLongestDistance
- Specified by:
getLongestDistance
in 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
-