Class Marker


  • public final class Marker
    extends MapCoordinateElement
    A marker in the map. A marker has a position where it is displayed, an image URL for the image to be displayed and offset values for x and y. The image should be in a format supporting transparency that can be rendered by JavaFX8 WebView. The image is rendered with it's top left point at the coordinate. This can be adjusted by setting the pixel offset values, x positive to the right, y positive down.

    The image URL and offset values can only be set at construction time, the coordinate is a JavaFX property. The Marker has a visibility property which must be set to true to make the marker visible. With this property it is possible to hide the marker without completely removing it from the map.

    A marker has a unique (within class existence in the VM) id of the form "marker-NNN" where NNN is a consecutive number assigned on creation. A Marker may have an attached Label. If it has one, the Label is shown/hidden/moved/removed together with the Marker. Any attempt to do these operations directly on the Label are ignored.
    Author:
    P.J. Meisch ([email protected]).
    • Constructor Detail

      • Marker

        public Marker​(java.net.URL imageURL)
        constructs an object with the given URL and offset values set to 0.
        Parameters:
        imageURL - the image URL
      • Marker

        public Marker​(java.net.URL imageURL,
                      int offsetX,
                      int offsetY)
        constructs a Marker with the given values.
        Parameters:
        imageURL - image URL
        offsetX - horizontal pixel offset
        offsetY - vertical pixel offset
        Throws:
        java.lang.NullPointerException - if imageURL is null
    • Method Detail

      • createProvided

        public static Marker createProvided​(Marker.Provided provided)
        return a provided Marker with the given color.
        Parameters:
        provided - desired color
        Returns:
        Marker
        Throws:
        java.lang.NullPointerException - when provided is null
      • getImageURL

        public java.net.URL getImageURL()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • attachLabel

        public Marker attachLabel​(MapLabel mapLabel)
        attaches the MapLabel to this Marker
        Parameters:
        mapLabel - the MapLabel to attach
        Returns:
        this object
        Throws:
        java.lang.NullPointerException - of mapLabel is null
      • detachLabel

        public Marker detachLabel()
        detaches an attached Label.
        Returns:
        this object
      • getMapLabel

        public java.util.Optional<MapLabel> getMapLabel()
      • setVisible

        public Marker setVisible​(boolean visible)
        Description copied from class: MapElement
        sets the visibilty of the marker
        Overrides:
        setVisible in class MapElement
        Parameters:
        visible - visibilty
        Returns:
        this object