[android] - add line-gradient example, integrate lineProgress expression

This commit is contained in:
tobrun
2018-08-13 11:40:54 +02:00
committed by Mikhail Pozdnyakov
parent fb5afd34b9
commit fc26f2a6ca
8 changed files with 216 additions and 1 deletions

View File

@@ -1461,6 +1461,32 @@ public class Expression {
return new Expression("heatmap-density");
}
/**
* Gets the progress along a gradient line. Can only be used in the line-gradient property.
* <p>
* Example usage:
* </p>
* <pre>
* {@code
* LineLayer layer = new LineLayer("layer-id", "source-id");
* layer.setProperties(
* lineGradient(interpolate(
* linear(), lineProgress(),
* stop(0f, rgb(0, 0, 255)),
* stop(0.5f, rgb(0, 255, 0)),
* stop(1f, rgb(255, 0, 0)))
* )
* )
* }
* </pre>
*
* @return expression
* @see <a href="https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-line-progress">Style specification</a>
*/
public static Expression lineProgress() {
return new Expression("line-progress");
}
/**
* Retrieves an item from an array.
*

View File

@@ -44,6 +44,17 @@ public class GeoJsonOptions extends HashMap<String, Object> {
return this;
}
/**
* Initialises whether to calculate line distance metrics.
*
* @param lineMetrics true to calculate line distance metrics.
* @return the current instance for chaining
*/
public GeoJsonOptions withLineMetrics(boolean lineMetrics) {
this.put("lineMetrics", lineMetrics);
return this;
}
/**
* Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance).
*
@@ -88,5 +99,4 @@ public class GeoJsonOptions extends HashMap<String, Object> {
this.put("clusterRadius", clusterRadius);
return this;
}
}