summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-01-24 19:42:15 +0100
committerTobrun <tobrun@mapbox.com>2018-01-25 12:54:10 +0100
commita4546a84de28cfddfcb1e5a4ba8b0516a4b4dfa4 (patch)
tree4a70d942b966d69de57da7fc1fbff30d06db3b87 /platform/android/MapboxGLAndroidSDK
parent0d453a688b5bfdd355141e41942fd36c1224d774 (diff)
downloadqtlocation-mapboxgl-a4546a84de28cfddfcb1e5a4ba8b0516a4b4dfa4.tar.gz
[android] - add binding integration for RasterDEMSource, add example
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java93
1 files changed, 93 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java
new file mode 100644
index 0000000000..ee6fc5d7b7
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/RasterDemSource.java
@@ -0,0 +1,93 @@
+package com.mapbox.mapboxsdk.style.sources;
+
+import android.support.annotation.Nullable;
+import android.support.annotation.UiThread;
+
+import java.net.URL;
+
+/**
+ * A raster DEM source. Currently only supports Mapbox Terrain RGB (mapbox://mapbox.terrain-rgb)
+ *
+ * @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#sources-raster-dem">The style specification</a>
+ */
+@UiThread
+public class RasterDemSource extends Source {
+ public static final int DEFAULT_TILE_SIZE = 512;
+
+ /**
+ * Internal use
+ *
+ * @param nativePtr - pointer to native peer
+ */
+ private RasterDemSource(long nativePtr) {
+ super(nativePtr);
+ }
+
+ /**
+ * Create the raster dem source from an URL
+ *
+ * @param id the source id
+ * @param url the source url
+ */
+ public RasterDemSource(String id, URL url) {
+ this(id, url.toExternalForm());
+ }
+
+ /**
+ * Create the raster dem source from an URL
+ *
+ * @param id the source id
+ * @param url the source url
+ */
+ public RasterDemSource(String id, String url) {
+ initialize(id, url, DEFAULT_TILE_SIZE);
+ }
+
+ /**
+ * Create the raster source from an URL with a specific tile size
+ *
+ * @param id the source id
+ * @param url the source url
+ * @param tileSize the tile size
+ */
+ public RasterDemSource(String id, String url, int tileSize) {
+ initialize(id, url, tileSize);
+ }
+
+ /**
+ * Create the raster dem source from a {@link TileSet}
+ *
+ * @param id the source id
+ * @param tileSet the {@link TileSet}
+ */
+ public RasterDemSource(String id, TileSet tileSet) {
+ initialize(id, tileSet.toValueObject(), DEFAULT_TILE_SIZE);
+ }
+
+ /**
+ * Create the raster source from a {@link TileSet} with a specific tile size
+ *
+ * @param id the source id
+ * @param tileSet the {@link TileSet}
+ * @param tileSize tje tile size
+ */
+ public RasterDemSource(String id, TileSet tileSet, int tileSize) {
+ initialize(id, tileSet.toValueObject(), tileSize);
+ }
+
+ /**
+ * @return The url or null
+ */
+ @Nullable
+ public String getUrl() {
+ return nativeGetUrl();
+ }
+
+ protected native void initialize(String layerId, Object payload, int tileSize);
+
+ @Override
+ protected native void finalize() throws Throwable;
+
+ protected native String nativeGetUrl();
+
+}