@jupytergis/schema 0.4.5 → 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.
- package/lib/_interface/project/jgis.d.ts +1 -0
- package/lib/_interface/version.d.ts +1 -0
- package/lib/_interface/version.js +1 -0
- package/lib/doc.js +2 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/interfaces.d.ts +4 -0
- package/lib/model.d.ts +10 -1
- package/lib/model.js +23 -1
- package/lib/schema/project/jgis.json +4 -0
- package/lib/types.d.ts +1 -0
- package/lib/types.js +1 -0
- package/package.json +2 -2
|
@@ -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
|
|
70
|
+
return SCHEMA_VERSION;
|
|
70
71
|
}
|
|
71
72
|
get layers() {
|
|
72
73
|
return JSONExt.deepCopy(this._layers.toJSON());
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/interfaces.d.ts
CHANGED
|
@@ -146,6 +146,7 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
|
|
|
146
146
|
highlightFeatureSignal: Signal<IJupyterGISModel, any>;
|
|
147
147
|
contentsManager: Contents.IManager | undefined;
|
|
148
148
|
filePath: string;
|
|
149
|
+
getSettings(): IJupyterGISSettings;
|
|
149
150
|
getContent(): IJGISContent;
|
|
150
151
|
getLayers(): IJGISLayers;
|
|
151
152
|
getLayer(id: string): IJGISLayer | undefined;
|
|
@@ -279,3 +280,6 @@ export interface IAnnotation {
|
|
|
279
280
|
parent: string;
|
|
280
281
|
open: boolean;
|
|
281
282
|
}
|
|
283
|
+
export interface IJupyterGISSettings {
|
|
284
|
+
proxyUrl: string;
|
|
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, JgisCoordinates, 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;
|
|
@@ -151,6 +157,8 @@ export declare class JupyterGISModel implements IJupyterGISModel {
|
|
|
151
157
|
readonly defaultKernelName: string;
|
|
152
158
|
readonly defaultKernelLanguage: string;
|
|
153
159
|
readonly annotationModel?: IAnnotationModel;
|
|
160
|
+
readonly settingRegistry?: ISettingRegistry;
|
|
161
|
+
private _settings;
|
|
154
162
|
private _sharedModel;
|
|
155
163
|
private _filePath;
|
|
156
164
|
private _contentsManager?;
|
|
@@ -181,5 +189,6 @@ export declare namespace JupyterGISModel {
|
|
|
181
189
|
function getOrderedLayerIds(model: IJupyterGISModel): string[];
|
|
182
190
|
interface IOptions extends DocumentRegistry.IModelOptions<IJupyterGISDoc> {
|
|
183
191
|
annotationModel?: IAnnotationModel;
|
|
192
|
+
settingRegistry?: ISettingRegistry;
|
|
184
193
|
}
|
|
185
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) => {
|
|
@@ -45,7 +46,7 @@ export class JupyterGISModel {
|
|
|
45
46
|
this._isIdentifying = false;
|
|
46
47
|
this._isTemporalControllerActive = false;
|
|
47
48
|
this._geolocationChanged = new Signal(this);
|
|
48
|
-
const { annotationModel, sharedModel } = options;
|
|
49
|
+
const { annotationModel, sharedModel, settingRegistry } = options;
|
|
49
50
|
if (sharedModel) {
|
|
50
51
|
this._sharedModel = sharedModel;
|
|
51
52
|
}
|
|
@@ -56,6 +57,23 @@ export class JupyterGISModel {
|
|
|
56
57
|
this.sharedModel.awareness.on('change', this._onClientStateChanged);
|
|
57
58
|
this._sharedModel.metadataChanged.connect(this._metadataChangedHandler, this);
|
|
58
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;
|
|
59
77
|
}
|
|
60
78
|
get sharedModel() {
|
|
61
79
|
return this._sharedModel;
|
|
@@ -323,8 +341,12 @@ export class JupyterGISModel {
|
|
|
323
341
|
this._addLayerTreeItem(id, groupName, position);
|
|
324
342
|
}
|
|
325
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;
|
|
326
347
|
this._removeLayerTreeLayer(this.getLayerTree(), layer_id);
|
|
327
348
|
this.sharedModel.removeLayer(layer_id);
|
|
349
|
+
this.sharedModel.removeSource(source_id);
|
|
328
350
|
}
|
|
329
351
|
setOptions(value) {
|
|
330
352
|
this._sharedModel.options = value;
|
package/lib/types.d.ts
CHANGED
package/lib/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupytergis/schema",
|
|
3
|
-
"version": "0.
|
|
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/
|
|
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",
|