summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java21
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java150
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TerrainLayer.java248
3 files changed, 419 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java
index 383d4217a8..81d90ed3ec 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java
@@ -445,6 +445,27 @@ public abstract class Property<T> {
@Retention(RetentionPolicy.SOURCE)
public @interface CIRCLE_PITCH_SCALE {}
+ //TERRAIN_ILLUMINATION_ALIGNMENT: Direction of light source when map is rotated.
+
+ /**
+ * The terrain illumination is relative to the north-west direction.
+ */
+ public static final String TERRAIN_ILLUMINATION_ALIGNMENT_MAP = "map";
+ /**
+ * The terrain illumination is relative to the top left of the viewport.
+ */
+ public static final String TERRAIN_ILLUMINATION_ALIGNMENT_VIEWPORT = "viewport";
+
+ /**
+ * Direction of light source when map is rotated.
+ */
+ @StringDef({
+ TERRAIN_ILLUMINATION_ALIGNMENT_MAP,
+ TERRAIN_ILLUMINATION_ALIGNMENT_VIEWPORT,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface TERRAIN_ILLUMINATION_ALIGNMENT {}
+
//Class definition
public final String name;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java
index 0cb8fdeff9..a3fbf2b93b 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java
@@ -1012,6 +1012,156 @@ public class PropertyFactory {
}
/**
+ * The color of the terrain that faces away from the light source.
+ *
+ * @param value a int color value
+ * @return property wrapper around String color
+ */
+ public static Property<String> terrainShadowColor(@ColorInt int value) {
+ return new PaintProperty<>("terrain-shadow-color", colorToRgbaString(value));
+ }
+
+ /**
+ * The color of the terrain that faces away from the light source.
+ *
+ * @param value a String value
+ * @return property wrapper around String
+ */
+ public static Property<String> terrainShadowColor(String value) {
+ return new PaintProperty<>("terrain-shadow-color", value);
+ }
+
+ /**
+ * The color of the terrain that faces away from the light source.
+ *
+ * @param function a wrapper function for String
+ * @return property wrapper around a String function
+ */
+ public static Property<Function<String>> terrainShadowColor(Function<String> function) {
+ return new PaintProperty<>("terrain-shadow-color", function);
+ }
+
+ /**
+ * The color of the terrain that faces towards the light source.
+ *
+ * @param value a int color value
+ * @return property wrapper around String color
+ */
+ public static Property<String> terrainHighlightColor(@ColorInt int value) {
+ return new PaintProperty<>("terrain-highlight-color", colorToRgbaString(value));
+ }
+
+ /**
+ * The color of the terrain that faces towards the light source.
+ *
+ * @param value a String value
+ * @return property wrapper around String
+ */
+ public static Property<String> terrainHighlightColor(String value) {
+ return new PaintProperty<>("terrain-highlight-color", value);
+ }
+
+ /**
+ * The color of the terrain that faces towards the light source.
+ *
+ * @param function a wrapper function for String
+ * @return property wrapper around a String function
+ */
+ public static Property<Function<String>> terrainHighlightColor(Function<String> function) {
+ return new PaintProperty<>("terrain-highlight-color", function);
+ }
+
+ /**
+ * The color used to accentuate rugged terrain with sharp cliffs and gorges.
+ *
+ * @param value a int color value
+ * @return property wrapper around String color
+ */
+ public static Property<String> terrainAccentColor(@ColorInt int value) {
+ return new PaintProperty<>("terrain-accent-color", colorToRgbaString(value));
+ }
+
+ /**
+ * The color used to accentuate rugged terrain with sharp cliffs and gorges.
+ *
+ * @param value a String value
+ * @return property wrapper around String
+ */
+ public static Property<String> terrainAccentColor(String value) {
+ return new PaintProperty<>("terrain-accent-color", value);
+ }
+
+ /**
+ * The color used to accentuate rugged terrain with sharp cliffs and gorges.
+ *
+ * @param function a wrapper function for String
+ * @return property wrapper around a String function
+ */
+ public static Property<Function<String>> terrainAccentColor(Function<String> function) {
+ return new PaintProperty<>("terrain-accent-color", function);
+ }
+
+ /**
+ * Direction of the lightsource. Defaults to top left.
+ *
+ * @param value a Float value
+ * @return property wrapper around Float
+ */
+ public static Property<Float> terrainIlluminationDirection(Float value) {
+ return new PaintProperty<>("terrain-illumination-direction", value);
+ }
+
+ /**
+ * Direction of the lightsource. Defaults to top left.
+ *
+ * @param function a wrapper function for Float
+ * @return property wrapper around a Float function
+ */
+ public static Property<Function<Float>> terrainIlluminationDirection(Function<Float> function) {
+ return new PaintProperty<>("terrain-illumination-direction", function);
+ }
+
+ /**
+ * Direction of light source when map is rotated.
+ *
+ * @param value a String value
+ * @return property wrapper around String
+ */
+ public static Property<String> terrainIlluminationAlignment(@Property.TERRAIN_ILLUMINATION_ALIGNMENT String value) {
+ return new PaintProperty<>("terrain-illumination-alignment", value);
+ }
+
+ /**
+ * Direction of light source when map is rotated.
+ *
+ * @param function a wrapper function for String
+ * @return property wrapper around a String function
+ */
+ public static Property<Function<String>> terrainIlluminationAlignment(Function<String> function) {
+ return new PaintProperty<>("terrain-illumination-alignment", function);
+ }
+
+ /**
+ * Intensity of the terrain
+ *
+ * @param value a Float value
+ * @return property wrapper around Float
+ */
+ public static Property<Float> terrainExaggeration(Float value) {
+ return new PaintProperty<>("terrain-exaggeration", value);
+ }
+
+ /**
+ * Intensity of the terrain
+ *
+ * @param function a wrapper function for Float
+ * @return property wrapper around a Float function
+ */
+ public static Property<Function<Float>> terrainExaggeration(Function<Float> function) {
+ return new PaintProperty<>("terrain-exaggeration", function);
+ }
+
+ /**
* The color with which the background will be drawn.
*
* @param value a int color value
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TerrainLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TerrainLayer.java
new file mode 100644
index 0000000000..c4da42142f
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/TerrainLayer.java
@@ -0,0 +1,248 @@
+// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make style-code-android`.
+package com.mapbox.mapboxsdk.style.layers;
+
+import com.mapbox.mapboxsdk.exceptions.ConversionException;
+
+import android.support.annotation.ColorInt;
+import android.support.annotation.NonNull;
+
+import static com.mapbox.mapboxsdk.utils.ColorUtils.*;
+
+/**
+ * Terrain visualization based on DEM data.
+ *
+ * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#layers-terrain">The online documentation</a>
+ */
+public class TerrainLayer extends Layer {
+
+ /**
+ * Creates a TerrainLayer.
+ *
+ * @param nativePtr pointer used by core
+ */
+ public TerrainLayer(long nativePtr) {
+ super(nativePtr);
+ }
+
+ /**
+ * Creates a TerrainLayer.
+ *
+ * @param layerId the id of the layer
+ * @param sourceId the id of the source
+ */
+ public TerrainLayer(String layerId, String sourceId) {
+ initialize(layerId, sourceId);
+ }
+
+ protected native void initialize(String layerId, String sourceId);
+
+ /**
+ * Set the source layer.
+ *
+ * @param sourceLayer the source layer to set
+ */
+ public void setSourceLayer(String sourceLayer) {
+ checkValidity();
+ nativeSetSourceLayer(sourceLayer);
+ }
+
+ /**
+ * Set the source Layer.
+ *
+ * @param sourceLayer the source layer to set
+ * @return This
+ */
+ public TerrainLayer withSourceLayer(String sourceLayer) {
+ setSourceLayer(sourceLayer);
+ return this;
+ }
+ /**
+ * Set a single filter.
+ *
+ * @param filter the filter to set
+ */
+ public void setFilter(Filter.Statement filter) {
+ checkValidity();
+ this.setFilter(filter.toArray());
+ }
+
+ /**
+ * Set an array of filters.
+ *
+ * @param filter the filter array to set
+ */
+ public void setFilter(Object[] filter) {
+ checkValidity();
+ nativeSetFilter(filter);
+ }
+
+ /**
+ * Set an array of filters.
+ *
+ * @param filter tthe filter array to set
+ * @return This
+ */
+ public TerrainLayer withFilter(Object[] filter) {
+ setFilter(filter);
+ return this;
+ }
+
+ /**
+ * Set a single filter.
+ *
+ * @param filter the filter to set
+ * @return This
+ */
+ public TerrainLayer withFilter(Filter.Statement filter) {
+ setFilter(filter);
+ return this;
+ }
+
+
+ /**
+ * Set a property or properties.
+ *
+ * @param properties the var-args properties
+ * @return This
+ */
+ public TerrainLayer withProperties(@NonNull Property<?>... properties) {
+ setProperties(properties);
+ return this;
+ }
+
+ // Property getters
+
+ /**
+ * Get the TerrainShadowColor property
+ *
+ * @return property wrapper value around String
+ */
+ @SuppressWarnings("unchecked")
+ public PropertyValue<String> getTerrainShadowColor() {
+ checkValidity();
+ return (PropertyValue<String>) new PropertyValue(nativeGetTerrainShadowColor());
+ }
+ /**
+ * The color of the terrain that faces away from the light source.
+ *
+ * @return int representation of a rgba string color
+ * @throws RuntimeException thrown if property isn't a value
+ */
+ @ColorInt
+ public int getTerrainShadowColorAsInt() {
+ checkValidity();
+ PropertyValue<String> value = getTerrainShadowColor();
+ if (value.isValue()) {
+ return rgbaToColor(value.getValue());
+ } else {
+ throw new RuntimeException("terrain-shadow-color was set as a Function");
+ }
+ }
+
+
+ /**
+ * Get the TerrainHighlightColor property
+ *
+ * @return property wrapper value around String
+ */
+ @SuppressWarnings("unchecked")
+ public PropertyValue<String> getTerrainHighlightColor() {
+ checkValidity();
+ return (PropertyValue<String>) new PropertyValue(nativeGetTerrainHighlightColor());
+ }
+ /**
+ * The color of the terrain that faces towards the light source.
+ *
+ * @return int representation of a rgba string color
+ * @throws RuntimeException thrown if property isn't a value
+ */
+ @ColorInt
+ public int getTerrainHighlightColorAsInt() {
+ checkValidity();
+ PropertyValue<String> value = getTerrainHighlightColor();
+ if (value.isValue()) {
+ return rgbaToColor(value.getValue());
+ } else {
+ throw new RuntimeException("terrain-highlight-color was set as a Function");
+ }
+ }
+
+
+ /**
+ * Get the TerrainAccentColor property
+ *
+ * @return property wrapper value around String
+ */
+ @SuppressWarnings("unchecked")
+ public PropertyValue<String> getTerrainAccentColor() {
+ checkValidity();
+ return (PropertyValue<String>) new PropertyValue(nativeGetTerrainAccentColor());
+ }
+ /**
+ * The color used to accentuate rugged terrain with sharp cliffs and gorges.
+ *
+ * @return int representation of a rgba string color
+ * @throws RuntimeException thrown if property isn't a value
+ */
+ @ColorInt
+ public int getTerrainAccentColorAsInt() {
+ checkValidity();
+ PropertyValue<String> value = getTerrainAccentColor();
+ if (value.isValue()) {
+ return rgbaToColor(value.getValue());
+ } else {
+ throw new RuntimeException("terrain-accent-color was set as a Function");
+ }
+ }
+
+
+ /**
+ * Get the TerrainIlluminationDirection property
+ *
+ * @return property wrapper value around Float
+ */
+ @SuppressWarnings("unchecked")
+ public PropertyValue<Float> getTerrainIlluminationDirection() {
+ checkValidity();
+ return (PropertyValue<Float>) new PropertyValue(nativeGetTerrainIlluminationDirection());
+ }
+
+ /**
+ * Get the TerrainIlluminationAlignment property
+ *
+ * @return property wrapper value around String
+ */
+ @SuppressWarnings("unchecked")
+ public PropertyValue<String> getTerrainIlluminationAlignment() {
+ checkValidity();
+ return (PropertyValue<String>) new PropertyValue(nativeGetTerrainIlluminationAlignment());
+ }
+
+ /**
+ * Get the TerrainExaggeration property
+ *
+ * @return property wrapper value around Float
+ */
+ @SuppressWarnings("unchecked")
+ public PropertyValue<Float> getTerrainExaggeration() {
+ checkValidity();
+ return (PropertyValue<Float>) new PropertyValue(nativeGetTerrainExaggeration());
+ }
+
+ private native Object nativeGetTerrainShadowColor();
+
+ private native Object nativeGetTerrainHighlightColor();
+
+ private native Object nativeGetTerrainAccentColor();
+
+ private native Object nativeGetTerrainIlluminationDirection();
+
+ private native Object nativeGetTerrainIlluminationAlignment();
+
+ private native Object nativeGetTerrainExaggeration();
+
+
+ @Override
+ protected native void finalize() throws Throwable;
+
+}