@jupytergis/base 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/lib/annotations/components/Annotation.js +1 -1
  2. package/lib/commands/BaseCommandIDs.d.ts +1 -0
  3. package/lib/commands/BaseCommandIDs.js +2 -0
  4. package/lib/commands/index.js +31 -73
  5. package/lib/constants.js +2 -1
  6. package/lib/dialogs/ProcessingFormDialog.js +2 -2
  7. package/lib/dialogs/symbology/colorRampUtils.d.ts +20 -0
  8. package/lib/dialogs/symbology/colorRampUtils.js +132 -0
  9. package/lib/dialogs/symbology/components/color_ramp/ColorRampControls.d.ts +36 -0
  10. package/lib/dialogs/symbology/components/color_ramp/ColorRampControls.js +82 -0
  11. package/lib/dialogs/symbology/components/color_ramp/ColorRampSelector.d.ts +20 -0
  12. package/lib/dialogs/symbology/components/color_ramp/{CanvasSelectComponent.js → ColorRampSelector.js} +26 -65
  13. package/lib/dialogs/symbology/components/color_ramp/ColorRampSelectorEntry.d.ts +20 -0
  14. package/lib/dialogs/symbology/components/color_ramp/{ColorRampEntry.js → ColorRampSelectorEntry.js} +17 -3
  15. package/lib/dialogs/symbology/components/color_ramp/ModeSelectRow.d.ts +6 -5
  16. package/lib/dialogs/symbology/components/color_ramp/ModeSelectRow.js +7 -2
  17. package/lib/dialogs/symbology/components/color_ramp/cmocean.json +459 -0
  18. package/lib/dialogs/symbology/components/color_stops/StopContainer.js +1 -1
  19. package/lib/dialogs/symbology/components/color_stops/StopRow.d.ts +3 -2
  20. package/lib/dialogs/symbology/components/color_stops/StopRow.js +4 -29
  21. package/lib/dialogs/symbology/hooks/useGetProperties.js +12 -6
  22. package/lib/dialogs/symbology/symbologyDialog.d.ts +2 -2
  23. package/lib/dialogs/symbology/symbologyUtils.d.ts +2 -1
  24. package/lib/dialogs/symbology/symbologyUtils.js +10 -4
  25. package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.js +9 -5
  26. package/lib/dialogs/symbology/vector_layer/VectorRendering.js +2 -2
  27. package/lib/dialogs/symbology/vector_layer/types/Categorized.js +4 -5
  28. package/lib/dialogs/symbology/vector_layer/types/Graduated.js +16 -28
  29. package/lib/dialogs/symbology/vector_layer/types/Heatmap.js +3 -3
  30. package/lib/formbuilder/editform.js +4 -3
  31. package/lib/formbuilder/objectform/layer/heatmapLayerForm.d.ts +2 -1
  32. package/lib/formbuilder/objectform/layer/heatmapLayerForm.js +4 -0
  33. package/lib/formbuilder/objectform/layer/vectorlayerform.d.ts +2 -1
  34. package/lib/formbuilder/objectform/layer/vectorlayerform.js +4 -0
  35. package/lib/formbuilder/objectform/layer/webGlLayerForm.d.ts +2 -0
  36. package/lib/formbuilder/objectform/layer/webGlLayerForm.js +4 -0
  37. package/lib/icons.d.ts +1 -0
  38. package/lib/icons.js +5 -0
  39. package/lib/index.d.ts +0 -1
  40. package/lib/index.js +0 -1
  41. package/lib/mainview/mainView.d.ts +1 -0
  42. package/lib/mainview/mainView.js +62 -12
  43. package/lib/panelview/annotationPanel.js +1 -1
  44. package/lib/panelview/components/filter-panel/Filter.js +1 -1
  45. package/lib/panelview/components/layers.js +152 -51
  46. package/lib/panelview/components/legendItem.js +36 -1
  47. package/lib/panelview/leftpanel.d.ts +0 -1
  48. package/lib/panelview/leftpanel.js +4 -4
  49. package/lib/panelview/rightpanel.js +4 -4
  50. package/lib/processing/processingFormToParam.js +3 -0
  51. package/lib/shared/components/ToggleGroup.d.ts +2 -2
  52. package/lib/stacBrowser/hooks/useStacSearch.js +2 -2
  53. package/lib/toolbar/widget.js +19 -28
  54. package/lib/tools.d.ts +1 -0
  55. package/lib/tools.js +2 -2
  56. package/lib/types.d.ts +8 -0
  57. package/lib/types.js +8 -0
  58. package/package.json +2 -2
  59. package/style/base.css +2 -0
  60. package/style/icons/book_open.svg +1 -1
  61. package/style/icons/clock-solid.svg +1 -1
  62. package/style/icons/geolocation.svg +1 -1
  63. package/style/icons/info-solid.svg +1 -1
  64. package/style/icons/logo_mini.svg +1 -1
  65. package/style/icons/marker.svg +5 -0
  66. package/style/icons/target_without_center.svg +1 -1
  67. package/style/icons/vector_square.svg +1 -1
  68. package/style/shared/tabs.css +1 -0
  69. package/style/symbologyDialog.css +12 -4
  70. package/lib/classificationModes.d.ts +0 -13
  71. package/lib/classificationModes.js +0 -326
  72. package/lib/dialogs/symbology/components/color_ramp/CanvasSelectComponent.d.ts +0 -11
  73. package/lib/dialogs/symbology/components/color_ramp/ColorRamp.d.ts +0 -16
  74. package/lib/dialogs/symbology/components/color_ramp/ColorRamp.js +0 -32
  75. package/lib/dialogs/symbology/components/color_ramp/ColorRampEntry.d.ts +0 -9
@@ -11,7 +11,7 @@
11
11
  xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12
12
  xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
13
13
  xmlns="http://www.w3.org/2000/svg"
14
- xmlns:svg="http://www.w3.org/2000/svg">
14
+ >
15
15
  <defs
16
16
  class="jp-icon-selectable jgis-main-logo">
17
17
  <clipPath
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640">
2
+ <!--!Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
3
+ <path fill="{{COLOR}}" d="M128 252.6C128 148.4 214 64 320 64C426 64 512 148.4 512 252.6C512 371.9 391.8 514.9 341.6 569.4C329.8 582.2 310.1 582.2 298.3 569.4C248.1 514.9 127.9 371.9 127.9 252.6zM320 320C355.3 320 384 291.3 384 256C384 220.7 355.3 192 320 192C284.7 192 256 220.7 256 256C256 291.3 284.7 320 320 320z"/>
4
+
5
+ </svg>
@@ -4,7 +4,7 @@
4
4
  version="1.1"
5
5
  id="svg1"
6
6
  xmlns="http://www.w3.org/2000/svg"
7
- xmlns:svg="http://www.w3.org/2000/svg">
7
+ >
8
8
  <defs
9
9
  id="defs1" />
10
10
  <!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.-->
@@ -5,7 +5,7 @@
5
5
  version="1.1"
6
6
  id="svg1"
7
7
  xmlns="http://www.w3.org/2000/svg"
8
- xmlns:svg="http://www.w3.org/2000/svg">
8
+ >
9
9
  <defs
10
10
  id="defs1" />
11
11
  <!--!Font
@@ -21,6 +21,7 @@
21
21
  width: 100%;
22
22
  font-size: 9px;
23
23
  border-radius: 5px;
24
+ overflow-x: scroll;
24
25
  }
25
26
 
26
27
  .jgis-tabs-trigger {
@@ -158,9 +158,9 @@ select option {
158
158
  border: var(--jp-border-width) solid var(--jp-input-border-color);
159
159
  border-radius: 0;
160
160
  outline: none;
161
- appearance: none;
162
161
  -webkit-appearance: none;
163
162
  -moz-appearance: none;
163
+ appearance: none;
164
164
  }
165
165
 
166
166
  .jp-gis-open {
@@ -172,20 +172,25 @@ select option {
172
172
  align-items: center;
173
173
  font-size: var(--jp-ui-font-size2);
174
174
  color: var(--jp-ui-font-color0);
175
- appearance: none;
176
175
  text-transform: capitalize;
177
176
  cursor: pointer;
177
+ position: relative;
178
178
  -webkit-appearance: none;
179
179
  -moz-appearance: none;
180
+ appearance: none;
180
181
  }
181
182
 
182
183
  .jp-gis-color-label {
183
184
  color: white;
185
+ padding-left: 10px;
184
186
  position: absolute;
187
+ text-shadow: 0px 0px 4px black;
188
+
185
189
  transition: transform 0.3s ease;
190
+ transform-origin: left bottom;
186
191
  }
187
192
 
188
- .jp-gis-color-ramp-entry:hover .jp-gis-color-label {
193
+ .jp-gis-color-ramp-entry:not(.jp-gis-selected-entry):hover .jp-gis-color-label {
189
194
  transform: scale(1.2);
190
195
  }
191
196
 
@@ -215,8 +220,11 @@ select option {
215
220
  }
216
221
 
217
222
  #jp-gis-canvas-button.jp-gis-canvas-button {
218
- visibility: hidden;
219
223
  margin: 0;
220
224
  padding: 0 1px 0 0;
221
225
  width: 100%;
222
226
  }
227
+
228
+ .jp-gis-selected-entry {
229
+ width: 100%;
230
+ }
@@ -1,13 +0,0 @@
1
- import { InterpolationType } from './dialogs/symbology/tiff_layer/types/SingleBandPseudoColor';
2
- export declare namespace VectorClassifications {
3
- const calculateQuantileBreaks: (values: number[], nClasses: number) => number[];
4
- const calculateEqualIntervalBreaks: (values: number[], nClasses: number) => number[];
5
- const calculateJenksBreaks: (values: number[], nClasses: number) => any[];
6
- const calculatePrettyBreaks: (values: number[], nClasses: number) => number[];
7
- const calculateLogarithmicBreaks: (values: number[], nClasses: number) => number[];
8
- }
9
- export declare namespace GeoTiffClassifications {
10
- const classifyQuantileBreaks: (nClasses: number, bandNumber: number, url: string, colorRampType: string) => Promise<number[]>;
11
- const classifyContinuousBreaks: (nClasses: number, minimumValue: number, maximumValue: number, colorRampType: InterpolationType) => number[];
12
- const classifyEqualIntervalBreaks: (nClasses: number, minimumValue: number, maximumValue: number, colorRampType: InterpolationType) => number[];
13
- }
@@ -1,326 +0,0 @@
1
- // Adapted from https://github.com/qgis/QGIS/blob/master/src/core/classification/
2
- import { Pool, fromUrl } from 'geotiff';
3
- export var VectorClassifications;
4
- (function (VectorClassifications) {
5
- VectorClassifications.calculateQuantileBreaks = (values, nClasses) => {
6
- // q-th quantile of a data set:
7
- // value where q fraction of data is below and (1-q) fraction is above this value
8
- // Xq = (1 - r) * X_NI1 + r * X_NI2
9
- // NI1 = (int) (q * (n+1))
10
- // NI2 = NI1 + 1
11
- // r = q * (n+1) - (int) (q * (n+1))
12
- // (indices of X: 1...n)
13
- const sortedValues = [...values].sort((a, b) => a - b);
14
- const breaks = [];
15
- if (!sortedValues) {
16
- return [];
17
- }
18
- const n = sortedValues.length;
19
- let xq = n > 0 ? sortedValues[0] : 0;
20
- for (let i = 1; i < nClasses; i++) {
21
- if (n > 1) {
22
- const q = i / nClasses;
23
- const a = q * (n - 1);
24
- const aa = Math.floor(a);
25
- const r = a - aa;
26
- xq = (1 - r) * sortedValues[aa] + r * sortedValues[aa + 1];
27
- }
28
- breaks.push(xq);
29
- }
30
- breaks.push(sortedValues[n - 1]);
31
- return breaks;
32
- };
33
- VectorClassifications.calculateEqualIntervalBreaks = (values, nClasses) => {
34
- const minimum = Math.min(...values);
35
- const maximum = Math.max(...values);
36
- const breaks = [];
37
- const step = (maximum - minimum) / nClasses;
38
- let value = minimum;
39
- for (let i = 0; i < nClasses; i++) {
40
- value += step;
41
- breaks.push(value);
42
- }
43
- breaks[nClasses - 1] = maximum;
44
- return breaks;
45
- };
46
- VectorClassifications.calculateJenksBreaks = (values, nClasses) => {
47
- const maximum = Math.max(...values);
48
- if (values.length === 0) {
49
- return [];
50
- }
51
- if (nClasses <= 1) {
52
- return [maximum];
53
- }
54
- if (nClasses >= values.length) {
55
- return values;
56
- }
57
- const sample = [...values].sort((a, b) => a - b);
58
- const n = sample.length;
59
- const matrixOne = Array.from({ length: n + 1 }, () => Array(nClasses + 1).fill(0));
60
- const matrixTwo = Array.from({ length: n + 1 }, () => Array(nClasses + 1).fill(Number.MAX_VALUE));
61
- for (let i = 1; i <= nClasses; i++) {
62
- matrixOne[0][i] = 1;
63
- matrixOne[1][i] = 1;
64
- matrixTwo[0][i] = 0.0;
65
- for (let j = 2; j <= n; j++) {
66
- matrixTwo[j][i] = Number.MAX_VALUE;
67
- }
68
- }
69
- for (let l = 2; l <= n; l++) {
70
- let s1 = 0.0;
71
- let s2 = 0.0;
72
- let w = 0;
73
- let v = 0.0;
74
- for (let m = 1; m <= l; m++) {
75
- const i3 = l - m + 1;
76
- const val = sample[i3 - 1];
77
- s2 += val * val;
78
- s1 += val;
79
- w++;
80
- v = s2 - (s1 * s1) / w;
81
- const i4 = i3 - 1;
82
- if (i4 !== 0) {
83
- for (let j = 2; j <= nClasses; j++) {
84
- if (matrixTwo[l][j] >= v + matrixTwo[i4][j - 1]) {
85
- matrixOne[l][j] = i4;
86
- matrixTwo[l][j] = v + matrixTwo[i4][j - 1];
87
- }
88
- }
89
- }
90
- }
91
- matrixOne[l][1] = 1;
92
- matrixTwo[l][1] = v;
93
- }
94
- const breaks = Array(nClasses);
95
- breaks[nClasses - 1] = sample[n - 1];
96
- for (let j = nClasses, k = n; j >= 2; j--) {
97
- const id = matrixOne[k][j] - 1;
98
- breaks[j - 2] = sample[id];
99
- k = matrixOne[k][j] - 1;
100
- }
101
- return breaks;
102
- };
103
- VectorClassifications.calculatePrettyBreaks = (values, nClasses) => {
104
- const minimum = Math.min(...values);
105
- const maximum = Math.max(...values);
106
- const breaks = [];
107
- if (nClasses < 1) {
108
- breaks.push(maximum);
109
- return breaks;
110
- }
111
- const minimumCount = Math.floor(nClasses / 3);
112
- const shrink = 0.75;
113
- const highBias = 1.5;
114
- const adjustBias = 0.5 + 1.5 * highBias;
115
- const divisions = nClasses;
116
- const h = highBias;
117
- let cell;
118
- let small = false;
119
- const dx = maximum - minimum;
120
- let U;
121
- cell = Math.max(Math.abs(minimum), Math.abs(maximum));
122
- if (adjustBias >= 1.5 * h + 0.5) {
123
- U = 1 + 1.0 / (1 + h);
124
- }
125
- else {
126
- U = 1 + 1.5 / (1 + adjustBias);
127
- }
128
- small = dx < cell * U * Math.max(1, divisions) * 1e-7 * 3.0;
129
- if (small) {
130
- if (cell > 10) {
131
- cell = 9 + cell / 10;
132
- cell = cell * shrink;
133
- }
134
- if (minimumCount > 1) {
135
- cell = cell / minimumCount;
136
- }
137
- }
138
- else {
139
- cell = dx;
140
- if (divisions > 1) {
141
- cell = cell / divisions;
142
- }
143
- }
144
- if (cell < 20 * 1e-7) {
145
- cell = 20 * 1e-7;
146
- }
147
- const base = Math.pow(10.0, Math.floor(Math.log10(cell)));
148
- let unit = base;
149
- if (2 * base - cell < h * (cell - unit)) {
150
- unit = 2.0 * base;
151
- if (5 * base - cell < adjustBias * (cell - unit)) {
152
- unit = 5.0 * base;
153
- if (10.0 * base - cell < h * (cell - unit)) {
154
- unit = 10.0 * base;
155
- }
156
- }
157
- }
158
- let start = Math.floor(minimum / unit + 1e-7);
159
- let end = Math.ceil(maximum / unit - 1e-7);
160
- while (start * unit > minimum + 1e-7 * unit) {
161
- start = start - 1;
162
- }
163
- while (end * unit < maximum - 1e-7 * unit) {
164
- end = end + 1;
165
- }
166
- let k = Math.floor(0.5 + end - start);
167
- if (k < minimumCount) {
168
- k = minimumCount - k;
169
- if (start >= 0) {
170
- end = end + k / 2;
171
- start = start - k / 2 + (k % 2);
172
- }
173
- else {
174
- start = start - k / 2;
175
- end = end + k / 2 + (k % 2);
176
- }
177
- }
178
- const minimumBreak = start * unit;
179
- const count = end - start;
180
- for (let i = 1; i < count + 1; i++) {
181
- breaks.push(minimumBreak + i * unit);
182
- }
183
- if (breaks.length === 0) {
184
- return breaks;
185
- }
186
- if (breaks[0] < minimum) {
187
- breaks[0] = minimum;
188
- }
189
- if (breaks[breaks.length - 1] > maximum) {
190
- breaks[breaks.length - 1] = maximum;
191
- }
192
- if (minimum < 0.0 && maximum > 0.0) {
193
- const breaksMinusZero = breaks.map(b => b - 0.0);
194
- let posOfMin = 0;
195
- for (let i = 1; i < breaks.length; i++) {
196
- if (Math.abs(breaksMinusZero[i]) < Math.abs(breaksMinusZero[posOfMin])) {
197
- posOfMin = i;
198
- }
199
- }
200
- breaks[posOfMin] = 0.0; // Set the closest break to zero
201
- }
202
- return breaks;
203
- };
204
- VectorClassifications.calculateLogarithmicBreaks = (values, nClasses) => {
205
- const minimum = Math.min(...values);
206
- const maximum = Math.max(...values);
207
- let positiveMinimum = Number.MAX_VALUE;
208
- let breaks = [];
209
- positiveMinimum = minimum;
210
- const actualLogMin = Math.log10(positiveMinimum);
211
- let logMin = Math.floor(actualLogMin);
212
- const logMax = Math.ceil(Math.log10(maximum));
213
- let prettyBreaks = VectorClassifications.calculatePrettyBreaks([logMin, logMax], nClasses);
214
- while (prettyBreaks.length > 0 && prettyBreaks[0] < actualLogMin) {
215
- logMin += 1.0;
216
- prettyBreaks = VectorClassifications.calculatePrettyBreaks([logMin, logMax], nClasses);
217
- }
218
- breaks = prettyBreaks;
219
- for (let i = 0; i < breaks.length; i++) {
220
- breaks[i] = Math.pow(10, breaks[i]);
221
- }
222
- return breaks;
223
- };
224
- })(VectorClassifications || (VectorClassifications = {}));
225
- export var GeoTiffClassifications;
226
- (function (GeoTiffClassifications) {
227
- GeoTiffClassifications.classifyQuantileBreaks = async (nClasses, bandNumber, url, colorRampType) => {
228
- const breaks = [];
229
- const isDiscrete = colorRampType === 'discrete';
230
- const pool = new Pool();
231
- const tiff = await fromUrl(url);
232
- const image = await tiff.getImage();
233
- const values = await image.readRasters({ pool });
234
- // Band numbers are 1 indexed
235
- const bandValues = values[bandNumber - 1];
236
- const bandSortedValues = bandValues
237
- .filter(value => value !== 0)
238
- .sort((a, b) => a - b);
239
- pool.destroy();
240
- if (!bandSortedValues) {
241
- return [];
242
- }
243
- // Adapted from https://github.com/GeoTIFF/geoblaze/blob/master/src/histogram/histogram.core.js#L64
244
- // iterate through values and use a counter to
245
- // decide when to set up the next bin.
246
- let numValuesInCurrentBin;
247
- let valuesPerBin;
248
- let startIndex;
249
- if (isDiscrete) {
250
- valuesPerBin = bandSortedValues.length / nClasses;
251
- numValuesInCurrentBin = 0;
252
- startIndex = 0;
253
- }
254
- else {
255
- valuesPerBin = bandSortedValues.length / (nClasses - 1);
256
- breaks.push(1);
257
- numValuesInCurrentBin = 1;
258
- startIndex = 1;
259
- }
260
- for (let i = startIndex; i < bandSortedValues.length; i++) {
261
- if (numValuesInCurrentBin + 1 < valuesPerBin) {
262
- numValuesInCurrentBin++;
263
- }
264
- else {
265
- breaks.push(bandSortedValues[i]);
266
- numValuesInCurrentBin = 0;
267
- }
268
- }
269
- if (breaks.length !== nClasses) {
270
- //TODO: This should be set based on the type of bandSortedValues I think
271
- breaks.push(65535);
272
- }
273
- return breaks;
274
- };
275
- GeoTiffClassifications.classifyContinuousBreaks = (nClasses, minimumValue, maximumValue, colorRampType) => {
276
- const min = minimumValue;
277
- const max = maximumValue;
278
- if (min > max) {
279
- return [];
280
- }
281
- const isDiscrete = colorRampType === 'discrete';
282
- const breaks = [];
283
- const numberOfEntries = nClasses;
284
- if (isDiscrete) {
285
- const intervalDiff = ((max - min) * (numberOfEntries - 1)) / numberOfEntries;
286
- for (let i = 1; i < numberOfEntries; i++) {
287
- const val = i / numberOfEntries;
288
- breaks.push(min + val * intervalDiff);
289
- }
290
- breaks.push(max);
291
- }
292
- else {
293
- for (let i = 0; i <= numberOfEntries; i++) {
294
- if (i === 26) {
295
- continue;
296
- }
297
- const val = i / numberOfEntries;
298
- breaks.push(min + val * (max - min));
299
- }
300
- }
301
- return breaks;
302
- };
303
- GeoTiffClassifications.classifyEqualIntervalBreaks = (nClasses, minimumValue, maximumValue, colorRampType) => {
304
- const min = minimumValue;
305
- const max = maximumValue;
306
- if (min > max) {
307
- return [];
308
- }
309
- const isDiscrete = colorRampType === 'discrete';
310
- const breaks = [];
311
- if (isDiscrete) {
312
- const intervalDiff = (max - min) / nClasses;
313
- for (let i = 1; i < nClasses; i++) {
314
- breaks.push(min + i * intervalDiff);
315
- }
316
- breaks.push(max);
317
- }
318
- else {
319
- const intervalDiff = (max - min) / (nClasses - 1);
320
- for (let i = 0; i < nClasses; i++) {
321
- breaks.push(min + i * intervalDiff);
322
- }
323
- }
324
- return breaks;
325
- };
326
- })(GeoTiffClassifications || (GeoTiffClassifications = {}));
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- export interface IColorMap {
3
- name: string;
4
- colors: string[];
5
- }
6
- interface ICanvasSelectComponentProps {
7
- selectedRamp: string;
8
- setSelected: (item: any) => void;
9
- }
10
- declare const CanvasSelectComponent: React.FC<ICanvasSelectComponentProps>;
11
- export default CanvasSelectComponent;
@@ -1,16 +0,0 @@
1
- import { IDict } from '@jupytergis/schema';
2
- import React from 'react';
3
- interface IColorRampProps {
4
- modeOptions: string[];
5
- layerParams: IDict;
6
- classifyFunc: (selectedMode: string, numberOfShades: string, selectedRamp: string, setIsLoading: (isLoading: boolean) => void) => void;
7
- showModeRow: boolean;
8
- showRampSelector: boolean;
9
- }
10
- export type ColorRampOptions = {
11
- selectedRamp: string;
12
- numberOfShades: string;
13
- selectedMode: string;
14
- };
15
- declare const ColorRamp: React.FC<IColorRampProps>;
16
- export default ColorRamp;
@@ -1,32 +0,0 @@
1
- import { Button } from '@jupyterlab/ui-components';
2
- import React, { useEffect, useState } from 'react';
3
- import { LoadingIcon } from "../../../../shared/components/loading";
4
- import CanvasSelectComponent from './CanvasSelectComponent';
5
- import ModeSelectRow from './ModeSelectRow';
6
- const ColorRamp = ({ layerParams, modeOptions, classifyFunc, showModeRow, showRampSelector, }) => {
7
- const [selectedRamp, setSelectedRamp] = useState('');
8
- const [selectedMode, setSelectedMode] = useState('');
9
- const [numberOfShades, setNumberOfShades] = useState('');
10
- const [isLoading, setIsLoading] = useState(false);
11
- useEffect(() => {
12
- populateOptions();
13
- }, [layerParams]);
14
- const populateOptions = async () => {
15
- let nClasses, singleBandMode, colorRamp;
16
- if (layerParams.symbologyState) {
17
- nClasses = layerParams.symbologyState.nClasses;
18
- singleBandMode = layerParams.symbologyState.mode;
19
- colorRamp = layerParams.symbologyState.colorRamp;
20
- }
21
- setNumberOfShades(nClasses ? nClasses : '9');
22
- setSelectedMode(singleBandMode ? singleBandMode : 'equal interval');
23
- setSelectedRamp(colorRamp ? colorRamp : 'viridis');
24
- };
25
- return (React.createElement("div", { className: "jp-gis-color-ramp-container" },
26
- showRampSelector && (React.createElement("div", { className: "jp-gis-symbology-row" },
27
- React.createElement("label", { htmlFor: "color-ramp-select" }, "Color Ramp:"),
28
- React.createElement(CanvasSelectComponent, { selectedRamp: selectedRamp, setSelected: setSelectedRamp }))),
29
- showModeRow && (React.createElement(ModeSelectRow, { modeOptions: modeOptions, numberOfShades: numberOfShades, setNumberOfShades: setNumberOfShades, selectedMode: selectedMode, setSelectedMode: setSelectedMode })),
30
- isLoading ? (React.createElement(LoadingIcon, null)) : (React.createElement(Button, { className: "jp-Dialog-button jp-mod-accept jp-mod-styled", onClick: () => classifyFunc(selectedMode, numberOfShades, selectedRamp, setIsLoading) }, "Classify"))));
31
- };
32
- export default ColorRamp;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { IColorMap } from './CanvasSelectComponent';
3
- interface IColorRampEntryProps {
4
- index: number;
5
- colorMap: IColorMap;
6
- onClick: (item: any) => void;
7
- }
8
- declare const ColorRampEntry: React.FC<IColorRampEntryProps>;
9
- export default ColorRampEntry;