public abstract class Tool
extends java.lang.Object
implements android.view.View.OnKeyListener
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
_identifier |
protected int |
_mapListenerCount |
protected MapView |
_mapView |
Constructor and Description |
---|
Tool(MapView mapView,
java.lang.String identifier) |
Modifier and Type | Method and Description |
---|---|
protected void |
clearExtraListeners()
Clears all listeners from the map except for those involved with fundamental map operations,
ie pan and pinch.
|
abstract void |
dispose()
Called only by the parent during final cleanup activities.
|
protected void |
endTool()
Used by ToolbarLibrary to stop a running tool.
|
protected GeoPointMetaData |
findPoint(MapEvent event)
Helper method that finds a point given a map event (i.e.
|
boolean |
getActive()
Returns whether the tool is currently active, ie, onToolBegin has been called but onToolEnd
has not yet been called.
|
java.lang.String |
getIdentifier()
Returns the identifier used to refer to this tool in intents.
|
boolean |
onKey(android.view.View v,
int keyCode,
android.view.KeyEvent event) |
protected boolean |
onToolBegin(android.os.Bundle extras)
Called when this tool has been asked to start (and after the last tool has cleaned up)
|
protected void |
onToolEnd()
Called when this tool has been asked to end, either directly or by the user selecting a new
tool or possibly a new toolbar.
|
protected void |
popAllMapListeners()
Pop all map listeners that were pushed with this tool
|
protected void |
popMapListeners()
Pop a set of map listeners while tracking the current push count
|
protected void |
pushMapListeners()
Push a new set of map listeners while tracking the current push count
|
void |
requestBeginTool()
Helper method to send the intent required to ask the ToolbarLibrary to make this tool active.
|
void |
requestEndTool()
Helper method to send the intent required to ask the ToolbarLibrary to make this tool
inactive.
|
protected void |
setActive(boolean active)
Called to set whether a tool is actively being used.
|
boolean |
shouldEndOnBack()
Returns whether this tool should end when the back button is pressed.
|
protected final MapView _mapView
protected java.lang.String _identifier
protected int _mapListenerCount
public Tool(MapView mapView, java.lang.String identifier)
protected boolean onToolBegin(android.os.Bundle extras)
extras
- extra params that were passed by the GUIprotected void onToolEnd()
public abstract void dispose()
protected void endTool()
public java.lang.String getIdentifier()
public boolean onKey(android.view.View v, int keyCode, android.view.KeyEvent event)
onKey
in interface android.view.View.OnKeyListener
v
- keyCode
- event
- public boolean shouldEndOnBack()
public void requestBeginTool()
public void requestEndTool()
public boolean getActive()
protected void setActive(boolean active)
protected void clearExtraListeners()
protected void pushMapListeners()
protected void popMapListeners()
protected void popAllMapListeners()
protected GeoPointMetaData findPoint(MapEvent event)
event
- Map event