public abstract class MapScaleBar
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
MapScaleBar.ScaleBarLengthAndValue
Internal class used by calculateScaleBarLengthAndValue
|
static class |
MapScaleBar.ScaleBarPosition |
| Modifier and Type | Field and Description |
|---|---|
protected DistanceUnitAdapter |
distanceUnitAdapter |
protected Map |
map |
protected Bitmap |
mapScaleBitmap |
protected Canvas |
mapScaleCanvas |
protected boolean |
redrawNeeded |
protected MapScaleBar.ScaleBarPosition |
scaleBarPosition |
| Constructor and Description |
|---|
MapScaleBar(Map map,
int width,
int height) |
| Modifier and Type | Method and Description |
|---|---|
protected MapScaleBar.ScaleBarLengthAndValue |
calculateScaleBarLengthAndValue()
Calculates the required length and value of the scalebar using the current
DistanceUnitAdapter |
protected MapScaleBar.ScaleBarLengthAndValue |
calculateScaleBarLengthAndValue(DistanceUnitAdapter unitAdapter)
Calculates the required length and value of the scalebar
|
void |
destroy()
Free all resources
|
void |
draw(Canvas canvas) |
void |
drawScaleBar()
The scalebar is redrawn now.
|
DistanceUnitAdapter |
getDistanceUnitAdapter() |
int |
getMarginHorizontal() |
int |
getMarginVertical() |
MapScaleBar.ScaleBarPosition |
getScaleBarPosition() |
protected boolean |
isRedrawNecessary()
Determines if a redraw is necessary or not
|
boolean |
isVisible() |
protected abstract void |
redraw(Canvas canvas)
Redraw the map scale bar.
|
void |
redrawScaleBar()
The scalebar will be redrawn on the next draw()
|
void |
setDistanceUnitAdapter(DistanceUnitAdapter distanceUnitAdapter)
Set the
DistanceUnitAdapter for the MapScaleBar |
void |
setMarginHorizontal(int marginHorizontal) |
void |
setMarginVertical(int marginVertical) |
void |
setScaleBarPosition(MapScaleBar.ScaleBarPosition scaleBarPosition) |
void |
setVisible(boolean visible)
Set the visibility of this
MapScaleBar |
protected DistanceUnitAdapter distanceUnitAdapter
protected final Map map
protected Bitmap mapScaleBitmap
protected Canvas mapScaleCanvas
protected boolean redrawNeeded
protected MapScaleBar.ScaleBarPosition scaleBarPosition
public MapScaleBar(Map map, int width, int height)
public void destroy()
public boolean isVisible()
MapScaleBar is visiblepublic void setVisible(boolean visible)
MapScaleBarvisible - true if the MapScaleBar should be visible, false otherwisepublic DistanceUnitAdapter getDistanceUnitAdapter()
DistanceUnitAdapter in use by this MapScaleBarpublic void setDistanceUnitAdapter(DistanceUnitAdapter distanceUnitAdapter)
DistanceUnitAdapter for the MapScaleBardistanceUnitAdapter - The DistanceUnitAdapter to be used by this MapScaleBarpublic int getMarginHorizontal()
public void setMarginHorizontal(int marginHorizontal)
public int getMarginVertical()
public void setMarginVertical(int marginVertical)
public MapScaleBar.ScaleBarPosition getScaleBarPosition()
public void setScaleBarPosition(MapScaleBar.ScaleBarPosition scaleBarPosition)
protected MapScaleBar.ScaleBarLengthAndValue calculateScaleBarLengthAndValue(DistanceUnitAdapter unitAdapter)
unitAdapter - the DistanceUnitAdapter to calculate forMapScaleBar.ScaleBarLengthAndValue object containing the required scaleBarLength and scaleBarValueprotected MapScaleBar.ScaleBarLengthAndValue calculateScaleBarLengthAndValue()
DistanceUnitAdapterMapScaleBar.ScaleBarLengthAndValue object containing the required scaleBarLength and scaleBarValuepublic void draw(Canvas canvas)
canvas - The canvas to use to draw the MapScaleBarpublic void drawScaleBar()
public void redrawScaleBar()
protected boolean isRedrawNecessary()
protected abstract void redraw(Canvas canvas)
canvas - The canvas to draw on