JavaView© v3.95.000

vgp.tutor.eventCamera
Class PjEventCamera

java.lang.Object
  extended byjv.object.PsObject
      extended byjv.project.PjProject
          extended byvgp.tutor.eventCamera.PjEventCamera
All Implemented Interfaces:
java.lang.Cloneable, PsTimeListenerIf, PsUpdateIf, PvCameraListenerIf, PvPickListenerIf, java.io.Serializable

public class PjEventCamera
extends PjProject
implements PvCameraListenerIf

Demo project shows how to handle camera events issued from a JavaView display. In this example the events are used to steer the camera in a second window.

The camera events from one window are used to steer the camera in the other window such that a stereo effect is produced. Note, the viewing direction of the left camera is slightly rotated around the up-vector of the camera by about 6 degrees.

See Also:
PvCameraEvent, PvCameraListenerIf, PvDisplayIf, Serialized Form

Field Summary
static int STEREO_CROSS
          Cross eye stereo projection.
static int STEREO_PARALLEL
          Parallel eye stereo projection.
static int STEREO_REDGREEN
          Red green painting of stereo projection.
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
 
Constructor Summary
PjEventCamera()
           
 
Method Summary
 void dragCamera(PvCameraEvent pos)
          Get camera events resulting from dragging the mouse.
 PvDisplayIf getLeftDisplay()
           
 PvDisplayIf getRightDisplay()
           
 int getStereoType()
          Get type of stereo projection.
 void init()
          Initialize and reset project, stops the running animation if any.
 void pickCamera(PvCameraEvent pos)
          Get camera events resulting from picking the mouse.
 void reset()
           
 void setStereoType(int type)
          Set type of stereo projection.
 void start()
          Method is invoked during loading of a project in JavaView.
 boolean update(java.lang.Object event)
          Event handling method in the update mechanism.
 
Methods inherited from class jv.project.PjProject
addDisplay, addGeometry, addGeometry, dispose, dragDisplay, dragInitial, dragVertex, fitDisplays, getAnimation, getDisplay, getDisplays, getGeometry, getGeometry, getNumGeometries, getParameter, getViewer, hasAnimation, hasDisplay, isEnabledAutoFit, markVertices, pickDisplay, pickInitial, pickVertex, removeDisplay, removeGeometries, removeGeometry, selectDisplay, selectGeometry, setAnimation, setBackColor, setBorderType, setDisplay, setEnabledAutoFit, setGeometry, setParameter, setTime, setViewer, stop, unmarkVertices
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.project.PvCameraListenerIf
getName
 
Methods inherited from interface jv.anim.PsTimeListenerIf
getName
 
Methods inherited from interface jv.project.PvPickListenerIf
getName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent
 

Field Detail

STEREO_CROSS

public static final int STEREO_CROSS
Cross eye stereo projection.

See Also:
Constant Field Values

STEREO_PARALLEL

public static final int STEREO_PARALLEL
Parallel eye stereo projection.

See Also:
Constant Field Values

STEREO_REDGREEN

public static final int STEREO_REDGREEN
Red green painting of stereo projection.

See Also:
Constant Field Values
Constructor Detail

PjEventCamera

public PjEventCamera()
Method Detail

init

public void init()
Description copied from class: PjProject
Initialize and reset project, stops the running animation if any. Does not reset any registered display nor geometry. They must be reset individually in each subclass.

Overrides:
init in class PjProject

start

public void start()
Description copied from class: PjProject
Method is invoked during loading of a project in JavaView.

If a project has an animation object, then the animation panel is shown when the project's this start() method is invoked during loading of the project. Use setAnimation(PsAnimation) to register an animation.

If auto fit is enabled then scenery is scaled to fit in each display.

Overrides:
start in class PjProject
See Also:
PvViewerIf.start(), PjProject.isEnabledAutoFit()

reset

public void reset()

update

public boolean update(java.lang.Object event)
Description copied from interface: PsUpdateIf
Event handling method in the update mechanism. Events not handled will be passed to m_parent or super in this sequence.

Specified by:
update in interface PsUpdateIf
Overrides:
update in class PsObject
See Also:
PsObject.setParent(PsUpdateIf), PsObject.getFather(), PsObject.addUpdateListener(PsUpdateIf)

getRightDisplay

public PvDisplayIf getRightDisplay()

getLeftDisplay

public PvDisplayIf getLeftDisplay()

getStereoType

public int getStereoType()
Get type of stereo projection.

Returns:
stereo projection type, see STEREO_CROSS and similar.

setStereoType

public void setStereoType(int type)
Set type of stereo projection.

Parameters:
type - stereo projection type, see STEREO_CROSS and similar.

pickCamera

public void pickCamera(PvCameraEvent pos)
Get camera events resulting from picking the mouse. Use information about camera in one display to adjust the camera in the other window. But previously rotate the camera position around the line given by interest+t*upVector by -6 degrees.

Specified by:
pickCamera in interface PvCameraListenerIf
Parameters:
pos - Pick event issued by the display
See Also:
PvCameraListenerIf

dragCamera

public void dragCamera(PvCameraEvent pos)
Get camera events resulting from dragging the mouse. This method just calls the method pickCamera which does all the work.

Specified by:
dragCamera in interface PvCameraListenerIf
Parameters:
pos - Drag event issued by the display
See Also:
PvCameraListenerIf

JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.