@jupytergis/base 0.8.0 → 0.8.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.
@@ -85,6 +85,7 @@ export function addCommands(app, tracker, translator, formSchemaRegistry, layerB
85
85
  'VectorLayer',
86
86
  'ShapefileLayer',
87
87
  'WebGlLayer',
88
+ 'VectorTileLayer',
88
89
  ].includes(selectedLayer.type);
89
90
  const isIdentifying = current.model.isIdentifying;
90
91
  if (isIdentifying && !canIdentify) {
@@ -98,7 +99,12 @@ export function addCommands(app, tracker, translator, formSchemaRegistry, layerB
98
99
  if (!selectedLayer) {
99
100
  return false;
100
101
  }
101
- return ['VectorLayer', 'ShapefileLayer', 'WebGlLayer'].includes(selectedLayer.type);
102
+ return [
103
+ 'VectorLayer',
104
+ 'ShapefileLayer',
105
+ 'WebGlLayer',
106
+ 'VectorTileLayer',
107
+ ].includes(selectedLayer.type);
102
108
  }, execute: args => {
103
109
  const current = tracker.currentWidget;
104
110
  if (!current) {
@@ -14,7 +14,7 @@ import { Heatmap as HeatmapLayer, Image as ImageLayer, Layer, Vector as VectorLa
14
14
  import TileLayer from 'ol/layer/Tile';
15
15
  import { fromLonLat, get as getProjection, toLonLat, transformExtent, } from 'ol/proj';
16
16
  import { register } from 'ol/proj/proj4.js';
17
- import RenderFeature from 'ol/render/Feature';
17
+ import RenderFeature, { toGeometry } from 'ol/render/Feature';
18
18
  import { GeoTIFF as GeoTIFFSource, ImageTile as ImageTileSource, Vector as VectorSource, VectorTile as VectorTileSource, XYZ as XYZSource, Tile as TileSource, } from 'ol/source';
19
19
  import Static from 'ol/source/ImageStatic';
20
20
  import { Circle, Fill, Stroke, Style } from 'ol/style';
@@ -664,7 +664,8 @@ export class MainView extends React.Component {
664
664
  switch (source.type) {
665
665
  case 'RasterSource': {
666
666
  const sourceParameters = source.parameters;
667
- const pmTiles = sourceParameters.url.endsWith('.pmtiles');
667
+ const pmTiles = sourceParameters.url.endsWith('.pmtiles') ||
668
+ sourceParameters.url.endsWith('pmtiles.gz');
668
669
  const url = this.computeSourceUrl(source);
669
670
  if (!pmTiles) {
670
671
  newSource = new XYZSource({
@@ -697,7 +698,8 @@ export class MainView extends React.Component {
697
698
  }
698
699
  case 'VectorTileSource': {
699
700
  const sourceParameters = source.parameters;
700
- const pmTiles = sourceParameters.url.endsWith('.pmtiles');
701
+ const pmTiles = sourceParameters.url.endsWith('.pmtiles') ||
702
+ sourceParameters.url.endsWith('pmtiles.gz');
701
703
  const url = this.computeSourceUrl(source);
702
704
  if (!pmTiles) {
703
705
  newSource = new VectorTileSource({
@@ -720,7 +722,10 @@ export class MainView extends React.Component {
720
722
  const tile = event.tile;
721
723
  const features = tile.getFeatures();
722
724
  if (features && features.length > 0) {
723
- this._model.syncTileFeatures({ sourceId: id, features });
725
+ this._model.syncTileFeatures({
726
+ sourceId: id,
727
+ features,
728
+ });
724
729
  }
725
730
  });
726
731
  break;
@@ -1587,6 +1592,39 @@ export class MainView extends React.Component {
1587
1592
  const layerId = Object.keys(selectedLayer)[0];
1588
1593
  const jgisLayer = this._model.getLayer(layerId);
1589
1594
  switch (jgisLayer === null || jgisLayer === void 0 ? void 0 : jgisLayer.type) {
1595
+ case 'VectorTileLayer': {
1596
+ const geometries = [];
1597
+ const features = [];
1598
+ this._Map.forEachFeatureAtPixel(e.pixel, (feature) => {
1599
+ let geom;
1600
+ if (feature instanceof RenderFeature) {
1601
+ geom = toGeometry(feature);
1602
+ }
1603
+ else if ('getGeometry' in feature) {
1604
+ geom = feature.getGeometry();
1605
+ }
1606
+ const props = feature.getProperties();
1607
+ if (geom) {
1608
+ geometries.push(geom);
1609
+ }
1610
+ features.push(Object.assign({}, props));
1611
+ return true;
1612
+ });
1613
+ if (features.length > 0) {
1614
+ this._model.syncIdentifiedFeatures(features, this._mainViewModel.id);
1615
+ }
1616
+ if (geometries.length > 0) {
1617
+ for (const geom of geometries) {
1618
+ this._model.highlightFeatureSignal.emit(geom);
1619
+ }
1620
+ }
1621
+ else {
1622
+ const coordinate = this._Map.getCoordinateFromPixel(e.pixel);
1623
+ const point = new Point(coordinate);
1624
+ this._model.highlightFeatureSignal.emit(point);
1625
+ }
1626
+ break;
1627
+ }
1590
1628
  case 'WebGlLayer': {
1591
1629
  const layer = this.getLayer(layerId);
1592
1630
  const data = layer.getData(e.pixel);
@@ -1,12 +1,14 @@
1
+ import { PageConfig } from '@jupyterlab/coreutils';
1
2
  import * as React from 'react';
2
3
  import { LayersBodyComponent } from './components/layers';
3
4
  import { PanelTabs, TabsContent, TabsList, TabsTrigger, } from '../shared/components/Tabs';
4
5
  import StacPanel from '../stacBrowser/components/StacPanel';
5
6
  import FilterComponent from './components/filter-panel/Filter';
6
7
  export const LeftPanel = (props) => {
8
+ const hideStacPanel = PageConfig.getOption('HIDE_STAC_PANEL') === 'true';
7
9
  const tabInfo = [
8
10
  { name: 'layers', title: 'Layers' },
9
- { name: 'stac', title: 'Stac Browser' },
11
+ ...(hideStacPanel ? [] : [{ name: 'stac', title: 'Stac Browser' }]),
10
12
  { name: 'filters', title: 'Filters' },
11
13
  ];
12
14
  const [curTab, setCurTab] = React.useState(tabInfo[0].name);
@@ -24,8 +26,8 @@ export const LeftPanel = (props) => {
24
26
  })),
25
27
  React.createElement(TabsContent, { value: "layers", className: "jgis-panel-tab-content jp-gis-layerPanel" },
26
28
  React.createElement(LayersBodyComponent, { model: props.model, commands: props.commands, state: props.state })),
27
- React.createElement(TabsContent, { value: "stac" },
28
- React.createElement(StacPanel, { model: props.model })),
29
+ !hideStacPanel && (React.createElement(TabsContent, { value: "stac" },
30
+ React.createElement(StacPanel, { model: props.model }))),
29
31
  React.createElement(TabsContent, { value: "filters", className: "jgis-panel-tab-content" },
30
32
  React.createElement(FilterComponent, { model: props.model }),
31
33
  ","))));
@@ -1,13 +1,17 @@
1
+ import { PageConfig } from '@jupyterlab/coreutils';
1
2
  import * as React from 'react';
2
3
  import { AnnotationsPanel } from './annotationPanel';
3
4
  import { IdentifyPanelComponent } from './components/identify-panel/IdentifyPanel';
4
5
  import { ObjectPropertiesReact } from './objectproperties';
5
6
  import { PanelTabs, TabsContent, TabsList, TabsTrigger, } from '../shared/components/Tabs';
6
7
  export const RightPanel = props => {
8
+ const hideAnnotationPanel = PageConfig.getOption('HIDE_ANNOTATION_PANEL') === 'true';
7
9
  const [selectedObjectProperties, setSelectedObjectProperties] = React.useState(undefined);
8
10
  const tabInfo = [
9
11
  { name: 'objectProperties', title: 'Object Properties' },
10
- { name: 'annotations', title: 'Annotations' },
12
+ ...(hideAnnotationPanel
13
+ ? []
14
+ : [{ name: 'annotations', title: 'Annotations' }]),
11
15
  { name: 'identifyPanel', title: 'Identify Features' },
12
16
  ];
13
17
  const [curTab, setCurTab] = React.useState(tabInfo[0].name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupytergis/base",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "A JupyterLab extension for 3D modelling.",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -44,7 +44,7 @@
44
44
  "@jupyter/collaboration": "^3.1.0",
45
45
  "@jupyter/react-components": "^0.16.6",
46
46
  "@jupyter/ydoc": "^2.0.0 || ^3.0.0",
47
- "@jupytergis/schema": "^0.8.0",
47
+ "@jupytergis/schema": "^0.8.1",
48
48
  "@jupyterlab/application": "^4.3.0",
49
49
  "@jupyterlab/apputils": "^4.3.0",
50
50
  "@jupyterlab/completer": "^4.3.0",