public class ObjectPicker extends ZuistPicker
An object picker that tells what objects overlap the corresponding coordinates. The picker will only test for objects that are visible in the given level range.
An ObjectPicker is instantiated as follows:
SceneManager sm = ...; // create a picker that will only consider objects visible at ZUIST levels 0 through 1 (any of these levels or all of them) ObjectPicker oPicker = sm.createObjectPicker(0,1); oPicker.setListener(aListener);
with aListener a PickedObjectListener that gets notified whenever the picker enters or exits an Object.
An ObjectPicker is moved programmatically using setVSCoordinates(). Any VirtualSpace coordinates can be given to it.
One way to tie it to a VCursor is simply to call setVSCoordinates() in the mouseMoved listener associated with the corresponding ViewListener.
public void mouseMoved(ViewPanel v, int jpx, int jpy, MouseEvent e){ oPicker.setVSCoordinates(v.getVCursor().getVSXCoordinate(), v.getVCursor().getVSYCoordinate()); }
Modifier and Type | Field and Description |
---|---|
protected int |
maxIndex |
Modifier and Type | Method and Description |
---|---|
void |
computePickedObjectList()
Compute the list of ObjectDescriptions currently picked.
|
PickedObjectListener |
getListener() |
ObjectDescription[] |
getPickedObjectList()
Get the list of ObjectDescriptions currently picked.
|
void |
reset()
Reset the list of glyphs under the cursor.
|
void |
setLevelRange(int tl,
int bl)
Get the picker's level range, i.e., the levels at which the picker is looking for candidates.
|
void |
setListener(PickedObjectListener ol) |
void |
setVSCoordinates(double x,
double y)
Set picker's coordinates (virtual space coordinates system).
|
void |
updateCandidateObjects()
This method should be called whenever ObjectDescriptions are added/removed in the level range considered for picking.
|
getLevelRange, getVSCoordinates
public void updateCandidateObjects()
public void setListener(PickedObjectListener ol)
public PickedObjectListener getListener()
public void setVSCoordinates(double x, double y)
ZuistPicker
setVSCoordinates
in class ZuistPicker
x
- x-coordinate, in virtual space coordinates systemy
- y-coordinate, in virtual space coordinates systempublic void setLevelRange(int tl, int bl)
ZuistPicker
setLevelRange
in class ZuistPicker
tl
- top levelbl
- bottom levelpublic void reset()
public ObjectDescription[] getPickedObjectList()
public void computePickedObjectList()
Copyright © 2000-2002 Xerox Corporation. All Rights Reserved
Copyright © 2003 World Wide Web Consortium. All Rights Reserved
Copyright © 2004-2015 INRIA. All Rights Reserved
Licensed under the GNU LGPL. For full terms see the file COPYING.