Class Label

    • Constructor Detail

      • Label

        public Label​(Position position,
                     java.lang.String text)
        Constructs a label that displays text at a geographic position.
        Parameters:
        position - the position where the label is displayed
        text - the text to display, or null to display nothing
        Throws:
        java.lang.IllegalArgumentException - If the position is null
      • Label

        public Label​(Position position,
                     TextAttributes attributes)
        Constructs a label with specified attributes that displays at a geographic position once its text is set to a non-null value.
        Parameters:
        position - the position where the label is displayed
        attributes - a reference to an attributes bundle used by this label when not highlighted
        Throws:
        java.lang.IllegalArgumentException - If the position is null
      • Label

        public Label​(Position position,
                     java.lang.String text,
                     TextAttributes attributes)
        Constructs a label with specified attributes that displays text at a geographic position.
        Parameters:
        position - the position where the label is displayed
        text - the text to display, or null to display nothing
        attributes - a reference to an attributes bundle used by this label when not highlighted
        Throws:
        java.lang.IllegalArgumentException - If the position is null
    • Method Detail

      • getPosition

        public Position getPosition()
        Indicates the geographic position where this label is displayed.
        Returns:
        this label's geographic position
      • setPosition

        public Label setPosition​(Position position)
        Sets this label's geographic position to the values in the supplied position.
        Parameters:
        position - the new position where this label is displayed
        Returns:
        this label, with its position set to the specified value
        Throws:
        java.lang.IllegalArgumentException - If the position is null
      • getAltitudeMode

        public int getAltitudeMode()
        Indicates the altitude mode associated with this label's position.
        Returns:
        the altitude mode, see WorldWind.AltitudeMode for possible
      • setAltitudeMode

        public Label setAltitudeMode​(int altitudeMode)
        Sets the altitude mode associated with this label's position.
        Parameters:
        altitudeMode - the new altitude mode, see WorldWind.AltitudeMode for acceptable values
        Returns:
        this label with its altitude mode set to the specified value
      • getText

        public java.lang.String getText()
        Indicates the text displayed by this label. The returned string may be null, indicating that this label displays nothing.
        Returns:
        a reference to the label's text, or null if the label displays nothing
      • setText

        public Label setText​(java.lang.String text)
        Sets the text displayed by this label. The string may be null, in which case the label displays nothing.
        Parameters:
        text - the text to display, or null to display nothing
        Returns:
        this label with its text set to the specified reference
      • getRotation

        public double getRotation()
        Indicates the rotation applied to this label. The rotation represents clockwise clockwise degrees relative to this label's labelRotationMode.
        Returns:
        this label's rotation amount in degrees, or zero if this label has no rotation relative to its orientation reference
        See Also:
        getRotationMode()
      • setRotation

        public Label setRotation​(double degrees)
        Sets the amount of rotation applied to this label. The rotation represents clockwise degrees relative to this label's labelRotationMode.
        Parameters:
        degrees - this label's new rotation amount in degrees, or zero to apply no rotation relative to this label's orientation reference
        Returns:
        this label with its rotation set to the specified value
        See Also:
        setRotationMode(int)
      • getRotationMode

        public int getRotationMode()
        Indicates the orientation mode used to interpret this label's rotation. Label rotation may be either relative to the screen or relative to the globe, as indicated by the following allowable values:
        • WorldWind.RELATIVE_TO_SCREEN - The label's orientation is fixed relative to the screen. Rotation indicates clockwise degrees relative to the screen's vertical axis. This is the default mode.
        • WorldWind.RELATIVE_TO_GLOBE - The label's orientation is fixed relative to the globe. Rotation indicates clockwise degrees relative to North.
        Returns:
        this label's rotation mode
      • setRotationMode

        public Label setRotationMode​(int orientationMode)
        Sets the orientation mode this label uses to interpret its rotation. Label rotation may be either relative to the screen or relative to the globe, as indicated by the following allowable values:
        • WorldWind.RELATIVE_TO_SCREEN - The label's orientation is fixed relative to the screen. Rotation indicates clockwise degrees relative to the screen's vertical axis. This is the default mode.
        • WorldWind.RELATIVE_TO_GLOBE - The label's orientation is fixed relative to the globe. Rotation indicates clockwise degrees relative to North.
        Parameters:
        orientationMode - the orientation mode used to interpret this label's rotation
        Returns:
        this label with its rotation mode set to the specified value
      • getAttributes

        public TextAttributes getAttributes()
        Indicates this label's "normal" attributes, that is the attributes used when the label's highlighted flag is false. If null and this label is not highlighted, this label displays nothing.
        Returns:
        a reference to this label's attributes bundle
      • setAttributes

        public Label setAttributes​(TextAttributes attributes)
        Sets this label's attributes to the supplied attributes bundle. If null and this label is not highlighted, this this label displays nothing.
        It is permissible to share attribute bundles between labels.
        Parameters:
        attributes - a reference to an attributes bundle used by this label when not highlighted
        Returns:
        this label with its normal attributes bundle set to the specified reference
      • getHighlightAttributes

        public TextAttributes getHighlightAttributes()
        Gets the attributes used when this label's highlighted flag is true. If null and the highlighted flag is true, this label's normal attributes are used. If they, too, are null, this label displays nothing.
        Returns:
        a reference to this label's highlight attributes bundle
      • setHighlightAttributes

        public Label setHighlightAttributes​(TextAttributes highlightAttributes)
        Sets the attributes used when this label's highlighted flag is true. If null and the highlighted flag is true, this label's normal attributes are used. If they, too, are null, this label displays nothing.
        It is permissible to share attribute bundles between labels.
        Parameters:
        highlightAttributes - a reference to the attributes bundle used by this label when highlighted
        Returns:
        this label with its highlight attributes bundle set to the specified reference
      • isHighlighted

        public boolean isHighlighted()
        Indicates whether this label uses its highlight attributes rather than its normal attributes.
        Specified by:
        isHighlighted in interface Highlightable
        Returns:
        true if this label is highlighted, and false otherwise
      • setHighlighted

        public void setHighlighted​(boolean highlighted)
        Sets the highlighted state of this label, which indicates whether this label uses its highlight attributes rather than its normal attributes.
        Specified by:
        setHighlighted in interface Highlightable
        Parameters:
        highlighted - true to highlight this label, and false otherwise
      • getReferencePosition

        public Position getReferencePosition()
        A position associated with the object that indicates its aggregate geographic position. For a Label, this is simply it's position property.
        Specified by:
        getReferencePosition in interface Movable
        Returns:
        getPosition()
      • moveTo

        public void moveTo​(Globe globe,
                           Position position)
        Moves the shape over the globe's surface. For a Label, this simply calls setPosition(Position).
        Specified by:
        moveTo in interface Movable
        Parameters:
        globe - not used.
        position - the new position of the shape's reference position.