Class Placemark

  • All Implemented Interfaces:
    Renderable, Highlightable, Movable

    public class Placemark
    extends AbstractRenderable
    implements Highlightable, Movable
    Represents a Placemark shape. A placemark displays an image, a label and a leader connecting the placemark's geographic position to the ground. All three of these items are optional. By default, the leader is not pickable. See setEnableLeaderPicking(boolean).
    Placemarks may be drawn with either an image or as single-color square with a specified size. When the placemark attributes indicate a valid image, the placemark's image is drawn as a rectangle in the image's original dimensions, scaled by the image scale attribute. Otherwise, the placemark is drawn as a square with width and height equal to the value of the image scale attribute, in pixels, and color equal to the image color attribute.
    • Constructor Detail

      • Placemark

        public Placemark​(Position position)
        Constructs a Placemark that draws its representation at the supplied position using default PlacemarkAttributes bundle. The displayName and label properties are empty.
        Parameters:
        position - The placemark's geographic position
      • Placemark

        public Placemark​(Position position,
                         PlacemarkAttributes attributes)
        Constructs a Placemark that draws its representation at the supplied position using the given PlacemarkAttributes bundle. The displayName and label properties are empty.
        Parameters:
        position - The placemark's geographic position
        attributes - The attributes bundle reference that defines how the placemark is drawn
      • Placemark

        public Placemark​(Position position,
                         PlacemarkAttributes attributes,
                         java.lang.String name)
        Constructs a Placemark with a label that draws its representation at the supplied position using the given PlacemarkAttributes bundle. The displayName is set to the supplied name string.
        Parameters:
        position - The placemark's geographic position
        attributes - The attributes to associate with this placemark. May be null, but if null the placemark will not be drawn.
        name - The text for the AbstractRenderable.displayName.
    • Method Detail

      • createWithColorAndSize

        public static Placemark createWithColorAndSize​(Position position,
                                                       Color color,
                                                       int pixelSize)
        This factory method creates a Placemark and an associated PlacemarkAttributes bundle that draws a simple square centered on the supplied position with the given size and color.
        Parameters:
        position - The geographic position where the placemark is drawn.
        color - The color of the placemark.
        pixelSize - The width and height of the placemark.
        Returns:
        A new Placemark with a PlacemarkAttributes bundle.
      • createWithImage

        public static Placemark createWithImage​(Position position,
                                                ImageSource imageSource)
        This factory method creates a Placemark and an associated PlacemarkAttributes bundle that draws the given image centered on the supplied position.
        Parameters:
        position - The geographic position with the placemark is drawn.
        imageSource - The object containing the image that is drawn.
        Returns:
        A new Placemark with a PlacemarkAttributes bundle.
      • createWithImageAndLabel

        public static Placemark createWithImageAndLabel​(Position position,
                                                        ImageSource imageSource,
                                                        java.lang.String label)
      • getPosition

        public Position getPosition()
        Gets this placemark's geographic position.
        Returns:
        The geographic position where this placemark is drawn
      • setPosition

        public Placemark setPosition​(Position position)
        Sets this placemark's geographic position to the values in the supplied position.
        Parameters:
        position - The new position where this placemark will be drawn
        Returns:
        This placemark
      • getAltitudeMode

        public int getAltitudeMode()
        Returns the placemark's altitude mode.
      • setAltitudeMode

        public Placemark setAltitudeMode​(int altitudeMode)
        Sets this placemark's altitude mode.
        Parameters:
        altitudeMode - The new altitude mode. See WorldWind.AltitudeMode for acceptable values
        Returns:
        This placemark
      • getAttributes

        public PlacemarkAttributes getAttributes()
        Gets the placemark's "normal" attributes, that is the attributes used when the placemark's highlighted flag is false. If null and this placemark is not highlighted, this placemark is not drawn.
        Returns:
        A reference to this placemark's attributes bundle.
      • setAttributes

        public Placemark setAttributes​(PlacemarkAttributes attributes)
        Sets the placemark's attributes to the supplied attributes bundle. If null and this placemark is not highlighted, this placemark is not drawn.
        It is permissible to share attribute bundles between placemarks.
        Parameters:
        attributes - A reference to an attributes bundle used by this placemark when not highlighted.
        Returns:
        This placemark
      • getHighlightAttributes

        public PlacemarkAttributes getHighlightAttributes()
        Gets the attributes used when this placemark's highlighted flag is true. If null and the highlighted flag is true, this placemark's normal attributes are used. If they, too, are null, this placemark is not drawn.
        Returns:
        A reference to this placemark's highlight attributes bundle
      • setHighlightAttributes

        public Placemark setHighlightAttributes​(PlacemarkAttributes highlightAttributes)
        Sets the attributes used when this placemark's highlighted flag is true. If null and the highlighted flag is true, this placemark's normal attributes are used. If they, too, are null, this placemark is not drawn.
        It is permissible to share attribute bundles between placemarks.
        Parameters:
        highlightAttributes - A reference to the attributes bundle used by this placemark when highlighted
        Returns:
        This placemark
      • getLevelOfDetailSelector

        public Placemark.LevelOfDetailSelector getLevelOfDetailSelector()
        gets the current level-of-detail selector used to inject logic for selecting PlacemarkAttributes based on the the camera distance and highlighted attribute.
        Returns:
        The current level-of-detail selector; may be null
      • setLevelOfDetailSelector

        public Placemark setLevelOfDetailSelector​(Placemark.LevelOfDetailSelector levelOfDetailSelector)
        Sets the optional level-of-detail selector used to inject logic for selecting PlacemarkAttributes based on the the camera distance and highlighted attribute. If set to null, the normal and highlight attribute bundles used respectfully for the normal and highlighted states.
        Parameters:
        levelOfDetailSelector - The new level-of-detail selected; may be null
        Returns:
        This placemark
      • getLabel

        public java.lang.String getLabel()
      • setLabel

        public Placemark setLabel​(java.lang.String label)
      • isEyeDistanceScaling

        public boolean isEyeDistanceScaling()
        Indicates whether this placemark's size is reduced at higher eye distances. If true, this placemark's size is scaled inversely proportional to the eye distance if the eye distance is greater than the value of the getEyeDistanceScalingThreshold() property. When the eye distance is below the threshold, this placemark is scaled only according to the PlacemarkAttributes.getImageScale().
        Returns:
        True if eye distance scaling should be applied.
      • setEyeDistanceScaling

        public Placemark setEyeDistanceScaling​(boolean eyeDistanceScaling)
        Enables or disables the eye distance scaling feature for this placemark. When enabled, the placemark's size is reduced at higher eye distances. If true, this placemark's size is scaled inversely proportional to the eye distance if the eye distance is greater than the value of the getEyeDistanceScalingThreshold() property. When the eye distance is below the threshold, this placemark is scaled only according to the PlacemarkAttributes.getImageScale().
        Parameters:
        eyeDistanceScaling - The new state for the eye distance scaling feature.
        Returns:
        This placemark.
      • getEyeDistanceScalingThreshold

        public double getEyeDistanceScalingThreshold()
        Gets the eye distance above which to reduce the size of this placemark, in meters. If isEyeDistanceScaling() is true, this placemark's image, label and leader sizes are reduced as the eye distance increases beyond this threshold.
        Returns:
        The current threshold value, in meters.
      • setEyeDistanceScalingThreshold

        public Placemark setEyeDistanceScalingThreshold​(double eyeDistanceScalingThreshold)
        Sets the eye distance above which to reduce the size of this placemark, in meters. If isEyeDistanceScaling() is true, this placemark's image, label and leader sizes are reduced as the eye distance increases beyond this threshold.
        Parameters:
        eyeDistanceScalingThreshold - The new threshold value, in meters, used to determine if eye distance scaling should be applied.
        Returns:
        This placemark.
      • getEyeDistanceScalingLabelThreshold

        public double getEyeDistanceScalingLabelThreshold()
        Gets the eye altitude, in meters, above which this placemark's label is not displayed.
        Returns:
        The current label scaling threshold.
      • setEyeDistanceScalingLabelThreshold

        public Placemark setEyeDistanceScalingLabelThreshold​(double eyeDistanceScalingLabelThreshold)
        Sets the eye altitude, in meters, above which this placemark's label is not displayed.
        Parameters:
        eyeDistanceScalingLabelThreshold - The new threshold value, in meters, used to determine if eye distance label scaling should be applied.
        Returns:
        This placemark.
      • getImageRotation

        public double getImageRotation()
        Gets the amount of rotation to apply to the image, measured in degrees clockwise and relative to this placemark's getImageRotationReference().
        Returns:
        The current image rotation value in degrees.
      • setImageRotation

        public Placemark setImageRotation​(double imageRotation)
        Sets the amount of rotation to apply to the image, measured in degrees clockwise and relative to this placemark's getImageRotationReference().
        Parameters:
        imageRotation - The amount in degrees to rotate the image. Zero is no rotation.
        Returns:
        This placemark.
      • getImageRotationReference

        public int getImageRotationReference()
        Gets the type of rotation to apply if the getImageRotation() is not zero. This value indicates whether to apply this placemark's image rotation relative to the screen or the globe.
        If WorldWind.RELATIVE_TO_SCREEN, this placemark's image is rotated in the plane of the screen and its orientation relative to the globe changes as the view changes. If WorldWind.RELATIVE_TO_GLOBE, this placemark's image is rotated in a plane tangent to the globe at this placemark's position and retains its orientation relative to the globe.
        Returns:
        The WorldWind.OrientationMode to use when image rotation applied.
      • setImageRotationReference

        public Placemark setImageRotationReference​(int imageRotationReference)
        Sets the type of rotation to apply if the getImageRotation() is not zero. This value indicates whether to apply this placemark's image rotation relative to the screen or the globe.
        If WorldWind.RELATIVE_TO_SCREEN, this placemark's image is rotated in the plane of the screen and its orientation relative to the globe changes as the view changes. If WorldWind.RELATIVE_TO_GLOBE, this placemark's image is rotated in a plane tangent to the globe at this placemark's position and retains its orientation relative to the globe.
        Parameters:
        imageRotationReference - The WorldWind.OrientationMode to use when image rotation applied.
        Returns:
        This placemark.
      • getImageTilt

        public double getImageTilt()
        Gets the amount of tilt to apply to the image, measured in degrees away from the eye point and relative to this placemark's getImageTiltReference(). While any positive or negative number may be specified, values outside the range [0. 90] cause some or all of the image to be clipped.
        Returns:
        The amount, in degrees, to tilt the image.
      • setImageTilt

        public Placemark setImageTilt​(double imageTilt)
        Sets the amount of tilt to apply to the image, measured in degrees away from the eye point and relative to this placemark's getImageTiltReference(). While any positive or negative number may be specified, values outside the range [0. 90] cause some or all of the image to be clipped.
        Parameters:
        imageTilt - The amount, in degrees, to tilt the image.
        Returns:
        This placemark.
      • getImageTiltReference

        public int getImageTiltReference()
        Gets the type tilt to apply when getImageTilt() is non-zero. This value indicates whether to apply this placemark's image tilt relative to the screen or the globe.
        If WorldWind.RELATIVE_TO_SCREEN, this placemark's image is tilted inwards (for positive tilts) relative to the plane of the screen, and its orientation relative to the globe changes as the view changes. If WorldWind.RELATIVE_TO_GLOBE, this placemark's image is tilted towards the globe's surface, and retains its orientation relative to the surface.
        Returns:
        The WorldWind.OrientationMode to use when the image is tilted.
      • setImageTiltReference

        public Placemark setImageTiltReference​(int imageTiltReference)
        Sets the type tilt to apply when getImageTilt() is non-zero. This value indicates whether to apply this placemark's image tilt relative to the screen or the globe.
        If WorldWind.RELATIVE_TO_SCREEN, this placemark's image is tilted inwards (for positive tilts) relative to the plane of the screen, and its orientation relative to the globe changes as the view changes. If WorldWind.RELATIVE_TO_GLOBE, this placemark's image is tilted towards the globe's surface, and retains its orientation relative to the surface.
        Parameters:
        imageTiltReference - The WorldWind.OrientationMode to use when the image is tilted.
        Returns:
        This placemark.
      • isEnableLeaderPicking

        public boolean isEnableLeaderPicking()
        Indicates if picking is allowed on this placemark's (optional) leader.
        Returns:
        true if leader picking is enabled, otherwise false
      • setEnableLeaderPicking

        public Placemark setEnableLeaderPicking​(boolean enableLeaderPicking)
        Sets whether picking is allowed on this placemark's (optional) leader.
        Parameters:
        enableLeaderPicking - true if leader picking should be enabled, otherwise false
        Returns:
        this placemark
      • isHighlighted

        public boolean isHighlighted()
        Indicates whether this placemark uses its highlight attributes rather than its normal attributes.
        Specified by:
        isHighlighted in interface Highlightable
        Returns:
        True if this placemark should be highlighted.
      • setHighlighted

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

        public Position getReferencePosition()
        A position associated with the object that indicates its aggregate geographic position. For a Placemark, 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 Placemark, 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.