< Zurück | Inhalt | Weiter >

16.4 PickCanvas

java.lang.Object

|

+−−com.sun.j3d.utils.picking.PickTool

|

+−−com.sun.j3d.utils.picking.PickCanvas


PickCanvas, a subclass of PickTool, simplifies picking using mouse events from an AWT 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 slightly speed up picking, but also makes 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, do the following:


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();


For the pickAllSorted or pickClosest methods, the picks will be sorted by the distance from the

ViewPlatform to the intersection point.