Class Marker

  • All Implemented Interfaces:
    ILatLon, Destroyable, TemplateEngineDataProvider
    Direct Known Subclasses:
    ButtonMarker, PlayHeadMarker

    public class Marker
    extends Object
    implements TemplateEngineDataProvider, ILatLon, Destroyable
    Basic marker class. Requires a position, and supports a custom icon and a name. This class is also used to create appropriate Marker-type objects when waypoints are imported. It hosts a public list object, named makers, containing implementations of the MarkerMaker interface. Whenever a Marker needs to be created, each object in makers is called with the waypoint parameters (Lat/Lon and tag data), and the first one to return a Marker object wins. By default, one the list contains one default "Maker" implementation that will create AudioMarkers for supported audio files, ImageMarkers for supported image files, and WebMarkers for everything else. (The creation of a WebMarker will fail if there's no valid URL in the <link> tag, so it might still make sense to add Makers for such waypoints at the end of the list.) The default implementation only looks at the value of the <link> tag inside the <wpt> tag of the GPX file.

    HowTo implement a new Marker

    • Subclass Marker or ButtonMarker and override containsPoint if you like to respond to user clicks
    • Override paint, if you want a custom marker look (not "a label and a symbol")
    • Implement MarkerCreator to return a new instance of your marker class
    • In you plugin constructor, add an instance of your MarkerCreator implementation either on top or bottom of Marker.markerProducers. Add at top, if your marker should overwrite an current marker or at bottom if you only add a new marker style.