@jupytergis/jupytergis-qgis 0.4.1 → 0.4.3

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,10 +1,11 @@
1
- import { IJupyterGISDoc, JupyterGISModel } from '@jupytergis/schema';
1
+ import { IJupyterGISDoc, JupyterGISModel, IAnnotationModel } from '@jupytergis/schema';
2
2
  import { DocumentRegistry } from '@jupyterlab/docregistry';
3
3
  import { Contents } from '@jupyterlab/services';
4
4
  /**
5
5
  * A Model factory to create new instances of JupyterGISModel.
6
6
  */
7
7
  export declare class JupyterGISModelFactoryBase implements DocumentRegistry.IModelFactory<JupyterGISModel> {
8
+ constructor(options: JupyterGISModelFactoryBase.IOptions);
8
9
  /**
9
10
  * Whether the model is collaborative or not.
10
11
  */
@@ -50,8 +51,14 @@ export declare class JupyterGISModelFactoryBase implements DocumentRegistry.IMod
50
51
  * @returns The model
51
52
  */
52
53
  createNew(options: DocumentRegistry.IModelOptions<IJupyterGISDoc>): JupyterGISModel;
54
+ private _annotationModel;
53
55
  private _disposed;
54
56
  }
57
+ export declare namespace JupyterGISModelFactoryBase {
58
+ interface IOptions {
59
+ annotationModel: IAnnotationModel;
60
+ }
61
+ }
55
62
  export declare class QGZModelFactory extends JupyterGISModelFactoryBase {
56
63
  /**
57
64
  * The name of the model.
@@ -3,12 +3,13 @@ import { JupyterGISModel } from '@jupytergis/schema';
3
3
  * A Model factory to create new instances of JupyterGISModel.
4
4
  */
5
5
  export class JupyterGISModelFactoryBase {
6
- constructor() {
6
+ constructor(options) {
7
7
  /**
8
8
  * Whether the model is collaborative or not.
9
9
  */
10
10
  this.collaborative = document.querySelectorAll('[data-jupyter-lite-root]')[0] === undefined;
11
11
  this._disposed = false;
12
+ this._annotationModel = options.annotationModel;
12
13
  }
13
14
  /**
14
15
  * The name of the model.
@@ -65,7 +66,8 @@ export class JupyterGISModelFactoryBase {
65
66
  createNew(options) {
66
67
  const model = new JupyterGISModel({
67
68
  sharedModel: options.sharedModel,
68
- languagePreference: options.languagePreference
69
+ languagePreference: options.languagePreference,
70
+ annotationModel: this._annotationModel
69
71
  });
70
72
  return model;
71
73
  }
package/lib/plugins.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ICollaborativeDrive } from '@jupyter/collaborative-drive';
2
- import { IJGISExternalCommandRegistryToken, JupyterGISDoc } from '@jupytergis/schema';
2
+ import { IJGISExternalCommandRegistryToken, JupyterGISDoc, IJupyterGISDocTracker, IAnnotationToken } from '@jupytergis/schema';
3
3
  import { Dialog, ICommandPalette, IThemeManager, InputDialog, showDialog, showErrorMessage } from '@jupyterlab/apputils';
4
4
  import { IEditorServices } from '@jupyterlab/codeeditor';
5
5
  import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
@@ -8,7 +8,6 @@ import { IRenderMimeRegistry } from '@jupyterlab/rendermime';
8
8
  import { Widget } from '@lumino/widgets';
9
9
  import { logoMiniIcon, logoMiniIconQGZ, requestAPI } from '@jupytergis/base';
10
10
  import { JupyterGISDocumentWidgetFactory } from '@jupytergis/jupytergis-core';
11
- import { IJupyterGISDocTracker } from '@jupytergis/schema';
12
11
  import { QGSModelFactory, QGZModelFactory } from './modelfactory';
13
12
  /**
14
13
  * The command IDs used by the qgis plugin.
@@ -17,7 +16,7 @@ var CommandIDs;
17
16
  (function (CommandIDs) {
18
17
  CommandIDs.exportQgis = 'jupytergis:export';
19
18
  })(CommandIDs || (CommandIDs = {}));
20
- const activate = async (app, tracker, themeManager, drive, externalCommandRegistry, contentFactory, editorServices, rendermime, consoleTracker, commandPalette) => {
19
+ const activate = async (app, tracker, themeManager, drive, externalCommandRegistry, contentFactory, editorServices, rendermime, consoleTracker, annotationModel, commandPalette) => {
21
20
  const fcCheck = await requestAPI('jupytergis_qgis/backend-check', {
22
21
  method: 'POST',
23
22
  body: JSON.stringify({})
@@ -63,8 +62,8 @@ const activate = async (app, tracker, themeManager, drive, externalCommandRegist
63
62
  app.docRegistry.addWidgetFactory(QGSWidgetFactory);
64
63
  app.docRegistry.addWidgetFactory(QGZWidgetFactory);
65
64
  // Creating and registering the model factory for our custom DocumentModel
66
- app.docRegistry.addModelFactory(new QGSModelFactory());
67
- app.docRegistry.addModelFactory(new QGZModelFactory());
65
+ app.docRegistry.addModelFactory(new QGSModelFactory({ annotationModel }));
66
+ app.docRegistry.addModelFactory(new QGZModelFactory({ annotationModel }));
68
67
  // register the filetype
69
68
  app.docRegistry.addFileType({
70
69
  name: 'QGS',
@@ -211,7 +210,8 @@ export const qgisplugin = {
211
210
  ConsolePanel.IContentFactory,
212
211
  IEditorServices,
213
212
  IRenderMimeRegistry,
214
- IConsoleTracker
213
+ IConsoleTracker,
214
+ IAnnotationToken
215
215
  ],
216
216
  optional: [ICommandPalette],
217
217
  autoStart: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/jupytergis-qgis",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "JupyterGIS QGIS extension.",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -54,9 +54,9 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@jupyter/collaborative-drive": "^3.0.0",
57
- "@jupytergis/base": "^0.4.1",
58
- "@jupytergis/jupytergis-core": "^0.4.1",
59
- "@jupytergis/schema": "^0.4.1",
57
+ "@jupytergis/base": "^0.4.3",
58
+ "@jupytergis/jupytergis-core": "^0.4.3",
59
+ "@jupytergis/schema": "^0.4.3",
60
60
  "@jupyterlab/application": "^4.3.0",
61
61
  "@jupyterlab/apputils": "^4.3.0",
62
62
  "@jupyterlab/coreutils": "^6.3.0",