@jupytergis/base 0.1.6 → 0.1.7
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/classificationModes.d.ts +13 -0
- package/lib/classificationModes.js +326 -0
- package/lib/commands.js +1 -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 +113 -57
- 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/objectform/vectorlayerform.js +1 -0
- package/lib/formbuilder/objectform/webGlLayerForm.js +1 -0
- package/lib/index.d.ts +6 -4
- package/lib/index.js +6 -4
- package/lib/mainview/mainView.d.ts +3 -1
- package/lib/mainview/mainView.js +66 -18
- package/lib/store.d.ts +9 -0
- package/lib/store.js +25 -0
- package/lib/toolbar/widget.js +1 -1
- package/lib/types.d.ts +14 -0
- package/package.json +16 -17
- 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,9 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { parseColor } from '
|
|
2
|
+
import { parseColor } from '../../../../tools';
|
|
3
3
|
const SimpleSymbol = ({ context, state, okSignalPromise, cancel, layerId }) => {
|
|
4
4
|
const styleRef = useRef();
|
|
5
|
-
const layerStateRef = useRef();
|
|
6
|
-
const [layerState, setLayerState] = useState();
|
|
7
5
|
const [useCircleStuff, setUseCircleStuff] = useState(false);
|
|
8
6
|
const [style, setStyle] = useState({
|
|
9
7
|
fillColor: '#3399CC',
|
|
@@ -31,16 +29,11 @@ const SimpleSymbol = ({ context, state, okSignalPromise, cancel, layerId }) => {
|
|
|
31
29
|
// Read values from file if we chose them using the single symbol thing
|
|
32
30
|
// but if we're switching to simple symbol, use defaults
|
|
33
31
|
const initStyle = async () => {
|
|
32
|
+
var _a;
|
|
34
33
|
if (!layer.parameters) {
|
|
35
34
|
return;
|
|
36
35
|
}
|
|
37
|
-
const
|
|
38
|
-
if (!layerState) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
setLayerState(layerState);
|
|
42
|
-
const renderType = layerState
|
|
43
|
-
.renderType;
|
|
36
|
+
const renderType = (_a = layer.parameters) === null || _a === void 0 ? void 0 : _a.symbologyState.renderType;
|
|
44
37
|
if (renderType === 'Single Symbol') {
|
|
45
38
|
// Read from current color or use defaults
|
|
46
39
|
const parsedStyle = parseColor(layer.parameters.type, layer.parameters.color);
|
|
@@ -61,14 +54,12 @@ const SimpleSymbol = ({ context, state, okSignalPromise, cancel, layerId }) => {
|
|
|
61
54
|
}, []);
|
|
62
55
|
useEffect(() => {
|
|
63
56
|
styleRef.current = style;
|
|
64
|
-
|
|
65
|
-
}, [style, layerState]);
|
|
57
|
+
}, [style]);
|
|
66
58
|
const handleOk = () => {
|
|
67
59
|
var _a, _b, _c, _d, _e, _f;
|
|
68
60
|
if (!layer.parameters) {
|
|
69
61
|
return;
|
|
70
62
|
}
|
|
71
|
-
state.save(`jupytergis:${layerId}`, Object.assign(Object.assign({}, layerStateRef.current), { renderType: 'Single Symbol' }));
|
|
72
63
|
const styleExpr = {};
|
|
73
64
|
const prefix = layer.parameters.type === 'circle' ? 'circle-' : '';
|
|
74
65
|
if (layer.parameters.type === 'circle') {
|
|
@@ -79,6 +70,10 @@ const SimpleSymbol = ({ context, state, okSignalPromise, cancel, layerId }) => {
|
|
|
79
70
|
styleExpr[`${prefix}stroke-width`] = (_d = styleRef.current) === null || _d === void 0 ? void 0 : _d.strokeWidth;
|
|
80
71
|
styleExpr[`${prefix}stroke-line-join`] = (_e = styleRef.current) === null || _e === void 0 ? void 0 : _e.joinStyle;
|
|
81
72
|
styleExpr[`${prefix}stroke-line-cap`] = (_f = styleRef.current) === null || _f === void 0 ? void 0 : _f.capStyle;
|
|
73
|
+
const symbologyState = {
|
|
74
|
+
renderType: 'Single Symbol'
|
|
75
|
+
};
|
|
76
|
+
layer.parameters.symbologyState = symbologyState;
|
|
82
77
|
layer.parameters.color = styleExpr;
|
|
83
78
|
context.model.sharedModel.updateLayer(layerId, layer);
|
|
84
79
|
cancel();
|
|
@@ -44,6 +44,7 @@ export class VectorLayerPropertiesForm extends LayerPropertiesForm {
|
|
|
44
44
|
}
|
|
45
45
|
processSchema(data, schema, uiSchema) {
|
|
46
46
|
this.removeFormEntry('color', data, schema, uiSchema);
|
|
47
|
+
this.removeFormEntry('symbologyState', data, schema, uiSchema);
|
|
47
48
|
super.processSchema(data, schema, uiSchema);
|
|
48
49
|
if (!data) {
|
|
49
50
|
return;
|
|
@@ -5,6 +5,7 @@ import { LayerPropertiesForm } from './layerform';
|
|
|
5
5
|
export class WebGlLayerPropertiesForm extends LayerPropertiesForm {
|
|
6
6
|
processSchema(data, schema, uiSchema) {
|
|
7
7
|
this.removeFormEntry('color', data, schema, uiSchema);
|
|
8
|
+
this.removeFormEntry('symbologyState', data, schema, uiSchema);
|
|
8
9
|
super.processSchema(data, schema, uiSchema);
|
|
9
10
|
}
|
|
10
11
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
export * from './classificationModes';
|
|
1
2
|
export * from './commands';
|
|
2
3
|
export * from './constants';
|
|
3
4
|
export * from './dialogs/formdialog';
|
|
5
|
+
export * from './formbuilder/objectform/baseform';
|
|
6
|
+
export * from './icons';
|
|
4
7
|
export * from './mainview';
|
|
8
|
+
export * from './panelview';
|
|
9
|
+
export * from './store';
|
|
10
|
+
export * from './toolbar';
|
|
5
11
|
export * from './tools';
|
|
6
|
-
export * from './icons';
|
|
7
12
|
export * from './types';
|
|
8
13
|
export * from './widget';
|
|
9
|
-
export * from './formbuilder/objectform/baseform';
|
|
10
|
-
export * from './panelview';
|
|
11
|
-
export * from './toolbar';
|
package/lib/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
export * from './classificationModes';
|
|
1
2
|
export * from './commands';
|
|
2
3
|
export * from './constants';
|
|
3
4
|
export * from './dialogs/formdialog';
|
|
5
|
+
export * from './formbuilder/objectform/baseform';
|
|
6
|
+
export * from './icons';
|
|
4
7
|
export * from './mainview';
|
|
8
|
+
export * from './panelview';
|
|
9
|
+
export * from './store';
|
|
10
|
+
export * from './toolbar';
|
|
5
11
|
export * from './tools';
|
|
6
|
-
export * from './icons';
|
|
7
12
|
export * from './types';
|
|
8
13
|
export * from './widget';
|
|
9
|
-
export * from './formbuilder/objectform/baseform';
|
|
10
|
-
export * from './panelview';
|
|
11
|
-
export * from './toolbar';
|
|
@@ -25,7 +25,7 @@ export declare class MainView extends React.Component<IProps, IStates> {
|
|
|
25
25
|
* @param id - the source id.
|
|
26
26
|
* @param source - the source object.
|
|
27
27
|
*/
|
|
28
|
-
addSource(id: string, source: IJGISSource): Promise<void>;
|
|
28
|
+
addSource(id: string, source: IJGISSource, layerId?: string): Promise<void>;
|
|
29
29
|
private computeSourceUrl;
|
|
30
30
|
/**
|
|
31
31
|
* Update a source in the map.
|
|
@@ -102,6 +102,7 @@ export declare class MainView extends React.Component<IProps, IStates> {
|
|
|
102
102
|
private _onLayersChanged;
|
|
103
103
|
private _onLayerTreeChange;
|
|
104
104
|
private _onSourcesChange;
|
|
105
|
+
private _onSharedModelStateChange;
|
|
105
106
|
private _handleThemeChange;
|
|
106
107
|
private _handleWindowResize;
|
|
107
108
|
render(): JSX.Element;
|
|
@@ -113,5 +114,6 @@ export declare class MainView extends React.Component<IProps, IStates> {
|
|
|
113
114
|
private _ready;
|
|
114
115
|
private _sources;
|
|
115
116
|
private _sourceToLayerMap;
|
|
117
|
+
private _documentPath?;
|
|
116
118
|
}
|
|
117
119
|
export {};
|
package/lib/mainview/mainView.js
CHANGED
|
@@ -12,10 +12,15 @@ import { GeoTIFF as GeoTIFFSource, ImageTile as ImageTileSource, Vector as Vecto
|
|
|
12
12
|
import Static from 'ol/source/ImageStatic';
|
|
13
13
|
//@ts-expect-error no types for ol-pmtiles
|
|
14
14
|
import { PMTilesRasterSource, PMTilesVectorSource } from 'ol-pmtiles';
|
|
15
|
+
import { register } from 'ol/proj/proj4.js';
|
|
16
|
+
import { get as getProjection } from 'ol/proj.js';
|
|
17
|
+
import proj4 from 'proj4';
|
|
15
18
|
import * as React from 'react';
|
|
16
19
|
import shp from 'shpjs';
|
|
17
20
|
import { isLightTheme } from '../tools';
|
|
18
21
|
import { Spinner } from './spinner';
|
|
22
|
+
//@ts-expect-error no types for proj4-list
|
|
23
|
+
import proj4list from 'proj4-list';
|
|
19
24
|
export class MainView extends React.Component {
|
|
20
25
|
constructor(props) {
|
|
21
26
|
super(props);
|
|
@@ -118,6 +123,23 @@ export class MainView extends React.Component {
|
|
|
118
123
|
this._onClientSharedStateChanged = (sender, clients) => {
|
|
119
124
|
// TODO SOMETHING
|
|
120
125
|
};
|
|
126
|
+
this._onSharedModelStateChange = (_, change) => {
|
|
127
|
+
var _a;
|
|
128
|
+
const changedState = (_a = change.stateChange) === null || _a === void 0 ? void 0 : _a.map(value => value.name);
|
|
129
|
+
if (!(changedState === null || changedState === void 0 ? void 0 : changedState.includes('path'))) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const path = this._model.sharedModel.getState('path');
|
|
133
|
+
if (path !== this._documentPath && typeof path === 'string') {
|
|
134
|
+
if (window.jupytergisMaps !== undefined && this._documentPath) {
|
|
135
|
+
delete window.jupytergisMaps[this._documentPath];
|
|
136
|
+
}
|
|
137
|
+
this._documentPath = path;
|
|
138
|
+
if (window.jupytergisMaps !== undefined) {
|
|
139
|
+
window.jupytergisMaps[this._documentPath] = this._Map;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
121
143
|
this._handleThemeChange = () => {
|
|
122
144
|
const lightTheme = isLightTheme();
|
|
123
145
|
// TODO SOMETHING
|
|
@@ -130,6 +152,8 @@ export class MainView extends React.Component {
|
|
|
130
152
|
this.divRef = React.createRef(); // Reference of render div
|
|
131
153
|
this._ready = false;
|
|
132
154
|
this._sourceToLayerMap = new Map();
|
|
155
|
+
proj4.defs(Array.from(proj4list));
|
|
156
|
+
register(proj4);
|
|
133
157
|
this._mainViewModel = this.props.viewModel;
|
|
134
158
|
this._mainViewModel.viewSettingChanged.connect(this._onViewChanged, this);
|
|
135
159
|
this._model = this._mainViewModel.jGISModel;
|
|
@@ -146,13 +170,20 @@ export class MainView extends React.Component {
|
|
|
146
170
|
firstLoad: true
|
|
147
171
|
};
|
|
148
172
|
this._sources = [];
|
|
173
|
+
this._model.sharedModel.changed.connect(this._onSharedModelStateChange);
|
|
149
174
|
}
|
|
150
175
|
async componentDidMount() {
|
|
151
176
|
window.addEventListener('resize', this._handleWindowResize);
|
|
152
177
|
await this.generateScene();
|
|
153
178
|
this._mainViewModel.initSignal();
|
|
179
|
+
if (window.jupytergisMaps !== undefined && this._documentPath) {
|
|
180
|
+
window.jupytergisMaps[this._documentPath] = this._Map;
|
|
181
|
+
}
|
|
154
182
|
}
|
|
155
183
|
componentWillUnmount() {
|
|
184
|
+
if (window.jupytergisMaps !== undefined && this._documentPath) {
|
|
185
|
+
delete window.jupytergisMaps[this._documentPath];
|
|
186
|
+
}
|
|
156
187
|
window.removeEventListener('resize', this._handleWindowResize);
|
|
157
188
|
this._mainViewModel.viewSettingChanged.disconnect(this._onViewChanged, this);
|
|
158
189
|
this._model.themeChanged.disconnect(this._handleThemeChange, this);
|
|
@@ -181,7 +212,8 @@ export class MainView extends React.Component {
|
|
|
181
212
|
name: 'Drag and Drop source',
|
|
182
213
|
parameters: { path: event.file.name }
|
|
183
214
|
};
|
|
184
|
-
|
|
215
|
+
const layerId = UUID.uuid4();
|
|
216
|
+
this.addSource(sourceId, sourceModel, layerId);
|
|
185
217
|
this._model.sharedModel.addSource(sourceId, sourceModel);
|
|
186
218
|
const layerModel = {
|
|
187
219
|
type: 'VectorLayer',
|
|
@@ -194,7 +226,6 @@ export class MainView extends React.Component {
|
|
|
194
226
|
source: sourceId
|
|
195
227
|
}
|
|
196
228
|
};
|
|
197
|
-
const layerId = UUID.uuid4();
|
|
198
229
|
this.addLayer(layerId, layerModel, this.getLayers().length);
|
|
199
230
|
this._model.addLayer(layerId, layerModel);
|
|
200
231
|
});
|
|
@@ -247,7 +278,7 @@ export class MainView extends React.Component {
|
|
|
247
278
|
* @param id - the source id.
|
|
248
279
|
* @param source - the source object.
|
|
249
280
|
*/
|
|
250
|
-
async addSource(id, source) {
|
|
281
|
+
async addSource(id, source, layerId) {
|
|
251
282
|
var _a, _b;
|
|
252
283
|
let newSource;
|
|
253
284
|
switch (source.type) {
|
|
@@ -363,8 +394,11 @@ export class MainView extends React.Component {
|
|
|
363
394
|
}
|
|
364
395
|
case 'GeoTiffSource': {
|
|
365
396
|
const sourceParameters = source.parameters;
|
|
397
|
+
const addNoData = (url) => {
|
|
398
|
+
return Object.assign(Object.assign({}, url), { nodata: 0 });
|
|
399
|
+
};
|
|
366
400
|
newSource = new GeoTIFFSource({
|
|
367
|
-
sources: sourceParameters.urls,
|
|
401
|
+
sources: sourceParameters.urls.map(addNoData),
|
|
368
402
|
normalize: sourceParameters.normalize,
|
|
369
403
|
wrapX: sourceParameters.wrapX
|
|
370
404
|
});
|
|
@@ -408,7 +442,7 @@ export class MainView extends React.Component {
|
|
|
408
442
|
// remove source being updated
|
|
409
443
|
this.removeSource(id);
|
|
410
444
|
// create updated source
|
|
411
|
-
this.addSource(id, source);
|
|
445
|
+
await this.addSource(id, source, layerId);
|
|
412
446
|
// change source of target layer
|
|
413
447
|
mapLayer.setSource(this._sources[id]);
|
|
414
448
|
}
|
|
@@ -454,12 +488,12 @@ export class MainView extends React.Component {
|
|
|
454
488
|
async _buildMapLayer(id, layer) {
|
|
455
489
|
var _a;
|
|
456
490
|
const sourceId = (_a = layer.parameters) === null || _a === void 0 ? void 0 : _a.source;
|
|
457
|
-
const source = this._model.sharedModel.
|
|
491
|
+
const source = this._model.sharedModel.getLayerSource(sourceId);
|
|
458
492
|
if (!source) {
|
|
459
493
|
return;
|
|
460
494
|
}
|
|
461
495
|
if (!this._sources[sourceId]) {
|
|
462
|
-
await this.addSource(sourceId, source);
|
|
496
|
+
await this.addSource(sourceId, source, id);
|
|
463
497
|
}
|
|
464
498
|
let newMapLayer;
|
|
465
499
|
let layerParameters;
|
|
@@ -559,12 +593,12 @@ export class MainView extends React.Component {
|
|
|
559
593
|
async updateLayer(id, layer, mapLayer) {
|
|
560
594
|
var _a, _b, _c, _d;
|
|
561
595
|
const sourceId = (_a = layer.parameters) === null || _a === void 0 ? void 0 : _a.source;
|
|
562
|
-
const source = this._model.sharedModel.
|
|
596
|
+
const source = this._model.sharedModel.getLayerSource(sourceId);
|
|
563
597
|
if (!source) {
|
|
564
598
|
return;
|
|
565
599
|
}
|
|
566
600
|
if (!this._sources[sourceId]) {
|
|
567
|
-
await this.addSource(sourceId, source);
|
|
601
|
+
await this.addSource(sourceId, source, id);
|
|
568
602
|
}
|
|
569
603
|
mapLayer.setVisible(layer.visible);
|
|
570
604
|
switch (layer.type) {
|
|
@@ -620,23 +654,37 @@ export class MainView extends React.Component {
|
|
|
620
654
|
this._initializedPosition = true;
|
|
621
655
|
}
|
|
622
656
|
}
|
|
623
|
-
updateOptions(options) {
|
|
624
|
-
const
|
|
657
|
+
async updateOptions(options) {
|
|
658
|
+
const { projection, extent, useExtent, latitude, longitude, zoom, bearing } = options;
|
|
659
|
+
let view = this._Map.getView();
|
|
660
|
+
const currentProjection = view.getProjection().getCode();
|
|
661
|
+
// Need to recreate view if the projection changes
|
|
662
|
+
if (projection !== undefined && currentProjection !== projection) {
|
|
663
|
+
const newProjection = getProjection(projection);
|
|
664
|
+
if (newProjection) {
|
|
665
|
+
view = new View({ projection: newProjection });
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
console.warn(`Invalid projection: ${projection}`);
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
625
672
|
// Use the extent only if explicitly requested (QGIS files).
|
|
626
|
-
if (
|
|
627
|
-
view.fit(
|
|
673
|
+
if (useExtent && extent) {
|
|
674
|
+
view.fit(extent);
|
|
628
675
|
}
|
|
629
676
|
else {
|
|
630
|
-
const centerCoord = fromLonLat([
|
|
631
|
-
|
|
632
|
-
|
|
677
|
+
const centerCoord = fromLonLat([longitude || 0, latitude || 0], view.getProjection());
|
|
678
|
+
view.setCenter(centerCoord);
|
|
679
|
+
view.setZoom(zoom || 0);
|
|
633
680
|
// Save the extent if it does not exists, to allow proper export to qgis.
|
|
634
|
-
if (options.extent
|
|
681
|
+
if (!options.extent) {
|
|
635
682
|
options.extent = view.calculateExtent();
|
|
636
683
|
this._model.setOptions(options);
|
|
637
684
|
}
|
|
638
685
|
}
|
|
639
|
-
view.setRotation(
|
|
686
|
+
view.setRotation(bearing || 0);
|
|
687
|
+
this._Map.setView(view);
|
|
640
688
|
}
|
|
641
689
|
_onViewChanged(sender, change) {
|
|
642
690
|
// TODO SOMETHING
|
package/lib/store.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IStateDB } from '@jupyterlab/statedb';
|
|
2
|
+
export declare class GlobalStateDbManager {
|
|
3
|
+
private static instance;
|
|
4
|
+
private stateDb;
|
|
5
|
+
private constructor();
|
|
6
|
+
static getInstance(): GlobalStateDbManager;
|
|
7
|
+
initialize(stateDb: IStateDB): void;
|
|
8
|
+
getStateDb(): IStateDB | null;
|
|
9
|
+
}
|
package/lib/store.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Singleton class to manage Jupyter stateDb globally
|
|
2
|
+
export class GlobalStateDbManager {
|
|
3
|
+
// Private constructor to prevent direct instantiation
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
5
|
+
constructor() {
|
|
6
|
+
this.stateDb = null;
|
|
7
|
+
}
|
|
8
|
+
static getInstance() {
|
|
9
|
+
if (!GlobalStateDbManager.instance) {
|
|
10
|
+
GlobalStateDbManager.instance = new GlobalStateDbManager();
|
|
11
|
+
}
|
|
12
|
+
return GlobalStateDbManager.instance;
|
|
13
|
+
}
|
|
14
|
+
initialize(stateDb) {
|
|
15
|
+
if (this.stateDb === null) {
|
|
16
|
+
this.stateDb = stateDb;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
console.warn('stateDb is already initialized.');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
getStateDb() {
|
|
23
|
+
return this.stateDb;
|
|
24
|
+
}
|
|
25
|
+
}
|
package/lib/toolbar/widget.js
CHANGED
|
@@ -58,7 +58,7 @@ export class ToolbarWidget extends ReactiveToolbar {
|
|
|
58
58
|
this.addItem('separator2', new Separator());
|
|
59
59
|
const NewButton = new ToolbarButton({
|
|
60
60
|
icon: addIcon,
|
|
61
|
-
|
|
61
|
+
noFocusOnClick: false,
|
|
62
62
|
onClick: () => {
|
|
63
63
|
if (!options.commands) {
|
|
64
64
|
return;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IDict, IJupyterGISDoc, IJupyterGISModel, IJupyterGISTracker, IJupyterGISWidget } from '@jupytergis/schema';
|
|
2
2
|
import { ISignal } from '@lumino/signaling';
|
|
3
|
+
import { Map } from 'ol';
|
|
3
4
|
export { IDict };
|
|
4
5
|
export type ValueOf<T> = T[keyof T];
|
|
5
6
|
export interface IControlPanelModel {
|
|
@@ -9,3 +10,16 @@ export interface IControlPanelModel {
|
|
|
9
10
|
jGISModel: IJupyterGISModel | undefined;
|
|
10
11
|
sharedModel: IJupyterGISDoc | undefined;
|
|
11
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Add jupytergisMaps object to the global variables.
|
|
15
|
+
*/
|
|
16
|
+
declare global {
|
|
17
|
+
interface Window {
|
|
18
|
+
/**
|
|
19
|
+
* Access JupyterGIS map
|
|
20
|
+
*/
|
|
21
|
+
jupytergisMaps: {
|
|
22
|
+
[name: string]: Map;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupytergis/base",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "A JupyterLab extension for 3D modelling.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"url": "https://github.com/geojupyter/jupytergis.git"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "
|
|
30
|
+
"build": "tsc -b && jlpm run cp:gdal",
|
|
31
31
|
"build:gallery": "python rasterlayer_gallery_generator.py",
|
|
32
32
|
"cp:gdal": "cp ../../node_modules/gdal3.js/dist/package/gdal3WebAssembly.data lib && cp ../../node_modules/gdal3.js/dist/package/gdal3WebAssembly.wasm lib",
|
|
33
33
|
"build:prod": "jlpm run clean && jlpm run build",
|
|
@@ -39,21 +39,20 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@deathbeds/jupyterlab-rjsf": "^1.1.0",
|
|
42
|
-
"@jupyter/
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@jupyterlab/
|
|
46
|
-
"@jupyterlab/
|
|
47
|
-
"@jupyterlab/
|
|
48
|
-
"@jupyterlab/
|
|
49
|
-
"@jupyterlab/
|
|
50
|
-
"@jupyterlab/
|
|
51
|
-
"@jupyterlab/
|
|
52
|
-
"@jupyterlab/
|
|
53
|
-
"@jupyterlab/
|
|
54
|
-
"@jupyterlab/
|
|
55
|
-
"@jupyterlab/
|
|
56
|
-
"@jupyterlab/ui-components": "^4.0.0",
|
|
42
|
+
"@jupyter/ydoc": "^2.0.0 || ^3.0.0",
|
|
43
|
+
"@jupytergis/schema": "^0.1.7",
|
|
44
|
+
"@jupyterlab/application": "^4.3.0",
|
|
45
|
+
"@jupyterlab/apputils": "^4.3.0",
|
|
46
|
+
"@jupyterlab/completer": "^4.3.0",
|
|
47
|
+
"@jupyterlab/console": "^4.3.0",
|
|
48
|
+
"@jupyterlab/coreutils": "^6.3.0",
|
|
49
|
+
"@jupyterlab/docregistry": "^4.3.0",
|
|
50
|
+
"@jupyterlab/filebrowser": "^4.3.0",
|
|
51
|
+
"@jupyterlab/launcher": "^4.3.0",
|
|
52
|
+
"@jupyterlab/observables": "^5.3.0",
|
|
53
|
+
"@jupyterlab/services": "^7.3.0",
|
|
54
|
+
"@jupyterlab/translation": "^4.3.0",
|
|
55
|
+
"@jupyterlab/ui-components": "^4.3.0",
|
|
57
56
|
"@lumino/commands": "^2.0.0",
|
|
58
57
|
"@lumino/coreutils": "^2.0.0",
|
|
59
58
|
"@lumino/messaging": "^2.0.0",
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
select,
|
|
2
|
+
select option {
|
|
3
|
+
text-transform: capitalize;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
.jp-gis-symbology-dialog .jp-Dialog-header {
|
|
2
7
|
font-weight: bold;
|
|
3
8
|
}
|
|
@@ -27,10 +32,30 @@
|
|
|
27
32
|
max-width: 50%;
|
|
28
33
|
}
|
|
29
34
|
|
|
35
|
+
.jp-gis-color-ramp-div {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex: 1 1 50%;
|
|
38
|
+
max-width: 50%;
|
|
39
|
+
justify-content: space-between;
|
|
40
|
+
align-items: baseline;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.jp-gis-color-ramp-div > .jp-select-wrapper {
|
|
44
|
+
flex: 1 0 40%;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.jp-gis-color-ramp-div:last-child {
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.jp-gis-color-ramp-div > input {
|
|
52
|
+
max-width: 25%;
|
|
53
|
+
}
|
|
54
|
+
|
|
30
55
|
.jp-gis-band-container {
|
|
31
56
|
display: flex;
|
|
32
57
|
flex-direction: column;
|
|
33
|
-
gap:
|
|
58
|
+
gap: 13px;
|
|
34
59
|
}
|
|
35
60
|
|
|
36
61
|
.jp-gis-layer-symbology-container {
|
|
@@ -45,8 +70,10 @@
|
|
|
45
70
|
margin-bottom: unset;
|
|
46
71
|
}
|
|
47
72
|
|
|
48
|
-
.jp-gis-
|
|
49
|
-
|
|
73
|
+
.jp-gis-color-ramp-container {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
gap: 13px;
|
|
50
77
|
}
|
|
51
78
|
|
|
52
79
|
.jp-gis-stop-container {
|
|
@@ -120,3 +147,77 @@
|
|
|
120
147
|
transform: rotate(360deg);
|
|
121
148
|
}
|
|
122
149
|
}
|
|
150
|
+
|
|
151
|
+
.jp-gis-color-ramp-dropdown {
|
|
152
|
+
display: flex;
|
|
153
|
+
flex-direction: column;
|
|
154
|
+
gap: 0.25rem;
|
|
155
|
+
position: absolute;
|
|
156
|
+
overflow-x: hidden;
|
|
157
|
+
overflow-y: auto;
|
|
158
|
+
visibility: hidden;
|
|
159
|
+
z-index: 40;
|
|
160
|
+
flex: 1 1 auto;
|
|
161
|
+
width: 97%;
|
|
162
|
+
max-height: 375px;
|
|
163
|
+
background: var(--jp-input-background);
|
|
164
|
+
padding-left: 8px;
|
|
165
|
+
border: var(--jp-border-width) solid var(--jp-input-border-color);
|
|
166
|
+
border-radius: 0;
|
|
167
|
+
outline: none;
|
|
168
|
+
appearance: none;
|
|
169
|
+
-webkit-appearance: none;
|
|
170
|
+
-moz-appearance: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.jp-gis-open {
|
|
174
|
+
visibility: visible;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.jp-gis-color-ramp-entry {
|
|
178
|
+
display: flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
font-size: var(--jp-ui-font-size2);
|
|
181
|
+
color: var(--jp-ui-font-color0);
|
|
182
|
+
appearance: none;
|
|
183
|
+
text-transform: capitalize;
|
|
184
|
+
cursor: pointer;
|
|
185
|
+
-webkit-appearance: none;
|
|
186
|
+
-moz-appearance: none;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.jp-gis-color-label {
|
|
190
|
+
color: white;
|
|
191
|
+
position: absolute;
|
|
192
|
+
transition: transform 0.3s ease;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.jp-gis-color-ramp-entry:hover .jp-gis-color-label {
|
|
196
|
+
transform: scale(1.2);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.jp-gis-color-canvas {
|
|
200
|
+
margin: 0 -7px;
|
|
201
|
+
border-radius: 4px;
|
|
202
|
+
width: 100%;
|
|
203
|
+
max-height: 38px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.jp-gis-color-canvas-display {
|
|
207
|
+
width: 100%;
|
|
208
|
+
height: 30px;
|
|
209
|
+
visibility: initial;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.jp-gis-canvas-button-wrapper {
|
|
213
|
+
flex: 1 0 50%;
|
|
214
|
+
max-width: 50%;
|
|
215
|
+
position: relative;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
#jp-gis-canvas-button.jp-gis-canvas-button {
|
|
219
|
+
visibility: hidden;
|
|
220
|
+
margin: 0;
|
|
221
|
+
padding: 0 1px 0 0;
|
|
222
|
+
width: 100%;
|
|
223
|
+
}
|