public class PickerVS extends Object
A picker that requires VirtualSpace coordinates only.
List of Glyphs that can be picked by PickerVS at this time:
When instantiating a Picker manually, that picker should be registered with the VirtualSpace in which it is going to perform picking operations so that it gets notified whenever glyphs get removed from the VirtualSpace and updates itself accordingly. This is not necessary for the picker associated with a View's VCursor, that gets created automatically.
VirtualSpace vs = ...; PickerVS pvs = new PickerVS(); vs.registerPicker(pvs); ... pvs.setVSCoordinates(vx, vy); // setting new VS coordinates does not trigger the update of the list of picked glyphs // one also needs to call computePickedGlyphList(Camera c) // where c is the camera through which the candidate glyphs are observed pvs.computePickedGlyphList(c); // or, if all glyphs should be considered, not only those that are visible within the camera's current viewport: pvs.computePickedGlyphList(c, false); // this can be useful, e.g, when picking in a VirtualSpace managed with zvtm-cluster.
Modifier and Type | Field and Description |
---|---|
protected int |
maxIndex |
protected double |
pvx |
protected double |
pvy |
protected Glyph |
tmpGlyph |
protected short |
tmpRes |
protected double |
vx
coord in virtual space
|
protected double |
vy
coord in virtual space
|
Constructor and Description |
---|
PickerVS()
Picker constructor.
|
PickerVS(int stackSize)
Picker constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
computePickedGlyphList(Camera c)
Compute the list of glyphs currently picked.
|
boolean |
computePickedGlyphList(Camera c,
boolean onlyGlyphsInViewport)
Compute the list of glyphs currently picked.
|
Glyph[] |
getDrawOrderedPickedGlyphList(VirtualSpace v)
The list of glyphs under the picker, ordered according to the drawing stack
|
Vector<Glyph> |
getIntersectingGlyphs(Camera c)
Get a list of all Glyphs (including segments and paths) picked.
|
Vector<Glyph> |
getIntersectingGlyphs(Camera c,
boolean onlyGlyphsInViewport,
String type)
Get a list of all Glyphs (including segments and paths) picked.
|
Vector<DPath> |
getIntersectingPaths(Camera c)
Get a list of all DPaths picked at the picker's current coordinates.
|
Vector<DPath> |
getIntersectingPaths(Camera c,
int tolerance)
Get a list of all DPaths picked at the picker's current coordinates.
|
static Vector<DPath> |
getIntersectingPaths(Camera c,
int tolerance,
double x,
double y,
boolean onlyGlyphsInViewport)
Get a list of all DPaths picked at a given set of coordinates.
|
PickerListener |
getListener() |
Glyph[] |
getPickedGlyphList()
Get the list of glyphs currently picked.
|
Glyph[] |
getPickedGlyphList(String type)
Get the list of glyphs currently picked.
|
Glyph[] |
getStickedGlyphArray()
Get list of glyphs sticked to picker.
|
int |
getStickedGlyphsNumber()
Get the number of glyphs sticked to the picker.
|
static boolean |
intersectsPath(DPath p,
int tolerance,
double x,
double y,
Graphics2D g2d)
Tells whether the picker is hovering a particular DPath or not.
|
boolean |
intersectsPath(DPath p,
int tolerance,
Graphics2D g2d)
Tells whether the picker is hovering a particular DPath or not.
|
boolean |
isPicked(Glyph g)
Tells whether a given glyph is under this picker or not.
|
Glyph |
lastGlyphEntered()
Get the last Glyph this picker entered.
|
Glyph |
pickOnTop(VirtualSpace v)
Returns the glyph under the picker (drawing order)
|
void |
printList()
Print list of glyphs under cursor on System.err for debugging.
|
void |
propagateMove(double dx,
double dy)
Propagate picker movements to sticked glyphs.
|
void |
setListener(PickerListener pl) |
void |
setVSCoordinates(double x,
double y)
Set picker's coordinates (virtual space coordinates system).
|
void |
stickGlyph(Glyph g)
Attach glyph g to picker.
|
void |
unstickGlyph(Glyph g)
Unstick glyph from picker.
|
Glyph |
unstickLastGlyph()
Unstick glyph that was last sticked to this picker.
|
protected double vx
protected double vy
protected double pvx
protected double pvy
protected Glyph tmpGlyph
protected short tmpRes
protected int maxIndex
public PickerVS()
public PickerVS(int stackSize)
stackSize
- start picked glyph stack size. Will double capacity if overflows.public Glyph lastGlyphEntered()
public void setVSCoordinates(double x, double y)
x
- x-coordinate, in virtual space coordinates systemy
- y-coordinate, in virtual space coordinates systempublic void setListener(PickerListener pl)
public PickerListener getListener()
public static Vector<DPath> getIntersectingPaths(Camera c, int tolerance, double x, double y, boolean onlyGlyphsInViewport)
c
- should be the active camera (can be obtained by VirtualSpaceManager.getActiveCamera())tolerance
- the rectangular area's half width/height considered as the cursor intersecting region, in virtual space units (default tolerance is 5)x
- picker x-coordinate, in virtual space coordinates systemy
- picker y-coordinate, in virtual space coordinates systemonlyGlyphsInViewport
- only perform picking test on glyphs that are drawn. Default value is true, as it limits the number of Glyphs to consider to those that fall within the camera's viewport.getIntersectingPaths(Camera c)
public Vector<DPath> getIntersectingPaths(Camera c)
c
- should be the active camera (can be obtained by VirtualSpaceManager.getActiveCamera())getIntersectingPaths(Camera c, int tolerance, double cursorX, double cursorY, boolean onlyGlyphsInViewport)
public Vector<DPath> getIntersectingPaths(Camera c, int tolerance)
c
- should be the active camera (can be obtained by VirtualSpaceManager.getActiveCamera())tolerance
- the rectangular area's half width/height considered as the cursor intersecting region, in virtual space units (default tolerance is 5)getIntersectingPaths(Camera c, int tolerance, double cursorX, double cursorY, boolean onlyGlyphsInViewport)
public static boolean intersectsPath(DPath p, int tolerance, double x, double y, Graphics2D g2d)
p
- DPath instance to be testedtolerance
- the rectangular area's half width/height considered as the cursor intersecting region, in virtual space units (default tolerance is 5)x
- picker x-coordinate, in virtual space coordinates systemy
- picker y-coordinate, in virtual space coordinates systemintersectsPath(DPath p, int tolerance, Graphics2D g2d)
public boolean intersectsPath(DPath p, int tolerance, Graphics2D g2d)
p
- DPath instance to be testedtolerance
- the rectangular area's half width/height considered as the cursor intersecting region, in virtual space units (default tolerance is 5)intersectsPath(DPath p, int tolerance, double x, double y, Graphics2D g2d)
public Vector<Glyph> getIntersectingGlyphs(Camera c, boolean onlyGlyphsInViewport, String type)
c
- a camera (the active camera can be obtained by VirtualSpaceManager.getActiveCamera())onlyGlyphsInViewport
- only perform picking test on glyphs that are drawn. Default value is true, as it limits the number of Glyphs to consider to those that fall within the camera's viewport.type
- the type of glyph to look for (pass null to look for any type of glyph). Type of glyph as specified with Glyph.setType().getIntersectingGlyphs(Camera c)
,
getPickedGlyphList()
public Vector<Glyph> getIntersectingGlyphs(Camera c)
c
- a camera (the active camera can be obtained by VirtualSpaceManager.getActiveCamera())getIntersectingGlyphs(Camera c, boolean onlyGlyphsInViewport, String type)
,
getPickedGlyphList()
public boolean computePickedGlyphList(Camera c)
c
- camera observing the glyphs of potential interest in the View.public boolean computePickedGlyphList(Camera c, boolean onlyGlyphsInViewport)
c
- camera observing the glyphs of potential interest in the View.onlyGlyphsInViewport
- only perform picking test on glyphs that are drawn. Default value is true, as it limits the number of Glyphs to consider to those that fall within the camera's viewport.public Glyph[] getPickedGlyphList()
getPickedGlyphList(String type)
,
getIntersectingGlyphs(Camera c)
,
getIntersectingGlyphs(Camera c, boolean onlyGlyphsInViewport, String type)
public Glyph[] getPickedGlyphList(String type)
type
- the type of glyph to look for. Type of glyph as specified with Glyph.setType().getPickedGlyphList()
,
getIntersectingGlyphs(Camera c)
,
getIntersectingGlyphs(Camera c, boolean onlyGlyphsInViewport, String type)
public boolean isPicked(Glyph g)
public void printList()
public Glyph[] getDrawOrderedPickedGlyphList(VirtualSpace v)
public Glyph pickOnTop(VirtualSpace v)
public void propagateMove(double dx, double dy)
public void stickGlyph(Glyph g)
public Glyph unstickLastGlyph()
public int getStickedGlyphsNumber()
public void unstickGlyph(Glyph g)
public Glyph[] getStickedGlyphArray()
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.