Skip to content
Permalink
Browse files

Implement change requests

  • Loading branch information...
sgelb committed Oct 16, 2019
1 parent a1d1098 commit c70f367fa14375c356725d3de7d94dd722dab53c
Showing with 51 additions and 8 deletions.
  1. +51 −8 osmdroid-mapsforge/src/main/java/org/osmdroid/mapsforge/MapsForgeTileSource.java
@@ -52,15 +52,16 @@
* except file should be determined from the archive file. Therefore a
* factory method is necessary.
*
* @param cacheTileSourceName
* @param minZoom
* @param maxZoom
* @param tileSizePixels
* @param file
* @param language
* @param xmlRenderTheme the theme to render tiles with
* @param hillsRenderConfig the hillshading setup to be used (can be null)
* @param language preferred language for map labels as defined in ISO 639-1 or ISO 639-2 (can be null)
*/
protected MapsForgeTileSource(String cacheTileSourceName, int minZoom, int maxZoom, int tileSizePixels, File[] file, String language, XmlRenderTheme xmlRenderTheme, MultiMapDataStore.DataPolicy dataPolicy, HillsRenderConfig hillsRenderConfig) {
protected MapsForgeTileSource(String cacheTileSourceName, int minZoom, int maxZoom, int tileSizePixels, File[] file, XmlRenderTheme xmlRenderTheme, MultiMapDataStore.DataPolicy dataPolicy, HillsRenderConfig hillsRenderConfig, final String language) {
super(cacheTileSourceName, minZoom, maxZoom, tileSizePixels, ".png","© OpenStreetMap contributors");

mapDatabase = new MultiMapDataStore(dataPolicy);
@@ -99,6 +100,23 @@ protected MapsForgeTileSource(String cacheTileSourceName, int minZoom, int maxZo
}
}

/**
* The reason this constructor is protected is because all parameters,
* except file should be determined from the archive file. Therefore a
* factory method is necessary.
*
* @param cacheTileSourceName
* @param minZoom
* @param maxZoom
* @param tileSizePixels
* @param file
* @param xmlRenderTheme the theme to render tiles with
* @param hillsRenderConfig the hillshading setup to be used (can be null)
*/
protected MapsForgeTileSource(String cacheTileSourceName, int minZoom, int maxZoom, int tileSizePixels, File[] file, XmlRenderTheme xmlRenderTheme, MultiMapDataStore.DataPolicy dataPolicy, HillsRenderConfig hillsRenderConfig) {
this(cacheTileSourceName, minZoom, maxZoom, tileSizePixels, file, xmlRenderTheme, dataPolicy, hillsRenderConfig, null);
}

public BoundingBox getBounds(){
return mapDatabase.boundingBox();
}
@@ -128,7 +146,7 @@ public static MapsForgeTileSource createFromFiles(File[] file) {
int maxZoomLevel = MAX_ZOOM;
int tileSizePixels = TILE_SIZE_PIXELS;

return new MapsForgeTileSource(InternalRenderTheme.OSMARENDER.name(), minZoomLevel, maxZoomLevel, tileSizePixels, file, null, InternalRenderTheme.OSMARENDER, MultiMapDataStore.DataPolicy.RETURN_ALL, null);
return new MapsForgeTileSource(InternalRenderTheme.OSMARENDER.name(), minZoomLevel, maxZoomLevel, tileSizePixels, file, InternalRenderTheme.OSMARENDER, MultiMapDataStore.DataPolicy.RETURN_ALL, null, null);
}

/**
@@ -149,7 +167,7 @@ public static MapsForgeTileSource createFromFiles(File[] file, XmlRenderTheme th
int maxZoomLevel = MAX_ZOOM;
int tileSizePixels = TILE_SIZE_PIXELS;

return new MapsForgeTileSource(themeName, minZoomLevel, maxZoomLevel, tileSizePixels, file, null, theme, MultiMapDataStore.DataPolicy.RETURN_ALL, null);
return new MapsForgeTileSource(themeName, minZoomLevel, maxZoomLevel, tileSizePixels, file, theme, MultiMapDataStore.DataPolicy.RETURN_ALL, null, null);
}

/**
@@ -160,18 +178,18 @@ public static MapsForgeTileSource createFromFiles(File[] file, XmlRenderTheme th
* defined by this class are used, which is zoom = 3-20
*
* @param file
* @param language this can be null, in which case the default language will be used
* @param theme this can be null, in which case the default them will be used
* @param themeName when using a custom theme, this sets up the osmdroid caching correctly
* @param language preferred language for map labels as defined in ISO 639-1 or ISO 639-2 (can be null)
* @return
*/
public static MapsForgeTileSource createFromFiles(File[] file, String language, XmlRenderTheme theme, String themeName) {
public static MapsForgeTileSource createFromFiles(File[] file, XmlRenderTheme theme, String themeName, final String language) {
//these settings are ignored and are set based on .map file info
int minZoomLevel = MIN_ZOOM;
int maxZoomLevel = MAX_ZOOM;
int tileSizePixels = TILE_SIZE_PIXELS;

return new MapsForgeTileSource(themeName, minZoomLevel, maxZoomLevel, tileSizePixels, file, language, theme, MultiMapDataStore.DataPolicy.RETURN_ALL, null);
return new MapsForgeTileSource(themeName, minZoomLevel, maxZoomLevel, tileSizePixels, file, theme, MultiMapDataStore.DataPolicy.RETURN_ALL, null, language);
}

/**
@@ -185,6 +203,7 @@ public static MapsForgeTileSource createFromFiles(File[] file, String language,
* @param theme this can be null, in which case the default them will be used
* @param themeName when using a custom theme, this sets up the osmdroid caching correctly
* @param dataPolicy use this to override the default, which is "RETURN_ALL"
* @param hillsRenderConfig the hillshading setup to be used (can be null)
* @return
*/
public static MapsForgeTileSource createFromFiles(File[] file, XmlRenderTheme theme, String themeName, MultiMapDataStore.DataPolicy dataPolicy, HillsRenderConfig hillsRenderConfig) {
@@ -193,7 +212,31 @@ public static MapsForgeTileSource createFromFiles(File[] file, XmlRenderTheme th
int maxZoomLevel = MAX_ZOOM;
int tileSizePixels = TILE_SIZE_PIXELS;

return new MapsForgeTileSource(themeName, minZoomLevel, maxZoomLevel, tileSizePixels, file, null, theme, dataPolicy, hillsRenderConfig);
return new MapsForgeTileSource(themeName, minZoomLevel, maxZoomLevel, tileSizePixels, file, theme, dataPolicy, hillsRenderConfig, null);
}

/**
* Creates a new MapsForgeTileSource from file[].
* <p></p>
* Parameters minZoom and maxZoom are obtained from the
* database. If they cannot be obtained from the DB, the default values as
* defined by this class are used, which is zoom = 3-20
*
* @param file
* @param theme this can be null, in which case the default them will be used
* @param themeName when using a custom theme, this sets up the osmdroid caching correctly
* @param dataPolicy use this to override the default, which is "RETURN_ALL"
* @param hillsRenderConfig the hillshading setup to be used (can be null)
* @param language preferred language for map labels as defined in ISO 639-1 or ISO 639-2 (can be null)
* @return
*/
public static MapsForgeTileSource createFromFiles(File[] file, XmlRenderTheme theme, String themeName, MultiMapDataStore.DataPolicy dataPolicy, HillsRenderConfig hillsRenderConfig, final String language) {
//these settings are ignored and are set based on .map file info
int minZoomLevel = MIN_ZOOM;
int maxZoomLevel = MAX_ZOOM;
int tileSizePixels = TILE_SIZE_PIXELS;

return new MapsForgeTileSource(themeName, minZoomLevel, maxZoomLevel, tileSizePixels, file, theme, dataPolicy, hillsRenderConfig, language);
}


0 comments on commit c70f367

Please sign in to comment.
You can’t perform that action at this time.