public class ScaleBarOverlay extends Overlay implements GeoConstants
Modifier and Type | Class and Description |
---|---|
static class |
ScaleBarOverlay.UnitsOfMeasure |
Overlay.Snappable
Modifier and Type | Field and Description |
---|---|
protected boolean |
alignBottom |
protected boolean |
alignRight |
protected Path |
barPath |
(package private) boolean |
latitudeBar |
protected Rect |
latitudeBarRect |
(package private) boolean |
longitudeBar |
protected Rect |
longitudeBarRect |
(package private) int |
minZoom |
int |
screenHeight |
int |
screenWidth |
(package private) ScaleBarOverlay.UnitsOfMeasure |
unitsOfMeasure |
float |
xdpi |
(package private) int |
xOffset |
float |
ydpi |
(package private) int |
yOffset |
SHADOW_X_SKEW, SHADOW_Y_SCALE
EQUATORCIRCUMFENCE, FEET_PER_METER, METERS_PER_NAUTICAL_MILE, METERS_PER_STATUTE_MILE, RADIUS_EARTH_METERS
DEFAULT_ZOOMLEVEL_MINIMAP_DIFFERENCE, NOT_SET
Constructor and Description |
---|
ScaleBarOverlay(MapView mapView) |
Modifier and Type | Method and Description |
---|---|
void |
disableScaleBar() |
void |
draw(Canvas c,
MapView mapView,
boolean shadow)
Draw the overlay over the map.
|
void |
drawLatitudeScale(boolean latitude)
Latitudinal / horizontal scale bar flag
|
void |
drawLongitudeScale(boolean longitude)
Longitudinal / vertical scale bar flag
|
void |
enableScaleBar() |
Paint |
getBarPaint()
Return's the paint used to draw the bar
|
Paint |
getTextPaint()
Returns the paint used to draw the text
|
ScaleBarOverlay.UnitsOfMeasure |
getUnitsOfMeasure()
Gets the units of measure to be shown in the scale bar
|
void |
onDetach(MapView mapView)
Override to perform clean up of resources before shutdown.
|
protected void |
rebuildBarPath(Projection projection) |
protected String |
scaleBarLengthText(int meters) |
void |
setAlignBottom(boolean alignBottom) |
void |
setAlignRight(boolean alignRight) |
void |
setBackgroundPaint(Paint pBgPaint)
Sets the background paint.
|
void |
setBarPaint(Paint pBarPaint)
Sets the paint for drawing the bar
|
void |
setCentred(boolean centred)
Flag to draw the bar centered around the set offset coordinates or to the right/bottom of the
coordinates (default)
|
void |
setEnableAdjustLength(boolean adjustLength)
If enabled, the bar will automatically adjust the length to reflect a round number (starting
with 1, 2 or 5).
|
void |
setLineWidth(float width)
Sets the bar's line width.
|
void |
setMaxLength(float pMaxLengthInCm)
Sets the maximum bar length.
|
void |
setMinZoom(int zoom)
Sets the minimum zoom level for the scale bar to be drawn.
|
void |
setScaleBarOffset(int x,
int y)
Sets the scale bar screen offset for the bar.
|
void |
setTextPaint(Paint pTextPaint)
Sets the paint for drawing the text
|
void |
setTextSize(float size)
Sets the text size.
|
void |
setUnitsOfMeasure(ScaleBarOverlay.UnitsOfMeasure unitsOfMeasure)
Sets the units of measure to be shown in the scale bar
|
drawAt, getSafeMenuId, getSafeMenuIdSequence, isEnabled, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onLongPress, onScroll, onShowPress, onSingleTapConfirmed, onSingleTapUp, onTouchEvent, onTrackballEvent, setEnabled
int xOffset
int yOffset
int minZoom
ScaleBarOverlay.UnitsOfMeasure unitsOfMeasure
boolean latitudeBar
boolean longitudeBar
protected boolean alignBottom
protected boolean alignRight
protected final Path barPath
protected final Rect latitudeBarRect
protected final Rect longitudeBarRect
public float xdpi
public float ydpi
public int screenWidth
public int screenHeight
public ScaleBarOverlay(MapView mapView)
public void setMinZoom(int zoom)
zoom
- minimum zoom levelpublic void setScaleBarOffset(int x, int y)
x
- x screen offsety
- z screen offsetpublic void setLineWidth(float width)
width
- the new line widthpublic void setTextSize(float size)
size
- the new text sizepublic void setUnitsOfMeasure(ScaleBarOverlay.UnitsOfMeasure unitsOfMeasure)
public ScaleBarOverlay.UnitsOfMeasure getUnitsOfMeasure()
public void drawLatitudeScale(boolean latitude)
latitude
- public void drawLongitudeScale(boolean longitude)
longitude
- public void setCentred(boolean centred)
centred
- set true to centre the bar around the given screen coordinatespublic void setAlignBottom(boolean alignBottom)
public void setAlignRight(boolean alignRight)
public Paint getBarPaint()
public void setBarPaint(Paint pBarPaint)
pBarPaint
- bar drawing paintpublic Paint getTextPaint()
public void setTextPaint(Paint pTextPaint)
pTextPaint
- text drawing paintpublic void setBackgroundPaint(Paint pBgPaint)
pBgPaint
- the paint for colouring the bar backgroundpublic void setEnableAdjustLength(boolean adjustLength)
public void setMaxLength(float pMaxLengthInCm)
pMaxLengthInCm
- maximum length of the bar in the screen in cm. Default is 2.54 (=1 inch)public void draw(Canvas c, MapView mapView, boolean shadow)
Overlay
public void disableScaleBar()
public void enableScaleBar()
protected void rebuildBarPath(Projection projection)
protected String scaleBarLengthText(int meters)