@jupytergis/base 0.1.6 → 0.2.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.
- package/lib/annotations/components/Annotation.d.ts +11 -0
- package/lib/annotations/components/Annotation.js +61 -0
- package/lib/annotations/components/AnnotationFloater.d.ts +7 -0
- package/lib/annotations/components/AnnotationFloater.js +30 -0
- package/lib/annotations/components/Message.d.ts +8 -0
- package/lib/annotations/components/Message.js +17 -0
- package/lib/annotations/index.d.ts +3 -0
- package/lib/annotations/index.js +3 -0
- package/lib/annotations/model.d.ts +28 -0
- package/lib/annotations/model.js +67 -0
- package/lib/classificationModes.d.ts +13 -0
- package/lib/classificationModes.js +326 -0
- package/lib/commands.js +52 -7
- package/lib/constants.d.ts +2 -0
- package/lib/constants.js +5 -1
- package/lib/dialogs/symbology/classificationModes.d.ts +13 -0
- package/lib/dialogs/symbology/classificationModes.js +326 -0
- package/lib/dialogs/symbology/components/color_ramp/CanvasSelectComponent.d.ts +11 -0
- package/lib/dialogs/symbology/components/color_ramp/CanvasSelectComponent.js +119 -0
- package/lib/dialogs/symbology/components/color_ramp/ColorRamp.d.ts +15 -0
- package/lib/dialogs/symbology/components/color_ramp/ColorRamp.js +33 -0
- package/lib/dialogs/symbology/components/color_ramp/ColorRampEntry.d.ts +9 -0
- package/lib/dialogs/symbology/components/color_ramp/ColorRampEntry.js +24 -0
- package/lib/dialogs/symbology/components/color_ramp/ModeSelectRow.d.ts +10 -0
- package/lib/dialogs/symbology/components/color_ramp/ModeSelectRow.js +11 -0
- package/lib/dialogs/symbology/components/color_stops/StopContainer.d.ts +9 -0
- package/lib/dialogs/symbology/components/color_stops/StopContainer.js +28 -0
- package/lib/dialogs/{components/symbology → symbology/components/color_stops}/StopRow.js +9 -2
- package/lib/dialogs/symbology/hooks/useGetProperties.d.ts +12 -0
- package/lib/dialogs/symbology/hooks/useGetProperties.js +47 -0
- package/lib/dialogs/{symbologyDialog.js → symbology/symbologyDialog.js} +3 -3
- package/lib/dialogs/symbology/symbologyUtils.d.ts +9 -0
- package/lib/dialogs/symbology/symbologyUtils.js +94 -0
- package/lib/dialogs/symbology/tiff_layer/TiffRendering.d.ts +4 -0
- package/lib/dialogs/{components/symbology/BandRendering.js → symbology/tiff_layer/TiffRendering.js} +3 -3
- package/lib/dialogs/{components/symbology → symbology/tiff_layer/components}/BandRow.d.ts +1 -1
- package/lib/dialogs/{components/symbology → symbology/tiff_layer/types}/SingleBandPseudoColor.d.ts +9 -1
- package/lib/dialogs/{components/symbology → symbology/tiff_layer/types}/SingleBandPseudoColor.js +131 -83
- package/lib/dialogs/{components/symbology → symbology/vector_layer}/VectorRendering.d.ts +1 -1
- package/lib/dialogs/{components/symbology → symbology/vector_layer}/VectorRendering.js +10 -13
- package/lib/dialogs/symbology/vector_layer/components/ValueSelect.d.ts +8 -0
- package/lib/dialogs/symbology/vector_layer/components/ValueSelect.js +7 -0
- package/lib/dialogs/symbology/vector_layer/types/Categorized.d.ts +4 -0
- package/lib/dialogs/symbology/vector_layer/types/Categorized.js +94 -0
- package/lib/dialogs/symbology/vector_layer/types/Graduated.js +169 -0
- package/lib/dialogs/{components/symbology → symbology/vector_layer/types}/SimpleSymbol.js +8 -13
- package/lib/formbuilder/formselectors.js +4 -0
- package/lib/formbuilder/objectform/baseform.d.ts +1 -1
- package/lib/formbuilder/objectform/baseform.js +31 -42
- package/lib/formbuilder/objectform/geojsonsource.js +33 -30
- package/lib/formbuilder/objectform/geotiffsource.d.ts +16 -0
- package/lib/formbuilder/objectform/geotiffsource.js +71 -0
- package/lib/formbuilder/objectform/vectorlayerform.js +1 -0
- package/lib/formbuilder/objectform/webGlLayerForm.js +1 -0
- package/lib/index.d.ts +7 -4
- package/lib/index.js +7 -4
- package/lib/mainview/CollaboratorPointers.d.ts +17 -0
- package/lib/mainview/CollaboratorPointers.js +37 -0
- package/lib/mainview/FollowIndicator.d.ts +7 -0
- package/lib/mainview/FollowIndicator.js +9 -0
- package/lib/mainview/mainView.d.ts +39 -3
- package/lib/mainview/mainView.js +451 -41
- package/lib/mainview/mainviewmodel.d.ts +2 -1
- package/lib/mainview/mainviewmodel.js +5 -0
- package/lib/panelview/annotationPanel.d.ts +27 -0
- package/lib/panelview/annotationPanel.js +45 -0
- package/lib/panelview/components/filter-panel/Filter.d.ts +7 -2
- package/lib/panelview/components/filter-panel/Filter.js +1 -1
- package/lib/panelview/components/filter-panel/FilterRow.js +3 -3
- package/lib/panelview/components/identify-panel/IdentifyPanel.d.ts +15 -0
- package/lib/panelview/components/identify-panel/IdentifyPanel.js +108 -0
- package/lib/panelview/components/layers.js +4 -4
- package/lib/panelview/leftpanel.js +8 -0
- package/lib/panelview/rightpanel.d.ts +4 -1
- package/lib/panelview/rightpanel.js +28 -7
- package/lib/store.d.ts +9 -0
- package/lib/store.js +25 -0
- package/lib/toolbar/widget.js +12 -2
- package/lib/tools.d.ts +35 -0
- package/lib/tools.js +86 -0
- package/lib/types.d.ts +14 -0
- package/package.json +18 -20
- package/style/base.css +4 -8
- package/style/dialog.css +1 -1
- package/style/icons/logo_mini.svg +70 -148
- package/style/icons/nonvisibility.svg +2 -7
- package/style/icons/visibility.svg +2 -6
- package/style/leftPanel.css +5 -0
- package/style/symbologyDialog.css +104 -3
- package/lib/dialogs/components/symbology/BandRendering.d.ts +0 -4
- package/lib/dialogs/components/symbology/Graduated.js +0 -188
- /package/lib/dialogs/{components/symbology → symbology/components/color_stops}/StopRow.d.ts +0 -0
- /package/lib/dialogs/{symbologyDialog.d.ts → symbology/symbologyDialog.d.ts} +0 -0
- /package/lib/dialogs/{components/symbology → symbology/tiff_layer/components}/BandRow.js +0 -0
- /package/lib/dialogs/{components/symbology → symbology/vector_layer/types}/Graduated.d.ts +0 -0
- /package/lib/dialogs/{components/symbology → symbology/vector_layer/types}/SimpleSymbol.d.ts +0 -0
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { Button } from '@jupyterlab/ui-components';
|
|
2
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import StopRow from './StopRow';
|
|
4
|
-
const Graduated = ({ context, state, okSignalPromise, cancel, layerId }) => {
|
|
5
|
-
const selectedValueRef = useRef();
|
|
6
|
-
const selectedMethodRef = useRef();
|
|
7
|
-
const stopRowsRef = useRef();
|
|
8
|
-
const layerStateRef = useRef();
|
|
9
|
-
const [selectedValue, setSelectedValue] = useState('');
|
|
10
|
-
const [featureProperties, setFeatureProperties] = useState({});
|
|
11
|
-
const [selectedMethod, setSelectedMethod] = useState('color');
|
|
12
|
-
const [stopRows, setStopRows] = useState([]);
|
|
13
|
-
const [methodOptions, setMethodOptions] = useState(['color']);
|
|
14
|
-
const [layerState, setLayerState] = useState();
|
|
15
|
-
if (!layerId) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const layer = context.model.getLayer(layerId);
|
|
19
|
-
if (!(layer === null || layer === void 0 ? void 0 : layer.parameters)) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
const getProperties = async () => {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
if (!layerId) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const model = context.model;
|
|
29
|
-
const layer = model.getLayer(layerId);
|
|
30
|
-
const source = model.getSource((_a = layer === null || layer === void 0 ? void 0 : layer.parameters) === null || _a === void 0 ? void 0 : _a.source);
|
|
31
|
-
if (!source) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const data = await model.readGeoJSON((_b = source.parameters) === null || _b === void 0 ? void 0 : _b.path);
|
|
35
|
-
const featureProps = {};
|
|
36
|
-
data === null || data === void 0 ? void 0 : data.features.forEach((feature) => {
|
|
37
|
-
feature.properties &&
|
|
38
|
-
Object.entries(feature.properties).forEach(([key, value]) => {
|
|
39
|
-
if (!(key in featureProps)) {
|
|
40
|
-
featureProps[key] = new Set();
|
|
41
|
-
}
|
|
42
|
-
featureProps[key].add(value);
|
|
43
|
-
});
|
|
44
|
-
setFeatureProperties(featureProps);
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
getProperties();
|
|
48
|
-
buildColorInfo();
|
|
49
|
-
okSignalPromise.promise.then(okSignal => {
|
|
50
|
-
okSignal.connect(handleOk, this);
|
|
51
|
-
});
|
|
52
|
-
return () => {
|
|
53
|
-
okSignalPromise.promise.then(okSignal => {
|
|
54
|
-
okSignal.disconnect(handleOk, this);
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
}, []);
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
selectedValueRef.current = selectedValue;
|
|
60
|
-
selectedMethodRef.current = selectedMethod;
|
|
61
|
-
stopRowsRef.current = stopRows;
|
|
62
|
-
layerStateRef.current = layerState;
|
|
63
|
-
}, [selectedValue, selectedMethod, stopRows, layerState]);
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
populateOptions();
|
|
66
|
-
}, [featureProperties]);
|
|
67
|
-
const buildColorInfo = () => {
|
|
68
|
-
var _a;
|
|
69
|
-
// This it to parse a color object on the layer
|
|
70
|
-
if (!((_a = layer.parameters) === null || _a === void 0 ? void 0 : _a.color)) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const color = layer.parameters.color;
|
|
74
|
-
// If color is a string we don't need to parse
|
|
75
|
-
if (typeof color === 'string') {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const prefix = layer.parameters.type === 'circle' ? 'circle-' : '';
|
|
79
|
-
if (!color[`${prefix}fill-color`]) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const valueColorPairs = [];
|
|
83
|
-
// So if it's not a string then it's an array and we parse
|
|
84
|
-
// Color[0] is the operator used for the color expression
|
|
85
|
-
switch (color[`${prefix}fill-color`][0]) {
|
|
86
|
-
case 'interpolate': {
|
|
87
|
-
// First element is interpolate for linear selection
|
|
88
|
-
// Second element is type of interpolation (ie linear)
|
|
89
|
-
// Third is input value that stop values are compared with
|
|
90
|
-
// Fourth and on is value:color pairs
|
|
91
|
-
for (let i = 3; i < color[`${prefix}fill-color`].length; i += 2) {
|
|
92
|
-
const obj = {
|
|
93
|
-
stop: color[`${prefix}fill-color`][i],
|
|
94
|
-
output: color[`${prefix}fill-color`][i + 1]
|
|
95
|
-
};
|
|
96
|
-
valueColorPairs.push(obj);
|
|
97
|
-
}
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
setStopRows(valueColorPairs);
|
|
102
|
-
};
|
|
103
|
-
const populateOptions = async () => {
|
|
104
|
-
var _a;
|
|
105
|
-
// Set up method options
|
|
106
|
-
if (((_a = layer === null || layer === void 0 ? void 0 : layer.parameters) === null || _a === void 0 ? void 0 : _a.type) === 'circle') {
|
|
107
|
-
const options = ['color', 'radius'];
|
|
108
|
-
setMethodOptions(options);
|
|
109
|
-
}
|
|
110
|
-
const layerState = await state.fetch(`jupytergis:${layerId}`);
|
|
111
|
-
let value, method;
|
|
112
|
-
if (layerState) {
|
|
113
|
-
value = layerState
|
|
114
|
-
.graduatedValue;
|
|
115
|
-
method = layerState
|
|
116
|
-
.graduatedMethod;
|
|
117
|
-
}
|
|
118
|
-
setLayerState(layerState);
|
|
119
|
-
setSelectedValue(value ? value : Object.keys(featureProperties)[0]);
|
|
120
|
-
setSelectedMethod(method ? method : 'color');
|
|
121
|
-
};
|
|
122
|
-
const handleOk = () => {
|
|
123
|
-
var _a;
|
|
124
|
-
if (!layer.parameters) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
state.save(`jupytergis:${layerId}`, Object.assign(Object.assign({}, layerStateRef.current), { renderType: 'Graduated', graduatedValue: selectedValueRef.current, graduatedMethod: selectedMethodRef.current }));
|
|
128
|
-
const colorExpr = [];
|
|
129
|
-
colorExpr.push('interpolate');
|
|
130
|
-
colorExpr.push(['linear']);
|
|
131
|
-
colorExpr.push(['get', selectedValueRef.current]);
|
|
132
|
-
(_a = stopRowsRef.current) === null || _a === void 0 ? void 0 : _a.map(stop => {
|
|
133
|
-
colorExpr.push(stop.stop);
|
|
134
|
-
colorExpr.push(stop.output);
|
|
135
|
-
});
|
|
136
|
-
const newStyle = Object.assign({}, layer.parameters.color);
|
|
137
|
-
if (selectedMethodRef.current === 'color') {
|
|
138
|
-
if (layer.parameters.type === 'fill') {
|
|
139
|
-
newStyle['fill-color'] = colorExpr;
|
|
140
|
-
}
|
|
141
|
-
if (layer.parameters.type === 'line') {
|
|
142
|
-
newStyle['stroke-color'] = colorExpr;
|
|
143
|
-
}
|
|
144
|
-
if (layer.parameters.type === 'circle') {
|
|
145
|
-
newStyle['circle-fill-color'] = colorExpr;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (selectedMethodRef.current === 'radius') {
|
|
149
|
-
if (layer.parameters.type === 'circle') {
|
|
150
|
-
newStyle['circle-radius'] = colorExpr;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
layer.parameters.color = newStyle;
|
|
154
|
-
context.model.sharedModel.updateLayer(layerId, layer);
|
|
155
|
-
cancel();
|
|
156
|
-
};
|
|
157
|
-
const addStopRow = () => {
|
|
158
|
-
setStopRows([
|
|
159
|
-
{
|
|
160
|
-
stop: 0,
|
|
161
|
-
output: [0, 0, 0, 1]
|
|
162
|
-
},
|
|
163
|
-
...stopRows
|
|
164
|
-
]);
|
|
165
|
-
};
|
|
166
|
-
const deleteStopRow = (index) => {
|
|
167
|
-
const newFilters = [...stopRows];
|
|
168
|
-
newFilters.splice(index, 1);
|
|
169
|
-
setStopRows(newFilters);
|
|
170
|
-
};
|
|
171
|
-
return (React.createElement("div", { className: "jp-gis-layer-symbology-container" },
|
|
172
|
-
React.createElement("div", { className: "jp-gis-symbology-row" },
|
|
173
|
-
React.createElement("label", { htmlFor: 'vector-value-select' }, "Value:"),
|
|
174
|
-
React.createElement("div", { className: "jp-select-wrapper" },
|
|
175
|
-
React.createElement("select", { name: 'vector-value-select', onChange: event => setSelectedValue(event.target.value), className: "jp-mod-styled" }, Object.keys(featureProperties).map((feature, index) => (React.createElement("option", { key: index, value: feature, selected: feature === selectedValue, className: "jp-mod-styled" }, feature)))))),
|
|
176
|
-
React.createElement("div", { className: "jp-gis-symbology-row" },
|
|
177
|
-
React.createElement("label", { htmlFor: 'vector-method-select' }, "Method:"),
|
|
178
|
-
React.createElement("div", { className: "jp-select-wrapper" },
|
|
179
|
-
React.createElement("select", { name: 'vector-method-select', onChange: event => setSelectedMethod(event.target.value), className: "jp-mod-styled" }, methodOptions.map((method, index) => (React.createElement("option", { key: index, value: method, selected: method === selectedMethod, className: "jp-mod-styled" }, method)))))),
|
|
180
|
-
React.createElement("div", { className: "jp-gis-stop-container" },
|
|
181
|
-
React.createElement("div", { className: "jp-gis-stop-labels", style: { display: 'flex', gap: 6 } },
|
|
182
|
-
React.createElement("span", { style: { flex: '0 0 18%' } }, "Value"),
|
|
183
|
-
React.createElement("span", null, "Output Value")),
|
|
184
|
-
stopRows.map((stop, index) => (React.createElement(StopRow, { key: `${index}-${stop.output}`, index: index, value: stop.stop, outputValue: stop.output, stopRows: stopRows, setStopRows: setStopRows, deleteRow: () => deleteStopRow(index), useNumber: selectedMethod === 'radius' ? true : false })))),
|
|
185
|
-
React.createElement("div", { className: "jp-gis-symbology-button-container" },
|
|
186
|
-
React.createElement(Button, { className: "jp-Dialog-button jp-mod-accept jp-mod-styled", onClick: addStopRow }, "Add Stop"))));
|
|
187
|
-
};
|
|
188
|
-
export default Graduated;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/lib/dialogs/{components/symbology → symbology/vector_layer/types}/SimpleSymbol.d.ts
RENAMED
|
File without changes
|