@open-pioneer/map 0.0.0-dev-20241120114910

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 (115) hide show
  1. package/CHANGELOG.md +354 -0
  2. package/LICENSE +202 -0
  3. package/MapRegistryImpl.d.ts +17 -0
  4. package/MapRegistryImpl.js +91 -0
  5. package/MapRegistryImpl.js.map +1 -0
  6. package/README.md +871 -0
  7. package/_virtual/_virtual-pioneer-module_react-hooks.js +7 -0
  8. package/_virtual/_virtual-pioneer-module_react-hooks.js.map +1 -0
  9. package/api/BaseFeature.d.ts +31 -0
  10. package/api/MapConfig.d.ts +111 -0
  11. package/api/MapModel.d.ts +229 -0
  12. package/api/MapRegistry.d.ts +48 -0
  13. package/api/index.d.ts +15 -0
  14. package/api/layers/GroupLayer.d.ts +50 -0
  15. package/api/layers/GroupLayer.js +6 -0
  16. package/api/layers/GroupLayer.js.map +1 -0
  17. package/api/layers/SimpleLayer.d.ts +27 -0
  18. package/api/layers/SimpleLayer.js +6 -0
  19. package/api/layers/SimpleLayer.js.map +1 -0
  20. package/api/layers/WMSLayer.d.ts +57 -0
  21. package/api/layers/WMSLayer.js +6 -0
  22. package/api/layers/WMSLayer.js.map +1 -0
  23. package/api/layers/WMTSLayer.d.ts +33 -0
  24. package/api/layers/WMTSLayer.js +6 -0
  25. package/api/layers/WMTSLayer.js.map +1 -0
  26. package/api/layers/base.d.ts +242 -0
  27. package/api/layers/base.js +9 -0
  28. package/api/layers/base.js.map +1 -0
  29. package/api/layers/index.d.ts +5 -0
  30. package/api/shared.d.ts +10 -0
  31. package/assets/images/mapMarker.png +0 -0
  32. package/index.d.ts +1 -0
  33. package/index.js +15 -0
  34. package/index.js.map +1 -0
  35. package/internalTestSupport.d.ts +8 -0
  36. package/internalTestSupport.js +2 -0
  37. package/internalTestSupport.js.map +1 -0
  38. package/layers/BkgTopPlusOpen.d.ts +21 -0
  39. package/layers/BkgTopPlusOpen.js +61 -0
  40. package/layers/BkgTopPlusOpen.js.map +1 -0
  41. package/model/AbstractLayer.d.ts +25 -0
  42. package/model/AbstractLayer.js +186 -0
  43. package/model/AbstractLayer.js.map +1 -0
  44. package/model/AbstractLayerBase.d.ts +54 -0
  45. package/model/AbstractLayerBase.js +119 -0
  46. package/model/AbstractLayerBase.js.map +1 -0
  47. package/model/Highlights.d.ts +42 -0
  48. package/model/Highlights.js +272 -0
  49. package/model/Highlights.js.map +1 -0
  50. package/model/LayerCollectionImpl.d.ts +27 -0
  51. package/model/LayerCollectionImpl.js +228 -0
  52. package/model/LayerCollectionImpl.js.map +1 -0
  53. package/model/MapModelImpl.d.ts +46 -0
  54. package/model/MapModelImpl.js +271 -0
  55. package/model/MapModelImpl.js.map +1 -0
  56. package/model/SublayersCollectionImpl.d.ts +18 -0
  57. package/model/SublayersCollectionImpl.js +31 -0
  58. package/model/SublayersCollectionImpl.js.map +1 -0
  59. package/model/createMapModel.d.ts +4 -0
  60. package/model/createMapModel.js +157 -0
  61. package/model/createMapModel.js.map +1 -0
  62. package/model/layers/GroupLayerImpl.d.ts +39 -0
  63. package/model/layers/GroupLayerImpl.js +88 -0
  64. package/model/layers/GroupLayerImpl.js.map +1 -0
  65. package/model/layers/SimpleLayerImpl.d.ts +13 -0
  66. package/model/layers/SimpleLayerImpl.js +19 -0
  67. package/model/layers/SimpleLayerImpl.js.map +1 -0
  68. package/model/layers/WMSLayerImpl.d.ts +41 -0
  69. package/model/layers/WMSLayerImpl.js +297 -0
  70. package/model/layers/WMSLayerImpl.js.map +1 -0
  71. package/model/layers/WMTSLayerImpl.d.ts +17 -0
  72. package/model/layers/WMTSLayerImpl.js +156 -0
  73. package/model/layers/WMTSLayerImpl.js.map +1 -0
  74. package/package.json +86 -0
  75. package/projections.d.ts +27 -0
  76. package/projections.js +15 -0
  77. package/projections.js.map +1 -0
  78. package/services.d.ts +1 -0
  79. package/services.js +2 -0
  80. package/services.js.map +1 -0
  81. package/ui/CssProps.d.ts +9 -0
  82. package/ui/CssProps.js +13 -0
  83. package/ui/CssProps.js.map +1 -0
  84. package/ui/DefaultMapProvider.d.ts +39 -0
  85. package/ui/DefaultMapProvider.js +24 -0
  86. package/ui/DefaultMapProvider.js.map +1 -0
  87. package/ui/MapAnchor.d.ts +36 -0
  88. package/ui/MapAnchor.js +28 -0
  89. package/ui/MapAnchor.js.map +1 -0
  90. package/ui/MapContainer.d.ts +50 -0
  91. package/ui/MapContainer.js +191 -0
  92. package/ui/MapContainer.js.map +1 -0
  93. package/ui/MapContainerContext.d.ts +7 -0
  94. package/ui/MapContainerContext.js +17 -0
  95. package/ui/MapContainerContext.js.map +1 -0
  96. package/ui/computeMapAnchorStyles.d.ts +3 -0
  97. package/ui/computeMapAnchorStyles.js +51 -0
  98. package/ui/computeMapAnchorStyles.js.map +1 -0
  99. package/ui/hooks.d.ts +34 -0
  100. package/ui/hooks.js +73 -0
  101. package/ui/hooks.js.map +1 -0
  102. package/ui/styles.css +10 -0
  103. package/ui/styles.css.map +1 -0
  104. package/ui/useMapModel.d.ts +58 -0
  105. package/ui/useMapModel.js +59 -0
  106. package/ui/useMapModel.js.map +1 -0
  107. package/util/capabilities-utils.d.ts +2 -0
  108. package/util/capabilities-utils.js +11 -0
  109. package/util/capabilities-utils.js.map +1 -0
  110. package/util/geometry-utils.d.ts +7 -0
  111. package/util/geometry-utils.js +25 -0
  112. package/util/geometry-utils.js.map +1 -0
  113. package/util/ol-test-support.d.ts +2 -0
  114. package/util/ol-test-support.js +24 -0
  115. package/util/ol-test-support.js.map +1 -0
@@ -0,0 +1,31 @@
1
+ class SublayersCollectionImpl {
2
+ /* eslint-enable indent */
3
+ #sublayers;
4
+ constructor(sublayers) {
5
+ this.#sublayers = sublayers;
6
+ }
7
+ destroy() {
8
+ for (const layer of this.#sublayers) {
9
+ layer.destroy();
10
+ }
11
+ this.#sublayers = [];
12
+ }
13
+ // Generic method name for consistent interface
14
+ getItems(options) {
15
+ return this.getSublayers(options);
16
+ }
17
+ getSublayers(_options) {
18
+ return this.#sublayers.slice();
19
+ }
20
+ /**
21
+ * Returns a reference to the internal sublayers array.
22
+ *
23
+ * NOTE: Do not modify directly!
24
+ */
25
+ __getRawSublayers() {
26
+ return this.#sublayers;
27
+ }
28
+ }
29
+
30
+ export { SublayersCollectionImpl };
31
+ //# sourceMappingURL=SublayersCollectionImpl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SublayersCollectionImpl.js","sources":["SublayersCollectionImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { LayerRetrievalOptions, SublayerBaseType, SublayersCollection } from \"../api\";\nimport { AbstractLayerBase } from \"./AbstractLayerBase\";\n\n/**\n * Manages the sublayers of a layer.\n */\n// NOTE: adding / removing sublayers currently not supported\n/* eslint-disable indent */\nexport class SublayersCollectionImpl<Sublayer extends SublayerBaseType & AbstractLayerBase>\n implements SublayersCollection<Sublayer>\n{\n /* eslint-enable indent */\n #sublayers: Sublayer[];\n\n constructor(sublayers: Sublayer[]) {\n this.#sublayers = sublayers;\n }\n\n destroy() {\n for (const layer of this.#sublayers) {\n layer.destroy();\n }\n this.#sublayers = [];\n }\n\n // Generic method name for consistent interface\n getItems(options?: LayerRetrievalOptions): Sublayer[] {\n return this.getSublayers(options);\n }\n\n getSublayers(_options?: LayerRetrievalOptions | undefined): Sublayer[] {\n // NOTE: options are ignored because layers are always ordered at this time.\n return this.#sublayers.slice();\n }\n\n /**\n * Returns a reference to the internal sublayers array.\n *\n * NOTE: Do not modify directly!\n */\n __getRawSublayers(): Sublayer[] {\n return this.#sublayers;\n }\n}\n"],"names":[],"mappings":"AAUO,MAAM,uBAEb,CAAA;AAAA;AAAA,EAEI,UAAA,CAAA;AAAA,EAEA,YAAY,SAAuB,EAAA;AAC/B,IAAA,IAAA,CAAK,UAAa,GAAA,SAAA,CAAA;AAAA,GACtB;AAAA,EAEA,OAAU,GAAA;AACN,IAAW,KAAA,MAAA,KAAA,IAAS,KAAK,UAAY,EAAA;AACjC,MAAA,KAAA,CAAM,OAAQ,EAAA,CAAA;AAAA,KAClB;AACA,IAAA,IAAA,CAAK,aAAa,EAAC,CAAA;AAAA,GACvB;AAAA;AAAA,EAGA,SAAS,OAA6C,EAAA;AAClD,IAAO,OAAA,IAAA,CAAK,aAAa,OAAO,CAAA,CAAA;AAAA,GACpC;AAAA,EAEA,aAAa,QAA0D,EAAA;AAEnE,IAAO,OAAA,IAAA,CAAK,WAAW,KAAM,EAAA,CAAA;AAAA,GACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,iBAAgC,GAAA;AAC5B,IAAA,OAAO,IAAK,CAAA,UAAA,CAAA;AAAA,GAChB;AACJ;;;;"}
@@ -0,0 +1,4 @@
1
+ import { MapModelImpl } from "./MapModelImpl";
2
+ import { MapConfig } from "../api";
3
+ import { HttpService } from "@open-pioneer/http";
4
+ export declare function createMapModel(mapId: string, mapConfig: MapConfig, httpService: HttpService): Promise<MapModelImpl>;
@@ -0,0 +1,157 @@
1
+ import { createLogger } from '@open-pioneer/core';
2
+ import OlMap from 'ol/Map.js';
3
+ import View from 'ol/View.js';
4
+ import Attribution from 'ol/control/Attribution.js';
5
+ import { getCenter } from 'ol/extent.js';
6
+ import TileLayer from 'ol/layer/Tile.js';
7
+ import { get } from 'ol/proj.js';
8
+ import OSM from 'ol/source/OSM.js';
9
+ import { defaults, DragZoom } from 'ol/interaction.js';
10
+ import { MapModelImpl } from './MapModelImpl.js';
11
+ import { registerProjections } from '../projections.js';
12
+ import { patchOpenLayersClassesForTesting } from '../util/ol-test-support.js';
13
+
14
+ registerProjections({
15
+ "EPSG:25832": "+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs",
16
+ "EPSG:25833": "+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs"
17
+ });
18
+ const LOG = createLogger("map:createMapModel");
19
+ async function createMapModel(mapId, mapConfig, httpService) {
20
+ return await new MapModelFactory(mapId, mapConfig, httpService).createMapModel();
21
+ }
22
+ class MapModelFactory {
23
+ mapId;
24
+ mapConfig;
25
+ httpService;
26
+ constructor(mapId, mapConfig, httpService) {
27
+ this.mapId = mapId;
28
+ this.mapConfig = mapConfig;
29
+ this.httpService = httpService;
30
+ }
31
+ async createMapModel() {
32
+ const mapId = this.mapId;
33
+ const mapConfig = this.mapConfig;
34
+ const { view: viewOption, ...rawOlOptions } = mapConfig.advanced ?? {};
35
+ const mapOptions = {
36
+ ...rawOlOptions
37
+ };
38
+ if (!mapOptions.controls) {
39
+ mapOptions.controls = [new Attribution({ collapsible: false })];
40
+ }
41
+ if (!mapOptions.interactions) {
42
+ const shiftCtrlKeysOnly = (mapBrowserEvent) => {
43
+ const originalEvent = mapBrowserEvent.originalEvent;
44
+ return (originalEvent.metaKey || originalEvent.ctrlKey) && originalEvent.shiftKey;
45
+ };
46
+ mapOptions.interactions = defaults({
47
+ dragPan: true,
48
+ altShiftDragRotate: false,
49
+ pinchRotate: false,
50
+ mouseWheelZoom: true
51
+ }).extend([new DragZoom({ out: true, condition: shiftCtrlKeysOnly })]);
52
+ }
53
+ const view = await viewOption ?? {};
54
+ this.initializeViewOptions(view);
55
+ mapOptions.view = view instanceof View ? view : new View(view);
56
+ if (!mapOptions.layers && !mapConfig.layers) {
57
+ mapOptions.layers = [
58
+ new TileLayer({
59
+ source: new OSM()
60
+ })
61
+ ];
62
+ }
63
+ const initialView = mapConfig.initialView;
64
+ const initialExtent = initialView?.kind === "extent" ? initialView.extent : void 0;
65
+ LOG.debug(`Constructing OpenLayers map with options`, mapOptions);
66
+ if (import.meta.env.VITEST) {
67
+ patchOpenLayersClassesForTesting();
68
+ }
69
+ const olMap = new OlMap(mapOptions);
70
+ const mapModel = new MapModelImpl({
71
+ id: mapId,
72
+ olMap,
73
+ initialExtent,
74
+ httpService: this.httpService
75
+ });
76
+ try {
77
+ if (mapConfig.layers) {
78
+ for (const layerConfig of mapConfig.layers) {
79
+ mapModel.layers.addLayer(layerConfig);
80
+ }
81
+ }
82
+ return mapModel;
83
+ } catch (e) {
84
+ mapModel.destroy();
85
+ throw e;
86
+ }
87
+ }
88
+ initializeViewOptions(view) {
89
+ const mapId = this.mapId;
90
+ const mapConfig = this.mapConfig;
91
+ if (view instanceof View) {
92
+ const warn = (prop) => {
93
+ LOG.warn(
94
+ `The advanced configuration for map id '${mapId}' has provided a fully constructed view instance: ${prop} cannot be applied.
95
+ Use ViewOptions instead of a View instance.`
96
+ );
97
+ };
98
+ if (mapConfig.projection != null) {
99
+ warn("projection");
100
+ }
101
+ if (mapConfig.initialView != null) {
102
+ warn("initialView");
103
+ }
104
+ return;
105
+ }
106
+ const projection = view.projection = this.initializeProjection(mapConfig.projection);
107
+ const initialView = mapConfig.initialView;
108
+ if (initialView) {
109
+ switch (initialView.kind) {
110
+ case "position":
111
+ view.zoom = initialView.zoom;
112
+ view.center = [initialView.center.x, initialView.center.y];
113
+ break;
114
+ case "extent": {
115
+ const extent = initialView.extent;
116
+ view.zoom = 0;
117
+ view.center = [
118
+ extent.xMin + (extent.xMax - extent.xMin) / 2,
119
+ extent.yMin + (extent.yMax - extent.yMin) / 2
120
+ ];
121
+ break;
122
+ }
123
+ }
124
+ } else {
125
+ this.setViewDefaults(view, projection);
126
+ }
127
+ }
128
+ setViewDefaults(view, projection) {
129
+ if (view.center == null) {
130
+ const extent = projection.getExtent();
131
+ if (!extent) {
132
+ LOG.warn(
133
+ `Cannot set default center coordinate because the current projection has no associated extent.
134
+ Try to configure 'initialView' explicity.`
135
+ );
136
+ } else {
137
+ view.center = getCenter(extent);
138
+ }
139
+ }
140
+ if (view.zoom == null || view.resolution == null) {
141
+ view.zoom = 0;
142
+ }
143
+ }
144
+ initializeProjection(projectionOption) {
145
+ if (projectionOption == null) {
146
+ return get("EPSG:3857");
147
+ }
148
+ const projection = get(projectionOption);
149
+ if (!projection) {
150
+ throw new Error(`Failed to retrieve projection for code '${projectionOption}'.`);
151
+ }
152
+ return projection;
153
+ }
154
+ }
155
+
156
+ export { createMapModel };
157
+ //# sourceMappingURL=createMapModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMapModel.js","sources":["createMapModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { createLogger } from \"@open-pioneer/core\";\nimport OlMap, { MapOptions } from \"ol/Map\";\nimport View, { ViewOptions } from \"ol/View\";\nimport Attribution from \"ol/control/Attribution\";\nimport { getCenter } from \"ol/extent\";\nimport TileLayer from \"ol/layer/Tile\";\nimport { Projection, get as getProjection } from \"ol/proj\";\nimport OSM from \"ol/source/OSM\";\nimport { DragZoom, defaults as defaultInteractions } from \"ol/interaction\";\nimport { MapBrowserEvent } from \"ol\";\nimport { MapModelImpl } from \"./MapModelImpl\";\nimport { MapConfig } from \"../api\";\nimport { registerProjections } from \"../projections\";\nimport { patchOpenLayersClassesForTesting } from \"../util/ol-test-support\";\nimport { HttpService } from \"@open-pioneer/http\";\n\n/**\n * Register custom projection to the global proj4js definitions. User can select `EPSG:25832`\n * and `EPSG:25833` from the predefined projections without calling `registerProjections`.\n */\nregisterProjections({\n \"EPSG:25832\":\n \"+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs\",\n \"EPSG:25833\":\n \"+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs\"\n});\nconst LOG = createLogger(\"map:createMapModel\");\n\nexport async function createMapModel(\n mapId: string,\n mapConfig: MapConfig,\n httpService: HttpService\n): Promise<MapModelImpl> {\n return await new MapModelFactory(mapId, mapConfig, httpService).createMapModel();\n}\n\nclass MapModelFactory {\n private mapId: string;\n private mapConfig: MapConfig;\n private httpService: HttpService;\n\n constructor(mapId: string, mapConfig: MapConfig, httpService: HttpService) {\n this.mapId = mapId;\n this.mapConfig = mapConfig;\n this.httpService = httpService;\n }\n\n async createMapModel() {\n const mapId = this.mapId;\n const mapConfig = this.mapConfig;\n const { view: viewOption, ...rawOlOptions } = mapConfig.advanced ?? {};\n const mapOptions: MapOptions = {\n ...rawOlOptions\n };\n\n if (!mapOptions.controls) {\n mapOptions.controls = [new Attribution({ collapsible: false })];\n }\n\n if (!mapOptions.interactions) {\n const shiftCtrlKeysOnly = (mapBrowserEvent: MapBrowserEvent<KeyboardEvent>) => {\n const originalEvent = mapBrowserEvent.originalEvent;\n return (originalEvent.metaKey || originalEvent.ctrlKey) && originalEvent.shiftKey;\n };\n /*\n * setting altShiftDragRotate to false disables or excludes DragRotate interaction\n * */\n mapOptions.interactions = defaultInteractions({\n dragPan: true,\n altShiftDragRotate: false,\n pinchRotate: false,\n mouseWheelZoom: true\n }).extend([new DragZoom({ out: true, condition: shiftCtrlKeysOnly })]);\n }\n\n const view = (await viewOption) ?? {};\n this.initializeViewOptions(view);\n mapOptions.view = view instanceof View ? view : new View(view);\n\n if (!mapOptions.layers && !mapConfig.layers) {\n mapOptions.layers = [\n new TileLayer({\n source: new OSM()\n })\n ];\n }\n\n const initialView = mapConfig.initialView;\n const initialExtent = initialView?.kind === \"extent\" ? initialView.extent : undefined;\n\n LOG.debug(`Constructing OpenLayers map with options`, mapOptions);\n\n if (import.meta.env.VITEST) {\n patchOpenLayersClassesForTesting();\n }\n\n const olMap = new OlMap(mapOptions);\n\n const mapModel = new MapModelImpl({\n id: mapId,\n olMap,\n initialExtent,\n httpService: this.httpService\n });\n\n try {\n if (mapConfig.layers) {\n for (const layerConfig of mapConfig.layers) {\n mapModel.layers.addLayer(layerConfig);\n }\n }\n return mapModel;\n } catch (e) {\n mapModel.destroy();\n throw e;\n }\n }\n\n private initializeViewOptions(view: View | ViewOptions) {\n const mapId = this.mapId;\n const mapConfig = this.mapConfig;\n if (view instanceof View) {\n const warn = (prop: string) => {\n LOG.warn(\n `The advanced configuration for map id '${mapId}' has provided a fully constructed view instance: ${prop} cannot be applied.\\n` +\n `Use ViewOptions instead of a View instance.`\n );\n };\n\n if (mapConfig.projection != null) {\n warn(\"projection\");\n }\n if (mapConfig.initialView != null) {\n warn(\"initialView\");\n }\n return;\n }\n\n const projection = (view.projection = this.initializeProjection(mapConfig.projection));\n const initialView = mapConfig.initialView;\n if (initialView) {\n switch (initialView.kind) {\n case \"position\":\n view.zoom = initialView.zoom;\n view.center = [initialView.center.x, initialView.center.y];\n break;\n case \"extent\": {\n /*\n OpenLayers does not support configuration of the initial map extent.\n The only relevant options here are center, zoom (and resolution).\n We must set those values because otherwise OpenLayers will not initialize layer sources.\n\n The actual initial extent is applied once tha map has loaded and its size is known.\n */\n const extent = initialView.extent;\n view.zoom = 0;\n view.center = [\n extent.xMin + (extent.xMax - extent.xMin) / 2,\n extent.yMin + (extent.yMax - extent.yMin) / 2\n ];\n break;\n }\n }\n } else {\n this.setViewDefaults(view, projection);\n }\n }\n\n private setViewDefaults(view: ViewOptions, projection: Projection) {\n if (view.center == null) {\n const extent = projection.getExtent(); // can be null\n if (!extent) {\n LOG.warn(\n `Cannot set default center coordinate because the current projection has no associated extent.\\n` +\n `Try to configure 'initialView' explicity.`\n );\n } else {\n view.center = getCenter(extent);\n }\n }\n\n if (view.zoom == null || view.resolution == null) {\n view.zoom = 0;\n }\n }\n\n private initializeProjection(projectionOption: MapConfig[\"projection\"]) {\n if (projectionOption == null) {\n return getProjection(\"EPSG:3857\")!; // default OpenLayers projection\n }\n\n const projection = getProjection(projectionOption);\n if (!projection) {\n throw new Error(`Failed to retrieve projection for code '${projectionOption}'.`);\n }\n return projection;\n }\n}\n"],"names":["defaultInteractions","getProjection"],"mappings":";;;;;;;;;;;;;AAsBA,mBAAoB,CAAA;AAAA,EAChB,YACI,EAAA,oFAAA;AAAA,EACJ,YACI,EAAA,oFAAA;AACR,CAAC,CAAA,CAAA;AACD,MAAM,GAAA,GAAM,aAAa,oBAAoB,CAAA,CAAA;AAEvB,eAA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gBAA2C,EAAA;AACpE,IAAA,IAAI,oBAAoB,IAAM,EAAA;AAC1B,MAAA,OAAOC,IAAc,WAAW,CAAA,CAAA;AAAA,KACpC;AAEA,IAAM,MAAA,UAAA,GAAaA,IAAc,gBAAgB,CAAA,CAAA;AACjD,IAAA,IAAI,CAAC,UAAY,EAAA;AACb,MAAA,MAAM,IAAI,KAAA,CAAM,CAA2C,wCAAA,EAAA,gBAAgB,CAAI,EAAA,CAAA,CAAA,CAAA;AAAA,KACnF;AACA,IAAO,OAAA,UAAA,CAAA;AAAA,GACX;AACJ;;;;"}
@@ -0,0 +1,39 @@
1
+ import { Group } from "ol/layer";
2
+ import { GroupLayerCollection, Layer, LayerRetrievalOptions } from "../../api";
3
+ import { GroupLayer, GroupLayerConfig } from "../../api/layers/GroupLayer";
4
+ import { AbstractLayer } from "../AbstractLayer";
5
+ import { MapModelImpl } from "../MapModelImpl";
6
+ export declare class GroupLayerImpl extends AbstractLayer implements GroupLayer {
7
+ #private;
8
+ constructor(config: GroupLayerConfig);
9
+ get type(): "group";
10
+ get legend(): undefined;
11
+ get layers(): GroupLayerCollectionImpl;
12
+ get sublayers(): undefined;
13
+ /**
14
+ * return raw OL LayerGroup
15
+ * Warning: Do not manipulate the collection of layers in this group, changes are not synchronized!
16
+ */
17
+ get olLayer(): Group;
18
+ __attachToMap(map: MapModelImpl): void;
19
+ }
20
+ export declare class GroupLayerCollectionImpl implements GroupLayerCollection {
21
+ #private;
22
+ constructor(layers: Layer[], parent: GroupLayer);
23
+ /**
24
+ * Destroys this collection, all contained layers are detached from their parent group layer
25
+ */
26
+ destroy(): void;
27
+ getItems(options?: LayerRetrievalOptions): (AbstractLayer & Layer)[];
28
+ getLayers(_options?: LayerRetrievalOptions | undefined): (AbstractLayer & Layer)[];
29
+ /**
30
+ * Returns a reference to the internal group layer array.
31
+ *
32
+ * NOTE: Do not modify directly!
33
+ */
34
+ __getRawLayers(): (AbstractLayer & Layer)[];
35
+ /**
36
+ * Returns the parent group layer that owns this collection.
37
+ */
38
+ __getParent(): GroupLayer;
39
+ }
@@ -0,0 +1,88 @@
1
+ import { Group } from 'ol/layer.js';
2
+ import { AbstractLayer } from '../AbstractLayer.js';
3
+ import { AbstractLayerBase } from '../AbstractLayerBase.js';
4
+
5
+ class GroupLayerImpl extends AbstractLayer {
6
+ #children;
7
+ constructor(config) {
8
+ const groupLayers = config.layers;
9
+ const olGroup = new Group({ layers: groupLayers.map((sublayer) => sublayer.olLayer) });
10
+ super({ ...config, olLayer: olGroup });
11
+ this.#children = new GroupLayerCollectionImpl(groupLayers, this);
12
+ }
13
+ get type() {
14
+ return "group";
15
+ }
16
+ get legend() {
17
+ return void 0;
18
+ }
19
+ get layers() {
20
+ return this.#children;
21
+ }
22
+ get sublayers() {
23
+ return void 0;
24
+ }
25
+ /**
26
+ * return raw OL LayerGroup
27
+ * Warning: Do not manipulate the collection of layers in this group, changes are not synchronized!
28
+ */
29
+ get olLayer() {
30
+ return super.olLayer;
31
+ }
32
+ __attachToMap(map) {
33
+ super.__attachToMap(map);
34
+ this.layers.__getRawLayers().forEach((layer) => layer.__attachToMap(map));
35
+ }
36
+ }
37
+ class GroupLayerCollectionImpl {
38
+ #layers;
39
+ #parent;
40
+ constructor(layers, parent) {
41
+ layers = layers.slice();
42
+ for (const layer of layers) {
43
+ if (layer instanceof AbstractLayer) {
44
+ layer.__attachToGroup(parent);
45
+ } else {
46
+ throw new Error(
47
+ `Layer '${layer.id}' of group '${parent.id}' does not implement abstract class '${AbstractLayerBase.name}`
48
+ );
49
+ }
50
+ }
51
+ this.#layers = layers;
52
+ this.#parent = parent;
53
+ }
54
+ /**
55
+ * Destroys this collection, all contained layers are detached from their parent group layer
56
+ */
57
+ destroy() {
58
+ for (const layer of this.#layers) {
59
+ layer.__detachFromGroup();
60
+ layer.destroy();
61
+ }
62
+ this.#layers = [];
63
+ }
64
+ // Generic method name for consistent interface
65
+ getItems(options) {
66
+ return this.getLayers(options);
67
+ }
68
+ getLayers(_options) {
69
+ return this.#layers.slice();
70
+ }
71
+ /**
72
+ * Returns a reference to the internal group layer array.
73
+ *
74
+ * NOTE: Do not modify directly!
75
+ */
76
+ __getRawLayers() {
77
+ return this.#layers;
78
+ }
79
+ /**
80
+ * Returns the parent group layer that owns this collection.
81
+ */
82
+ __getParent() {
83
+ return this.#parent;
84
+ }
85
+ }
86
+
87
+ export { GroupLayerCollectionImpl, GroupLayerImpl };
88
+ //# sourceMappingURL=GroupLayerImpl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupLayerImpl.js","sources":["GroupLayerImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Group } from \"ol/layer\";\nimport { GroupLayerCollection, Layer, LayerRetrievalOptions } from \"../../api\";\nimport { GroupLayer, GroupLayerConfig } from \"../../api/layers/GroupLayer\";\nimport { AbstractLayer } from \"../AbstractLayer\";\nimport { AbstractLayerBase } from \"../AbstractLayerBase\";\nimport { MapModelImpl } from \"../MapModelImpl\";\n\nexport class GroupLayerImpl extends AbstractLayer implements GroupLayer {\n #children: GroupLayerCollectionImpl;\n\n constructor(config: GroupLayerConfig) {\n const groupLayers = config.layers;\n const olGroup = new Group({ layers: groupLayers.map((sublayer) => sublayer.olLayer) });\n super({ ...config, olLayer: olGroup });\n this.#children = new GroupLayerCollectionImpl(groupLayers, this);\n }\n\n get type() {\n return \"group\" as const;\n }\n\n get legend() {\n return undefined;\n }\n\n get layers(): GroupLayerCollectionImpl {\n return this.#children;\n }\n\n get sublayers(): undefined {\n return undefined;\n }\n\n /**\n * return raw OL LayerGroup\n * Warning: Do not manipulate the collection of layers in this group, changes are not synchronized!\n */\n get olLayer(): Group {\n return super.olLayer as Group;\n }\n\n __attachToMap(map: MapModelImpl): void {\n super.__attachToMap(map);\n this.layers.__getRawLayers().forEach((layer) => layer.__attachToMap(map));\n }\n}\n\n// NOTE: adding / removing currently not supported.\n// When adding support for dynamic content, make sure to also updating the layer indexing logic in the map (LayerCollectionImpl).\n// Nested children of a group layer must also be found in id-lookups.\nexport class GroupLayerCollectionImpl implements GroupLayerCollection {\n #layers: (AbstractLayer & Layer)[];\n #parent: GroupLayer;\n\n constructor(layers: Layer[], parent: GroupLayer) {\n layers = layers.slice(); // Don't modify the input\n for (const layer of layers) {\n if (layer instanceof AbstractLayer) {\n layer.__attachToGroup(parent); //attach every layer to the parent group layer\n } else {\n throw new Error(\n `Layer '${layer.id}' of group '${parent.id}' does not implement abstract class '${AbstractLayerBase.name}`\n );\n }\n }\n this.#layers = layers as (Layer & AbstractLayer)[];\n this.#parent = parent;\n }\n\n /**\n * Destroys this collection, all contained layers are detached from their parent group layer\n */\n destroy() {\n for (const layer of this.#layers) {\n layer.__detachFromGroup();\n layer.destroy();\n }\n this.#layers = [];\n }\n\n // Generic method name for consistent interface\n getItems(options?: LayerRetrievalOptions): (AbstractLayer & Layer)[] {\n return this.getLayers(options);\n }\n\n getLayers(_options?: LayerRetrievalOptions | undefined): (AbstractLayer & Layer)[] {\n // NOTE: options are ignored because layers are always ordered at this time.\n return this.#layers.slice();\n }\n\n /**\n * Returns a reference to the internal group layer array.\n *\n * NOTE: Do not modify directly!\n */\n __getRawLayers(): (AbstractLayer & Layer)[] {\n return this.#layers;\n }\n\n /**\n * Returns the parent group layer that owns this collection.\n */\n __getParent(): GroupLayer {\n return this.#parent;\n }\n}\n"],"names":[],"mappings":";;;;AASO,MAAM,uBAAuB,aAAoC,CAAA;AAAA,EACpE,SAAA,CAAA;AAAA,EAEA,YAAY,MAA0B,EAAA;AAClC,IAAA,MAAM,cAAc,MAAO,CAAA,MAAA,CAAA;AAC3B,IAAA,MAAM,OAAU,GAAA,IAAI,KAAM,CAAA,EAAE,MAAQ,EAAA,WAAA,CAAY,GAAI,CAAA,CAAC,QAAa,KAAA,QAAA,CAAS,OAAO,CAAA,EAAG,CAAA,CAAA;AACrF,IAAA,KAAA,CAAM,EAAE,GAAG,MAAQ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kB,IAAI,CAAA,CAAA;AAAA,SAC5G,CAAA;AAAA,OACJ;AAAA,KACJ;AACA,IAAA,IAAA,CAAK,OAAU,GAAA,MAAA,CAAA;AACf,IAAA,IAAA,CAAK,OAAU,GAAA,MAAA,CAAA;AAAA,GACnB;AAAA;AAAA;AAAA;AAAA,EAKA,OAAU,GAAA;AACN,IAAW,KAAA,MAAA,KAAA,IAAS,KAAK,OAAS,EAAA;AAC9B,MAAA,KAAA,CAAM,iBAAkB,EAAA,CAAA;AACxB,MAAA,KAAA,CAAM,OAAQ,EAAA,CAAA;AAAA,KAClB;AACA,IAAA,IAAA,CAAK,UAAU,EAAC,CAAA;AAAA,GACpB;AAAA;AAAA,EAGA,SAAS,OAA4D,EAAA;AACjE,IAAO,OAAA,IAAA,CAAK,UAAU,OAAO,CAAA,CAAA;AAAA,GACjC;AAAA,EAEA,UAAU,QAAyE,EAAA;AAE/E,IAAO,OAAA,IAAA,CAAK,QAAQ,KAAM,EAAA,CAAA;AAAA,GAC9B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAA4C,GAAA;AACxC,IAAA,OAAO,IAAK,CAAA,OAAA,CAAA;AAAA,GAChB;AAAA;AAAA;AAAA;AAAA,EAKA,WAA0B,GAAA;AACtB,IAAA,OAAO,IAAK,CAAA,OAAA,CAAA;AAAA,GAChB;AACJ;;;;"}
@@ -0,0 +1,13 @@
1
+ import { SimpleLayer } from "../../api";
2
+ import { AbstractLayer } from "../AbstractLayer";
3
+ /**
4
+ * A simple layer that accepts a custom OpenLayer's layer instance.
5
+ *
6
+ * Some API features (such as sublayers) will not be available.
7
+ */
8
+ export declare class SimpleLayerImpl extends AbstractLayer implements SimpleLayer {
9
+ get type(): "simple";
10
+ get legend(): undefined;
11
+ get layers(): undefined;
12
+ get sublayers(): undefined;
13
+ }
@@ -0,0 +1,19 @@
1
+ import { AbstractLayer } from '../AbstractLayer.js';
2
+
3
+ class SimpleLayerImpl extends AbstractLayer {
4
+ get type() {
5
+ return "simple";
6
+ }
7
+ get legend() {
8
+ return void 0;
9
+ }
10
+ get layers() {
11
+ return void 0;
12
+ }
13
+ get sublayers() {
14
+ return void 0;
15
+ }
16
+ }
17
+
18
+ export { SimpleLayerImpl };
19
+ //# sourceMappingURL=SimpleLayerImpl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleLayerImpl.js","sources":["SimpleLayerImpl.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { SimpleLayer } from \"../../api\";\nimport { AbstractLayer } from \"../AbstractLayer\";\n\n/**\n * A simple layer that accepts a custom OpenLayer's layer instance.\n *\n * Some API features (such as sublayers) will not be available.\n */\nexport class SimpleLayerImpl extends AbstractLayer implements SimpleLayer {\n get type() {\n return \"simple\" as const;\n }\n\n get legend(): undefined {\n return undefined;\n }\n\n get layers(): undefined {\n return undefined;\n }\n\n get sublayers(): undefined {\n return undefined;\n }\n}\n"],"names":[],"mappings":";;AAUO,MAAM,wBAAwB,aAAqC,CAAA;AAAA,EACtE,IAAI,IAAO,GAAA;AACP,IAAO,OAAA,QAAA,CAAA;AAAA,GACX;AAAA,EAEA,IAAI,MAAoB,GAAA;AACpB,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACX;AAAA,EAEA,IAAI,MAAoB,GAAA;AACpB,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACX;AAAA,EAEA,IAAI,SAAuB,GAAA;AACvB,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACX;AACJ;;;;"}
@@ -0,0 +1,41 @@
1
+ import { WMSLayer, WMSLayerConfig, WMSSublayer, WMSSublayerConfig } from "../../api";
2
+ import { AbstractLayer } from "../AbstractLayer";
3
+ import { AbstractLayerBase } from "../AbstractLayerBase";
4
+ import { MapModelImpl } from "../MapModelImpl";
5
+ import { SublayersCollectionImpl } from "../SublayersCollectionImpl";
6
+ export declare class WMSLayerImpl extends AbstractLayer implements WMSLayer {
7
+ #private;
8
+ constructor(config: WMSLayerConfig);
9
+ destroy(): void;
10
+ get type(): "wms";
11
+ get legend(): undefined;
12
+ get url(): string;
13
+ get layers(): undefined;
14
+ get sublayers(): SublayersCollectionImpl<WMSSublayerImpl>;
15
+ get capabilities(): Record<string, any> | undefined;
16
+ __attachToMap(map: MapModelImpl): void;
17
+ }
18
+ declare class WMSSublayerImpl extends AbstractLayerBase implements WMSSublayer {
19
+ #private;
20
+ constructor(config: WMSSublayerConfig);
21
+ get type(): "wms-sublayer";
22
+ get name(): string | undefined;
23
+ get layers(): undefined;
24
+ get sublayers(): SublayersCollectionImpl<WMSSublayerImpl>;
25
+ get parent(): WMSSublayerImpl | WMSLayerImpl;
26
+ get parentLayer(): WMSLayerImpl;
27
+ get legend(): string | undefined;
28
+ get visible(): boolean;
29
+ /**
30
+ * Called by the parent layer when it is attached to the map to attach all sublayers.
31
+ */
32
+ __attach(map: MapModelImpl, parentLayer: WMSLayerImpl, parent: WMSLayerImpl | WMSSublayerImpl): void;
33
+ /**
34
+ * Called by the parent layer to update the legend on load.
35
+ */
36
+ __setLegend(legendUrl: string | undefined): void;
37
+ setVisible(newVisibility: boolean): void;
38
+ }
39
+ /** extract the legend url from the service capabilities */
40
+ export declare function getWMSLegendUrl(capabilities: Record<string, any>, layerName: string): undefined;
41
+ export {};