@open-pioneer/map 1.3.0-dev.20260512095810 → 1.3.0

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @open-pioneer/map
2
2
 
3
- ## 1.3.0-dev.20260512095810
3
+ ## 1.3.0
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -22,18 +22,19 @@
22
22
 
23
23
  The old methods on the Map Model have been deprecated and will be removed in a future major release.
24
24
 
25
- - d54ccfd: Update to Chakra UI 3.34.0
25
+ - d54ccfd: Update to Chakra UI 3.35.0
26
26
  - 33ab02f: Add new `mapModel.overlays` API to render arbitrary React content on the map at certain coordinates.
27
27
  This can be helpful for feature info, popups and for tooltips during map interactions.
28
28
 
29
29
  Use `mapModel.overlay.add({ content: <SomeReactContent />, ...})` to create a new overlay.
30
30
 
31
- - 206b397: Update to trails core packages 4.5.0
31
+ - 206b397: Update to trails core packages 4.6.0
32
32
  - 2ceb1ca: MapContainer: allow configuration of `rootProps` and `containerProps`.
33
33
  This can be used to set custom attributes on the respective DOM elements.
34
34
 
35
35
  ### Patch Changes
36
36
 
37
+ - 989144d: update packages for hmr i18n usage
37
38
  - 36da1be: Do not animate the view when changing the map padding during initialization.
38
39
  - 30f75bf: Fix map center / map extent not being animated correctly if view padding changes multiple times in short succession (see [#587](https://github.com/open-pioneer/trails-openlayers-base-packages/issues/587)).
39
40
  - 28cf317: Fix baselayer documentation of the map package: use `olLayer` instead of `layer`.
package/MapRegistry.d.ts CHANGED
@@ -54,7 +54,7 @@ interface References {
54
54
  export declare class MapRegistry implements Service {
55
55
  #private;
56
56
  [DECLARE_SERVICE_INTERFACE]: "map.MapRegistry";
57
- constructor({ references, intl }: ServiceOptions<References>);
57
+ constructor({ references, currentIntl }: ServiceOptions<References>);
58
58
  destroy(): void;
59
59
  /**
60
60
  * Returns the map model associated with the given id.
package/MapRegistry.js CHANGED
@@ -6,7 +6,7 @@ import { createMapModel } from './model/createMapModel.js';
6
6
 
7
7
  const LOG = createLogger(sourceId);
8
8
  class MapRegistry {
9
- #intl;
9
+ #currentIntl;
10
10
  #httpService;
11
11
  #layerFactory;
12
12
  #configProviders = /* @__PURE__ */ new Map();
@@ -14,8 +14,8 @@ class MapRegistry {
14
14
  #modelCreationJobs = /* @__PURE__ */ new Map();
15
15
  #modelsByOlMap = /* @__PURE__ */ new WeakMap();
16
16
  #destroyed = false;
17
- constructor({ references, intl }) {
18
- this.#intl = intl;
17
+ constructor({ references, currentIntl }) {
18
+ this.#currentIntl = currentIntl;
19
19
  this.#httpService = references.httpService;
20
20
  this.#layerFactory = references.layerFactory;
21
21
  const providers = references.providers;
@@ -146,7 +146,12 @@ class MapRegistry {
146
146
  async #createMapModelImpl(mapId, configProvider) {
147
147
  LOG.info(`Creating map with id '${mapId}'`);
148
148
  const mapConfig = await configProvider();
149
- const mapModel = await createMapModel(mapId, mapConfig, this.#intl, this.#httpService);
149
+ const mapModel = await createMapModel(
150
+ mapId,
151
+ mapConfig,
152
+ this.#currentIntl,
153
+ this.#httpService
154
+ );
150
155
  return mapModel;
151
156
  }
152
157
  #isDynamic(mapId) {
@@ -1 +1 @@
1
- {"version":3,"file":"MapRegistry.js","sources":["MapRegistry.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { batch } from \"@conterra/reactivity-core\";\nimport { on } from \"@conterra/reactivity-events\";\nimport { createLogger, Resource } from \"@open-pioneer/core\";\nimport { HttpService } from \"@open-pioneer/http\";\nimport {\n DECLARE_SERVICE_INTERFACE,\n PackageIntl,\n Service,\n ServiceOptions\n} from \"@open-pioneer/runtime\";\nimport OlMap from \"ol/Map\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { LayerFactory } from \"./LayerFactory\";\nimport { createMapModel } from \"./model/createMapModel\";\nimport { MapConfig } from \"./model/MapConfig\";\nimport { MapModel } from \"./model/MapModel\";\n\nconst LOG = createLogger(sourceId);\n\n/**\n * Options passed to the {@link MapConfigProvider.getMapConfig} method.\n *\n * @group Services\n */\nexport interface MapConfigProviderOptions {\n /**\n * A reference to the layer factory, for the construction of new layer instances.\n */\n layerFactory: LayerFactory;\n}\n\n/**\n * Provides an OpenLayers map configuration with a given map id.\n *\n * The implementor must also provide the interface name `\"map.MapConfigProvider\"`.\n *\n * @group Services\n */\nexport interface MapConfigProvider {\n /**\n * Unique identifier of the map.\n */\n readonly mapId: string;\n\n /**\n * Returns the map configuration for this map.\n *\n * Called by the {@link MapRegistry} when the map is requested for the first time.\n *\n * See {@link MapConfig} for supported options during map creation.\n * Use {@link MapConfigProviderOptions.layerFactory} to construct new layers.\n */\n getMapConfig(options: MapConfigProviderOptions): Promise<MapConfig>;\n}\n\ninterface References {\n providers: MapConfigProvider[];\n httpService: HttpService;\n layerFactory: LayerFactory;\n}\n\ntype ModelJobResult =\n | { kind: \"model\"; model: MapModel; listener: Resource }\n | { kind: \"error\"; error: Error };\n\n/**\n * Provides access to registered map instances.\n *\n * Maps are identified by a unique id.\n *\n * Inject an instance of this service by referencing the interface name `\"map.MapRegistry\"`.\n *\n * @group Services\n */\nexport class MapRegistry implements Service {\n declare [DECLARE_SERVICE_INTERFACE]: \"map.MapRegistry\";\n\n #intl: PackageIntl;\n #httpService: HttpService;\n #layerFactory: LayerFactory;\n\n #configProviders = new Map<string, MapConfigProvider>();\n #entries = new Map<string, ModelJobResult>();\n #modelCreationJobs = new Map<string, Promise<ModelJobResult>>();\n #modelsByOlMap = new WeakMap<OlMap, MapModel>();\n #destroyed = false;\n\n constructor({ references, intl }: ServiceOptions<References>) {\n this.#intl = intl;\n this.#httpService = references.httpService;\n this.#layerFactory = references.layerFactory;\n\n const providers = references.providers;\n for (const provider of providers) {\n this.#configProviders.set(provider.mapId, provider);\n }\n }\n\n destroy(): void {\n if (this.#destroyed) {\n return;\n }\n\n batch(() => {\n LOG.debug(`Destroy map registry and all maps`);\n this.#destroyed = true;\n this.#entries.forEach((entry) => {\n if (entry.kind === \"model\") {\n entry.listener.destroy();\n entry.model.destroy();\n }\n });\n this.#entries.clear();\n this.#modelCreationJobs.clear();\n });\n }\n\n /**\n * Returns the map model associated with the given id.\n * Returns undefined if there is no such model.\n */\n async getMapModel(mapId: string): Promise<MapModel | undefined> {\n if (this.#destroyed) {\n throw new Error(\"MapRegistry has already been destroyed.\");\n }\n\n const entry = this.#entries.get(mapId);\n if (entry) {\n return unbox(entry);\n }\n\n const creationJob = this.#modelCreationJobs.get(mapId);\n if (creationJob) {\n return await waitForResult(creationJob);\n }\n\n const provider = this.#configProviders.get(mapId);\n if (!provider) {\n LOG.debug(`Failed to find a config provider for map id '${mapId}'.`);\n return undefined;\n }\n\n return await this.#createMapModel(mapId, () =>\n provider.getMapConfig({\n layerFactory: this.#layerFactory\n })\n );\n }\n\n /**\n * Like {@link getMapModel}, but throws if no model exists for the given `mapId`.\n */\n async expectMapModel(mapId: string): Promise<MapModel> {\n const model = await this.getMapModel(mapId);\n if (!model) {\n throw new Error(`No configuration available for map with id '${mapId}'.`);\n }\n return model;\n }\n\n /**\n * Creates a MapModel without the need to provide a {@link MapConfigProvider}.\n * Throws an error if a map with the given id already exists or if the map config is invalid.\n */\n async createMapModel(mapId: string, options?: MapConfig): Promise<MapModel> {\n if (this.#destroyed) {\n throw new Error(\"MapRegistry has already been destroyed.\");\n }\n if (this.#entries.has(mapId)) {\n throw new Error(`Map id '${mapId}' is not unique.`);\n }\n if (this.#modelCreationJobs.has(mapId)) {\n throw new Error(`A map with the id '${mapId}' is already under construction.`);\n }\n return await this.#createMapModel(mapId, () => Promise.resolve(options ?? {}));\n }\n\n /**\n * Given a raw OpenLayers map instance, returns the associated {@link MapModel} - or undefined\n * if the map is unknown to this registry.\n *\n * All OpenLayers maps created by this registry (e.g. via {@link MapConfigProvider} or {@link createMapModel}) have an associated map model.\n */\n getMapModelByRawInstance(olMap: OlMap): MapModel | undefined {\n return this.#modelsByOlMap.get(olMap);\n }\n\n // Wrapper method to ensure that in-progress construction of maps can be observed.\n #createMapModel(mapId: string, configProvider: () => Promise<MapConfig>): Promise<MapModel> {\n const creationJob = this.#modelCreationJobs.get(mapId);\n if (creationJob) {\n throw new Error(\"Internal error: a map model is already being created for this mapId\");\n }\n\n const modelPromise = this.#createMapModelImpl(mapId, configProvider)\n .then((mapModel) => {\n if (this.#destroyed) {\n mapModel.destroy();\n throw new Error(`MapRegistry has been destroyed.`);\n }\n\n const listener = on(\n mapModel.destroyed,\n () => {\n // Allow id reuse for dynamically created maps\n if (this.#isDynamic(mapId)) {\n const currentEntry = this.#entries.get(mapId);\n if (currentEntry === entry) {\n this.#entries.delete(mapId);\n }\n }\n },\n { dispatch: \"sync\" }\n );\n\n const entry: ModelJobResult = { kind: \"model\", model: mapModel, listener };\n this.#entries.set(mapId, entry);\n this.#modelCreationJobs.delete(mapId);\n this.#modelsByOlMap.set(mapModel.olMap, mapModel);\n return entry;\n })\n .catch((cause) => {\n const error = new Error(`Failed to construct map '${mapId}'`, { cause });\n const entry: ModelJobResult = { kind: \"error\", error };\n this.#modelCreationJobs.delete(mapId);\n if (!this.#isDynamic(mapId)) {\n // Don't store errors for dynamically created maps (the caller already got the error via promise).\n this.#entries.set(mapId, entry);\n }\n return entry;\n });\n this.#modelCreationJobs.set(mapId, modelPromise);\n return waitForResult(modelPromise);\n }\n\n async #createMapModelImpl(\n mapId: string,\n configProvider: () => Promise<MapConfig>\n ): Promise<MapModel> {\n LOG.info(`Creating map with id '${mapId}'`);\n const mapConfig = await configProvider();\n const mapModel = await createMapModel(mapId, mapConfig, this.#intl, this.#httpService);\n return mapModel;\n }\n\n #isDynamic(mapId: string): boolean {\n return !this.#configProviders.has(mapId);\n }\n}\n\nasync function waitForResult(job: Promise<ModelJobResult>): Promise<MapModel> {\n return unbox(await job);\n}\n\nfunction unbox(entry: ModelJobResult): MapModel {\n if (entry.kind === \"error\") {\n throw entry.error;\n }\n return entry.model;\n}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;AAAA,MAClC;AACA,MAAA,OAAO,KAAA;AAAA,IACX,CAAC,CAAA;AACL,IAAA,IAAA,CAAK,kBAAA,CAAmB,GAAA,CAAI,KAAA,EAAO,YAAY,CAAA;AAC/C,IAAA,OAAO,cAAc,YAAY,CAAA;AAAA,EACrC;AAAA,EAEA,MAAM,mBAAA,CACF,KAAA,EACA,cAAA,EACiB;AACjB,IAAA,GAAA,CAAI,IAAA,CAAK,CAAA,sBAAA,EAAyB,KAAK,CAAA,CAAA,CAAG,CAAA;AAC1C,IAAA,MAAM,SAAA,GAAY,MAAM,cAAA,EAAe;AACvC,IAAA,MAAM,QAAA,GAAW,MAAM,cAAA,CAAe,KAAA,EAAO,WAAW,IAAA,CAAK,KAAA,EAAO,KAAK,YAAY,CAAA;AACrF,IAAA,OAAO,QAAA;AAAA,EACX;AAAA,EAEA,WAAW,KAAA,EAAwB;AAC/B,IAAA,OAAO,CAAC,IAAA,CAAK,gBAAA,CAAiB,GAAA,CAAI,KAAK,CAAA;AAAA,EAC3C;AACJ;AAEA,eAAe,cAAc,GAAA,EAAiD;AAC1E,EAAA,OAAO,KAAA,CAAM,MAAM,GAAG,CAAA;AAC1B;AAEA,SAAS,MAAM,KAAA,EAAiC;AAC5C,EAAA,IAAI,KAAA,CAAM,SAAS,OAAA,EAAS;AACxB,IAAA,MAAM,KAAA,CAAM,KAAA;AAAA,EAChB;AACA,EAAA,OAAO,KAAA,CAAM,KAAA;AACjB;;;;"}
1
+ {"version":3,"file":"MapRegistry.js","sources":["MapRegistry.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { batch, ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport { on } from \"@conterra/reactivity-events\";\nimport { createLogger, Resource } from \"@open-pioneer/core\";\nimport { HttpService } from \"@open-pioneer/http\";\nimport {\n DECLARE_SERVICE_INTERFACE,\n PackageIntl,\n Service,\n ServiceOptions\n} from \"@open-pioneer/runtime\";\nimport OlMap from \"ol/Map\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { LayerFactory } from \"./LayerFactory\";\nimport { createMapModel } from \"./model/createMapModel\";\nimport { MapConfig } from \"./model/MapConfig\";\nimport { MapModel } from \"./model/MapModel\";\n\nconst LOG = createLogger(sourceId);\n\n/**\n * Options passed to the {@link MapConfigProvider.getMapConfig} method.\n *\n * @group Services\n */\nexport interface MapConfigProviderOptions {\n /**\n * A reference to the layer factory, for the construction of new layer instances.\n */\n layerFactory: LayerFactory;\n}\n\n/**\n * Provides an OpenLayers map configuration with a given map id.\n *\n * The implementor must also provide the interface name `\"map.MapConfigProvider\"`.\n *\n * @group Services\n */\nexport interface MapConfigProvider {\n /**\n * Unique identifier of the map.\n */\n readonly mapId: string;\n\n /**\n * Returns the map configuration for this map.\n *\n * Called by the {@link MapRegistry} when the map is requested for the first time.\n *\n * See {@link MapConfig} for supported options during map creation.\n * Use {@link MapConfigProviderOptions.layerFactory} to construct new layers.\n */\n getMapConfig(options: MapConfigProviderOptions): Promise<MapConfig>;\n}\n\ninterface References {\n providers: MapConfigProvider[];\n httpService: HttpService;\n layerFactory: LayerFactory;\n}\n\ntype ModelJobResult =\n | { kind: \"model\"; model: MapModel; listener: Resource }\n | { kind: \"error\"; error: Error };\n\n/**\n * Provides access to registered map instances.\n *\n * Maps are identified by a unique id.\n *\n * Inject an instance of this service by referencing the interface name `\"map.MapRegistry\"`.\n *\n * @group Services\n */\nexport class MapRegistry implements Service {\n declare [DECLARE_SERVICE_INTERFACE]: \"map.MapRegistry\";\n\n #currentIntl: ReadonlyReactive<PackageIntl>;\n #httpService: HttpService;\n #layerFactory: LayerFactory;\n\n #configProviders = new Map<string, MapConfigProvider>();\n #entries = new Map<string, ModelJobResult>();\n #modelCreationJobs = new Map<string, Promise<ModelJobResult>>();\n #modelsByOlMap = new WeakMap<OlMap, MapModel>();\n #destroyed = false;\n\n constructor({ references, currentIntl }: ServiceOptions<References>) {\n this.#currentIntl = currentIntl;\n this.#httpService = references.httpService;\n this.#layerFactory = references.layerFactory;\n\n const providers = references.providers;\n for (const provider of providers) {\n this.#configProviders.set(provider.mapId, provider);\n }\n }\n\n destroy(): void {\n if (this.#destroyed) {\n return;\n }\n\n batch(() => {\n LOG.debug(`Destroy map registry and all maps`);\n this.#destroyed = true;\n this.#entries.forEach((entry) => {\n if (entry.kind === \"model\") {\n entry.listener.destroy();\n entry.model.destroy();\n }\n });\n this.#entries.clear();\n this.#modelCreationJobs.clear();\n });\n }\n\n /**\n * Returns the map model associated with the given id.\n * Returns undefined if there is no such model.\n */\n async getMapModel(mapId: string): Promise<MapModel | undefined> {\n if (this.#destroyed) {\n throw new Error(\"MapRegistry has already been destroyed.\");\n }\n\n const entry = this.#entries.get(mapId);\n if (entry) {\n return unbox(entry);\n }\n\n const creationJob = this.#modelCreationJobs.get(mapId);\n if (creationJob) {\n return await waitForResult(creationJob);\n }\n\n const provider = this.#configProviders.get(mapId);\n if (!provider) {\n LOG.debug(`Failed to find a config provider for map id '${mapId}'.`);\n return undefined;\n }\n\n return await this.#createMapModel(mapId, () =>\n provider.getMapConfig({\n layerFactory: this.#layerFactory\n })\n );\n }\n\n /**\n * Like {@link getMapModel}, but throws if no model exists for the given `mapId`.\n */\n async expectMapModel(mapId: string): Promise<MapModel> {\n const model = await this.getMapModel(mapId);\n if (!model) {\n throw new Error(`No configuration available for map with id '${mapId}'.`);\n }\n return model;\n }\n\n /**\n * Creates a MapModel without the need to provide a {@link MapConfigProvider}.\n * Throws an error if a map with the given id already exists or if the map config is invalid.\n */\n async createMapModel(mapId: string, options?: MapConfig): Promise<MapModel> {\n if (this.#destroyed) {\n throw new Error(\"MapRegistry has already been destroyed.\");\n }\n if (this.#entries.has(mapId)) {\n throw new Error(`Map id '${mapId}' is not unique.`);\n }\n if (this.#modelCreationJobs.has(mapId)) {\n throw new Error(`A map with the id '${mapId}' is already under construction.`);\n }\n return await this.#createMapModel(mapId, () => Promise.resolve(options ?? {}));\n }\n\n /**\n * Given a raw OpenLayers map instance, returns the associated {@link MapModel} - or undefined\n * if the map is unknown to this registry.\n *\n * All OpenLayers maps created by this registry (e.g. via {@link MapConfigProvider} or {@link createMapModel}) have an associated map model.\n */\n getMapModelByRawInstance(olMap: OlMap): MapModel | undefined {\n return this.#modelsByOlMap.get(olMap);\n }\n\n // Wrapper method to ensure that in-progress construction of maps can be observed.\n #createMapModel(mapId: string, configProvider: () => Promise<MapConfig>): Promise<MapModel> {\n const creationJob = this.#modelCreationJobs.get(mapId);\n if (creationJob) {\n throw new Error(\"Internal error: a map model is already being created for this mapId\");\n }\n\n const modelPromise = this.#createMapModelImpl(mapId, configProvider)\n .then((mapModel) => {\n if (this.#destroyed) {\n mapModel.destroy();\n throw new Error(`MapRegistry has been destroyed.`);\n }\n\n const listener = on(\n mapModel.destroyed,\n () => {\n // Allow id reuse for dynamically created maps\n if (this.#isDynamic(mapId)) {\n const currentEntry = this.#entries.get(mapId);\n if (currentEntry === entry) {\n this.#entries.delete(mapId);\n }\n }\n },\n { dispatch: \"sync\" }\n );\n\n const entry: ModelJobResult = { kind: \"model\", model: mapModel, listener };\n this.#entries.set(mapId, entry);\n this.#modelCreationJobs.delete(mapId);\n this.#modelsByOlMap.set(mapModel.olMap, mapModel);\n return entry;\n })\n .catch((cause) => {\n const error = new Error(`Failed to construct map '${mapId}'`, { cause });\n const entry: ModelJobResult = { kind: \"error\", error };\n this.#modelCreationJobs.delete(mapId);\n if (!this.#isDynamic(mapId)) {\n // Don't store errors for dynamically created maps (the caller already got the error via promise).\n this.#entries.set(mapId, entry);\n }\n return entry;\n });\n this.#modelCreationJobs.set(mapId, modelPromise);\n return waitForResult(modelPromise);\n }\n\n async #createMapModelImpl(\n mapId: string,\n configProvider: () => Promise<MapConfig>\n ): Promise<MapModel> {\n LOG.info(`Creating map with id '${mapId}'`);\n const mapConfig = await configProvider();\n const mapModel = await createMapModel(\n mapId,\n mapConfig,\n this.#currentIntl,\n this.#httpService\n );\n return mapModel;\n }\n\n #isDynamic(mapId: string): boolean {\n return !this.#configProviders.has(mapId);\n }\n}\n\nasync function waitForResult(job: Promise<ModelJobResult>): Promise<MapModel> {\n return unbox(await job);\n}\n\nfunction unbox(entry: ModelJobResult): MapModel {\n if (entry.kind === \"error\") {\n throw entry.error;\n }\n return entry.model;\n}\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAyD1B,MAAM,WAAA,CAA+B;AAAA,EAGxC,YAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EAEA,gBAAA,uBAAuB,GAAA,EAA+B;AAAA,EACtD,QAAA,uBAAe,GAAA,EAA4B;AAAA,EAC3C,kBAAA,uBAAyB,GAAA,EAAqC;AAAA,EAC9D,cAAA,uBAAqB,OAAA,EAAyB;AAAA,EAC9C,UAAA,GAAa,KAAA;AAAA,EAEb,WAAA,CAAY,EAAE,UAAA,EAAY,WAAA,EAAY,EAA+B;AACjE,IAAA,IAAA,CAAK,YAAA,GAAe,WAAA;AACpB,IAAA,IAAA,CAAK,eAAe,UAAA,CAAW,WAAA;AAC/B,IAAA,IAAA,CAAK,gBAAgB,UAAA,CAAW,YAAA;AAEhC,IAAA,MAAM,YAAY,UAAA,CAAW,SAAA;AAC7B,IAAA,KAAA,MAAW,YAAY,SAAA,EAAW;AAC9B,MAAA,IAAA,CAAK,gBAAA,CAAiB,GAAA,CAAI,QAAA,CAAS,KAAA,EAAO,QAAQ,CAAA;AAAA,IACtD;AAAA,EACJ;AAAA,EAEA,OAAA,GAAgB;AACZ,IAAA,IAAI,KAAK,UAAA,EAAY;AACjB,MAAA;AAAA,IACJ;AAEA,IAAA,KAAA,CAAM,MAAM;AACR,MAAA,GAAA,CAAI,MAAM,CAAA,iCAAA,CAAmC,CAAA;AAC7C,MAAA,IAAA,CAAK,UAAA,GAAa,IAAA;AAClB,MAAA,IAAA,CAAK,QAAA,CAAS,OAAA,CAAQ,CAAC,KAAA,K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
  import OlMap from "ol/Map";
3
4
  import { AttributionItem } from "./MapModel";
@@ -7,7 +8,7 @@ export declare class MapAttributions {
7
8
  olMap: OlMap;
8
9
  /** false: not rendered */
9
10
  showControl: boolean;
10
- intl: PackageIntl;
11
+ intl: ReadonlyReactive<PackageIntl>;
11
12
  });
12
13
  destroy(): void;
13
14
  get attributionItems(): AttributionItem[];
@@ -1,9 +1,11 @@
1
+ import { reactive, computed, effect } from '@conterra/reactivity-core';
2
+ import { destroyResources } from '@open-pioneer/core';
1
3
  import Attribution from 'ol/control/Attribution.js';
2
4
  import { sanitizeHtml } from '../utils/sanitize.js';
3
- import { reactive, computed } from '@conterra/reactivity-core';
4
5
 
5
6
  class MapAttributions {
6
7
  #olMap;
8
+ #intl;
7
9
  /**
8
10
  * When default rendering of attributions is active, we simply display this control on the map (otherwise: hidden).
9
11
  *
@@ -19,8 +21,10 @@ class MapAttributions {
19
21
  text: attribution
20
22
  }))
21
23
  );
24
+ #resources = [];
22
25
  constructor(options) {
23
26
  this.#olMap = options.olMap;
27
+ this.#intl = options.intl;
24
28
  const control = this.#control = new Attribution({
25
29
  collapsible: false,
26
30
  target: options.showControl ? void 0 : createDummyTargetNode()
@@ -36,12 +40,17 @@ class MapAttributions {
36
40
  const element = control.element;
37
41
  if (element) {
38
42
  element.role = "region";
39
- element.ariaLabel = options.intl.formatMessage({ id: "attribution.label" });
43
+ this.#resources.push(
44
+ effect(() => {
45
+ element.ariaLabel = this.#intl.value.formatMessage({ id: "attribution.label" });
46
+ })
47
+ );
40
48
  }
41
49
  this.#olMap.addControl(control);
42
50
  }
43
51
  destroy() {
44
52
  this.#olMap.removeControl(this.#control);
53
+ destroyResources(this.#resources);
45
54
  this.#control.dispose();
46
55
  }
47
56
  get attributionItems() {
@@ -1 +1 @@
1
- {"version":3,"file":"MapAttributions.js","sources":["MapAttributions.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport OlMap, { FrameState } from \"ol/Map\";\nimport Attribution from \"ol/control/Attribution\";\nimport { sanitizeHtml } from \"../utils/sanitize\";\nimport { computed, reactive } from \"@conterra/reactivity-core\";\nimport { AttributionItem } from \"./MapModel\";\n\nexport class MapAttributions {\n #olMap: OlMap;\n\n /**\n * When default rendering of attributions is active, we simply display this control on the map (otherwise: hidden).\n *\n * The control is always active (even if invisible) because we re-use its rendering code to extract the attribution items.\n * There is no real API to extract the attributions from OpenLayers, and we don't want to re-implement that logic right now.\n * We will see if that approach remains stable.\n */\n #control: Attribution;\n\n #attributionStrings = reactive<string[]>([], { equal: shallowEqual });\n\n // Attribution strings wrapped in objects, for forward compat.\n #attributionItems = computed<AttributionItem[]>(() =>\n this.#attributionStrings.value.map((attribution) => ({\n text: attribution\n }))\n );\n\n constructor(options: {\n olMap: OlMap;\n /** false: not rendered */\n showControl: boolean;\n intl: PackageIntl;\n }) {\n this.#olMap = options.olMap;\n\n const control = (this.#control = new Attribution({\n collapsible: false,\n target: options.showControl ? undefined : createDummyTargetNode()\n }));\n interceptAttributions(\n control,\n // Called by the attributions widgets as a side effect.\n // NOTE: this is currently called very often (~ every map render).\n (attributions) => {\n this.#attributionStrings.value = attributions;\n }\n );\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const element = (control as any).element as HTMLElement | undefined;\n if (element) {\n element.role = \"region\";\n element.ariaLabel = options.intl.formatMessage({ id: \"attribution.label\" });\n }\n\n this.#olMap.addControl(control);\n }\n\n destroy() {\n this.#olMap.removeControl(this.#control);\n this.#control.dispose();\n }\n\n get attributionItems(): AttributionItem[] {\n return this.#attributionItems.value;\n }\n}\n\n// Overrides the OpenLayers widget to sanitize HTML attributions and to intercept the computed array of strings.\n// Note that this depends on OpenLayers internals that may change between versions.\nfunction interceptAttributions(attr: Attribution, onUpdate: (attributions: string[]) => void) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-function-type\n const originalCollectSourceAttributions = (attr as any).collectSourceAttributions_ as Function;\n if (!originalCollectSourceAttributions) {\n throw new Error(\"Internal error: failed to override attributions widget\");\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (attr as any).collectSourceAttributions_ = (frameState: FrameState) => {\n const rawAttributions = originalCollectSourceAttributions.call(\n attr,\n frameState\n ) as string[];\n if (!Array.isArray(rawAttributions)) {\n throw new Error(\"Internal error: unexpected attributions result (should be an array)\");\n }\n const sanitizedAttributions = rawAttributions.map((a) => sanitizeHtml(a));\n onUpdate(sanitizedAttributions);\n return sanitizedAttributions;\n };\n}\n\nfunction createDummyTargetNode() {\n const node = document.createElement(\"div\");\n node.style.display = \"none\";\n node.className = \"map-attribution-dummy-target\";\n return node;\n}\n\n// TODO: generic shallowEqual, deepEqual helpers @open-pioneer/core\nfunction shallowEqual<T>(a: T[], b: T[]) {\n return a.length === b.length && a.every((v, i) => v == b[i]);\n}\n"],"names":[],"mappings":";;;;AASO,MAAM,eAAA,CAAgB;AAAA,EACzB,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,QAAA;AAAA,EAEA,sBAAsB,QAAA,CAAmB,IAAI,EAAE,KAAA,EAAO,cAAc,CAAA;AAAA;AAAA,EAGpE,iBAAA,GAAoB,QAAA;AAAA,IAA4B,MAC5C,IAAA,CAAK,mBAAA,CAAoB,KAAA,CAAM,GAAA,CAAI,CAAC,WAAA,MAAiB;AAAA,MACjD,IAAA,EAAM;AAAA,KACV,CAAE;AAAA,GACN;AAAA,EAEA,YAAY,OAAA,EAKT;AACC,IAAA,IAAA,CAAK,SAAS,OAAA,CAAQ,KAAA;AAEtB,IAAA,MAAM,OAAA,GAAW,IAAA,CAAK,QAAA,GAAW,IAAI,WAAA,CAAY;AAAA,MAC7C,WAAA,EAAa,KAAA;AAAA,MACb,MAAA,EAAQ,OAAA,CAAQ,WAAA,GAAc,MAAA,GAAY,qBAAA;AAAs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AAA,CAAa,CAAC,CAAC,CAAA;AACxE,IAAA,QAAA,CAAS,qBAAqB,CAAA;AAC9B,IAAA,OAAO,qBAAA;AAAA,EACX,CAAA;AACJ;AAEA,SAAS,qBAAA,GAAwB;AAC7B,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,aAAA,CAAc,KAAK,CAAA;AACzC,EAAA,IAAA,CAAK,MAAM,OAAA,GAAU,MAAA;AACrB,EAAA,IAAA,CAAK,SAAA,GAAY,8BAAA;AACjB,EAAA,OAAO,IAAA;AACX;AAGA,SAAS,YAAA,CAAgB,GAAQ,CAAA,EAAQ;AACrC,EAAA,OAAO,CAAA,CAAE,MAAA,KAAW,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,EAAG,CAAA,KAAM,CAAA,IAAK,CAAA,CAAE,CAAC,CAAC,CAAA;AAC/D;;;;"}
1
+ {"version":3,"file":"MapAttributions.js","sources":["MapAttributions.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { computed, effect, reactive, ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport { destroyResources, Resource } from \"@open-pioneer/core\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport OlMap, { FrameState } from \"ol/Map\";\nimport Attribution from \"ol/control/Attribution\";\nimport { sanitizeHtml } from \"../utils/sanitize\";\nimport { AttributionItem } from \"./MapModel\";\n\nexport class MapAttributions {\n #olMap: OlMap;\n #intl: ReadonlyReactive<PackageIntl>;\n\n /**\n * When default rendering of attributions is active, we simply display this control on the map (otherwise: hidden).\n *\n * The control is always active (even if invisible) because we re-use its rendering code to extract the attribution items.\n * There is no real API to extract the attributions from OpenLayers, and we don't want to re-implement that logic right now.\n * We will see if that approach remains stable.\n */\n #control: Attribution;\n\n #attributionStrings = reactive<string[]>([], { equal: shallowEqual });\n\n // Attribution strings wrapped in objects, for forward compat.\n #attributionItems = computed<AttributionItem[]>(() =>\n this.#attributionStrings.value.map((attribution) => ({\n text: attribution\n }))\n );\n\n #resources: Resource[] = [];\n\n constructor(options: {\n olMap: OlMap;\n /** false: not rendered */\n showControl: boolean;\n intl: ReadonlyReactive<PackageIntl>;\n }) {\n this.#olMap = options.olMap;\n this.#intl = options.intl;\n\n const control = (this.#control = new Attribution({\n collapsible: false,\n target: options.showControl ? undefined : createDummyTargetNode()\n }));\n interceptAttributions(\n control,\n // Called by the attributions widgets as a side effect.\n // NOTE: this is currently called very often (~ every map render).\n (attributions) => {\n this.#attributionStrings.value = attributions;\n }\n );\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const element = (control as any).element as HTMLElement | undefined;\n if (element) {\n element.role = \"region\";\n this.#resources.push(\n effect(() => {\n element.ariaLabel = this.#intl.value.formatMessage({ id: \"attribution.label\" });\n })\n );\n }\n\n this.#olMap.addControl(control);\n }\n\n destroy() {\n this.#olMap.removeControl(this.#control);\n destroyResources(this.#resources);\n this.#control.dispose();\n }\n\n get attributionItems(): AttributionItem[] {\n return this.#attributionItems.value;\n }\n}\n\n// Overrides the OpenLayers widget to sanitize HTML attributions and to intercept the computed array of strings.\n// Note that this depends on OpenLayers internals that may change between versions.\nfunction interceptAttributions(attr: Attribution, onUpdate: (attributions: string[]) => void) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-function-type\n const originalCollectSourceAttributions = (attr as any).collectSourceAttributions_ as Function;\n if (!originalCollectSourceAttributions) {\n throw new Error(\"Internal error: failed to override attributions widget\");\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (attr as any).collectSourceAttributions_ = (frameState: FrameState) => {\n const rawAttributions = originalCollectSourceAttributions.call(\n attr,\n frameState\n ) as string[];\n if (!Array.isArray(rawAttributions)) {\n throw new Error(\"Internal error: unexpected attributions result (should be an array)\");\n }\n const sanitizedAttributions = rawAttributions.map((a) => sanitizeHtml(a));\n onUpdate(sanitizedAttributions);\n return sanitizedAttributions;\n };\n}\n\nfunction createDummyTargetNode() {\n const node = document.createElement(\"div\");\n node.style.display = \"none\";\n node.className = \"map-attribution-dummy-target\";\n return node;\n}\n\n// TODO: generic shallowEqual, deepEqual helpers @open-pioneer/core\nfunction shallowEqual<T>(a: T[], b: T[]) {\n return a.length === b.length && a.every((v, i) => v == b[i]);\n}\n"],"names":[],"mappings":";;;;;AAUO,MAAM,eAAA,CAAgB;AAAA,EACzB,MAAA;AAAA,EACA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,QAAA;AAAA,EAEA,sBAAsB,QAAA,CAAmB,IAAI,EAAE,KAAA,EAAO,cAAc,CAAA;AAAA;AAAA,EAGpE,iBAAA,GAAoB,QAAA;AAAA,IAA4B,MAC5C,IAAA,CAAK,mBAAA,CAAoB,KAAA,CAAM,GAAA,CAAI,CAAC,WAAA,MAAiB;AAAA,MACjD,IAAA,EAAM;AAAA,KACV,CAAE;AAAA,GACN;AAAA,EAEA,aAAyB,EAAC;AAAA,EAE1B,YAAY,OAAA,EAKT;AACC,IAAA,IAAA,CAAK,SAAS,OAAA,CAAQ,KAAA;AACtB,IAAA,IAAA,CAAK,QAAQ,OAAA,CAAQ,IAAA;AAErB,IAAA,MAAM,OAAA,GAAW,IAAA,CAAK,QAAA,GAAW,IAAI,WAAA,CAAY;AAAA,MAC7C,WAAA,EAAa,KAAA;AAAA,MACb,MAAA,EAAQ,OAAA,CAAQ,WAAA,GAAc,MAAA,GAAY,qBAAA;AAAsB,KACnE,CAAA;AACD,IAAA,qBAAA;AAAA,MACI,OAAA;AAAA;AAAA;AAAA,MAGA,CAAC,YAAA,KAAiB;AACd,QAAA,IAAA,CAAK,oBAAoB,KAAA,GAAQ,YAAA;AAAA,MACrC;AAAA,KACJ;AAGA,IAAA,MAAM,UAAW,OAAA,CAAgB,OAAA;AACjC,IAAA,IAAI,OAAA,EAAS;AACT,MAAA,OAAA,CAAQ,IAAA,GAAO,Q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BAAA,GAAwB;AAC7B,EAAA,MAAM,IAAA,GAAO,QAAA,CAAS,aAAA,CAAc,KAAK,CAAA;AACzC,EAAA,IAAA,CAAK,MAAM,OAAA,GAAU,MAAA;AACrB,EAAA,IAAA,CAAK,SAAA,GAAY,8BAAA;AACjB,EAAA,OAAO,IAAA;AACX;AAGA,SAAS,YAAA,CAAgB,GAAQ,CAAA,EAAQ;AACrC,EAAA,OAAO,CAAA,CAAE,MAAA,KAAW,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,EAAG,CAAA,KAAM,CAAA,IAAK,CAAA,CAAE,CAAC,CAAC,CAAA;AAC/D;;;;"}
@@ -1,3 +1,4 @@
1
+ import { ReadonlyReactive } from "@conterra/reactivity-core";
1
2
  import { EventSource } from "@conterra/reactivity-events";
2
3
  import { HttpService } from "@open-pioneer/http";
3
4
  import OlMap from "ol/Map";
@@ -87,7 +88,7 @@ export declare class MapModel {
87
88
  olMap: OlMap;
88
89
  initialExtent: ExtentConfig | undefined;
89
90
  showDefaultAttributions: boolean;
90
- intl: PackageIntl;
91
+ currentIntl: ReadonlyReactive<PackageIntl>;
91
92
  httpService: HttpService;
92
93
  }, tag: InternalConstructorTag);
93
94
  /**
package/model/MapModel.js CHANGED
@@ -56,7 +56,7 @@ class MapModel {
56
56
  this.#id = options.id;
57
57
  this.#olMap = options.olMap;
58
58
  this.#attributions = new MapAttributions({
59
- intl: options.intl,
59
+ intl: options.currentIntl,
60
60
  olMap: this.#olMap,
61
61
  showControl: options.showDefaultAttributions
62
62
  });
@@ -1 +1 @@
1
- {"version":3,"file":"MapModel.js","sources":["MapModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { computed, reactive, ReadonlyReactive, synchronized } from \"@conterra/reactivity-core\";\nimport { emit, emitter, EventSource } from \"@conterra/reactivity-events\";\nimport {\n createAbortError,\n createLogger,\n createManualPromise,\n deprecated,\n isAbortError,\n ManualPromise\n} from \"@open-pioneer/core\";\nimport { HttpService } from \"@open-pioneer/http\";\nimport OlMap from \"ol/Map\";\nimport { unByKey } from \"ol/Observable\";\nimport OlView from \"ol/View\";\nimport { Coordinate } from \"ol/coordinate\";\nimport { EventsKey } from \"ol/events\";\nimport { createEmpty, extend, getArea, getCenter } from \"ol/extent\";\nimport { getPointResolution, Projection } from \"ol/proj\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { LAYER_DEPS, LayerDependencies } from \"../layers/shared/internals\";\nimport {\n assertInternalConstructor,\n INTERNAL_CONSTRUCTOR_TAG,\n InternalConstructorTag\n} from \"../utils/InternalConstructorTag\";\nimport { calculateBufferedExtent } from \"../utils/geometry-utils\";\nimport {\n DESTROY_HIGHLIGHTS,\n Highlight,\n HighlightOptions,\n Highlights,\n HighlightZoomOptions\n} from \"./Highlights\";\nimport { LayerCollection } from \"./LayerCollection\";\nimport { ExtentConfig } from \"./MapConfig\";\nimport { Overlays } from \"./Overlays\";\nimport { getGeometries } from \"./getGeometries\";\nimport { BaseFeature } from \"../utils/BaseFeature\";\nimport { Geometry } from \"ol/geom\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { MapAttributions } from \"./MapAttributions\";\n\nconst LOG = createLogger(sourceId);\n\nconst DEFAULT_DPI = 25.4 / 0.28;\nconst INCHES_PER_METRE = 39.37;\n\nconst DEFAULT_OL_POINT_ZOOM_LEVEL = 17;\nconst DEFAULT_OL_MAX_ZOOM_LEVEL = 20;\nconst DEFAULT_VIEW_PADDING = { top: 50, right: 20, bottom: 10, left: 20 };\n\nexport const DISPLAY_STATUS = Symbol(\"DISPLAY_STATUS\");\n\nconst deprecatedHighlights = deprecated({\n name: \"MapModel highlight function called\",\n packageName: \"@open-pioneer/map\",\n since: \"v1.3.0\",\n alternative: \"call methods of myMapModel.highlights instead\"\n});\n\n/**\n * Options supported when calling {@link MapModel.zoom}.\n *\n * @group Map Model\n **/\nexport interface ZoomOptions {\n /**\n * The zoom-level used if there is no valid extend (such as for single points).\n */\n pointZoom?: number;\n\n /**\n * The maximum zoom-level for multiple points, line or polygon results.\n */\n maxZoom?: number;\n\n /**\n * The view padding to make all features visible.\n */\n viewPadding?: MapPadding;\n\n /**\n * The buffer factor around the extent of the zoomed features. E.g. a value of 1.1 will add\n * 10% to specify the size increase of the extent's width and height.\n */\n buffer?: number;\n}\n\n/**\n * Represents an object in the map.\n *\n * @group Map Model\n */\nexport type DisplayTarget = BaseFeature | Geometry;\n\n/**\n * Map padding, all values are pixels.\n *\n * See https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#padding\n *\n * @group Map Model\n */\nexport interface MapPadding {\n left?: number;\n right?: number;\n top?: number;\n bottom?: number;\n}\n\n/**\n * An item that should be displayed as part of the attributions for the map.\n *\n * @group MapModel\n */\nexport interface AttributionItem {\n /**\n * The attribution's text.\n *\n * Note that this property contains raw HTML tags.\n * The HTML content has been sanitized, so it is safe to display in the user interface.\n */\n text: string;\n}\n\ntype DisplayStatus = \"waiting\" | \"ready\" | \"error\";\n\n/**\n * Represents a map.\n *\n * @group Map Model\n */\nexport class MapModel {\n readonly #id: string;\n readonly #olMap: OlMap;\n readonly #olView: ReadonlyReactive<OlView>;\n readonly #attributions: MapAttributions;\n readonly #layers = new LayerCollection(this, INTERNAL_CONSTRUCTOR_TAG);\n readonly #highlights: Highlights;\n readonly #tooltips: Overlays;\n readonly #layerDeps: LayerDependencies;\n readonly #destroyed = emitter();\n\n #loadStartEventHandler: EventsKey | undefined;\n #loadEndEventHandler: EventsKey | undefined;\n readonly #olLoading = reactive(false);\n\n #isDestroyed = false;\n readonly #container: ReadonlyReactive<HTMLElement | undefined>;\n readonly #initialExtent = reactive<ExtentConfig>();\n readonly #viewBindings: ReadonlyReactive<ViewBindings>;\n readonly #scale: ReadonlyReactive<number | undefined>;\n\n readonly #abortController = new AbortController();\n #displayStatus: DisplayStatus;\n #displayWaiter: ManualPromise<void> | undefined;\n\n /**\n * @internal\n */\n constructor(\n options: {\n id: string;\n olMap: OlMap;\n initialExtent: ExtentConfig | undefined;\n showDefaultAttributions: boolean;\n intl: PackageIntl;\n httpService: HttpService;\n },\n tag: InternalConstructorTag\n ) {\n assertInternalConstructor(tag);\n\n this.#id = options.id;\n this.#olMap = options.olMap;\n this.#attributions = new MapAttributions({\n intl: options.intl,\n olMap: this.#olMap,\n showControl: options.showDefaultAttributions\n });\n\n this.#olView = synchronized(\n () => this.#olMap.getView(),\n (cb) => {\n const key = this.#olMap.on(\"change:view\", cb);\n return () => unByKey(key);\n }\n );\n\n // NOTE: As early as possible (before any async actions) so we don't miss any events.\n this.#watchLoadingState();\n\n this.#initialExtent.value = options.initialExtent;\n this.#layerDeps = {\n httpService: options.httpService\n };\n\n this.#displayStatus = \"waiting\";\n this.#initializeView().then(\n () => {\n this.#displayStatus = \"ready\";\n this.#displayWaiter?.resolve();\n this.#displayWaiter = undefined;\n },\n (error) => {\n if (!isAbortError(error)) {\n LOG.error(`Failed to initialize map`, error);\n }\n\n this.#displayStatus = \"error\";\n this.#displayWaiter?.reject(new Error(`Failed to initialize map.`));\n this.#displayWaiter = undefined;\n }\n );\n\n this.#container = synchronized(\n () => this.#olMap.getTargetElement() ?? undefined,\n (cb) => {\n const key = this.#olMap.on(\"change:target\", cb);\n return () => unByKey(key);\n }\n );\n\n this.#viewBindings = computed(() => createViewBindings(this.#olView.value));\n this.#scale = computed(() => {\n const { projection, resolution, center } = this;\n if (projection == null || resolution == null || center == null) {\n return undefined;\n }\n\n /**\n * Returns the appropriate scale for the given resolution and units, see OpenLayers function getScaleForResolution()\n * https://github.com/openlayers/openlayers/blob/7fa9df03431e9e1bc517e6c414565d9f848a3132/src/ol/control/ScaleLine.js#L454C3-L454C24\n */\n const pointResolution = getPointResolution(projection, resolution, center, \"m\"); //point resolution in meter per pixel\n const scale = Math.round(pointResolution * INCHES_PER_METRE * DEFAULT_DPI);\n return scale;\n });\n\n // expects fully constructed mapModel\n this.#highlights = new Highlights(this, this.#layerDeps);\n this.#tooltips = new Overlays(this);\n }\n\n /**\n * Destroys this objects, including all layers, highlights and the OL map itself.\n */\n destroy() {\n if (this.#isDestroyed) {\n return;\n }\n\n this.#isDestroyed = true;\n try {\n emit(this.#destroyed);\n } catch (e) {\n LOG.warn(`Unexpected error from event listener during map model destruction:`, e);\n }\n\n this.#loadStartEventHandler && unByKey(this.#loadStartEventHandler);\n this.#loadStartEventHandler = undefined;\n this.#loadEndEventHandler && unByKey(this.#loadEndEventHandler);\n this.#loadEndEventHandler = undefined;\n\n this.#abortController.abort();\n this.#displayWaiter?.reject(new Error(\"Map model was destroyed.\"));\n this.#layers.destroy();\n this.#highlights[DESTROY_HIGHLIGHTS]();\n this.#attributions.destroy();\n this.#olMap.dispose();\n }\n\n /**\n * Emitted when the map model is destroyed.\n */\n get destroyed(): EventSource<void> {\n return this.#destroyed;\n }\n\n /**\n * Returns the map's current display status.\n * This is `waiting` during initialization and `error` or `ready` when done.\n *\n * @internal\n */\n get [DISPLAY_STATUS](): DisplayStatus {\n return this.#displayStatus;\n }\n\n /**\n * The unique id of the map.\n */\n get id(): string {\n return this.#id;\n }\n\n /**\n * The initial map extent.\n *\n * May be undefined before the map is shown.\n * This is guaranteed to be initialized if the promise returned by {@link whenDisplayed} has resolved.\n */\n get initialExtent(): ExtentConfig | undefined {\n return this.#initialExtent.value;\n }\n\n /**\n * Returns the current projection of the map (reactive).\n */\n get projection(): Projection {\n return this.#viewBindings.value.projection;\n }\n\n /**\n * Returns the current center of the map.\n * Same as `olView.getCenter()`, but reactive.\n */\n get center(): Coordinate | undefined {\n return this.#viewBindings.value.center.value;\n }\n\n /**\n * Returns the current resolution of the map.\n * Same as `olView.getResolution()`, but reactive.\n */\n get resolution(): number | undefined {\n return this.#viewBindings.value.resolution.value;\n }\n\n /**\n * Returns the current zoom level of the map.\n * Same as `olView.getZoom()`, but reactive.\n */\n get zoomLevel(): number | undefined {\n return this.#viewBindings.value.zoom.value;\n }\n\n /**\n * Returns the current scale of the map.\n *\n * The scale is a value derived from the current `center`, `resolution` and `projection` of the map.\n * The scale will change when the map is zoomed in our out, but depending on the projection, it may also\n * change when the map is _panned_.\n *\n * > NOTE: Technically, this is the _denominator_ of the current scale.\n * > In order to display it, use a format like `1:${scale}`.\n */\n get scale(): number | undefined {\n return this.#scale.value;\n }\n\n /**\n * Returns true if the map is currently loading.\n *\n * This is based on the OpenLayers events `loadstart` and `loadend`,\n * see [Documentation](https://openlayers.org/en/latest/apidoc/module-ol_MapEvent-MapEvent.html#event:loadstart).\n */\n get loading(): boolean {\n return this.#olLoading.value;\n }\n\n /**\n * Contains all known layers of this map.\n *\n * Note that not all layers in this collection may be active in the OpenLayers map.\n * Also note that not all layers in the OpenLayers map may be contained in this collection.\n */\n get layers(): LayerCollection {\n return this.#layers;\n }\n\n /**\n * The container in which the map is currently being rendered.\n * This is the same as the target element of the underlying OpenLayers map.\n *\n * May be undefined if the map is not being rendered at the moment.\n * May change at runtime.\n */\n get container(): HTMLElement | undefined {\n return this.#container.value;\n }\n\n /**\n * Returns attributions for the current content of the map.\n */\n get attributionItems(): AttributionItem[] {\n return this.#attributions.attributionItems;\n }\n\n /**\n * The raw OpenLayers map.\n */\n get olMap(): OlMap {\n return this.#olMap;\n }\n\n /**\n * Returns the current view of the OpenLayers map.\n */\n get olView(): OlView {\n return this.#olView.value;\n }\n\n /**\n * TODO: Can be removed once the LayerFactory is the only supported way of constructing a layer.\n *\n * @internal\n */\n get [LAYER_DEPS](): LayerDependencies {\n return this.#layerDeps;\n }\n\n /**\n * Create and receive map overlays\n */\n get overlays(): Overlays {\n return this.#tooltips;\n }\n\n /**\n * Create, receive and zoom to map highlights\n */\n get highlights(): Highlights {\n return this.#highlights;\n }\n\n /**\n * Changes the current scale of the map to the given value.\n *\n * Internally, this computes a new zoom level / resolution based on the scale\n * and the current center.\n * The new resolution is then applied to the current `olView`.\n *\n * See also {@link scale}.\n */\n setScale(newScale: number): void {\n const view = this.olView;\n const projection = this.projection;\n const center = this.center;\n if (!center) {\n return;\n }\n\n const mpu = projection.getMetersPerUnit() ?? 1;\n const resolution = INCHES_PER_METRE * DEFAULT_DPI * mpu;\n const pointResolution = newScale / getPointResolution(projection, resolution, center);\n view.setResolution(pointResolution);\n }\n\n /**\n * Zooms to the given targets.\n */\n zoom(displayTargets: DisplayTarget[], options?: ZoomOptions | undefined): void {\n const olView = this.olView;\n const geometries = getGeometries(displayTargets);\n if (geometries.length === 0) {\n return;\n }\n\n let extent = createEmpty();\n for (const geometry of geometries) {\n extent = extend(extent, geometry.getExtent());\n }\n\n const bufferParameter = options?.buffer;\n if (typeof bufferParameter === \"number\") {\n extent = calculateBufferedExtent(extent, bufferParameter);\n }\n\n const center = getCenter(extent);\n const isPoint = getArea(extent) === 0;\n const zoomLevel = isPoint\n ? (options?.pointZoom ?? DEFAULT_OL_POINT_ZOOM_LEVEL)\n : (options?.maxZoom ?? DEFAULT_OL_MAX_ZOOM_LEVEL);\n if (center && center.length) {\n olView.setCenter(center);\n }\n\n const {\n top = 0,\n right = 0,\n bottom = 0,\n left = 0\n } = options?.viewPadding ?? DEFAULT_VIEW_PADDING;\n const padding = [top, right, bottom, left];\n\n if (extent) {\n olView.fit(extent, { maxZoom: zoomLevel, padding });\n } else if (zoomLevel) {\n olView.setZoom(zoomLevel);\n }\n }\n\n /**\n * Creates a highlight at the given targets.\n *\n * A highlight is a temporary graphic on the map that calls attention to a point or an area.\n *\n * Call `destroy()` on the returned highlight object to remove the highlight.\n *\n * @deprecated Highlight functions will be removed in a future major release; call {@link Highlights.add} instead.\n */\n highlight(geometries: DisplayTarget[], options?: HighlightOptions | undefined): Highlight {\n deprecatedHighlights();\n return this.#highlights.add(geometries, options);\n }\n\n /**\n * Creates a highlight and zooms to the given targets.\n *\n * See also {@link highlight} and {@link zoom}.\n *\n * @deprecated Highlight functions will be removed in a future major release; call {@link Highlights.addAndZoom} instead.\n */\n highlightAndZoom(geometries: DisplayTarget[], options?: HighlightZoomOptions): Highlight {\n deprecatedHighlights();\n return this.#highlights.addAndZoom(geometries, options ?? {});\n }\n\n /**\n * Removes any existing highlights from the map.\n *\n * @deprecated Highlight functions wil be removed in a future major release; call {@link Highlights.clear} instead.\n */\n removeHighlights(): void {\n deprecatedHighlights();\n this.#highlights.clear();\n }\n\n /**\n * Returns a promise that resolves when the map has mounted in the DOM.\n */\n whenDisplayed(): Promise<void> {\n if (this.#isDestroyed) {\n return Promise.reject(new Error(\"Map model was destroyed.\"));\n }\n if (this.#displayStatus === \"error\") {\n return Promise.reject(new Error(`Failed to initialize map.`));\n }\n if (this.#displayStatus === \"ready\") {\n return Promise.resolve();\n }\n return (this.#displayWaiter ??= createManualPromise()).promise;\n }\n\n /**\n * Waits for the map to be displayed and then initializes the view (if necessary).\n *\n * May simply resolve when done, or throw an error when a problem occurs.\n * AbortError is thrown when cancelled via `this.#abortController`, for example\n * when the map model is destroyed before it has ever been displayed.\n */\n async #initializeView(): Promise<void> {\n try {\n await waitForMapSize(this.olMap, this.#abortController.signal); // may throw on cancel\n } catch (e) {\n if (isAbortError(e)) {\n throw e;\n }\n throw new Error(`Failed to wait for the map to be displayed.`, { cause: e });\n }\n\n try {\n const olMap = this.#olMap;\n const view = olMap.getView();\n\n if (this.#initialExtent.value) {\n // Initial extent was set from the outside. We simply ensure that it gets displayed by the map.\n const extent = this.#initialExtent.value;\n const olExtent = [extent.xMin, extent.yMin, extent.xMax, extent.yMax];\n\n const olCenter = getCenter(olExtent);\n const resolution = view.getResolutionForExtent(olExtent);\n LOG.debug(`Applying initial extent`, extent);\n LOG.debug(` Computed center:`, olCenter);\n LOG.debug(` Computed resolution:`, resolution);\n\n view.setCenter(olCenter);\n view.setResolution(resolution);\n } else {\n // Initial extent was NOT set from the outside.\n // We detect whatever the view is displaying and consider it to be the initial extent.\n const olExtent = view.calculateExtent();\n const [xMin = 0, yMin = 0, xMax = 0, yMax = 0] = olExtent;\n const extent: ExtentConfig = { xMin, yMin, xMax, yMax };\n LOG.debug(`Detected initial extent`, extent);\n\n this.#initialExtent.value = extent;\n }\n } catch (e) {\n throw new Error(`Failed to apply the initial extent.`, { cause: e });\n }\n }\n\n /**\n * Subscribes to the OpenLayers loading state.\n */\n #watchLoadingState() {\n this.#loadStartEventHandler = this.#olMap.on(\"loadstart\", () => {\n this.#olLoading.value = true;\n });\n this.#loadEndEventHandler = this.#olMap.on(\"loadend\", () => {\n this.#olLoading.value = false;\n });\n }\n}\n\ninterface ViewBindings {\n resolution: ReadonlyReactive<number | undefined>;\n center: ReadonlyReactive<Coordinate | undefined>;\n zoom: ReadonlyReactive<number | undefined>;\n projection: Projection; // not reactive (change view to change projection)\n}\n\nfunction createViewBindings(view: OlView): ViewBindings {\n return {\n resolution: synchronized(\n () => view.getResolution(),\n (cb) => {\n const key = view.on(\"change:resolution\", cb);\n return () => unByKey(key);\n }\n ),\n center: synchronized(\n () => view.getCenter(),\n (cb) => {\n const key = view.on(\"change:center\", cb);\n return () => unByKey(key);\n }\n ),\n zoom: synchronized(\n () => view.getZoom(),\n (cb) => {\n const key = view.on(\"change:resolution\", cb);\n return () => unByKey(key);\n }\n ),\n projection: view.getProjection()\n };\n}\n\nfunction waitForMapSize(olMap: OlMap, signal: AbortSignal): Promise<void> {\n const promise = new Promise<void>((resolve, reject) => {\n let eventKey: EventsKey | undefined;\n\n function checkSize() {\n const currentSize = olMap.getSize() ?? [];\n const [width = 0, height = 0] = currentSize;\n if (currentSize && width > 0 && height > 0) {\n finish();\n }\n }\n\n function onAbort() {\n finish(createAbortError());\n }\n\n function finish(error?: Error | undefined) {\n if (eventKey) {\n unByKey(eventKey);\n eventKey = undefined;\n }\n signal.removeEventListener(\"abort\", onAbort);\n\n if (error) {\n reject(error);\n } else {\n resolve(wait(25)); // Give the map some time to render\n }\n }\n\n if (signal.aborted) {\n finish(createAbortError());\n return;\n }\n\n signal.addEventListener(\"abort\", onAbort);\n eventKey = olMap.on(\"change:size\", checkSize);\n });\n return promise;\n}\n\nfunction wait(milliseconds: number): Prom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AACD,EAAA,OAAO,OAAA;AACX;AAEA,SAAS,KAAK,YAAA,EAAqC;AAC/C,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,YAAY,UAAA,CAAW,OAAA,EAAS,YAAY,CAAC,CAAA;AACrE;;;;"}
1
+ {"version":3,"file":"MapModel.js","sources":["MapModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { computed, reactive, ReadonlyReactive, synchronized } from \"@conterra/reactivity-core\";\nimport { emit, emitter, EventSource } from \"@conterra/reactivity-events\";\nimport {\n createAbortError,\n createLogger,\n createManualPromise,\n deprecated,\n isAbortError,\n ManualPromise\n} from \"@open-pioneer/core\";\nimport { HttpService } from \"@open-pioneer/http\";\nimport OlMap from \"ol/Map\";\nimport { unByKey } from \"ol/Observable\";\nimport OlView from \"ol/View\";\nimport { Coordinate } from \"ol/coordinate\";\nimport { EventsKey } from \"ol/events\";\nimport { createEmpty, extend, getArea, getCenter } from \"ol/extent\";\nimport { getPointResolution, Projection } from \"ol/proj\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { LAYER_DEPS, LayerDependencies } from \"../layers/shared/internals\";\nimport {\n assertInternalConstructor,\n INTERNAL_CONSTRUCTOR_TAG,\n InternalConstructorTag\n} from \"../utils/InternalConstructorTag\";\nimport { calculateBufferedExtent } from \"../utils/geometry-utils\";\nimport {\n DESTROY_HIGHLIGHTS,\n Highlight,\n HighlightOptions,\n Highlights,\n HighlightZoomOptions\n} from \"./Highlights\";\nimport { LayerCollection } from \"./LayerCollection\";\nimport { ExtentConfig } from \"./MapConfig\";\nimport { Overlays } from \"./Overlays\";\nimport { getGeometries } from \"./getGeometries\";\nimport { BaseFeature } from \"../utils/BaseFeature\";\nimport { Geometry } from \"ol/geom\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { MapAttributions } from \"./MapAttributions\";\n\nconst LOG = createLogger(sourceId);\n\nconst DEFAULT_DPI = 25.4 / 0.28;\nconst INCHES_PER_METRE = 39.37;\n\nconst DEFAULT_OL_POINT_ZOOM_LEVEL = 17;\nconst DEFAULT_OL_MAX_ZOOM_LEVEL = 20;\nconst DEFAULT_VIEW_PADDING = { top: 50, right: 20, bottom: 10, left: 20 };\n\nexport const DISPLAY_STATUS = Symbol(\"DISPLAY_STATUS\");\n\nconst deprecatedHighlights = deprecated({\n name: \"MapModel highlight function called\",\n packageName: \"@open-pioneer/map\",\n since: \"v1.3.0\",\n alternative: \"call methods of myMapModel.highlights instead\"\n});\n\n/**\n * Options supported when calling {@link MapModel.zoom}.\n *\n * @group Map Model\n **/\nexport interface ZoomOptions {\n /**\n * The zoom-level used if there is no valid extend (such as for single points).\n */\n pointZoom?: number;\n\n /**\n * The maximum zoom-level for multiple points, line or polygon results.\n */\n maxZoom?: number;\n\n /**\n * The view padding to make all features visible.\n */\n viewPadding?: MapPadding;\n\n /**\n * The buffer factor around the extent of the zoomed features. E.g. a value of 1.1 will add\n * 10% to specify the size increase of the extent's width and height.\n */\n buffer?: number;\n}\n\n/**\n * Represents an object in the map.\n *\n * @group Map Model\n */\nexport type DisplayTarget = BaseFeature | Geometry;\n\n/**\n * Map padding, all values are pixels.\n *\n * See https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#padding\n *\n * @group Map Model\n */\nexport interface MapPadding {\n left?: number;\n right?: number;\n top?: number;\n bottom?: number;\n}\n\n/**\n * An item that should be displayed as part of the attributions for the map.\n *\n * @group MapModel\n */\nexport interface AttributionItem {\n /**\n * The attribution's text.\n *\n * Note that this property contains raw HTML tags.\n * The HTML content has been sanitized, so it is safe to display in the user interface.\n */\n text: string;\n}\n\ntype DisplayStatus = \"waiting\" | \"ready\" | \"error\";\n\n/**\n * Represents a map.\n *\n * @group Map Model\n */\nexport class MapModel {\n readonly #id: string;\n readonly #olMap: OlMap;\n readonly #olView: ReadonlyReactive<OlView>;\n readonly #attributions: MapAttributions;\n readonly #layers = new LayerCollection(this, INTERNAL_CONSTRUCTOR_TAG);\n readonly #highlights: Highlights;\n readonly #tooltips: Overlays;\n readonly #layerDeps: LayerDependencies;\n readonly #destroyed = emitter();\n\n #loadStartEventHandler: EventsKey | undefined;\n #loadEndEventHandler: EventsKey | undefined;\n readonly #olLoading = reactive(false);\n\n #isDestroyed = false;\n readonly #container: ReadonlyReactive<HTMLElement | undefined>;\n readonly #initialExtent = reactive<ExtentConfig>();\n readonly #viewBindings: ReadonlyReactive<ViewBindings>;\n readonly #scale: ReadonlyReactive<number | undefined>;\n\n readonly #abortController = new AbortController();\n #displayStatus: DisplayStatus;\n #displayWaiter: ManualPromise<void> | undefined;\n\n /**\n * @internal\n */\n constructor(\n options: {\n id: string;\n olMap: OlMap;\n initialExtent: ExtentConfig | undefined;\n showDefaultAttributions: boolean;\n currentIntl: ReadonlyReactive<PackageIntl>;\n httpService: HttpService;\n },\n tag: InternalConstructorTag\n ) {\n assertInternalConstructor(tag);\n\n this.#id = options.id;\n this.#olMap = options.olMap;\n this.#attributions = new MapAttributions({\n intl: options.currentIntl,\n olMap: this.#olMap,\n showControl: options.showDefaultAttributions\n });\n\n this.#olView = synchronized(\n () => this.#olMap.getView(),\n (cb) => {\n const key = this.#olMap.on(\"change:view\", cb);\n return () => unByKey(key);\n }\n );\n\n // NOTE: As early as possible (before any async actions) so we don't miss any events.\n this.#watchLoadingState();\n\n this.#initialExtent.value = options.initialExtent;\n this.#layerDeps = {\n httpService: options.httpService\n };\n\n this.#displayStatus = \"waiting\";\n this.#initializeView().then(\n () => {\n this.#displayStatus = \"ready\";\n this.#displayWaiter?.resolve();\n this.#displayWaiter = undefined;\n },\n (error) => {\n if (!isAbortError(error)) {\n LOG.error(`Failed to initialize map`, error);\n }\n\n this.#displayStatus = \"error\";\n this.#displayWaiter?.reject(new Error(`Failed to initialize map.`));\n this.#displayWaiter = undefined;\n }\n );\n\n this.#container = synchronized(\n () => this.#olMap.getTargetElement() ?? undefined,\n (cb) => {\n const key = this.#olMap.on(\"change:target\", cb);\n return () => unByKey(key);\n }\n );\n\n this.#viewBindings = computed(() => createViewBindings(this.#olView.value));\n this.#scale = computed(() => {\n const { projection, resolution, center } = this;\n if (projection == null || resolution == null || center == null) {\n return undefined;\n }\n\n /**\n * Returns the appropriate scale for the given resolution and units, see OpenLayers function getScaleForResolution()\n * https://github.com/openlayers/openlayers/blob/7fa9df03431e9e1bc517e6c414565d9f848a3132/src/ol/control/ScaleLine.js#L454C3-L454C24\n */\n const pointResolution = getPointResolution(projection, resolution, center, \"m\"); //point resolution in meter per pixel\n const scale = Math.round(pointResolution * INCHES_PER_METRE * DEFAULT_DPI);\n return scale;\n });\n\n // expects fully constructed mapModel\n this.#highlights = new Highlights(this, this.#layerDeps);\n this.#tooltips = new Overlays(this);\n }\n\n /**\n * Destroys this objects, including all layers, highlights and the OL map itself.\n */\n destroy() {\n if (this.#isDestroyed) {\n return;\n }\n\n this.#isDestroyed = true;\n try {\n emit(this.#destroyed);\n } catch (e) {\n LOG.warn(`Unexpected error from event listener during map model destruction:`, e);\n }\n\n this.#loadStartEventHandler && unByKey(this.#loadStartEventHandler);\n this.#loadStartEventHandler = undefined;\n this.#loadEndEventHandler && unByKey(this.#loadEndEventHandler);\n this.#loadEndEventHandler = undefined;\n\n this.#abortController.abort();\n this.#displayWaiter?.reject(new Error(\"Map model was destroyed.\"));\n this.#layers.destroy();\n this.#highlights[DESTROY_HIGHLIGHTS]();\n this.#attributions.destroy();\n this.#olMap.dispose();\n }\n\n /**\n * Emitted when the map model is destroyed.\n */\n get destroyed(): EventSource<void> {\n return this.#destroyed;\n }\n\n /**\n * Returns the map's current display status.\n * This is `waiting` during initialization and `error` or `ready` when done.\n *\n * @internal\n */\n get [DISPLAY_STATUS](): DisplayStatus {\n return this.#displayStatus;\n }\n\n /**\n * The unique id of the map.\n */\n get id(): string {\n return this.#id;\n }\n\n /**\n * The initial map extent.\n *\n * May be undefined before the map is shown.\n * This is guaranteed to be initialized if the promise returned by {@link whenDisplayed} has resolved.\n */\n get initialExtent(): ExtentConfig | undefined {\n return this.#initialExtent.value;\n }\n\n /**\n * Returns the current projection of the map (reactive).\n */\n get projection(): Projection {\n return this.#viewBindings.value.projection;\n }\n\n /**\n * Returns the current center of the map.\n * Same as `olView.getCenter()`, but reactive.\n */\n get center(): Coordinate | undefined {\n return this.#viewBindings.value.center.value;\n }\n\n /**\n * Returns the current resolution of the map.\n * Same as `olView.getResolution()`, but reactive.\n */\n get resolution(): number | undefined {\n return this.#viewBindings.value.resolution.value;\n }\n\n /**\n * Returns the current zoom level of the map.\n * Same as `olView.getZoom()`, but reactive.\n */\n get zoomLevel(): number | undefined {\n return this.#viewBindings.value.zoom.value;\n }\n\n /**\n * Returns the current scale of the map.\n *\n * The scale is a value derived from the current `center`, `resolution` and `projection` of the map.\n * The scale will change when the map is zoomed in our out, but depending on the projection, it may also\n * change when the map is _panned_.\n *\n * > NOTE: Technically, this is the _denominator_ of the current scale.\n * > In order to display it, use a format like `1:${scale}`.\n */\n get scale(): number | undefined {\n return this.#scale.value;\n }\n\n /**\n * Returns true if the map is currently loading.\n *\n * This is based on the OpenLayers events `loadstart` and `loadend`,\n * see [Documentation](https://openlayers.org/en/latest/apidoc/module-ol_MapEvent-MapEvent.html#event:loadstart).\n */\n get loading(): boolean {\n return this.#olLoading.value;\n }\n\n /**\n * Contains all known layers of this map.\n *\n * Note that not all layers in this collection may be active in the OpenLayers map.\n * Also note that not all layers in the OpenLayers map may be contained in this collection.\n */\n get layers(): LayerCollection {\n return this.#layers;\n }\n\n /**\n * The container in which the map is currently being rendered.\n * This is the same as the target element of the underlying OpenLayers map.\n *\n * May be undefined if the map is not being rendered at the moment.\n * May change at runtime.\n */\n get container(): HTMLElement | undefined {\n return this.#container.value;\n }\n\n /**\n * Returns attributions for the current content of the map.\n */\n get attributionItems(): AttributionItem[] {\n return this.#attributions.attributionItems;\n }\n\n /**\n * The raw OpenLayers map.\n */\n get olMap(): OlMap {\n return this.#olMap;\n }\n\n /**\n * Returns the current view of the OpenLayers map.\n */\n get olView(): OlView {\n return this.#olView.value;\n }\n\n /**\n * TODO: Can be removed once the LayerFactory is the only supported way of constructing a layer.\n *\n * @internal\n */\n get [LAYER_DEPS](): LayerDependencies {\n return this.#layerDeps;\n }\n\n /**\n * Create and receive map overlays\n */\n get overlays(): Overlays {\n return this.#tooltips;\n }\n\n /**\n * Create, receive and zoom to map highlights\n */\n get highlights(): Highlights {\n return this.#highlights;\n }\n\n /**\n * Changes the current scale of the map to the given value.\n *\n * Internally, this computes a new zoom level / resolution based on the scale\n * and the current center.\n * The new resolution is then applied to the current `olView`.\n *\n * See also {@link scale}.\n */\n setScale(newScale: number): void {\n const view = this.olView;\n const projection = this.projection;\n const center = this.center;\n if (!center) {\n return;\n }\n\n const mpu = projection.getMetersPerUnit() ?? 1;\n const resolution = INCHES_PER_METRE * DEFAULT_DPI * mpu;\n const pointResolution = newScale / getPointResolution(projection, resolution, center);\n view.setResolution(pointResolution);\n }\n\n /**\n * Zooms to the given targets.\n */\n zoom(displayTargets: DisplayTarget[], options?: ZoomOptions | undefined): void {\n const olView = this.olView;\n const geometries = getGeometries(displayTargets);\n if (geometries.length === 0) {\n return;\n }\n\n let extent = createEmpty();\n for (const geometry of geometries) {\n extent = extend(extent, geometry.getExtent());\n }\n\n const bufferParameter = options?.buffer;\n if (typeof bufferParameter === \"number\") {\n extent = calculateBufferedExtent(extent, bufferParameter);\n }\n\n const center = getCenter(extent);\n const isPoint = getArea(extent) === 0;\n const zoomLevel = isPoint\n ? (options?.pointZoom ?? DEFAULT_OL_POINT_ZOOM_LEVEL)\n : (options?.maxZoom ?? DEFAULT_OL_MAX_ZOOM_LEVEL);\n if (center && center.length) {\n olView.setCenter(center);\n }\n\n const {\n top = 0,\n right = 0,\n bottom = 0,\n left = 0\n } = options?.viewPadding ?? DEFAULT_VIEW_PADDING;\n const padding = [top, right, bottom, left];\n\n if (extent) {\n olView.fit(extent, { maxZoom: zoomLevel, padding });\n } else if (zoomLevel) {\n olView.setZoom(zoomLevel);\n }\n }\n\n /**\n * Creates a highlight at the given targets.\n *\n * A highlight is a temporary graphic on the map that calls attention to a point or an area.\n *\n * Call `destroy()` on the returned highlight object to remove the highlight.\n *\n * @deprecated Highlight functions will be removed in a future major release; call {@link Highlights.add} instead.\n */\n highlight(geometries: DisplayTarget[], options?: HighlightOptions | undefined): Highlight {\n deprecatedHighlights();\n return this.#highlights.add(geometries, options);\n }\n\n /**\n * Creates a highlight and zooms to the given targets.\n *\n * See also {@link highlight} and {@link zoom}.\n *\n * @deprecated Highlight functions will be removed in a future major release; call {@link Highlights.addAndZoom} instead.\n */\n highlightAndZoom(geometries: DisplayTarget[], options?: HighlightZoomOptions): Highlight {\n deprecatedHighlights();\n return this.#highlights.addAndZoom(geometries, options ?? {});\n }\n\n /**\n * Removes any existing highlights from the map.\n *\n * @deprecated Highlight functions wil be removed in a future major release; call {@link Highlights.clear} instead.\n */\n removeHighlights(): void {\n deprecatedHighlights();\n this.#highlights.clear();\n }\n\n /**\n * Returns a promise that resolves when the map has mounted in the DOM.\n */\n whenDisplayed(): Promise<void> {\n if (this.#isDestroyed) {\n return Promise.reject(new Error(\"Map model was destroyed.\"));\n }\n if (this.#displayStatus === \"error\") {\n return Promise.reject(new Error(`Failed to initialize map.`));\n }\n if (this.#displayStatus === \"ready\") {\n return Promise.resolve();\n }\n return (this.#displayWaiter ??= createManualPromise()).promise;\n }\n\n /**\n * Waits for the map to be displayed and then initializes the view (if necessary).\n *\n * May simply resolve when done, or throw an error when a problem occurs.\n * AbortError is thrown when cancelled via `this.#abortController`, for example\n * when the map model is destroyed before it has ever been displayed.\n */\n async #initializeView(): Promise<void> {\n try {\n await waitForMapSize(this.olMap, this.#abortController.signal); // may throw on cancel\n } catch (e) {\n if (isAbortError(e)) {\n throw e;\n }\n throw new Error(`Failed to wait for the map to be displayed.`, { cause: e });\n }\n\n try {\n const olMap = this.#olMap;\n const view = olMap.getView();\n\n if (this.#initialExtent.value) {\n // Initial extent was set from the outside. We simply ensure that it gets displayed by the map.\n const extent = this.#initialExtent.value;\n const olExtent = [extent.xMin, extent.yMin, extent.xMax, extent.yMax];\n\n const olCenter = getCenter(olExtent);\n const resolution = view.getResolutionForExtent(olExtent);\n LOG.debug(`Applying initial extent`, extent);\n LOG.debug(` Computed center:`, olCenter);\n LOG.debug(` Computed resolution:`, resolution);\n\n view.setCenter(olCenter);\n view.setResolution(resolution);\n } else {\n // Initial extent was NOT set from the outside.\n // We detect whatever the view is displaying and consider it to be the initial extent.\n const olExtent = view.calculateExtent();\n const [xMin = 0, yMin = 0, xMax = 0, yMax = 0] = olExtent;\n const extent: ExtentConfig = { xMin, yMin, xMax, yMax };\n LOG.debug(`Detected initial extent`, extent);\n\n this.#initialExtent.value = extent;\n }\n } catch (e) {\n throw new Error(`Failed to apply the initial extent.`, { cause: e });\n }\n }\n\n /**\n * Subscribes to the OpenLayers loading state.\n */\n #watchLoadingState() {\n this.#loadStartEventHandler = this.#olMap.on(\"loadstart\", () => {\n this.#olLoading.value = true;\n });\n this.#loadEndEventHandler = this.#olMap.on(\"loadend\", () => {\n this.#olLoading.value = false;\n });\n }\n}\n\ninterface ViewBindings {\n resolution: ReadonlyReactive<number | undefined>;\n center: ReadonlyReactive<Coordinate | undefined>;\n zoom: ReadonlyReactive<number | undefined>;\n projection: Projection; // not reactive (change view to change projection)\n}\n\nfunction createViewBindings(view: OlView): ViewBindings {\n return {\n resolution: synchronized(\n () => view.getResolution(),\n (cb) => {\n const key = view.on(\"change:resolution\", cb);\n return () => unByKey(key);\n }\n ),\n center: synchronized(\n () => view.getCenter(),\n (cb) => {\n const key = view.on(\"change:center\", cb);\n return () => unByKey(key);\n }\n ),\n zoom: synchronized(\n () => view.getZoom(),\n (cb) => {\n const key = view.on(\"change:resolution\", cb);\n return () => unByKey(key);\n }\n ),\n projection: view.getProjection()\n };\n}\n\nfunction waitForMapSize(olMap: OlMap, signal: AbortSignal): Promise<void> {\n const promise = new Promise<void>((resolve, reject) => {\n let eventKey: EventsKey | undefined;\n\n function checkSize() {\n const currentSize = olMap.getSize() ?? [];\n const [width = 0, height = 0] = currentSize;\n if (currentSize && width > 0 && height > 0) {\n finish();\n }\n }\n\n function onAbort() {\n finish(createAbortError());\n }\n\n function finish(error?: Error | undefined) {\n if (eventKey) {\n unByKey(eventKey);\n eventKey = undefined;\n }\n signal.removeEventListener(\"abort\", onAbort);\n\n if (error) {\n reject(error);\n } else {\n resolve(wait(25)); // Give the map some time to render\n }\n }\n\n if (signal.aborted) {\n finish(createAbortError());\n return;\n }\n\n signal.addEventListener(\"abort\", onAbort);\n eventKey = olMap.on(\"change:size\", checkSize);\n });\n return promise;\n}\n\nfunction wait(milliseconds: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, milliseconds));\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAEjC,MAAM,cAAc,IAAA,GAAO,IAAA;AAC3B,MAAM,gBAAA,GAAmB,KAAA;AAEzB,MAAM,2BAAA,GAA8B,EAAA;AACpC,MAAM,yBAAA,GAA4B,EAAA;AAClC,MAAM,oBAAA,GAAuB,EAAE,GAAA,EAAK,EAAA,EAAI,OAAO,EAAA,EAAI,MAAA,EAAQ,EAAA,EAAI,IAAA,EAAM,EAAA,EAAG;AAEjE,MAAM,cAAA,0BAAwB,gBAAgB;AAErD,MAAM,uBAAuB,UAAA,CAAW;AAAA,EACpC,IAAA,EAAM,oCAAA;AAAA,EACN,WAAA,EAAa,mBAAA;AAAA,EACb,KAAA,EAAO,QAAA;AAAA,EACP,WAAA,EAAa;AACjB,CAAC,CAAA;AAyEM,MAAM,QAAA,CAAS;AAAA,EACT,GAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA,OAAA,GAAU,IAAI,eAAA,CAAgB,IAAA,EAAM,wBAAwB,CAAA;AAAA,EAC5D,WAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;A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AAO,CAAA;AAE3C,MAAA,IAAI,KAAA,EAAO;AACP,QAAA,MAAA,CAAO,KAAK,CAAA;AAAA,MAChB,CAAA,MAAO;AACH,QAAA,OAAA,CAAQ,IAAA,CAAK,EAAE,CAAC,CAAA;AAAA,MACpB;AAAA,IACJ;AAEA,IAAA,IAAI,OAAO,OAAA,EAAS;AAChB,MAAA,MAAA,CAAO,kBAAkB,CAAA;AACzB,MAAA;AAAA,IACJ;AAEA,IAAA,MAAA,CAAO,gBAAA,CAAiB,SAAS,OAAO,CAAA;AACxC,IAAA,QAAA,GAAW,KAAA,CAAM,EAAA,CAAG,aAAA,EAAe,SAAS,CAAA;AAAA,EAChD,CAAC,CAAA;AACD,EAAA,OAAO,OAAA;AACX;AAEA,SAAS,KAAK,YAAA,EAAqC;AAC/C,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,YAAY,UAAA,CAAW,OAAA,EAAS,YAAY,CAAC,CAAA;AACrE;;;;"}
@@ -1,5 +1,6 @@
1
+ import { ReadonlyReactive } from "@conterra/reactivity-core";
1
2
  import { HttpService } from "@open-pioneer/http";
2
3
  import { PackageIntl } from "@open-pioneer/runtime";
3
4
  import { MapConfig } from "./MapConfig";
4
5
  import { MapModel } from "./MapModel";
5
- export declare function createMapModel(mapId: string, mapConfig: MapConfig, intl: PackageIntl, httpService: HttpService): Promise<MapModel>;
6
+ export declare function createMapModel(mapId: string, mapConfig: MapConfig, currentIntl: ReadonlyReactive<PackageIntl>, httpService: HttpService): Promise<MapModel>;
@@ -18,18 +18,18 @@ registerProjections({
18
18
  "EPSG:25833": "+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs"
19
19
  });
20
20
  const LOG = createLogger(sourceId);
21
- async function createMapModel(mapId, mapConfig, intl, httpService) {
22
- return await new MapModelFactory(mapId, mapConfig, intl, httpService).createMapModel();
21
+ async function createMapModel(mapId, mapConfig, currentIntl, httpService) {
22
+ return await new MapModelFactory(mapId, mapConfig, currentIntl, httpService).createMapModel();
23
23
  }
24
24
  class MapModelFactory {
25
25
  mapId;
26
26
  mapConfig;
27
- intl;
27
+ currentIntl;
28
28
  httpService;
29
- constructor(mapId, mapConfig, intl, httpService) {
29
+ constructor(mapId, mapConfig, currentIntl, httpService) {
30
30
  this.mapId = mapId;
31
31
  this.mapConfig = mapConfig;
32
- this.intl = intl;
32
+ this.currentIntl = currentIntl;
33
33
  this.httpService = httpService;
34
34
  }
35
35
  async createMapModel() {
@@ -78,7 +78,7 @@ class MapModelFactory {
78
78
  olMap,
79
79
  initialExtent,
80
80
  showDefaultAttributions,
81
- intl: this.intl,
81
+ currentIntl: this.currentIntl,
82
82
  httpService: this.httpService
83
83
  },
84
84
  INTERNAL_CONSTRUCTOR_TAG
@@ -1 +1 @@
1
- {"version":3,"file":"createMapModel.js","sources":["createMapModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { batch } from \"@conterra/reactivity-core\";\nimport { createLogger } from \"@open-pioneer/core\";\nimport { HttpService } from \"@open-pioneer/http\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { MapBrowserEvent } from \"ol\";\nimport OlMap, { MapOptions } from \"ol/Map\";\nimport View, { ViewOptions } from \"ol/View\";\nimport { getCenter } from \"ol/extent\";\nimport { DragZoom, defaults as defaultInteractions } from \"ol/interaction\";\nimport TileLayer from \"ol/layer/Tile\";\nimport { Projection, get as getProjection } from \"ol/proj\";\nimport OSM from \"ol/source/OSM\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { INTERNAL_CONSTRUCTOR_TAG } from \"../utils/InternalConstructorTag\";\nimport { patchOpenLayersClassesForTesting } from \"../utils/ol-test-support\";\nimport { registerProjections } from \"../utils/projections\";\nimport { MapConfig } from \"./MapConfig\";\nimport { MapModel } from \"./MapModel\";\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(sourceId);\n\nexport async function createMapModel(\n mapId: string,\n mapConfig: MapConfig,\n intl: PackageIntl,\n httpService: HttpService\n): Promise<MapModel> {\n return await new MapModelFactory(mapId, mapConfig, intl, httpService).createMapModel();\n}\n\nclass MapModelFactory {\n private mapId: string;\n private mapConfig: MapConfig;\n private intl: PackageIntl;\n private httpService: HttpService;\n\n constructor(mapId: string, mapConfig: MapConfig, intl: PackageIntl, httpService: HttpService) {\n this.mapId = mapId;\n this.mapConfig = mapConfig;\n this.intl = intl;\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 showDefaultAttributions =\n mapConfig.showAttributions ?? (rawOlOptions.controls ? false : true);\n\n const mapOptions: MapOptions = {\n ...rawOlOptions\n };\n if (!mapOptions.controls) {\n mapOptions.controls = [];\n }\n if (!mapOptions.interactions) {\n const shiftCtrlKeysOnly = (\n mapBrowserEvent: MapBrowserEvent<KeyboardEvent | WheelEvent | PointerEvent>\n ) => {\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 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 const mapModel = new MapModel(\n {\n id: mapId,\n olMap,\n initialExtent,\n showDefaultAttributions,\n intl: this.intl,\n httpService: this.httpService\n },\n INTERNAL_CONSTRUCTOR_TAG\n );\n\n return batch(() => {\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\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 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\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":";;;;;;;;;;;;;;;AAyBA,mBAAA,CAAoB;AAAA,EAChB,YAAA,EACI,oFAAA;AAAA,EACJ,YAAA,EACI;AACR,CAAC,CAAA;AACD,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAEjC,eAAsB,cAAA,CAClB,KAAA,EACA,SAAA,EACA,IAAA,EACA,WAAA,EACiB;AACjB,EAAA,OAAO,MAAM,IAAI,eAAA,CAAgB,KAAA,EAAO,WAAW,IAAA,EAAM,WAAW,EAAE,cAAA,EAAe;AACzF;AAEA,MAAM,eAAA,CAAgB;AAAA,EACV,KAAA;AAAA,EACA,SAAA;AAAA,EACA,IAAA;AAAA,EACA,WAAA;AAAA,EAER,WAAA,CAAY,KAAA,EAAe,SAAA,EAAsB,IAAA,EAAmB,WAAA,EAA0B;AAC1F,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AACb,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AACjB,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,WAAA,GAAc,WAAA;AAAA,EACvB;AAAA,EAEA,MAAM,cAAA,GAAiB;AACnB,IAAA,M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CAAgB,MAAM,UAAU,CAAA;AAAA,IACzC;AAAA,EACJ;AAAA,EAEQ,eAAA,CAAgB,MAAmB,UAAA,EAAwB;AAC/D,IAAA,IAAI,IAAA,CAAK,UAAU,IAAA,EAAM;AACrB,MAAA,MAAM,MAAA,GAAS,WAAW,SAAA,EAAU;AACpC,MAAA,IAAI,CAAC,MAAA,EAAQ;AACT,QAAA,GAAA,CAAI,IAAA;AAAA,UACA,CAAA;AAAA,yCAAA;AAAA,SAEJ;AAAA,MACJ,CAAA,MAAO;AACH,QAAA,IAAA,CAAK,MAAA,GAAS,UAAU,MAAM,CAAA;AAAA,MAClC;AAAA,IACJ;AAEA,IAAA,IAAI,IAAA,CAAK,IAAA,IAAQ,IAAA,IAAQ,IAAA,CAAK,cAAc,IAAA,EAAM;AAC9C,MAAA,IAAA,CAAK,IAAA,GAAO,CAAA;AAAA,IAChB;AAAA,EACJ;AAAA,EAEQ,qBAAqB,gBAAA,EAA2C;AACpE,IAAA,IAAI,oBAAoB,IAAA,EAAM;AAE1B,MAAA,OAAOC,IAAc,WAAW,CAAA;AAAA,IACpC;AAEA,IAAA,MAAM,UAAA,GAAaA,IAAc,gBAAgB,CAAA;AACjD,IAAA,IAAI,CAAC,UAAA,EAAY;AACb,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,wCAAA,EAA2C,gBAAgB,CAAA,EAAA,CAAI,CAAA;AAAA,IACnF;AACA,IAAA,OAAO,UAAA;AAAA,EACX;AACJ;;;;"}
1
+ {"version":3,"file":"createMapModel.js","sources":["createMapModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { batch, ReadonlyReactive } from \"@conterra/reactivity-core\";\nimport { createLogger } from \"@open-pioneer/core\";\nimport { HttpService } from \"@open-pioneer/http\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { MapBrowserEvent } from \"ol\";\nimport OlMap, { MapOptions } from \"ol/Map\";\nimport View, { ViewOptions } from \"ol/View\";\nimport { getCenter } from \"ol/extent\";\nimport { DragZoom, defaults as defaultInteractions } from \"ol/interaction\";\nimport TileLayer from \"ol/layer/Tile\";\nimport { Projection, get as getProjection } from \"ol/proj\";\nimport OSM from \"ol/source/OSM\";\nimport { sourceId } from \"open-pioneer:source-info\";\nimport { INTERNAL_CONSTRUCTOR_TAG } from \"../utils/InternalConstructorTag\";\nimport { patchOpenLayersClassesForTesting } from \"../utils/ol-test-support\";\nimport { registerProjections } from \"../utils/projections\";\nimport { MapConfig } from \"./MapConfig\";\nimport { MapModel } from \"./MapModel\";\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(sourceId);\n\nexport async function createMapModel(\n mapId: string,\n mapConfig: MapConfig,\n currentIntl: ReadonlyReactive<PackageIntl>,\n httpService: HttpService\n): Promise<MapModel> {\n return await new MapModelFactory(mapId, mapConfig, currentIntl, httpService).createMapModel();\n}\n\nclass MapModelFactory {\n private mapId: string;\n private mapConfig: MapConfig;\n private currentIntl: ReadonlyReactive<PackageIntl>;\n private httpService: HttpService;\n\n constructor(\n mapId: string,\n mapConfig: MapConfig,\n currentIntl: ReadonlyReactive<PackageIntl>,\n httpService: HttpService\n ) {\n this.mapId = mapId;\n this.mapConfig = mapConfig;\n this.currentIntl = currentIntl;\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 showDefaultAttributions =\n mapConfig.showAttributions ?? (rawOlOptions.controls ? false : true);\n\n const mapOptions: MapOptions = {\n ...rawOlOptions\n };\n if (!mapOptions.controls) {\n mapOptions.controls = [];\n }\n if (!mapOptions.interactions) {\n const shiftCtrlKeysOnly = (\n mapBrowserEvent: MapBrowserEvent<KeyboardEvent | WheelEvent | PointerEvent>\n ) => {\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 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 const mapModel = new MapModel(\n {\n id: mapId,\n olMap,\n initialExtent,\n showDefaultAttributions,\n currentIntl: this.currentIntl,\n httpService: this.httpService\n },\n INTERNAL_CONSTRUCTOR_TAG\n );\n\n return batch(() => {\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\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 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\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":";;;;;;;;;;;;;;;AAyBA,mBAAA,CAAoB;AAAA,EAChB,YAAA,EACI,oFAAA;AAAA,EACJ,YAAA,EACI;AACR,CAAC,CAAA;AACD,MAAM,GAAA,GAAM,aAAa,QAAQ,CAAA;AAEjC,eAAsB,cAAA,CAClB,KAAA,EACA,SAAA,EACA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BAAgB,CAAA;AACjD,IAAA,IAAI,CAAC,UAAA,EAAY;AACb,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,wCAAA,EAA2C,gBAAgB,CAAA,EAAA,CAAI,CAAA;AAAA,IACnF;AACA,IAAA,OAAO,UAAA;AAAA,EACX;AACJ;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@open-pioneer/map",
4
- "version": "1.3.0-dev.20260512095810",
4
+ "version": "1.3.0",
5
5
  "description": "This package integrates OpenLayers maps into an open pioneer trails application.",
6
6
  "keywords": [
7
7
  "open-pioneer-trails"
@@ -14,20 +14,20 @@
14
14
  "directory": "src/packages/map"
15
15
  },
16
16
  "dependencies": {
17
- "@chakra-ui/react": "^3.34.0",
18
- "@conterra/reactivity-core": "^0.8.2",
19
- "@conterra/reactivity-events": "^0.8.2",
17
+ "@chakra-ui/react": "^3.35.0",
18
+ "@conterra/reactivity-core": "^0.8.5",
19
+ "@conterra/reactivity-events": "^0.8.5",
20
20
  "@esri/arcgis-html-sanitizer": "^4.1.0",
21
- "@open-pioneer/core": "4.6.0-dev.20260420101935",
22
- "@open-pioneer/http": "4.6.0-dev.20260420101935",
23
- "@open-pioneer/react-utils": "4.6.0-dev.20260420101935",
24
- "@open-pioneer/reactivity": "4.6.0-dev.20260420101935",
25
- "@open-pioneer/runtime": "4.6.0-dev.20260420101935",
21
+ "@open-pioneer/core": "^4.6.0",
22
+ "@open-pioneer/http": "^4.6.0",
23
+ "@open-pioneer/react-utils": "^4.6.0",
24
+ "@open-pioneer/reactivity": "^4.6.0",
25
+ "@open-pioneer/runtime": "^4.6.0",
26
26
  "ol": "^10.9.0",
27
27
  "proj4": "^2.20.8",
28
- "react-dom": "^19.2.5",
28
+ "react-dom": "^19.2.6",
29
29
  "react-use": "^17.6.0",
30
- "react": "^19.2.5",
30
+ "react": "^19.2.6",
31
31
  "uuid": "^14.0.0"
32
32
  },
33
33
  "exports": {
@@ -106,6 +106,6 @@
106
106
  ]
107
107
  },
108
108
  "properties": [],
109
- "packageFormatVersion": "1.0.0"
109
+ "packageFormatVersion": "1.0.1"
110
110
  }
111
111
  }