@geogirafe/lib-geoportal 1.1.0-dev.2299940648 → 1.1.0-dev.2316166507

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,11 +1,17 @@
1
1
  import { Map } from 'ol';
2
2
  import olVectorTileLayer from 'ol/layer/VectorTile.js';
3
3
  import LayerVectorTiles from '../../../models/layers/layervectortiles.js';
4
+ import LayerGroup from 'ol/layer/Group.js';
4
5
  declare class VectorTilesManager {
5
6
  map: Map;
6
- basemapLayers: olVectorTileLayer[];
7
+ basemapLayers: (olVectorTileLayer | LayerGroup)[];
7
8
  constructor(map: Map);
8
9
  removeAllBasemapLayers(): void;
10
+ /**
11
+ * Adds a vectortiles basemap based on its layerName. If no layerName is provided,
12
+ * will use apply from ol-mapbox-style to create all layers.
13
+ * @param basemap
14
+ */
9
15
  addBasemapLayer(basemap: LayerVectorTiles): void;
10
16
  }
11
17
  export default VectorTilesManager;
@@ -1,5 +1,6 @@
1
1
  import olVectorTileLayer from 'ol/layer/VectorTile.js';
2
- import { applyStyle } from 'ol-mapbox-style';
2
+ import apply, { applyStyle } from 'ol-mapbox-style';
3
+ import LayerGroup from 'ol/layer/Group.js';
3
4
  class VectorTilesManager {
4
5
  map;
5
6
  basemapLayers = [];
@@ -12,9 +13,21 @@ class VectorTilesManager {
12
13
  });
13
14
  this.basemapLayers = [];
14
15
  }
16
+ /**
17
+ * Adds a vectortiles basemap based on its layerName. If no layerName is provided,
18
+ * will use apply from ol-mapbox-style to create all layers.
19
+ * @param basemap
20
+ */
15
21
  addBasemapLayer(basemap) {
16
- const olayer = new olVectorTileLayer({ declutter: true });
17
- applyStyle(olayer, basemap.style, basemap.source);
22
+ let olayer;
23
+ if (basemap.layerName) {
24
+ olayer = new olVectorTileLayer({ declutter: true });
25
+ applyStyle(olayer, basemap.style, basemap.layerName);
26
+ }
27
+ else {
28
+ olayer = new LayerGroup();
29
+ apply(olayer, basemap.style);
30
+ }
18
31
  this.basemapLayers.push(olayer);
19
32
  // For basemap, set a minimal number (arbitrary defined to less than -5000)
20
33
  olayer.setZIndex(-5000 - basemap.order);
@@ -16,7 +16,7 @@ export default class BasemapSwisstopoVectorTiles extends Basemap {
16
16
  name: 'Swisstopo Vector-Tiles',
17
17
  metadata: { ...basemapMetadata }
18
18
  });
19
- const vectorTilesLayer = new LayerVectorTiles(LayerConsts.LayerSwisstopoVectorTilesId, 'Swisstopo Vector-Tiles', 0, 'https://vectortiles.geo.admin.ch/styles/ch.swisstopo.leichte-basiskarte.vt/style.json', 'leichtebasiskarte_v3.0.1', { projection: 'EPSG:3857' });
19
+ const vectorTilesLayer = new LayerVectorTiles(LayerConsts.LayerSwisstopoVectorTilesId, 'Swisstopo Vector-Tiles', 0, 'https://vectortiles.geo.admin.ch/styles/ch.swisstopo.lightbasemap.vt/style.json', { projection: 'EPSG:3857' });
20
20
  this.layersList.push(vectorTilesLayer);
21
21
  }
22
22
  }
@@ -1,6 +1,7 @@
1
1
  import Layer from './layer.js';
2
2
  type LayerVectorTilesOptions = {
3
3
  projection?: string;
4
+ layerName?: string;
4
5
  isDefaultChecked?: boolean;
5
6
  disclaimer?: string;
6
7
  metadataUrl?: string;
@@ -16,9 +17,9 @@ declare class LayerVectorTiles extends Layer {
16
17
  * For example, any method doing <this.xxx = value> is forbidden here, because the modification be known from the proxy
17
18
  */
18
19
  style: string;
19
- source: string;
20
+ layerName?: string;
20
21
  projection?: string;
21
- constructor(id: number, name: string, order: number, style: string, source: string, options?: LayerVectorTilesOptions);
22
+ constructor(id: number, name: string, order: number, style: string, options?: LayerVectorTilesOptions);
22
23
  clone(): LayerVectorTiles;
23
24
  }
24
25
  export default LayerVectorTiles;
@@ -8,24 +8,25 @@ class LayerVectorTiles extends Layer {
8
8
  * For example, any method doing <this.xxx = value> is forbidden here, because the modification be known from the proxy
9
9
  */
10
10
  style;
11
- source;
11
+ layerName;
12
12
  projection;
13
- constructor(id, name, order, style, source, options) {
13
+ constructor(id, name, order, style, options) {
14
14
  super(id, name, order, options);
15
15
  this.style = style;
16
- this.source = source;
16
+ this.layerName = options?.layerName;
17
17
  this.projection = options?.projection;
18
18
  }
19
19
  clone() {
20
20
  const options = {
21
21
  projection: this.projection,
22
+ layerName: this.layerName,
22
23
  isDefaultChecked: this.isDefaultChecked,
23
24
  metadataUrl: this.metadataUrl,
24
25
  disclaimer: this.disclaimer,
25
26
  opacity: this.opacity,
26
27
  restricted: this.restricted
27
28
  };
28
- const clonedObject = new LayerVectorTiles(this.id, this.name, this.order, this.style, this.source, options);
29
+ const clonedObject = new LayerVectorTiles(this.id, this.name, this.order, this.style, options);
29
30
  clonedObject.activeState = this.activeState;
30
31
  return clonedObject;
31
32
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "GeoGirafe PSC",
6
6
  "url": "https://doc.geomapfish.dev"
7
7
  },
8
- "version": "1.1.0-dev.2299940648",
8
+ "version": "1.1.0-dev.2316166507",
9
9
  "type": "module",
10
10
  "engines": {
11
11
  "node": ">=20.19.0"
@@ -52,7 +52,7 @@
52
52
  "vanilla-picker": "2.12.3"
53
53
  },
54
54
  "peerDependencies": {
55
- "@geoblocks/mapfishprint": "0.2",
55
+ "@geoblocks/mapfishprint": "0.3",
56
56
  "@types/geojson": "7946",
57
57
  "cesium": ">1.113",
58
58
  "ol": "8 || 9 || 10",
@@ -62,7 +62,7 @@
62
62
  "proj4": "2"
63
63
  },
64
64
  "devDependencies": {
65
- "@geoblocks/mapfishprint": "0.2.20",
65
+ "@geoblocks/mapfishprint": "0.3.0",
66
66
  "@geoblocks/print": "0.7.9",
67
67
  "@types/babel__generator": "7.27.0",
68
68
  "@types/d3": "7.4.3",
@@ -1 +1 @@
1
- {"version":"1.1.0-dev.2299940648", "build":"2299940648", "date":"02/02/2026"}
1
+ {"version":"1.1.0-dev.2316166507", "build":"2316166507", "date":"10/02/2026"}
@@ -8,6 +8,4 @@
8
8
  * });
9
9
  * </code>
10
10
  */
11
- export const KNOWN_FUNCTIONALITIES = [
12
- "default_basemap"
13
- ];
11
+ export const KNOWN_FUNCTIONALITIES = ['default_basemap'];
@@ -193,7 +193,7 @@ describe('ThemesHelper.onSelectedThemeChanged', () => {
193
193
  it('should NOT trigger change in functionalities if functionality is not known', () => {
194
194
  stateManager.state.themes._allFunctionalities = {
195
195
  42: {
196
- unknown_functionality: "Lorem Ipsum Dolor Sit Amet"
196
+ unknown_functionality: 'Lorem Ipsum Dolor Sit Amet'
197
197
  }
198
198
  };
199
199
  let subscriptionCalled = false;
@@ -371,12 +371,13 @@ class ThemesManager extends GirafeSingleton {
371
371
  projection: 'EPSG:3857',
372
372
  isDefaultChecked: elem.metadata?.isChecked,
373
373
  disclaimer: elem.metadata?.disclaimer,
374
- metadata: elem.metadata
374
+ metadata: elem.metadata,
375
+ layerName: elem.metadata.layerName
375
376
  };
376
377
  if (options.metadata?.metadataUrl) {
377
378
  options.metadata.metadataUrl = this.calculateMetadataUrl(options.metadata.metadataUrl);
378
379
  }
379
- return new LayerVectorTiles(elem.id, elem.name, order.value, elem.style, elem.metadata.layerName, options);
380
+ return new LayerVectorTiles(elem.id, elem.name, order.value, elem.style, options);
380
381
  }
381
382
  return null;
382
383
  }