@jupytergis/base 0.3.0 → 0.4.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 (77) hide show
  1. package/lib/annotations/components/Annotation.js +1 -1
  2. package/lib/annotations/model.d.ts +6 -7
  3. package/lib/annotations/model.js +15 -15
  4. package/lib/commands.d.ts +2 -3
  5. package/lib/commands.js +117 -62
  6. package/lib/constants.d.ts +2 -0
  7. package/lib/constants.js +4 -1
  8. package/lib/dialogs/formdialog.js +2 -2
  9. package/lib/dialogs/layerBrowserDialog.d.ts +4 -5
  10. package/lib/dialogs/layerBrowserDialog.js +9 -9
  11. package/lib/dialogs/symbology/hooks/useGetBandInfo.d.ts +3 -8
  12. package/lib/dialogs/symbology/hooks/useGetBandInfo.js +16 -28
  13. package/lib/dialogs/symbology/hooks/useGetProperties.d.ts +1 -1
  14. package/lib/dialogs/symbology/hooks/useGetProperties.js +6 -8
  15. package/lib/dialogs/symbology/symbologyDialog.d.ts +2 -3
  16. package/lib/dialogs/symbology/symbologyDialog.js +10 -9
  17. package/lib/dialogs/symbology/tiff_layer/TiffRendering.d.ts +1 -1
  18. package/lib/dialogs/symbology/tiff_layer/TiffRendering.js +6 -6
  19. package/lib/dialogs/symbology/tiff_layer/components/BandRow.js +3 -1
  20. package/lib/dialogs/symbology/tiff_layer/types/MultibandColor.d.ts +1 -1
  21. package/lib/dialogs/symbology/tiff_layer/types/MultibandColor.js +5 -4
  22. package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.d.ts +1 -1
  23. package/lib/dialogs/symbology/tiff_layer/types/SingleBandPseudoColor.js +8 -7
  24. package/lib/dialogs/symbology/vector_layer/VectorRendering.d.ts +1 -1
  25. package/lib/dialogs/symbology/vector_layer/VectorRendering.js +18 -13
  26. package/lib/dialogs/symbology/vector_layer/types/Categorized.d.ts +1 -1
  27. package/lib/dialogs/symbology/vector_layer/types/Categorized.js +30 -19
  28. package/lib/dialogs/symbology/vector_layer/types/Graduated.d.ts +1 -1
  29. package/lib/dialogs/symbology/vector_layer/types/Graduated.js +16 -13
  30. package/lib/dialogs/symbology/vector_layer/types/Heatmap.d.ts +4 -0
  31. package/lib/dialogs/symbology/vector_layer/types/Heatmap.js +77 -0
  32. package/lib/dialogs/symbology/vector_layer/types/SimpleSymbol.d.ts +1 -1
  33. package/lib/dialogs/symbology/vector_layer/types/SimpleSymbol.js +4 -3
  34. package/lib/formbuilder/creationform.d.ts +1 -2
  35. package/lib/formbuilder/creationform.js +4 -4
  36. package/lib/formbuilder/editform.d.ts +1 -2
  37. package/lib/formbuilder/editform.js +7 -7
  38. package/lib/formbuilder/formselectors.js +5 -2
  39. package/lib/formbuilder/objectform/baseform.d.ts +3 -4
  40. package/lib/formbuilder/objectform/baseform.js +2 -2
  41. package/lib/formbuilder/objectform/fileselectorwidget.js +13 -6
  42. package/lib/formbuilder/objectform/geotiffsource.d.ts +5 -1
  43. package/lib/formbuilder/objectform/geotiffsource.js +51 -18
  44. package/lib/formbuilder/objectform/heatmapLayerForm.d.ts +11 -0
  45. package/lib/formbuilder/objectform/heatmapLayerForm.js +60 -0
  46. package/lib/formbuilder/objectform/vectorlayerform.d.ts +0 -2
  47. package/lib/formbuilder/objectform/vectorlayerform.js +0 -59
  48. package/lib/mainview/TemporalSlider.d.ts +8 -0
  49. package/lib/mainview/TemporalSlider.js +303 -0
  50. package/lib/mainview/mainView.d.ts +26 -5
  51. package/lib/mainview/mainView.js +221 -108
  52. package/lib/mainview/mainviewmodel.d.ts +4 -0
  53. package/lib/mainview/mainviewmodel.js +4 -0
  54. package/lib/mainview/mainviewwidget.d.ts +0 -2
  55. package/lib/mainview/mainviewwidget.js +0 -2
  56. package/lib/panelview/annotationPanel.js +5 -5
  57. package/lib/panelview/components/filter-panel/Filter.js +4 -25
  58. package/lib/panelview/components/identify-panel/IdentifyPanel.js +1 -1
  59. package/lib/panelview/components/layers.js +2 -2
  60. package/lib/panelview/components/sources.js +1 -1
  61. package/lib/panelview/leftpanel.d.ts +3 -0
  62. package/lib/panelview/leftpanel.js +5 -1
  63. package/lib/panelview/model.js +8 -8
  64. package/lib/panelview/objectproperties.js +10 -10
  65. package/lib/panelview/rightpanel.d.ts +1 -1
  66. package/lib/panelview/rightpanel.js +10 -10
  67. package/lib/toolbar/widget.d.ts +1 -1
  68. package/lib/toolbar/widget.js +44 -32
  69. package/lib/tools.d.ts +6 -16
  70. package/lib/tools.js +54 -56
  71. package/lib/types.d.ts +2 -0
  72. package/lib/widget.d.ts +30 -6
  73. package/lib/widget.js +43 -9
  74. package/package.json +4 -3
  75. package/style/base.css +10 -0
  76. package/style/symbologyDialog.css +7 -1
  77. package/style/temporalSlider.css +47 -0
package/lib/widget.d.ts CHANGED
@@ -1,25 +1,48 @@
1
- import { JSONValue } from '@lumino/coreutils';
2
- import { ISignal } from '@lumino/signaling';
3
- import { SplitPanel } from '@lumino/widgets';
1
+ import { IJupyterGISDocumentWidget, IJupyterGISModel, IJupyterGISOutputWidget } from '@jupytergis/schema';
2
+ import { MainAreaWidget } from '@jupyterlab/apputils';
4
3
  import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
5
4
  import { DocumentWidget } from '@jupyterlab/docregistry';
6
5
  import { IObservableMap, ObservableMap } from '@jupyterlab/observables';
7
- import { IJupyterGISModel, IJupyterGISWidget } from '@jupytergis/schema';
6
+ import { JSONValue } from '@lumino/coreutils';
7
+ import { ISignal } from '@lumino/signaling';
8
+ import { SplitPanel } from '@lumino/widgets';
9
+ import { CommandRegistry } from '@lumino/commands';
10
+ import { ConsoleView } from './console';
8
11
  import { JupyterGISMainViewPanel } from './mainview';
9
12
  import { MainViewModel } from './mainview/mainviewmodel';
10
- import { ConsoleView } from './console';
11
- export declare class JupyterGISWidget extends DocumentWidget<JupyterGISPanel, IJupyterGISModel> implements IJupyterGISWidget {
13
+ export type JupyterGISWidget = JupyterGISDocumentWidget | JupyterGISOutputWidget;
14
+ export declare class JupyterGISDocumentWidget extends DocumentWidget<JupyterGISPanel, IJupyterGISModel> implements IJupyterGISDocumentWidget {
12
15
  constructor(options: DocumentWidget.IOptions<JupyterGISPanel, IJupyterGISModel>);
16
+ get model(): IJupyterGISModel;
13
17
  /**
14
18
  * Dispose of the resources held by the widget.
15
19
  */
16
20
  dispose(): void;
17
21
  onResize: (msg: any) => void;
18
22
  }
23
+ /**
24
+ * A main area widget designed to be used as Notebook cell output widget, to ease the
25
+ * integration of toolbar and tracking.
26
+ */
27
+ export declare class JupyterGISOutputWidget extends MainAreaWidget<JupyterGISPanel> implements IJupyterGISOutputWidget {
28
+ constructor(options: JupyterGISOutputWidget.IOptions);
29
+ /**
30
+ * Dispose of the resources held by the widget.
31
+ */
32
+ dispose(): void;
33
+ readonly model: IJupyterGISModel;
34
+ readonly resizeObserver: ResizeObserver;
35
+ }
36
+ export declare namespace JupyterGISOutputWidget {
37
+ interface IOptions extends MainAreaWidget.IOptions<JupyterGISPanel> {
38
+ model: IJupyterGISModel;
39
+ }
40
+ }
19
41
  export declare class JupyterGISPanel extends SplitPanel {
20
42
  constructor(options: JupyterGISPanel.IOptions);
21
43
  _initModel(options: {
22
44
  model: IJupyterGISModel;
45
+ commandRegistry: CommandRegistry;
23
46
  }): void;
24
47
  _initView(): void;
25
48
  get jupyterGISMainViewPanel(): JupyterGISMainViewPanel;
@@ -44,6 +67,7 @@ export declare class JupyterGISPanel extends SplitPanel {
44
67
  export declare namespace JupyterGISPanel {
45
68
  interface IOptions extends Partial<ConsoleView.IOptions> {
46
69
  model: IJupyterGISModel;
70
+ commandRegistry: CommandRegistry;
47
71
  consoleTracker?: IConsoleTracker;
48
72
  }
49
73
  }
package/lib/widget.js CHANGED
@@ -9,20 +9,26 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { Signal } from '@lumino/signaling';
13
- import { SplitPanel } from '@lumino/widgets';
12
+ import { MainAreaWidget } from '@jupyterlab/apputils';
14
13
  import { DocumentWidget } from '@jupyterlab/docregistry';
15
14
  import { ObservableMap } from '@jupyterlab/observables';
15
+ import { Signal } from '@lumino/signaling';
16
+ import { SplitPanel, Widget } from '@lumino/widgets';
17
+ import { MessageLoop } from '@lumino/messaging';
18
+ import { ConsoleView } from './console';
16
19
  import { JupyterGISMainViewPanel } from './mainview';
17
20
  import { MainViewModel } from './mainview/mainviewmodel';
18
- import { ConsoleView } from './console';
19
- export class JupyterGISWidget extends DocumentWidget {
21
+ const CELL_OUTPUT_WIDGET_CLASS = 'jgis-cell-output-widget';
22
+ export class JupyterGISDocumentWidget extends DocumentWidget {
20
23
  constructor(options) {
21
24
  super(options);
22
25
  this.onResize = (msg) => {
23
26
  window.dispatchEvent(new Event('resize'));
24
27
  };
25
28
  }
29
+ get model() {
30
+ return this.context.model;
31
+ }
26
32
  /**
27
33
  * Dispose of the resources held by the widget.
28
34
  */
@@ -31,21 +37,49 @@ export class JupyterGISWidget extends DocumentWidget {
31
37
  super.dispose();
32
38
  }
33
39
  }
40
+ /**
41
+ * A main area widget designed to be used as Notebook cell output widget, to ease the
42
+ * integration of toolbar and tracking.
43
+ */
44
+ export class JupyterGISOutputWidget extends MainAreaWidget {
45
+ constructor(options) {
46
+ super(options);
47
+ this.addClass(CELL_OUTPUT_WIDGET_CLASS);
48
+ this.model = options.model;
49
+ this.resizeObserver = new ResizeObserver(() => {
50
+ // Send a resize message to the widget, to update the child size.
51
+ MessageLoop.sendMessage(this, Widget.ResizeMessage.UnknownSize);
52
+ });
53
+ this.resizeObserver.observe(this.node);
54
+ this.model.disposed.connect(() => this.dispose());
55
+ }
56
+ /**
57
+ * Dispose of the resources held by the widget.
58
+ */
59
+ dispose() {
60
+ if (!this.isDisposed) {
61
+ this.resizeObserver.disconnect();
62
+ this.content.dispose();
63
+ super.dispose();
64
+ }
65
+ }
66
+ }
34
67
  export class JupyterGISPanel extends SplitPanel {
35
68
  constructor(options) {
36
69
  super({ orientation: 'vertical', spacing: 0 });
37
70
  this._consoleOpened = false;
38
- const { model, consoleTracker } = options, consoleOption = __rest(options, ["model", "consoleTracker"]);
39
- this._initModel({ model });
71
+ const { model, consoleTracker, commandRegistry } = options, consoleOption = __rest(options, ["model", "consoleTracker", "commandRegistry"]);
72
+ this._initModel({ model, commandRegistry });
40
73
  this._initView();
41
- this._consoleOption = consoleOption;
74
+ this._consoleOption = Object.assign({ commandRegistry }, consoleOption);
42
75
  this._consoleTracker = consoleTracker;
43
76
  }
44
77
  _initModel(options) {
45
78
  this._view = new ObservableMap();
46
79
  this._mainViewModel = new MainViewModel({
47
80
  jGISModel: options.model,
48
- viewSetting: this._view
81
+ viewSetting: this._view,
82
+ commands: options.commandRegistry
49
83
  });
50
84
  }
51
85
  _initView() {
@@ -116,10 +150,10 @@ export class JupyterGISPanel extends SplitPanel {
116
150
  const { consolePanel } = this._consoleView;
117
151
  this._consoleTracker.widgetAdded.emit(consolePanel);
118
152
  await consolePanel.sessionContext.ready;
119
- await consolePanel.console.inject(`from jupytergis_lab import GISDocument\ndoc = GISDocument("${jgisPath}")`);
120
153
  this.addWidget(this._consoleView);
121
154
  this.setRelativeSizes([2, 1]);
122
155
  this._consoleOpened = true;
156
+ await consolePanel.console.inject(`from jupytergis import GISDocument\ndoc = GISDocument("${jgisPath}")`);
123
157
  consolePanel.console.sessionContext.kernelChanged.connect((_, arg) => {
124
158
  if (!arg.newValue) {
125
159
  this.removeConsole();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/base",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "A JupyterLab extension for 3D modelling.",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -43,7 +43,7 @@
43
43
  "@fortawesome/react-fontawesome": "latest",
44
44
  "@jupyter/react-components": "^0.16.6",
45
45
  "@jupyter/ydoc": "^2.0.0 || ^3.0.0",
46
- "@jupytergis/schema": "^0.3.0",
46
+ "@jupytergis/schema": "^0.4.1",
47
47
  "@jupyterlab/application": "^4.3.0",
48
48
  "@jupyterlab/apputils": "^4.3.0",
49
49
  "@jupyterlab/completer": "^4.3.0",
@@ -68,6 +68,7 @@
68
68
  "ajv": "^8.14.0",
69
69
  "colormap": "^2.3.2",
70
70
  "d3-color": "^3.1.0",
71
+ "date-fns": "^4.1.0",
71
72
  "gdal3.js": "^2.8.1",
72
73
  "geojson-vt": "^4.0.2",
73
74
  "geotiff": "^2.1.3",
@@ -76,7 +77,7 @@
76
77
  "pbf": "^4.0.1",
77
78
  "pmtiles": "^3.0.7",
78
79
  "proj4": "^2.14.0",
79
- "proj4-list": "^1.0.2",
80
+ "proj4-list": "^1.0.4",
80
81
  "react": "^18.0.1",
81
82
  "shpjs": "^6.1.0",
82
83
  "styled-components": "^5.3.6",
package/style/base.css CHANGED
@@ -9,6 +9,7 @@
9
9
  @import url('./filterPanel.css');
10
10
  @import url('./symbologyDialog.css');
11
11
  @import url('./statusBar.css');
12
+ @import url('./temporalSlider.css');
12
13
  @import url('ol/ol.css');
13
14
 
14
15
  .jGIS-Toolbar-GroupName {
@@ -49,3 +50,12 @@
49
50
  display: block;
50
51
  position: relative;
51
52
  }
53
+
54
+ /*This is being upstreamed. Will remove once upstream's been fixed.*/
55
+ button.jp-mod-styled.jp-mod-accept {
56
+ background-color: var(--jp-brand-color1) !important;
57
+ }
58
+
59
+ button.jp-mod-styled.jp-mod-reject {
60
+ background-color: var(--jp-layout-color4) !important;
61
+ }
@@ -159,7 +159,7 @@ select option {
159
159
  z-index: 40;
160
160
  flex: 1 1 auto;
161
161
  width: 97%;
162
- max-height: 375px;
162
+ max-height: 20rem;
163
163
  background: var(--jp-input-background);
164
164
  padding-left: 8px;
165
165
  border: var(--jp-border-width) solid var(--jp-input-border-color);
@@ -207,6 +207,12 @@ select option {
207
207
  width: 100%;
208
208
  height: 30px;
209
209
  visibility: initial;
210
+ border-radius: var(--jp-border-radius);
211
+ }
212
+
213
+ .jp-Dialog-content:has(.jp-gis-heatmap),
214
+ .jp-Dialog-body:has(.jp-gis-heatmap) {
215
+ overflow: visible;
210
216
  }
211
217
 
212
218
  .jp-gis-canvas-button-wrapper {
@@ -0,0 +1,47 @@
1
+ .jp-gis-temporal-slider-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 0.2rem;
5
+ padding: 0.5rem;
6
+ background-color: var(--jp-layout-color1);
7
+ border-bottom: 1px solid var(--jp-border-color1);
8
+ }
9
+
10
+ .jp-gis-temporal-slider-container span,
11
+ .jp-gis-temporal-slider-container label {
12
+ font-weight: bold;
13
+ }
14
+
15
+ .jp-gis-temporal-slider-row {
16
+ display: flex;
17
+ gap: 0.25rem;
18
+ justify-content: space-between;
19
+ align-items: center;
20
+ }
21
+
22
+ .jp-gis-temporal-slider-controls {
23
+ display: flex;
24
+ flex-grow: 1;
25
+ justify-content: space-around;
26
+ }
27
+
28
+ .jp-gis-temporal-slider-sub-controls {
29
+ display: flex;
30
+ justify-content: center;
31
+ align-items: center;
32
+ gap: 0.25rem;
33
+ }
34
+
35
+ .jp-gis-temporal-slider-sub-controls > input {
36
+ width: 35px;
37
+ }
38
+
39
+ select,
40
+ select option {
41
+ text-transform: capitalize;
42
+ }
43
+
44
+ .jp-gis-temporal-slider {
45
+ flex: 1 0 40%;
46
+ min-width: 300px;
47
+ }