public abstract class AbstractShapeMarker extends AbstractMarker
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.util.List<Location>> |
interiorRingLocationArray
Optional interior rings (polygon holes).
|
protected java.util.List<Location> |
locations
All locations defining (the outline of) this shape.
|
color, hidden, highlightColor, highlightStrokeColor, id, location, properties, selected, strokeColor, strokeWeight
Constructor and Description |
---|
AbstractShapeMarker()
Creates an empty shape marker with no locations.
|
AbstractShapeMarker(java.util.List<Location> locations)
Creates a shape marker for the given locations.
|
AbstractShapeMarker(java.util.List<Location> locations,
java.util.HashMap<java.lang.String,java.lang.Object> properties)
Creates a shape marker for the given locations.
|
Modifier and Type | Method and Description |
---|---|
void |
addLocation(float lat,
float lon)
Adds a Location to the list of locations.
|
void |
addLocations(java.util.List<Location> locations)
Adds all locations to the list of locations.
|
void |
addLocations(Location... locations)
Adds all locations to the list of locations.
|
boolean |
contains(float latitude,
float longitude) |
boolean |
contains(Location location) |
void |
draw(processing.core.PGraphics pg,
float x,
float y)
Draws a visual representation of this marker.
|
abstract void |
draw(processing.core.PGraphics pg,
java.util.List<MapPosition> mapPositions)
Draws marker in outer object coordinate system.
|
protected void |
draw(processing.core.PGraphics pg,
java.util.List<MapPosition> mapPositions,
java.util.HashMap<java.lang.String,java.lang.Object> properties,
UnfoldingMap map)
Simply calls
draw(PGraphics, List) . |
void |
draw(processing.core.PGraphics pg,
java.util.List<MapPosition> mapPositions,
java.util.List<java.util.List<MapPosition>> ringMapPositionsArray)
Draws marker in outer object coordinate system including interior rings.
|
void |
draw(UnfoldingMap map)
Draws this marker onto the map.
|
Location |
getCentroid()
Returns the geometric center of this shape.
|
java.util.List<java.util.List<Location>> |
getInteriorRings()
Returns all interior rings of the shape.
|
Location |
getLocation()
Gets the geometric center location of this marker.
|
Location |
getLocation(int index)
Gets the location at the specified index.
|
java.util.List<Location> |
getLocations()
Gets all locations.
|
protected boolean |
isInside(float checkX,
float checkY,
float x,
float y)
Checks whether given position is inside the marker.
|
protected boolean |
isInside(float checkX,
float checkY,
java.util.List<? extends processing.core.PVector> vectors)
Checks whether the position is within the border of the vectors.
|
boolean |
isInside(UnfoldingMap map,
float checkX,
float checkY)
Checks whether given position is inside this marker, according to the maps coordinate system.
|
boolean |
isInsideByLocation(float latitude,
float longitude)
Checks whether given position is inside this marker, according to the shape defined by the marker's locations.
|
boolean |
isInsideByLocation(Location location) |
void |
removeLocation(int index)
Deletes a Location from the list of locations.
|
void |
removeLocation(Location location)
Deletes a Location from the list of locations.
|
void |
setInteriorRings(java.util.List<java.util.List<Location>> interiorRingLocationArray)
Sets a list of lists of locations as interior rings.
|
void |
setLocation(Location location)
Adds the given location to the list of locations.
|
void |
setLocations(java.util.List<Location> locations)
Sets the list of locations.
|
draw, getDistanceTo, getId, getIntegerProperty, getProperties, getProperty, getScreenPosition, getStringProperty, isHidden, isSelected, setColor, setHidden, setHighlightColor, setHighlightStrokeColor, setId, setLocation, setProperties, setProperty, setSelected, setStrokeColor, setStrokeWeight
protected java.util.List<Location> locations
protected java.util.List<java.util.List<Location>> interiorRingLocationArray
public AbstractShapeMarker()
public AbstractShapeMarker(java.util.List<Location> locations)
locations
- The list of locations.public AbstractShapeMarker(java.util.List<Location> locations, java.util.HashMap<java.lang.String,java.lang.Object> properties)
locations
- The list of locations.properties
- Some data properties for this marker.public void setLocations(java.util.List<Location> locations)
locations
- A list of Locations.public java.util.List<Location> getLocations()
public void addLocations(Location... locations)
locations
- One or multiple Location.public void addLocations(java.util.List<Location> locations)
locations
- A list of Locations.public void addLocation(float lat, float lon)
lat
- The latitude value.lon
- The longitude value.public Location getLocation(int index)
index
- The index of the location.public void removeLocation(Location location)
location
- The Location to remove.public void removeLocation(int index)
index
- The index of the Location to remove.public void setLocation(Location location)
setLocation
in interface Marker
setLocation
in class AbstractMarker
location
- The location to add.public Location getLocation()
getLocation
in interface Marker
getLocation
in class AbstractMarker
public Location getCentroid()
public java.util.List<java.util.List<Location>> getInteriorRings()
public void setInteriorRings(java.util.List<java.util.List<Location>> interiorRingLocationArray)
interiorRingLocationArray
- The array of locations for all interior rings.public void draw(UnfoldingMap map)
AbstractMarker
AbstractMarker.draw(PGraphics, float, float, UnfoldingMap)
.draw
in interface Marker
draw
in class AbstractMarker
map
- The map to draw on.protected void draw(processing.core.PGraphics pg, java.util.List<MapPosition> mapPositions, java.util.HashMap<java.lang.String,java.lang.Object> properties, UnfoldingMap map)
draw(PGraphics, List)
.
To be overwritten by sub-classes if properties and/or map is needed.pg
- The PGraphics to draw on.mapPositions
- The positions in map (, i.e. outer object) coordinates.properties
- The data properties of this marker.map
- The Unfolding map this marker belongs to.public abstract void draw(processing.core.PGraphics pg, java.util.List<MapPosition> mapPositions)
pg
- The PGraphics to draw on.mapPositions
- The positions in map (, i.e. outer object) coordinates.public void draw(processing.core.PGraphics pg, java.util.List<MapPosition> mapPositions, java.util.List<java.util.List<MapPosition>> ringMapPositionsArray)
draw(PGraphics, List)
and ignores interior rings! Needs to be implemented in
sub-class! (See SimplePolygonMarker.draw(PGraphics, List, List)
.)pg
- The PGraphics to draw on.mapPositions
- The positions in map (, i.e. outer object) coordinates.ringMapPositionsArray
- A list of lists of positions (for interior rings).public void draw(processing.core.PGraphics pg, float x, float y)
AbstractMarker
draw
in class AbstractMarker
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)
AbstractMarker
AbstractMarker.isInside(float, float, float, float)
of the sub class.isInside
in interface Marker
isInside
in class AbstractMarker
map
- The map to draw on.checkX
- The x position to check in screen coordinates.checkY
- The y position to check in screen coordinates.protected boolean isInside(float checkX, float checkY, java.util.List<? extends processing.core.PVector> vectors)
checkX
- The x position to check if inside.checkY
- The y position to check if inside.vectors
- The vectors of the polygonpublic boolean isInsideByLocation(float latitude, float longitude)
isInside(UnfoldingMap, float, float)
may check whether a point is inside the
visual representation, which has an area.longitude
- The longitude.latitude
- The latitude.public boolean isInsideByLocation(Location location)
isInsideByLocation(float, float)
public boolean contains(float latitude, float longitude)
isInsideByLocation(float, float)
public boolean contains(Location location)
isInsideByLocation(Location)
protected boolean isInside(float checkX, float checkY, float x, float y)
AbstractMarker
isInside
in class AbstractMarker
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.