@jupytergis/schema 0.7.0 → 0.8.1

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.
@@ -7,6 +7,7 @@ import { Contents, User } from '@jupyterlab/services';
7
7
  import { JSONObject } from '@lumino/coreutils';
8
8
  import { ISignal, Signal } from '@lumino/signaling';
9
9
  import { SplitPanel } from '@lumino/widgets';
10
+ import { FeatureLike } from 'ol/Feature';
10
11
  import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerItem, IJGISLayers, IJGISLayerTree, IJGISOptions, IJGISSource, IJGISSources, SourceType } from './_interface/project/jgis';
11
12
  import { IRasterSource } from './_interface/project/sources/rasterSource';
12
13
  export { IGeoJSONSource } from './_interface/project/sources/geoJsonSource';
@@ -148,6 +149,13 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
148
149
  contentsManager: Contents.IManager | undefined;
149
150
  filePath: string;
150
151
  pathChanged: ISignal<IJupyterGISModel, string>;
152
+ getFeaturesForCurrentTile: ({ sourceId, }: {
153
+ sourceId: string;
154
+ }) => FeatureLike[];
155
+ syncTileFeatures: ({ sourceId, features, }: {
156
+ sourceId: string;
157
+ features: FeatureLike[];
158
+ }) => void;
151
159
  getSettings(): IJupyterGISSettings;
152
160
  getContent(): IJGISContent;
153
161
  getLayers(): IJGISLayers;
package/lib/model.d.ts CHANGED
@@ -5,6 +5,7 @@ import { Contents } from '@jupyterlab/services';
5
5
  import { ISettingRegistry } from '@jupyterlab/settingregistry';
6
6
  import { PartialJSONObject } from '@lumino/coreutils';
7
7
  import { ISignal, Signal } from '@lumino/signaling';
8
+ import { FeatureLike } from 'ol/Feature';
8
9
  import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerTree, IJGISLayers, IJGISOptions, IJGISSource, IJGISSources } from './_interface/project/jgis';
9
10
  import { IAnnotationModel, IDict, IJGISLayerDocChange, IJGISLayerTreeDocChange, IJGISSourceDocChange, IJupyterGISClientState, IJupyterGISDoc, IJupyterGISModel, ISelection, IUserData, IViewPortState, JgisCoordinates, Pointer, IJupyterGISSettings } from './interfaces';
10
11
  export declare class JupyterGISModel implements IJupyterGISModel {
@@ -14,6 +15,13 @@ export declare class JupyterGISModel implements IJupyterGISModel {
14
15
  */
15
16
  initSettings(): Promise<void>;
16
17
  getSettings(): IJupyterGISSettings;
18
+ getFeaturesForCurrentTile({ sourceId }: {
19
+ sourceId: string;
20
+ }): FeatureLike[];
21
+ syncTileFeatures({ sourceId, features, }: {
22
+ sourceId: string;
23
+ features: FeatureLike[];
24
+ }): void;
17
25
  private _onSharedModelChanged;
18
26
  readonly collaborative: boolean;
19
27
  get sharedModel(): IJupyterGISDoc;
@@ -184,6 +192,7 @@ export declare class JupyterGISModel implements IJupyterGISModel {
184
192
  static worker: Worker;
185
193
  private _geolocation;
186
194
  private _geolocationChanged;
195
+ private _tileFeatureCache;
187
196
  }
188
197
  export declare namespace JupyterGISModel {
189
198
  /**
package/lib/model.js CHANGED
@@ -47,6 +47,7 @@ export class JupyterGISModel {
47
47
  this._isIdentifying = false;
48
48
  this._isTemporalControllerActive = false;
49
49
  this._geolocationChanged = new Signal(this);
50
+ this._tileFeatureCache = new Map();
50
51
  const { annotationModel, sharedModel, settingRegistry } = options;
51
52
  if (sharedModel) {
52
53
  this._sharedModel = sharedModel;
@@ -77,6 +78,18 @@ export class JupyterGISModel {
77
78
  getSettings() {
78
79
  return this._settings;
79
80
  }
81
+ getFeaturesForCurrentTile({ sourceId }) {
82
+ var _a;
83
+ return Array.from((_a = this._tileFeatureCache.get(sourceId)) !== null && _a !== void 0 ? _a : []);
84
+ }
85
+ syncTileFeatures({ sourceId, features, }) {
86
+ let featureSet = this._tileFeatureCache.get(sourceId);
87
+ if (!featureSet) {
88
+ featureSet = new Set();
89
+ this._tileFeatureCache.set(sourceId, featureSet);
90
+ }
91
+ features.forEach(feature => featureSet.add(feature));
92
+ }
80
93
  get sharedModel() {
81
94
  return this._sharedModel;
82
95
  }
@@ -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.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "A JupyterGIS schema package.",
5
5
  "keywords": [
6
6
  "jupytergis"