-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #597 from openmobilemaps/2.0-RC
2.0 rc
- Loading branch information
Showing
41 changed files
with
1,474 additions
and
344 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
android/src/main/java/io/openmobilemaps/mapscore/map/layers/TiledRasterLayer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.openmobilemaps.mapscore.map.layers | ||
|
||
import android.content.Context | ||
import io.openmobilemaps.mapscore.map.loader.DataLoader | ||
import io.openmobilemaps.mapscore.shared.map.layers.tiled.DefaultTiled2dMapLayerConfigs | ||
import io.openmobilemaps.mapscore.shared.map.layers.tiled.Tiled2dMapLayerConfig | ||
import io.openmobilemaps.mapscore.shared.map.layers.tiled.raster.Tiled2dMapRasterLayerInterface | ||
import io.openmobilemaps.mapscore.shared.map.loader.LoaderInterface | ||
import java.util.UUID | ||
|
||
class TiledRasterLayer(layerConfig: Tiled2dMapLayerConfig, loaders: ArrayList<LoaderInterface>) { | ||
|
||
/** | ||
* Creates a default web-mercator (EPSG:3857) tiled raster layer with a custom LoaderInterface (e.g. a custom DataLoader) | ||
* | ||
* @param tileUrl Url to the tiles, formatted with placeholders. E.g. https://www.sample.org/{z}/{x}/{y}.png | ||
* @param loader A loader interface for loading the layer tiles. E.g an instance of a DataLoader | ||
* @param layerName Name of the created layer | ||
*/ | ||
constructor(tileUrl: String, loader: LoaderInterface, layerName: String = UUID.randomUUID().toString()) : this( | ||
DefaultTiled2dMapLayerConfigs.webMercator(layerName, tileUrl), arrayListOf(loader) | ||
) | ||
|
||
/** | ||
* Creates a default web-mercator (EPSG:3857) tiled raster layer with a default DataLoader. | ||
* | ||
* @param context Android contex used for the default DataLoader | ||
* @param tileUrl Url to the tiles, formatted with placeholders. E.g. https://www.sample.org/{z}/{x}/{y}.png | ||
* @param layerName Name of the created layer | ||
*/ | ||
constructor(context: Context, tileUrl: String, layerName: String = UUID.randomUUID().toString()) : this( | ||
tileUrl, DataLoader(context, context.cacheDir, 50 * 1024 * 1024L), layerName | ||
) | ||
|
||
private val layer: Tiled2dMapRasterLayerInterface = Tiled2dMapRasterLayerInterface.create(layerConfig, loaders) | ||
|
||
fun layerInterface() = layer.asLayerInterface() | ||
fun rasterLayerInterface() = layer | ||
} |
37 changes: 37 additions & 0 deletions
37
android/src/main/java/io/openmobilemaps/mapscore/map/layers/TiledVectorLayer.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.openmobilemaps.mapscore.map.layers | ||
|
||
import android.content.Context | ||
import io.openmobilemaps.mapscore.map.loader.DataLoader | ||
import io.openmobilemaps.mapscore.map.loader.FontLoader | ||
import io.openmobilemaps.mapscore.shared.map.layers.tiled.vector.Tiled2dMapVectorLayerInterface | ||
import io.openmobilemaps.mapscore.shared.map.loader.FontLoaderInterface | ||
import io.openmobilemaps.mapscore.shared.map.loader.LoaderInterface | ||
import java.util.UUID | ||
|
||
class TiledVectorLayer( | ||
styleUrl: String, | ||
loaders: ArrayList<LoaderInterface>, | ||
fontLoader: FontLoaderInterface, | ||
name: String = UUID.randomUUID().toString() | ||
) { | ||
|
||
constructor( | ||
context: Context, | ||
styleUrl: String, | ||
fontAssetFolder: String, | ||
loaders: ArrayList<LoaderInterface> = arrayListOf(DataLoader(context, context.cacheDir, 50 * 1024L * 1024L)) | ||
) : this(styleUrl, loaders, FontLoader(context, fontAssetFolder)) | ||
|
||
constructor( | ||
context: Context, | ||
styleUrl: String, | ||
loaders: ArrayList<LoaderInterface> = arrayListOf(DataLoader(context, context.cacheDir, 50 * 1024L * 1024L)), | ||
fontLoader: FontLoaderInterface = FontLoader(context) | ||
) : this(styleUrl, loaders, fontLoader) | ||
|
||
private val layer = Tiled2dMapVectorLayerInterface.createFromStyleJson(name, styleUrl, loaders, fontLoader) | ||
|
||
fun layerInterface() = layer.asLayerInterface() | ||
fun vectorLayerInterface() = layer | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
.../java/io/openmobilemaps/mapscore/shared/map/layers/tiled/DefaultTiled2dMapLayerConfigs.kt
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...va/io/openmobilemaps/mapscore/shared/map/layers/tiled/raster/wmts/WmtsLayerDescription.kt
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.