Class 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 Detail

      • pickablePositions

        protected java.util.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.
      • pathPickedObjects

        protected java.util.Map<java.lang.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.
    • Constructor Detail

      • PathPickSupport

        protected PathPickSupport()
    • Method Detail

      • clearPickList

        public void clearPickList()

        Overridden to clear the list of pickable positions.

        Overrides:
        clearPickList in class PickSupport
      • getPickablePositions

        public java.util.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.
      • 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:
        java.lang.IllegalArgumentException - if the path is null.
      • getTopObject

        public PickedObject getTopObject​(DrawContext dc,
                                         java.awt.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:
        java.lang.IllegalArgumentException - if the draw context is null.
      • doResolvePick

        protected void doResolvePick​(DrawContext dc,
                                     java.awt.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.