@jupytergis/jupytergis-core 0.4.4 → 0.5.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IAnnotationModel, IJupyterGISDoc, JupyterGISModel } from '@jupytergis/schema';
|
|
2
2
|
import { DocumentRegistry } from '@jupyterlab/docregistry';
|
|
3
3
|
import { Contents } from '@jupyterlab/services';
|
|
4
|
+
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
4
5
|
/**
|
|
5
6
|
* A Model factory to create new instances of JupyterGISModel.
|
|
6
7
|
*/
|
|
@@ -52,10 +53,12 @@ export declare class JupyterGISModelFactory implements DocumentRegistry.IModelFa
|
|
|
52
53
|
*/
|
|
53
54
|
createNew(options: DocumentRegistry.IModelOptions<IJupyterGISDoc>): JupyterGISModel;
|
|
54
55
|
private _annotationModel;
|
|
56
|
+
private _settingRegistry;
|
|
55
57
|
private _disposed;
|
|
56
58
|
}
|
|
57
59
|
export declare namespace JupyterGISModelFactory {
|
|
58
60
|
interface IOptions {
|
|
59
61
|
annotationModel: IAnnotationModel;
|
|
62
|
+
settingRegistry: ISettingRegistry;
|
|
60
63
|
}
|
|
61
64
|
}
|
|
@@ -10,6 +10,7 @@ export class JupyterGISModelFactory {
|
|
|
10
10
|
this.collaborative = true;
|
|
11
11
|
this._disposed = false;
|
|
12
12
|
this._annotationModel = options.annotationModel;
|
|
13
|
+
this._settingRegistry = options.settingRegistry;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* The name of the model.
|
|
@@ -67,8 +68,10 @@ export class JupyterGISModelFactory {
|
|
|
67
68
|
const model = new JupyterGISModel({
|
|
68
69
|
sharedModel: options.sharedModel,
|
|
69
70
|
languagePreference: options.languagePreference,
|
|
70
|
-
annotationModel: this._annotationModel
|
|
71
|
+
annotationModel: this._annotationModel,
|
|
72
|
+
settingRegistry: this._settingRegistry
|
|
71
73
|
});
|
|
74
|
+
model.initSettings();
|
|
72
75
|
return model;
|
|
73
76
|
}
|
|
74
77
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ICollaborativeDrive } from '@jupyter/collaborative-drive';
|
|
2
|
-
import { IAnnotationToken, IJGISExternalCommandRegistryToken, IJupyterGISDocTracker, JupyterGISDoc } from '@jupytergis/schema';
|
|
2
|
+
import { IAnnotationToken, IJGISExternalCommandRegistryToken, IJupyterGISDocTracker, JupyterGISDoc, SCHEMA_VERSION } from '@jupytergis/schema';
|
|
3
3
|
import { ICommandPalette, IThemeManager } from '@jupyterlab/apputils';
|
|
4
4
|
import { IEditorServices } from '@jupyterlab/codeeditor';
|
|
5
5
|
import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
|
|
@@ -7,6 +7,7 @@ import { PageConfig } from '@jupyterlab/coreutils';
|
|
|
7
7
|
import { IFileBrowserFactory } from '@jupyterlab/filebrowser';
|
|
8
8
|
import { ILauncher } from '@jupyterlab/launcher';
|
|
9
9
|
import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
|
|
10
|
+
import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
|
10
11
|
import { CommandIDs, logoIcon, logoMiniIcon } from '@jupytergis/base';
|
|
11
12
|
import { JupyterGISDocumentWidgetFactory } from '../factory';
|
|
12
13
|
import { JupyterGISModelFactory } from './modelfactory';
|
|
@@ -15,10 +16,19 @@ const FACTORY = 'JupyterGIS .jgis Viewer';
|
|
|
15
16
|
const CONTENT_TYPE = 'jgis';
|
|
16
17
|
const PALETTE_CATEGORY = 'JupyterGIS';
|
|
17
18
|
const MODEL_NAME = 'jupytergis-jgismodel';
|
|
18
|
-
const
|
|
19
|
+
const SETTINGS_ID = '@jupytergis/jupytergis-core:jupytergis-settings';
|
|
20
|
+
const activate = async (app, tracker, themeManager, browserFactory, externalCommandRegistry, contentFactory, editorServices, rendermime, consoleTracker, annotationModel, settingRegistry, launcher, palette, drive) => {
|
|
19
21
|
if (PageConfig.getOption('jgis_expose_maps')) {
|
|
20
22
|
window.jupytergisMaps = {};
|
|
21
23
|
}
|
|
24
|
+
let settings = null;
|
|
25
|
+
try {
|
|
26
|
+
settings = await settingRegistry.load(SETTINGS_ID);
|
|
27
|
+
console.log(`Loaded settings for ${SETTINGS_ID}`, settings);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.warn(`Failed to load settings for ${SETTINGS_ID}`, error);
|
|
31
|
+
}
|
|
22
32
|
const widgetFactory = new JupyterGISDocumentWidgetFactory({
|
|
23
33
|
name: FACTORY,
|
|
24
34
|
modelName: MODEL_NAME,
|
|
@@ -45,7 +55,10 @@ const activate = (app, tracker, themeManager, browserFactory, externalCommandReg
|
|
|
45
55
|
});
|
|
46
56
|
app.docRegistry.addWidgetFactory(mimeDocumentFactory);
|
|
47
57
|
// Creating and registering the model factory for our custom DocumentModel
|
|
48
|
-
const modelFactory = new JupyterGISModelFactory({
|
|
58
|
+
const modelFactory = new JupyterGISModelFactory({
|
|
59
|
+
annotationModel,
|
|
60
|
+
settingRegistry
|
|
61
|
+
});
|
|
49
62
|
app.docRegistry.addModelFactory(modelFactory);
|
|
50
63
|
// register the filetype
|
|
51
64
|
app.docRegistry.addFileType({
|
|
@@ -100,7 +113,7 @@ const activate = (app, tracker, themeManager, browserFactory, externalCommandReg
|
|
|
100
113
|
type: 'file',
|
|
101
114
|
ext: '.jGIS'
|
|
102
115
|
});
|
|
103
|
-
model = await app.serviceManager.contents.save(model.path, Object.assign(Object.assign({}, model), { format: 'text', size: undefined, content:
|
|
116
|
+
model = await app.serviceManager.contents.save(model.path, Object.assign(Object.assign({}, model), { format: 'text', size: undefined, content: `{\n\t"schemaVersion": "${SCHEMA_VERSION}",\n\t"layers": {},\n\t"sources": {},\n\t"options": {"latitude": 0, "longitude": 0, "zoom": 0, "bearing": 0, "pitch": 0, "projection": "EPSG:3857"},\n\t"layerTree": [],\n\t"metadata": {}\n}` }));
|
|
104
117
|
// Open the newly created file with the 'Editor'
|
|
105
118
|
return app.commands.execute('docmanager:open', {
|
|
106
119
|
path: model.path,
|
|
@@ -144,36 +157,6 @@ const activate = (app, tracker, themeManager, browserFactory, externalCommandReg
|
|
|
144
157
|
command: CommandIDs.newHillshadeEntry,
|
|
145
158
|
category: 'JupyterGIS'
|
|
146
159
|
});
|
|
147
|
-
// Source only
|
|
148
|
-
palette.addItem({
|
|
149
|
-
command: CommandIDs.newRasterSource,
|
|
150
|
-
category: 'JupyterGIS'
|
|
151
|
-
});
|
|
152
|
-
palette.addItem({
|
|
153
|
-
command: CommandIDs.newRasterDemSource,
|
|
154
|
-
category: 'JupyterGIS'
|
|
155
|
-
});
|
|
156
|
-
palette.addItem({
|
|
157
|
-
command: CommandIDs.newVectorSource,
|
|
158
|
-
category: 'JupyterGIS'
|
|
159
|
-
});
|
|
160
|
-
palette.addItem({
|
|
161
|
-
command: CommandIDs.newGeoJSONSource,
|
|
162
|
-
category: 'JupyterGIS'
|
|
163
|
-
});
|
|
164
|
-
// Layers only
|
|
165
|
-
palette.addItem({
|
|
166
|
-
command: CommandIDs.newRasterLayer,
|
|
167
|
-
category: 'JupyterGIS'
|
|
168
|
-
});
|
|
169
|
-
palette.addItem({
|
|
170
|
-
command: CommandIDs.newVectorLayer,
|
|
171
|
-
category: 'JupyterGIS'
|
|
172
|
-
});
|
|
173
|
-
palette.addItem({
|
|
174
|
-
command: CommandIDs.newHillshadeLayer,
|
|
175
|
-
category: 'JupyterGIS'
|
|
176
|
-
});
|
|
177
160
|
// Layer and group actions
|
|
178
161
|
palette.addItem({
|
|
179
162
|
command: CommandIDs.moveLayerToNewGroup,
|
|
@@ -196,7 +179,8 @@ const jGISPlugin = {
|
|
|
196
179
|
IEditorServices,
|
|
197
180
|
IRenderMimeRegistry,
|
|
198
181
|
IConsoleTracker,
|
|
199
|
-
IAnnotationToken
|
|
182
|
+
IAnnotationToken,
|
|
183
|
+
ISettingRegistry
|
|
200
184
|
],
|
|
201
185
|
optional: [ILauncher, ICommandPalette, ICollaborativeDrive],
|
|
202
186
|
autoStart: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupytergis/jupytergis-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "JupyterGIS core extension",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"author": "JupyterGIS contributors",
|
|
16
16
|
"files": [
|
|
17
17
|
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
|
|
18
|
-
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
|
|
18
|
+
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
|
|
19
|
+
"schema/**/*.{json,js,ts}"
|
|
19
20
|
],
|
|
20
21
|
"main": "lib/index.js",
|
|
21
22
|
"types": "lib/index.d.ts",
|
|
@@ -53,8 +54,8 @@
|
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"@jupyter/collaborative-drive": "^3.0.0",
|
|
56
|
-
"@jupytergis/base": "^0.
|
|
57
|
-
"@jupytergis/schema": "^0.
|
|
57
|
+
"@jupytergis/base": "^0.5.0",
|
|
58
|
+
"@jupytergis/schema": "^0.5.0",
|
|
58
59
|
"@jupyterlab/application": "^4.3.0",
|
|
59
60
|
"@jupyterlab/apputils": "^4.3.0",
|
|
60
61
|
"@jupyterlab/docregistry": "^4.3.0",
|
|
@@ -91,6 +92,7 @@
|
|
|
91
92
|
"access": "public"
|
|
92
93
|
},
|
|
93
94
|
"jupyterlab": {
|
|
95
|
+
"schemaDir": "schema",
|
|
94
96
|
"discovery": {
|
|
95
97
|
"server": {
|
|
96
98
|
"managers": [
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "JupyterGIS Settings",
|
|
3
|
+
"description": "Settings for the JupyterGIS extension.",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"proxyUrl": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"title": "Proxy URL",
|
|
9
|
+
"description": "The proxy URL to use for external requests.",
|
|
10
|
+
"default": "https://corsproxy.io"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|