public class PickTool extends Object
The pick mode specifies the detail level of picking before the PickInfo is returned:
The pick flags specifies the content of the PickInfo(s) returned by the pick methods. This is specified as one or more individual bits that are bitwise "OR"ed together to describe the PickInfo data. The flags include :
PickInfo.SCENEGRAPHPATH
- request for computed SceneGraphPath.PickInfo.NODE
- request for computed intersected Node.PickInfo.LOCAL_TO_VWORLD
- request for computed local to virtual world transform.PickInfo.CLOSEST_INTERSECTION_POINT
- request for closest intersection point.PickInfo.CLOSEST_DISTANCE
- request for the distance of closest intersection.PickInfo.CLOSEST_GEOM_INFO
- request for only the closest intersection geometry information.PickInfo.ALL_GEOM_INFO
- request for all intersection geometry information.When using pickAllSorted or pickClosest methods, the picks will be sorted by the distance from the start point of the pick shape to the intersection point.
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_BRANCH_GROUP
Flag to pass to
getNode(int)
to return a
BranchGroup node from
the SceneGraphPath . |
static int |
TYPE_GROUP
Flag to pass to
getNode(int)
to return a
Group node from
the SceneGraphPath . |
static int |
TYPE_LINK
Flag to pass to
getNode(int)
to return a
Link node from
the SceneGraphPath . |
static int |
TYPE_MORPH
Flag to pass to
getNode(int)
to return a
Morph node from
the SceneGraphPath . |
static int |
TYPE_PRIMITIVE
Flag to pass to
getNode(int)
to return a
Primitive node from
the SceneGraphPath . |
static int |
TYPE_SHAPE3D
Flag to pass to
getNode(int)
to return a
Shape3D node from
the SceneGraphPath . |
static int |
TYPE_SWITCH
Flag to pass to
getNode(int)
to return a
Switch node from
the SceneGraphPath . |
static int |
TYPE_TRANSFORM_GROUP
Flag to pass to
getNode(int)
to return a
TransformGroup node from
the SceneGraphPath . |
protected boolean |
userDefineShape |
Constructor and Description |
---|
PickTool(BranchGroup b)
Constructor with BranchGroup to be picked.
|
PickTool(Locale l)
Constructor with the Locale to be picked.
|
Modifier and Type | Method and Description |
---|---|
BranchGroup |
getBranchGroup()
Returns the BranchGroup to be picked if the tool was initialized
with a BranchGroup, null otherwise.
|
int |
getFlags()
Gets the PickInfo content flags.
|
Locale |
getLocale()
Returns the Locale to be picked if the tool was initialized with
a Locale, null otherwise.
|
int |
getMode()
Gets the picking detail mode.
|
Node |
getNode(PickInfo pickInfo,
int type)
Get the first node of a certain type up the SceneGraphPath
|
PickShape |
getPickShape()
Returns the PickShape for this object.
|
Point3d |
getStartPosition()
Returns the start postion used for distance measurement.
|
PickInfo[] |
pickAll()
Selects all the nodes that intersect the PickShape.
|
PickInfo[] |
pickAllSorted()
Select all the nodes that intersect the
PickShape, returned sorted.
|
PickInfo |
pickAny()
Select one of the nodes that intersect the PickShape
|
PickInfo |
pickClosest()
Select the closest node that
intersects the PickShape.
|
void |
setFlags(int flags)
Sets the PickInfo content flags.
|
void |
setMode(int mode)
Sets the picking detail mode.
|
void |
setShape(PickShape ps,
Point3d startPt)
Sets the pick shape to a user-provided PickShape object
|
void |
setShapeBounds(Bounds bounds,
Point3d startPt)
Sets the pick shape to use a user-provided Bounds object
|
void |
setShapeConeRay(Point3d start,
Vector3d dir,
double angle)
Sets the pick shape to an infinite PickCone.
|
void |
setShapeConeSegment(Point3d start,
Point3d end,
double angle)
Sets the pick shape to a capped PickCone
|
void |
setShapeCylinderRay(Point3d start,
Vector3d dir,
double radius)
Sets the pick shape to an infinite PickCylinder.
|
void |
setShapeCylinderSegment(Point3d start,
Point3d end,
double radius)
Sets the pick shape to a capped PickCylinder
|
void |
setShapeRay(Point3d start,
Vector3d dir)
Sets the pick shape to a PickRay.
|
void |
setShapeSegment(Point3d start,
Point3d end)
Sets the pick shape to a PickSegment.
|
public static final int TYPE_SHAPE3D
getNode(int)
to return a
Shape3D
node from
the SceneGraphPath
.public static final int TYPE_MORPH
getNode(int)
to return a
Morph
node from
the SceneGraphPath
.public static final int TYPE_PRIMITIVE
getNode(int)
to return a
Primitive
node from
the SceneGraphPath
.public static final int TYPE_LINK
getNode(int)
to return a
Link
node from
the SceneGraphPath
.public static final int TYPE_GROUP
getNode(int)
to return a
Group
node from
the SceneGraphPath
.public static final int TYPE_TRANSFORM_GROUP
getNode(int)
to return a
TransformGroup
node from
the SceneGraphPath
.public static final int TYPE_BRANCH_GROUP
getNode(int)
to return a
BranchGroup
node from
the SceneGraphPath
.public static final int TYPE_SWITCH
getNode(int)
to return a
Switch
node from
the SceneGraphPath
.protected boolean userDefineShape
public PickTool(BranchGroup b)
public PickTool(Locale l)
public BranchGroup getBranchGroup()
public Locale getLocale()
public void setShape(PickShape ps, Point3d startPt)
ps
- The pick shape to pick against.startPt
- The start point to use for distance calculationspublic void setShapeBounds(Bounds bounds, Point3d startPt)
bounds
- The bounds to pick against.startPt
- The start point to use for distance calculationspublic void setMode(int mode)
mode
- One of PickInfo.PICK_BOUNDS or PickInfo.PICK_GEOMETRY.IllegalArgumentException
- if mode is not a legal valuepublic int getMode()
public void setFlags(int flags)
flags
- specified as one or more individual bits that are
bitwise "OR"ed together :
PickInfo.SCENEGRAPHPATH
- request for computed SceneGraphPath.PickInfo.NODE
- request for computed intersected Node.PickInfo.LOCAL_TO_VWORLD
- request for computed local to virtual world transform.PickInfo.CLOSEST_INTERSECTION_POINT
- request for closest intersection point.PickInfo.CLOSEST_DISTANCE
- request for the distance of closest intersection.PickInfo.CLOSEST_GEOM_INFO
- request for only the closest intersection geometry information.PickInfo.ALL_GEOM_INFO
- request for all intersection geometry information.IllegalArgumentException
- if any other bits besides the above are set.public int getFlags()
public void setShapeRay(Point3d start, Vector3d dir)
start
- The start of the raydir
- The direction of the raypublic void setShapeSegment(Point3d start, Point3d end)
start
- The start of the segmentend
- The end of the segmentpublic void setShapeCylinderSegment(Point3d start, Point3d end, double radius)
start
- The start of axis of the cylinderend
- The end of the axis of the cylinderradius
- The radius of the cylinderpublic void setShapeCylinderRay(Point3d start, Vector3d dir, double radius)
start
- The start of axis of the cylinderdir
- The direction of the axis of the cylinderradius
- The radius of the cylinderpublic void setShapeConeSegment(Point3d start, Point3d end, double angle)
start
- The start of axis of the coneend
- The end of the axis of the coneangle
- The angle of the conepublic void setShapeConeRay(Point3d start, Vector3d dir, double angle)
start
- The start of axis of the conedir
- The direction of the axis of the coneangle
- The angle of the conepublic PickShape getPickShape()
public Point3d getStartPosition()
public PickInfo[] pickAll()
PickInfo
objects which will contain
information about the picked instances. null
if nothing was
picked.public PickInfo pickAny()
PickInfo
object which will contain
information about the picked instance. null
if nothing
was picked.public PickInfo[] pickAllSorted()
PickInfo
objects which will contain
information
about the picked instances. null
if nothing was picked.public PickInfo pickClosest()
PickInfo
object which will contain
information about the picked instance. null
if nothing
was picked.public Node getNode(PickInfo pickInfo, int type)
type
- the type of node we are interested inNullPointerException
- if pickInfo does not contain a
Scenegraphpath or a picked nodeCopyright © 2016–2022 SciJava. All rights reserved.