com.nutiteq.maps
Class BaseMap

java.lang.Object
  extended by com.nutiteq.maps.BaseMap
All Implemented Interfaces:
GeoMap
Direct Known Subclasses:
EPSG3395, EPSG3785, EPSG4326, Lambert, UnstreamedDoubleSizedTilesMap

public abstract class BaseMap
extends java.lang.Object
implements GeoMap

Base class for maps that handles some common logic between different map types.

Handles properties:

Default map size, map bounds and zoom handling is implemented based on OpenStreetMap system. Feel free to override these based on your specific needs.


Constructor Summary
BaseMap(Copyright copyright, int tileSize, int minZoom, int maxZoom)
           
BaseMap(java.lang.String copyright, int tileSize, int minZoom, int maxZoom)
           
 
Method Summary
 void addTileOverlay(MapTileOverlay overlay)
          Add overlay for displaying tiles with additional data on map tiles.
 Copyright getCopyright()
          Map copyright string painted on screen
 com.nutiteq.task.Task getInitializationTask()
          Get task that will be executed after this is set with BasicMapComponent.setMap(GeoMap)
 int getMapHeight(int zoom)
          Get map height for given zoom level.
 int getMapWidth(int zoom)
          Get map width for given zoom level.
 int getMaxZoom()
          Maximum zoom level for implementing map.
 int getMinZoom()
          Minimum zoom level for implementing map.
 com.nutiteq.wrappers.Image getMissingTileImage()
          Get image used for showing missing image.
 ZoomRange getZoomRange()
          Get zoom range for the map
 TileMapBounds getTileMapBounds(int zoom)
          Get map bounds for specified zoom level.
 MapTileOverlay getTileOverlay()
          Get overlay used for map
 int getTileSize()
          Get tile size for implemented map
 void setCopyright(Copyright copyright)
           
 void setMissingTileImage(com.nutiteq.wrappers.Image missingTile)
          Set image used for missing tiles
 MapPos zoom(MapPos middlePoint, int zoomSteps)
           Handles zoom for display middle point (as default the red cross on screen) by assuming that map size between single zoom levels is always magnitude of two (next map size is two times smaller or bigger).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.nutiteq.maps.GeoMap
mapPosToWgs, wgsToMapPos
 

Constructor Detail

BaseMap

public BaseMap(Copyright copyright,
               int tileSize,
               int minZoom,
               int maxZoom)

BaseMap

public BaseMap(java.lang.String copyright,
               int tileSize,
               int minZoom,
               int maxZoom)
Method Detail

getInitializationTask

public com.nutiteq.task.Task getInitializationTask()
Description copied from interface: GeoMap
Get task that will be executed after this is set with BasicMapComponent.setMap(GeoMap)

Specified by:
getInitializationTask in interface GeoMap
Returns:
Task to execute.

getCopyright

public Copyright getCopyright()
Description copied from interface: GeoMap
Map copyright string painted on screen

Specified by:
getCopyright in interface GeoMap
Returns:
copyright string

getTileSize

public int getTileSize()
Description copied from interface: GeoMap
Get tile size for implemented map

Specified by:
getTileSize in interface GeoMap
Returns:
tile size in pixels

getMaxZoom

public int getMaxZoom()
Description copied from interface: GeoMap
Maximum zoom level for implementing map.

Specified by:
getMaxZoom in interface GeoMap
Returns:
maximum zoom for the map

getMinZoom

public int getMinZoom()
Description copied from interface: GeoMap
Minimum zoom level for implementing map.

Specified by:
getMinZoom in interface GeoMap
Returns:
minimum zoom level

getZoomRange

public ZoomRange getZoomRange()
Description copied from interface: GeoMap
Get zoom range for the map

Specified by:
getZoomRange in interface GeoMap
Returns:
zoom range (min zoom, max zoom) for the map

zoom

public MapPos zoom(MapPos middlePoint,
                   int zoomSteps)

Handles zoom for display middle point (as default the red cross on screen) by assuming that map size between single zoom levels is always magnitude of two (next map size is two times smaller or bigger).

For example for OpenStreetMap zoom level 0 world size is 256x256 pixels and center point will be in 128x128. If zoomed in one level world size will be 512x512 pixels and center point will be at 256x256.

Specified by:
zoom in interface GeoMap
Parameters:
middlePoint - map position on witch to perform zoom action
zoomSteps - zoom steps needed to handle
Returns:
maps position on new zoom level

getTileMapBounds

public TileMapBounds getTileMapBounds(int zoom)
Get map bounds for specified zoom level.

Specified by:
getTileMapBounds in interface GeoMap
Parameters:
zoom - zoom level for witch to get map bounds
Returns:
bounds for zoom level for given map

getMapHeight

public int getMapHeight(int zoom)
Get map height for given zoom level. Default implementation is done for OpenStreetMap system (map tile edge is power of 2)

Specified by:
getMapHeight in interface GeoMap
Parameters:
zoom - zoom level for witch to get map height
Returns:
map height

getMapWidth

public int getMapWidth(int zoom)
Get map width for given zoom level. Default implementation is done for OpenStreetMap system (map tile edge is power of 2)

Specified by:
getMapWidth in interface GeoMap
Parameters:
zoom - zoom level for witch to get map width
Returns:
map width

addTileOverlay

public void addTileOverlay(MapTileOverlay overlay)
Description copied from interface: GeoMap
Add overlay for displaying tiles with additional data on map tiles.

Specified by:
addTileOverlay in interface GeoMap
Parameters:
overlay - overlay to be used for additional data

getTileOverlay

public MapTileOverlay getTileOverlay()
Description copied from interface: GeoMap
Get overlay used for map

Specified by:
getTileOverlay in interface GeoMap
Returns:
overlay used for additional data

setMissingTileImage

public void setMissingTileImage(com.nutiteq.wrappers.Image missingTile)
Description copied from interface: GeoMap
Set image used for missing tiles

Specified by:
setMissingTileImage in interface GeoMap
Parameters:
missingTile - image used

getMissingTileImage

public com.nutiteq.wrappers.Image getMissingTileImage()
Description copied from interface: GeoMap
Get image used for showing missing image.

Specified by:
getMissingTileImage in interface GeoMap
Returns:
image used

setCopyright

public void setCopyright(Copyright copyright)