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 android.graphics.Path |
barPath |
protected android.graphics.Rect |
latitudeBarRect |
protected android.graphics.Rect |
longitudeBarRect |
int |
screenHeight |
int |
screenWidth |
float |
xdpi |
float |
ydpi |
mResourceProxy, mScale, SHADOW_X_SKEW, SHADOW_Y_SCALE
EQUATORCIRCUMFENCE, FEET_PER_METER, METERS_PER_NAUTICAL_MILE, METERS_PER_STATUTE_MILE, RADIUS_EARTH_METERS
DEBUGMODE, DEFAULT_ZOOMLEVEL_MINIMAP_DIFFERENCE, NOT_SET
Constructor and Description |
---|
ScaleBarOverlay(android.content.Context context) |
ScaleBarOverlay(android.content.Context context,
ResourceProxy pResourceProxy) |
Modifier and Type | Method and Description |
---|---|
void |
disableScaleBar() |
protected void |
draw(android.graphics.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() |
android.graphics.Paint |
getBarPaint()
Return's the paint used to draw the bar
|
android.graphics.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
|
protected String |
scaleBarLengthText(int meters) |
void |
setBackgroundPaint(android.graphics.Paint pBgPaint)
Sets the background paint.
|
void |
setBarPaint(android.graphics.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(android.graphics.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, onDetach, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onLongPress, onScroll, onShowPress, onSingleTapConfirmed, onSingleTapUp, onTouchEvent, onTrackballEvent, setEnabled
protected final android.graphics.Path barPath
protected final android.graphics.Rect latitudeBarRect
protected final android.graphics.Rect longitudeBarRect
public float xdpi
public float ydpi
public int screenWidth
public int screenHeight
public ScaleBarOverlay(android.content.Context context)
public ScaleBarOverlay(android.content.Context context, ResourceProxy pResourceProxy)
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 android.graphics.Paint getBarPaint()
public void setBarPaint(android.graphics.Paint pBarPaint)
pBarPaint
- bar drawing paintpublic android.graphics.Paint getTextPaint()
public void setTextPaint(android.graphics.Paint pTextPaint)
pTextPaint
- text drawing paintpublic void setBackgroundPaint(android.graphics.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)protected void draw(android.graphics.Canvas c, MapView mapView, boolean shadow)
Overlay
public void disableScaleBar()
public void enableScaleBar()
protected String scaleBarLengthText(int meters)
Copyright © 2015. All Rights Reserved.