public class Circle extends Layer
Circle
consists of a center LatLong
and a non-negative radius in meters.
A Circle
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 |
---|
Circle(org.mapsforge.core.model.LatLong latLong,
float radius,
org.mapsforge.core.graphics.Paint paintFill,
org.mapsforge.core.graphics.Paint paintStroke) |
Circle(org.mapsforge.core.model.LatLong latLong,
float radius,
org.mapsforge.core.graphics.Paint paintFill,
org.mapsforge.core.graphics.Paint paintStroke,
boolean keepAligned) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(org.mapsforge.core.model.Point center,
org.mapsforge.core.model.Point point,
double latitude,
byte zoomLevel) |
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. |
org.mapsforge.core.graphics.Paint |
getPaintFill() |
org.mapsforge.core.graphics.Paint |
getPaintStroke() |
org.mapsforge.core.model.LatLong |
getPosition()
Gets the geographic position of this layer element, if it exists.
|
float |
getRadius() |
protected int |
getRadiusInPixels(double latitude,
byte zoomLevel) |
boolean |
isKeepAligned() |
void |
setLatLong(org.mapsforge.core.model.LatLong latLong) |
void |
setPaintFill(org.mapsforge.core.graphics.Paint paintFill) |
void |
setPaintStroke(org.mapsforge.core.graphics.Paint paintStroke) |
void |
setRadius(float radius) |
getDisplayModel, isVisible, onAdd, onDestroy, onLongPress, onRemove, onTap, requestRedraw, setDisplayModel, setVisible, setVisible
public Circle(org.mapsforge.core.model.LatLong latLong, float radius, org.mapsforge.core.graphics.Paint paintFill, org.mapsforge.core.graphics.Paint paintStroke)
latLong
- the initial center point of this circle (may be null).radius
- the initial non-negative radius of this circle in meters.paintFill
- the initial Paint
used to fill this circle (may be null).paintStroke
- the initial Paint
used to stroke this circle (may be null).java.lang.IllegalArgumentException
- if the given radius
is negative or Float.NaN
.public Circle(org.mapsforge.core.model.LatLong latLong, float radius, org.mapsforge.core.graphics.Paint paintFill, org.mapsforge.core.graphics.Paint paintStroke, boolean keepAligned)
latLong
- the initial center point of this circle (may be null).radius
- the initial non-negative radius of this circle in meters.paintFill
- the initial Paint
used to fill this circle (may be null).paintStroke
- the initial Paint
used to stroke this circle (may be null).keepAligned
- if set to true it will keep the bitmap aligned with the map,
to avoid a moving effect of a bitmap shader.java.lang.IllegalArgumentException
- if the given radius
is negative or Float.NaN
.public boolean contains(org.mapsforge.core.model.Point center, org.mapsforge.core.model.Point point, double latitude, byte zoomLevel)
public void draw(org.mapsforge.core.model.BoundingBox boundingBox, byte zoomLevel, org.mapsforge.core.graphics.Canvas canvas, org.mapsforge.core.model.Point topLeftPoint)
Layer
Layer
on the given canvas.draw
in class Layer
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.graphics.Paint getPaintFill()
Paint
used to fill this circle (may be null).public org.mapsforge.core.graphics.Paint getPaintStroke()
Paint
used to stroke this circle (may be null).public org.mapsforge.core.model.LatLong getPosition()
Layer
getPosition
in class Layer
public float getRadius()
protected int getRadiusInPixels(double latitude, byte zoomLevel)
public boolean isKeepAligned()
public void setLatLong(org.mapsforge.core.model.LatLong latLong)
latLong
- the new center point of this circle (may be null).public void setPaintFill(org.mapsforge.core.graphics.Paint paintFill)
paintFill
- the new Paint
used to fill this circle (may be null).public void setPaintStroke(org.mapsforge.core.graphics.Paint paintStroke)
paintStroke
- the new Paint
used to stroke this circle (may be null).public void setRadius(float radius)
radius
- the new non-negative radius of this circle in meters.java.lang.IllegalArgumentException
- if the given radius
is negative or Float.NaN
.