public abstract class Layer
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected DisplayModel |
displayModel |
| Constructor and Description |
|---|
Layer() |
| Modifier and Type | Method and Description |
|---|---|
abstract 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. |
DisplayModel |
getDisplayModel()
Getter for DisplayModel.
|
org.mapsforge.core.model.LatLong |
getPosition()
Gets the geographic position of this layer element, if it exists.
|
boolean |
isVisible() |
protected void |
onAdd()
Called each time this
Layer is added to a Layers list. |
void |
onDestroy() |
boolean |
onLongPress(org.mapsforge.core.model.LatLong tapLatLong,
org.mapsforge.core.model.Point layerXY,
org.mapsforge.core.model.Point tapXY)
Handles a long press event.
|
protected void |
onRemove()
Called each time this
Layer is removed from a Layers list. |
boolean |
onTap(org.mapsforge.core.model.LatLong tapLatLong,
org.mapsforge.core.model.Point layerXY,
org.mapsforge.core.model.Point tapXY)
Handles a tap event.
|
void |
requestRedraw()
Requests an asynchronous redrawing of all layers.
|
void |
setDisplayModel(DisplayModel displayModel)
The DisplayModel comes from a MapView, so is generally not known when the layer itself is created.
|
void |
setVisible(boolean visible)
Sets the visibility flag of this
Layer to the given value. |
void |
setVisible(boolean visible,
boolean redraw)
Sets the visibility flag of this
Layer to the given value. |
protected DisplayModel displayModel
public abstract void draw(org.mapsforge.core.model.BoundingBox boundingBox,
byte zoomLevel,
org.mapsforge.core.graphics.Canvas canvas,
org.mapsforge.core.model.Point topLeftPoint)
Layer on the given canvas.boundingBox - 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 org.mapsforge.core.model.LatLong getPosition()
public final boolean isVisible()
Layer is currently visible, false otherwise. The default value is true.public void onDestroy()
public boolean onLongPress(org.mapsforge.core.model.LatLong tapLatLong,
org.mapsforge.core.model.Point layerXY,
org.mapsforge.core.model.Point tapXY)
tapLatLong - the geographic position of the long press.layerXY - the xy position of the layer element (if available)tapXY - the xy position of the tappublic boolean onTap(org.mapsforge.core.model.LatLong tapLatLong,
org.mapsforge.core.model.Point layerXY,
org.mapsforge.core.model.Point tapXY)
tapLatLong - the the geographic position of the tap.layerXY - the xy position of the layer element (if available)tapXY - the xy position of the tappublic final void requestRedraw()
public DisplayModel getDisplayModel()
public void setDisplayModel(DisplayModel displayModel)
displayModel - the displayModel to use.public final void setVisible(boolean visible)
Layer to the given value.
Note: By default a redraw will take place afterwards.public void setVisible(boolean visible,
boolean redraw)
Layer to the given value.protected void onAdd()
Layer is added to a Layers list.protected void onRemove()
Layer is removed from a Layers list.