JavaView® v2.12

jv.project
Class PvPickEvent

java.lang.Object
  |
  +--jv.project.PvPickEvent

public final class PvPickEvent
extends java.lang.Object

Pick events on geometries sent to a pick listener from a display.

Version:
24.03.01, 1.70 revised (kp) Meaning of nearest vertex moved to m_vertex, new vertex m_viewBase instead.
02.12.00, 1.60 revised (kp) Store nearest vertex on the geometry too.
02.12.00, 1.55 revised (kp) Add methods get/set distance of picked vertex to geometry.
02.12.00, 1.50 revised (kp) Class no longer serializable.
03.07.00, 1.40 revised (kp) Cursor position of pick event added.
24.03.00, 1.30 revised (kp) Class no longer derived from PsObject but Object.
26.09.99, 1.20 revised (kp) Mark box added.
19.08.99, 1.10 revised (kp) Display added.
00.06.99, 1.00 created (kp)
Author:
Konrad Polthier
See Also:
PvPickListenerIf, PjProject, PvDisplayIf

Constructor Summary
PvPickEvent(int dim)
          Constructor with dimension of scene in display.
 
Method Summary
 PdBary getBary()
          Get barycentric coordinates inside the picked element.
 int getDimOfVertex()
          Get dimension of scene position of cursor in world coordinate of scene in display.
 double getDistance()
          Get distance of picked vertex to nearest position on geometry.
 int getElementInd()
          Get index of element in element array of picked geometry.
 int getElementSubInd()
          Get the index of a subtringle if element has more than three edges.
 int getElemInd()
          Deprecated: use #getElementInd() which provides the same functionality.
 PgGeometryIf getGeometry()
          Get the picked geometry, may be null.
 java.awt.Point getLocation()
          Get position of cursor in pixel coordinates of drawing canvas of event.
 PiVector getMarkBox()
          Get bounds of user dragged rectangle with four components in pixel coordinates.
 PdVector[] getMarkBoxWorld()
          Get bounds of user dragged rectangle with four components converted to world-coordinates.
 PdVector getNormal()
          Get normal vector at picked surface points.
 PvDisplayIf getSource()
          Get source display where this event occurred.
 PdVector getVertex()
          Get the point on the geometry nearest to the picked vertex, i.e. the intersection of the pick ray (viewBase,viewDir) with the geometry.
 int getVertexInd()
          Get index of vertex in vertex array of picked geometry if pick was close to a vertex.
 PdVector getVertexNearest()
          Deprecated. use getVertex()
 PdVector getViewBase()
          Get position of cursor in world coordinate of scene in display.
 PdVector getViewDir()
          Get normalized viewing direction as the vector pointing from the camera to its interest.
 void set(PdVector pos, int elemInd, int elemSubInd, PdBary bary)
          Convenient method to assign the four parameters of an event simultaneously.
 void setBary(PdBary bary)
          Set barycentric coordinates inside the picked element.
 void setDistance(double dist)
          Set distance of picked vertex to nearest position on geometry.
 void setElementInd(int elem)
          Set index of element in element array of picked geometry.
 void setElementSubInd(int elemSub)
          Set the index of a subtringle if element has more than three edges.
 void setGeometry(PgGeometryIf geom)
          Set the picked geometry from display, may be null.
 void setLocation(java.awt.Point pos)
          Set position of cursor in pixel coordinates of drawing canvas of event.
 void setMarkBox(PiVector box)
          Set bounds of user dragged rectangle with four components in pixel coordinates.
 void setMarkBoxWorld(PdVector[] box)
          Set bounds of user dragged rectangle with four components in world-coordinates.
 void setNormal(PdVector normal)
          Get normal vector at picked surface points.
 void setSource(PvDisplayIf disp)
          Set source display where this event occurred.
 void setVertex(PdVector vertex)
          Set the point on the geometry nearest to the picked vertex, i.e. the intersection of the pick ray (viewBase,viewDir) with the geometry.
 void setVertexInd(int ind)
          Set index of vertex in vertex array of picked geometry if pick was close to a vertex.
 void setVertexNearest(PdVector vertex)
          Deprecated. use setVertex(PdVector)
 void setViewBase(PdVector base)
          Set position of cursor in world coordinate of scene in display.
 void setViewDir(PdVector pos)
          Set viewing direction as the vector pointing from the camera to its interest.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PvPickEvent

public PvPickEvent(int dim)
Constructor with dimension of scene in display. Dimension is used for size of geometric vectors in world coordinates.
Parameters:
dim - Dimension of scene in display
Method Detail

getSource

public PvDisplayIf getSource()
Get source display where this event occurred.
Returns:
display where this event occurred

setSource

public void setSource(PvDisplayIf disp)
Set source display where this event occurred.
Parameters:
display - where this event occurred

getDimOfVertex

public int getDimOfVertex()
Get dimension of scene position of cursor in world coordinate of scene in display.
Returns:
Dimension of scene.

getGeometry

public PgGeometryIf getGeometry()
Get the picked geometry, may be null. A geometry must be the active geometry to receive a pick event. Return value may be null.
Returns:
picked geometry

setGeometry

public void setGeometry(PgGeometryIf geom)
Set the picked geometry from display, may be null. A geometry must be the active geometry to receive a pick event.
Parameters:
picked - geometry

getMarkBox

public PiVector getMarkBox()
Get bounds of user dragged rectangle with four components in pixel coordinates. Return value may be null.
Returns:
lower left and upper right corner of dragged rectangle in pixel coordinates

setMarkBox

public void setMarkBox(PiVector box)
Set bounds of user dragged rectangle with four components in pixel coordinates.
Parameters:
lower - left and upper right corner of dragged rectangle in pixel coordinates

getMarkBoxWorld

public PdVector[] getMarkBoxWorld()
Get bounds of user dragged rectangle with four components converted to world-coordinates. Return value may be null.
Returns:
lower left and upper right corner of dragged rectangle in world-coordinates

setMarkBoxWorld

public void setMarkBoxWorld(PdVector[] box)
Set bounds of user dragged rectangle with four components in world-coordinates.
Parameters:
lower - left and upper right corner of dragged rectangle in world-coordinates

getLocation

public java.awt.Point getLocation()
Get position of cursor in pixel coordinates of drawing canvas of event.
Returns:
Location of mouse cursor in 2d pixel coordinates

setLocation

public void setLocation(java.awt.Point pos)
Set position of cursor in pixel coordinates of drawing canvas of event.
Parameters:
Location - of mouse cursor in 2d pixel coordinates

getVertex

public PdVector getVertex()
Get the point on the geometry nearest to the picked vertex, i.e. the intersection of the pick ray (viewBase,viewDir) with the geometry. If the pick ray does not intersect a geometry, then the vertex is equal to the viewBase.
Returns:
World coordinates of the nearest point on the geometry.
See Also:
getViewBase(), getViewDir()

setVertex

public void setVertex(PdVector vertex)
Set the point on the geometry nearest to the picked vertex, i.e. the intersection of the pick ray (viewBase,viewDir) with the geometry. If the pick ray does not intersect a geometry, then the vertex should be the viewBase.
Parameters:
World - coordinates of the nearest point on the geometry.
See Also:
setViewBase(jv.vecmath.PdVector), setViewDir(jv.vecmath.PdVector)

getVertexNearest

public PdVector getVertexNearest()
Deprecated. use getVertex()

Get position of the point on the geometry nearest to the picked vertex. Return value may be null.
Returns:
World coordinates of the nearest point on the geometry.

setVertexNearest

public void setVertexNearest(PdVector vertex)
Deprecated. use setVertex(PdVector)

Set position of the point on the geometry nearest to the picked vertex.
Parameters:
World - coordinates of the nearest point on the geometry.

getVertexInd

public int getVertexInd()
Get index of vertex in vertex array of picked geometry if pick was close to a vertex. Return value -1 indicates that no vertex was close to pick position.
Returns:
index of a vertex

setVertexInd

public void setVertexInd(int ind)
Set index of vertex in vertex array of picked geometry if pick was close to a vertex. Return value -1 indicates that no vertex was close to pick position.
Parameters:
index - of a vertex

getDistance

public double getDistance()
Get distance of picked vertex to nearest position on geometry.
Returns:
distance of picked vertex to nearest position on geometry.

setDistance

public void setDistance(double dist)
Set distance of picked vertex to nearest position on geometry. Parameter value may be -1 indicating that no element has been picked.
Parameters:
distance - of picked vertex to nearest position on geometry.

getNormal

public PdVector getNormal()
Get normal vector at picked surface points. Return value may be null.
Returns:
World coordinates of normal vector in scene.

setNormal

public void setNormal(PdVector normal)
Get normal vector at picked surface points.
Parameters:
World - coordinates of normal vector in scene.

getBary

public PdBary getBary()
Get barycentric coordinates inside the picked element. If element has more that three edges then the barycentric coordinates in a subtriangle of the element is return. Return value may be null.
See Also:
#getElemSubInd

setBary

public void setBary(PdBary bary)
Set barycentric coordinates inside the picked element. If element has more that three edges then the barycentric coordinates in a subtriangle of the element are returned.
See Also:
#getElemSubInd

getElementInd

public int getElementInd()
Get index of element in element array of picked geometry. Return value -1 indicates that no element was picked.
Returns:
index of element

getElemInd

public int getElemInd()
Deprecated: use #getElementInd() which provides the same functionality.

setElementInd

public void setElementInd(int elem)
Set index of element in element array of picked geometry. Parameter value -1 indicates that no element was picked.
Parameters:
index - of element

getElementSubInd

public int getElementSubInd()
Get the index of a subtringle if element has more than three edges. The j-th subtriangle is spanned by element entries {[0],[j],[j+1]}.

setElementSubInd

public void setElementSubInd(int elemSub)
Set the index of a subtringle if element has more than three edges. The j-th subtriangle is spanned by element entries {[0],[j],[j+1]}.

getViewBase

public PdVector getViewBase()
Get position of cursor in world coordinate of scene in display. Return value may be null.
Returns:
World coordinates of mouse position in scene.
See Also:
getVertex(), getViewDir()

setViewBase

public void setViewBase(PdVector base)
Set position of cursor in world coordinate of scene in display.
Parameters:
World - coordinates of mouse position in scene.
See Also:
setViewDir(jv.vecmath.PdVector)

getViewDir

public PdVector getViewDir()
Get normalized viewing direction as the vector pointing from the camera to its interest.
Returns:
normalized viewing direction in world coordinates

setViewDir

public void setViewDir(PdVector pos)
Set viewing direction as the vector pointing from the camera to its interest. Length of vector is irrelevant.
Parameters:
viewing - direction in world coordinates

set

public void set(PdVector pos,
                int elemInd,
                int elemSubInd,
                PdBary bary)
Convenient method to assign the four parameters of an event simultaneously.
Parameters:
coordinates - of picked vertex
index - of picked element
index - of sub element
barycentric - coordinates inside an element

JavaView® v2.12

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