@jupytergis/schema 0.2.1 → 0.3.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/forms.json +13 -22
- package/lib/_interface/imageSource.d.ts +2 -2
- package/lib/_interface/rasterDemSource.d.ts +0 -5
- package/lib/_interface/webGlLayer.d.ts +8 -5
- package/lib/doc.d.ts +1 -1
- package/lib/doc.js +4 -0
- package/lib/interfaces.d.ts +6 -5
- package/lib/model.d.ts +20 -12
- package/lib/model.js +29 -28
- package/lib/schema/imageSource.json +3 -3
- package/lib/schema/rasterDemSource.json +0 -10
- package/lib/schema/webGlLayer.json +10 -8
- package/package.json +1 -1
|
@@ -77,15 +77,15 @@
|
|
|
77
77
|
"ImageSource": {
|
|
78
78
|
"type": "object",
|
|
79
79
|
"required": [
|
|
80
|
-
"
|
|
80
|
+
"path",
|
|
81
81
|
"coordinates"
|
|
82
82
|
],
|
|
83
83
|
"additionalProperties": false,
|
|
84
84
|
"properties": {
|
|
85
|
-
"
|
|
85
|
+
"path": {
|
|
86
86
|
"type": "string",
|
|
87
87
|
"readOnly": true,
|
|
88
|
-
"description": "
|
|
88
|
+
"description": "Path that points to an image"
|
|
89
89
|
},
|
|
90
90
|
"coordinates": {
|
|
91
91
|
"type": "array",
|
|
@@ -116,23 +116,10 @@
|
|
|
116
116
|
"type": "string",
|
|
117
117
|
"description": "The url to the tile provider"
|
|
118
118
|
},
|
|
119
|
-
"tileSize": {
|
|
120
|
-
"type": "number",
|
|
121
|
-
"description": " The tile size",
|
|
122
|
-
"default": 512
|
|
123
|
-
},
|
|
124
119
|
"attribution": {
|
|
125
120
|
"type": "string",
|
|
126
121
|
"description": "The attribution for the raster-dem source"
|
|
127
122
|
},
|
|
128
|
-
"encoding": {
|
|
129
|
-
"type": "string",
|
|
130
|
-
"enum": [
|
|
131
|
-
"terrarium",
|
|
132
|
-
"mapbox"
|
|
133
|
-
],
|
|
134
|
-
"default": "mapbox"
|
|
135
|
-
},
|
|
136
123
|
"urlParameters": {
|
|
137
124
|
"type": "object",
|
|
138
125
|
"additionalProperties": {
|
|
@@ -543,12 +530,7 @@
|
|
|
543
530
|
"type": "object",
|
|
544
531
|
"description": "The state of the symbology panel options",
|
|
545
532
|
"required": [
|
|
546
|
-
"renderType"
|
|
547
|
-
"band",
|
|
548
|
-
"interpolation",
|
|
549
|
-
"colorRamp",
|
|
550
|
-
"nClasses",
|
|
551
|
-
"mode"
|
|
533
|
+
"renderType"
|
|
552
534
|
],
|
|
553
535
|
"properties": {
|
|
554
536
|
"renderType": {
|
|
@@ -557,6 +539,15 @@
|
|
|
557
539
|
"band": {
|
|
558
540
|
"type": "number"
|
|
559
541
|
},
|
|
542
|
+
"redBand": {
|
|
543
|
+
"type": "number"
|
|
544
|
+
},
|
|
545
|
+
"greenBand": {
|
|
546
|
+
"type": "number"
|
|
547
|
+
},
|
|
548
|
+
"blueBand": {
|
|
549
|
+
"type": "number"
|
|
550
|
+
},
|
|
560
551
|
"interpolation": {
|
|
561
552
|
"type": "string",
|
|
562
553
|
"enum": [
|
|
@@ -13,15 +13,10 @@ export interface IRasterDemSource {
|
|
|
13
13
|
* The url to the tile provider
|
|
14
14
|
*/
|
|
15
15
|
url: string;
|
|
16
|
-
/**
|
|
17
|
-
* The tile size
|
|
18
|
-
*/
|
|
19
|
-
tileSize?: number;
|
|
20
16
|
/**
|
|
21
17
|
* The attribution for the raster-dem source
|
|
22
18
|
*/
|
|
23
19
|
attribution?: string;
|
|
24
|
-
encoding?: "terrarium" | "mapbox";
|
|
25
20
|
urlParameters?: {
|
|
26
21
|
[k: string]: string;
|
|
27
22
|
};
|
|
@@ -26,10 +26,13 @@ export interface IWebGlLayer {
|
|
|
26
26
|
*/
|
|
27
27
|
symbologyState?: {
|
|
28
28
|
renderType: string;
|
|
29
|
-
band
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
band?: number;
|
|
30
|
+
redBand?: number;
|
|
31
|
+
greenBand?: number;
|
|
32
|
+
blueBand?: number;
|
|
33
|
+
interpolation?: "discrete" | "linear" | "exact";
|
|
34
|
+
colorRamp?: string;
|
|
35
|
+
nClasses?: string;
|
|
36
|
+
mode?: "continuous" | "equal interval" | "quantile";
|
|
34
37
|
};
|
|
35
38
|
}
|
package/lib/doc.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { IDict, IJGISLayerDocChange, IJGISLayerTreeDocChange, IJGISSourceDocChan
|
|
|
6
6
|
export declare class JupyterGISDoc extends YDocument<IJupyterGISDocChange> implements IJupyterGISDoc {
|
|
7
7
|
constructor();
|
|
8
8
|
getSource(): JSONObject;
|
|
9
|
-
setSource(value: JSONObject): void;
|
|
9
|
+
setSource(value: JSONObject | string): void;
|
|
10
10
|
dispose(): void;
|
|
11
11
|
get version(): string;
|
|
12
12
|
get layers(): IJGISLayers;
|
package/lib/doc.js
CHANGED
|
@@ -42,6 +42,10 @@ export class JupyterGISDoc extends YDocument {
|
|
|
42
42
|
if (!value) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
+
if (typeof value === 'string') {
|
|
46
|
+
value = JSON.parse(value);
|
|
47
|
+
}
|
|
48
|
+
value = value;
|
|
45
49
|
this.transact(() => {
|
|
46
50
|
var _a, _b, _c, _d, _e;
|
|
47
51
|
const layers = (_a = value['layers']) !== null && _a !== void 0 ? _a : {};
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { DocumentRegistry, IDocumentWidget } from '@jupyterlab/docregistry';
|
|
|
5
5
|
import { Contents, User } from '@jupyterlab/services';
|
|
6
6
|
import { ISignal, Signal } from '@lumino/signaling';
|
|
7
7
|
import { SplitPanel } from '@lumino/widgets';
|
|
8
|
-
import {
|
|
8
|
+
import { IDocumentManager } from '@jupyterlab/docmanager';
|
|
9
9
|
import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerItem, IJGISLayers, IJGISLayerTree, IJGISOptions, IJGISSource, IJGISSources, SourceType } from './_interface/jgis';
|
|
10
10
|
import { IRasterSource } from './_interface/rastersource';
|
|
11
11
|
export { IGeoJSONSource } from './_interface/geojsonsource';
|
|
@@ -127,8 +127,9 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
|
|
|
127
127
|
sharedLayerTreeChanged: ISignal<IJupyterGISDoc, IJGISLayerTreeDocChange>;
|
|
128
128
|
sharedSourcesChanged: ISignal<IJupyterGISDoc, IJGISSourceDocChange>;
|
|
129
129
|
sharedMetadataChanged: ISignal<IJupyterGISModel, MapChange>;
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
zoomToPositionSignal: ISignal<IJupyterGISModel, string>;
|
|
131
|
+
contentsManager: Contents.IManager | undefined;
|
|
132
|
+
filePath: string;
|
|
132
133
|
getContent(): IJGISContent;
|
|
133
134
|
getLayers(): IJGISLayers;
|
|
134
135
|
getLayer(id: string): IJGISLayer | undefined;
|
|
@@ -143,7 +144,6 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
|
|
|
143
144
|
removeLayer(id: string): void;
|
|
144
145
|
getOptions(): IJGISOptions;
|
|
145
146
|
setOptions(value: IJGISOptions): void;
|
|
146
|
-
readGeoJSON(filepath: string): Promise<GeoJSON | undefined>;
|
|
147
147
|
removeLayerGroup(groupName: string): void;
|
|
148
148
|
renameLayerGroup(groupName: string, newName: string): void;
|
|
149
149
|
moveItemsToGroup(items: string[], groupName: string, index?: number): void;
|
|
@@ -161,7 +161,7 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
|
|
|
161
161
|
getClientId(): number;
|
|
162
162
|
addMetadata(key: string, value: string): void;
|
|
163
163
|
removeMetadata(key: string): void;
|
|
164
|
-
|
|
164
|
+
centerOnPosition(id: string): void;
|
|
165
165
|
toggleIdentify(): void;
|
|
166
166
|
isIdentifying: boolean;
|
|
167
167
|
disposed: ISignal<any, void>;
|
|
@@ -196,6 +196,7 @@ export interface IJGISFormSchemaRegistry {
|
|
|
196
196
|
* @memberof IJGISFormSchemaRegistry
|
|
197
197
|
*/
|
|
198
198
|
has(name: string): boolean;
|
|
199
|
+
getDocManager(): IDocumentManager;
|
|
199
200
|
}
|
|
200
201
|
export interface IJGISExternalCommand {
|
|
201
202
|
name: string;
|
package/lib/model.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { IChangedArgs } from '@jupyterlab/coreutils';
|
|
|
3
3
|
import { DocumentRegistry } from '@jupyterlab/docregistry';
|
|
4
4
|
import { PartialJSONObject } from '@lumino/coreutils';
|
|
5
5
|
import { ISignal, Signal } from '@lumino/signaling';
|
|
6
|
-
import { GeoJSON } from './_interface/geojsonsource';
|
|
7
6
|
import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerTree, IJGISLayers, IJGISOptions, IJGISSource, IJGISSources } from './_interface/jgis';
|
|
8
7
|
import { IViewPortState, Pointer, IAnnotationModel, IJGISLayerDocChange, IJGISLayerTreeDocChange, IJGISSourceDocChange, IJupyterGISClientState, IJupyterGISDoc, IJupyterGISModel, ISelection, IUserData, IDict } from './interfaces';
|
|
9
8
|
import { Contents } from '@jupyterlab/services';
|
|
@@ -31,10 +30,10 @@ export declare class JupyterGISModel implements IJupyterGISModel {
|
|
|
31
30
|
get sharedSourcesChanged(): ISignal<IJupyterGISDoc, IJGISSourceDocChange>;
|
|
32
31
|
get disposed(): ISignal<JupyterGISModel, void>;
|
|
33
32
|
get sharedMetadataChanged(): ISignal<this, MapChange>;
|
|
34
|
-
get
|
|
33
|
+
get zoomToPositionSignal(): ISignal<this, string>;
|
|
35
34
|
set isIdentifying(isIdentifying: boolean);
|
|
36
35
|
get isIdentifying(): boolean;
|
|
37
|
-
|
|
36
|
+
centerOnPosition(id: string): void;
|
|
38
37
|
private _metadataChangedHandler;
|
|
39
38
|
addMetadata(key: string, value: string): void;
|
|
40
39
|
removeMetadata(key: string): void;
|
|
@@ -46,7 +45,23 @@ export declare class JupyterGISModel implements IJupyterGISModel {
|
|
|
46
45
|
initialize(): void;
|
|
47
46
|
getWorker(): Worker;
|
|
48
47
|
getContent(): IJGISContent;
|
|
49
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Getter for the contents manager.
|
|
50
|
+
*/
|
|
51
|
+
get contentsManager(): Contents.IManager | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Setter for the contents manager.
|
|
54
|
+
* Also updates the file path.
|
|
55
|
+
*/
|
|
56
|
+
set contentsManager(manager: Contents.IManager | undefined);
|
|
57
|
+
/**
|
|
58
|
+
* Getter for the file path associated with the contents manager.
|
|
59
|
+
*/
|
|
60
|
+
get filePath(): string;
|
|
61
|
+
/**
|
|
62
|
+
* Setter for the file path associated with the contents manager.
|
|
63
|
+
*/
|
|
64
|
+
set filePath(path: string);
|
|
50
65
|
getLayers(): IJGISLayers;
|
|
51
66
|
getSources(): IJGISSources;
|
|
52
67
|
getLayerTree(): IJGISLayerTree;
|
|
@@ -66,13 +81,6 @@ export declare class JupyterGISModel implements IJupyterGISModel {
|
|
|
66
81
|
* @returns a list of layer ids that use the source.
|
|
67
82
|
*/
|
|
68
83
|
getLayersBySource(id: string): string[];
|
|
69
|
-
/**
|
|
70
|
-
* Read a GeoJSON file.
|
|
71
|
-
*
|
|
72
|
-
* @param filepath - the path of the GeoJSON file.
|
|
73
|
-
* @returns a promise to the GeoJSON data.
|
|
74
|
-
*/
|
|
75
|
-
readGeoJSON(filepath: string): Promise<GeoJSON | undefined>;
|
|
76
84
|
/**
|
|
77
85
|
* Add a layer group in the layer tree.
|
|
78
86
|
*
|
|
@@ -145,7 +153,7 @@ export declare class JupyterGISModel implements IJupyterGISModel {
|
|
|
145
153
|
private _themeChanged;
|
|
146
154
|
private _clientStateChanged;
|
|
147
155
|
private _sharedMetadataChanged;
|
|
148
|
-
private
|
|
156
|
+
private _zoomToPositionSignal;
|
|
149
157
|
private _isIdentifying;
|
|
150
158
|
static worker: Worker;
|
|
151
159
|
}
|
package/lib/model.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PathExt } from '@jupyterlab/coreutils';
|
|
2
1
|
import { Signal } from '@lumino/signaling';
|
|
3
2
|
import Ajv from 'ajv';
|
|
4
3
|
import { JupyterGISDoc } from './doc';
|
|
@@ -32,7 +31,7 @@ export class JupyterGISModel {
|
|
|
32
31
|
this._themeChanged = new Signal(this);
|
|
33
32
|
this._clientStateChanged = new Signal(this);
|
|
34
33
|
this._sharedMetadataChanged = new Signal(this);
|
|
35
|
-
this.
|
|
34
|
+
this._zoomToPositionSignal = new Signal(this);
|
|
36
35
|
this._isIdentifying = false;
|
|
37
36
|
const { annotationModel, sharedModel } = options;
|
|
38
37
|
if (sharedModel) {
|
|
@@ -115,8 +114,8 @@ export class JupyterGISModel {
|
|
|
115
114
|
get sharedMetadataChanged() {
|
|
116
115
|
return this._sharedMetadataChanged;
|
|
117
116
|
}
|
|
118
|
-
get
|
|
119
|
-
return this.
|
|
117
|
+
get zoomToPositionSignal() {
|
|
118
|
+
return this._zoomToPositionSignal;
|
|
120
119
|
}
|
|
121
120
|
set isIdentifying(isIdentifying) {
|
|
122
121
|
this._isIdentifying = isIdentifying;
|
|
@@ -124,8 +123,8 @@ export class JupyterGISModel {
|
|
|
124
123
|
get isIdentifying() {
|
|
125
124
|
return this._isIdentifying;
|
|
126
125
|
}
|
|
127
|
-
|
|
128
|
-
this.
|
|
126
|
+
centerOnPosition(id) {
|
|
127
|
+
this._zoomToPositionSignal.emit(id);
|
|
129
128
|
}
|
|
130
129
|
_metadataChangedHandler(_, args) {
|
|
131
130
|
this._sharedMetadataChanged.emit(args);
|
|
@@ -198,9 +197,30 @@ export class JupyterGISModel {
|
|
|
198
197
|
metadata: this.sharedModel.metadata
|
|
199
198
|
};
|
|
200
199
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
200
|
+
/**
|
|
201
|
+
* Getter for the contents manager.
|
|
202
|
+
*/
|
|
203
|
+
get contentsManager() {
|
|
204
|
+
return this._contentsManager;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Setter for the contents manager.
|
|
208
|
+
* Also updates the file path.
|
|
209
|
+
*/
|
|
210
|
+
set contentsManager(manager) {
|
|
211
|
+
this._contentsManager = manager;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Getter for the file path associated with the contents manager.
|
|
215
|
+
*/
|
|
216
|
+
get filePath() {
|
|
217
|
+
return this._filePath;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Setter for the file path associated with the contents manager.
|
|
221
|
+
*/
|
|
222
|
+
set filePath(path) {
|
|
223
|
+
this._filePath = path;
|
|
204
224
|
}
|
|
205
225
|
getLayers() {
|
|
206
226
|
return this.sharedModel.layers;
|
|
@@ -247,25 +267,6 @@ export class JupyterGISModel {
|
|
|
247
267
|
});
|
|
248
268
|
return usingLayers;
|
|
249
269
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Read a GeoJSON file.
|
|
252
|
-
*
|
|
253
|
-
* @param filepath - the path of the GeoJSON file.
|
|
254
|
-
* @returns a promise to the GeoJSON data.
|
|
255
|
-
*/
|
|
256
|
-
async readGeoJSON(filepath) {
|
|
257
|
-
if (!this._contentsManager) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
const absolutePath = PathExt.resolve(PathExt.dirname(this._filePath), filepath);
|
|
261
|
-
const file = await this._contentsManager.get(absolutePath, {
|
|
262
|
-
content: true
|
|
263
|
-
});
|
|
264
|
-
if (typeof file.content === 'string') {
|
|
265
|
-
return JSON.parse(file.content);
|
|
266
|
-
}
|
|
267
|
-
return file.content;
|
|
268
|
-
}
|
|
269
270
|
/**
|
|
270
271
|
* Add a layer group in the layer tree.
|
|
271
272
|
*
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"type": "object",
|
|
3
3
|
"description": "ImageSource",
|
|
4
4
|
"title": "IImageSource",
|
|
5
|
-
"required": ["
|
|
5
|
+
"required": ["path", "coordinates"],
|
|
6
6
|
"additionalProperties": false,
|
|
7
7
|
"properties": {
|
|
8
|
-
"
|
|
8
|
+
"path": {
|
|
9
9
|
"type": "string",
|
|
10
10
|
"readOnly": true,
|
|
11
|
-
"description": "
|
|
11
|
+
"description": "Path that points to an image"
|
|
12
12
|
},
|
|
13
13
|
"coordinates": {
|
|
14
14
|
"type": "array",
|
|
@@ -9,20 +9,10 @@
|
|
|
9
9
|
"type": "string",
|
|
10
10
|
"description": "The url to the tile provider"
|
|
11
11
|
},
|
|
12
|
-
"tileSize": {
|
|
13
|
-
"type": "number",
|
|
14
|
-
"description": " The tile size",
|
|
15
|
-
"default": 512
|
|
16
|
-
},
|
|
17
12
|
"attribution": {
|
|
18
13
|
"type": "string",
|
|
19
14
|
"description": "The attribution for the raster-dem source"
|
|
20
15
|
},
|
|
21
|
-
"encoding": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"enum": ["terrarium", "mapbox"],
|
|
24
|
-
"default": "mapbox"
|
|
25
|
-
},
|
|
26
16
|
"urlParameters": {
|
|
27
17
|
"type": "object",
|
|
28
18
|
"additionalProperties": {
|
|
@@ -51,14 +51,7 @@
|
|
|
51
51
|
"symbologyState": {
|
|
52
52
|
"type": "object",
|
|
53
53
|
"description": "The state of the symbology panel options",
|
|
54
|
-
"required": [
|
|
55
|
-
"renderType",
|
|
56
|
-
"band",
|
|
57
|
-
"interpolation",
|
|
58
|
-
"colorRamp",
|
|
59
|
-
"nClasses",
|
|
60
|
-
"mode"
|
|
61
|
-
],
|
|
54
|
+
"required": ["renderType"],
|
|
62
55
|
"properties": {
|
|
63
56
|
"renderType": {
|
|
64
57
|
"type": "string"
|
|
@@ -66,6 +59,15 @@
|
|
|
66
59
|
"band": {
|
|
67
60
|
"type": "number"
|
|
68
61
|
},
|
|
62
|
+
"redBand": {
|
|
63
|
+
"type": "number"
|
|
64
|
+
},
|
|
65
|
+
"greenBand": {
|
|
66
|
+
"type": "number"
|
|
67
|
+
},
|
|
68
|
+
"blueBand": {
|
|
69
|
+
"type": "number"
|
|
70
|
+
},
|
|
69
71
|
"interpolation": {
|
|
70
72
|
"type": "string",
|
|
71
73
|
"enum": ["discrete", "linear", "exact"]
|