@jupytergis/schema 0.15.0 → 0.16.0-alpha.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.
Files changed (78) hide show
  1. package/lib/_interface/forms.json +7836 -503
  2. package/lib/_interface/processing/clipRasterByExtent.d.ts +39 -0
  3. package/lib/_interface/processing/clipRasterByVector.d.ts +32 -0
  4. package/lib/_interface/processing/clipVectorByMaskLayer.d.ts +28 -0
  5. package/lib/_interface/processing/rasterize.d.ts +42 -0
  6. package/lib/_interface/project/jgis.d.ts +20 -4
  7. package/lib/_interface/project/layers/geoTiffLayer.d.ts +351 -0
  8. package/lib/_interface/project/layers/heatmapLayer.d.ts +8 -1
  9. package/lib/_interface/project/layers/openeoTileLayer.d.ts +20 -0
  10. package/lib/_interface/project/layers/storySegmentLayer.d.ts +6 -0
  11. package/lib/_interface/project/layers/vectorLayer.d.ts +599 -5
  12. package/lib/_interface/project/layers/vectorTileLayer.d.ts +566 -2
  13. package/lib/_interface/project/sources/geoJsonSource.d.ts +8 -0
  14. package/lib/_interface/project/sources/geoPackageRasterSource.d.ts +36 -0
  15. package/lib/_interface/project/sources/geoPackageVectorSource.d.ts +28 -0
  16. package/lib/_interface/project/sources/geoParquetSource.d.ts +8 -0
  17. package/lib/_interface/project/sources/geoTiffSource.d.ts +8 -0
  18. package/lib/_interface/project/sources/imageSource.d.ts +8 -0
  19. package/lib/_interface/project/sources/openeoTileSource.d.ts +26 -0
  20. package/lib/_interface/project/sources/rasterDemSource.d.ts +8 -0
  21. package/lib/_interface/project/sources/rasterSource.d.ts +8 -0
  22. package/lib/_interface/project/sources/shapefileSource.d.ts +8 -0
  23. package/lib/_interface/project/sources/vectorTileSource.d.ts +8 -0
  24. package/lib/_interface/project/sources/videoSource.d.ts +8 -0
  25. package/lib/_interface/project/sources/wmsTileSource.d.ts +8 -0
  26. package/lib/_interface/project/symbology.d.ts +305 -0
  27. package/lib/_interface/version.d.ts +1 -1
  28. package/lib/_interface/version.js +1 -1
  29. package/lib/doc.d.ts +8 -2
  30. package/lib/doc.js +47 -4
  31. package/lib/grammar/grammarConversions.d.ts +50 -0
  32. package/lib/grammar/grammarConversions.js +137 -0
  33. package/lib/index.d.ts +4 -0
  34. package/lib/index.js +2 -0
  35. package/lib/interfaces.d.ts +87 -19
  36. package/lib/interfaces.js +10 -1
  37. package/lib/migrations/index.d.ts +16 -0
  38. package/lib/migrations/index.js +52 -0
  39. package/lib/migrations/v0_5_to_v0_6.d.ts +11 -0
  40. package/lib/migrations/v0_5_to_v0_6.js +154 -0
  41. package/lib/model.d.ts +49 -13
  42. package/lib/model.js +212 -21
  43. package/lib/processing/ProcessingMerge.d.ts +4 -0
  44. package/lib/processing/ProcessingMerge.js +4 -0
  45. package/lib/processing/_generated/exportProcessingSchema.d.ts +7 -3
  46. package/lib/processing/_generated/exportProcessingSchema.js +7 -3
  47. package/lib/processing/_generated/processingType.d.ts +1 -1
  48. package/lib/processing/_generated/processingType.js +7 -3
  49. package/lib/processing/_generated/processing_merge.json +76 -21
  50. package/lib/schema/processing/clipRasterByExtent.json +39 -0
  51. package/lib/schema/processing/clipRasterByVector.json +33 -0
  52. package/lib/schema/processing/clipVectorByMaskLayer.json +27 -0
  53. package/lib/schema/processing/rasterize.json +45 -0
  54. package/lib/schema/project/jgis.json +34 -5
  55. package/lib/schema/project/layers/{webGlLayer.json → geoTiffLayer.json} +9 -3
  56. package/lib/schema/project/layers/heatmapLayer.json +7 -1
  57. package/lib/schema/project/layers/openeoTileLayer.json +21 -0
  58. package/lib/schema/project/layers/storySegmentLayer.json +14 -3
  59. package/lib/schema/project/layers/vectorLayer.json +73 -14
  60. package/lib/schema/project/layers/vectorTileLayer.json +14 -10
  61. package/lib/schema/project/sources/geoJsonSource.json +13 -0
  62. package/lib/schema/project/sources/geoPackageRasterSource.json +45 -0
  63. package/lib/schema/project/sources/geoPackageVectorSource.json +29 -0
  64. package/lib/schema/project/sources/geoParquetSource.json +13 -0
  65. package/lib/schema/project/sources/geoTiffSource.json +13 -0
  66. package/lib/schema/project/sources/imageSource.json +13 -0
  67. package/lib/schema/project/sources/openeoTileSource.json +23 -0
  68. package/lib/schema/project/sources/rasterDemSource.json +13 -0
  69. package/lib/schema/project/sources/rasterSource.json +13 -0
  70. package/lib/schema/project/sources/shapefileSource.json +13 -0
  71. package/lib/schema/project/sources/vectorTileSource.json +13 -0
  72. package/lib/schema/project/sources/videoSource.json +13 -0
  73. package/lib/schema/project/sources/wmsTileSource.json +13 -0
  74. package/lib/schema/project/symbology.json +418 -0
  75. package/lib/types.d.ts +15 -1
  76. package/lib/types.js +7 -1
  77. package/package.json +2 -1
  78. package/lib/_interface/project/layers/webGlLayer.d.ts +0 -39
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Conversions between existing symbology render types and IGrammarSymbologyState.
3
+ *
4
+ * Pure schema transforms with no OL or UI dependencies, usable both as a
5
+ * schema migration step and when the user switches render types in the dialog.
6
+ */
7
+ import { UUID } from '@lumino/coreutils';
8
+ const DEFAULT_STROKE_WIDTH = 1.25;
9
+ const DEFAULT_FILL = [255, 255, 255, 0.4];
10
+ const DEFAULT_STROKE = [51, 153, 204, 1];
11
+ const DEFAULT_RADIUS = 5;
12
+ const TRANSPARENT = [0, 0, 0, 0];
13
+ // ---------------------------------------------------------------------------
14
+ // Helpers
15
+ // ---------------------------------------------------------------------------
16
+ /** Wrap a list of rules in a single default IGrammarLayer. */
17
+ function wrapLayer(rules) {
18
+ return [{ id: UUID.uuid4(), rules }];
19
+ }
20
+ // ---------------------------------------------------------------------------
21
+ // Public API
22
+ // ---------------------------------------------------------------------------
23
+ /** Convert a Single Symbol state to Grammar. */
24
+ export function singleSymbolToGrammar(state) {
25
+ var _a, _b, _c, _d;
26
+ const fill = ((_a = state.fillColor) !== null && _a !== void 0 ? _a : DEFAULT_FILL);
27
+ const stroke = ((_b = state.strokeColor) !== null && _b !== void 0 ? _b : DEFAULT_STROKE);
28
+ const strokeWidth = (_c = state.strokeWidth) !== null && _c !== void 0 ? _c : DEFAULT_STROKE_WIDTH;
29
+ const radius = (_d = state.radius) !== null && _d !== void 0 ? _d : DEFAULT_RADIUS;
30
+ const rule = {
31
+ id: UUID.uuid4(),
32
+ mappings: [
33
+ {
34
+ scale: { scheme: 'constant_rgba', params: { value: fill } },
35
+ channels: ['fill-color', 'circle-fill-color'],
36
+ },
37
+ {
38
+ scale: { scheme: 'constant_rgba', params: { value: stroke } },
39
+ channels: ['stroke-color', 'circle-stroke-color'],
40
+ },
41
+ {
42
+ scale: { scheme: 'constant_num', params: { value: strokeWidth } },
43
+ channels: ['stroke-width', 'circle-stroke-width'],
44
+ },
45
+ {
46
+ scale: { scheme: 'constant_num', params: { value: radius } },
47
+ channels: ['circle-radius'],
48
+ },
49
+ ],
50
+ };
51
+ return { layers: wrapLayer([rule]) };
52
+ }
53
+ /**
54
+ * Convert a Graduated state to Grammar.
55
+ * The colorRamp scale stores recipe params; grammarToOLStyle computes
56
+ * classification breaks from featureValues at render time.
57
+ */
58
+ export function graduatedToGrammar(state) {
59
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
60
+ const field = state.value;
61
+ const fallback = ((_a = state.fallbackColor) !== null && _a !== void 0 ? _a : TRANSPARENT);
62
+ const stroke = ((_b = state.strokeColor) !== null && _b !== void 0 ? _b : DEFAULT_STROKE);
63
+ const strokeWidth = (_c = state.strokeWidth) !== null && _c !== void 0 ? _c : DEFAULT_STROKE_WIDTH;
64
+ const radius = (_d = state.radius) !== null && _d !== void 0 ? _d : DEFAULT_RADIUS;
65
+ const colorStops = (_e = state.stopsOverride) === null || _e === void 0 ? void 0 : _e.filter(s => s.value !== undefined && s.color !== undefined).map(s => ({
66
+ stop: typeof s.value === 'string' ? parseFloat(s.value) : s.value,
67
+ color: s.color,
68
+ }));
69
+ const colorRampScale = {
70
+ scheme: 'colorRamp',
71
+ params: Object.assign(Object.assign(Object.assign({ name: (_f = state.colorRamp) !== null && _f !== void 0 ? _f : 'viridis' }, (state.vmin !== undefined && state.vmax !== undefined
72
+ ? { domain: [state.vmin, state.vmax] }
73
+ : {})), { nShades: (_g = state.nClasses) !== null && _g !== void 0 ? _g : 9, mode: (_h = state.mode) !== null && _h !== void 0 ? _h : 'equal interval', reverse: (_j = state.reverseRamp) !== null && _j !== void 0 ? _j : false, fallback }), (colorStops && colorStops.length >= 2 ? { colorStops } : {})),
74
+ };
75
+ const fillChannels = state.strokeFollowsFill
76
+ ? ['fill-color', 'stroke-color', 'circle-fill-color', 'circle-stroke-color']
77
+ : ['fill-color', 'circle-fill-color'];
78
+ const mappings = [
79
+ { scale: colorRampScale, channels: fillChannels },
80
+ ];
81
+ if (!state.strokeFollowsFill) {
82
+ mappings.push({
83
+ scale: { scheme: 'constant_rgba', params: { value: stroke } },
84
+ channels: ['stroke-color', 'circle-stroke-color'],
85
+ });
86
+ }
87
+ mappings.push({
88
+ scale: { scheme: 'constant_num', params: { value: strokeWidth } },
89
+ channels: ['stroke-width', 'circle-stroke-width'],
90
+ }, {
91
+ scale: { scheme: 'constant_num', params: { value: radius } },
92
+ channels: ['circle-radius'],
93
+ });
94
+ const rule = Object.assign(Object.assign({ id: UUID.uuid4() }, (field ? { fields: [field] } : {})), { mappings: mappings });
95
+ return { layers: wrapLayer([rule]) };
96
+ }
97
+ /**
98
+ * Convert a Categorized state to Grammar.
99
+ * The categorical scale stores recipe params; grammarToOLStyle enumerates
100
+ * unique values from featureValues at render time.
101
+ */
102
+ export function categorizedToGrammar(state) {
103
+ var _a, _b, _c, _d, _e, _f, _g;
104
+ const field = state.value;
105
+ const fallback = ((_a = state.fallbackColor) !== null && _a !== void 0 ? _a : TRANSPARENT);
106
+ const stroke = ((_b = state.strokeColor) !== null && _b !== void 0 ? _b : DEFAULT_STROKE);
107
+ const strokeWidth = (_c = state.strokeWidth) !== null && _c !== void 0 ? _c : DEFAULT_STROKE_WIDTH;
108
+ const radius = (_d = state.radius) !== null && _d !== void 0 ? _d : DEFAULT_RADIUS;
109
+ const catColorStops = (_e = state.stopsOverride) === null || _e === void 0 ? void 0 : _e.filter(s => s.value !== undefined && s.color !== undefined).map(s => ({ stop: s.value, color: s.color }));
110
+ const categoricalScale = {
111
+ scheme: 'categorical',
112
+ params: Object.assign({ colorRamp: (_f = state.colorRamp) !== null && _f !== void 0 ? _f : 'viridis', nShades: state.nClasses, reverse: (_g = state.reverseRamp) !== null && _g !== void 0 ? _g : false, fallback }, (catColorStops && catColorStops.length > 0
113
+ ? { colorStops: catColorStops }
114
+ : {})),
115
+ };
116
+ const fillChannels = state.strokeFollowsFill
117
+ ? ['fill-color', 'stroke-color', 'circle-fill-color', 'circle-stroke-color']
118
+ : ['fill-color', 'circle-fill-color'];
119
+ const mappings = [
120
+ { scale: categoricalScale, channels: fillChannels },
121
+ ];
122
+ if (!state.strokeFollowsFill) {
123
+ mappings.push({
124
+ scale: { scheme: 'constant_rgba', params: { value: stroke } },
125
+ channels: ['stroke-color', 'circle-stroke-color'],
126
+ });
127
+ }
128
+ mappings.push({
129
+ scale: { scheme: 'constant_num', params: { value: strokeWidth } },
130
+ channels: ['stroke-width', 'circle-stroke-width'],
131
+ }, {
132
+ scale: { scheme: 'constant_num', params: { value: radius } },
133
+ channels: ['circle-radius'],
134
+ });
135
+ const rule = Object.assign(Object.assign({ id: UUID.uuid4() }, (field ? { fields: [field] } : {})), { mappings: mappings });
136
+ return { layers: wrapLayer([rule]) };
137
+ }
package/lib/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  export * from './interfaces';
2
+ export { singleSymbolToGrammar, graduatedToGrammar, categorizedToGrammar, } from './grammar/grammarConversions';
3
+ export type { SymbologyState } from './grammar/grammarConversions';
4
+ export { migrateDocument } from './migrations';
2
5
  export * from './model';
3
6
  export * from './token';
7
+ export type * from './types';
4
8
  export * from './doc';
5
9
  export { SCHEMA_VERSION } from './_interface/version';
6
10
  export { ProcessingMerge, ProcessingCommandIDs, ProcessingLogicType, } from './processing/ProcessingMerge';
package/lib/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from './interfaces';
2
+ export { singleSymbolToGrammar, graduatedToGrammar, categorizedToGrammar, } from './grammar/grammarConversions';
3
+ export { migrateDocument } from './migrations';
2
4
  export * from './model';
3
5
  export * from './token';
4
6
  export * from './doc';
@@ -9,9 +9,13 @@ import { JSONObject } from '@lumino/coreutils';
9
9
  import { ISignal, Signal } from '@lumino/signaling';
10
10
  import { SplitPanel } from '@lumino/widgets';
11
11
  import { FeatureLike } from 'ol/Feature';
12
- import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerItem, IJGISLayers, IJGISLayerTree, IJGISOptions, IJGISSource, IJGISSources, IJGISStoryMap, LayerType, SourceType } from './_interface/project/jgis';
13
- import { IGeoJSONSource, IGeoParquetSource, IGeoTiffSource, IHeatmapLayer, IHillshadeLayer, IImageLayer, IImageSource, IMarkerSource, IRasterDemSource, IRasterLayer, IRasterSource, IShapefileSource, IStacLayer, IStorySegmentLayer, IVectorLayer, IVectorTileLayer, IVectorTileSource, IVideoSource, IWebGlLayer, Modes } from './types';
14
- export { IGeoJSONSource } from './_interface/project/sources/geoJsonSource';
12
+ import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerItem, IJGISLayers, IJGISLayerTree, IJGISOptions, IJGISSource, IJGISSources, IJGISStoryMap, IJGISViewState, LayerType, SourceType } from './_interface/project/jgis';
13
+ import { IGeoJSONSource, IGeoParquetSource, IGeoTiffSource, IHeatmapLayer, IHillshadeLayer, IImageLayer, IImageSource, IMarkerSource, IRasterDemSource, IRasterLayer, IRasterSource, IOpenEOTileLayer, IOpenEOTileSource, IShapefileSource, IStacLayer, IStorySegmentLayer, IVectorLayer, IVectorTileLayer, IVectorTileSource, IVideoSource, IGeoTiffLayer, Modes } from './types';
14
+ export type { IGeoJSONSource } from './_interface/project/sources/geoJsonSource';
15
+ export interface IJGISUIState {
16
+ leftPanelOpen?: boolean;
17
+ rightPanelOpen?: boolean;
18
+ }
15
19
  export interface IJGISStoryMaps {
16
20
  [k: string]: IJGISStoryMap;
17
21
  }
@@ -22,6 +26,7 @@ export type JgisCoordinates = {
22
26
  export interface IViewPortState {
23
27
  coordinates: JgisCoordinates;
24
28
  zoom: number;
29
+ extent: [number, number, number, number];
25
30
  }
26
31
  export type Pointer = {
27
32
  coordinates: {
@@ -59,6 +64,22 @@ export interface ISelection {
59
64
  type: SelectionType;
60
65
  parent?: string;
61
66
  }
67
+ export interface IIdentifiedFeature {
68
+ _id?: string;
69
+ _fromDrawTool?: boolean;
70
+ geometry?: unknown;
71
+ _geometry?: unknown;
72
+ [key: string]: unknown;
73
+ }
74
+ export interface IIdentifiedFeatureEntry {
75
+ feature: IIdentifiedFeature;
76
+ floaterOpen?: boolean;
77
+ }
78
+ export type IIdentifiedFeatures = IIdentifiedFeatureEntry[];
79
+ export interface IIdentifiedFeaturesAwarenessState {
80
+ value?: IIdentifiedFeatures;
81
+ emitter?: string | null;
82
+ }
62
83
  export interface IJupyterGISClientState {
63
84
  selected: {
64
85
  value?: {
@@ -66,6 +87,9 @@ export interface IJupyterGISClientState {
66
87
  };
67
88
  emitter?: string | null;
68
89
  };
90
+ lastAddedLayer?: {
91
+ layerId?: string;
92
+ };
69
93
  selectedPropField?: {
70
94
  id: string | null;
71
95
  value: any;
@@ -79,21 +103,38 @@ export interface IJupyterGISClientState {
79
103
  value?: Pointer;
80
104
  emitter?: string | null;
81
105
  };
82
- identifiedFeatures: {
83
- value?: any;
84
- emitter?: string | null;
85
- };
106
+ identifiedFeatures: IIdentifiedFeaturesAwarenessState;
86
107
  user: User.IIdentity;
87
108
  remoteUser?: number;
88
109
  toolbarForm?: IDict;
89
110
  isTemporalControllerActive: boolean;
90
111
  }
112
+ export declare const AWARENESS_STATE_FIELDS: {
113
+ readonly selected: "selected";
114
+ readonly pointer: "pointer";
115
+ readonly viewportState: "viewportState";
116
+ readonly identifiedFeatures: "identifiedFeatures";
117
+ readonly remoteUser: "remoteUser";
118
+ readonly isTemporalControllerActive: "isTemporalControllerActive";
119
+ readonly lastAddedLayer: "lastAddedLayer";
120
+ };
121
+ export type AwarenessFieldKey = (typeof AWARENESS_STATE_FIELDS)[keyof typeof AWARENESS_STATE_FIELDS];
122
+ export declare const AWARENESS_FIELD_KEYS: AwarenessFieldKey[];
123
+ export interface IAwarenessFieldChange<T = any> {
124
+ clientId: number;
125
+ field: AwarenessFieldKey;
126
+ previousValue: T | undefined;
127
+ currentValue: T | undefined;
128
+ fullState: IJupyterGISClientState | undefined;
129
+ isLocalClient: boolean;
130
+ }
91
131
  export interface IJupyterGISDoc extends YDocument<IJupyterGISDocChange> {
92
132
  options: IJGISOptions;
93
133
  layers: IJGISLayers;
94
134
  sources: IJGISSources;
95
135
  stories: IJGISStoryMaps;
96
136
  layerTree: IJGISLayerTree;
137
+ viewState: IJGISViewState;
97
138
  metadata: any;
98
139
  readonly editable: boolean;
99
140
  readonly toJGISEndpoint?: string;
@@ -143,15 +184,34 @@ export interface IJupyterGISDocChange extends DocumentChange {
143
184
  optionChange?: MapChange;
144
185
  stateChange?: StateChange<any>[];
145
186
  }
187
+ export interface IViewState {
188
+ [id: string]: {
189
+ extent: number[];
190
+ zoom: number;
191
+ projection?: string;
192
+ layerId?: string;
193
+ layerName?: string;
194
+ };
195
+ }
196
+ export interface IStorySegmentRef {
197
+ storySegmentId: string;
198
+ storyId: string;
199
+ }
146
200
  export interface IJupyterGISModel extends DocumentRegistry.IModel {
147
201
  isDisposed: boolean;
148
202
  sharedModel: IJupyterGISDoc;
149
203
  geolocation: JgisCoordinates;
150
204
  localState: IJupyterGISClientState | null;
205
+ viewState?: IViewState;
151
206
  annotationModel?: IAnnotationModel;
152
207
  currentMode: Modes;
153
208
  themeChanged: Signal<IJupyterGISModel, IChangedArgs<string, string | null, string>>;
154
- clientStateChanged: ISignal<IJupyterGISModel, Map<number, IJupyterGISClientState>>;
209
+ selectedChanged: ISignal<IJupyterGISModel, IAwarenessFieldChange<IJupyterGISClientState['selected']>>;
210
+ pointerChanged: ISignal<IJupyterGISModel, IAwarenessFieldChange<IJupyterGISClientState['pointer']>>;
211
+ viewportStateChanged: ISignal<IJupyterGISModel, IAwarenessFieldChange<IJupyterGISClientState['viewportState']>>;
212
+ identifiedFeaturesChanged: ISignal<IJupyterGISModel, IAwarenessFieldChange<IJupyterGISClientState['identifiedFeatures']>>;
213
+ remoteUserChanged: ISignal<IJupyterGISModel, IAwarenessFieldChange<IJupyterGISClientState['remoteUser']>>;
214
+ temporalControllerActiveChanged: ISignal<IJupyterGISModel, IAwarenessFieldChange<IJupyterGISClientState['isTemporalControllerActive']>>;
155
215
  sharedOptionsChanged: ISignal<IJupyterGISDoc, MapChange>;
156
216
  sharedLayersChanged: ISignal<IJupyterGISDoc, IJGISLayerDocChange>;
157
217
  sharedLayerTreeChanged: ISignal<IJupyterGISDoc, IJGISLayerTreeDocChange>;
@@ -164,6 +224,7 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
164
224
  flyToGeometrySignal: Signal<IJupyterGISModel, any>;
165
225
  highlightFeatureSignal: Signal<IJupyterGISModel, any>;
166
226
  updateBboxSignal: Signal<IJupyterGISModel, any>;
227
+ editingVectorLayerChanged: ISignal<IJupyterGISModel, boolean>;
167
228
  contentsManager: Contents.IManager | undefined;
168
229
  filePath: string;
169
230
  pathChanged: ISignal<IJupyterGISModel, string>;
@@ -176,11 +237,14 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
176
237
  features: FeatureLike[];
177
238
  }) => void;
178
239
  getSettings(): Promise<ISettingRegistry.ISettings>;
240
+ settingsReady: Promise<void>;
179
241
  settingsChanged: ISignal<IJupyterGISModel, string>;
180
242
  jgisSettings: IJupyterGISSettings;
181
243
  getContent(): IJGISContent;
244
+ getViewState(): IViewState;
182
245
  getLayers(): IJGISLayers;
183
246
  getLayer(id: string): IJGISLayer | undefined;
247
+ getExtent(id: string): number[] | undefined;
184
248
  getLayerOrSource(id: string): IJGISLayer | IJGISSource | undefined;
185
249
  getSources(): IJGISSources;
186
250
  getSource(id: string): IJGISSource | undefined;
@@ -189,6 +253,7 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
189
253
  };
190
254
  getLayerTree(): IJGISLayerTree;
191
255
  addLayer(id: string, layer: IJGISLayer, groupName?: string, position?: number): void;
256
+ updateLayerViewState(id: string, view: IViewState[string]): void;
192
257
  removeLayer(id: string): void;
193
258
  removeSource(id: string): void;
194
259
  getOptions(): IJGISOptions;
@@ -207,6 +272,7 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
207
272
  selected: {
208
273
  [key: string]: ISelection;
209
274
  } | undefined;
275
+ syncLastAddedLayer(layerId: string): void;
210
276
  setEditingItem(type: SelectionType, itemId: string): void;
211
277
  clearEditingItem(): void;
212
278
  readonly editing: {
@@ -218,13 +284,16 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
218
284
  itemId: string;
219
285
  } | null>;
220
286
  syncPointer(pointer?: Pointer, emitter?: string): void;
221
- syncIdentifiedFeatures(features: IDict<any>, emitter?: string): void;
287
+ syncIdentifiedFeatures(features: IIdentifiedFeatures, emitter?: string): void;
222
288
  setUserToFollow(userId?: number): void;
223
289
  getClientId(): number;
224
290
  addMetadata(key: string, value: string): void;
225
291
  removeMetadata(key: string): void;
226
292
  centerOnPosition(id: string): void;
227
293
  toggleMode(mode: Modes): void;
294
+ editingVectorLayer: boolean;
295
+ updateEditingVectorLayer(): void;
296
+ checkIfIsADrawVectorLayer(layer: IJGISLayer): boolean;
228
297
  isTemporalControllerActive: boolean;
229
298
  toggleTemporalController(): void;
230
299
  addFeatureAsMs(id: string, selectedFeature: string): void;
@@ -237,15 +306,13 @@ export interface IJupyterGISModel extends DocumentRegistry.IModel {
237
306
  getCurrentSegmentIndex(): number;
238
307
  setCurrentSegmentIndex(index: number): void;
239
308
  currentSegmentIndexChanged: ISignal<IJupyterGISModel, number>;
240
- addStorySegment(): {
241
- storySegmentId: string;
242
- storyId: string;
243
- } | null;
244
- segmentAdded: ISignal<IJupyterGISModel, {
245
- storySegmentId: string;
246
- storyId: string;
247
- }>;
309
+ addStorySegment(viewState?: IViewState[string]): IStorySegmentRef | null;
310
+ createStorySegmentFromLayer(layerId: string): IStorySegmentRef | null;
311
+ segmentAdded: ISignal<IJupyterGISModel, IStorySegmentRef>;
248
312
  isSpectaMode(): boolean;
313
+ setUIState(value: Partial<IJGISUIState>): void;
314
+ getUIState(): IJGISUIState;
315
+ uiStateChanged: ISignal<IJupyterGISModel, IJGISUIState>;
249
316
  }
250
317
  export interface IUserData {
251
318
  userId: number;
@@ -303,9 +370,9 @@ export type ILayerGalleryEntry = {
303
370
  name: string;
304
371
  thumbnail: string;
305
372
  layerType: LayerType;
306
- layerParameters: IHeatmapLayer | IHillshadeLayer | IImageLayer | IRasterLayer | IStacLayer | IStorySegmentLayer | IVectorLayer | IVectorTileLayer | IWebGlLayer;
373
+ layerParameters: IHeatmapLayer | IHillshadeLayer | IImageLayer | IRasterLayer | IStacLayer | IStorySegmentLayer | IVectorLayer | IVectorTileLayer | IGeoTiffLayer | IOpenEOTileLayer;
307
374
  sourceType: SourceType;
308
- sourceParameters: IGeoJSONSource | IGeoParquetSource | IGeoTiffSource | IImageSource | IMarkerSource | IRasterDemSource | IRasterSource | IShapefileSource | IVectorTileSource | IVideoSource;
375
+ sourceParameters: IGeoJSONSource | IGeoParquetSource | IGeoTiffSource | IImageSource | IMarkerSource | IRasterDemSource | IRasterSource | IShapefileSource | IVectorTileSource | IVideoSource | IOpenEOTileSource;
309
376
  provider: string;
310
377
  description: string;
311
378
  };
@@ -354,4 +421,5 @@ export interface IJupyterGISSettings {
354
421
  identifyDisabled?: boolean;
355
422
  storyMapsDisabled: boolean;
356
423
  zoomButtonsEnabled?: boolean;
424
+ useServerGdalProcessing?: boolean | null;
357
425
  }
package/lib/interfaces.js CHANGED
@@ -1 +1,10 @@
1
- export {};
1
+ export const AWARENESS_STATE_FIELDS = {
2
+ selected: 'selected',
3
+ pointer: 'pointer',
4
+ viewportState: 'viewportState',
5
+ identifiedFeatures: 'identifiedFeatures',
6
+ remoteUser: 'remoteUser',
7
+ isTemporalControllerActive: 'isTemporalControllerActive',
8
+ lastAddedLayer: 'lastAddedLayer',
9
+ };
10
+ export const AWARENESS_FIELD_KEYS = Object.values(AWARENESS_STATE_FIELDS);
@@ -0,0 +1,16 @@
1
+ /**
2
+ * JupyterGIS document migration runner.
3
+ *
4
+ * Each step in STEPS is a { from, to, migrate } record where `migrate` takes
5
+ * a parsed document object and returns a new object. Steps must be listed in
6
+ * order and form a contiguous chain.
7
+ */
8
+ /**
9
+ * Apply all necessary migration steps to bring *doc* up to *toVersion*.
10
+ *
11
+ * @param doc - Parsed jGIS document object.
12
+ * @param toVersion - Target schema version. Defaults to the current
13
+ * SCHEMA_VERSION if omitted.
14
+ * @throws If the document's version is newer than the current schema version.
15
+ */
16
+ export declare function migrateDocument(doc: Record<string, any>, toVersion?: string): Record<string, any>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * JupyterGIS document migration runner.
3
+ *
4
+ * Each step in STEPS is a { from, to, migrate } record where `migrate` takes
5
+ * a parsed document object and returns a new object. Steps must be listed in
6
+ * order and form a contiguous chain.
7
+ */
8
+ import { migrate as migrateV0_5ToV0_6 } from './v0_5_to_v0_6';
9
+ import { SCHEMA_VERSION } from '../_interface/version';
10
+ const STEPS = [
11
+ { from: '0.5.0', to: '0.6.0', migrate: migrateV0_5ToV0_6 },
12
+ ];
13
+ /**
14
+ * Apply all necessary migration steps to bring *doc* up to *toVersion*.
15
+ *
16
+ * @param doc - Parsed jGIS document object.
17
+ * @param toVersion - Target schema version. Defaults to the current
18
+ * SCHEMA_VERSION if omitted.
19
+ * @throws If the document's version is newer than the current schema version.
20
+ */
21
+ export function migrateDocument(doc, toVersion) {
22
+ var _a;
23
+ const target = toVersion !== null && toVersion !== void 0 ? toVersion : SCHEMA_VERSION;
24
+ const fileVersion = (_a = doc.schemaVersion) !== null && _a !== void 0 ? _a : '0.5.0';
25
+ if (_compareVersions(fileVersion, SCHEMA_VERSION) > 0) {
26
+ throw new Error(`Cannot load file with schema version ${fileVersion} (current: ${SCHEMA_VERSION})`);
27
+ }
28
+ let current = fileVersion;
29
+ let result = Object.assign({}, doc);
30
+ for (const step of STEPS) {
31
+ if (_compareVersions(current, step.to) < 0 &&
32
+ _compareVersions(step.to, target) <= 0) {
33
+ result = step.migrate(result);
34
+ result.schemaVersion = step.to;
35
+ current = step.to;
36
+ }
37
+ }
38
+ return result;
39
+ }
40
+ /** Simple semver comparison: returns negative, 0, or positive. */
41
+ function _compareVersions(a, b) {
42
+ var _a, _b;
43
+ const pa = a.split('.').map(Number);
44
+ const pb = b.split('.').map(Number);
45
+ for (let i = 0; i < 3; i++) {
46
+ const diff = ((_a = pa[i]) !== null && _a !== void 0 ? _a : 0) - ((_b = pb[i]) !== null && _b !== void 0 ? _b : 0);
47
+ if (diff !== 0) {
48
+ return diff;
49
+ }
50
+ }
51
+ return 0;
52
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Migration from schema version 0.5.0 to 0.6.0.
3
+ *
4
+ * Converts legacy representations to Grammar symbologyState in one pass:
5
+ * - parameters.color (flat OL FlatStyle keys) → Grammar directly
6
+ * - parameters.symbologyState with old render types → Grammar
7
+ * - HeatmapLayer color array → symbologyState.gradient
8
+ * - WebGlLayer type → GeoTiffLayer
9
+ * - layer.filters → grammar layer-level when + whenOp (filters removed)
10
+ */
11
+ export declare function migrate(doc: Record<string, any>): Record<string, any>;
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Migration from schema version 0.5.0 to 0.6.0.
3
+ *
4
+ * Converts legacy representations to Grammar symbologyState in one pass:
5
+ * - parameters.color (flat OL FlatStyle keys) → Grammar directly
6
+ * - parameters.symbologyState with old render types → Grammar
7
+ * - HeatmapLayer color array → symbologyState.gradient
8
+ * - WebGlLayer type → GeoTiffLayer
9
+ * - layer.filters → grammar layer-level when + whenOp (filters removed)
10
+ */
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ import { categorizedToGrammar, graduatedToGrammar, singleSymbolToGrammar, } from '../grammar/grammarConversions';
23
+ export function migrate(doc) {
24
+ var _a, _b;
25
+ const layers = Object.assign({}, doc.layers);
26
+ for (const [id, layer] of Object.entries(layers)) {
27
+ const newType = layer.type === 'WebGlLayer' ? 'GeoTiffLayer' : layer.type;
28
+ const params = layer === null || layer === void 0 ? void 0 : layer.parameters;
29
+ if (!params) {
30
+ if (newType !== layer.type) {
31
+ layers[id] = Object.assign(Object.assign({}, layer), { type: newType });
32
+ }
33
+ continue;
34
+ }
35
+ const newParams = Object.assign({}, params);
36
+ if (layer.type === 'VectorLayer' || layer.type === 'VectorTileLayer') {
37
+ const color = newParams.color;
38
+ if (color && typeof color === 'object' && !Array.isArray(color)) {
39
+ // Flat OL color dict → Grammar (skip intermediate symbologyState format)
40
+ newParams.symbologyState = singleSymbolToGrammar(_colorToState(color));
41
+ delete newParams.color;
42
+ }
43
+ else {
44
+ // Handle files that already carry old-style symbologyState (defensive)
45
+ const state = newParams.symbologyState;
46
+ if ((state === null || state === void 0 ? void 0 : state.renderType) && state.renderType !== 'Grammar') {
47
+ switch (state.renderType) {
48
+ case 'Single Symbol':
49
+ newParams.symbologyState = singleSymbolToGrammar(state);
50
+ break;
51
+ case 'Graduated':
52
+ newParams.symbologyState = graduatedToGrammar(state);
53
+ break;
54
+ case 'Categorized':
55
+ newParams.symbologyState = categorizedToGrammar(state);
56
+ break;
57
+ }
58
+ }
59
+ }
60
+ }
61
+ else if (layer.type === 'HeatmapLayer') {
62
+ if (Array.isArray(newParams.color)) {
63
+ const state = (_a = newParams.symbologyState) !== null && _a !== void 0 ? _a : { renderType: 'Heatmap' };
64
+ if (!state.gradient) {
65
+ newParams.symbologyState = Object.assign(Object.assign({}, state), { gradient: newParams.color });
66
+ }
67
+ delete newParams.color;
68
+ }
69
+ }
70
+ // Convert legacy layer.filters → grammar layer-level when + whenOp.
71
+ const filters = layer.filters;
72
+ if ((_b = filters === null || filters === void 0 ? void 0 : filters.appliedFilters) === null || _b === void 0 ? void 0 : _b.length) {
73
+ const logicalOp = filters.logicalOp === 'any' ? 'any' : 'all';
74
+ const predicates = [];
75
+ for (const item of filters.appliedFilters) {
76
+ if (item.operator === 'between') {
77
+ if (item.betweenMin !== undefined && item.betweenMax !== undefined) {
78
+ predicates.push({
79
+ type: 'between',
80
+ field: item.feature,
81
+ min: item.betweenMin,
82
+ max: item.betweenMax,
83
+ });
84
+ }
85
+ }
86
+ else if (item.operator === '==') {
87
+ predicates.push({
88
+ type: 'fieldEquals',
89
+ field: item.feature,
90
+ value: item.value,
91
+ });
92
+ }
93
+ else {
94
+ predicates.push({
95
+ type: 'fieldCompare',
96
+ field: item.feature,
97
+ op: item.operator,
98
+ value: item.value,
99
+ });
100
+ }
101
+ }
102
+ if (predicates.length) {
103
+ const symbologyState = newParams.symbologyState;
104
+ if (Array.isArray(symbologyState === null || symbologyState === void 0 ? void 0 : symbologyState.layers) &&
105
+ symbologyState.layers.length > 0) {
106
+ newParams.symbologyState = Object.assign(Object.assign({}, symbologyState), { layers: symbologyState.layers.map((gl) => {
107
+ var _a, _b;
108
+ return (Object.assign(Object.assign({}, gl), { when: [...((_a = gl.when) !== null && _a !== void 0 ? _a : []), ...predicates], whenOp: (_b = gl.whenOp) !== null && _b !== void 0 ? _b : logicalOp }));
109
+ }) });
110
+ }
111
+ }
112
+ }
113
+ const _c = Object.assign(Object.assign({}, layer), { type: newType }), { filters: _ } = _c, layerWithoutFilters = __rest(_c, ["filters"]);
114
+ layers[id] = Object.assign(Object.assign({}, layerWithoutFilters), { parameters: newParams });
115
+ }
116
+ return Object.assign(Object.assign({}, doc), { layers });
117
+ }
118
+ /** Build a SymbologyState from a flat OL color dict. */
119
+ function _colorToState(color) {
120
+ var _a;
121
+ const state = { renderType: 'Single Symbol' };
122
+ const fill = _firstSolidColor(color['fill-color'], color['circle-fill-color']);
123
+ if (fill) {
124
+ state.fillColor = fill;
125
+ }
126
+ const stroke = _firstSolidColor(color['stroke-color'], color['circle-stroke-color']);
127
+ if (stroke) {
128
+ state.strokeColor = stroke;
129
+ }
130
+ const sw = (_a = color['stroke-width']) !== null && _a !== void 0 ? _a : color['circle-stroke-width'];
131
+ if (typeof sw === 'number') {
132
+ state.strokeWidth = sw;
133
+ }
134
+ const r = color['circle-radius'];
135
+ if (typeof r === 'number') {
136
+ state.radius = r;
137
+ }
138
+ return state;
139
+ }
140
+ function _firstSolidColor(...candidates) {
141
+ for (const c of candidates) {
142
+ if (Array.isArray(c) && c.length >= 3 && typeof c[0] === 'number') {
143
+ const [r = 0, g = 0, b = 0, a = 1] = c;
144
+ return [r, g, b, a];
145
+ }
146
+ if (typeof c === 'string') {
147
+ const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(c);
148
+ if (m) {
149
+ return [parseInt(m[1], 16), parseInt(m[2], 16), parseInt(m[3], 16), 1];
150
+ }
151
+ }
152
+ }
153
+ return undefined;
154
+ }