@jupytergis/base 0.6.1 → 0.7.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 +2 -3
- package/lib/annotations/components/Annotation.js +2 -9
- package/lib/commands/BaseCommandIDs.d.ts +1 -0
- package/lib/commands/BaseCommandIDs.js +1 -0
- package/lib/commands/index.js +15 -0
- package/lib/constants.js +1 -0
- package/lib/dialogs/symbology/components/color_ramp/ColorRamp.js +1 -1
- package/lib/dialogs/symbology/vector_layer/types/Heatmap.js +2 -2
- package/lib/formbuilder/formselectors.js +3 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/keybindings.json +2 -2
- package/lib/mainview/mainView.d.ts +8 -1
- package/lib/mainview/mainView.js +24 -1
- package/lib/mainview/mainviewwidget.d.ts +11 -4
- package/lib/mainview/mainviewwidget.js +3 -2
- package/lib/menus.js +4 -0
- package/lib/panelview/annotationPanel.d.ts +3 -17
- package/lib/panelview/annotationPanel.js +5 -22
- package/lib/panelview/components/filter-panel/Filter.d.ts +2 -19
- package/lib/panelview/components/filter-panel/Filter.js +26 -59
- package/lib/panelview/components/identify-panel/IdentifyPanel.d.ts +6 -14
- package/lib/panelview/components/identify-panel/IdentifyPanel.js +14 -52
- package/lib/panelview/components/layers.d.ts +10 -12
- package/lib/panelview/components/layers.js +109 -79
- package/lib/panelview/index.d.ts +0 -1
- package/lib/panelview/index.js +0 -1
- package/lib/panelview/leftpanel.d.ts +8 -47
- package/lib/panelview/leftpanel.js +32 -154
- package/lib/panelview/objectproperties.d.ts +20 -15
- package/lib/panelview/objectproperties.js +12 -34
- package/lib/panelview/rightpanel.d.ts +8 -22
- package/lib/panelview/rightpanel.js +32 -77
- package/lib/processing/index.js +4 -3
- package/lib/shared/components/Tabs.d.ts +7 -1
- package/lib/shared/components/Tabs.js +6 -1
- package/lib/stacBrowser/components/{StacPanelView.d.ts → StacPanel.d.ts} +2 -2
- package/lib/stacBrowser/components/{StacPanelView.js → StacPanel.js} +3 -3
- package/lib/stacBrowser/index.d.ts +1 -1
- package/lib/stacBrowser/index.js +1 -1
- package/lib/tools.js +26 -0
- package/lib/types.d.ts +1 -9
- package/lib/widget.d.ts +8 -3
- package/lib/widget.js +8 -4
- package/package.json +7 -5
- package/style/base.css +18 -2
- package/style/shared/tabs.css +16 -2
- package/style/stacBrowser.css +0 -6
- package/style/tabPanel.css +91 -0
- package/style/temporalSlider.css +1 -0
- package/lib/panelview/model.d.ts +0 -19
- package/lib/panelview/model.js +0 -30
- package/lib/stacBrowser/StacBrowser.d.ts +0 -7
- package/lib/stacBrowser/StacBrowser.js +0 -16
- package/lib/stacBrowser/StacPanel.d.ts +0 -14
- package/lib/stacBrowser/StacPanel.js +0 -16
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { IAnnotationModel } from '@jupytergis/schema';
|
|
1
|
+
import { IAnnotationModel, IJupyterGISModel } from '@jupytergis/schema';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { IControlPanelModel } from "../../types";
|
|
4
3
|
export interface IAnnotationProps {
|
|
5
4
|
itemId: string;
|
|
6
5
|
annotationModel: IAnnotationModel;
|
|
7
|
-
|
|
6
|
+
jgisModel?: IJupyterGISModel;
|
|
8
7
|
children?: JSX.Element[] | JSX.Element;
|
|
9
8
|
}
|
|
10
9
|
declare const Annotation: React.FC<IAnnotationProps>;
|
|
@@ -4,17 +4,10 @@ import { showDialog, Dialog } from '@jupyterlab/apputils';
|
|
|
4
4
|
import { Button } from '@jupyterlab/ui-components';
|
|
5
5
|
import React, { useMemo, useState } from 'react';
|
|
6
6
|
import { Message } from './Message';
|
|
7
|
-
const Annotation = ({ itemId, annotationModel,
|
|
7
|
+
const Annotation = ({ itemId, annotationModel, jgisModel, children, }) => {
|
|
8
8
|
const [messageContent, setMessageContent] = useState('');
|
|
9
|
-
const [jgisModel, setJgisModel] = useState(rightPanelModel === null || rightPanelModel === void 0 ? void 0 : rightPanelModel.jGISModel);
|
|
10
9
|
const annotation = annotationModel.getAnnotation(itemId);
|
|
11
10
|
const contents = useMemo(() => { var _a; return (_a = annotation === null || annotation === void 0 ? void 0 : annotation.contents) !== null && _a !== void 0 ? _a : []; }, [annotation]);
|
|
12
|
-
/**
|
|
13
|
-
* Update the model when it changes.
|
|
14
|
-
*/
|
|
15
|
-
rightPanelModel === null || rightPanelModel === void 0 ? void 0 : rightPanelModel.documentChanged.connect((_, widget) => {
|
|
16
|
-
setJgisModel(widget === null || widget === void 0 ? void 0 : widget.model);
|
|
17
|
-
});
|
|
18
11
|
const handleSubmit = () => {
|
|
19
12
|
annotationModel.addContent(itemId, messageContent);
|
|
20
13
|
setMessageContent('');
|
|
@@ -53,7 +46,7 @@ const Annotation = ({ itemId, annotationModel, rightPanelModel, children, }) =>
|
|
|
53
46
|
React.createElement("div", { className: "jGIS-Annotation-Buttons" },
|
|
54
47
|
React.createElement(Button, { className: "jp-mod-styled jp-mod-warn", onClick: handleDelete },
|
|
55
48
|
React.createElement(FontAwesomeIcon, { icon: faTrash })),
|
|
56
|
-
|
|
49
|
+
jgisModel && (React.createElement(Button, { className: "jp-mod-styled jp-mod-accept", onClick: centerOnAnnotation },
|
|
57
50
|
React.createElement(FontAwesomeIcon, { icon: faArrowsToDot }))),
|
|
58
51
|
React.createElement(Button, { className: "jp-mod-styled jp-mod-accept", onClick: handleSubmit },
|
|
59
52
|
React.createElement(FontAwesomeIcon, { icon: faPaperPlane })))));
|
|
@@ -14,6 +14,7 @@ export declare const newHillshadeEntry = "jupytergis:newHillshadeEntry";
|
|
|
14
14
|
export declare const newImageEntry = "jupytergis:newImageEntry";
|
|
15
15
|
export declare const newVideoEntry = "jupytergis:newVideoEntry";
|
|
16
16
|
export declare const newGeoTiffEntry = "jupytergis:newGeoTiffEntry";
|
|
17
|
+
export declare const newGeoParquetEntry = "jupytergis:newGeoParquetEntry";
|
|
17
18
|
export declare const renameLayer = "jupytergis:renameLayer";
|
|
18
19
|
export declare const removeLayer = "jupytergis:removeLayer";
|
|
19
20
|
export declare const renameGroup = "jupytergis:renameGroup";
|
|
@@ -21,6 +21,7 @@ export const newHillshadeEntry = 'jupytergis:newHillshadeEntry';
|
|
|
21
21
|
export const newImageEntry = 'jupytergis:newImageEntry';
|
|
22
22
|
export const newVideoEntry = 'jupytergis:newVideoEntry';
|
|
23
23
|
export const newGeoTiffEntry = 'jupytergis:newGeoTiffEntry';
|
|
24
|
+
export const newGeoParquetEntry = 'jupytergis:newGeoParquetEntry';
|
|
24
25
|
// Layer and group actions
|
|
25
26
|
export const renameLayer = 'jupytergis:renameLayer';
|
|
26
27
|
export const removeLayer = 'jupytergis:removeLayer';
|
package/lib/commands/index.js
CHANGED
|
@@ -198,6 +198,21 @@ export function addCommands(app, tracker, translator, formSchemaRegistry, layerB
|
|
|
198
198
|
sourceType: 'VectorTileSource',
|
|
199
199
|
layerType: 'VectorTileLayer',
|
|
200
200
|
}) }, icons.get(CommandIDs.newVectorTileEntry)));
|
|
201
|
+
commands.addCommand(CommandIDs.newGeoParquetEntry, Object.assign({ label: trans.__('New GeoParquet Layer'), isEnabled: () => {
|
|
202
|
+
return tracker.currentWidget
|
|
203
|
+
? tracker.currentWidget.model.sharedModel.editable
|
|
204
|
+
: false;
|
|
205
|
+
}, execute: Private.createEntry({
|
|
206
|
+
tracker,
|
|
207
|
+
formSchemaRegistry,
|
|
208
|
+
title: 'Create GeoParquet Layer',
|
|
209
|
+
createLayer: true,
|
|
210
|
+
createSource: true,
|
|
211
|
+
sourceData: { name: 'Custom GeoParquet Source' },
|
|
212
|
+
layerData: { name: 'Custom GeoParquet Layer' },
|
|
213
|
+
sourceType: 'GeoParquetSource',
|
|
214
|
+
layerType: 'VectorLayer',
|
|
215
|
+
}) }, icons.get(CommandIDs.newGeoParquetEntry)));
|
|
201
216
|
commands.addCommand(CommandIDs.newGeoJSONEntry, Object.assign({ label: trans.__('New GeoJSON layer'), isEnabled: () => {
|
|
202
217
|
return tracker.currentWidget
|
|
203
218
|
? tracker.currentWidget.model.sharedModel.editable
|
package/lib/constants.js
CHANGED
|
@@ -30,6 +30,7 @@ const iconObject = {
|
|
|
30
30
|
[CommandIDs.newVideoEntry]: { iconClass: 'fa fa-video' },
|
|
31
31
|
[CommandIDs.newShapefileEntry]: { iconClass: 'fa fa-file' },
|
|
32
32
|
[CommandIDs.newGeoTiffEntry]: { iconClass: 'fa fa-image' },
|
|
33
|
+
[CommandIDs.newGeoParquetEntry]: { iconClass: 'fa fa-file' },
|
|
33
34
|
[CommandIDs.symbology]: { iconClass: 'fa fa-brush' },
|
|
34
35
|
[CommandIDs.identify]: { icon: infoIcon },
|
|
35
36
|
[CommandIDs.temporalController]: { icon: clockIcon },
|
|
@@ -20,7 +20,7 @@ const ColorRamp = ({ layerParams, modeOptions, classifyFunc, showModeRow, showRa
|
|
|
20
20
|
}
|
|
21
21
|
setNumberOfShades(nClasses ? nClasses : '9');
|
|
22
22
|
setSelectedMode(singleBandMode ? singleBandMode : 'equal interval');
|
|
23
|
-
setSelectedRamp(colorRamp ? colorRamp : '
|
|
23
|
+
setSelectedRamp(colorRamp ? colorRamp : 'viridis');
|
|
24
24
|
};
|
|
25
25
|
return (React.createElement("div", { className: "jp-gis-color-ramp-container" },
|
|
26
26
|
showRampSelector && (React.createElement("div", { className: "jp-gis-symbology-row" },
|
|
@@ -14,7 +14,7 @@ const Heatmap = ({ model, state, okSignalPromise, cancel, layerId, }) => {
|
|
|
14
14
|
radius: 8,
|
|
15
15
|
blur: 15,
|
|
16
16
|
});
|
|
17
|
-
const selectedRampRef = useRef('
|
|
17
|
+
const selectedRampRef = useRef('viridis');
|
|
18
18
|
const heatmapOptionsRef = useRef({
|
|
19
19
|
radius: 8,
|
|
20
20
|
blur: 15,
|
|
@@ -40,7 +40,7 @@ const Heatmap = ({ model, state, okSignalPromise, cancel, layerId, }) => {
|
|
|
40
40
|
if ((_a = layer.parameters) === null || _a === void 0 ? void 0 : _a.symbologyState) {
|
|
41
41
|
colorRamp = layer.parameters.symbologyState.colorRamp;
|
|
42
42
|
}
|
|
43
|
-
setSelectedRamp(colorRamp ? colorRamp : '
|
|
43
|
+
setSelectedRamp(colorRamp ? colorRamp : 'viridis');
|
|
44
44
|
};
|
|
45
45
|
const handleOk = () => {
|
|
46
46
|
if (!layer.parameters) {
|
|
@@ -38,6 +38,9 @@ export function getSourceTypeForm(sourceType) {
|
|
|
38
38
|
case 'VectorTileSource':
|
|
39
39
|
SourceForm = TileSourcePropertiesForm;
|
|
40
40
|
break;
|
|
41
|
+
case 'GeoParquetSource':
|
|
42
|
+
SourceForm = PathBasedSourcePropertiesForm;
|
|
43
|
+
break;
|
|
41
44
|
// ADD MORE FORM TYPES HERE
|
|
42
45
|
}
|
|
43
46
|
return SourceForm;
|
package/lib/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export * from './icons';
|
|
|
8
8
|
export * from './mainview';
|
|
9
9
|
export * from './menus';
|
|
10
10
|
export * from './panelview';
|
|
11
|
-
export * from './stacBrowser';
|
|
12
11
|
export * from './store';
|
|
12
|
+
export * from './stacBrowser';
|
|
13
13
|
export * from './toolbar';
|
|
14
14
|
export * from './tools';
|
|
15
15
|
export * from './types';
|
package/lib/index.js
CHANGED
|
@@ -8,8 +8,8 @@ export * from './icons';
|
|
|
8
8
|
export * from './mainview';
|
|
9
9
|
export * from './menus';
|
|
10
10
|
export * from './panelview';
|
|
11
|
-
export * from './stacBrowser';
|
|
12
11
|
export * from './store';
|
|
12
|
+
export * from './stacBrowser';
|
|
13
13
|
export * from './toolbar';
|
|
14
14
|
export * from './tools';
|
|
15
15
|
export * from './types';
|
package/lib/keybindings.json
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
{
|
|
38
38
|
"command": "jupytergis:renameLayer",
|
|
39
39
|
"keys": ["F2"],
|
|
40
|
-
"selector": ".
|
|
40
|
+
"selector": ".jp-gis-layerItem"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
"command": "jupytergis:removeGroup",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
{
|
|
48
48
|
"command": "jupytergis:renameGroup",
|
|
49
49
|
"keys": ["F2"],
|
|
50
|
-
"selector": ".
|
|
50
|
+
"selector": ".jp-gis-layerGroupHeader"
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
"command": "jupytergis:executeConsole",
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { IAnnotation, IDict, IJGISFilterItem, IJGISLayer, IJGISSource } from '@jupytergis/schema';
|
|
1
|
+
import { IAnnotation, IAnnotationModel, IDict, IJGISFilterItem, IJGISFormSchemaRegistry, IJGISLayer, IJGISSource } from '@jupytergis/schema';
|
|
2
2
|
import { User } from '@jupyterlab/services';
|
|
3
|
+
import { IStateDB } from '@jupyterlab/statedb';
|
|
3
4
|
import { Layer } from 'ol/layer';
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import { ClientPointer } from './CollaboratorPointers';
|
|
6
7
|
import { MainViewModel } from './mainviewmodel';
|
|
7
8
|
interface IProps {
|
|
8
9
|
viewModel: MainViewModel;
|
|
10
|
+
state?: IStateDB;
|
|
11
|
+
formSchemaRegistry?: IJGISFormSchemaRegistry;
|
|
12
|
+
annotationModel?: IAnnotationModel;
|
|
9
13
|
}
|
|
10
14
|
interface IStates {
|
|
11
15
|
id: string;
|
|
@@ -194,5 +198,8 @@ export declare class MainView extends React.Component<IProps, IStates> {
|
|
|
194
198
|
private _originalFeatures;
|
|
195
199
|
private _highlightLayer;
|
|
196
200
|
private _updateCenter;
|
|
201
|
+
private _state?;
|
|
202
|
+
private _formSchemaRegistry?;
|
|
203
|
+
private _annotationModel?;
|
|
197
204
|
}
|
|
198
205
|
export {};
|
package/lib/mainview/mainView.js
CHANGED
|
@@ -33,6 +33,7 @@ import { debounce, isLightTheme, loadFile, throttle } from "../tools";
|
|
|
33
33
|
import CollaboratorPointers from './CollaboratorPointers';
|
|
34
34
|
import { FollowIndicator } from './FollowIndicator';
|
|
35
35
|
import TemporalSlider from './TemporalSlider';
|
|
36
|
+
import { LeftPanel, RightPanel } from '../panelview';
|
|
36
37
|
export class MainView extends React.Component {
|
|
37
38
|
constructor(props) {
|
|
38
39
|
super(props);
|
|
@@ -441,6 +442,9 @@ export class MainView extends React.Component {
|
|
|
441
442
|
this._ready = false;
|
|
442
443
|
this._sourceToLayerMap = new Map();
|
|
443
444
|
this._originalFeatures = {};
|
|
445
|
+
this._state = props.state;
|
|
446
|
+
this._formSchemaRegistry = props.formSchemaRegistry;
|
|
447
|
+
this._annotationModel = props.annotationModel;
|
|
444
448
|
// Enforce the map to take the full available width in the case of Jupyter Notebook viewer
|
|
445
449
|
const el = document.getElementById('main-panel');
|
|
446
450
|
if (el) {
|
|
@@ -819,6 +823,23 @@ export class MainView extends React.Component {
|
|
|
819
823
|
});
|
|
820
824
|
break;
|
|
821
825
|
}
|
|
826
|
+
case 'GeoParquetSource': {
|
|
827
|
+
const parameters = source.parameters;
|
|
828
|
+
const geojson = await loadFile({
|
|
829
|
+
filepath: parameters.path,
|
|
830
|
+
type: 'GeoParquetSource',
|
|
831
|
+
model: this._model,
|
|
832
|
+
});
|
|
833
|
+
const geojsonData = Array.isArray(geojson) ? geojson[0] : geojson;
|
|
834
|
+
const format = new GeoJSON();
|
|
835
|
+
newSource = new VectorSource({
|
|
836
|
+
features: format.readFeatures(geojsonData, {
|
|
837
|
+
dataProjection: parameters.projection,
|
|
838
|
+
featureProjection: this._Map.getView().getProjection(),
|
|
839
|
+
}),
|
|
840
|
+
});
|
|
841
|
+
break;
|
|
842
|
+
}
|
|
822
843
|
}
|
|
823
844
|
newSource.set('id', id);
|
|
824
845
|
// _sources is a list of OpenLayers sources
|
|
@@ -1642,6 +1663,8 @@ export class MainView extends React.Component {
|
|
|
1642
1663
|
width: '100%',
|
|
1643
1664
|
height: '100%',
|
|
1644
1665
|
} })),
|
|
1645
|
-
React.createElement(StatusBar, { jgisModel: this._model, loading: this.state.loadingLayer, projection: this.state.viewProjection, scale: this.state.scale }))
|
|
1666
|
+
React.createElement(StatusBar, { jgisModel: this._model, loading: this.state.loadingLayer, projection: this.state.viewProjection, scale: this.state.scale })),
|
|
1667
|
+
this._state && (React.createElement(LeftPanel, { model: this._model, commands: this._mainViewModel.commands, state: this._state })),
|
|
1668
|
+
this._formSchemaRegistry && this._annotationModel && (React.createElement(RightPanel, { model: this._model, formSchemaRegistry: this._formSchemaRegistry, annotationModel: this._annotationModel }))));
|
|
1646
1669
|
}
|
|
1647
1670
|
}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import { IAnnotationModel, IJGISFormSchemaRegistry } from '@jupytergis/schema';
|
|
1
2
|
import { ReactWidget } from '@jupyterlab/apputils';
|
|
3
|
+
import { IStateDB } from '@jupyterlab/statedb';
|
|
2
4
|
import { MainViewModel } from './mainviewmodel';
|
|
5
|
+
export interface IOptions {
|
|
6
|
+
mainViewModel: MainViewModel;
|
|
7
|
+
state?: IStateDB;
|
|
8
|
+
formSchemaRegistry?: IJGISFormSchemaRegistry;
|
|
9
|
+
annotationModel?: IAnnotationModel;
|
|
10
|
+
}
|
|
3
11
|
export declare class JupyterGISMainViewPanel extends ReactWidget {
|
|
4
12
|
/**
|
|
5
13
|
* Construct a `JupyterGISPanel`.
|
|
6
14
|
*/
|
|
7
|
-
constructor(options:
|
|
8
|
-
mainViewModel: MainViewModel;
|
|
9
|
-
});
|
|
15
|
+
constructor(options: IOptions);
|
|
10
16
|
render(): JSX.Element;
|
|
11
|
-
private
|
|
17
|
+
private _state?;
|
|
18
|
+
private _options;
|
|
12
19
|
}
|
|
@@ -7,10 +7,11 @@ export class JupyterGISMainViewPanel extends ReactWidget {
|
|
|
7
7
|
*/
|
|
8
8
|
constructor(options) {
|
|
9
9
|
super();
|
|
10
|
-
this.
|
|
10
|
+
this._state = options.state;
|
|
11
11
|
this.addClass('jp-jupytergis-panel');
|
|
12
|
+
this._options = options;
|
|
12
13
|
}
|
|
13
14
|
render() {
|
|
14
|
-
return React.createElement(MainView, { viewModel: this.
|
|
15
|
+
return (React.createElement(MainView, { state: this._state, viewModel: this._options.mainViewModel, formSchemaRegistry: this._options.formSchemaRegistry, annotationModel: this._options.annotationModel }));
|
|
15
16
|
}
|
|
16
17
|
}
|
package/lib/menus.js
CHANGED
|
@@ -18,6 +18,10 @@ export const vectorSubMenu = (commands) => {
|
|
|
18
18
|
type: 'command',
|
|
19
19
|
command: CommandIDs.newShapefileEntry,
|
|
20
20
|
});
|
|
21
|
+
subMenu.addItem({
|
|
22
|
+
type: 'command',
|
|
23
|
+
command: CommandIDs.newGeoParquetEntry,
|
|
24
|
+
});
|
|
21
25
|
return subMenu;
|
|
22
26
|
};
|
|
23
27
|
export const rasterSubMenu = (commands) => {
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
import { IAnnotationModel } from '@jupytergis/schema';
|
|
2
|
-
import { PanelWithToolbar } from '@jupyterlab/ui-components';
|
|
1
|
+
import { IAnnotationModel, IJupyterGISModel } from '@jupytergis/schema';
|
|
3
2
|
import { Component } from 'react';
|
|
4
|
-
import { IControlPanelModel } from "../types";
|
|
5
3
|
interface IAnnotationPanelProps {
|
|
6
4
|
annotationModel: IAnnotationModel;
|
|
7
|
-
|
|
5
|
+
jgisModel: IJupyterGISModel;
|
|
8
6
|
}
|
|
9
7
|
export declare class AnnotationsPanel extends Component<IAnnotationPanelProps> {
|
|
10
8
|
constructor(props: IAnnotationPanelProps);
|
|
11
9
|
render(): JSX.Element;
|
|
12
10
|
private _annotationModel;
|
|
13
|
-
private
|
|
14
|
-
}
|
|
15
|
-
export declare class Annotations extends PanelWithToolbar {
|
|
16
|
-
constructor(options: Annotations.IOptions);
|
|
17
|
-
private _widget;
|
|
18
|
-
private _annotationModel;
|
|
19
|
-
private _rightPanelModel;
|
|
20
|
-
}
|
|
21
|
-
export declare namespace Annotations {
|
|
22
|
-
interface IOptions {
|
|
23
|
-
annotationModel: IAnnotationModel;
|
|
24
|
-
rightPanelModel: IControlPanelModel;
|
|
25
|
-
}
|
|
11
|
+
private _jgisModel;
|
|
26
12
|
}
|
|
27
13
|
export {};
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import { PanelWithToolbar, ReactWidget } from '@jupyterlab/ui-components';
|
|
2
1
|
import React, { Component } from 'react';
|
|
3
2
|
import Annotation from "../annotations/components/Annotation";
|
|
4
3
|
export class AnnotationsPanel extends Component {
|
|
5
4
|
constructor(props) {
|
|
5
|
+
var _a, _b;
|
|
6
6
|
super(props);
|
|
7
7
|
const updateCallback = () => {
|
|
8
8
|
this.forceUpdate();
|
|
9
9
|
};
|
|
10
10
|
this._annotationModel = props.annotationModel;
|
|
11
|
-
this.
|
|
12
|
-
this._annotationModel.
|
|
13
|
-
|
|
14
|
-
var _a, _b, _c, _d;
|
|
15
|
-
(_b = (_a = this._annotationModel) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.sharedMetadataChanged.disconnect(updateCallback);
|
|
16
|
-
this._annotationModel = props.annotationModel;
|
|
17
|
-
(_d = (_c = this._annotationModel) === null || _c === void 0 ? void 0 : _c.model) === null || _d === void 0 ? void 0 : _d.sharedMetadataChanged.connect(updateCallback);
|
|
18
|
-
this.forceUpdate();
|
|
19
|
-
});
|
|
11
|
+
this._jgisModel = props.jgisModel;
|
|
12
|
+
(_b = (_a = this._annotationModel) === null || _a === void 0 ? void 0 : _a.model) === null || _b === void 0 ? void 0 : _b.sharedMetadataChanged.connect(updateCallback);
|
|
13
|
+
this.forceUpdate();
|
|
20
14
|
}
|
|
21
15
|
render() {
|
|
22
16
|
var _a;
|
|
@@ -26,20 +20,9 @@ export class AnnotationsPanel extends Component {
|
|
|
26
20
|
}
|
|
27
21
|
const annotations = annotationIds.map((id) => {
|
|
28
22
|
return (React.createElement("div", null,
|
|
29
|
-
React.createElement(Annotation, {
|
|
23
|
+
React.createElement(Annotation, { jgisModel: this._jgisModel, annotationModel: this._annotationModel, itemId: id }),
|
|
30
24
|
React.createElement("hr", { className: "jGIS-Annotations-Separator" })));
|
|
31
25
|
});
|
|
32
26
|
return React.createElement("div", { className: "jgis-scrollable" }, annotations);
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
|
-
export class Annotations extends PanelWithToolbar {
|
|
36
|
-
constructor(options) {
|
|
37
|
-
super({});
|
|
38
|
-
this.title.label = 'Annotations';
|
|
39
|
-
this.addClass('jgis-scrollable');
|
|
40
|
-
this._annotationModel = options.annotationModel;
|
|
41
|
-
this._rightPanelModel = options.rightPanelModel;
|
|
42
|
-
this._widget = ReactWidget.create(React.createElement(AnnotationsPanel, { rightPanelModel: this._rightPanelModel, annotationModel: this._annotationModel }));
|
|
43
|
-
this.addWidget(this._widget);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,24 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Panel } from '@lumino/widgets';
|
|
1
|
+
import { IJupyterGISModel } from '@jupytergis/schema';
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { IControlPanelModel } from "../../../types";
|
|
5
|
-
/**
|
|
6
|
-
* The filters panel widget.
|
|
7
|
-
*/
|
|
8
|
-
export declare class FilterPanel extends Panel {
|
|
9
|
-
constructor(options: FilterPanel.IOptions);
|
|
10
|
-
private _model;
|
|
11
|
-
private _tracker;
|
|
12
|
-
}
|
|
13
|
-
export declare namespace FilterPanel {
|
|
14
|
-
interface IOptions {
|
|
15
|
-
model: IControlPanelModel;
|
|
16
|
-
tracker: IJupyterGISTracker;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
3
|
interface IFilterComponentProps {
|
|
20
|
-
model:
|
|
21
|
-
tracker: IJupyterGISTracker;
|
|
4
|
+
model: IJupyterGISModel;
|
|
22
5
|
}
|
|
23
6
|
declare const FilterComponent: React.FC<IFilterComponentProps>;
|
|
24
7
|
export default FilterComponent;
|
|
@@ -1,62 +1,22 @@
|
|
|
1
|
-
import { Button
|
|
2
|
-
import { Panel } from '@lumino/widgets';
|
|
1
|
+
import { Button } from '@jupyterlab/ui-components';
|
|
3
2
|
import { cloneDeep } from 'lodash';
|
|
4
3
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
4
|
import { debounce, loadFile } from "../../../tools";
|
|
6
5
|
import FilterRow from './FilterRow';
|
|
7
|
-
|
|
8
|
-
* The filters panel widget.
|
|
9
|
-
*/
|
|
10
|
-
export class FilterPanel extends Panel {
|
|
11
|
-
constructor(options) {
|
|
12
|
-
super();
|
|
13
|
-
this._model = options.model;
|
|
14
|
-
this._tracker = options.tracker;
|
|
15
|
-
this.id = 'jupytergis::layerTree';
|
|
16
|
-
// this.addClass(LAYERS_PANEL_CLASS);
|
|
17
|
-
this.addWidget(ReactWidget.create(React.createElement(FilterComponent, { model: this._model, tracker: this._tracker })));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const FilterComponent = props => {
|
|
21
|
-
var _a;
|
|
6
|
+
const FilterComponent = ({ model }) => {
|
|
22
7
|
const featuresInLayerRef = useRef({});
|
|
23
|
-
const [widgetId, setWidgetId] = useState('');
|
|
24
8
|
const [logicalOp, setLogicalOp] = useState('all');
|
|
25
9
|
const [selectedLayer, setSelectedLayer] = useState('');
|
|
26
10
|
const [shouldDisplay, setShouldDisplay] = useState(false);
|
|
27
11
|
const [filterRows, setFilterRows] = useState([]);
|
|
28
12
|
const [featuresInLayer, setFeaturesInLayer] = useState({});
|
|
29
|
-
const [model, setModel] = useState(props.model.jGISModel);
|
|
30
|
-
(_a = props.model) === null || _a === void 0 ? void 0 : _a.documentChanged.connect((_, widget) => {
|
|
31
|
-
setModel(widget === null || widget === void 0 ? void 0 : widget.model);
|
|
32
|
-
});
|
|
33
|
-
// Reset state values when current widget changes
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
const handleCurrentChanged = () => {
|
|
36
|
-
var _a;
|
|
37
|
-
if (((_a = props.tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.id) === widgetId) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (props.tracker.currentWidget) {
|
|
41
|
-
setWidgetId(props.tracker.currentWidget.id);
|
|
42
|
-
}
|
|
43
|
-
setFeaturesInLayer({});
|
|
44
|
-
setFilterRows([]);
|
|
45
|
-
setLogicalOp('all');
|
|
46
|
-
setSelectedLayer('');
|
|
47
|
-
};
|
|
48
|
-
props.tracker.currentChanged.connect(handleCurrentChanged);
|
|
49
|
-
return () => {
|
|
50
|
-
props.tracker.currentChanged.disconnect(handleCurrentChanged);
|
|
51
|
-
};
|
|
52
|
-
}, []);
|
|
53
13
|
useEffect(() => {
|
|
54
14
|
var _a, _b, _c, _d;
|
|
55
15
|
// Keep layer selected when widget changes
|
|
56
16
|
if ((_b = (_a = model === null || model === void 0 ? void 0 : model.localState) === null || _a === void 0 ? void 0 : _a.selected) === null || _b === void 0 ? void 0 : _b.value) {
|
|
57
17
|
setSelectedLayer(Object.keys((_d = (_c = model === null || model === void 0 ? void 0 : model.localState) === null || _c === void 0 ? void 0 : _c.selected) === null || _d === void 0 ? void 0 : _d.value)[0]);
|
|
58
18
|
}
|
|
59
|
-
}, [
|
|
19
|
+
}, []);
|
|
60
20
|
useEffect(() => {
|
|
61
21
|
const handleClientStateChanged = () => {
|
|
62
22
|
var _a, _b, _c, _d;
|
|
@@ -68,13 +28,13 @@ const FilterComponent = props => {
|
|
|
68
28
|
setSelectedLayer(currentLayer);
|
|
69
29
|
};
|
|
70
30
|
const handleSharedOptionsChanged = (_, keys) => {
|
|
71
|
-
var _a, _b, _c, _d
|
|
31
|
+
var _a, _b, _c, _d;
|
|
72
32
|
// model changes when current widget changes, don't want this to run in that case
|
|
73
|
-
if (
|
|
74
|
-
if (!((
|
|
33
|
+
if (keys.has('zoom')) {
|
|
34
|
+
if (!((_b = (_a = model === null || model === void 0 ? void 0 : model.localState) === null || _a === void 0 ? void 0 : _a.selected) === null || _b === void 0 ? void 0 : _b.value)) {
|
|
75
35
|
return;
|
|
76
36
|
}
|
|
77
|
-
const currentLayer = Object.keys((
|
|
37
|
+
const currentLayer = Object.keys((_d = (_c = model === null || model === void 0 ? void 0 : model.localState) === null || _c === void 0 ? void 0 : _c.selected) === null || _d === void 0 ? void 0 : _d.value)[0];
|
|
78
38
|
// TODO: Probably want to debounce/throttle here
|
|
79
39
|
buildFilterDebounce(currentLayer);
|
|
80
40
|
}
|
|
@@ -189,19 +149,26 @@ const FilterComponent = props => {
|
|
|
189
149
|
if (!layer) {
|
|
190
150
|
return;
|
|
191
151
|
}
|
|
192
|
-
layer.filters = {
|
|
152
|
+
layer.filters = {
|
|
153
|
+
logicalOp: op !== null && op !== void 0 ? op : logicalOp,
|
|
154
|
+
appliedFilters: filters,
|
|
155
|
+
};
|
|
193
156
|
model === null || model === void 0 ? void 0 : model.sharedModel.updateLayer(selectedLayer, layer);
|
|
194
157
|
};
|
|
195
|
-
return (React.createElement(React.Fragment, null,
|
|
196
|
-
React.createElement("div", {
|
|
197
|
-
React.createElement("
|
|
198
|
-
React.createElement("
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
React.createElement("div", {
|
|
203
|
-
React.createElement(
|
|
204
|
-
|
|
205
|
-
|
|
158
|
+
return (React.createElement(React.Fragment, null,
|
|
159
|
+
shouldDisplay && (React.createElement("div", { className: "jp-gis-filter-main" },
|
|
160
|
+
React.createElement("div", { id: "filter-container", className: "jp-gis-filter-select-container" },
|
|
161
|
+
React.createElement("select", { className: "jp-mod-styled rjsf jp-gis-logical-select", onChange: handleLogicalOpChange },
|
|
162
|
+
React.createElement("option", { key: "all", value: "all", selected: logicalOp === 'all' }, "All"),
|
|
163
|
+
React.createElement("option", { key: "any", value: "any", selected: logicalOp === 'any' }, "Any")),
|
|
164
|
+
filterRows.map((row, index) => (React.createElement(FilterRow, { key: index, index: index, features: featuresInLayer, filterRows: filterRows, setFilterRows: setFilterRows, deleteRow: () => deleteRow(index) })))),
|
|
165
|
+
React.createElement("div", { className: "jp-gis-filter-button-container" },
|
|
166
|
+
React.createElement("div", { style: {
|
|
167
|
+
justifyContent: 'flex-start',
|
|
168
|
+
} },
|
|
169
|
+
React.createElement(Button, { className: "jp-Dialog-button jp-mod-accept jp-mod-styled", onClick: addFilterRow }, "Add"),
|
|
170
|
+
React.createElement(Button, { className: "jp-Dialog-button jp-mod-reject jp-mod-styled", onClick: clearFilters }, "Clear")),
|
|
171
|
+
React.createElement(Button, { className: "jp-Dialog-button jp-mod-accept jp-mod-styled", onClick: submitFilter }, "Submit")))),
|
|
172
|
+
!shouldDisplay && (React.createElement("div", { style: { textAlign: 'center' } }, "No layer selected"))));
|
|
206
173
|
};
|
|
207
174
|
export default FilterComponent;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
constructor(options: IdentifyPanel.IOptions);
|
|
6
|
-
private _model;
|
|
7
|
-
private _tracker;
|
|
1
|
+
import { IJupyterGISModel } from '@jupytergis/schema';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface IIdentifyComponentProps {
|
|
4
|
+
model: IJupyterGISModel;
|
|
8
5
|
}
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
model: IControlPanelModel;
|
|
12
|
-
tracker: IJupyterGISTracker;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export default IdentifyPanel;
|
|
6
|
+
export declare const IdentifyPanelComponent: React.FC<IIdentifyComponentProps>;
|
|
7
|
+
export {};
|