|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.nutiteq.BaseMapComponent
com.nutiteq.BasicMapComponent
public class BasicMapComponent
Main class for integration between implementing application and maps library without any default values.
Best practice for map display handling would be using one instance trough
whole application life circle. This means calling startMapping()
and stopMapping() only once.
Required steps for basic functionality initialization:
setMap(GeoMap)setControlKeysHandler(ControlKeysHandler) or define individual
keys by calling defineControlKey(int, int)PanningStrategy if panning with keys will be
usedMapListener for receiving map view
update notifications
| Field Summary | |
|---|---|
static int |
FINGER_CLICK_TOLERANCE
Pixel tolerance used for phones without stylus to distinguish between screen click and drag events |
static int |
STYLUS_CLICK_TOLERANCE
Pixel tolerance used for stylus phones to distinguish between screen click and drag events |
| Constructor Summary | |
|---|---|
BasicMapComponent(java.lang.String licenseKey,
javax.microedition.midlet.MIDlet midlet,
int width,
int height,
WgsPoint middlePoint,
int zoom)
Constructor for map display object. |
|
BasicMapComponent(java.lang.String licenseKey,
java.lang.String vendor,
java.lang.String appname,
int width,
int height,
WgsPoint middlePoint,
int zoom)
Constructor for map display object. |
|
| Method Summary | |
|---|---|
void |
addKmlService(KmlService service)
Add kml service to be handled (updated, parsed, painted) internally by library. |
void |
addLine(Line line)
Add line to be displayed on map |
void |
addLines(Line[] lines)
Add lines to be displayed on map |
void |
addOnMapElements(OnMapElement[] elements)
Add elements to be displayed on map |
void |
addOnMapElements(OnMapElement[] elements,
boolean updateScreen)
Not part of public API |
void |
addPlace(Place place)
Add a place to be displayed on map |
void |
addPlaces(Place[] places)
Add places to be displayed on map |
void |
addPlaces(Place[] places,
boolean updateScreen)
Not part of public API. |
void |
addPolygon(Polygon polygon)
Add polygon to be displayed on map |
void |
addPolygons(Polygon[] polygons)
Add multiple polygons for display |
void |
defineControlKey(int actionCode,
int keyCode)
Set key code values for defined control keys. |
void |
enqueue(com.nutiteq.task.Task task)
Not part of public API |
void |
enqueueDownload(ResourceRequestor downloadable,
int cacheLevel)
Enqueue download requestor to be handled by library. |
void |
focusOnPlace(Place focusOn)
Set focus on given place. |
PlaceInfo |
getAdditionalInfo(Place place)
Get additional info for place displayed by internally handled service. |
MapTile[] |
getAllRequiredTiles()
Not part of public API |
WgsBoundingBox |
getBoundingBox()
Get bounding box for current map view. |
WgsPoint |
getCenterPoint()
Get map center point. |
DownloadCounter |
getDownloadCounter()
|
ErrorListener |
getErrorListener()
Get the current error listener. |
int |
getHeight()
Return current view height |
MapPos |
getInternalMiddlePoint()
Not part of public API. |
KmlPlace[] |
getKmlPlaces(KmlService service)
Get KML places which were read by KML parser. |
KmlService[] |
getKmlServices()
Get list of used kml services |
java.lang.String |
getLibraryLog()
Get internal log for library. |
GeoMap |
getMap()
Retrieve currently used map. |
MapListener |
getMapListener()
Get the current map listener. |
MapPos |
getMapPosition(WgsPoint wgsLocation)
Not part of public API |
WgsPoint |
getMiddlePoint()
Get map center point value in lon/lat |
OnMapElementListener |
getOnMapElementListener()
Get current listener for objects on map |
PlaceListener |
getPlaceListener()
Deprecated. Will be removed in 1.0.3. Use getOnMapElementListener() instead. |
MapTile |
getRequiredTile()
Not part of public API |
int |
getScreenLeft()
Get the screen position for the top-left corner. |
int |
getScreenTop()
Get the screen position for the top-left corner. |
int |
getZoom()
Get the current zoom level. |
ZoomRange |
getZoomRange()
Get zoom range for currently used map |
int |
getWidth()
Return current view width |
Place[] |
getVisiblePlaces()
Get places currently visible on map view. |
void |
keyPressed(int keyCode)
Handle key pressed event |
void |
keyReleased(int keyCode)
Handle key released event |
void |
keyRepeated(int keyCode)
Handle key repeated event |
void |
looseFocusOnDrag(boolean looseFocus)
On touch screen phones, if some object has been selected, should focus be lost on map drag. |
void |
loosePlaceFocus()
|
void |
moveMap(double lon,
double lat)
Move map without changing zoom. |
void |
moveMap(WgsPoint point)
Move map without changing zoom. |
void |
paint(Graphics g)
Paint the map component. |
void |
paintAt(Graphics g,
int paintX,
int paintY)
Paint map view to give position on screen |
void |
panMap(int panX,
int panY)
Move view on map by number of pixels |
void |
pointerDragged(int x,
int y)
Handle pointer dragged event |
void |
pointerPressed(int x,
int y)
Handle pointer pressed event |
void |
pointerReleased(int x,
int y)
Handle pointer released event |
void |
removeAllPlaces()
Remove all places. |
void |
removeKmlService(KmlService service)
Remove previously added kml service |
void |
removeLine(Line line)
Remove a line from previously added lines |
void |
removeLines(Line[] lines)
Remove lines from previously added lines |
void |
removeLocationSource()
Remove used location source |
void |
removeOnMapElements(OnMapElement[] elements)
Remove given elements from map display |
void |
removePlace(Place place)
Remove a place from previously added places |
void |
removePlaces(Place[] places)
Remove places from previously added places |
void |
removePolygon(Polygon polygon)
Remove polygon from map |
void |
removePolygons(Polygon[] polygons)
Remove multiple polygons from map |
void |
removeZoomDelay()
Not part of public API. |
void |
repaint()
|
void |
repaint(boolean fromTimer)
Not in public API. |
void |
replacePlaces(Place[] places)
Add new places to the map and remove all other places previously on the map. |
boolean |
requiresMoreTiles()
Not part of public API |
void |
resize(int width,
int height)
Changes map view size |
void |
setBoundingBox(WgsBoundingBox bBox)
Set bounding box for the view. |
void |
setControlKeysHandler(ControlKeysHandler keysHandler)
Change control keys handler used for actions mapping. |
void |
setCursor(Cursor newCursor)
Set cursor used on screen for places selection, etc. |
void |
setDownloadCounter(DownloadCounter counter)
Set download counter used for gathering information about network traffic |
void |
setDownloadDisplay(DownloadDisplay display)
Set used implementation for network traffic display on map. |
void |
setDownloadStreamOpener(DownloadStreamOpener opener)
Change the implementation for download stream opening. |
void |
setErrorListener(ErrorListener errorListener)
Set listener for library errors |
void |
setFileSystem(FileSystem fs)
Set file system to be used for StoredMap handling |
void |
setLicense(com.nutiteq.license.License license)
Not in public API. |
void |
setLocationSource(LocationSource source)
Set location source with GPS marker to be displayed. |
void |
setMap(GeoMap newMap)
Change used map |
void |
setMapListener(MapListener mL)
Set map listener for receiving map related callback events from library |
void |
setMiddlePoint(double lon,
double lat,
int zoom)
Define middle point location in WGS84 |
void |
setMiddlePoint(WgsPoint wgs)
Define middle point in WGS84, without changing zoom level |
void |
setMiddlePoint(WgsPoint point,
int zoom)
Define middle point location in WGS84 |
void |
setNetworkCache(Cache cache)
Set cache for networking. |
void |
setOnMapElementListener(OnMapElementListener listener)
Set listener for receiving events related to objects shown on map. |
void |
setOnScreenZoomControls(OnScreenZoomControls zoomControls)
Set zoom controls to be displayed on screen and used for touch screen zooming. |
void |
setPanningStrategy(PanningStrategy panningStrategy)
Set panning strategy for map component. |
void |
setPlaceListener(PlaceListener pL)
Deprecated. use setOnMapElementListener(OnMapElementListener)
instead. This method will be removed in 1.0.3 |
void |
setScreenBounds(int x,
int y,
int w,
int h)
Set bounds on screen. |
void |
setScreenCenter(int x,
int y)
Set the screen position for the center of the displayed map. |
void |
setScreenPosition(int x,
int y)
Set position on screen for top-left corner. |
void |
setSize(int w,
int h)
Set map size on screen. |
void |
setZoom(int newZoom)
Set map zoom without changing position. |
void |
setZoomLevelIndicator(ZoomIndicator zoomIndicator)
Set zoom indicator to be painted on display. |
void |
setTileSearchStrategy(GeoMap[] searched)
Set search strategy for map tile. |
void |
setTouchClickTolerance(int pixels)
Set tolerance for detecting click events instead of dragging on touchscreen. |
void |
startMapping()
Initialize needed resources for mapping and start internal threads. |
void |
stopMapping()
Stop threads started by MapComponent. |
void |
zoomIn()
Zoom in one level |
void |
zoomLevelIndicatorCheck()
Not part of public API |
void |
zoomOut()
Zoom out one level |
void |
tileRetrieved(MapTile mt)
Not in public API. |
void |
updateTile(MapTile mapTile)
Not part of public API |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int STYLUS_CLICK_TOLERANCE
public static final int FINGER_CLICK_TOLERANCE
| Constructor Detail |
|---|
public BasicMapComponent(java.lang.String licenseKey,
java.lang.String vendor,
java.lang.String appname,
int width,
int height,
WgsPoint middlePoint,
int zoom)
licenseKey - License key issued by Nutiteq LLCvendor - Vendor name used by library for license checkappname - Application name used by library for license checkwidth - map view widthheight - map view heightmiddlePoint - middle point at start (defined in WGS84)zoom - zoom level at start
public BasicMapComponent(java.lang.String licenseKey,
javax.microedition.midlet.MIDlet midlet,
int width,
int height,
WgsPoint middlePoint,
int zoom)
licenseKey - License key issued by Nutiteq LLCmidlet - MIDlet class for the application. Used by library for reading
midlet name and vendor from jad for license verification.width - map view widthheight - map view heightmiddlePoint - middle point at start (defined in WGS84)zoom - zoom level at start| Method Detail |
|---|
public void startMapping()
public void resize(int width,
int height)
width - new map view widthheight - new map view heightpublic int getWidth()
public int getHeight()
public void setMiddlePoint(double lon,
double lat,
int zoom)
lon - degrees in wgslat - degrees in wgszoom - zoom level to be displayed
public void setMiddlePoint(WgsPoint point,
int zoom)
point - coordinates in WGS84zoom - zoom level to be displayedpublic void setMiddlePoint(WgsPoint wgs)
wgs - coordinates in WGS84public void paint(Graphics g)
setScreenPosition(int, int)
g - graphics object provided by implementing application
public void paintAt(Graphics g,
int paintX,
int paintY)
g - graphics object to paint onpaintX - screen position xpaintY - screen position ypublic WgsPoint getMiddlePoint()
public void zoomIn()
public void zoomOut()
public void setMapListener(MapListener mL)
mL - class implementing MapListener interfacepublic void setPlaceListener(PlaceListener pL)
setOnMapElementListener(OnMapElementListener)
instead. This method will be removed in 1.0.3
pL - class implementing PlaceListener interfacepublic void setOnMapElementListener(OnMapElementListener listener)
listener - public void setErrorListener(ErrorListener errorListener)
errorListener - class implementing ErrorListener interfacepublic void setOnScreenZoomControls(OnScreenZoomControls zoomControls)
zoomControls - zoom controls to be used
public void panMap(int panX,
int panY)
panMap in interface com.nutiteq.ui.PannablepanX - number of pixels to be moved left/rightpanY - number of pixels to be moved up/downpublic void keyPressed(int keyCode)
keyCode - key code forwarded by implementing applicationpublic void keyReleased(int keyCode)
keyCode - key code forwarded by implementing applicationpublic void keyRepeated(int keyCode)
keyCode - key code forwarded by implementing application
public void pointerDragged(int x,
int y)
x - pixels draggedy - pixels dragged
public void pointerPressed(int x,
int y)
x - position on screeny - position on screen
public void pointerReleased(int x,
int y)
x - position on screeny - position on screen
public void defineControlKey(int actionCode,
int keyCode)
UserDefinedKeysMapping
actionCode - internal code for action ControlKeyskeyCode - key code value for defined keypublic void setControlKeysHandler(ControlKeysHandler keysHandler)
keysHandler - new keys mapping handlerpublic MapTile getRequiredTile()
getRequiredTile in interface com.nutiteq.maps.MapTilesRequestorpublic boolean requiresMoreTiles()
requiresMoreTiles in interface com.nutiteq.maps.MapTilesRequestorpublic MapTile[] getAllRequiredTiles()
getAllRequiredTiles in interface com.nutiteq.maps.MapTilesRequestorpublic void tileRetrieved(MapTile mt)
tileRetrieved in interface com.nutiteq.maps.MapTilesRequestormt - the tile downloadedpublic void updateTile(MapTile mapTile)
updateTile in interface com.nutiteq.maps.MapTilesRequestorpublic void repaint()
repaint in interface DisplayUpdaterpublic void removePlace(Place place)
place - place to be removedpublic void removeLine(Line line)
line - line to be removedpublic void removeLines(Line[] lines)
lines - lines to be removedpublic void removeOnMapElements(OnMapElement[] elements)
elements - elements to be removedpublic void removePlaces(Place[] places)
places - places to be removedpublic void removeAllPlaces()
public void replacePlaces(Place[] places)
places - places to be displayed on mappublic void addPlace(Place place)
place - place to be displayed on map (if visible)public void addPlaces(Place[] places)
places - places to be displayed on map (if visible)
public void addPlaces(Place[] places,
boolean updateScreen)
places - places to be addedupdateScreen - should screen be updated after places have been addedpublic void addLine(Line line)
line - line to be displayedpublic void addLines(Line[] lines)
lines - lines to be displayedpublic void addPolygon(Polygon polygon)
polygon - polygon to be displayedpublic void addPolygons(Polygon[] polygons)
polygons - polygons to be addedpublic void removePolygon(Polygon polygon)
polygon - polygon to be removedpublic void removePolygons(Polygon[] polygons)
polygons - polygons to be removedpublic void addOnMapElements(OnMapElement[] elements)
elements - elements to be added for display
public void addOnMapElements(OnMapElement[] elements,
boolean updateScreen)
elements - updateScreen - public WgsBoundingBox getBoundingBox()
public void setBoundingBox(WgsBoundingBox bBox)
bBox - are to be displayed (in WGS84 coordinates)public void stopMapping()
public void repaint(boolean fromTimer)
fromTimer - public void setLicense(com.nutiteq.license.License license)
license - public void setMap(GeoMap newMap)
newMap - new map to be displayedpublic ZoomRange getZoomRange()
public void addKmlService(KmlService service)
service - new service to be displayed on mappublic KmlService[] getKmlServices()
public void removeKmlService(KmlService service)
service - service to be removedpublic PlaceInfo getAdditionalInfo(Place place)
place - place associated with internal data
public KmlPlace[] getKmlPlaces(KmlService service)
KML - service TODO service for which KML places are needed
public GeoMap getMap()
public java.lang.String getLibraryLog()
public void removeZoomDelay()
public MapPos getInternalMiddlePoint()
public void setSize(int w,
int h)
w - map widthh - map height
public void setScreenPosition(int x,
int y)
x - lefty - top
public void setScreenBounds(int x,
int y,
int w,
int h)
x - lefty - topw - widthh - heightsetScreenPosition(int,int),
setSize(int,int)
public void setScreenCenter(int x,
int y)
x - screen position Xy - screen position Ypublic int getScreenLeft()
public int getScreenTop()
public WgsPoint getCenterPoint()
public void setTouchClickTolerance(int pixels)
pixels - needed to be moved for map dragging
public void moveMap(double lon,
double lat)
lon - new map center in WGS84lat - new map center in WGS84public void moveMap(WgsPoint point)
point - new map center in WGS84public void setZoom(int newZoom)
newZoom - new zoom levelpublic void setCursor(Cursor newCursor)
newCursor - cursor implementationpublic int getZoom()
public MapListener getMapListener()
public PlaceListener getPlaceListener()
getOnMapElementListener() instead.
public OnMapElementListener getOnMapElementListener()
public ErrorListener getErrorListener()
public void setDownloadStreamOpener(DownloadStreamOpener opener)
public void zoomLevelIndicatorCheck()
public void setTileSearchStrategy(GeoMap[] searched)
searched - search strategy to be usedpublic void setPanningStrategy(PanningStrategy panningStrategy)
panningStrategy - new panning strategypublic void setLocationSource(LocationSource source)
source - source to be usedpublic void setNetworkCache(Cache cache)
cache - public MapPos getMapPosition(WgsPoint wgsLocation)
public void removeLocationSource()
public void enqueueDownload(ResourceRequestor downloadable,
int cacheLevel)
enqueueDownload in interface com.nutiteq.net.DownloadHandlerdownloadable - resource to be downloadedcacheLevel - at which cache levels should response be cachedpublic void setZoomLevelIndicator(ZoomIndicator zoomIndicator)
MapComponent.showZoomLevelIndicator(boolean).
zoomIndicator - zoom indicator to usepublic void setDownloadDisplay(DownloadDisplay display)
display - display used for info showpublic void setDownloadCounter(DownloadCounter counter)
counter - implementation usedpublic void looseFocusOnDrag(boolean looseFocus)
looseFocus - should object focus be lostpublic void loosePlaceFocus()
public void focusOnPlace(Place focusOn)
focusOn - place to be focused onpublic Place[] getVisiblePlaces()
public void setFileSystem(FileSystem fs)
StoredMap handling
fs - platform dependent file system to be usedpublic DownloadCounter getDownloadCounter()
public void enqueue(com.nutiteq.task.Task task)
task -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||