@jupytergis/schema 0.3.0 → 0.4.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.
@@ -35,6 +35,68 @@
35
35
  }
36
36
  }
37
37
  },
38
+ "HeatmapLayer": {
39
+ "type": "object",
40
+ "required": [
41
+ "source",
42
+ "blur",
43
+ "radius"
44
+ ],
45
+ "additionalProperties": false,
46
+ "properties": {
47
+ "source": {
48
+ "type": "string",
49
+ "description": "The id of the source"
50
+ },
51
+ "opacity": {
52
+ "type": "number",
53
+ "description": "The opacity of the source",
54
+ "default": 1,
55
+ "multipleOf": 0.1,
56
+ "minimum": 0,
57
+ "maximum": 1
58
+ },
59
+ "radius": {
60
+ "type": "number",
61
+ "description": "Radius size in pixels",
62
+ "default": 8
63
+ },
64
+ "blur": {
65
+ "type": "number",
66
+ "description": "Blur size in pixels",
67
+ "default": 15
68
+ },
69
+ "color": {
70
+ "type": "array",
71
+ "items": {
72
+ "type": "string"
73
+ },
74
+ "default": [
75
+ "#00f",
76
+ "#0ff",
77
+ "#0f0",
78
+ "#ff0",
79
+ "#f00"
80
+ ]
81
+ },
82
+ "symbologyState": {
83
+ "type": "object",
84
+ "description": "The state of the symbology panel options",
85
+ "required": [
86
+ "renderType"
87
+ ],
88
+ "properties": {
89
+ "renderType": {
90
+ "type": "string"
91
+ },
92
+ "colorRamp": {
93
+ "type": "string",
94
+ "default": "cool"
95
+ }
96
+ }
97
+ }
98
+ }
99
+ },
38
100
  "HillshadeLayer": {
39
101
  "type": "object",
40
102
  "required": [
@@ -276,10 +338,6 @@
276
338
  "default": "line",
277
339
  "description": "The type of vector layer"
278
340
  },
279
- "sourceLayer": {
280
- "type": "string",
281
- "description": "The source layer to use"
282
- },
283
341
  "color": {
284
342
  "type": "object",
285
343
  "description": "The color of the the object"
@@ -316,10 +374,6 @@
316
374
  "default": "line",
317
375
  "description": "The type of vector layer"
318
376
  },
319
- "sourceLayer": {
320
- "type": "string",
321
- "description": "The source layer to use"
322
- },
323
377
  "color": {
324
378
  "type": "object",
325
379
  "description": "The color of the the object"
@@ -0,0 +1,37 @@
1
+ /* tslint:disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ /**
9
+ * HeatmapLayer
10
+ */
11
+ export interface IHeatmapLayer {
12
+ /**
13
+ * The id of the source
14
+ */
15
+ source: string;
16
+ /**
17
+ * The opacity of the source
18
+ */
19
+ opacity?: number;
20
+ /**
21
+ * Radius size in pixels
22
+ */
23
+ radius: number;
24
+ /**
25
+ * Blur size in pixels
26
+ */
27
+ blur: number;
28
+ color?: string[];
29
+ /**
30
+ * The state of the symbology panel options
31
+ */
32
+ symbologyState?: {
33
+ renderType: string;
34
+ colorRamp?: string;
35
+ [k: string]: any;
36
+ };
37
+ }
@@ -15,7 +15,8 @@ export type LayerType =
15
15
  | "VectorTileLayer"
16
16
  | "HillshadeLayer"
17
17
  | "WebGlLayer"
18
- | "ImageLayer";
18
+ | "ImageLayer"
19
+ | "HeatmapLayer";
19
20
  /**
20
21
  * This interface was referenced by `IJGISContent`'s JSON-Schema
21
22
  * via the `definition` "sourceType".
@@ -86,9 +87,11 @@ export interface IJGISFilter {
86
87
  * via the `definition` "jGISFilterItem".
87
88
  */
88
89
  export interface IJGISFilterItem {
89
- operator: "==" | "!=" | ">" | "<" | ">=" | "<=";
90
+ operator: "==" | "!=" | ">" | "<" | ">=" | "<=" | "between";
90
91
  feature: string;
91
92
  value: string | number;
93
+ betweenMin?: number;
94
+ betweenMax?: number;
92
95
  }
93
96
  /**
94
97
  * This interface was referenced by `IJGISContent`'s JSON-Schema
@@ -17,10 +17,6 @@ export interface IVectorTileLayer {
17
17
  * The type of vector layer
18
18
  */
19
19
  type: "circle" | "fill" | "line";
20
- /**
21
- * The source layer to use
22
- */
23
- sourceLayer?: string;
24
20
  /**
25
21
  * The color of the the object
26
22
  */
@@ -17,10 +17,6 @@ export interface IVectorLayer {
17
17
  * The type of vector layer
18
18
  */
19
19
  type: "circle" | "fill" | "line";
20
- /**
21
- * The source layer to use
22
- */
23
- sourceLayer?: string;
24
20
  /**
25
21
  * The color of the the object
26
22
  */
package/lib/doc.js CHANGED
@@ -259,6 +259,7 @@ export class JupyterGISDoc extends YDocument {
259
259
  }
260
260
  changes.push({
261
261
  id: key,
262
+ oldValue: change.oldValue,
262
263
  newValue: JSONExt.deepCopy(event.target.toJSON()[key])
263
264
  });
264
265
  });
@@ -1,11 +1,12 @@
1
1
  import { Delta, DocumentChange, MapChange, StateChange, YDocument } from '@jupyter/ydoc';
2
- import { IWidgetTracker } from '@jupyterlab/apputils';
2
+ import { IWidgetTracker, MainAreaWidget } from '@jupyterlab/apputils';
3
3
  import { IChangedArgs } from '@jupyterlab/coreutils';
4
+ import { IDocumentManager } from '@jupyterlab/docmanager';
4
5
  import { DocumentRegistry, IDocumentWidget } from '@jupyterlab/docregistry';
5
6
  import { Contents, User } from '@jupyterlab/services';
7
+ import { JSONObject } from '@lumino/coreutils';
6
8
  import { ISignal, Signal } from '@lumino/signaling';
7
9
  import { SplitPanel } from '@lumino/widgets';
8
- import { IDocumentManager } from '@jupyterlab/docmanager';
9
10
  import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerItem, IJGISLayers, IJGISLayerTree, IJGISOptions, IJGISSource, IJGISSources, SourceType } from './_interface/jgis';
10
11
  import { IRasterSource } from './_interface/rastersource';
11
12
  export { IGeoJSONSource } from './_interface/geojsonsource';
@@ -29,6 +30,7 @@ export interface IDict<T = any> {
29
30
  export interface IJGISLayerDocChange {
30
31
  layerChange?: Array<{
31
32
  id: string;
33
+ oldValue: IDict;
32
34
  newValue: IJGISLayer | undefined;
33
35
  }>;
34
36
  }
@@ -69,6 +71,7 @@ export interface IJupyterGISClientState {
69
71
  user: User.IIdentity;
70
72
  remoteUser?: number;
71
73
  toolbarForm?: IDict;
74
+ isTemporalControllerActive: boolean;
72
75
  }
73
76
  export interface IJupyterGISDoc extends YDocument<IJupyterGISDocChange> {
74
77
  options: IJGISOptions;
@@ -78,6 +81,8 @@ export interface IJupyterGISDoc extends YDocument<IJupyterGISDocChange> {
78
81
  metadata: any;
79
82
  readonly editable: boolean;
80
83
  readonly toJGISEndpoint?: string;
84
+ getSource(): JSONObject;
85
+ setSource(value: JSONObject | string): void;
81
86
  layerExists(id: string): boolean;
82
87
  getLayer(id: string): IJGISLayer | undefined;
83
88
  removeLayer(id: string): void;
@@ -128,6 +133,8 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
128
133
  sharedSourcesChanged: ISignal<IJupyterGISDoc, IJGISSourceDocChange>;
129
134
  sharedMetadataChanged: ISignal<IJupyterGISModel, MapChange>;
130
135
  zoomToPositionSignal: ISignal<IJupyterGISModel, string>;
136
+ addFeatureAsMsSignal: ISignal<IJupyterGISModel, string>;
137
+ updateLayerSignal: ISignal<IJupyterGISModel, string>;
131
138
  contentsManager: Contents.IManager | undefined;
132
139
  filePath: string;
133
140
  getContent(): IJGISContent;
@@ -164,13 +171,23 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
164
171
  centerOnPosition(id: string): void;
165
172
  toggleIdentify(): void;
166
173
  isIdentifying: boolean;
174
+ isTemporalControllerActive: boolean;
175
+ toggleTemporalController(): void;
176
+ addFeatureAsMs(id: string, selectedFeature: string): void;
177
+ triggerLayerUpdate(layerId: string, layer: IJGISLayer): void;
167
178
  disposed: ISignal<any, void>;
168
179
  }
169
180
  export interface IUserData {
170
181
  userId: number;
171
182
  userData: User.IIdentity;
172
183
  }
173
- export type IJupyterGISWidget = IDocumentWidget<SplitPanel, IJupyterGISModel>;
184
+ export interface IJupyterGISDocumentWidget extends IDocumentWidget<SplitPanel, IJupyterGISModel> {
185
+ readonly model: IJupyterGISModel;
186
+ }
187
+ export interface IJupyterGISOutputWidget extends MainAreaWidget {
188
+ model: IJupyterGISModel;
189
+ }
190
+ export type IJupyterGISWidget = IJupyterGISDocumentWidget | IJupyterGISOutputWidget;
174
191
  export type IJupyterGISTracker = IWidgetTracker<IJupyterGISWidget>;
175
192
  export interface IJGISFormSchemaRegistry {
176
193
  /**
@@ -228,8 +245,8 @@ export interface IJGISLayerBrowserRegistry {
228
245
  export interface IAnnotationModel {
229
246
  updateSignal: ISignal<this, null>;
230
247
  user: User.IIdentity | undefined;
231
- context: DocumentRegistry.IContext<IJupyterGISModel> | undefined;
232
- contextChanged: ISignal<this, void>;
248
+ model: IJupyterGISModel | undefined;
249
+ modelChanged: ISignal<this, void>;
233
250
  update(): void;
234
251
  getAnnotation(id: string): IAnnotation | undefined;
235
252
  getAnnotationIds(): string[];
package/lib/model.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { MapChange } from '@jupyter/ydoc';
2
2
  import { IChangedArgs } from '@jupyterlab/coreutils';
3
3
  import { DocumentRegistry } from '@jupyterlab/docregistry';
4
+ import { Contents } from '@jupyterlab/services';
4
5
  import { PartialJSONObject } from '@lumino/coreutils';
5
6
  import { ISignal, Signal } from '@lumino/signaling';
6
7
  import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerTree, IJGISLayers, IJGISOptions, IJGISSource, IJGISSources } from './_interface/jgis';
7
- import { IViewPortState, Pointer, IAnnotationModel, IJGISLayerDocChange, IJGISLayerTreeDocChange, IJGISSourceDocChange, IJupyterGISClientState, IJupyterGISDoc, IJupyterGISModel, ISelection, IUserData, IDict } from './interfaces';
8
- import { Contents } from '@jupyterlab/services';
8
+ import { IAnnotationModel, IDict, IJGISLayerDocChange, IJGISLayerTreeDocChange, IJGISSourceDocChange, IJupyterGISClientState, IJupyterGISDoc, IJupyterGISModel, ISelection, IUserData, IViewPortState, Pointer } from './interfaces';
9
9
  export declare class JupyterGISModel implements IJupyterGISModel {
10
10
  constructor(options: JupyterGISModel.IOptions);
11
11
  private _onSharedModelChanged;
@@ -33,6 +33,8 @@ export declare class JupyterGISModel implements IJupyterGISModel {
33
33
  get zoomToPositionSignal(): ISignal<this, string>;
34
34
  set isIdentifying(isIdentifying: boolean);
35
35
  get isIdentifying(): boolean;
36
+ set isTemporalControllerActive(isActive: boolean);
37
+ get isTemporalControllerActive(): boolean;
36
38
  centerOnPosition(id: string): void;
37
39
  private _metadataChangedHandler;
38
40
  addMetadata(key: string, value: string): void;
@@ -134,8 +136,13 @@ export declare class JupyterGISModel implements IJupyterGISModel {
134
136
  renameLayerGroup(groupName: string, newName: string): void;
135
137
  removeLayerGroup(groupName: string): void;
136
138
  toggleIdentify(): void;
139
+ toggleTemporalController(): void;
137
140
  private _getLayerTreeInfo;
138
141
  private _onClientStateChanged;
142
+ addFeatureAsMs: (id: string, selectedFeature: string) => void;
143
+ get addFeatureAsMsSignal(): Signal<this, string>;
144
+ get updateLayerSignal(): Signal<this, string>;
145
+ triggerLayerUpdate: (layerId: string, layer: IJGISLayer) => void;
139
146
  readonly defaultKernelName: string;
140
147
  readonly defaultKernelLanguage: string;
141
148
  readonly annotationModel?: IAnnotationModel;
@@ -154,7 +161,10 @@ export declare class JupyterGISModel implements IJupyterGISModel {
154
161
  private _clientStateChanged;
155
162
  private _sharedMetadataChanged;
156
163
  private _zoomToPositionSignal;
164
+ private _addFeatureAsMsSignal;
165
+ private _updateLayerSignal;
157
166
  private _isIdentifying;
167
+ private _isTemporalControllerActive;
158
168
  static worker: Worker;
159
169
  }
160
170
  export declare namespace JupyterGISModel {
package/lib/model.js CHANGED
@@ -19,6 +19,12 @@ export class JupyterGISModel {
19
19
  this._userChanged.emit(this.users);
20
20
  }
21
21
  };
22
+ this.addFeatureAsMs = (id, selectedFeature) => {
23
+ this.addFeatureAsMsSignal.emit(JSON.stringify({ id, selectedFeature }));
24
+ };
25
+ this.triggerLayerUpdate = (layerId, layer) => {
26
+ this.updateLayerSignal.emit(JSON.stringify({ layerId, layer }));
27
+ };
22
28
  this.defaultKernelName = '';
23
29
  this.defaultKernelLanguage = '';
24
30
  this._dirty = false;
@@ -32,7 +38,10 @@ export class JupyterGISModel {
32
38
  this._clientStateChanged = new Signal(this);
33
39
  this._sharedMetadataChanged = new Signal(this);
34
40
  this._zoomToPositionSignal = new Signal(this);
41
+ this._addFeatureAsMsSignal = new Signal(this);
42
+ this._updateLayerSignal = new Signal(this);
35
43
  this._isIdentifying = false;
44
+ this._isTemporalControllerActive = false;
36
45
  const { annotationModel, sharedModel } = options;
37
46
  if (sharedModel) {
38
47
  this._sharedModel = sharedModel;
@@ -123,6 +132,12 @@ export class JupyterGISModel {
123
132
  get isIdentifying() {
124
133
  return this._isIdentifying;
125
134
  }
135
+ set isTemporalControllerActive(isActive) {
136
+ this._isTemporalControllerActive = isActive;
137
+ }
138
+ get isTemporalControllerActive() {
139
+ return this._isTemporalControllerActive;
140
+ }
126
141
  centerOnPosition(id) {
127
142
  this._zoomToPositionSignal.emit(id);
128
143
  }
@@ -489,6 +504,10 @@ export class JupyterGISModel {
489
504
  toggleIdentify() {
490
505
  this._isIdentifying = !this._isIdentifying;
491
506
  }
507
+ toggleTemporalController() {
508
+ this._isTemporalControllerActive = !this._isTemporalControllerActive;
509
+ this.sharedModel.awareness.setLocalStateField('isTemporalControllerActive', this._isTemporalControllerActive);
510
+ }
492
511
  _getLayerTreeInfo(groupName) {
493
512
  const layerTree = this.getLayerTree();
494
513
  const indexesPath = Private.findItemPath(layerTree, groupName);
@@ -515,6 +534,12 @@ export class JupyterGISModel {
515
534
  mainGroupIndex
516
535
  };
517
536
  }
537
+ get addFeatureAsMsSignal() {
538
+ return this._addFeatureAsMsSignal;
539
+ }
540
+ get updateLayerSignal() {
541
+ return this._updateLayerSignal;
542
+ }
518
543
  }
519
544
  (function (JupyterGISModel) {
520
545
  /**
@@ -0,0 +1,52 @@
1
+ {
2
+ "type": "object",
3
+ "description": "HeatmapLayer",
4
+ "title": "IHeatmapLayer",
5
+ "required": ["source", "blur", "radius"],
6
+ "additionalProperties": false,
7
+ "properties": {
8
+ "source": {
9
+ "type": "string",
10
+ "description": "The id of the source"
11
+ },
12
+ "opacity": {
13
+ "type": "number",
14
+ "description": "The opacity of the source",
15
+ "default": 1,
16
+ "multipleOf": 0.1,
17
+ "minimum": 0,
18
+ "maximum": 1
19
+ },
20
+ "radius": {
21
+ "type": "number",
22
+ "description": "Radius size in pixels",
23
+ "default": 8
24
+ },
25
+ "blur": {
26
+ "type": "number",
27
+ "description": "Blur size in pixels",
28
+ "default": 15
29
+ },
30
+ "color": {
31
+ "type": "array",
32
+ "items": {
33
+ "type": "string"
34
+ },
35
+ "default": ["#00f", "#0ff", "#0f0", "#ff0", "#f00"]
36
+ },
37
+ "symbologyState": {
38
+ "type": "object",
39
+ "description": "The state of the symbology panel options",
40
+ "required": ["renderType"],
41
+ "properties": {
42
+ "renderType": {
43
+ "type": "string"
44
+ },
45
+ "colorRamp": {
46
+ "type": "string",
47
+ "default": "cool"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
@@ -35,7 +35,8 @@
35
35
  "VectorTileLayer",
36
36
  "HillshadeLayer",
37
37
  "WebGlLayer",
38
- "ImageLayer"
38
+ "ImageLayer",
39
+ "HeatmapLayer"
39
40
  ]
40
41
  },
41
42
  "sourceType": {
@@ -205,7 +206,7 @@
205
206
  "properties": {
206
207
  "operator": {
207
208
  "type": "string",
208
- "enum": ["==", "!=", ">", "<", ">=", "<="],
209
+ "enum": ["==", "!=", ">", "<", ">=", "<=", "between"],
209
210
  "default": "=="
210
211
  },
211
212
  "feature": {
@@ -214,6 +215,12 @@
214
215
  },
215
216
  "value": {
216
217
  "type": ["string", "number"]
218
+ },
219
+ "betweenMin": {
220
+ "type": ["number"]
221
+ },
222
+ "betweenMax": {
223
+ "type": ["number"]
217
224
  }
218
225
  }
219
226
  },
@@ -15,10 +15,6 @@
15
15
  "default": "line",
16
16
  "description": "The type of vector layer"
17
17
  },
18
- "sourceLayer": {
19
- "type": "string",
20
- "description": "The source layer to use"
21
- },
22
18
  "color": {
23
19
  "type": "object",
24
20
  "description": "The color of the the object"
@@ -15,10 +15,6 @@
15
15
  "default": "line",
16
16
  "description": "The type of vector layer"
17
17
  },
18
- "sourceLayer": {
19
- "type": "string",
20
- "description": "The source layer to use"
21
- },
22
18
  "color": {
23
19
  "type": "object",
24
20
  "description": "The color of the the object"
package/lib/types.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from './_interface/vectorlayer';
13
13
  export * from './_interface/vectorTileLayer';
14
14
  export * from './_interface/webGlLayer';
15
15
  export * from './_interface/imageLayer';
16
+ export * from './_interface/heatmapLayer';
16
17
  export * from './doc';
17
18
  export * from './interfaces';
18
19
  export * from './model';
package/lib/types.js CHANGED
@@ -15,6 +15,7 @@ export * from './_interface/vectorlayer';
15
15
  export * from './_interface/vectorTileLayer';
16
16
  export * from './_interface/webGlLayer';
17
17
  export * from './_interface/imageLayer';
18
+ export * from './_interface/heatmapLayer';
18
19
  // Other
19
20
  export * from './doc';
20
21
  export * from './interfaces';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/schema",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "A JupyterGIS schema package.",
5
5
  "keywords": [
6
6
  "jupytergis"