de.fhpotsdam.unfolding.marker
Interface Marker

All Known Implementing Classes:
AbstractMarker, AbstractShapeMarker, MultiMarker, SimpleLinesMarker, SimplePointMarker, SimplePolygonMarker

public interface Marker

Marker interface for all markers to be drawn on to maps. A marker has at least one location, and properties. A marker can be drawn, selected, and tested if hit.


Method Summary
 void draw(UnfoldingMap map)
          Draws this marker.
 double getDistanceTo(Location location)
          Calculate distance between this marker and the given location.
 java.lang.String getId()
          Gets the marker ID.
 Location getLocation()
          Gets the location of this marker.
 java.util.HashMap<java.lang.String,java.lang.Object> getProperties()
          Gets the optional properties of this marker.
 java.lang.Object getProperty(java.lang.String key)
          Gets the property for given key.
 java.lang.String getStringProperty(java.lang.String key)
          Gets the property as String for given key.
 boolean isHidden()
          Indicates whether this marker is hidden.
 boolean isInside(UnfoldingMap map, float checkX, float checkY)
          Checks whether given position is inside this marker, according to the maps coordinate system.
 boolean isSelected()
          Indicates whether this marker is selected.
 void setColor(int color)
          Sets the main color of this marker.
 void setHidden(boolean hidden)
          Sets the visibility status of this marker.
 void setId(java.lang.String id)
          Sets the marker ID.
 void setLocation(float lat, float lng)
          Set the location for this marker.
 void setLocation(Location location)
          Set the location for this marker.
 void setProperties(java.util.HashMap<java.lang.String,java.lang.Object> properties)
          Sets the optional properties of this marker.
 void setSelected(boolean selected)
          Changes the select status of this marker.
 void setStrokeColor(int color)
          Sets the color of the border.
 void setStrokeWeight(int weight)
          Sets the thickness of the border of this marker.
 

Method Detail

getId

java.lang.String getId()
Gets the marker ID.

Returns:
An ID.

setId

void setId(java.lang.String id)
Sets the marker ID.

Parameters:
id - The ID.

getLocation

Location getLocation()
Gets the location of this marker. For point marker this returns the single location, for shape markers it should return a meaningful location, e.g. the centroid.

Returns:
The location with lat, lng.

setLocation

void setLocation(float lat,
                 float lng)
Set the location for this marker.

Parameters:
lat - latitude
lng - longitude

setLocation

void setLocation(Location location)
Set the location for this marker.

Parameters:
location - Location with lat, lng

getDistanceTo

double getDistanceTo(Location location)
Calculate distance between this marker and the given location.

Parameters:
location - The location to calculate the distance to.
Returns:
Distance to location in kilometers (km).

setProperties

void setProperties(java.util.HashMap<java.lang.String,java.lang.Object> properties)
Sets the optional properties of this marker.

Parameters:
properties - The properties to set. The map consist of key,value pairs for each property.

getProperties

java.util.HashMap<java.lang.String,java.lang.Object> getProperties()
Gets the optional properties of this marker. The map consist of key,value pairs for each property.

Returns:
A map of properties.

getProperty

java.lang.Object getProperty(java.lang.String key)
Gets the property for given key.

Parameters:
key - The key of the property.
Returns:
The property, if found.

getStringProperty

java.lang.String getStringProperty(java.lang.String key)
Gets the property as String for given key.

Parameters:
key - The key of the property.
Returns:
The property, if found.

isInside

boolean isInside(UnfoldingMap map,
                 float checkX,
                 float checkY)
Checks whether given position is inside this marker, according to the maps coordinate system. Can be used for interactive hit tests, e.g. mouse interaction

Parameters:
map - The map to draw on.
checkX - The x position to check in screen coordinates.
checkY - The y position to check in screen coordinates.
Returns:
true if inside, false otherwise.

draw

void draw(UnfoldingMap map)
Draws this marker.

Parameters:
map - The map to draw on.

setSelected

void setSelected(boolean selected)
Changes the select status of this marker. Sub-classes can use the selection status to highlight this marker.

Parameters:
selected - Whether this marker is selected or not.

isSelected

boolean isSelected()
Indicates whether this marker is selected. Can be used for drawing the marker differently, e.g. to highlight it.

Returns:
true if it is selected, false otherwise.

setHidden

void setHidden(boolean hidden)
Sets the visibility status of this marker.

Parameters:
hidden - The new status

isHidden

boolean isHidden()
Indicates whether this marker is hidden. Can be used for drawing the marker differently.

Returns:
true if it is hidden, false otherwise.

setColor

void setColor(int color)
Sets the main color of this marker.

Parameters:
color - The color (in Processing's color type)

setStrokeColor

void setStrokeColor(int color)
Sets the color of the border.

Parameters:
color - The color (in Processing's color type)

setStrokeWeight

void setStrokeWeight(int weight)
Sets the thickness of the border of this marker.

Parameters:
weight - Thickness in pixel.