|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.lbs.maps.ui.MapAction
public class MapAction
Defines if and how actions are performed on the parent map field.
Note: for the setCenter* methods, if the new center is
outside of the world boundaries for the latitude, then the coordinate is
clipped to the maximum value. If the longitude coordinate exceeds the
world boundaries, then the coordinate is wrapped to an equivalent point
within the world boundaries.
Note: This class is tightly integrated with the MapField.
If your application calls methods within this class while this class is
orphaned (for example, this class is not linked to a MapField)
a NullPointerException is thrown. Use the
MapField.setAction(MapAction) method to associate this class
with a MapField instance.
| Field Summary | ||
|---|---|---|
static int |
ACTION_CENTER_CHANGE
Action event that indicates the center coordinates changed. |
|
static int |
ACTION_CENTRE_CHANGE
Deprecated. Use MapAction.ACTION_CENTER_CHANGE instead |
|
static int |
ACTION_FOCUSED_CHANGE
Action event that indicates the focused mappable item changed. |
|
static int |
ACTION_NAVIGATE_CHANGE
Action event that indicates the navigated mappable changed. |
|
static int |
ACTION_OPERATION_MODE_CHANGE
Action event that indicates the operational mode changed. |
|
static int |
ACTION_ROTATION_CHANGE
Action event that indicates the rotation angle changed. |
|
static int |
ACTION_SELECTED_MAPPABLE_CHANGE
Action event that indicates the selected mappable changed. |
|
static int |
ACTION_ZOOM_CHANGE
Action event that indicates the zoom level changed. |
|
| Constructor Summary | ||
|---|---|---|
MapAction()
Constructs a new MapAction instance. |
||
| Method Summary | ||
|---|---|---|
protected boolean |
allowNavigateNextPrev(boolean forward)
Indicates whether the actions to navigate to the next or previous mappable items are allowed. |
|
protected boolean |
allowSetCenter(MapPoint newCenter)
Indicates whether the center point of the map field may be set. |
|
protected boolean |
allowSetFocusMappable(Mappable target)
Indicates whether focus can be set for a specified mappable item. |
|
protected boolean |
allowSetFocusMappableByPoint(MapPoint target)
Indicates whether the selection of a mapable item by a point may be made. |
|
protected boolean |
allowSetFocusMappableByPoint(XYPoint target)
Indicates whether a selection may be made of a mappable item that is near a specified point. |
|
protected boolean |
allowSetOperationMode(int newMode)
Indicates whether the operation mode of the parent field may be changed. |
|
protected boolean |
allowSetRotation(int rotation)
Indicates whether the rotation angle for the map field may be changed. |
|
protected boolean |
allowSetSelectionPoint(MapPoint target)
Indicates whether the selection point may be set. |
|
protected boolean |
allowSetZoom(int zoom)
Indicates whether the zoom level for the map field may be changed. |
|
protected boolean |
allowTemporaryFocusMappable()
Indicates whether focus is kept on the current focused mappable item if no new mappable item is found to focus on. |
|
void |
disableOperationMode(int modeToDisable)
Disables an operation mode from the current composite mode, leaving the other active modes enabled. |
|
void |
enableOperationMode(int modeToEnable)
Enables an operation mode on top of the mode that is currently active. |
|
MapField |
getParentField()
Retrieves the parent map field of this action instance. |
|
void |
navigateNext()
Navigates to the next mappable item. |
|
void |
navigatePrev()
Navigates to the previous mappable item. |
|
protected boolean |
performNavigateNext()
Implements the action of navigating to the next mappable item. |
|
protected boolean |
performNavigatePrev()
Implements the action of navigating to the previous mappable item. |
|
protected boolean |
performSetCenter(MapPoint newCenter)
Centers the map to the specified point. |
|
protected void |
performSetFocusMappable(Mappable target)
Sets focus on the specified mappable item. |
|
protected boolean |
performSetFocusMappableByPoint(MapPoint target)
Sets a focused mappable item based on a specified point. |
|
protected boolean |
performSetFocusMappableByPoint(XYPoint target)
Sets a focused mappable item based on a specified screen point. |
|
protected boolean |
performSetOperationMode(int newMode)
Changes the operation mode of the parent map field. |
|
protected boolean |
performSetRotation(int rotation)
Rotates the map field to the specified rotation angle. |
|
protected void |
performSetSelectionPoint(MapPoint target)
Sets the current selection point. |
|
protected boolean |
performSetZoom(int zoom)
Sets the zoom to the specified level. |
|
void |
setCenter(MapPoint newCenter)
Sets the center of the map to the specified point. |
|
void |
setCenterAndZoom(Boxable visible)
Sets the center and zoom levels for the mappable item by performing both a MapAction.setCenter(MapPoint) and a MapAction.setZoom(int), and then
updates the mappable item, with a single update instead of two updates. |
|
void |
setCenterAndZoom(MapPoint center,
int zoom)
Sets the center point and zoom level of the map, and then updates the map. |
|
void |
setCenterLatLon(double lat,
double lon)
Sets the center of the map to the specified latitude and longitude coordinates. |
|
void |
setCentre(MapPoint newCenter)
Deprecated. Use MapAction.setCenter(MapPoint) instead |
|
void |
setCentreAndZoom(MapPoint center,
int zoom)
Deprecated. Use MapAction.setCenterAndZoom(MapPoint,int) instead |
|
void |
setCentreLatLon(double lat,
double lon)
Deprecated. Use MapAction.setCenterLatLon(double,double) instead |
|
void |
setFocusMappable(Mappable target)
Sets focus on the specified mappable item. |
|
boolean |
setFocusMappableByPoint(MapPoint target)
Sets the mappable item that is nearest to the specified point as the focused mappable item. |
|
boolean |
setFocusMappableByPoint(XYPoint screenPt)
Sets the mappable item that is nearest to the specified point as the focused mappable item. |
|
void |
setRotation(int rotation)
Sets the rotation angle of the map field. |
|
void |
setSelectionPoint(MapPoint target)
Sets the current selection point. |
|
protected void |
setTrackpadSensitivity(int level)
Sets the screen's trackpad sensitivity offset and trackpad filter based on the given level. |
|
void |
setZoom(int zoom)
Sets the zoom level for the map field. |
|
void |
zoomIn()
Zooms in by one zoom level. |
|
void |
zoomOut()
Zooms out by one zoom level. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ACTION_ZOOM_CHANGE
public static final int ACTION_CENTER_CHANGE
public static final int ACTION_CENTRE_CHANGE
MapAction.ACTION_CENTER_CHANGE instead
public static final int ACTION_FOCUSED_CHANGE
public static final int ACTION_OPERATION_MODE_CHANGE
public static final int ACTION_NAVIGATE_CHANGE
public static final int ACTION_SELECTED_MAPPABLE_CHANGE
public static final int ACTION_ROTATION_CHANGE
| Constructor Detail |
|---|
public MapAction()
MapAction instance.
Note: MapAction must be associated with a MapField instance.
| Method Detail |
|---|
public MapField getParentField()
public final void setZoom(int zoom)
zoom - The specified zoom level for the map field.protected boolean performSetZoom(int zoom)
zoom - The specified zoom level.
true if the zoom level successfully changed,
false otherwise.protected boolean allowSetZoom(int zoom)
zoom - The new zoom level.
true if the zoom level may be changed,
false otherwise.public void zoomIn()
public void zoomOut()
public final void setCentreAndZoom(MapPoint center,
int zoom)
MapAction.setCenterAndZoom(MapPoint,int) instead
public final void setCenterAndZoom(MapPoint center,
int zoom)
center - The new center of the screen.zoom - The new zoom level.public final void setRotation(int rotation)
rotation - The new rotation angle of the map field.protected boolean performSetRotation(int rotation)
rotation - The new rotation angle of the map field.
true if the rotation angle successfully changed,
false otherwise.protected boolean allowSetRotation(int rotation)
rotation - The new rotation angle for the map field.
true if the rotation angle may be changed,
false otherwise.public final void setCenterAndZoom(Boxable visible)
MapAction.setCenter(MapPoint) and a MapAction.setZoom(int), and then
updates the mappable item, with a single update instead of two updates.
The center point is calculated based on the parameter's center point, and the zoom level is calculated based on what level is required to make the parameter entirely visible.
visible - The visible entity to base the zoom and center calculations on.public final void setCentre(MapPoint newCenter)
MapAction.setCenter(MapPoint) instead
public final void setCenter(MapPoint newCenter)
newCenter - The new center point.
public final void setCentreLatLon(double lat,
double lon)
MapAction.setCenterLatLon(double,double) instead
public final void setCenterLatLon(double lat,
double lon)
lat - The latitude of the location (in degrees).lon - The longitude of the location (in degrees).protected boolean performSetCenter(MapPoint newCenter)
newCenter - The new center point of the map.
true if the center successfully changed, false
otherwise.protected boolean allowSetCenter(MapPoint newCenter)
newCenter - The new center point of the map field.
true if the center may be set,
false otherwise.public final void enableOperationMode(int modeToEnable)
MODE_SELECTION and MODE_ZOOM to be active
concurrently.
Note: No validation is performed to ensure that mutually
exclusive modes (such as MODE_ZOOM and
MODE_PAN) are not enabled at the same time.
It is the responsibility of the caller to ensure mode consistency. When mutually exclusive modes are enabled, the behavior is undefined.
modeToEnable - The operation mode to enable.public final void disableOperationMode(int modeToDisable)
modeToDisable - The mode to be disabled.protected boolean performSetOperationMode(int newMode)
newMode - The new operation mode.
true if the mode was changed,
false otherwise.protected boolean allowSetOperationMode(int newMode)
newMode - The new operation mode.
true if the parent field's operation mode may
be changed, false otherwise.public final void setSelectionPoint(MapPoint target)
target - The point that is selected.protected boolean allowSetSelectionPoint(MapPoint target)
target - The selection point.
true if the selection point may be set,
false otherwise.protected void performSetSelectionPoint(MapPoint target)
target - The entity (or point) that now has focus.public final boolean setFocusMappableByPoint(XYPoint screenPt)
Note: This method behaves slightly differently than
MapAction.setFocusMappableByPoint(MapPoint) because it considers on-screen
artifacts to help determine what's in focus. On-screen artifacts are rendered
objects that aren't directly on the mappable item. For example, a mappable
item's flag is an on-screen artifact.
If the specified point is off-screen, MapAction.setFocusMappableByPoint(MapPoint)
is used to set the focused mappable item.
screenPt - The screen point near which to focus the mappable item.
true if focus was successfully set,
false otherwise.protected boolean allowSetFocusMappableByPoint(XYPoint target)
target - The specified point at which to select the mappable item.
true if a selection may be made,
false otherwise.protected boolean performSetFocusMappableByPoint(XYPoint target)
target - The screen point to indicate what's in focus.
true if a mappable item in the map model has focus,
false otherwise.public final boolean setFocusMappableByPoint(MapPoint target)
Note: This method behaves slightly differently than
MapAction.setFocusMappableByPoint(XYPoint) because it doesn't consider on-screen
artifacts to determine what's in focus. On-screen artifacts are rendered
objects that aren't directly on the mappable item. For example, the caption
box is an on-screen artifact.
If the specified point is off-screen,
MapAction.setFocusMappableByPoint(MapPoint) is used to set the focused
mappable item.
target - The screen point near which to focus the mappable item.
true if focus was successfully set,
false otherwise.protected boolean performSetFocusMappableByPoint(MapPoint target)
target - The point at which to focus the mappable item.
true if a mappable item in the map model has focus,
false otherwise.protected boolean allowSetFocusMappableByPoint(MapPoint target)
target - The point at which to select the mappable item.
true if a selection may be made,
false otherwise.protected boolean allowTemporaryFocusMappable()
true to set focus on a temporary
MapPoint if no new mappable item is found to focus on,
false if focus is kept on the current focused
mappable if no new mappable item is found to focus on.public final void setFocusMappable(Mappable target)
target - The mappable item to receive focus.protected void performSetFocusMappable(Mappable target)
target - The mappable item to receive focus.protected boolean allowSetFocusMappable(Mappable target)
target - The mappable item to receive focus.
true if focus can be set for the mappable item,
false otherwise.protected void setTrackpadSensitivity(int level)
level - The specified level to set the sensitivity of the trackpad, which
are defined with the prefix TRACKPAD_SENSITIVITY_*
in MapConstants.protected boolean allowNavigateNextPrev(boolean forward)
forward - If true, navigation moves forward to the
next mappable item, if false, navigation moves to the
previous mappable item.
true if navigation to the next or previous mappable item
is allowed, false otherwise.protected boolean performNavigateNext()
true if the action performed a change or if the action
was successful, false otherwise.public final void navigateNext()
protected boolean performNavigatePrev()
true if the action performed a change or if it was successful,
false otherwise.public final void navigatePrev()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal