@jupytergis/schema 0.8.0 → 0.9.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.
@@ -4,6 +4,7 @@ import { IChangedArgs } from '@jupyterlab/coreutils';
4
4
  import { IDocumentManager } from '@jupyterlab/docmanager';
5
5
  import { DocumentRegistry, IDocumentWidget } from '@jupyterlab/docregistry';
6
6
  import { Contents, User } from '@jupyterlab/services';
7
+ import { ISettingRegistry } from '@jupyterlab/settingregistry';
7
8
  import { JSONObject } from '@lumino/coreutils';
8
9
  import { ISignal, Signal } from '@lumino/signaling';
9
10
  import { SplitPanel } from '@lumino/widgets';
@@ -132,6 +133,7 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
132
133
  geolocation: JgisCoordinates;
133
134
  localState: IJupyterGISClientState | null;
134
135
  annotationModel?: IAnnotationModel;
136
+ currentMode: 'panning' | 'identifying';
135
137
  themeChanged: Signal<IJupyterGISModel, IChangedArgs<string, string | null, string>>;
136
138
  clientStateChanged: ISignal<IJupyterGISModel, Map<number, IJupyterGISClientState>>;
137
139
  sharedOptionsChanged: ISignal<IJupyterGISDoc, MapChange>;
@@ -156,7 +158,9 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
156
158
  sourceId: string;
157
159
  features: FeatureLike[];
158
160
  }) => void;
159
- getSettings(): IJupyterGISSettings;
161
+ getSettings(): Promise<ISettingRegistry.ISettings>;
162
+ settingsChanged: ISignal<IJupyterGISModel, string>;
163
+ jgisSettings: IJupyterGISSettings;
160
164
  getContent(): IJGISContent;
161
165
  getLayers(): IJGISLayers;
162
166
  getLayer(id: string): IJGISLayer | undefined;
@@ -190,7 +194,6 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
190
194
  removeMetadata(key: string): void;
191
195
  centerOnPosition(id: string): void;
192
196
  toggleIdentify(): void;
193
- isIdentifying: boolean;
194
197
  isTemporalControllerActive: boolean;
195
198
  toggleTemporalController(): void;
196
199
  addFeatureAsMs(id: string, selectedFeature: string): void;
@@ -292,4 +295,12 @@ export interface IAnnotation {
292
295
  }
293
296
  export interface IJupyterGISSettings {
294
297
  proxyUrl: string;
298
+ leftPanelDisabled?: boolean;
299
+ rightPanelDisabled?: boolean;
300
+ layersDisabled?: boolean;
301
+ stacBrowserDisabled?: boolean;
302
+ filtersDisabled?: boolean;
303
+ objectPropertiesDisabled?: boolean;
304
+ annotationsDisabled?: boolean;
305
+ identifyDisabled?: boolean;
295
306
  }
package/lib/model.d.ts CHANGED
@@ -14,7 +14,16 @@ export declare class JupyterGISModel implements IJupyterGISModel {
14
14
  * Initialize custom settings for JupyterLab.
15
15
  */
16
16
  initSettings(): Promise<void>;
17
- getSettings(): IJupyterGISSettings;
17
+ private _updateLocalSettings;
18
+ get jgisSettings(): IJupyterGISSettings;
19
+ /**
20
+ * Expose the settingsChanged signal for external use.
21
+ */
22
+ get settingsChanged(): ISignal<JupyterGISModel, string>;
23
+ /**
24
+ * Return stored settings.
25
+ */
26
+ getSettings(): Promise<ISettingRegistry.ISettings>;
18
27
  getFeaturesForCurrentTile({ sourceId }: {
19
28
  sourceId: string;
20
29
  }): FeatureLike[];
@@ -46,8 +55,6 @@ export declare class JupyterGISModel implements IJupyterGISModel {
46
55
  get disposed(): ISignal<JupyterGISModel, void>;
47
56
  get sharedMetadataChanged(): ISignal<this, MapChange>;
48
57
  get zoomToPositionSignal(): ISignal<this, string>;
49
- set isIdentifying(isIdentifying: boolean);
50
- get isIdentifying(): boolean;
51
58
  set isTemporalControllerActive(isActive: boolean);
52
59
  get isTemporalControllerActive(): boolean;
53
60
  centerOnPosition(id: string): void;
@@ -154,6 +161,8 @@ export declare class JupyterGISModel implements IJupyterGISModel {
154
161
  renameLayerGroup(groupName: string, newName: string): void;
155
162
  removeLayerGroup(groupName: string): void;
156
163
  toggleIdentify(): void;
164
+ get currentMode(): 'panning' | 'identifying';
165
+ set currentMode(value: 'panning' | 'identifying');
157
166
  toggleTemporalController(): void;
158
167
  private _getLayerTreeInfo;
159
168
  private _onClientStateChanged;
@@ -169,6 +178,9 @@ export declare class JupyterGISModel implements IJupyterGISModel {
169
178
  readonly annotationModel?: IAnnotationModel;
170
179
  readonly settingRegistry?: ISettingRegistry;
171
180
  private _settings;
181
+ private _settingsChanged;
182
+ private _jgisSettings;
183
+ private _currentMode;
172
184
  private _sharedModel;
173
185
  private _filePath;
174
186
  private _contentsManager?;
@@ -187,7 +199,6 @@ export declare class JupyterGISModel implements IJupyterGISModel {
187
199
  private _zoomToPositionSignal;
188
200
  private _addFeatureAsMsSignal;
189
201
  private _updateLayerSignal;
190
- private _isIdentifying;
191
202
  private _isTemporalControllerActive;
192
203
  static worker: Worker;
193
204
  private _geolocation;
package/lib/model.js CHANGED
@@ -44,7 +44,6 @@ export class JupyterGISModel {
44
44
  this._zoomToPositionSignal = new Signal(this);
45
45
  this._addFeatureAsMsSignal = new Signal(this);
46
46
  this._updateLayerSignal = new Signal(this);
47
- this._isIdentifying = false;
48
47
  this._isTemporalControllerActive = false;
49
48
  this._geolocationChanged = new Signal(this);
50
49
  this._tileFeatureCache = new Map();
@@ -61,21 +60,95 @@ export class JupyterGISModel {
61
60
  this.annotationModel = annotationModel;
62
61
  this.settingRegistry = settingRegistry;
63
62
  this._pathChanged = new Signal(this);
63
+ this._settingsChanged = new Signal(this);
64
+ this._jgisSettings = {
65
+ proxyUrl: 'https://corsproxy.io',
66
+ leftPanelDisabled: false,
67
+ rightPanelDisabled: false,
68
+ layersDisabled: false,
69
+ stacBrowserDisabled: false,
70
+ filtersDisabled: false,
71
+ objectPropertiesDisabled: false,
72
+ annotationsDisabled: false,
73
+ identifyDisabled: false,
74
+ };
75
+ this.initSettings();
64
76
  }
65
77
  /**
66
78
  * Initialize custom settings for JupyterLab.
67
79
  */
68
80
  async initSettings() {
69
81
  if (this.settingRegistry) {
70
- const setting = await this.settingRegistry.load(SETTINGS_ID);
71
- this._settings = setting.composite;
72
- setting.changed.connect(() => {
73
- this._settings = setting.composite;
74
- console.log('JupyterGIS Settings updated:', this._settings);
75
- });
82
+ try {
83
+ const setting = await this.settingRegistry.load(SETTINGS_ID);
84
+ this._settings = setting;
85
+ this._updateLocalSettings();
86
+ setting.changed.connect(() => {
87
+ const oldSettings = Object.assign({}, this._jgisSettings);
88
+ this._updateLocalSettings();
89
+ const newSettings = this._jgisSettings;
90
+ const keys = [
91
+ 'proxyUrl',
92
+ 'leftPanelDisabled',
93
+ 'rightPanelDisabled',
94
+ 'layersDisabled',
95
+ 'stacBrowserDisabled',
96
+ 'filtersDisabled',
97
+ 'objectPropertiesDisabled',
98
+ 'annotationsDisabled',
99
+ 'identifyDisabled',
100
+ ];
101
+ keys.forEach(key => {
102
+ if (oldSettings[key] !== newSettings[key]) {
103
+ this._settingsChanged.emit(key);
104
+ }
105
+ });
106
+ });
107
+ }
108
+ catch (error) {
109
+ console.error(`Failed to load settings for ${SETTINGS_ID}:`, error);
110
+ this._jgisSettings = {
111
+ proxyUrl: 'https://corsproxy.io',
112
+ leftPanelDisabled: false,
113
+ rightPanelDisabled: false,
114
+ layersDisabled: false,
115
+ stacBrowserDisabled: false,
116
+ filtersDisabled: false,
117
+ objectPropertiesDisabled: false,
118
+ annotationsDisabled: false,
119
+ identifyDisabled: false,
120
+ };
121
+ }
76
122
  }
77
123
  }
78
- getSettings() {
124
+ _updateLocalSettings() {
125
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
126
+ const composite = this._settings.composite;
127
+ this._jgisSettings = {
128
+ proxyUrl: (_a = composite.proxyUrl) !== null && _a !== void 0 ? _a : 'https://corsproxy.io',
129
+ leftPanelDisabled: (_b = composite.leftPanelDisabled) !== null && _b !== void 0 ? _b : false,
130
+ rightPanelDisabled: (_c = composite.rightPanelDisabled) !== null && _c !== void 0 ? _c : false,
131
+ layersDisabled: (_d = composite.layersDisabled) !== null && _d !== void 0 ? _d : false,
132
+ stacBrowserDisabled: (_e = composite.stacBrowserDisabled) !== null && _e !== void 0 ? _e : false,
133
+ filtersDisabled: (_f = composite.filtersDisabled) !== null && _f !== void 0 ? _f : false,
134
+ objectPropertiesDisabled: (_g = composite.objectPropertiesDisabled) !== null && _g !== void 0 ? _g : false,
135
+ annotationsDisabled: (_h = composite.annotationsDisabled) !== null && _h !== void 0 ? _h : false,
136
+ identifyDisabled: (_j = composite.identifyDisabled) !== null && _j !== void 0 ? _j : false,
137
+ };
138
+ }
139
+ get jgisSettings() {
140
+ return this._jgisSettings;
141
+ }
142
+ /**
143
+ * Expose the settingsChanged signal for external use.
144
+ */
145
+ get settingsChanged() {
146
+ return this._settingsChanged;
147
+ }
148
+ /**
149
+ * Return stored settings.
150
+ */
151
+ async getSettings() {
79
152
  return this._settings;
80
153
  }
81
154
  getFeaturesForCurrentTile({ sourceId }) {
@@ -165,12 +238,6 @@ export class JupyterGISModel {
165
238
  get zoomToPositionSignal() {
166
239
  return this._zoomToPositionSignal;
167
240
  }
168
- set isIdentifying(isIdentifying) {
169
- this._isIdentifying = isIdentifying;
170
- }
171
- get isIdentifying() {
172
- return this._isIdentifying;
173
- }
174
241
  set isTemporalControllerActive(isActive) {
175
242
  this._isTemporalControllerActive = isActive;
176
243
  }
@@ -546,7 +613,18 @@ export class JupyterGISModel {
546
613
  }
547
614
  }
548
615
  toggleIdentify() {
549
- this._isIdentifying = !this._isIdentifying;
616
+ if (this._currentMode === 'identifying') {
617
+ this._currentMode = 'panning';
618
+ }
619
+ else {
620
+ this._currentMode = 'identifying';
621
+ }
622
+ }
623
+ get currentMode() {
624
+ return this._currentMode;
625
+ }
626
+ set currentMode(value) {
627
+ this._currentMode = value;
550
628
  }
551
629
  toggleTemporalController() {
552
630
  this._isTemporalControllerActive = !this._isTemporalControllerActive;
@@ -1,6 +1,6 @@
1
+ export * from '../../_interface/processing/centroids';
1
2
  export * from '../../_interface/processing/buffer';
2
3
  export * from '../../_interface/processing/concaveHull';
3
- export * from '../../_interface/processing/centroids';
4
+ export * from '../../_interface/processing/boundingBoxes';
4
5
  export * from '../../_interface/processing/convexHull';
5
6
  export * from '../../_interface/processing/dissolve';
6
- export * from '../../_interface/processing/boundingBoxes';
@@ -1,7 +1,7 @@
1
1
  //Generated automatically please don't modify directly
2
+ export * from '../../_interface/processing/centroids';
2
3
  export * from '../../_interface/processing/buffer';
3
4
  export * from '../../_interface/processing/concaveHull';
4
- export * from '../../_interface/processing/centroids';
5
+ export * from '../../_interface/processing/boundingBoxes';
5
6
  export * from '../../_interface/processing/convexHull';
6
7
  export * from '../../_interface/processing/dissolve';
7
- export * from '../../_interface/processing/boundingBoxes';
@@ -1,2 +1,2 @@
1
- export type ProcessingType = 'Buffer' | 'ConcaveHull' | 'Centroids' | 'ConvexHull' | 'Dissolve' | 'BoundingBoxes';
1
+ export type ProcessingType = 'Centroids' | 'Buffer' | 'ConcaveHull' | 'BoundingBoxes' | 'ConvexHull' | 'Dissolve';
2
2
  export declare const processingList: string[];
@@ -1,8 +1,8 @@
1
1
  export const processingList = [
2
+ 'Centroids',
2
3
  'Buffer',
3
4
  'ConcaveHull',
4
- 'Centroids',
5
+ 'BoundingBoxes',
5
6
  'ConvexHull',
6
7
  'Dissolve',
7
- 'BoundingBoxes',
8
8
  ];
@@ -1,4 +1,15 @@
1
1
  [
2
+ {
3
+ "description": "Centroids",
4
+ "name": "centroids",
5
+ "operationParams": [],
6
+ "label": "Centroids",
7
+ "operations": {
8
+ "gdalFunction": "ogr2ogr",
9
+ "sql": "SELECT ST_Centroid(geometry) AS geometry, * FROM \"{layerName}\""
10
+ },
11
+ "type": "vector"
12
+ },
2
13
  {
3
14
  "description": "Buffer",
4
15
  "name": "buffer",
@@ -27,13 +38,13 @@
27
38
  "type": "vector"
28
39
  },
29
40
  {
30
- "description": "Centroids",
31
- "name": "centroids",
41
+ "description": "BoundingBoxes",
42
+ "name": "boundingBoxes",
32
43
  "operationParams": [],
33
- "label": "Centroids",
44
+ "label": "Bounding Boxes",
34
45
  "operations": {
35
- "gdalFunction": "ogr2ogr",
36
- "sql": "SELECT ST_Centroid(geometry) AS geometry, * FROM \"{layerName}\""
46
+ "sql": "SELECT ST_Envelope(geometry) AS geometry, * FROM \"{layerName}\"",
47
+ "gdalFunction": "ogr2ogr"
37
48
  },
38
49
  "type": "vector"
39
50
  },
@@ -60,16 +71,5 @@
60
71
  "sql": "SELECT ST_Union(geometry) AS geometry, {dissolveField} FROM \"{layerName}\" GROUP BY {dissolveField}"
61
72
  },
62
73
  "type": "vector"
63
- },
64
- {
65
- "description": "BoundingBoxes",
66
- "name": "boundingBoxes",
67
- "operationParams": [],
68
- "label": "Bounding Boxes",
69
- "operations": {
70
- "sql": "SELECT ST_Envelope(geometry) AS geometry, * FROM \"{layerName}\"",
71
- "gdalFunction": "ogr2ogr"
72
- },
73
- "type": "vector"
74
74
  }
75
75
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/schema",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "A JupyterGIS schema package.",
5
5
  "keywords": [
6
6
  "jupytergis"