@Override public void close() { for (MapDataStore mdb : mapDatabases) { mdb.close(); } }
private MapReadResult readLabels(Tile tile, boolean deduplicate) { MapReadResult mapReadResult = new MapReadResult(); for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(tile)) { MapReadResult result = mdb.readLabels(tile); if (result == null) { continue; } boolean isWater = mapReadResult.isWater & result.isWater; mapReadResult.isWater = isWater; mapReadResult.add(result, deduplicate); } } return mapReadResult; }
private MapReadResult readMapData(Tile tile, boolean deduplicate) { MapReadResult mapReadResult = new MapReadResult(); for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(tile)) { MapReadResult result = mdb.readMapData(tile); if (result == null) { continue; } boolean isWater = mapReadResult.isWater & result.isWater; mapReadResult.isWater = isWater; mapReadResult.add(result, deduplicate); } } return mapReadResult; }
private MapReadResult readPoiData(Tile upperLeft, Tile lowerRight, boolean deduplicate) { MapReadResult mapReadResult = new MapReadResult(); for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(upperLeft)) { MapReadResult result = mdb.readPoiData(upperLeft, lowerRight); if (result == null) { continue; } boolean isWater = mapReadResult.isWater & result.isWater; mapReadResult.isWater = isWater; mapReadResult.add(result, deduplicate); } } return mapReadResult; }
/** * 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 * * @param upperLeft tile that defines the upper left corner of the requested area. * @param lowerRight tile that defines the lower right corner of the requested area. * @return map data for the tile. */ public MapReadResult readLabels(Tile upperLeft, Tile lowerRight) { if (upperLeft.tileX > lowerRight.tileX || upperLeft.tileY > lowerRight.tileY) { new IllegalArgumentException("upperLeft tile must be above and left of lowerRight tile"); } MapReadResult result = new MapReadResult(); for (int x = upperLeft.tileX; x <= lowerRight.tileX; x++) { for (int y = upperLeft.tileY; y <= lowerRight.tileY; y++) { Tile current = new Tile(x, y, upperLeft.zoomLevel, upperLeft.tileSize); result.add(readLabels(current), false); } } return result; }
@Override public MapReadResult readLabels(Tile tile) { switch (this.dataPolicy) { case RETURN_FIRST: for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(tile)) { return mdb.readLabels(tile); } } return null; case RETURN_ALL: return readLabels(tile, false); case DEDUPLICATE: return readLabels(tile, true); } throw new IllegalStateException("Invalid data policy for multi map database"); }
@Override public MapReadResult readPoiData(Tile upperLeft, Tile lowerRight) { switch (this.dataPolicy) { case RETURN_FIRST: for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(upperLeft)) { return mdb.readPoiData(upperLeft, lowerRight); } } return null; case RETURN_ALL: return readPoiData(upperLeft, lowerRight, false); case DEDUPLICATE: return readPoiData(upperLeft, lowerRight, true); } throw new IllegalStateException("Invalid data policy for multi map database"); }
@Override public MapReadResult readMapData(Tile tile) { switch (this.dataPolicy) { case RETURN_FIRST: for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(tile)) { return mdb.readMapData(tile); } } return null; case RETURN_ALL: return readMapData(tile, false); case DEDUPLICATE: return readMapData(tile, true); } throw new IllegalStateException("Invalid data policy for multi map database"); }
/** * Extracts substring of preferred language from multilingual string using * the preferredLanguage setting. */ protected String extractLocalized(String s) { return MapDataStore.extract(s, preferredLanguage); }
/** * @return the start point (may be null). */ public LatLong getStartPosition() { if (this.mapDataStore != null) { return this.mapDataStore.startPosition(); } return null; }
/** * @return the start zoom level (may be null). */ public Byte getStartZoomLevel() { if (this.mapDataStore != null && null != this.mapDataStore.startZoomLevel()) { return this.mapDataStore.startZoomLevel(); } return DEFAULT_START_ZOOM_LEVEL; }
@Override public boolean supportsTile(Tile tile) { for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(tile)) { return true; } } return false; } }
/** * 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. * * @param tile tile for which data is requested. * @return label data for the tile. */ public MapReadResult readLabels(Tile tile) { return readMapData(tile); }
private MapReadResult readLabels(Tile upperLeft, Tile lowerRight, boolean deduplicate) { MapReadResult mapReadResult = new MapReadResult(); for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(upperLeft)) { MapReadResult result = mdb.readLabels(upperLeft, lowerRight); if (result == null) { continue; } boolean isWater = mapReadResult.isWater & result.isWater; mapReadResult.isWater = isWater; mapReadResult.add(result, deduplicate); } } return mapReadResult; }
private MapReadResult readMapData(Tile upperLeft, Tile lowerRight, boolean deduplicate) { MapReadResult mapReadResult = new MapReadResult(); for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(upperLeft)) { MapReadResult result = mdb.readMapData(upperLeft, lowerRight); if (result == null) { continue; } boolean isWater = mapReadResult.isWater & result.isWater; mapReadResult.isWater = isWater; mapReadResult.add(result, deduplicate); } } return mapReadResult; }
private MapReadResult readPoiData(Tile tile, boolean deduplicate) { MapReadResult mapReadResult = new MapReadResult(); for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(tile)) { MapReadResult result = mdb.readPoiData(tile); if (result == null) { continue; } boolean isWater = mapReadResult.isWater & result.isWater; mapReadResult.isWater = isWater; mapReadResult.add(result, deduplicate); } } return mapReadResult; }
@Override public MapReadResult readLabels(Tile upperLeft, Tile lowerRight) { switch (this.dataPolicy) { case RETURN_FIRST: for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(upperLeft)) { return mdb.readLabels(upperLeft, lowerRight); } } return null; case RETURN_ALL: return readLabels(upperLeft, lowerRight, false); case DEDUPLICATE: return readLabels(upperLeft, lowerRight, true); } throw new IllegalStateException("Invalid data policy for multi map database"); }
@Override public MapReadResult readPoiData(Tile tile) { switch (this.dataPolicy) { case RETURN_FIRST: for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(tile)) { return mdb.readPoiData(tile); } } return null; case RETURN_ALL: return readPoiData(tile, false); case DEDUPLICATE: return readPoiData(tile, true); } throw new IllegalStateException("Invalid data policy for multi map database"); }
@Override public MapReadResult readMapData(Tile upperLeft, Tile lowerRight) { switch (this.dataPolicy) { case RETURN_FIRST: for (MapDataStore mdb : mapDatabases) { if (mdb.supportsTile(upperLeft)) { return mdb.readMapData(upperLeft, lowerRight); } } return null; case RETURN_ALL: return readMapData(upperLeft, lowerRight, false); case DEDUPLICATE: return readMapData(upperLeft, lowerRight, true); } throw new IllegalStateException("Invalid data policy for multi map database"); }
boolean renderBitmap(RenderContext renderContext) { return !renderContext.renderTheme.hasMapBackgroundOutside() || this.mapDataStore.supportsTile(renderContext.rendererJob.tile); }