Package org.mapsforge.map.layer.overlay
Class Polyline
- java.lang.Object
-
- org.mapsforge.map.layer.Layer
-
- org.mapsforge.map.layer.overlay.Polyline
-
public class Polyline extends Layer
APolylinedraws a connected series of line segments specified by a list ofLatLongs. APolylineholds aPaintobject which defines drawing parameters such as color, stroke width, pattern and transparency.
-
-
Field Summary
-
Fields inherited from class org.mapsforge.map.layer.Layer
displayModel
-
-
Constructor Summary
Constructors Constructor Description Polyline(org.mapsforge.core.graphics.Paint paintStroke, org.mapsforge.core.graphics.GraphicFactory graphicFactory)Polyline(org.mapsforge.core.graphics.Paint paintStroke, org.mapsforge.core.graphics.GraphicFactory graphicFactory, boolean keepAligned)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPoint(org.mapsforge.core.model.LatLong point)voidaddPoints(java.util.List<org.mapsforge.core.model.LatLong> points)voidclear()booleancontains(org.mapsforge.core.model.Point tapXY, MapViewProjection mapViewProjection)voiddraw(org.mapsforge.core.model.BoundingBox boundingBox, byte zoomLevel, org.mapsforge.core.graphics.Canvas canvas, org.mapsforge.core.model.Point topLeftPoint)Draws thisLayeron the given canvas.java.util.List<org.mapsforge.core.model.LatLong>getLatLongs()org.mapsforge.core.graphics.PaintgetPaintStroke()doublegetStrokeIncrease()booleanisKeepAligned()voidsetPaintStroke(org.mapsforge.core.graphics.Paint paintStroke)voidsetPoints(java.util.List<org.mapsforge.core.model.LatLong> points)voidsetStrokeIncrease(double strokeIncrease)-
Methods inherited from class org.mapsforge.map.layer.Layer
getDisplayModel, getPosition, isVisible, onAdd, onDestroy, onLongPress, onRemove, onScroll, onTap, requestRedraw, setDisplayModel, setVisible, setVisible
-
-
-
-
Constructor Detail
-
Polyline
public Polyline(org.mapsforge.core.graphics.Paint paintStroke, org.mapsforge.core.graphics.GraphicFactory graphicFactory)- Parameters:
paintStroke- the initialPaintused to stroke this polyline (may be null).graphicFactory- the GraphicFactory
-
Polyline
public Polyline(org.mapsforge.core.graphics.Paint paintStroke, org.mapsforge.core.graphics.GraphicFactory graphicFactory, boolean keepAligned)- Parameters:
paintStroke- the initialPaintused to stroke this polyline (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.
-
-
Method Detail
-
addPoint
public void addPoint(org.mapsforge.core.model.LatLong point)
-
addPoints
public void addPoints(java.util.List<org.mapsforge.core.model.LatLong> points)
-
clear
public void clear()
-
contains
public boolean contains(org.mapsforge.core.model.Point tapXY, MapViewProjection mapViewProjection)
-
draw
public void draw(org.mapsforge.core.model.BoundingBox boundingBox, byte zoomLevel, org.mapsforge.core.graphics.Canvas canvas, org.mapsforge.core.model.Point topLeftPoint)Description copied from class:LayerDraws thisLayeron the given canvas.- Specified by:
drawin classLayer- Parameters:
boundingBox- the geographical area which should be drawn.zoomLevel- the zoom level at which thisLayershould draw itself.canvas- the canvas on which thisLayershould draw itself.topLeftPoint- the top-left pixel position of the canvas relative to the top-left map position.
-
getLatLongs
public java.util.List<org.mapsforge.core.model.LatLong> getLatLongs()
- Returns:
- a thread-safe list of LatLongs in this polyline.
-
getPaintStroke
public org.mapsforge.core.graphics.Paint getPaintStroke()
- Returns:
- the
Paintused to stroke this polyline (may be null).
-
getStrokeIncrease
public double getStrokeIncrease()
- Returns:
- the base to scale polyline stroke per zoom (default 1 not scale).
-
isKeepAligned
public boolean isKeepAligned()
- Returns:
- true if it keeps the bitmap aligned with the map, to avoid a moving effect of a bitmap shader, false otherwise.
-
setPaintStroke
public void setPaintStroke(org.mapsforge.core.graphics.Paint paintStroke)
- Parameters:
paintStroke- the newPaintused to stroke this polyline (may be null).
-
setPoints
public void setPoints(java.util.List<org.mapsforge.core.model.LatLong> points)
-
setStrokeIncrease
public void setStrokeIncrease(double strokeIncrease)
- Parameters:
strokeIncrease- the base to scale polyline stroke per zoom (default 1 not scale).
-
-