public class PickCanvas extends PickTool
The pick tolerance specifies the distance from the pick center to include in the pick shape. A tolerance of 0.0 may speedup picking slightly, but also make it very difficult to pick points and lines.
The pick canvas can be used to make a series of picks. For example, to initialize the pick canvas:
PickCanvas pickCanvas = new PickCanvas(canvas, scene); pickCanvas.setMode(PickTool.GEOMETRY_INTERSECT_INFO); pickCanvas.setTolerance(4.0f);
Then for each mouse event:
pickCanvas.setShapeLocation(mouseEvent); PickResult[] results = pickCanvas.pickAll();
NOTE: For the pickAllSorted or pickClosest methods, the picks will be sorted by the distance from the ViewPlatform to the intersection point.
PickTool
BOUNDS, GEOMETRY, GEOMETRY_INTERSECT_INFO, INTERSECT_COORD, INTERSECT_FULL, INTERSECT_TEST, userDefineShape
Constructor | Description |
---|---|
PickCanvas(Canvas3D c,
BranchGroup b) |
Constructor with Canvas3D for mouse events and BranchGroup to be picked.
|
PickCanvas(Canvas3D c,
Locale l) |
Constructor with Canvas3D for mouse events and Locale to be picked.
|
Modifier and Type | Method | Description |
---|---|---|
Canvas3D |
getCanvas() |
Inquire the canvas to be used for picking operations.
|
float |
getTolerance() |
Get the pick tolerance.
|
void |
setShapeLocation(int xpos,
int ypos) |
Set the pick location.
|
void |
setShapeLocation(java.awt.event.MouseEvent mevent) |
Set the pick location.
|
void |
setTolerance(float t) |
Set the picking tolerance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBranchGroup, getLocale, getMode, getPickShape, getStartPosition, pickAll, pickAllSorted, pickAny, pickClosest, setBranchGroup, setCapabilities, setMode, setShape, setShapeBounds, setShapeConeRay, setShapeConeSegment, setShapeCylinderRay, setShapeCylinderSegment, setShapeRay, setShapeSegment
public PickCanvas(Canvas3D c, BranchGroup b)
public Canvas3D getCanvas()
public void setTolerance(float t)
t
- The tolerancejava.lang.IllegalArgumentException
- if the tolerance is less than 0.public float getTolerance()
public void setShapeLocation(java.awt.event.MouseEvent mevent)
mevent
- The MouseEvent for the picking pointpublic void setShapeLocation(int xpos, int ypos)
xpos
- the X position of the picking pointypos
- the Y position of the picking pointCopyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.