|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jzy3d.plot3d.rendering.view.View
public class View
A View
holds a Scene
, a LightSet
, an ICanvas
to render into. It is the responsability to layout a set of concrete
AbstractViewport
s such as the rendering the scene
or an ImageViewport
for displaying an image in the same window.
On can control the Camera
with a
and get notifyed by a IViewPointChangedListener
that the view point
has changed. The control is relative to the center of the Scene
and
is defined using polar coordinates.
The View
supports post rendering through the addition of
Renderer2d
s whose implementation can define Java2d calls to render on
top on OpenGL2.
Last, the View
offers the ability to get an AxeBox
for
embedding the Scene
and getting values along axes.
Field Summary | |
---|---|
protected IAxe |
axe
|
protected boolean |
axeBoxDisplayed
|
protected Color |
bgColor
|
protected BufferedImage |
bgImg
|
protected Color |
bgOverlay
|
protected ImageViewport |
bgViewport
|
protected ViewBoundMode |
boundmode
|
protected Camera |
cam
|
protected CameraMode |
cameraMode
|
protected ICanvas |
canvas
|
protected Coord3d |
center
|
protected static View |
current
|
static Coord3d |
DEFAULT_VIEW
|
protected boolean |
dimensionDirty
|
protected boolean |
DISPLAY_AXE_WHOLE_BOUNDS
|
protected javax.media.opengl.glu.GLU |
glu
|
protected boolean |
MAINTAIN_ALL_OBJECTS_IN_VIEW
|
protected com.jogamp.opengl.util.awt.Overlay |
overlay
|
protected static float |
PI_div2
|
protected Quality |
quality
|
protected List<Renderer2d> |
renderers
|
protected Coord3d |
scaling
|
protected Scene |
scene
|
protected boolean |
squared
|
static float |
STRETCH_RATIO
|
protected BoundingBox3d |
targetBox
|
protected List<ITooltipRenderer> |
tooltips
|
protected BoundingBox3d |
viewbounds
|
protected boolean |
viewDirty
can be set to true by the Renderer3d so that the View knows it is rendering due to a canvas size change |
protected ViewPositionMode |
viewmode
|
protected List<IViewIsVerticalEventListener> |
viewOnTopListeners
|
protected Coord3d |
viewpoint
|
protected List<IViewPointChangedListener> |
viewPointChangedListeners
|
protected boolean |
wasOnTopAtLastRendering
|
Constructor Summary | |
---|---|
View(Scene scene,
ICanvas canvas,
Quality quality)
Create a view attached to a Scene, with its own Camera and Axe. |
Method Summary | |
---|---|
void |
addRenderer2d(Renderer2d renderer)
|
void |
addTooltip(ITooltipRenderer tooltip)
|
void |
addTooltips(List<ITooltipRenderer> tooltip)
|
boolean |
addViewOnTopEventListener(IViewIsVerticalEventListener listener)
|
boolean |
addViewPointChangedListener(IViewPointChangedListener listener)
|
void |
clear(javax.media.opengl.GL2 gl)
Clear the color and depth buffer. |
void |
clearColorAndDepth(javax.media.opengl.GL2 gl)
|
void |
clearTooltips()
|
BoundingBox3d |
computeScaling()
|
protected void |
correctCameraPositionForIncludingTextLabels(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
ViewPort viewport)
|
static View |
current()
|
void |
dispose()
|
protected void |
fireViewOnTopEvent(boolean isOnTop)
|
protected void |
fireViewPointChangedEvent(ViewPointChangedEvent e)
|
IAxe |
getAxe()
|
Color |
getBackgroundColor()
|
BufferedImage |
getBackgroundImage()
|
BoundingBox3d |
getBounds()
Get the AxeBox 's BoundingBox3d |
ViewBoundMode |
getBoundsMode()
|
Camera |
getCamera()
|
CameraMode |
getCameraMode()
Get the projection of this view, either CameraMode.ORTHOGONAL or CameraMode.PERSPECTIVE. |
ICanvas |
getCanvas()
|
protected javax.media.opengl.GLAutoDrawable |
getCanvasAsGLAutoDrawable()
|
javax.media.opengl.GLContext |
getCurrentContext()
|
javax.media.opengl.GL2 |
getCurrentGL()
GL2 |
Coord3d |
getLastViewScaling()
|
void |
getMaximized()
|
Scale |
getScale()
|
Scene |
getScene()
|
Rectangle |
getSceneViewportRectangle()
|
boolean |
getSquared()
|
List<ITooltipRenderer> |
getTooltips()
|
ViewPositionMode |
getViewMode()
Return the ViewPositionMode applied to this view. |
Coord3d |
getViewPoint()
Get the viewpoint. |
void |
init(javax.media.opengl.GL2 gl)
The init function specifies general GL settings that impact the rendering quality and performance (computation speed). |
void |
initLights(javax.media.opengl.GL2 gl)
|
void |
initQuality(javax.media.opengl.GL2 gl)
|
boolean |
isAxeBoxDisplayed()
|
void |
lookToBox(BoundingBox3d box)
Set the surrounding AxeBox dimensions and the Camera target, and the colorbar range. |
void |
project()
|
Coord3d |
projectMouse(int x,
int y)
|
void |
removeRenderer2d(Renderer2d renderer)
|
boolean |
removeViewOnTopEventListener(IViewIsVerticalEventListener listener)
|
boolean |
removeViewPointChangedListener(IViewPointChangedListener listener)
|
void |
render(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu)
|
void |
renderAxeBox(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu)
|
void |
renderBackground(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
float left,
float right)
|
void |
renderBackground(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
ViewPort viewport)
|
void |
renderOverlay(javax.media.opengl.GL2 gl)
|
void |
renderOverlay(javax.media.opengl.GL2 gl,
ViewPort viewport)
Renders all provided Tooltip s and Renderer2d s on top of
the scene. |
void |
renderScene(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu)
|
void |
renderScene(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
float left,
float right)
|
void |
renderScene(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
ViewPort viewport)
|
void |
renderSceneGraph(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu)
|
void |
renderSceneGraph(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
boolean light)
|
void |
rotate(Coord2d move)
GENERAL DISPLAY CONTROLS |
void |
rotate(Coord2d move,
boolean updateView)
|
void |
setAxe(AxeBox ax)
CONTROLS ANNOTATIONS & GENERAL RENDERING |
void |
setAxeBoxDisplayed(boolean axeBoxDisplayed)
|
void |
setBackgroundColor(Color color)
|
void |
setBackgroundImage(BufferedImage i)
Set a buffered image, or null to desactivate background image |
void |
setBoundManual(BoundingBox3d bounds)
Set a manual bounding box and switch the bounding mode to {ViewBoundMode.MANUAL}, meaning that any call to updateBounds()
will update view bounds to the current bounds. |
void |
setBoundMode(ViewBoundMode mode)
Select between an automatic bounding (that allows fitting the entire scene graph), or a custom bounding. |
void |
setCameraMode(CameraMode mode)
Set the projection of this view, either Camera.ORTHOGONAL or Camera.PERSPECTIVE. |
void |
setMaximized(boolean status)
|
void |
setScale(Scale scale)
|
void |
setScale(Scale scale,
boolean notify)
|
void |
setSquared(boolean status)
|
void |
setTooltip(ITooltipRenderer tooltip)
|
void |
setTooltips(List<ITooltipRenderer> tooltip)
|
void |
setViewPoint(Coord3d polar)
|
void |
setViewPoint(Coord3d polar,
boolean updateView)
Set the viewpoint using polar coordinates relative to the target (i.e. |
void |
setViewPositionMode(ViewPositionMode mode)
Set the ViewPositionMode applied to this view. |
void |
shift(float factor)
|
void |
shift(float factor,
boolean updateView)
|
void |
shoot()
Current view selection into the mother Scene, and call to target canvas rendering. |
protected Coord3d |
squarify()
Return a 3d scaling factor that allows scaling the scene into a square box, according to the current ViewBoundMode. |
void |
updateBounds()
Set the bounds of the view according to the current ViewBoundMode
, and orders a Camera.shoot() . |
void |
updateBoundsForceUpdate(boolean refresh)
Update the bounds according to the scene graph whatever is the current ViewBoundMode , and orders a Camera.shoot() |
void |
updateCamera(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
ViewPort viewport,
BoundingBox3d boundsScaled)
|
void |
updateCamera(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu,
ViewPort viewport,
BoundingBox3d boundsScaled,
float sceneRadiusScaled)
|
void |
updateQuality(javax.media.opengl.GL2 gl)
|
void |
zoom(float factor)
|
void |
zoom(float factor,
boolean updateView)
|
void |
zoomX(float factor)
|
void |
zoomX(float factor,
boolean updateView)
|
void |
zoomY(float factor)
|
void |
zoomY(float factor,
boolean updateView)
|
void |
zoomZ(float factor)
|
void |
zoomZ(float factor,
boolean updateView)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.media.opengl.glu.GLU glu
public static float STRETCH_RATIO
protected boolean MAINTAIN_ALL_OBJECTS_IN_VIEW
protected boolean DISPLAY_AXE_WHOLE_BOUNDS
protected boolean axeBoxDisplayed
protected boolean squared
protected Camera cam
protected IAxe axe
protected Quality quality
protected com.jogamp.opengl.util.awt.Overlay overlay
protected Scene scene
protected ICanvas canvas
protected Coord3d viewpoint
protected Coord3d center
protected Coord3d scaling
protected BoundingBox3d viewbounds
protected CameraMode cameraMode
protected ViewPositionMode viewmode
protected ViewBoundMode boundmode
protected ImageViewport bgViewport
protected BufferedImage bgImg
protected BoundingBox3d targetBox
protected Color bgColor
protected Color bgOverlay
protected List<ITooltipRenderer> tooltips
protected List<Renderer2d> renderers
protected List<IViewPointChangedListener> viewPointChangedListeners
protected List<IViewIsVerticalEventListener> viewOnTopListeners
protected boolean wasOnTopAtLastRendering
protected static final float PI_div2
public static final Coord3d DEFAULT_VIEW
protected boolean dimensionDirty
protected boolean viewDirty
protected static View current
Constructor Detail |
---|
public View(Scene scene, ICanvas canvas, Quality quality)
View.DEFAULT_VIEW
.
The Quality
allows setting the rendering capabilities that are
set one time by the init() method.
Method Detail |
---|
public void dispose()
public void shoot()
public void project()
public Coord3d projectMouse(int x, int y)
public void rotate(Coord2d move)
public void rotate(Coord2d move, boolean updateView)
public void shift(float factor)
public void shift(float factor, boolean updateView)
public void zoom(float factor)
public void zoom(float factor, boolean updateView)
public void zoomX(float factor)
public void zoomX(float factor, boolean updateView)
public void zoomY(float factor)
public void zoomY(float factor, boolean updateView)
public void zoomZ(float factor)
public void zoomZ(float factor, boolean updateView)
public void setScale(Scale scale)
public void setScale(Scale scale, boolean notify)
public Scale getScale()
public void lookToBox(BoundingBox3d box)
public BoundingBox3d getBounds()
AxeBox
's BoundingBox3d
public ViewBoundMode getBoundsMode()
public void setViewPositionMode(ViewPositionMode mode)
ViewPositionMode
applied to this view.
public ViewPositionMode getViewMode()
ViewPositionMode
applied to this view.
public void setViewPoint(Coord3d polar, boolean updateView)
public void setViewPoint(Coord3d polar)
public Coord3d getViewPoint()
public Coord3d getLastViewScaling()
public void setAxe(AxeBox ax)
public IAxe getAxe()
public boolean getSquared()
public void setSquared(boolean status)
public boolean isAxeBoxDisplayed()
public void setAxeBoxDisplayed(boolean axeBoxDisplayed)
public void setBackgroundColor(Color color)
public Color getBackgroundColor()
public void setBackgroundImage(BufferedImage i)
public BufferedImage getBackgroundImage()
public Camera getCamera()
public void setCameraMode(CameraMode mode)
public CameraMode getCameraMode()
public void getMaximized()
public void setMaximized(boolean status)
public Scene getScene()
public Rectangle getSceneViewportRectangle()
public void clearTooltips()
public void setTooltip(ITooltipRenderer tooltip)
public void addTooltip(ITooltipRenderer tooltip)
public void setTooltips(List<ITooltipRenderer> tooltip)
public void addTooltips(List<ITooltipRenderer> tooltip)
public List<ITooltipRenderer> getTooltips()
public ICanvas getCanvas()
public void addRenderer2d(Renderer2d renderer)
public void removeRenderer2d(Renderer2d renderer)
public boolean addViewOnTopEventListener(IViewIsVerticalEventListener listener)
public boolean removeViewOnTopEventListener(IViewIsVerticalEventListener listener)
protected void fireViewOnTopEvent(boolean isOnTop)
public boolean addViewPointChangedListener(IViewPointChangedListener listener)
public boolean removeViewPointChangedListener(IViewPointChangedListener listener)
protected void fireViewPointChangedEvent(ViewPointChangedEvent e)
public void setBoundMode(ViewBoundMode mode)
public void updateBounds()
ViewBoundMode
, and orders a Camera.shoot()
.
public void updateBoundsForceUpdate(boolean refresh)
ViewBoundMode
, and orders a Camera.shoot()
public void setBoundManual(BoundingBox3d bounds)
updateBounds()
will update view bounds to the current bounds.
protected Coord3d squarify()
public javax.media.opengl.GL2 getCurrentGL()
public javax.media.opengl.GLContext getCurrentContext()
protected javax.media.opengl.GLAutoDrawable getCanvasAsGLAutoDrawable()
public void init(javax.media.opengl.GL2 gl)
Quality
instance given in
the constructor parameters.
public void initQuality(javax.media.opengl.GL2 gl)
public void initLights(javax.media.opengl.GL2 gl)
public void clear(javax.media.opengl.GL2 gl)
public void clearColorAndDepth(javax.media.opengl.GL2 gl)
public void render(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu)
public void renderBackground(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, float left, float right)
public void renderBackground(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, ViewPort viewport)
public void renderScene(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu)
public void renderScene(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, float left, float right)
public void renderScene(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, ViewPort viewport)
public void updateQuality(javax.media.opengl.GL2 gl)
public BoundingBox3d computeScaling()
public void updateCamera(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, ViewPort viewport, BoundingBox3d boundsScaled)
public void updateCamera(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, ViewPort viewport, BoundingBox3d boundsScaled, float sceneRadiusScaled)
public void renderAxeBox(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu)
public void renderSceneGraph(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu)
public void renderSceneGraph(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, boolean light)
public void renderOverlay(javax.media.opengl.GL2 gl)
public void renderOverlay(javax.media.opengl.GL2 gl, ViewPort viewport)
Tooltip
s and Renderer2d
s on top of
the scene.
Due to the behaviour of the Overlay
implementation, Java2d
geometries must be drawn relative to the Chart
's
IScreenCanvas
, BUT will then be stretched to fit in the
Camera
's viewport. This bug is very important to consider, since
the Camera's viewport may not occupy the full IScreenCanvas
.
Indeed, when View is not maximized (like the default behaviour), the
viewport remains square and centered in the canvas, meaning the Overlay
won't cover the full canvas area.
In other words, the following piece of code draws a border around the
View
, and not around the complete chart canvas, although queried
to occupy chart canvas dimensions:
g2d.drawRect(1, 1, chart.getCanvas().getRendererWidth()-2,
chart.getCanvas().getRendererHeight()-2);
renderOverlay()
must be called while the OpenGL2 context for the
drawable is current, and after the OpenGL2 scene has been rendered.
protected void correctCameraPositionForIncludingTextLabels(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu, ViewPort viewport)
public static View current()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |