JavaView® v2.00.008

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:
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

Field Summary
protected  PdBary m_bary
          Barycentric coordinates of point in m_elemInd, or, if m_subElemInd!
protected  int m_dim
          Dimension of vertex in world coordinates.
protected  PvDisplayIf m_display
          Display where pick event occurred.
protected  double m_dist
          Distance of picked vertex to nearest position on geometry.
protected  int m_elemInd
          Element in geometry in which point lies.
protected  int m_elemSubInd
          If element has more than three vertices, then a subElement is specified.
protected  PgGeometryIf m_geom
          Geometry of point
protected  java.awt.Point m_location
          Position of cursor in pixel coordinates of drawing canvas.
protected  PiVector m_markBox
          Rectangle on the screen marked by user.
protected  PdVector[] m_markBoxWorld
          Set of vertices if user has selected a rectangular box on the screen.
protected  PdVector m_normal
          Normal vector at picked surface points.
protected  PdVector m_vertex
          Vertex representing the picked point, not a vertex of the geometry.
protected  int m_vertexInd
          Index of vertex of geometry representing close to the picked point.
protected  PdVector m_vertexNearest
          The position on the geometry which is nearest to the picked vertex.
protected  PdVector m_viewDir
          Direction under which this point was hit by the viewing ray.
 
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 position of cursor in world coordinate of scene in display.
 int getVertexInd()
          Get index of vector in vertex array of picked geometry.
 PdVector getVertexNearest()
          Get position of the point on the geometry nearest to the picked vertex.
 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 the four parameters of event simultanously.
 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 position of cursor in world coordinate of scene in display.
 void setVertexInd(int ind)
          Set index of vector in vertex array of picked geometry.
 void setVertexNearest(PdVector vertexNearest)
          Set position of the point on the geometry nearest to the picked vertex.
 void setViewDir(PdVector pos)
          Set viewing direction as the vector pointing from the camera to its interest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_display

protected PvDisplayIf m_display
Display where pick event occurred.

m_geom

protected PgGeometryIf m_geom
Geometry of point

m_dim

protected int m_dim
Dimension of vertex in world coordinates.

m_vertexInd

protected int m_vertexInd
Index of vertex of geometry representing close to the picked point. Note, this vertex of the geometry usually has different coodinates than the 3d-representation m_vertex of the picked point. Usually, the vertex index is not defined if picked point is too far away from a geometry vertex.

m_vertex

protected PdVector m_vertex
Vertex representing the picked point, not a vertex of the geometry.

m_vertexNearest

protected PdVector m_vertexNearest
The position on the geometry which is nearest to the picked vertex.

m_dist

protected double m_dist
Distance of picked vertex to nearest position on geometry.

m_normal

protected PdVector m_normal
Normal vector at picked surface points.

m_bary

protected PdBary m_bary
Barycentric coordinates of point in m_elemInd, or, if m_subElemInd!=-1, in m_subElemInd.

m_elemInd

protected int m_elemInd
Element in geometry in which point lies.

m_elemSubInd

protected int m_elemSubInd
If element has more than three vertices, then a subElement is specified. If len is the number of vertices v[0],... of m_elemInd, then there are len-2 subElements defined: subElem==j is {v[0], v[j], v[j+1]}.

m_viewDir

protected PdVector m_viewDir
Direction under which this point was hit by the viewing ray.

m_location

protected java.awt.Point m_location
Position of cursor in pixel coordinates of drawing canvas.

m_markBox

protected PiVector m_markBox
Rectangle on the screen marked by user.
See Also:
jv.project.PvPickListenerIf#markVertices()

m_markBoxWorld

protected PdVector[] m_markBoxWorld
Set of vertices if user has selected a rectangular box on the screen. Mark box contains four coplanar points on the bounding prism, and direction of prism, all data is in world coordinates of geometry.
See Also:
jv.project.PvPickListenerIf#markVertices()
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 position of cursor in world coordinate of scene in display. Return value may be null.
Returns:
World coordinates of mouse position in scene.

setVertex

public void setVertex(PdVector vertex)
Set position of cursor in world coordinate of scene in display.
Parameters:
World - coordinates of mouse position in scene.

getVertexNearest

public PdVector getVertexNearest()
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 vertexNearest)
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 vector in vertex array of picked geometry. Return value may be -1 indicating that no element has been picked.
Returns:
index of vertex

setVertexInd

public void setVertexInd(int ind)
Set index of vector in vertex array of picked geometry. Parameter value may be -1 indicating that no element has been picked.
Parameters:
index - of 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 may be -1 indicating that no element has been 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 may be -1 indicating that no element has been 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]}.

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 the four parameters of event simultanously.
Parameters:
coordinates - of picked vertex
index - of picked element
index - of sub element
barycentric - coordinates inside an element

JavaView® v2.00.008

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