@jupytergis/schema 0.4.4 → 0.5.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.
@@ -42,6 +42,7 @@ export type IJGISLayerItem = string | IJGISLayerGroup;
42
42
  export type IJGISLayerTree = IJGISLayerItem[];
43
43
 
44
44
  export interface IJGISContent {
45
+ schemaVersion?: string;
45
46
  layers: IJGISLayers;
46
47
  sources: IJGISSources;
47
48
  layerTree?: IJGISLayerTree;
@@ -0,0 +1 @@
1
+ export declare const SCHEMA_VERSION = '0.5.0';
@@ -0,0 +1 @@
1
+ export const SCHEMA_VERSION = '0.5.0';
package/lib/doc.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { YDocument } from '@jupyter/ydoc';
2
2
  import { JSONExt } from '@lumino/coreutils';
3
3
  import { Signal } from '@lumino/signaling';
4
+ import { SCHEMA_VERSION } from './_interface/version';
4
5
  export class JupyterGISDoc extends YDocument {
5
6
  constructor() {
6
7
  super();
@@ -66,7 +67,7 @@ export class JupyterGISDoc extends YDocument {
66
67
  super.dispose();
67
68
  }
68
69
  get version() {
69
- return '0.1.0';
70
+ return SCHEMA_VERSION;
70
71
  }
71
72
  get layers() {
72
73
  return JSONExt.deepCopy(this._layers.toJSON());
package/lib/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './interfaces';
2
2
  export * from './model';
3
3
  export * from './token';
4
4
  export * from './doc';
5
+ export { SCHEMA_VERSION } from './_interface/version';
package/lib/index.js CHANGED
@@ -2,3 +2,4 @@ export * from './interfaces';
2
2
  export * from './model';
3
3
  export * from './token';
4
4
  export * from './doc';
5
+ export { SCHEMA_VERSION } from './_interface/version';
@@ -128,6 +128,7 @@ export interface IJupyterGISDocChange extends DocumentChange {
128
128
  export interface IJupyterGISModel extends DocumentRegistry.IModel {
129
129
  isDisposed: boolean;
130
130
  sharedModel: IJupyterGISDoc;
131
+ geolocation: JgisCoordinates;
131
132
  localState: IJupyterGISClientState | null;
132
133
  annotationModel?: IAnnotationModel;
133
134
  themeChanged: Signal<IJupyterGISModel, IChangedArgs<string, string | null, string>>;
@@ -140,8 +141,12 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
140
141
  zoomToPositionSignal: ISignal<IJupyterGISModel, string>;
141
142
  addFeatureAsMsSignal: ISignal<IJupyterGISModel, string>;
142
143
  updateLayerSignal: ISignal<IJupyterGISModel, string>;
144
+ geolocationChanged: Signal<IJupyterGISModel, JgisCoordinates>;
145
+ flyToGeometrySignal: Signal<IJupyterGISModel, any>;
146
+ highlightFeatureSignal: Signal<IJupyterGISModel, any>;
143
147
  contentsManager: Contents.IManager | undefined;
144
148
  filePath: string;
149
+ getSettings(): IJupyterGISSettings;
145
150
  getContent(): IJGISContent;
146
151
  getLayers(): IJGISLayers;
147
152
  getLayer(id: string): IJGISLayer | undefined;
@@ -256,6 +261,7 @@ export interface IAnnotationModel {
256
261
  getAnnotation(id: string): IAnnotation | undefined;
257
262
  getAnnotationIds(): string[];
258
263
  addAnnotation(key: string, value: IAnnotation): void;
264
+ updateAnnotation(id: string, updates: Partial<IAnnotation>): void;
259
265
  removeAnnotation(key: string): void;
260
266
  addContent(id: string, value: string): void;
261
267
  }
@@ -272,4 +278,8 @@ export interface IAnnotation {
272
278
  zoom: number;
273
279
  contents: IAnnotationContent[];
274
280
  parent: string;
281
+ open: boolean;
282
+ }
283
+ export interface IJupyterGISSettings {
284
+ proxyUrl: string;
275
285
  }
package/lib/model.d.ts CHANGED
@@ -5,9 +5,15 @@ import { Contents } from '@jupyterlab/services';
5
5
  import { PartialJSONObject } from '@lumino/coreutils';
6
6
  import { ISignal, Signal } from '@lumino/signaling';
7
7
  import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerTree, IJGISLayers, IJGISOptions, IJGISSource, IJGISSources } from './_interface/project/jgis';
8
- import { IAnnotationModel, IDict, IJGISLayerDocChange, IJGISLayerTreeDocChange, IJGISSourceDocChange, IJupyterGISClientState, IJupyterGISDoc, IJupyterGISModel, ISelection, IUserData, IViewPortState, Pointer } from './interfaces';
8
+ import { IAnnotationModel, IDict, IJGISLayerDocChange, IJGISLayerTreeDocChange, IJGISSourceDocChange, IJupyterGISClientState, IJupyterGISDoc, IJupyterGISModel, ISelection, IUserData, IViewPortState, JgisCoordinates, Pointer, IJupyterGISSettings } from './interfaces';
9
+ import { ISettingRegistry } from '@jupyterlab/settingregistry';
9
10
  export declare class JupyterGISModel implements IJupyterGISModel {
10
11
  constructor(options: JupyterGISModel.IOptions);
12
+ /**
13
+ * Initialize custom settings for JupyterLab.
14
+ */
15
+ initSettings(): Promise<void>;
16
+ getSettings(): IJupyterGISSettings;
11
17
  private _onSharedModelChanged;
12
18
  readonly collaborative: boolean;
13
19
  get sharedModel(): IJupyterGISDoc;
@@ -46,6 +52,8 @@ export declare class JupyterGISModel implements IJupyterGISModel {
46
52
  fromJSON(data: PartialJSONObject): void;
47
53
  initialize(): void;
48
54
  getWorker(): Worker;
55
+ readonly flyToGeometrySignal: Signal<this, any>;
56
+ readonly highlightFeatureSignal: Signal<this, any>;
49
57
  getContent(): IJGISContent;
50
58
  /**
51
59
  * Getter for the contents manager.
@@ -143,9 +151,14 @@ export declare class JupyterGISModel implements IJupyterGISModel {
143
151
  get addFeatureAsMsSignal(): Signal<this, string>;
144
152
  get updateLayerSignal(): Signal<this, string>;
145
153
  triggerLayerUpdate: (layerId: string, layer: IJGISLayer) => void;
154
+ get geolocation(): JgisCoordinates;
155
+ set geolocation(geolocation: JgisCoordinates);
156
+ get geolocationChanged(): Signal<this, JgisCoordinates>;
146
157
  readonly defaultKernelName: string;
147
158
  readonly defaultKernelLanguage: string;
148
159
  readonly annotationModel?: IAnnotationModel;
160
+ readonly settingRegistry?: ISettingRegistry;
161
+ private _settings;
149
162
  private _sharedModel;
150
163
  private _filePath;
151
164
  private _contentsManager?;
@@ -166,6 +179,8 @@ export declare class JupyterGISModel implements IJupyterGISModel {
166
179
  private _isIdentifying;
167
180
  private _isTemporalControllerActive;
168
181
  static worker: Worker;
182
+ private _geolocation;
183
+ private _geolocationChanged;
169
184
  }
170
185
  export declare namespace JupyterGISModel {
171
186
  /**
@@ -174,5 +189,6 @@ export declare namespace JupyterGISModel {
174
189
  function getOrderedLayerIds(model: IJupyterGISModel): string[];
175
190
  interface IOptions extends DocumentRegistry.IModelOptions<IJupyterGISDoc> {
176
191
  annotationModel?: IAnnotationModel;
192
+ settingRegistry?: ISettingRegistry;
177
193
  }
178
194
  }
package/lib/model.js CHANGED
@@ -2,6 +2,7 @@ import { Signal } from '@lumino/signaling';
2
2
  import Ajv from 'ajv';
3
3
  import { JupyterGISDoc } from './doc';
4
4
  import jgisSchema from './schema/project/jgis.json';
5
+ const SETTINGS_ID = '@jupytergis/jupytergis-core:jupytergis-settings';
5
6
  export class JupyterGISModel {
6
7
  constructor(options) {
7
8
  this._onSharedModelChanged = (sender, changes) => {
@@ -12,6 +13,8 @@ export class JupyterGISModel {
12
13
  }
13
14
  };
14
15
  this.collaborative = document.querySelectorAll('[data-jupyter-lite-root]')[0] === undefined;
16
+ this.flyToGeometrySignal = new Signal(this);
17
+ this.highlightFeatureSignal = new Signal(this);
15
18
  this._onClientStateChanged = (changed) => {
16
19
  const clients = this.sharedModel.awareness.getStates();
17
20
  this._clientStateChanged.emit(clients);
@@ -42,7 +45,8 @@ export class JupyterGISModel {
42
45
  this._updateLayerSignal = new Signal(this);
43
46
  this._isIdentifying = false;
44
47
  this._isTemporalControllerActive = false;
45
- const { annotationModel, sharedModel } = options;
48
+ this._geolocationChanged = new Signal(this);
49
+ const { annotationModel, sharedModel, settingRegistry } = options;
46
50
  if (sharedModel) {
47
51
  this._sharedModel = sharedModel;
48
52
  }
@@ -53,6 +57,23 @@ export class JupyterGISModel {
53
57
  this.sharedModel.awareness.on('change', this._onClientStateChanged);
54
58
  this._sharedModel.metadataChanged.connect(this._metadataChangedHandler, this);
55
59
  this.annotationModel = annotationModel;
60
+ this.settingRegistry = settingRegistry;
61
+ }
62
+ /**
63
+ * Initialize custom settings for JupyterLab.
64
+ */
65
+ async initSettings() {
66
+ if (this.settingRegistry) {
67
+ const setting = await this.settingRegistry.load(SETTINGS_ID);
68
+ this._settings = setting.composite;
69
+ setting.changed.connect(() => {
70
+ this._settings = setting.composite;
71
+ console.log('JupyterGIS Settings updated:', this._settings);
72
+ });
73
+ }
74
+ }
75
+ getSettings() {
76
+ return this._settings;
56
77
  }
57
78
  get sharedModel() {
58
79
  return this._sharedModel;
@@ -320,8 +341,12 @@ export class JupyterGISModel {
320
341
  this._addLayerTreeItem(id, groupName, position);
321
342
  }
322
343
  removeLayer(layer_id) {
344
+ var _a;
345
+ const layer = this._sharedModel.getLayer(layer_id);
346
+ const source_id = (_a = layer === null || layer === void 0 ? void 0 : layer.parameters) === null || _a === void 0 ? void 0 : _a.source;
323
347
  this._removeLayerTreeLayer(this.getLayerTree(), layer_id);
324
348
  this.sharedModel.removeLayer(layer_id);
349
+ this.sharedModel.removeSource(source_id);
325
350
  }
326
351
  setOptions(value) {
327
352
  this._sharedModel.options = value;
@@ -540,6 +565,16 @@ export class JupyterGISModel {
540
565
  get updateLayerSignal() {
541
566
  return this._updateLayerSignal;
542
567
  }
568
+ get geolocation() {
569
+ return this._geolocation;
570
+ }
571
+ set geolocation(geolocation) {
572
+ this._geolocation = geolocation;
573
+ this.geolocationChanged.emit(this.geolocation);
574
+ }
575
+ get geolocationChanged() {
576
+ return this._geolocationChanged;
577
+ }
543
578
  }
544
579
  (function (JupyterGISModel) {
545
580
  /**
@@ -4,6 +4,10 @@
4
4
  "required": ["layers", "sources"],
5
5
  "additionalProperties": false,
6
6
  "properties": {
7
+ "schemaVersion": {
8
+ "type": "string",
9
+ "default": "0.5.0"
10
+ },
7
11
  "layers": {
8
12
  "$ref": "#/definitions/jGISLayers"
9
13
  },
package/lib/types.d.ts CHANGED
@@ -22,3 +22,4 @@ export * from './doc';
22
22
  export * from './interfaces';
23
23
  export * from './model';
24
24
  export * from './token';
25
+ export * from './index';
package/lib/types.js CHANGED
@@ -27,3 +27,4 @@ export * from './doc';
27
27
  export * from './interfaces';
28
28
  export * from './model';
29
29
  export * from './token';
30
+ export * from './index';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/schema",
3
- "version": "0.4.4",
3
+ "version": "0.5.0",
4
4
  "description": "A JupyterGIS schema package.",
5
5
  "keywords": [
6
6
  "jupytergis"
@@ -28,7 +28,7 @@
28
28
  "build": "jlpm build:schema && jlpm build:lib",
29
29
  "build:schema": "node ./cacheGeoJSONSchema.js && jlpm build:schema:js && jlpm build:schema:py",
30
30
  "build:schema:js": "json2ts -i src/schema -o src/_interface --no-unknownAny --unreachableDefinitions --cwd ./src/schema && cd src/schema && node ../../schema.js",
31
- "build:schema:py": "datamodel-codegen --input ./src/schema --output ../../python/jupytergis_lab/jupytergis_lab/notebook/objects/_schema --output-model-type pydantic_v2.BaseModel --input-file-type jsonschema",
31
+ "build:schema:py": "datamodel-codegen --input ./src/schema --output ../../python/jupytergis_core/jupytergis_core/schema/interfaces --output-model-type pydantic_v2.BaseModel --input-file-type jsonschema",
32
32
  "build:prod": "jlpm run clean && jlpm build:schema && jlpm run build:lib",
33
33
  "build:lib": "tsc -b",
34
34
  "build:dev": "jlpm run build",