|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhpotsdam.unfolding.marker.AbstractMarker
public abstract class AbstractMarker
Abstract marker handling conversion of location to appropriate coordinate system, and handles basic marker functionality. All default marker of Unfolding implement this. Your own class can extend this AbstractMarker or implement the Marker interface, directly.
Field Summary | |
---|---|
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 Summary | |
---|---|
AbstractMarker()
|
|
AbstractMarker(Location location)
|
|
AbstractMarker(Location location,
java.util.HashMap<java.lang.String,java.lang.Object> props)
|
Method Summary | |
---|---|
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. |
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)
|
void |
setHighlightStrokeColor(int highlightStrokeColor)
|
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. |
void |
setSelected(boolean selected)
Changes the select status of this marker. |
void |
setStrokeColor(int color)
Sets the color of the border. |
void |
setStrokeWeight(int strokeWeight)
Sets the thickness of the border of this marker. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public AbstractMarker()
public AbstractMarker(Location location)
public AbstractMarker(Location location, java.util.HashMap<java.lang.String,java.lang.Object> props)
Method Detail |
---|
public java.lang.String getId()
Marker
getId
in interface Marker
public void setId(java.lang.String id)
Marker
setId
in interface Marker
id
- The ID.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.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 void draw(UnfoldingMap map)
draw(PGraphics, float, float, UnfoldingMap)
.
draw
in interface Marker
map
- The map to draw on.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.
isInside
in interface Marker
map
- The map to draw on.checkX
- The x position to check in screen coordinates.checkY
- The y position to check in screen coordinates.
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
setHidden
in interface Marker
hidden
- The new statuspublic boolean isHidden()
Marker
isHidden
in interface Marker
public void setColor(int color)
Marker
setColor
in interface Marker
color
- The color (in Processing's color type)public void setStrokeWeight(int strokeWeight)
Marker
setStrokeWeight
in interface Marker
strokeWeight
- Thickness in pixel.public void setHighlightColor(int highlightColor)
public void setHighlightStrokeColor(int highlightStrokeColor)
public void setStrokeColor(int color)
Marker
setStrokeColor
in interface Marker
color
- The color (in Processing's color type)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |