| java.lang.Object examples.cityguide.CityMap
CityMap | public class CityMap implements LocationListener(Code) | | 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.
version: 1.3 |
Constructor Summary | |
public | CityMap(String[] imageNames, Coordinates topLeftCoordinates, Coordinates bottomRightCoordinates, Coordinates visitorCoordinates, Vector categories, ImageManager imageManager, LandmarkStore landmarkStore, LocationProvider locationProvider) |
Method Summary | |
void | addMapListener(MapListener listener) Registers a map listener. | public synchronized void | cleanup() The final unregistration. | public int[] | convertCoordinatesToXY(int[] dest, Coordinates coords) Converts from the given latitude / longitude coordinates to the map
xy coordinates. | public Coordinates | convertXYToCoordinates(Coordinates dest, int[] xy) Converts from the given map xy coordinates to the latitude / longitude
coordinates. | public synchronized void | disable() Sets the city map to the disabled state. | public synchronized void | enable() Sets the city map to the enabled state. | public Image | getMapImage() Returns the map image. | public MapLandmark[] | getMapLandmarks() Returns the set of the map landmarks. | public Image | getVisitorImage() Returns the visitor icon based on his state. | public synchronized int[] | getVisitorXY(int[] dest) Returns the xy coordinates of the visitor. | public synchronized void | locationUpdated(LocationProvider provider, Location location) A method which is called by the location provider when the current
location is changed. | public synchronized void | providerStateChanged(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). | void | removeMapListener(MapListener listener) Unregisters a map listener. | public void | setCategories(Vector categories) Changes the landmark set to contain only landmarks of the given
categories. | public synchronized void | setVisitorActive(boolean active) Changes the state of the visitor. | public synchronized void | setVisitorCoordinates(Coordinates newCoordinates) Changes the coordinates of the visitor and notifies the listeners about
it. |
IMAGE_LAST | public static int IMAGE_LAST(Code) | | |
IMAGE_MAP | public static int IMAGE_MAP(Code) | | |
IMAGE_VISITOR_OFF | public static int IMAGE_VISITOR_OFF(Code) | | |
IMAGE_VISITOR_ON | public static int IMAGE_VISITOR_ON(Code) | | |
CityMap | public CityMap(String[] imageNames, Coordinates topLeftCoordinates, Coordinates bottomRightCoordinates, Coordinates visitorCoordinates, Vector categories, ImageManager imageManager, LandmarkStore landmarkStore, LocationProvider locationProvider)(Code) | | Creates a new instance of CityMap
|
addMapListener | void addMapListener(MapListener listener)(Code) | | Registers a map listener.
|
cleanup | public synchronized void cleanup()(Code) | | The final unregistration.
|
convertCoordinatesToXY | public int[] convertCoordinatesToXY(int[] dest, Coordinates coords)(Code) | | Converts from the given latitude / longitude coordinates to the map
xy coordinates.
|
convertXYToCoordinates | public Coordinates convertXYToCoordinates(Coordinates dest, int[] xy)(Code) | | Converts from the given map xy coordinates to the latitude / longitude
coordinates.
|
disable | public synchronized void disable()(Code) | | Sets the city map to the disabled state. In the disabled state it ignores
all notifications from the location provider.
|
enable | public synchronized void enable()(Code) | | Sets the city map to the enabled state.
|
getMapImage | public Image getMapImage()(Code) | | Returns the map image.
|
getMapLandmarks | public MapLandmark[] getMapLandmarks()(Code) | | Returns the set of the map landmarks.
|
getVisitorImage | public Image getVisitorImage()(Code) | | Returns the visitor icon based on his state.
|
getVisitorXY | public synchronized int[] getVisitorXY(int[] dest)(Code) | | Returns the xy coordinates of the visitor.
|
locationUpdated | public synchronized void locationUpdated(LocationProvider provider, Location location)(Code) | | A method which is called by the location provider when the current
location is changed.
|
providerStateChanged | public synchronized void providerStateChanged(LocationProvider provider, int newState)(Code) | | A method which is called by the location provider when its state changes
(for example, when its services are temporary unavailable).
|
removeMapListener | void removeMapListener(MapListener listener)(Code) | | Unregisters a map listener.
|
setCategories | public void setCategories(Vector categories)(Code) | | Changes the landmark set to contain only landmarks of the given
categories.
|
setVisitorActive | public synchronized void setVisitorActive(boolean active)(Code) | | Changes the state of the visitor. A deactivated visitor doesn't change
his position.
|
setVisitorCoordinates | public synchronized void setVisitorCoordinates(Coordinates newCoordinates)(Code) | | Changes the coordinates of the visitor and notifies the listeners about
it.
|
|
|