|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.j3d.utils.pickfast.PickTool
com.sun.j3d.utils.pickfast.PickCanvas
public class PickCanvas
A subclass of PickTool, simplifies picking using mouse events from a canvas. This class allows picking using canvas x,y locations by generating the appropriate pick shape.
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(PickInfo.PICK_GEOMETRY); pickCanvas.setFlags(PickInfo.NODE | PickInfo.CLOSEST_INTERSECTION_POINT); pickCanvas.setTolerance(4.0f);
Then for each mouse event:
pickCanvas.setShapeLocation(mouseEvent); PickInfo[] pickInfos = 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
Field Summary |
---|
Fields inherited from class com.sun.j3d.utils.pickfast.PickTool |
---|
TYPE_BRANCH_GROUP, TYPE_GROUP, TYPE_LINK, TYPE_MORPH, TYPE_PRIMITIVE, TYPE_SHAPE3D, TYPE_SWITCH, TYPE_TRANSFORM_GROUP |
Constructor Summary | |
---|---|
PickCanvas(javax.media.j3d.Canvas3D c,
javax.media.j3d.BranchGroup b)
Constructor with Canvas3D for mouse events and BranchGroup to be picked. |
|
PickCanvas(javax.media.j3d.Canvas3D c,
javax.media.j3d.Locale l)
Constructor with Canvas3D for mouse events and Locale to be picked. |
Method Summary | |
---|---|
javax.media.j3d.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. |
Methods inherited from class com.sun.j3d.utils.pickfast.PickTool |
---|
getBranchGroup, getFlags, getLocale, getMode, getNode, getPickShape, getStartPosition, pickAll, pickAllSorted, pickAny, pickClosest, setFlags, setMode, setShape, setShapeBounds, setShapeConeRay, setShapeConeSegment, setShapeCylinderRay, setShapeCylinderSegment, setShapeRay, setShapeSegment |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PickCanvas(javax.media.j3d.Canvas3D c, javax.media.j3d.BranchGroup b)
public PickCanvas(javax.media.j3d.Canvas3D c, javax.media.j3d.Locale l)
Method Detail |
---|
public javax.media.j3d.Canvas3D getCanvas()
public void setTolerance(float t)
t
- The tolerance
java.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 point
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |