|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jzy3d.plot3d.primitives.AbstractDrawable
public abstract class AbstractDrawable
A AbstractDrawable
defines objects that may be rendered into an OpenGL
context provided by a ICanvas
.
A AbstractDrawable
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 AbstractDrawable
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 AbstractDrawable
.
A good practice is to define a setData function for initializing a AbstractDrawable
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 AbstractDrawable
may have its data loaded by
an add(Drawable)
function.
Note: A AbstractDrawable
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 AxeBox
object but could be extended with some few more
algorithm for referencing all GL2 polygons.
Field Summary | |
---|---|
protected BoundingBox3d |
bbox
|
protected boolean |
displayed
|
protected boolean |
hasListeners
|
protected Legend |
legend
|
protected boolean |
legendDisplayed
|
protected List<IDrawableListener> |
listeners
|
protected Transform |
transform
|
Constructor Summary | |
---|---|
AbstractDrawable()
|
Method Summary | |
---|---|
void |
addDrawableListener(IDrawableListener listener)
|
protected void |
call(javax.media.opengl.GL2 gl,
Color c)
|
protected void |
call(javax.media.opengl.GL2 gl,
Color c,
float alpha)
|
protected void |
callWithAlphaFactor(javax.media.opengl.GL2 gl,
Color c,
float alpha)
|
void |
dispose()
Performs all required operation to cleanup the Drawable. |
abstract void |
draw(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
Camera cam)
Call OpenGL2 routines for rendering the object. |
protected void |
fireDrawableChanged(DrawableChangedEvent e)
|
protected void |
fireDrawableChanged(int eventType)
|
Coord3d |
getBarycentre()
Return the barycentre of this object, which is computed as the center of its bounding box. |
BoundingBox3d |
getBounds()
Return the BoundingBox of this object. |
double |
getDistance(Camera camera)
Return the distance of the object center to the Camera 's eye. |
Legend |
getLegend()
|
double |
getLongestDistance(Camera camera)
|
double |
getShortestDistance(Camera camera)
|
Transform |
getTransform()
Get object's transformation that is applied at the beginning of a call to #draw(GL,GLU,Camera) . |
boolean |
hasLegend()
|
boolean |
isDisplayed()
Return the display status of this object. |
boolean |
isLegendDisplayed()
|
protected void |
negative(Color c)
|
void |
removeDrawableListener(IDrawableListener listener)
|
void |
setDisplayed(boolean status)
Set to true or false the displayed status of this object. |
void |
setLegend(Legend face)
|
void |
setLegendDisplayed(boolean status)
|
void |
setTransform(Transform transform)
Set object's transformation that is applied at the beginning of a call to #draw(GL,GLU,Camera) . |
String |
toString()
|
String |
toString(int depth)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Transform transform
protected BoundingBox3d bbox
protected Legend legend
protected List<IDrawableListener> listeners
protected boolean hasListeners
protected boolean displayed
protected boolean legendDisplayed
Constructor Detail |
---|
public AbstractDrawable()
Method Detail |
---|
public void dispose()
public abstract void draw(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, Camera cam)
draw
in interface IGLRenderer
gl
- GL2 contextglu
- GLU contextcam
- a reference to a shooting Camera.protected void call(javax.media.opengl.GL2 gl, Color c)
protected void call(javax.media.opengl.GL2 gl, Color c, float alpha)
protected void callWithAlphaFactor(javax.media.opengl.GL2 gl, Color c, float alpha)
protected void negative(Color c)
public void setTransform(Transform transform)
#draw(GL,GLU,Camera)
.
transform
- public Transform getTransform()
#draw(GL,GLU,Camera)
.
public BoundingBox3d getBounds()
public Coord3d getBarycentre()
Coord3d.INVALID
Coord3d.INVALID
.public void setDisplayed(boolean status)
status
- public boolean isDisplayed()
public double getDistance(Camera camera)
Camera
's eye.
getDistance
in interface ISortableDraw
public double getShortestDistance(Camera camera)
getShortestDistance
in interface ISortableDraw
public double getLongestDistance(Camera camera)
getLongestDistance
in interface ISortableDraw
public void setLegend(Legend face)
public Legend getLegend()
public boolean hasLegend()
public void setLegendDisplayed(boolean status)
public boolean isLegendDisplayed()
public void addDrawableListener(IDrawableListener listener)
public void removeDrawableListener(IDrawableListener listener)
protected void fireDrawableChanged(int eventType)
protected void fireDrawableChanged(DrawableChangedEvent e)
public String toString()
toString
in class Object
public String toString(int depth)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |