Package org.mapsforge.map.datastore
Class MultiMapDataStore
- java.lang.Object
-
- org.mapsforge.map.datastore.MapDataStore
-
- org.mapsforge.map.datastore.MultiMapDataStore
-
public class MultiMapDataStore extends MapDataStore
A MapDatabase that reads and combines data from multiple map files. The MultiMapDatabase supports the following modes for reading from multiple files: - RETURN_FIRST: the data from the first database to support a tile will be returned. This is the fastest operation suitable when you know there is no overlap between map files. - RETURN_ALL: the data from all files will be returned, the data will be combined. This is suitable if more than one file can contain data for a tile, but you know there is no semantic overlap, e.g. one file contains contour lines, another road data. - DEDUPLICATE: the data from all files will be returned but duplicates will be eliminated. This is suitable when multiple maps cover the different areas, but there is some overlap at boundaries. This is the most expensive operation and often it is actually faster to double paint objects as otherwise all objects have to be compared with all others.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MultiMapDataStore.DataPolicy
-
Field Summary
-
Fields inherited from class org.mapsforge.map.datastore.MapDataStore
preferredLanguage
-
-
Constructor Summary
Constructors Constructor Description MultiMapDataStore(MultiMapDataStore.DataPolicy dataPolicy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMapDataStore(MapDataStore mapDataStore, boolean useStartZoomLevel, boolean useStartPosition)
adds another mapDataStoreorg.mapsforge.core.model.BoundingBox
boundingBox()
Returns the area for which data is supplied.void
close()
long
getDataTimestamp(org.mapsforge.core.model.Tile tile)
Returns the timestamp of the data used to render a specific tile.MapReadResult
readLabels(org.mapsforge.core.model.Tile tile)
Reads only labels for tile.MapReadResult
readLabels(org.mapsforge.core.model.Tile upperLeft, org.mapsforge.core.model.Tile lowerRight)
Reads data for an area defined by the tile in the upper left and the tile in the lower right corner.MapReadResult
readMapData(org.mapsforge.core.model.Tile tile)
Reads data for tile.MapReadResult
readMapData(org.mapsforge.core.model.Tile upperLeft, org.mapsforge.core.model.Tile lowerRight)
Reads data for an area defined by the tile in the upper left and the tile in the lower right corner.MapReadResult
readPoiData(org.mapsforge.core.model.Tile tile)
Reads only POI data for tile.MapReadResult
readPoiData(org.mapsforge.core.model.Tile upperLeft, org.mapsforge.core.model.Tile lowerRight)
Reads POI data for an area defined by the tile in the upper left and the tile in the lower right corner.void
setStartPosition(org.mapsforge.core.model.LatLong startPosition)
void
setStartZoomLevel(byte startZoomLevel)
org.mapsforge.core.model.LatLong
startPosition()
Gets the initial map position.java.lang.Byte
startZoomLevel()
Gets the initial zoom level.boolean
supportsTile(org.mapsforge.core.model.Tile tile)
Returns true if MapDatabase contains tile.-
Methods inherited from class org.mapsforge.map.datastore.MapDataStore
extract, extractLocalized, wayAsLabelTagFilter
-
-
-
-
Constructor Detail
-
MultiMapDataStore
public MultiMapDataStore(MultiMapDataStore.DataPolicy dataPolicy)
-
-
Method Detail
-
addMapDataStore
public void addMapDataStore(MapDataStore mapDataStore, boolean useStartZoomLevel, boolean useStartPosition)
adds another mapDataStore- Parameters:
mapDataStore
- the mapDataStore to adduseStartZoomLevel
- if true, use the start zoom level of this mapDataStore as the start zoom leveluseStartPosition
- if true, use the start position of this mapDataStore as the start position
-
boundingBox
public org.mapsforge.core.model.BoundingBox boundingBox()
Description copied from class:MapDataStore
Returns the area for which data is supplied.- Specified by:
boundingBox
in classMapDataStore
- Returns:
- bounding box of area.
-
close
public void close()
- Specified by:
close
in classMapDataStore
-
getDataTimestamp
public long getDataTimestamp(org.mapsforge.core.model.Tile tile)
Returns the timestamp of the data used to render a specific tile. If the tile uses data from multiple data stores, the most recent timestamp is returned.- Specified by:
getDataTimestamp
in classMapDataStore
- Parameters:
tile
- A tile.- Returns:
- the timestamp of the data used to render the tile
-
readLabels
public MapReadResult readLabels(org.mapsforge.core.model.Tile tile)
Description copied from class:MapDataStore
Reads only labels for tile. Labels are pois as well as ways that carry a name tag. It is permissible for the MapDataStore to return more data. This default implementation returns all map data, which is inefficient, but works.- Overrides:
readLabels
in classMapDataStore
- Parameters:
tile
- tile for which data is requested.- Returns:
- label data for the tile.
-
readLabels
public MapReadResult readLabels(org.mapsforge.core.model.Tile upperLeft, org.mapsforge.core.model.Tile lowerRight)
Description copied from class:MapDataStore
Reads data for an area defined by the tile in the upper left and the tile in the lower right corner. The default implementation combines the results from all tiles, a possibly inefficient solution. Precondition: upperLeft.tileX <= lowerRight.tileX && upperLeft.tileY <= lowerRight.tileY- Overrides:
readLabels
in classMapDataStore
- Parameters:
upperLeft
- tile that defines the upper left corner of the requested area.lowerRight
- tile that defines the lower right corner of the requested area.- Returns:
- map data for the tile.
-
readMapData
public MapReadResult readMapData(org.mapsforge.core.model.Tile tile)
Description copied from class:MapDataStore
Reads data for tile.- Specified by:
readMapData
in classMapDataStore
- Parameters:
tile
- tile for which data is requested.- Returns:
- map data for the tile.
-
readMapData
public MapReadResult readMapData(org.mapsforge.core.model.Tile upperLeft, org.mapsforge.core.model.Tile lowerRight)
Description copied from class:MapDataStore
Reads data for an area defined by the tile in the upper left and the tile in the lower right corner. The default implementation combines the results from all tiles, a possibly inefficient solution. Precondition: upperLeft.tileX <= lowerRight.tileX && upperLeft.tileY <= lowerRight.tileY- Overrides:
readMapData
in classMapDataStore
- Parameters:
upperLeft
- tile that defines the upper left corner of the requested area.lowerRight
- tile that defines the lower right corner of the requested area.- Returns:
- map data for the tile.
-
readPoiData
public MapReadResult readPoiData(org.mapsforge.core.model.Tile tile)
Description copied from class:MapDataStore
Reads only POI data for tile.- Specified by:
readPoiData
in classMapDataStore
- Parameters:
tile
- tile for which data is requested.- Returns:
- poi data for the tile.
-
readPoiData
public MapReadResult readPoiData(org.mapsforge.core.model.Tile upperLeft, org.mapsforge.core.model.Tile lowerRight)
Description copied from class:MapDataStore
Reads POI data for an area defined by the tile in the upper left and the tile in the lower right corner. The default implementation combines the results from all tiles, a possibly inefficient solution. Precondition: upperLeft.tileX <= lowerRight.tileX && upperLeft.tileY <= lowerRight.tileY- Overrides:
readPoiData
in classMapDataStore
- Parameters:
upperLeft
- tile that defines the upper left corner of the requested area.lowerRight
- tile that defines the lower right corner of the requested area.- Returns:
- map data for the tile.
-
setStartPosition
public void setStartPosition(org.mapsforge.core.model.LatLong startPosition)
-
setStartZoomLevel
public void setStartZoomLevel(byte startZoomLevel)
-
startPosition
public org.mapsforge.core.model.LatLong startPosition()
Description copied from class:MapDataStore
Gets the initial map position.- Specified by:
startPosition
in classMapDataStore
- Returns:
- the start position, if available.
-
startZoomLevel
public java.lang.Byte startZoomLevel()
Description copied from class:MapDataStore
Gets the initial zoom level.- Specified by:
startZoomLevel
in classMapDataStore
- Returns:
- the start zoom level.
-
supportsTile
public boolean supportsTile(org.mapsforge.core.model.Tile tile)
Description copied from class:MapDataStore
Returns true if MapDatabase contains tile.- Specified by:
supportsTile
in classMapDataStore
- Parameters:
tile
- tile to be rendered.- Returns:
- true if tile is part of database.
-
-