Skip to content

Commit fcaad81

Browse files
lasselammiactions-user
authored andcommitted
[MAPS3D-2179] Add new line-elevation-ground-scale property to scale elevated lines with terrain exaggeration (#9440)
Closes https://mapbox.atlassian.net/browse/MAPS3D-2179 This PR adds a new layout property `line-elevation-ground-scale`, which allows scaling line elevation data with terrain exaggeration for lines that use `line-elevation-reference: "sea"`. Previously such lines were always rendered at the exact elevation provided by the source data while ignoring the terrain exaggeration value. This worked correctly as long as terrain exaggeration was `1`. Disabling terrain by transitioning terrain elevation to `0` would cause the elevated line to lose any connection it had with the ground. Here's an example: https://github.com/user-attachments/assets/a1b7e691-d850-491c-81e0-a7473810b765 With the new property it's possible to scale elevation values with terrain exaggeration, either for the entire length of the line or for parts of it only. For flight paths good results can be had by interpolating at the start and end of the line. Here is an example of using the property to keep the start and end of the flight path connected with the ground: ``` "line-elevation-ground-scale": [ "interpolate", [ "linear" ], [ "line-progress" ], 0, 1, 0.1, 0, 0.9, 0, 1, 1 ] ``` https://github.com/user-attachments/assets/92485a5c-b974-45e3-b0bb-67f1c38df68f ``` <public> Add `line-elevation-ground-scale` property to scale elevated lines with terrain exaggeration (#9440) </public> ``` cc @mapbox/gl-js cc @mapbox/gl-native cc @mapbox/maps-ios cc @mapbox/maps-android cc @mapbox/sdk-platform --------- Co-authored-by: Changelog autocreator bot <actions@github.com> GitOrigin-RevId: 5513c0747c841d28a588be8c8441d9fa0339f1fd
1 parent a7b0c54 commit fcaad81

18 files changed

Lines changed: 657 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Mapbox welcomes participation and contributions from everyone.
1111
* Introduce new `AnnotationConfig#slotName` property to allow to specify a slot to position annotation layer.
1212
* Introduce experimental `queryRenderedRasterValues` API for querying the rendered raster values on the map at a specific screen coordinate.
1313
* Introduce `StyleAttributionsChanged` event for detecting map attributions changes
14+
* Introduce new `LineLayer.lineElevationGroundScale` property to scale elevated lines with terrain exaggeration.
1415

1516
## Bug fixes 🐞
1617
* Fix rare scenario where map render surface size was wrong.

app/src/androidTest/java/com/mapbox/maps/testapp/annotation/generated/PolylineAnnotationManagerAndroidTest.kt

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extension-compose/api/Release/metalava.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,7 @@ package com.mapbox.maps.extension.compose.annotation.generated {
976976
method public Double? getLineCutoutOpacity();
977977
method public java.util.List<java.lang.Double>? getLineDasharray();
978978
method public Double? getLineDepthOcclusionFactor();
979+
method public Double? getLineElevationGroundScale();
979980
method public com.mapbox.maps.extension.style.layers.properties.generated.LineElevationReference? getLineElevationReference();
980981
method public Double? getLineEmissiveStrength();
981982
method public Double? getLineGapWidth();
@@ -1013,6 +1014,7 @@ package com.mapbox.maps.extension.compose.annotation.generated {
10131014
method public void setLineCutoutOpacity(Double?);
10141015
method public void setLineDasharray(java.util.List<java.lang.Double>?);
10151016
method public void setLineDepthOcclusionFactor(Double?);
1017+
method public void setLineElevationGroundScale(Double?);
10161018
method public void setLineElevationReference(com.mapbox.maps.extension.style.layers.properties.generated.LineElevationReference?);
10171019
method public void setLineEmissiveStrength(Double?);
10181020
method public void setLineGapWidth(Double?);
@@ -1050,6 +1052,7 @@ package com.mapbox.maps.extension.compose.annotation.generated {
10501052
property public final Double? lineCutoutOpacity;
10511053
property public final java.util.List<java.lang.Double>? lineDasharray;
10521054
property public final Double? lineDepthOcclusionFactor;
1055+
property public final Double? lineElevationGroundScale;
10531056
property public final com.mapbox.maps.extension.style.layers.properties.generated.LineElevationReference? lineElevationReference;
10541057
property public final Double? lineEmissiveStrength;
10551058
property public final Double? lineGapWidth;
@@ -1117,6 +1120,7 @@ package com.mapbox.maps.extension.compose.annotation.generated {
11171120
method public Double? getLineBorderWidth();
11181121
method public androidx.compose.ui.graphics.Color? getLineColor();
11191122
method public String? getLineColorUseTheme();
1123+
method public Double? getLineElevationGroundScale();
11201124
method public Double? getLineEmissiveStrength();
11211125
method public Double? getLineGapWidth();
11221126
method public com.mapbox.maps.extension.style.layers.properties.generated.LineJoin? getLineJoin();
@@ -1132,6 +1136,7 @@ package com.mapbox.maps.extension.compose.annotation.generated {
11321136
method public void setLineBorderWidth(Double?);
11331137
method public void setLineColor(androidx.compose.ui.graphics.Color?);
11341138
method public void setLineColorUseTheme(String?);
1139+
method public void setLineElevationGroundScale(Double?);
11351140
method public void setLineEmissiveStrength(Double?);
11361141
method public void setLineGapWidth(Double?);
11371142
method public void setLineJoin(com.mapbox.maps.extension.style.layers.properties.generated.LineJoin?);
@@ -1147,6 +1152,7 @@ package com.mapbox.maps.extension.compose.annotation.generated {
11471152
property public final Double? lineBorderWidth;
11481153
property public final androidx.compose.ui.graphics.Color? lineColor;
11491154
property public final String? lineColorUseTheme;
1155+
property public final Double? lineElevationGroundScale;
11501156
property public final Double? lineEmissiveStrength;
11511157
property public final Double? lineGapWidth;
11521158
property public final com.mapbox.maps.extension.style.layers.properties.generated.LineJoin? lineJoin;
@@ -2905,6 +2911,8 @@ package com.mapbox.maps.extension.compose.style.layers.generated {
29052911
method public com.mapbox.maps.extension.compose.style.DoubleListValue getLineDasharray();
29062912
method public com.mapbox.maps.extension.compose.style.DoubleValue getLineDepthOcclusionFactor();
29072913
method public com.mapbox.maps.extension.compose.style.Transition getLineDepthOcclusionFactorTransition();
2914+
method public com.mapbox.maps.extension.compose.style.DoubleValue getLineElevationGroundScale();
2915+
method public com.mapbox.maps.extension.compose.style.Transition getLineElevationGroundScaleTransition();
29082916
method public com.mapbox.maps.extension.compose.style.layers.generated.LineElevationReferenceValue getLineElevationReference();
29092917
method public com.mapbox.maps.extension.compose.style.DoubleValue getLineEmissiveStrength();
29102918
method public com.mapbox.maps.extension.compose.style.Transition getLineEmissiveStrengthTransition();
@@ -2961,6 +2969,8 @@ package com.mapbox.maps.extension.compose.style.layers.generated {
29612969
method public void setLineDasharray(com.mapbox.maps.extension.compose.style.DoubleListValue);
29622970
method public void setLineDepthOcclusionFactor(com.mapbox.maps.extension.compose.style.DoubleValue);
29632971
method public void setLineDepthOcclusionFactorTransition(com.mapbox.maps.extension.compose.style.Transition);
2972+
method public void setLineElevationGroundScale(com.mapbox.maps.extension.compose.style.DoubleValue);
2973+
method public void setLineElevationGroundScaleTransition(com.mapbox.maps.extension.compose.style.Transition);
29642974
method public void setLineElevationReference(com.mapbox.maps.extension.compose.style.layers.generated.LineElevationReferenceValue);
29652975
method public void setLineEmissiveStrength(com.mapbox.maps.extension.compose.style.DoubleValue);
29662976
method public void setLineEmissiveStrengthTransition(com.mapbox.maps.extension.compose.style.Transition);
@@ -3017,6 +3027,8 @@ package com.mapbox.maps.extension.compose.style.layers.generated {
30173027
property public final com.mapbox.maps.extension.compose.style.DoubleListValue lineDasharray;
30183028
property public final com.mapbox.maps.extension.compose.style.DoubleValue lineDepthOcclusionFactor;
30193029
property public final com.mapbox.maps.extension.compose.style.Transition lineDepthOcclusionFactorTransition;
3030+
property public final com.mapbox.maps.extension.compose.style.DoubleValue lineElevationGroundScale;
3031+
property public final com.mapbox.maps.extension.compose.style.Transition lineElevationGroundScaleTransition;
30203032
property public final com.mapbox.maps.extension.compose.style.layers.generated.LineElevationReferenceValue lineElevationReference;
30213033
property public final com.mapbox.maps.extension.compose.style.DoubleValue lineEmissiveStrength;
30223034
property public final com.mapbox.maps.extension.compose.style.Transition lineEmissiveStrengthTransition;

extension-compose/api/extension-compose.api

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ public final class com/mapbox/maps/extension/compose/annotation/generated/Polyli
781781
public final fun getLineCutoutOpacity ()Ljava/lang/Double;
782782
public final fun getLineDasharray ()Ljava/util/List;
783783
public final fun getLineDepthOcclusionFactor ()Ljava/lang/Double;
784+
public final fun getLineElevationGroundScale ()Ljava/lang/Double;
784785
public final fun getLineElevationReference ()Lcom/mapbox/maps/extension/style/layers/properties/generated/LineElevationReference;
785786
public final fun getLineEmissiveStrength ()Ljava/lang/Double;
786787
public final fun getLineGapWidth ()Ljava/lang/Double;
@@ -818,6 +819,7 @@ public final class com/mapbox/maps/extension/compose/annotation/generated/Polyli
818819
public final fun setLineCutoutOpacity (Ljava/lang/Double;)V
819820
public final fun setLineDasharray (Ljava/util/List;)V
820821
public final fun setLineDepthOcclusionFactor (Ljava/lang/Double;)V
822+
public final fun setLineElevationGroundScale (Ljava/lang/Double;)V
821823
public final fun setLineElevationReference (Lcom/mapbox/maps/extension/style/layers/properties/generated/LineElevationReference;)V
822824
public final fun setLineEmissiveStrength (Ljava/lang/Double;)V
823825
public final fun setLineGapWidth (Ljava/lang/Double;)V
@@ -880,6 +882,7 @@ public final class com/mapbox/maps/extension/compose/annotation/generated/Polyli
880882
public final fun getLineBorderWidth ()Ljava/lang/Double;
881883
public final fun getLineColor-QN2ZGVo ()Landroidx/compose/ui/graphics/Color;
882884
public final fun getLineColorUseTheme ()Ljava/lang/String;
885+
public final fun getLineElevationGroundScale ()Ljava/lang/Double;
883886
public final fun getLineEmissiveStrength ()Ljava/lang/Double;
884887
public final fun getLineGapWidth ()Ljava/lang/Double;
885888
public final fun getLineJoin ()Lcom/mapbox/maps/extension/style/layers/properties/generated/LineJoin;
@@ -895,6 +898,7 @@ public final class com/mapbox/maps/extension/compose/annotation/generated/Polyli
895898
public final fun setLineBorderWidth (Ljava/lang/Double;)V
896899
public final fun setLineColor-Y2TPw74 (Landroidx/compose/ui/graphics/Color;)V
897900
public final fun setLineColorUseTheme (Ljava/lang/String;)V
901+
public final fun setLineElevationGroundScale (Ljava/lang/Double;)V
898902
public final fun setLineEmissiveStrength (Ljava/lang/Double;)V
899903
public final fun setLineGapWidth (Ljava/lang/Double;)V
900904
public final fun setLineJoin (Lcom/mapbox/maps/extension/style/layers/properties/generated/LineJoin;)V
@@ -2460,6 +2464,8 @@ public final class com/mapbox/maps/extension/compose/style/layers/generated/Line
24602464
public final fun getLineDasharray ()Lcom/mapbox/maps/extension/compose/style/DoubleListValue;
24612465
public final fun getLineDepthOcclusionFactor ()Lcom/mapbox/maps/extension/compose/style/DoubleValue;
24622466
public final fun getLineDepthOcclusionFactorTransition ()Lcom/mapbox/maps/extension/compose/style/Transition;
2467+
public final fun getLineElevationGroundScale ()Lcom/mapbox/maps/extension/compose/style/DoubleValue;
2468+
public final fun getLineElevationGroundScaleTransition ()Lcom/mapbox/maps/extension/compose/style/Transition;
24632469
public final fun getLineElevationReference ()Lcom/mapbox/maps/extension/compose/style/layers/generated/LineElevationReferenceValue;
24642470
public final fun getLineEmissiveStrength ()Lcom/mapbox/maps/extension/compose/style/DoubleValue;
24652471
public final fun getLineEmissiveStrengthTransition ()Lcom/mapbox/maps/extension/compose/style/Transition;
@@ -2516,6 +2522,8 @@ public final class com/mapbox/maps/extension/compose/style/layers/generated/Line
25162522
public final fun setLineDasharray (Lcom/mapbox/maps/extension/compose/style/DoubleListValue;)V
25172523
public final fun setLineDepthOcclusionFactor (Lcom/mapbox/maps/extension/compose/style/DoubleValue;)V
25182524
public final fun setLineDepthOcclusionFactorTransition (Lcom/mapbox/maps/extension/compose/style/Transition;)V
2525+
public final fun setLineElevationGroundScale (Lcom/mapbox/maps/extension/compose/style/DoubleValue;)V
2526+
public final fun setLineElevationGroundScaleTransition (Lcom/mapbox/maps/extension/compose/style/Transition;)V
25192527
public final fun setLineElevationReference (Lcom/mapbox/maps/extension/compose/style/layers/generated/LineElevationReferenceValue;)V
25202528
public final fun setLineEmissiveStrength (Lcom/mapbox/maps/extension/compose/style/DoubleValue;)V
25212529
public final fun setLineEmissiveStrengthTransition (Lcom/mapbox/maps/extension/compose/style/Transition;)V

extension-compose/src/main/java/com/mapbox/maps/extension/compose/annotation/generated/PolylineAnnotationGroupState.kt

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extension-compose/src/main/java/com/mapbox/maps/extension/compose/annotation/generated/PolylineAnnotationState.kt

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extension-compose/src/main/java/com/mapbox/maps/extension/compose/style/layers/generated/LineLayerState.kt

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)