NASA World Wind

gov.nasa.worldwind.render
Class Path.PathPickSupport

java.lang.Object
  extended by gov.nasa.worldwind.pick.PickSupport
      extended by gov.nasa.worldwind.render.Path.PathPickSupport
Enclosing class:
Path

protected static class Path.PathPickSupport
extends PickSupport

Subclass of PickSupport that adds the capability to resolve a Path's picked position point. Path position points are registered with PathPickSupport by calling addPickablePositions(int, int, Path) with the minimum and maximum color codes that the Path's position points are drawn in.

The resolution of the picked position point is integrated with the resolution of the picked Path. Either an entire Path or one of its position points may be picked. In either case, resolvePick and getTopObject return a PickedObject that specifies the picked Path. If a position point is picked, the PickedObject's AVList contains the position and ordinal number of the picked position.


Field Summary
protected  Map<Object,PickedObject> pathPickedObjects
          A map that associates each path with a picked object.
protected  List<Path.PickablePositions> pickablePositions
          The list of Path pickable positions that this PathPickSupport is currently tracking.
 
Fields inherited from class gov.nasa.worldwind.pick.PickSupport
minAndMaxColorCodes, pickableObjects
 
Constructor Summary
protected Path.PathPickSupport()
           
 
Method Summary
 void addPickablePositions(int minColorCode, int maxColorCode, Path path)
          Registers a range of unique pick color codes with a Path, representing the range of pick colors that the Path's position points are drawn in.
 void clearPickList()
          

Overridden to clear the list of pickable positions.

protected  void doResolvePick(DrawContext dc, Rectangle pickRect, Layer layer)
          Adds all picked paths that are registered with this PickSupport and intersect the specified rectangle in AWT screen coordinates (if any) to the draw context's list of picked objects.
 List<Path.PickablePositions> getPickablePositions()
          Indicates the list of Path pickable positions that this PathPickSupport is currently tracking.
 PickedObject getTopObject(DrawContext dc, Point pickPoint)
          Computes and returns the top object at the specified pick point.
 
Methods inherited from class gov.nasa.worldwind.pick.PickSupport
addPickableObject, addPickableObject, addPickableObject, addPickableObject, adjustExtremeColorCodes, areSelectionsTheSame, beginPicking, doResolvePick, endPicking, getPickableObjects, getTopColor, resolvePick
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pathPickedObjects

protected Map<Object,PickedObject> pathPickedObjects
A map that associates each path with a picked object. Used to during box picking to consolidate the information about what parts of each path are picked into a single picked object. Path's positions are drawn in unique colors and are therefore separately pickable during box picking.


pickablePositions

protected List<Path.PickablePositions> pickablePositions
The list of Path pickable positions that this PathPickSupport is currently tracking. This list maps a range of color codes to a Path, where the color codes represent the range of pick colors that the Path's position points are drawn in.

Constructor Detail

Path.PathPickSupport

protected Path.PathPickSupport()
Method Detail

addPickablePositions

public void addPickablePositions(int minColorCode,
                                 int maxColorCode,
                                 Path path)
Registers a range of unique pick color codes with a Path, representing the range of pick colors that the Path's position points are drawn in. The color codes represent ARGB colors packed into a 32-bit integer.

Parameters:
minColorCode - the minimum color code, inclusive.
maxColorCode - the maximum color code, inclusive.
path - the Path who's position points are associated with the specified color code range.
Throws:
IllegalArgumentException - if the path is null.

clearPickList

public void clearPickList()

Overridden to clear the list of pickable positions.

Overrides:
clearPickList in class PickSupport

doResolvePick

protected void doResolvePick(DrawContext dc,
                             Rectangle pickRect,
                             Layer layer)
Adds all picked paths that are registered with this PickSupport and intersect the specified rectangle in AWT screen coordinates (if any) to the draw context's list of picked objects. Each picked object includes the picked path and the ordinal numbers of positions that intersect the specified rectangle, if any. If any positions intersect the rectangle, the picked object's AVList contains the ordinal numbers in the key AVKey.ORDINAL_LIST.

Overrides:
doResolvePick in class PickSupport
Parameters:
dc - the draw context which receives the picked objects.
pickRect - the rectangle in AWT screen coordinates.
layer - the layer associated with the picked objects.

getPickablePositions

public List<Path.PickablePositions> getPickablePositions()
Indicates the list of Path pickable positions that this PathPickSupport is currently tracking. This list maps a range of color codes to a Path, where the color codes represent the range of pick colors that the Path's position points are drawn in. The returned list is empty if addPickablePositions has not been called since the last call to clearPickList.

Returns:
the list of Path pickable positions.

getTopObject

public PickedObject getTopObject(DrawContext dc,
                                 Point pickPoint)
Computes and returns the top object at the specified pick point. This either resolves a pick of an entire Path or one of its position points. In either case, this returns a PickedObject that specifies the picked Path. If a position point is picked, the PickedObject's AVList contains the picked position's geographic position in the key AVKey.POSITION and its ordinal number in the key AVKey.ORDINAL.

This returns null if the pickPoint is null, or if there is no Path or Path position point at the specified pick point.

Overrides:
getTopObject in class PickSupport
Parameters:
dc - the current draw context.
pickPoint - the screen-coordinate point in question.
Returns:
a new picked object instances indicating the Path or Path position point at the specified pick point, or null if no Path is at the specified pick point.
Throws:
IllegalArgumentException - if the draw context is null.

NASA World Wind