|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectexamples.cityguide.CityMap
public class CityMap
This class represents a map with a visitor and landmarks. It allows registration of a map listener which gets information about position changes of the visitor, activations and de-activations of the landmarks and changes of the whole landmark set. A class instance registers itself as a location listener and registers each landmark as a proximity listener, so it is notified about position change and proximity events from a location provider. After getting a notification from the location provider it updates its internal state and delegates the notification to its own listeners.
Field Summary | |
---|---|
static int |
IMAGE_LAST
|
static int |
IMAGE_MAP
|
static int |
IMAGE_VISITOR_OFF
|
static int |
IMAGE_VISITOR_ON
|
static int |
X
|
static int |
Y
|
Constructor Summary | |
---|---|
CityMap(java.lang.String[] imageNames,
javax.microedition.location.Coordinates topLeftCoordinates,
javax.microedition.location.Coordinates bottomRightCoordinates,
javax.microedition.location.Coordinates visitorCoordinates,
java.util.Vector categories,
ImageManager imageManager,
javax.microedition.location.LandmarkStore landmarkStore,
javax.microedition.location.LocationProvider locationProvider)
Creates a new instance of CityMap |
Method Summary | |
---|---|
(package private) void |
addMapListener(MapListener listener)
Registers a map listener. |
void |
cleanup()
The final unregistration. |
int[] |
convertCoordinatesToXY(int[] dest,
javax.microedition.location.Coordinates coords)
Converts from the given latitude / longitude coordinates to the map xy coordinates. |
javax.microedition.location.Coordinates |
convertXYToCoordinates(javax.microedition.location.Coordinates dest,
int[] xy)
Converts from the given map xy coordinates to the latitude / longitude coordinates. |
void |
disable()
Sets the city map to the disabled state. |
void |
enable()
Sets the city map to the enabled state. |
javax.microedition.lcdui.Image |
getMapImage()
Returns the map image. |
MapLandmark[] |
getMapLandmarks()
Returns the set of the map landmarks. |
javax.microedition.lcdui.Image |
getVisitorImage()
Returns the visitor icon based on his state. |
int[] |
getVisitorXY(int[] dest)
Returns the xy coordinates of the visitor. |
void |
locationUpdated(javax.microedition.location.LocationProvider provider,
javax.microedition.location.Location location)
A method which is called by the location provider when the current location is changed. |
void |
providerStateChanged(javax.microedition.location.LocationProvider provider,
int newState)
A method which is called by the location provider when its state changes (for example, when its services are temporary unavailable). |
(package private) void |
removeMapListener(MapListener listener)
Unregisters a map listener. |
void |
setCategories(java.util.Vector categories)
Changes the landmark set to contain only landmarks of the given categories. |
void |
setVisitorActive(boolean active)
Changes the state of the visitor. |
void |
setVisitorCoordinates(javax.microedition.location.Coordinates newCoordinates)
Changes the coordinates of the visitor and notifies the listeners about it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int X
public static int Y
public static int IMAGE_MAP
public static int IMAGE_VISITOR_ON
public static int IMAGE_VISITOR_OFF
public static int IMAGE_LAST
Constructor Detail |
---|
public CityMap(java.lang.String[] imageNames, javax.microedition.location.Coordinates topLeftCoordinates, javax.microedition.location.Coordinates bottomRightCoordinates, javax.microedition.location.Coordinates visitorCoordinates, java.util.Vector categories, ImageManager imageManager, javax.microedition.location.LandmarkStore landmarkStore, javax.microedition.location.LocationProvider locationProvider)
Method Detail |
---|
public void setCategories(java.util.Vector categories)
public void setVisitorCoordinates(javax.microedition.location.Coordinates newCoordinates)
public void setVisitorActive(boolean active)
public int[] getVisitorXY(int[] dest)
public javax.microedition.lcdui.Image getVisitorImage()
public javax.microedition.lcdui.Image getMapImage()
public MapLandmark[] getMapLandmarks()
void addMapListener(MapListener listener)
void removeMapListener(MapListener listener)
public int[] convertCoordinatesToXY(int[] dest, javax.microedition.location.Coordinates coords)
public javax.microedition.location.Coordinates convertXYToCoordinates(javax.microedition.location.Coordinates dest, int[] xy)
public void locationUpdated(javax.microedition.location.LocationProvider provider, javax.microedition.location.Location location)
locationUpdated
in interface javax.microedition.location.LocationListener
public void providerStateChanged(javax.microedition.location.LocationProvider provider, int newState)
providerStateChanged
in interface javax.microedition.location.LocationListener
public void disable()
public void enable()
public void cleanup()
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |