Class LineBuilder

  • All Implemented Interfaces:
    AVList

    public class LineBuilder
    extends AVListImpl
    A utility class to interactively build a path. When armed, the class monitors mouse events and adds new positions to a path as the user identifies them. The interaction sequence for creating a line is as follows:
    • Arm the line builder by calling its setArmed(boolean) method with an argument of true.
    • Place the cursor at the first desired path position. Press and release mouse button one.
    • Press button one near the next desired position, drag the mouse to the exact position, then release the button. The proposed line segment will echo while the mouse is dragged. Continue selecting new positions this way until the path contains all desired positions.
    • Disarm the LineBuilder object by calling its setArmed(boolean) method with an argument of false.

    While the line builder is armed, pressing and immediately releasing mouse button one while also pressing the control key (Ctl) removes the last position from the path.

    Mouse events the line builder acts on while armed are marked as consumed. These events are mouse pressed, released, clicked and dragged. These events are not acted on while the line builder is not armed. The builder can be continuously armed and rearmed to allow intervening maneuvering of the globe while building a path. A user can add positions, pause entry, maneuver the view, then continue entering positions.

    Arming and disarming the line builder does not change the contents or attributes of the line builder's layer.

    The path and a layer containing it may be specified when a LineBuilder is constructed.

    This class contains a main method implementing an example program illustrating use of LineBuilder.

    • Constructor Detail

      • LineBuilder

        public LineBuilder​(WorldWindow wwd,
                           RenderableLayer lineLayer,
                           Path path)
        Construct a new line builder using the specified path and layer and drawing events from the specified world window. Either or both the path and the layer may be null, in which case the necessary object is created.
        Parameters:
        wwd - the WorldWindow to draw events from.
        lineLayer - the layer holding the path. May be null, in which case a new layer is created.
        path - the path object to build. May be null, in which case a new path is created.
    • Method Detail

      • getLayer

        public RenderableLayer getLayer()
        Returns the layer holding the path being created.
        Returns:
        the layer containing the path.
      • getLine

        public Path getLine()
        Returns the layer currently used to display the path.
        Returns:
        the layer holding the path.
      • clear

        public void clear()
        Removes all positions from the path.
      • isArmed

        public boolean isArmed()
        Identifies whether the line builder is armed.
        Returns:
        true if armed, false if not armed.
      • setArmed

        public void setArmed​(boolean armed)
        Arms and disarms the line builder. When armed, the line builder monitors user input and builds the path in response to the actions mentioned in the overview above. When disarmed, the line builder ignores all user input.
        Parameters:
        armed - true to arm the line builder, false to disarm it.
      • main

        public static void main​(java.lang.String[] args)