public abstract class AbstractMarker extends java.lang.Object implements Marker
Modifier and Type | Field and Description |
---|---|
protected int |
color |
protected boolean |
hidden
Indicates whether this marker is hidden.
|
protected int |
highlightColor |
protected int |
highlightStrokeColor |
protected java.lang.String |
id
The ID of this marker.
|
protected Location |
location
The location of this marker.
|
protected java.util.HashMap<java.lang.String,java.lang.Object> |
properties
Optional data properties.
|
protected boolean |
selected
Indicates whether this marker is selected.
|
protected int |
strokeColor |
protected int |
strokeWeight |
Constructor and Description |
---|
AbstractMarker() |
AbstractMarker(Location location) |
AbstractMarker(Location location,
java.util.HashMap<java.lang.String,java.lang.Object> props) |
Modifier and Type | Method and Description |
---|---|
abstract void |
draw(processing.core.PGraphics pg,
float x,
float y)
Draws a visual representation of this marker.
|
protected void |
draw(processing.core.PGraphics pg,
float x,
float y,
UnfoldingMap map)
Draws a visual representation of this marker.
|
void |
draw(UnfoldingMap map)
Draws this marker onto the map.
|
double |
getDistanceTo(Location location)
Calculate distance between this marker and the given location.
|
java.lang.String |
getId()
Gets the marker ID.
|
java.lang.Integer |
getIntegerProperty(java.lang.String key)
Gets the property as Integer for given key.
|
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.
|
ScreenPosition |
getScreenPosition(UnfoldingMap map) |
java.lang.String |
getStringProperty(java.lang.String key)
Gets the property as String for given key.
|
boolean |
isHidden()
Indicates whether this marker is hidden.
|
protected abstract boolean |
isInside(float checkX,
float checkY,
float x,
float y)
Checks whether given position is inside the marker.
|
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 |
setHighlightColor(int highlightColor)
Sets the highlight color of this marker.
|
void |
setHighlightStrokeColor(int highlightStrokeColor)
Sets the highlight color of this marker's border.
|
void |
setId(java.lang.String id)
Sets the marker ID.
|
void |
setLocation(float lat,
float lon)
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> props)
Sets the optional properties of this marker.
|
java.lang.Object |
setProperty(java.lang.String key,
java.lang.Object value)
Sets the property for given key.
|
void |
setSelected(boolean selected)
Changes the select status of this marker.
|
void |
setStrokeColor(int color)
Sets the color of this marker's border.
|
void |
setStrokeWeight(int strokeWeight)
Sets the thickness of the border of this marker.
|
protected int color
protected int strokeColor
protected int strokeWeight
protected int highlightColor
protected int highlightStrokeColor
protected Location location
protected java.util.HashMap<java.lang.String,java.lang.Object> properties
protected boolean selected
protected boolean hidden
protected java.lang.String id
public AbstractMarker()
public AbstractMarker(Location location)
public AbstractMarker(Location location, java.util.HashMap<java.lang.String,java.lang.Object> props)
public java.lang.String getId()
Marker
public void setId(java.lang.String id)
Marker
public void setProperties(java.util.HashMap<java.lang.String,java.lang.Object> props)
Marker
setProperties
in interface Marker
props
- The properties to set. The map consist of key,value pairs for each property.public java.lang.Object setProperty(java.lang.String key, java.lang.Object value)
Marker
setProperty
in interface Marker
key
- The key of the property.value
- The value of the property.public java.util.HashMap<java.lang.String,java.lang.Object> getProperties()
Marker
getProperties
in interface Marker
public java.lang.Object getProperty(java.lang.String key)
Marker
getProperty
in interface Marker
key
- The key of the property.public java.lang.String getStringProperty(java.lang.String key)
Marker
getStringProperty
in interface Marker
key
- The key of the property.public java.lang.Integer getIntegerProperty(java.lang.String key)
Marker
getIntegerProperty
in interface Marker
key
- The key of the property.public void draw(UnfoldingMap map)
draw(PGraphics, float, float, UnfoldingMap)
.protected void draw(processing.core.PGraphics pg, float x, float y, UnfoldingMap map)
pg
- The PGraphics to draw on.x
- The x position in object coordinates.y
- The y position in object coordinates.map
- The map to draw on. Can be used to draw a marker which depends on other properties of the map.public abstract void draw(processing.core.PGraphics pg, float x, float y)
pg
- The PGraphics to draw onx
- The x position in outer object coordinates.y
- The y position in outer object coordinates.public boolean isInside(UnfoldingMap map, float checkX, float checkY)
isInside(float, float, float, float)
of the sub class.public ScreenPosition getScreenPosition(UnfoldingMap map)
public Location getLocation()
Marker
getLocation
in interface Marker
public void setLocation(Location location)
Marker
setLocation
in interface Marker
location
- Location with lat, lngpublic void setLocation(float lat, float lon)
Marker
setLocation
in interface Marker
lat
- latitudelon
- longitudepublic double getDistanceTo(Location location)
Marker
getDistanceTo
in interface Marker
location
- The location to calculate the distance to.protected abstract boolean isInside(float checkX, float checkY, float x, float y)
checkX
- The x position to check in screen coordinates.checkY
- The y position to check in screen coordinates.x
- The x position of this marker in screen coordinates.y
- The y position of this marker in screen coordinates.public void setSelected(boolean selected)
Marker
setSelected
in interface Marker
selected
- Whether this marker is selected or not.public boolean isSelected()
Marker
isSelected
in interface Marker
public void setHidden(boolean hidden)
Marker
public boolean isHidden()
Marker
public void setColor(int color)
Marker
public void setStrokeWeight(int strokeWeight)
Marker
setStrokeWeight
in interface Marker
strokeWeight
- Thickness in pixel.public void setHighlightColor(int highlightColor)
Marker
setHighlightColor
in interface Marker
highlightColor
- The color (in Processing's color type)public void setHighlightStrokeColor(int highlightStrokeColor)
Marker
setHighlightStrokeColor
in interface Marker
public void setStrokeColor(int color)
Marker
setStrokeColor
in interface Marker
color
- The color (in Processing's color type)