Skip to content

Commit 682e9fc

Browse files
lasselammimourner
authored andcommitted
[MAPS3D-1478] Fix layer reordering issue when draping status changes (internal-2060)
* Add render test * Reorder layers for draping
1 parent c9c97d8 commit 682e9fc

File tree

3 files changed

+204
-0
lines changed

3 files changed

+204
-0
lines changed

src/terrain/terrain.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,9 @@ export class Terrain extends Elevation {
11781178
}
11791179

11801180
_setupDrapedRenderBatches() {
1181+
// It's possible that the draping status of a layer has changed, which requires reordering of the layers
1182+
this._style.updateDrapeFirstLayers();
1183+
11811184
const layerIds = this._style.order;
11821185
const layerCount = layerIds.length;
11831186
if (layerCount === 0) {
195 KB
Loading
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
{
2+
"version": 8,
3+
"metadata": {
4+
"test": {
5+
"height": 300,
6+
"width": 512,
7+
"allowed": 0.0021,
8+
"operations": [
9+
["setZoom", 12],
10+
["wait"]
11+
]
12+
}
13+
},
14+
"center": [-113.32694547094238, 35.93455626259847],
15+
"zoom": 11,
16+
"pitch": 38,
17+
"bearing": 90,
18+
"terrain": {
19+
"source": "rgbterrain",
20+
"exaggeration": 1.0
21+
},
22+
"sprite": "local://sprites/emerald",
23+
"lights": [
24+
{
25+
"type": "ambient",
26+
"id": "test_ambient",
27+
"properties": {
28+
"color": "rgba(255, 255, 255, 1)",
29+
"intensity": 0.2
30+
}
31+
},
32+
{
33+
"type": "directional",
34+
"id": "test_directional",
35+
"properties": {
36+
"cast-shadows" : true,
37+
"color": "rgba(255, 255, 255, 1)",
38+
"intensity": 0.7
39+
}
40+
}
41+
],
42+
"sources": {
43+
"rgbterrain": {
44+
"type": "raster-dem",
45+
"tiles": [
46+
"local://tiles/{z}-{x}-{y}.terrain.png"
47+
],
48+
"maxzoom": 12,
49+
"tileSize": 256
50+
},
51+
"satellite": {
52+
"type": "raster",
53+
"tiles": [
54+
"local://tiles/{z}-{x}-{y}.satellite.png"
55+
],
56+
"maxzoom": 17,
57+
"tileSize": 256
58+
},
59+
"geojson": {
60+
"type": "geojson",
61+
"lineMetrics": true,
62+
"data": {
63+
"type": "Feature",
64+
"properties": {
65+
"elevation": [10, 400, 100]
66+
},
67+
"geometry": {
68+
"type": "MultiLineString",
69+
"coordinates": [
70+
[
71+
[
72+
-113.35094547094238,
73+
35.91855626259847
74+
],
75+
[
76+
-113.35094547094238,
77+
35.93455626259847
78+
],
79+
[
80+
-113.35094547094238,
81+
35.95055626259847
82+
]
83+
],
84+
[
85+
[
86+
-113.32894547094237,
87+
35.91855626259847
88+
],
89+
[
90+
-113.32494547094238,
91+
35.95055626259847
92+
],
93+
[
94+
-113.32094547094238,
95+
35.91855626259847
96+
]
97+
],
98+
[
99+
[
100+
-113.31294547094238,
101+
35.91855626259847
102+
],
103+
[
104+
-113.31294547094238,
105+
35.95055626259847
106+
],
107+
[
108+
-113.31294547094238,
109+
35.93455626259847
110+
]
111+
]
112+
]
113+
}
114+
}
115+
},
116+
"geojson1": {
117+
"type": "geojson",
118+
"lineMetrics": true,
119+
"data": {
120+
"type": "Feature",
121+
"properties": {
122+
"elevation": [400, 400, 400, 0, 400, 400, 400]
123+
},
124+
"geometry": {
125+
"type": "MultiLineString",
126+
"coordinates": [
127+
[
128+
[
129+
-113.33994547094238,
130+
35.91855626259847
131+
],
132+
[
133+
-113.33994547094238,
134+
35.93455626259847
135+
],
136+
[
137+
-113.33694547094238,
138+
35.95055626259847
139+
]
140+
],
141+
[
142+
[
143+
-113.30294547094238,
144+
35.91855626259847
145+
],
146+
[
147+
-113.30294547094238,
148+
35.95055626259847
149+
],
150+
[
151+
-113.30274547094238,
152+
35.91855626259847
153+
]
154+
]
155+
]
156+
}
157+
}
158+
}
159+
},
160+
"layers": [
161+
{
162+
"id": "raster",
163+
"type": "raster",
164+
"source": "satellite",
165+
"paint": {
166+
"raster-fade-duration": 0
167+
}
168+
},
169+
{
170+
"id": "line",
171+
"type": "line",
172+
"source": "geojson",
173+
"layout": {
174+
"line-join": "round",
175+
"line-z-offset": [
176+
"step",
177+
["zoom"],
178+
0,
179+
11.9,
180+
1
181+
]
182+
},
183+
"paint": {
184+
"line-width": 12,
185+
"line-color": "red"
186+
}
187+
},
188+
{
189+
"id": "line1",
190+
"type": "line",
191+
"source": "geojson1",
192+
"layout": {
193+
"line-join": "none"
194+
},
195+
"paint": {
196+
"line-width": 14,
197+
"line-pattern": "dot"
198+
}
199+
}
200+
]
201+
}

0 commit comments

Comments
 (0)