jv.project
Class PvPickEvent
- java.lang.Object
-
- jv.project.PvPickEvent
-
public final class PvPickEvent extends java.lang.ObjectPick events on geometries sent to a pick listener from a display.- See Also:
PvPickListenerIf,PjProject,PvDisplayIf- Author:
- Konrad Polthier
- Version:
- 15.02.05, 1.80 revised (kp) Horizontal distance added to better check polygons and points.
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)
-
-
Constructor Summary
Constructors Constructor and Description PvPickEvent(int dim)Constructor with dimension of scene in display.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description PdBarygetBary()Get barycentric coordinates inside the picked element.intgetDimOfVertex()Get dimension of scene position of cursor in world coordinate of scene in display.doublegetDistance()Get distance of picked vertex to nearest position on geometry.intgetElementInd()Get index of element in element array of picked geometry.intgetElementSubInd()Get the index of a subtringle if element has more than three edges.intgetElemInd()Deprecated.use #getElementInd() which provides the same functionality.PgGeometryIfgetGeometry()Get the picked geometry, may benull.doublegetHorDistance()Get distance of picked vertex to nearest position on geometry.java.awt.PointgetLocation()Get position of cursor in pixel coordinates of drawing canvas of event.PiVectorgetMarkBox()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.PdVectorgetNormal()Get normal vector at picked surface points.PvDisplayIfgetSource()Get source display where this event occurred.PdVectorgetVertex()Get the point on the geometry nearest to the picked vertex, i.e. the intersection of the pick ray (viewBase,viewDir) with the geometry.intgetVertexInd()Get index of vertex in vertex array of picked geometry if pick was close to a vertex.PdVectorgetVertexNearest()Deprecated.use getVertex()PdVectorgetViewBase()Get position of cursor in world coordinate of scene in display.PdVectorgetViewDir()Get normalized viewing direction as the vector pointing from the camera to its interest.voidset(PdVector pos, int elemInd, int elemSubInd, PdBary bary)Convenient method to assign the four parameters of an event simultaneously.voidsetBary(PdBary bary)Set barycentric coordinates inside the picked element.voidsetDistance(double dist)Set distance of picked vertex to nearest position on geometry.voidsetElementInd(int elem)Set index of element in element array of picked geometry.voidsetElementSubInd(int elemSub)Set the index of a subtringle if element has more than three edges.voidsetGeometry(PgGeometryIf geom)Set the picked geometry from display, may benull.voidsetHorDistance(double horDist)Set distance of picked vertex to nearest position on geometry.voidsetLocation(java.awt.Point pos)Set position of cursor in pixel coordinates of drawing canvas of event.voidsetMarkBox(PiVector box)Set bounds of user dragged rectangle with four components in pixel coordinates.voidsetMarkBoxWorld(PdVector[] box)Set bounds of user dragged rectangle with four components in world-coordinates.voidsetNormal(PdVector normal)Get normal vector at picked surface points.voidsetSource(PvDisplayIf disp)Set source display where this event occurred.voidsetVertex(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.voidsetVertexInd(int ind)Set index of vertex in vertex array of picked geometry if pick was close to a vertex.voidsetVertexNearest(PdVector vertex)Deprecated.use setVertex(PdVector)voidsetViewBase(PdVector base)Set position of cursor in world coordinate of scene in display.voidsetViewDir(PdVector pos)Set viewing direction as the vector pointing from the camera to its interest.
-
-
-
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:
disp- 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 benull. A geometry must be the active geometry to receive a pick event. Return value may benull.- Returns:
- picked geometry
-
setGeometry
public void setGeometry(PgGeometryIf geom)
Set the picked geometry from display, may benull. A geometry must be the active geometry to receive a pick event.- Parameters:
geom- picked geometry
-
getMarkBox
public PiVector getMarkBox()
Get bounds of user dragged rectangle with four components in pixel coordinates. Return value may benull.- 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:
box- 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 benull.- 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:
box- 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:
pos- 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()- Version:
- 24.03.01, 1.10 revised (kp) Meaning of this vertex changed, before it was used as viewBase.
-
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:
vertex- World coordinates of the nearest point on the geometry.- See Also:
setViewBase(PdVector),setViewDir(PdVector)- Version:
- 24.03.01, 1.10 revised (kp) Meaning of this vertex changed, before it was used as viewBase.
-
getVertexNearest
public PdVector getVertexNearest()
Deprecated. use getVertex()Get position of the point on the geometry nearest to the picked vertex. Return value may benull.- 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:
vertex- 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:
ind- 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:
dist- distance of picked vertex to nearest position on geometry.
-
getHorDistance
public double getHorDistance()
Get distance of picked vertex to nearest position on geometry.- Returns:
- distance of picked vertex to nearest position on geometry.
- Since:
- JavaView 3.84.016
- Version:
- 15.02.05, 1.00 created
-
setHorDistance
public void setHorDistance(double horDist)
Set distance of picked vertex to nearest position on geometry. Parameter value may be -1 indicating that no element has been picked.- Parameters:
horDist- horizontal distance of picked vertex to nearest position on geometry.- Since:
- JavaView 3.84.016
- Version:
- 15.02.05, 1.00 created
-
getNormal
public PdVector getNormal()
Get normal vector at picked surface points. Return value may benull.- Returns:
- World coordinates of normal vector in scene.
-
setNormal
public void setNormal(PdVector normal)
Get normal vector at picked surface points.- Parameters:
normal- 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 benull.- See Also:
getElementSubInd()
-
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:
getElementSubInd()
-
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:
elem- 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]}.- Parameters:
elemSub- index of subtriangle
-
getViewBase
public PdVector getViewBase()
Get position of cursor in world coordinate of scene in display. Return value may benull.- 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:
base- World coordinates of mouse position in scene.- See Also:
setViewDir(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:
pos- 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:
pos- coordinates of picked vertexelemInd- index of picked elementelemSubInd- index of sub elementbary- barycentric coordinates inside an element
-
-
"