public abstract class Layer extends Object
| Modifier and Type | Field and Description |
|---|---|
protected DisplayModel |
displayModel |
| Constructor and Description |
|---|
Layer() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
draw(BoundingBox boundingBox,
byte zoomLevel,
Canvas canvas,
Point topLeftPoint)
Draws this
Layer on the given canvas. |
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(LatLong tapLatLong,
Point layerXY,
Point tapXY)
Handles a long press event.
|
protected void |
onRemove()
Called each time this
Layer is removed from a Layers list. |
boolean |
onTap(LatLong tapLatLong,
Point layerXY,
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(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, 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 LatLong getPosition()
The default implementation of this method returns null.
public final boolean isVisible()
Layer is currently visible, false otherwise. The default value is true.public void onDestroy()
public boolean onLongPress(LatLong tapLatLong, Point layerXY, Point tapXY)
The default implementation of this method does nothing and returns false.
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(LatLong tapLatLong, Point layerXY, Point tapXY)
The default implementation of this method does nothing and returns false.
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 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 final 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.Copyright © 2015 mapsforge.org