@jupytergis/schema 0.1.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.
Files changed (44) hide show
  1. package/lib/_interface/forms.json +1987 -0
  2. package/lib/_interface/geoTiffSource.d.ts +31 -0
  3. package/lib/_interface/geojsonsource.d.ts +404 -0
  4. package/lib/_interface/hillshadeLayer.d.ts +20 -0
  5. package/lib/_interface/imageLayer.d.ts +20 -0
  6. package/lib/_interface/imageSource.d.ts +20 -0
  7. package/lib/_interface/jgis.d.ts +140 -0
  8. package/lib/_interface/rasterDemSource.d.ts +28 -0
  9. package/lib/_interface/rasterlayer.d.ts +20 -0
  10. package/lib/_interface/rastersource.d.ts +43 -0
  11. package/lib/_interface/shapefileSource.d.ts +34 -0
  12. package/lib/_interface/vectorTileLayer.d.ts +32 -0
  13. package/lib/_interface/vectorlayer.d.ts +32 -0
  14. package/lib/_interface/vectortilesource.d.ts +35 -0
  15. package/lib/_interface/videoSource.d.ts +20 -0
  16. package/lib/_interface/webGlLayer.d.ts +24 -0
  17. package/lib/doc.d.ts +59 -0
  18. package/lib/doc.js +251 -0
  19. package/lib/index.d.ts +4 -0
  20. package/lib/index.js +4 -0
  21. package/lib/interfaces.d.ts +189 -0
  22. package/lib/interfaces.js +1 -0
  23. package/lib/model.d.ts +142 -0
  24. package/lib/model.js +554 -0
  25. package/lib/schema/geoTiffSource.json +37 -0
  26. package/lib/schema/geojsonsource.json +23 -0
  27. package/lib/schema/hillshadeLayer.json +18 -0
  28. package/lib/schema/imageLayer.json +21 -0
  29. package/lib/schema/imageSource.json +30 -0
  30. package/lib/schema/jgis.json +248 -0
  31. package/lib/schema/rasterDemSource.json +33 -0
  32. package/lib/schema/rasterlayer.json +21 -0
  33. package/lib/schema/rastersource.json +66 -0
  34. package/lib/schema/shapefileSource.json +37 -0
  35. package/lib/schema/vectorTileLayer.json +36 -0
  36. package/lib/schema/vectorlayer.json +36 -0
  37. package/lib/schema/vectortilesource.json +40 -0
  38. package/lib/schema/videoSource.json +33 -0
  39. package/lib/schema/webGlLayer.json +41 -0
  40. package/lib/token.d.ts +6 -0
  41. package/lib/token.js +5 -0
  42. package/lib/types.d.ts +19 -0
  43. package/lib/types.js +22 -0
  44. package/package.json +65 -0
@@ -0,0 +1,189 @@
1
+ import { ICollaborativeDrive } from '@jupyter/docprovider';
2
+ import { Delta, DocumentChange, MapChange, StateChange, YDocument } from '@jupyter/ydoc';
3
+ import { IWidgetTracker } from '@jupyterlab/apputils';
4
+ import { IChangedArgs } from '@jupyterlab/coreutils';
5
+ import { DocumentRegistry, IDocumentWidget } from '@jupyterlab/docregistry';
6
+ import { User } from '@jupyterlab/services';
7
+ import { ISignal, Signal } from '@lumino/signaling';
8
+ import { SplitPanel } from '@lumino/widgets';
9
+ import { GeoJSON } from './_interface/geojsonsource';
10
+ import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerItem, IJGISLayers, IJGISLayerTree, IJGISOptions, IJGISSource, IJGISSources, IJGISTerrain, SourceType } from './_interface/jgis';
11
+ import { IRasterSource } from './_interface/rastersource';
12
+ export { IGeoJSONSource } from './_interface/geojsonsource';
13
+ export interface IDict<T = any> {
14
+ [key: string]: T;
15
+ }
16
+ export interface IJGISLayerDocChange {
17
+ layerChange?: Array<{
18
+ id: string;
19
+ newValue: IJGISLayer | undefined;
20
+ }>;
21
+ }
22
+ export interface IJGISLayerTreeDocChange {
23
+ layerTreeChange?: Delta<IJGISLayerItem[]>;
24
+ }
25
+ export interface IJGISSourceDocChange {
26
+ sourceChange?: Array<{
27
+ id: string;
28
+ newValue: IJGISSource | undefined;
29
+ }>;
30
+ }
31
+ export type SelectionType = 'layer' | 'source' | 'group';
32
+ export interface ISelection {
33
+ type: SelectionType;
34
+ parent?: string;
35
+ selectedNodeId?: string;
36
+ }
37
+ export interface IJupyterGISClientState {
38
+ selected: {
39
+ value?: {
40
+ [key: string]: ISelection;
41
+ };
42
+ emitter?: string | null;
43
+ };
44
+ user: User.IIdentity;
45
+ remoteUser?: number;
46
+ toolbarForm?: IDict;
47
+ }
48
+ export interface IJupyterGISDoc extends YDocument<IJupyterGISDocChange> {
49
+ options: IJGISOptions;
50
+ layers: IJGISLayers;
51
+ sources: IJGISSources;
52
+ layerTree: IJGISLayerTree;
53
+ terrain: IJGISTerrain;
54
+ readonly editable: boolean;
55
+ readonly toJGISEndpoint?: string;
56
+ layerExists(id: string): boolean;
57
+ getLayer(id: string): IJGISLayer | undefined;
58
+ removeLayer(id: string): void;
59
+ addLayer(id: string, value: IJGISLayer, groupName?: string, position?: number): void;
60
+ updateLayer(id: string, value: IJGISLayer): void;
61
+ sourceExists(id: string): boolean;
62
+ getSource(id: string): IJGISSource | undefined;
63
+ removeSource(id: string): void;
64
+ addSource(id: string, value: IJGISSource): void;
65
+ updateSource(id: string, value: IJGISSource): void;
66
+ addLayerTreeItem(index: number, item: IJGISLayerItem): void;
67
+ updateLayerTreeItem(index: number, item: IJGISLayerItem): void;
68
+ updateObjectParameters(id: string, value: IJGISLayer['parameters'] | IJGISSource['parameters']): void;
69
+ getObject(id: string): IJGISLayer | IJGISSource | undefined;
70
+ getOption(key: keyof IJGISOptions): IDict | undefined;
71
+ setOption(key: keyof IJGISOptions, value: IDict): void;
72
+ optionsChanged: ISignal<IJupyterGISDoc, MapChange>;
73
+ layersChanged: ISignal<IJupyterGISDoc, IJGISLayerDocChange>;
74
+ sourcesChanged: ISignal<IJupyterGISDoc, IJGISSourceDocChange>;
75
+ layerTreeChanged: ISignal<IJupyterGISDoc, IJGISLayerTreeDocChange>;
76
+ terrainChanged: ISignal<IJupyterGISDoc, IJGISTerrain>;
77
+ }
78
+ export interface IJupyterGISDocChange extends DocumentChange {
79
+ contextChange?: MapChange;
80
+ contentChange?: MapChange;
81
+ layerChange?: Array<{
82
+ name: string;
83
+ key: string;
84
+ newValue: IJGISLayer | undefined;
85
+ }>;
86
+ layerTreeChange?: Delta<IJGISLayerItem[]>;
87
+ optionChange?: MapChange;
88
+ stateChange?: StateChange<any>[];
89
+ }
90
+ export interface IJupyterGISModel extends DocumentRegistry.IModel {
91
+ isDisposed: boolean;
92
+ sharedModel: IJupyterGISDoc;
93
+ localState: IJupyterGISClientState | null;
94
+ themeChanged: Signal<IJupyterGISModel, IChangedArgs<string, string | null, string>>;
95
+ clientStateChanged: ISignal<IJupyterGISModel, Map<number, IJupyterGISClientState>>;
96
+ sharedOptionsChanged: ISignal<IJupyterGISDoc, MapChange>;
97
+ sharedLayersChanged: ISignal<IJupyterGISDoc, IJGISLayerDocChange>;
98
+ sharedLayerTreeChanged: ISignal<IJupyterGISDoc, IJGISLayerTreeDocChange>;
99
+ sharedSourcesChanged: ISignal<IJupyterGISDoc, IJGISSourceDocChange>;
100
+ terrainChanged: ISignal<IJupyterGISDoc, IJGISTerrain>;
101
+ setDrive(value: ICollaborativeDrive, filePath: string): void;
102
+ getContent(): IJGISContent;
103
+ getLayers(): IJGISLayers;
104
+ getLayer(id: string): IJGISLayer | undefined;
105
+ getSources(): IJGISSources;
106
+ getSource(id: string): IJGISSource | undefined;
107
+ getSourcesByType(type: SourceType): {
108
+ [key: string]: string;
109
+ };
110
+ getLayersBySource(id: string): string[];
111
+ getLayerTree(): IJGISLayerTree;
112
+ addLayer(id: string, layer: IJGISLayer, groupName?: string, position?: number): void;
113
+ removeLayer(id: string): void;
114
+ getOptions(): IJGISOptions;
115
+ setOptions(value: IJGISOptions): void;
116
+ readGeoJSON(filepath: string): Promise<GeoJSON | undefined>;
117
+ setTerrain(terrain: IJGISTerrain): void;
118
+ removeLayerGroup(groupName: string): void;
119
+ renameLayerGroup(groupName: string, newName: string): void;
120
+ moveItemsToGroup(items: string[], groupName: string, index?: number): void;
121
+ moveItemRelatedTo(item: string, relativeItem: string, after: boolean): void;
122
+ addNewLayerGroup(selected: {
123
+ [key: string]: ISelection;
124
+ }, group: IJGISLayerGroup): void;
125
+ syncSelected(value: {
126
+ [key: string]: ISelection;
127
+ }, emitter?: string): void;
128
+ setUserToFollow(userId?: number): void;
129
+ getClientId(): number;
130
+ disposed: ISignal<any, void>;
131
+ }
132
+ export interface IUserData {
133
+ userId: number;
134
+ userData: User.IIdentity;
135
+ }
136
+ export type IJupyterGISWidget = IDocumentWidget<SplitPanel, IJupyterGISModel>;
137
+ export type IJupyterGISTracker = IWidgetTracker<IJupyterGISWidget>;
138
+ export interface IJGISFormSchemaRegistry {
139
+ /**
140
+ *
141
+ *
142
+ * @return {*} {IDict}
143
+ * @memberof IJGISFormSchemaRegistry
144
+ */
145
+ getSchemas(): Map<string, IDict>;
146
+ /**
147
+ *
148
+ *
149
+ * @param {string} name
150
+ * @param {IDict} schema
151
+ * @memberof IJGISFormSchemaRegistry
152
+ */
153
+ registerSchema(name: string, schema: IDict): void;
154
+ /**
155
+ *
156
+ *
157
+ * @param {string} name
158
+ * @return {*} {boolean}
159
+ * @memberof IJGISFormSchemaRegistry
160
+ */
161
+ has(name: string): boolean;
162
+ }
163
+ export interface IJGISExternalCommand {
164
+ name: string;
165
+ id: string;
166
+ label?: string;
167
+ }
168
+ export interface IJGISExternalCommandRegistry {
169
+ getCommands(): IJGISExternalCommand[];
170
+ registerCommand(command: IJGISExternalCommand): void;
171
+ }
172
+ /**
173
+ * Defines the structure for entries in a raster layer gallery.
174
+ * Each entry consists of a name, a thumbnail URL, and source information.
175
+ * The source information is expected to conform to the IRasterSource interface.
176
+ *
177
+ * @interface IRasterLayerGalleryEntry
178
+ */
179
+ export interface IRasterLayerGalleryEntry {
180
+ name: string;
181
+ thumbnail: string;
182
+ source: IRasterSource;
183
+ }
184
+ export interface IJGISLayerBrowserRegistry {
185
+ getRegistryLayers(): IRasterLayerGalleryEntry[];
186
+ addRegistryLayer(data: IRasterLayerGalleryEntry): void;
187
+ removeRegistryLayer(name: string): void;
188
+ clearRegistry(): void;
189
+ }
@@ -0,0 +1 @@
1
+ export {};
package/lib/model.d.ts ADDED
@@ -0,0 +1,142 @@
1
+ import { ICollaborativeDrive } from '@jupyter/docprovider';
2
+ import { MapChange } from '@jupyter/ydoc';
3
+ import { IChangedArgs } from '@jupyterlab/coreutils';
4
+ import { DocumentRegistry } from '@jupyterlab/docregistry';
5
+ import { PartialJSONObject } from '@lumino/coreutils';
6
+ import { ISignal, Signal } from '@lumino/signaling';
7
+ import { GeoJSON } from './_interface/geojsonsource';
8
+ import { IJGISContent, IJGISLayer, IJGISLayerGroup, IJGISLayerTree, IJGISLayers, IJGISOptions, IJGISSource, IJGISSources, IJGISTerrain } from './_interface/jgis';
9
+ import { IJGISLayerDocChange, IJGISLayerTreeDocChange, IJGISSourceDocChange, IJupyterGISClientState, IJupyterGISDoc, IJupyterGISModel, ISelection, IUserData } from './interfaces';
10
+ export declare class JupyterGISModel implements IJupyterGISModel {
11
+ constructor(options: DocumentRegistry.IModelOptions<IJupyterGISDoc>);
12
+ private _onSharedModelChanged;
13
+ readonly collaborative = true;
14
+ get sharedModel(): IJupyterGISDoc;
15
+ get isDisposed(): boolean;
16
+ get contentChanged(): ISignal<this, void>;
17
+ get stateChanged(): ISignal<this, IChangedArgs<any, any, string>>;
18
+ get themeChanged(): Signal<this, IChangedArgs<string, string | null, string>>;
19
+ get currentUserId(): number | undefined;
20
+ get users(): IUserData[];
21
+ get userChanged(): ISignal<this, IUserData[]>;
22
+ get dirty(): boolean;
23
+ set dirty(value: boolean);
24
+ get readOnly(): boolean;
25
+ set readOnly(value: boolean);
26
+ get localState(): IJupyterGISClientState | null;
27
+ get clientStateChanged(): ISignal<this, Map<number, IJupyterGISClientState>>;
28
+ get sharedOptionsChanged(): ISignal<IJupyterGISDoc, MapChange>;
29
+ get sharedLayersChanged(): ISignal<IJupyterGISDoc, IJGISLayerDocChange>;
30
+ get sharedLayerTreeChanged(): ISignal<IJupyterGISDoc, IJGISLayerTreeDocChange>;
31
+ get sharedSourcesChanged(): ISignal<IJupyterGISDoc, IJGISSourceDocChange>;
32
+ get terrainChanged(): ISignal<IJupyterGISDoc, IJGISTerrain>;
33
+ get disposed(): ISignal<JupyterGISModel, void>;
34
+ dispose(): void;
35
+ toString(): string;
36
+ fromString(data: string): void;
37
+ toJSON(): PartialJSONObject;
38
+ fromJSON(data: PartialJSONObject): void;
39
+ initialize(): void;
40
+ getWorker(): Worker;
41
+ getContent(): IJGISContent;
42
+ setDrive(value: ICollaborativeDrive, filePath: string): void;
43
+ getLayers(): IJGISLayers;
44
+ getSources(): IJGISSources;
45
+ getLayerTree(): IJGISLayerTree;
46
+ getLayer(id: string): IJGISLayer | undefined;
47
+ getSource(id: string): IJGISSource | undefined;
48
+ /**
49
+ * Get a {[key: id]: name} dictionary of sources for a given source type
50
+ * @param type The required source type
51
+ */
52
+ getSourcesByType(type: string): {
53
+ [key: string]: string;
54
+ };
55
+ /**
56
+ * Get the list of layers using a source.
57
+ *
58
+ * @param id - the source id.
59
+ * @returns a list of layer ids that use the source.
60
+ */
61
+ getLayersBySource(id: string): string[];
62
+ /**
63
+ * Read a GeoJSON file.
64
+ *
65
+ * @param filepath - the path of the GeoJSON file.
66
+ * @returns a promise to the GeoJSON data.
67
+ */
68
+ readGeoJSON(filepath: string): Promise<GeoJSON | undefined>;
69
+ /**
70
+ * Add a layer group in the layer tree.
71
+ *
72
+ * @param name - the name of the group.
73
+ * @param groupName - (optional) the name of the parent group in which to include the
74
+ * new group.
75
+ * @param position - (optional) the index of the new group in its parent group or
76
+ * from root of layer tree.
77
+ */
78
+ addGroup(name: string, groupName?: string, position?: number): void;
79
+ /**
80
+ * Add a layer in the layer tree and the layers list.
81
+ *
82
+ * @param id - the ID of the layer.
83
+ * @param layer - the layer object.
84
+ * @param groupName - (optional) the name of the group in which to include the new
85
+ * layer.
86
+ * @param position - (optional) the index of the new layer in its parent group or
87
+ * from root of layer tree.
88
+ */
89
+ addLayer(id: string, layer: IJGISLayer, groupName?: string, position?: number): void;
90
+ removeLayer(layer_id: string): void;
91
+ setTerrain(terrain: IJGISTerrain): void;
92
+ setOptions(value: IJGISOptions): void;
93
+ getOptions(): IJGISOptions;
94
+ syncSelected(value: {
95
+ [key: string]: ISelection;
96
+ }, emitter?: string): void;
97
+ setUserToFollow(userId?: number): void;
98
+ getClientId(): number;
99
+ /**
100
+ * Add an item in the layer tree.
101
+ *
102
+ * @param item - the item to add.
103
+ * @param groupName - (optional) the name of the parent group in which to include the
104
+ * new item.
105
+ * @param index - (optional) the index of the new item in its parent group or
106
+ * from root of layer tree.
107
+ */
108
+ private _addLayerTreeItem;
109
+ moveItemsToGroup(items: string[], groupName: string, index?: number): void;
110
+ moveItemRelatedTo(item: string, relativeItem: string, after: boolean): void;
111
+ addNewLayerGroup(selected: {
112
+ [key: string]: ISelection;
113
+ }, group: IJGISLayerGroup): void;
114
+ private _removeLayerTreeLayer;
115
+ private _removeLayerTreeGroup;
116
+ renameLayerGroup(groupName: string, newName: string): void;
117
+ removeLayerGroup(groupName: string): void;
118
+ private _getLayerTreeInfo;
119
+ private _onClientStateChanged;
120
+ readonly defaultKernelName: string;
121
+ readonly defaultKernelLanguage: string;
122
+ private _sharedModel;
123
+ private _filePath;
124
+ private _drive?;
125
+ private _dirty;
126
+ private _readOnly;
127
+ private _isDisposed;
128
+ private _userChanged;
129
+ private _usersMap?;
130
+ private _disposed;
131
+ private _contentChanged;
132
+ private _stateChanged;
133
+ private _themeChanged;
134
+ private _clientStateChanged;
135
+ static worker: Worker;
136
+ }
137
+ export declare namespace JupyterGISModel {
138
+ /**
139
+ * Function to get the ordered list of layers according to the tree.
140
+ */
141
+ function getOrderedLayerIds(model: IJupyterGISModel): string[];
142
+ }