public class Polygon extends Layer
Polygon draws a closed connected series of line segments specified by a list of LatLongs.
If the first and the last LatLong are not equal, the Polygon will be closed automatically.
A Polygon holds two Paint objects to allow for different outline and filling. These paints define
drawing parameters such as color, stroke width, pattern and transparency.displayModel| Constructor and Description |
|---|
Polygon(org.mapsforge.core.graphics.Paint paintFill,
org.mapsforge.core.graphics.Paint paintStroke,
org.mapsforge.core.graphics.GraphicFactory graphicFactory) |
Polygon(org.mapsforge.core.graphics.Paint paintFill,
org.mapsforge.core.graphics.Paint paintStroke,
org.mapsforge.core.graphics.GraphicFactory graphicFactory,
boolean keepAligned) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(org.mapsforge.core.model.LatLong tapLatLong) |
void |
draw(org.mapsforge.core.model.BoundingBox boundingBox,
byte zoomLevel,
org.mapsforge.core.graphics.Canvas canvas,
org.mapsforge.core.model.Point topLeftPoint)
Draws this
Layer on the given canvas. |
java.util.List<org.mapsforge.core.model.LatLong> |
getLatLongs() |
org.mapsforge.core.graphics.Paint |
getPaintFill() |
org.mapsforge.core.graphics.Paint |
getPaintStroke() |
boolean |
isKeepAligned() |
void |
setPaintFill(org.mapsforge.core.graphics.Paint paintFill) |
void |
setPaintStroke(org.mapsforge.core.graphics.Paint paintStroke) |
getDisplayModel, getPosition, isVisible, onAdd, onDestroy, onLongPress, onRemove, onTap, requestRedraw, setDisplayModel, setVisible, setVisiblepublic Polygon(org.mapsforge.core.graphics.Paint paintFill,
org.mapsforge.core.graphics.Paint paintStroke,
org.mapsforge.core.graphics.GraphicFactory graphicFactory)
paintFill - the initial Paint used to fill this polygon (may be null).paintStroke - the initial Paint used to stroke this polygon (may be null).graphicFactory - the GraphicFactorypublic Polygon(org.mapsforge.core.graphics.Paint paintFill,
org.mapsforge.core.graphics.Paint paintStroke,
org.mapsforge.core.graphics.GraphicFactory graphicFactory,
boolean keepAligned)
paintFill - the initial Paint used to fill this polygon (may be null).paintStroke - the initial Paint used to stroke this polygon (may be null).graphicFactory - the GraphicFactorykeepAligned - if set to true it will keep the bitmap aligned with the map,
to avoid a moving effect of a bitmap shader.public boolean contains(org.mapsforge.core.model.LatLong tapLatLong)
public void draw(org.mapsforge.core.model.BoundingBox boundingBox,
byte zoomLevel,
org.mapsforge.core.graphics.Canvas canvas,
org.mapsforge.core.model.Point topLeftPoint)
LayerLayer on the given canvas.draw in class LayerboundingBox - the geographical area which should be drawn.zoomLevel - the zoom level at which this Layer should draw itself.canvas - the canvas on which this Layer should draw itself.topLeftPoint - the top-left pixel position of the canvas relative to the top-left map position.public java.util.List<org.mapsforge.core.model.LatLong> getLatLongs()
public org.mapsforge.core.graphics.Paint getPaintFill()
Paint used to fill this polygon (may be null).public org.mapsforge.core.graphics.Paint getPaintStroke()
Paint used to stroke this polygon (may be null).public boolean isKeepAligned()
public void setPaintFill(org.mapsforge.core.graphics.Paint paintFill)
paintFill - the new Paint used to fill this polygon (may be null).public void setPaintStroke(org.mapsforge.core.graphics.Paint paintStroke)
paintStroke - the new Paint used to stroke this polygon (may be null).