Skip to content

Commit d78bf94

Browse files
nakul-pymfisher87
authored andcommitted
Add support for color stops in symbollogyState in SingleBandPseudoColor layer
1 parent 3378266 commit d78bf94

File tree

3 files changed

+148
-1
lines changed

3 files changed

+148
-1
lines changed

examples/cloud_optimized_geotiff.jGIS

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,144 @@
146146
"interpolation": "linear",
147147
"mode": "equal interval",
148148
"nClasses": "15",
149-
"renderType": "Singleband Pseudocolor"
149+
"renderType": "Singleband Pseudocolor",
150+
"stops": [
151+
{
152+
"output": [
153+
0.0,
154+
0.0,
155+
0.0,
156+
1.0
157+
],
158+
"stop": 2000.0
159+
},
160+
{
161+
"output": [
162+
58.0,
163+
0.0,
164+
0.0,
165+
1.0
166+
],
167+
"stop": 3642.857142857143
168+
},
169+
{
170+
"output": [
171+
115.0,
172+
0.0,
173+
0.0,
174+
1.0
175+
],
176+
"stop": 5285.714285714286
177+
},
178+
{
179+
"output": [
180+
173.0,
181+
0.0,
182+
0.0,
183+
1.0
184+
],
185+
"stop": 6928.571428571428
186+
},
187+
{
188+
"output": [
189+
230.0,
190+
0.0,
191+
0.0,
192+
1.0
193+
],
194+
"stop": 8571.428571428572
195+
},
196+
{
197+
"output": [
198+
236.0,
199+
53.0,
200+
0.0,
201+
1.0
202+
],
203+
"stop": 10214.285714285714
204+
},
205+
{
206+
"output": [
207+
243.0,
208+
105.0,
209+
0.0,
210+
1.0
211+
],
212+
"stop": 11857.142857142857
213+
},
214+
{
215+
"output": [
216+
249.0,
217+
158.0,
218+
0.0,
219+
1.0
220+
],
221+
"stop": 13500.0
222+
},
223+
{
224+
"output": [
225+
255.0,
226+
210.0,
227+
0.0,
228+
1.0
229+
],
230+
"stop": 15142.857142857143
231+
},
232+
{
233+
"output": [
234+
255.0,
235+
218.0,
236+
43.0,
237+
1.0
238+
],
239+
"stop": 16785.714285714286
240+
},
241+
{
242+
"output": [
243+
255.0,
244+
225.0,
245+
85.0,
246+
1.0
247+
],
248+
"stop": 18428.571428571428
249+
},
250+
{
251+
"output": [
252+
255.0,
253+
233.0,
254+
128.0,
255+
1.0
256+
],
257+
"stop": 20071.428571428572
258+
},
259+
{
260+
"output": [
261+
255.0,
262+
240.0,
263+
170.0,
264+
1.0
265+
],
266+
"stop": 21714.285714285714
267+
},
268+
{
269+
"output": [
270+
255.0,
271+
248.0,
272+
213.0,
273+
1.0
274+
],
275+
"stop": 23357.14285714286
276+
},
277+
{
278+
"output": [
279+
255.0,
280+
255.0,
281+
255.0,
282+
1.0
283+
],
284+
"stop": 25000.0
285+
}
286+
]
150287
}
151288
},
152289
"type": "WebGlLayer",

packages/base/src/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ const SingleBandPseudoColor: React.FC<ISymbologyDialogProps> = ({
9898

9999
setSelectedBand(band);
100100
setSelectedFunction(interpolation);
101+
102+
if (layerParams.symbologyState?.stops) {
103+
setStopRows(layerParams.symbologyState.stops as IStopRow[]);
104+
} else {
105+
buildColorInfo();
106+
}
101107
};
102108

103109
const buildColorInfo = () => {
@@ -254,6 +260,7 @@ const SingleBandPseudoColor: React.FC<ISymbologyDialogProps> = ({
254260
colorRamp: colorRampOptionsRef.current?.selectedRamp,
255261
nClasses: colorRampOptionsRef.current?.numberOfShades,
256262
mode: colorRampOptionsRef.current?.selectedMode,
263+
stops: stopRowsRef.current,
257264
};
258265

259266
layer.parameters.symbologyState = symbologyState;

packages/schema/src/schema/project/layers/webGlLayer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
"type": "string",
8888
"default": "equal interval",
8989
"enum": ["continuous", "equal interval", "quantile"]
90+
},
91+
"stops": {
92+
"type": "array"
9093
}
9194
},
9295
"additionalProperties": false

0 commit comments

Comments
 (0)