@open-pioneer/map 0.0.0-dev-20241120114910

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/CHANGELOG.md +354 -0
  2. package/LICENSE +202 -0
  3. package/MapRegistryImpl.d.ts +17 -0
  4. package/MapRegistryImpl.js +91 -0
  5. package/MapRegistryImpl.js.map +1 -0
  6. package/README.md +871 -0
  7. package/_virtual/_virtual-pioneer-module_react-hooks.js +7 -0
  8. package/_virtual/_virtual-pioneer-module_react-hooks.js.map +1 -0
  9. package/api/BaseFeature.d.ts +31 -0
  10. package/api/MapConfig.d.ts +111 -0
  11. package/api/MapModel.d.ts +229 -0
  12. package/api/MapRegistry.d.ts +48 -0
  13. package/api/index.d.ts +15 -0
  14. package/api/layers/GroupLayer.d.ts +50 -0
  15. package/api/layers/GroupLayer.js +6 -0
  16. package/api/layers/GroupLayer.js.map +1 -0
  17. package/api/layers/SimpleLayer.d.ts +27 -0
  18. package/api/layers/SimpleLayer.js +6 -0
  19. package/api/layers/SimpleLayer.js.map +1 -0
  20. package/api/layers/WMSLayer.d.ts +57 -0
  21. package/api/layers/WMSLayer.js +6 -0
  22. package/api/layers/WMSLayer.js.map +1 -0
  23. package/api/layers/WMTSLayer.d.ts +33 -0
  24. package/api/layers/WMTSLayer.js +6 -0
  25. package/api/layers/WMTSLayer.js.map +1 -0
  26. package/api/layers/base.d.ts +242 -0
  27. package/api/layers/base.js +9 -0
  28. package/api/layers/base.js.map +1 -0
  29. package/api/layers/index.d.ts +5 -0
  30. package/api/shared.d.ts +10 -0
  31. package/assets/images/mapMarker.png +0 -0
  32. package/index.d.ts +1 -0
  33. package/index.js +15 -0
  34. package/index.js.map +1 -0
  35. package/internalTestSupport.d.ts +8 -0
  36. package/internalTestSupport.js +2 -0
  37. package/internalTestSupport.js.map +1 -0
  38. package/layers/BkgTopPlusOpen.d.ts +21 -0
  39. package/layers/BkgTopPlusOpen.js +61 -0
  40. package/layers/BkgTopPlusOpen.js.map +1 -0
  41. package/model/AbstractLayer.d.ts +25 -0
  42. package/model/AbstractLayer.js +186 -0
  43. package/model/AbstractLayer.js.map +1 -0
  44. package/model/AbstractLayerBase.d.ts +54 -0
  45. package/model/AbstractLayerBase.js +119 -0
  46. package/model/AbstractLayerBase.js.map +1 -0
  47. package/model/Highlights.d.ts +42 -0
  48. package/model/Highlights.js +272 -0
  49. package/model/Highlights.js.map +1 -0
  50. package/model/LayerCollectionImpl.d.ts +27 -0
  51. package/model/LayerCollectionImpl.js +228 -0
  52. package/model/LayerCollectionImpl.js.map +1 -0
  53. package/model/MapModelImpl.d.ts +46 -0
  54. package/model/MapModelImpl.js +271 -0
  55. package/model/MapModelImpl.js.map +1 -0
  56. package/model/SublayersCollectionImpl.d.ts +18 -0
  57. package/model/SublayersCollectionImpl.js +31 -0
  58. package/model/SublayersCollectionImpl.js.map +1 -0
  59. package/model/createMapModel.d.ts +4 -0
  60. package/model/createMapModel.js +157 -0
  61. package/model/createMapModel.js.map +1 -0
  62. package/model/layers/GroupLayerImpl.d.ts +39 -0
  63. package/model/layers/GroupLayerImpl.js +88 -0
  64. package/model/layers/GroupLayerImpl.js.map +1 -0
  65. package/model/layers/SimpleLayerImpl.d.ts +13 -0
  66. package/model/layers/SimpleLayerImpl.js +19 -0
  67. package/model/layers/SimpleLayerImpl.js.map +1 -0
  68. package/model/layers/WMSLayerImpl.d.ts +41 -0
  69. package/model/layers/WMSLayerImpl.js +297 -0
  70. package/model/layers/WMSLayerImpl.js.map +1 -0
  71. package/model/layers/WMTSLayerImpl.d.ts +17 -0
  72. package/model/layers/WMTSLayerImpl.js +156 -0
  73. package/model/layers/WMTSLayerImpl.js.map +1 -0
  74. package/package.json +86 -0
  75. package/projections.d.ts +27 -0
  76. package/projections.js +15 -0
  77. package/projections.js.map +1 -0
  78. package/services.d.ts +1 -0
  79. package/services.js +2 -0
  80. package/services.js.map +1 -0
  81. package/ui/CssProps.d.ts +9 -0
  82. package/ui/CssProps.js +13 -0
  83. package/ui/CssProps.js.map +1 -0
  84. package/ui/DefaultMapProvider.d.ts +39 -0
  85. package/ui/DefaultMapProvider.js +24 -0
  86. package/ui/DefaultMapProvider.js.map +1 -0
  87. package/ui/MapAnchor.d.ts +36 -0
  88. package/ui/MapAnchor.js +28 -0
  89. package/ui/MapAnchor.js.map +1 -0
  90. package/ui/MapContainer.d.ts +50 -0
  91. package/ui/MapContainer.js +191 -0
  92. package/ui/MapContainer.js.map +1 -0
  93. package/ui/MapContainerContext.d.ts +7 -0
  94. package/ui/MapContainerContext.js +17 -0
  95. package/ui/MapContainerContext.js.map +1 -0
  96. package/ui/computeMapAnchorStyles.d.ts +3 -0
  97. package/ui/computeMapAnchorStyles.js +51 -0
  98. package/ui/computeMapAnchorStyles.js.map +1 -0
  99. package/ui/hooks.d.ts +34 -0
  100. package/ui/hooks.js +73 -0
  101. package/ui/hooks.js.map +1 -0
  102. package/ui/styles.css +10 -0
  103. package/ui/styles.css.map +1 -0
  104. package/ui/useMapModel.d.ts +58 -0
  105. package/ui/useMapModel.js +59 -0
  106. package/ui/useMapModel.js.map +1 -0
  107. package/util/capabilities-utils.d.ts +2 -0
  108. package/util/capabilities-utils.js +11 -0
  109. package/util/capabilities-utils.js.map +1 -0
  110. package/util/geometry-utils.d.ts +7 -0
  111. package/util/geometry-utils.js +25 -0
  112. package/util/geometry-utils.js.map +1 -0
  113. package/util/ol-test-support.d.ts +2 -0
  114. package/util/ol-test-support.js +24 -0
  115. package/util/ol-test-support.js.map +1 -0
@@ -0,0 +1,7 @@
1
+ import { useServiceInternal } from '@open-pioneer/runtime/react-integration';
2
+
3
+ const PACKAGE_NAME = "@open-pioneer/map";
4
+ const useService = /*@__PURE__*/ useServiceInternal.bind(undefined, PACKAGE_NAME);
5
+
6
+ export { useService };
7
+ //# sourceMappingURL=_virtual-pioneer-module_react-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_virtual-pioneer-module_react-hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,31 @@
1
+ import { Geometry } from "ol/geom";
2
+ import { Style } from "ol/style";
3
+ /**
4
+ * Base interface for all feature objects with geometry and / or attribute information.
5
+ */
6
+ export interface BaseFeature {
7
+ /**
8
+ * Identifier for the feature object. Must be unique within all features of one source/layer.
9
+ *
10
+ * If your source cannot provide a useful id on its own, another strategy to generate unique ids is to
11
+ * generate a [UUID](https://www.npmjs.com/package/uuid#uuidv4options-buffer-offset) instead.
12
+ */
13
+ id: number | string;
14
+ /**
15
+ * Geometry of the feature.
16
+ * Also specify the {@link projection} if geometry is set.
17
+ */
18
+ geometry?: Geometry;
19
+ /**
20
+ * The projection of the {@link geometry}.
21
+ */
22
+ projection?: string;
23
+ /**
24
+ * Properties of the feature.
25
+ */
26
+ properties?: Readonly<Record<string, unknown>>;
27
+ /**
28
+ * Additional style information for displaying the feature on the map.
29
+ */
30
+ style?: Style;
31
+ }
@@ -0,0 +1,111 @@
1
+ import type { MapOptions as OlMapBaseOptions } from "ol/Map";
2
+ import type OlView from "ol/View";
3
+ import type { ViewOptions as OlViewOptions } from "ol/View";
4
+ import { Layer } from "./layers";
5
+ /**
6
+ * Configures an extent.
7
+ *
8
+ * Coordinates must be valid for the map's configured projection.
9
+ */
10
+ export interface ExtentConfig {
11
+ xMin: number;
12
+ yMin: number;
13
+ xMax: number;
14
+ yMax: number;
15
+ }
16
+ /**
17
+ * Configures a coordinate.
18
+ *
19
+ * Coordinates must be valid for the map's configured projection.
20
+ */
21
+ export interface CoordinateConfig {
22
+ x: number;
23
+ y: number;
24
+ z?: number;
25
+ }
26
+ /**
27
+ * Configures the map's initial extent.
28
+ */
29
+ export interface InitialExtentConfig {
30
+ kind: "extent";
31
+ extent: ExtentConfig;
32
+ }
33
+ /**
34
+ * Configures the map's initial position.
35
+ */
36
+ export interface InitialPositionConfig {
37
+ kind: "position";
38
+ center: CoordinateConfig;
39
+ zoom: number;
40
+ }
41
+ /**
42
+ * Configures the map's initial view.
43
+ */
44
+ export type InitialViewConfig = InitialExtentConfig | InitialPositionConfig;
45
+ /**
46
+ * Advanced options during map construction.
47
+ */
48
+ export interface OlMapOptions extends Omit<OlMapBaseOptions, "target" | "view"> {
49
+ /**
50
+ * Advanced options to control the view.
51
+ *
52
+ * We recommend using the `OlViewOptions` type.
53
+ *
54
+ * > Warning: When a fully constructed `OlView` instance is provided, some options
55
+ * > of {@link MapConfig} (such as `initialView` or `projection`) cannot be applied anymore.
56
+ */
57
+ view: OlView | OlViewOptions | Promise<OlViewOptions> | undefined;
58
+ }
59
+ /**
60
+ * Options supported during map construction.
61
+ */
62
+ export interface MapConfig {
63
+ /**
64
+ * Configures the initial view.
65
+ * This can be an extent, or a (center, zoom) value.
66
+ */
67
+ initialView?: InitialViewConfig;
68
+ /**
69
+ * Configures a specific projection, e.g. `"EPSG:4326"`.
70
+ * Defaults to `EPSG:3857`.
71
+ *
72
+ * To use custom projections, make sure that they are registered first:
73
+ *
74
+ * ```ts
75
+ * import { registerProjections } from "@open-pioneer/map";
76
+ *
77
+ * // Usually done at the top of the module.
78
+ * // This will register the projection(s) in proj4's global registry.
79
+ * registerProjections({
80
+ * "EPSG:31466": "+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +nadgrids=BETA2007.gsb +units=m +no_defs +type=crs",
81
+ * // ... more projections
82
+ * });
83
+ *
84
+ * // later, use projection: "EPSG:31466"
85
+ * ```
86
+ */
87
+ projection?: "EPSG:3857" | "EPSG:4326" | "EPSG:25832" | "EPSG:25833" | (string & {});
88
+ /**
89
+ * Configures the layers of the map.
90
+ *
91
+ * **Layer order**
92
+ *
93
+ * Layers defined in this array are (by default) displayed in their listed order:
94
+ * layers defined first are shown at the bottom, and layers defined at a later position
95
+ * are shown _above_ their predecessors.
96
+ *
97
+ * Note: base layers are always shown below all operational layers.
98
+ */
99
+ layers?: Layer[];
100
+ /**
101
+ * Advanced OpenLayers configuration.
102
+ *
103
+ * Options in this object are passed to the OlMap's constructor.
104
+ * Other properties defined in this configuration (e.g. {@link initialView})
105
+ * will be applied on top of these map options.
106
+ *
107
+ * > Warning: Not all properties here are supported.
108
+ * > For example, you cannot set the `target` because the target is controlled by the `<MapContainer />`.
109
+ */
110
+ advanced?: Partial<OlMapOptions>;
111
+ }
@@ -0,0 +1,229 @@
1
+ import type { EventSource, Resource } from "@open-pioneer/core";
2
+ import type OlMap from "ol/Map";
3
+ import type OlView from "ol/View";
4
+ import type OlBaseLayer from "ol/layer/Base";
5
+ import type { ExtentConfig } from "./MapConfig";
6
+ import type { AnyLayer, Layer } from "./layers";
7
+ import type { LayerRetrievalOptions } from "./shared";
8
+ import type { Geometry } from "ol/geom";
9
+ import type { BaseFeature } from "./BaseFeature";
10
+ import type { StyleLike } from "ol/style/Style";
11
+ import type { Projection } from "ol/proj";
12
+ import type { Coordinate } from "ol/coordinate";
13
+ /** Events emitted by the {@link MapModel}. */
14
+ export interface MapModelEvents {
15
+ "destroy": void;
16
+ }
17
+ /** Styleoptions supported when creating a new {@link Highlight}. */
18
+ export interface HighlightOptions {
19
+ /**
20
+ * Optional styles to override the default styles.
21
+ */
22
+ highlightStyle?: HighlightStyle;
23
+ }
24
+ /** Zoomoptions supported when creating a new {@link Highlight}. */
25
+ export interface ZoomOptions {
26
+ /**
27
+ * The zoom-level used if there is no valid extend (such as for single points).
28
+ */
29
+ pointZoom?: number;
30
+ /**
31
+ * The maximum zoom-level for multiple points, line or polygon results.
32
+ */
33
+ maxZoom?: number;
34
+ /**
35
+ * The view padding to make all features visible.
36
+ */
37
+ viewPadding?: MapPadding;
38
+ }
39
+ /** Options supported by the map model's {@link MapModel.highlightAndZoom | zoom | highlightAndZoom} method. */
40
+ export interface HighlightZoomOptions extends HighlightOptions, ZoomOptions {
41
+ }
42
+ /**
43
+ * Custom styles when creating a new {@link Highlight}.
44
+ */
45
+ export type HighlightStyle = {
46
+ Point?: StyleLike;
47
+ LineString?: StyleLike;
48
+ Polygon?: StyleLike;
49
+ MultiPolygon?: StyleLike;
50
+ MultiPoint?: StyleLike;
51
+ MultiLineString?: StyleLike;
52
+ };
53
+ /**
54
+ * Map padding, all values are pixels.
55
+ *
56
+ * See https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#padding
57
+ */
58
+ export interface MapPadding {
59
+ left?: number;
60
+ right?: number;
61
+ top?: number;
62
+ bottom?: number;
63
+ }
64
+ /**
65
+ * Represents the additional graphical representations of objects.
66
+ *
67
+ * See also {@link MapModel.highlight}.
68
+ */
69
+ export interface Highlight extends Resource {
70
+ readonly isActive: boolean;
71
+ }
72
+ /**
73
+ * Represents an object in the map.
74
+ */
75
+ export type DisplayTarget = BaseFeature | Geometry;
76
+ /**
77
+ * Represents a map.
78
+ */
79
+ export interface MapModel extends EventSource<MapModelEvents> {
80
+ /**
81
+ * The unique id of the map.
82
+ */
83
+ readonly id: string;
84
+ /**
85
+ * The container in which the map is currently being rendered.
86
+ * This is the same as the target element of the underlying OpenLayers map.
87
+ *
88
+ * May be undefined if the map is not being rendered at the moment.
89
+ * May change at runtime.
90
+ */
91
+ readonly container: HTMLElement | undefined;
92
+ /**
93
+ * The initial map extent.
94
+ *
95
+ * May be undefined before the map is shown.
96
+ * This is guaranteed to be initialized if the promise returned by {@link whenDisplayed} has resolved.
97
+ */
98
+ readonly initialExtent: ExtentConfig | undefined;
99
+ /**
100
+ * Contains all known layers of this map.
101
+ *
102
+ * Note that not all layers in this collection may be active in the OpenLayers map.
103
+ * Also note that not all layers in the OpenLayers map may be contained in this collection.
104
+ */
105
+ readonly layers: LayerCollection;
106
+ /**
107
+ * The raw OpenLayers map.
108
+ */
109
+ readonly olMap: OlMap;
110
+ /**
111
+ * Returns the current view of the OpenLayers map.
112
+ */
113
+ readonly olView: OlView;
114
+ /**
115
+ * Returns the current zoom level of the map.
116
+ * Same as `olView.getZoom()`, but reactive.
117
+ */
118
+ readonly zoomLevel: number | undefined;
119
+ /**
120
+ * Returns the current resolution of the map.
121
+ * Same as `olView.getResolution()`, but reactive.
122
+ */
123
+ readonly resolution: number | undefined;
124
+ /**
125
+ * Returns the current center of the map.
126
+ * Same as `olView.getCenter()`, but reactive.
127
+ */
128
+ readonly center: Coordinate | undefined;
129
+ /**
130
+ * Returns the current projection of the map (reactive).
131
+ */
132
+ readonly projection: Projection;
133
+ /**
134
+ * Returns the current scale of the map.
135
+ *
136
+ * Technically, this is the _denominator_ of the current scale.
137
+ * In order to display it, use a format like `1:${scale}`.
138
+ */
139
+ readonly scale: number | undefined;
140
+ /**
141
+ * Changes the current scale of the map to the given value.
142
+ *
143
+ * Internally, this computes a new zoom level / resolution based on the scale
144
+ * and the current center.
145
+ * The new resolution is then applied to the current `olView`.
146
+ *
147
+ * See also {@link scale}.
148
+ */
149
+ setScale(newScale: number): void;
150
+ /**
151
+ * Returns a promise that resolves when the map has mounted in the DOM.
152
+ */
153
+ whenDisplayed(): Promise<void>;
154
+ /**
155
+ * Creates a highlight at the given targets.
156
+ *
157
+ * A highlight is a temporary graphic on the map that calls attention to a point or an area.
158
+ *
159
+ * Call `destroy()` on the returned highlight object to remove the highlight again.
160
+ */
161
+ highlight(geometries: DisplayTarget[], options?: HighlightOptions): Highlight;
162
+ /**
163
+ * Zooms to the given targets.
164
+ */
165
+ zoom(geometries: DisplayTarget[], options?: ZoomOptions): void;
166
+ /**
167
+ * Creates a highlight and zooms to the given targets.
168
+ *
169
+ * See also {@link highlight} and {@link zoom}.
170
+ */
171
+ highlightAndZoom(geometries: DisplayTarget[], options?: HighlightZoomOptions): Highlight;
172
+ /**
173
+ * Removes any existing highlights from the map.
174
+ */
175
+ removeHighlights(): void;
176
+ }
177
+ /**
178
+ * Contains the layers known to a {@link MapModel}.
179
+ */
180
+ export interface LayerCollection {
181
+ /**
182
+ * Returns all configured base layers.
183
+ */
184
+ getBaseLayers(): Layer[];
185
+ /**
186
+ * Returns the currently active base layer.
187
+ */
188
+ getActiveBaseLayer(): Layer | undefined;
189
+ /**
190
+ * Activates the base layer with the given id.
191
+ * `undefined` can be used to hide all base layers.
192
+ *
193
+ * The associated layer is made visible and all other base layers are hidden.
194
+ *
195
+ * Returns true if the given layer has been successfully activated.
196
+ */
197
+ activateBaseLayer(id: string | undefined): boolean;
198
+ /**
199
+ * Adds a new layer to the map.
200
+ *
201
+ * The new layer is automatically registered with this collection.
202
+ *
203
+ * NOTE: by default, the new layer will be shown on _top_ of all existing layers.
204
+ */
205
+ addLayer(layer: Layer): void;
206
+ /**
207
+ * Returns all operational layers.
208
+ */
209
+ getOperationalLayers(options?: LayerRetrievalOptions): Layer[];
210
+ /**
211
+ * Returns the layer identified by the `id` or undefined, if no such layer exists.
212
+ */
213
+ getLayerById(id: string): AnyLayer | undefined;
214
+ /**
215
+ * Returns all layers known to this collection.
216
+ */
217
+ getAllLayers(options?: LayerRetrievalOptions): Layer[];
218
+ /**
219
+ * Removes a layer identified by the `id` from the map.
220
+ *
221
+ * NOTE: The current implementation only supports removal of _top level_ layers.
222
+ */
223
+ removeLayerById(id: string): void;
224
+ /**
225
+ * Given a raw OpenLayers layer instance, returns the associated {@link Layer} - or undefined
226
+ * if the layer is unknown to this collection.
227
+ */
228
+ getLayerByRawInstance(olLayer: OlBaseLayer): Layer | undefined;
229
+ }
@@ -0,0 +1,48 @@
1
+ import type OlMap from "ol/Map";
2
+ import type { MapConfig } from "./MapConfig";
3
+ import type { MapModel } from "./MapModel";
4
+ import type { DeclaredService } from "@open-pioneer/runtime";
5
+ /**
6
+ * Provides access to registered map instances.
7
+ *
8
+ * Maps are identified by a unique id.
9
+ *
10
+ * Inject an instance of this service by referencing the interface name `"map.MapRegistry"`.
11
+ */
12
+ export interface MapRegistry extends DeclaredService<"map.MapRegistry"> {
13
+ /**
14
+ * Returns the map model associated with the given id.
15
+ * Returns undefined if there is no such model.
16
+ */
17
+ getMapModel(mapId: string): Promise<MapModel | undefined>;
18
+ /**
19
+ * Like {@link getMapModel}, but throws if no model exists for the given `mapId`.
20
+ */
21
+ expectMapModel(mapId: string): Promise<MapModel>;
22
+ /**
23
+ * Given a raw OpenLayers map instance, returns the associated {@link MapModel} - or undefined
24
+ * if the map is unknown to this registry.
25
+ *
26
+ * All OpenLayers maps created by this registry (e.g. via {@link MapConfigProvider}) have an associated map model.
27
+ */
28
+ getMapModelByRawInstance(olMap: OlMap): MapModel | undefined;
29
+ }
30
+ /**
31
+ * Provides an OpenLayers map configuration with a given map id.
32
+ *
33
+ * The implementor must also provide the interface name `"map.MapConfigProvider"`.
34
+ */
35
+ export interface MapConfigProvider {
36
+ /**
37
+ * Unique identifier of the map.
38
+ */
39
+ readonly mapId: string;
40
+ /**
41
+ * Returns the map configuration for this map.
42
+ *
43
+ * Called by the {@link MapRegistry} when the map is requested for the first time.
44
+ *
45
+ * See {@link MapConfig} for supported options.
46
+ */
47
+ getMapConfig(): Promise<MapConfig>;
48
+ }
package/api/index.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ export * from "./BaseFeature";
2
+ export * from "./MapConfig";
3
+ export * from "./MapModel";
4
+ export * from "./MapRegistry";
5
+ export * from "./layers";
6
+ export * from "./shared";
7
+ export { getProjection, registerProjections, type ProjectionDefinition } from "../projections";
8
+ export { BkgTopPlusOpen, type BkgTopPlusOpenProps } from "../layers/BkgTopPlusOpen";
9
+ export { useView, useProjection, useResolution, useCenter, useScale } from "../ui/hooks";
10
+ export { MapAnchor, type MapAnchorProps, type MapAnchorPosition } from "../ui/MapAnchor";
11
+ export { MapContainer, type MapContainerProps } from "../ui/MapContainer";
12
+ export { useMapModel, type UseMapModelResult, type UseMapModelLoading, type UseMapModelResolved, type UseMapModelRejected, type MapModelProps } from "../ui/useMapModel";
13
+ export { DefaultMapProvider } from "../ui/DefaultMapProvider";
14
+ export { calculateBufferedExtent } from "../util/geometry-utils";
15
+ export { TOPMOST_LAYER_Z } from "../model/LayerCollectionImpl";
@@ -0,0 +1,50 @@
1
+ import type { Group } from "ol/layer";
2
+ import type { LayerRetrievalOptions } from "../shared";
3
+ import type { ChildrenCollection, Layer, LayerBaseType, LayerConfig } from "./base";
4
+ /**
5
+ * Configuration options to construct a {@link GroupLayer}.
6
+ */
7
+ export interface GroupLayerConfig extends LayerConfig {
8
+ /**
9
+ * List of layers that belong to the new group layer.
10
+ *
11
+ * The group layer takes ownership of the given layers: they will be destroyed when the parent is destroyed.
12
+ * A layer must have a unique parent: it can only be added to the map or a single group layer.
13
+ */
14
+ layers: Layer[];
15
+ }
16
+ /**
17
+ * Represents a group of layers.
18
+ *
19
+ * A group layer contains a collection of {@link Layer} children.
20
+ * Groups can be nested to form a hierarchy.
21
+ */
22
+ export interface GroupLayer extends LayerBaseType {
23
+ readonly type: "group";
24
+ /**
25
+ * Layers contained in this group.
26
+ */
27
+ readonly layers: GroupLayerCollection;
28
+ /**
29
+ * Raw OpenLayers group instance.
30
+ *
31
+ * **Warning:** Do not manipulate the collection of layers in this group directly, changes are not synchronized!
32
+ */
33
+ readonly olLayer: Group;
34
+ readonly sublayers: undefined;
35
+ }
36
+ /**
37
+ * Contains {@link Layer} instances that belong to a {@link GroupLayer}
38
+ */
39
+ export interface GroupLayerCollection extends ChildrenCollection<Layer> {
40
+ /**
41
+ * Returns all layers in this collection
42
+ */
43
+ getLayers(options?: LayerRetrievalOptions): Layer[];
44
+ }
45
+ export interface GroupLayerConstructor {
46
+ prototype: GroupLayer;
47
+ /** Creates a new {@link GroupLayer}. */
48
+ new (config: GroupLayerConfig): GroupLayer;
49
+ }
50
+ export declare const GroupLayer: GroupLayerConstructor;
@@ -0,0 +1,6 @@
1
+ import { GroupLayerImpl } from '../../model/layers/GroupLayerImpl.js';
2
+
3
+ const GroupLayer = GroupLayerImpl;
4
+
5
+ export { GroupLayer };
6
+ //# sourceMappingURL=GroupLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupLayer.js","sources":["GroupLayer.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport type { Group } from \"ol/layer\";\nimport { GroupLayerImpl } from \"../../model/layers/GroupLayerImpl\";\nimport type { LayerRetrievalOptions } from \"../shared\";\nimport type { ChildrenCollection, Layer, LayerBaseType, LayerConfig } from \"./base\";\n\n/**\n * Configuration options to construct a {@link GroupLayer}.\n */\nexport interface GroupLayerConfig extends LayerConfig {\n /**\n * List of layers that belong to the new group layer.\n *\n * The group layer takes ownership of the given layers: they will be destroyed when the parent is destroyed.\n * A layer must have a unique parent: it can only be added to the map or a single group layer.\n */\n layers: Layer[];\n}\n\n/**\n * Represents a group of layers.\n *\n * A group layer contains a collection of {@link Layer} children.\n * Groups can be nested to form a hierarchy.\n */\nexport interface GroupLayer extends LayerBaseType {\n readonly type: \"group\";\n\n /**\n * Layers contained in this group.\n */\n readonly layers: GroupLayerCollection;\n\n /**\n * Raw OpenLayers group instance.\n *\n * **Warning:** Do not manipulate the collection of layers in this group directly, changes are not synchronized!\n */\n readonly olLayer: Group;\n\n readonly sublayers: undefined;\n}\n\n/**\n * Contains {@link Layer} instances that belong to a {@link GroupLayer}\n */\nexport interface GroupLayerCollection extends ChildrenCollection<Layer> {\n /**\n * Returns all layers in this collection\n */\n getLayers(options?: LayerRetrievalOptions): Layer[];\n}\n\nexport interface GroupLayerConstructor {\n prototype: GroupLayer;\n\n /** Creates a new {@link GroupLayer}. */\n new (config: GroupLayerConfig): GroupLayer;\n}\n\nexport const GroupLayer: GroupLayerConstructor = GroupLayerImpl;\n"],"names":[],"mappings":";;AA6DO,MAAM,UAAoC,GAAA;;;;"}
@@ -0,0 +1,27 @@
1
+ import type OlBaseLayer from "ol/layer/Base";
2
+ import { LayerConfig, LayerBaseType } from "./base";
3
+ /**
4
+ * Options to construct a simple layer.
5
+ *
6
+ * Simple layers are wrappers around a custom OpenLayers layer.
7
+ */
8
+ export interface SimpleLayerConfig extends LayerConfig {
9
+ /**
10
+ * The raw OpenLayers instance.
11
+ */
12
+ olLayer: OlBaseLayer;
13
+ }
14
+ /** Constructor for {@link SimpleLayer}. */
15
+ export interface SimpleLayerConstructor {
16
+ prototype: SimpleLayer;
17
+ /** Creates a new {@link SimpleLayer}. */
18
+ new (config: SimpleLayerConfig): SimpleLayer;
19
+ }
20
+ /**
21
+ * A simple layer type wrapping an OpenLayers layer.
22
+ */
23
+ export interface SimpleLayer extends LayerBaseType {
24
+ readonly type: "simple";
25
+ readonly layers: undefined;
26
+ }
27
+ export declare const SimpleLayer: SimpleLayerConstructor;
@@ -0,0 +1,6 @@
1
+ import { SimpleLayerImpl } from '../../model/layers/SimpleLayerImpl.js';
2
+
3
+ const SimpleLayer = SimpleLayerImpl;
4
+
5
+ export { SimpleLayer };
6
+ //# sourceMappingURL=SimpleLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleLayer.js","sources":["SimpleLayer.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport type OlBaseLayer from \"ol/layer/Base\";\nimport { LayerConfig, LayerBaseType } from \"./base\";\nimport { SimpleLayerImpl } from \"../../model/layers/SimpleLayerImpl\";\n\n/**\n * Options to construct a simple layer.\n *\n * Simple layers are wrappers around a custom OpenLayers layer.\n */\nexport interface SimpleLayerConfig extends LayerConfig {\n /**\n * The raw OpenLayers instance.\n */\n olLayer: OlBaseLayer;\n}\n\n/** Constructor for {@link SimpleLayer}. */\nexport interface SimpleLayerConstructor {\n prototype: SimpleLayer;\n\n /** Creates a new {@link SimpleLayer}. */\n new (config: SimpleLayerConfig): SimpleLayer;\n}\n\n/**\n * A simple layer type wrapping an OpenLayers layer.\n */\nexport interface SimpleLayer extends LayerBaseType {\n readonly type: \"simple\";\n\n readonly layers: undefined;\n}\n\nexport const SimpleLayer: SimpleLayerConstructor = SimpleLayerImpl;\n"],"names":[],"mappings":";;AAmCO,MAAM,WAAsC,GAAA;;;;"}
@@ -0,0 +1,57 @@
1
+ import type { Options as WMSSourceOptions } from "ol/source/ImageWMS";
2
+ import type { LayerBaseConfig, SublayersCollection, LayerConfig, LayerBaseType, SublayerBaseType } from "./base";
3
+ /**
4
+ * Configuration options to construct a WMS layer.
5
+ */
6
+ export interface WMSLayerConfig extends LayerConfig {
7
+ /** URL of the WMS service. */
8
+ url: string;
9
+ /** Configures the layer's sublayers. */
10
+ sublayers?: WMSSublayerConfig[];
11
+ /**
12
+ * Additional source options for the layer's WMS source.
13
+ *
14
+ * NOTE: These options are intended for advanced configuration:
15
+ * the WMS Layer manages some of the OpenLayers source options itself.
16
+ */
17
+ sourceOptions?: Partial<WMSSourceOptions>;
18
+ }
19
+ /**
20
+ * Configuration options to construct the sublayers of a WMS layer.
21
+ */
22
+ export interface WMSSublayerConfig extends LayerBaseConfig {
23
+ /**
24
+ * The name of the WMS sublayer in the service's capabilities.
25
+ * Not mandatory, e.g. for WMS group layer. See [WMS spec](https://www.ogc.org/standard/wms/).
26
+ */
27
+ name?: string;
28
+ /** Configuration for nested sublayers. */
29
+ sublayers?: WMSSublayerConfig[];
30
+ }
31
+ /** Represents a WMS layer. */
32
+ export interface WMSLayer extends LayerBaseType {
33
+ readonly type: "wms";
34
+ readonly sublayers: SublayersCollection<WMSSublayer>;
35
+ readonly layers: undefined;
36
+ /** The URL of the WMS service that was used during layer construction. */
37
+ readonly url: string;
38
+ }
39
+ /** Represents a WMS sublayer */
40
+ export interface WMSSublayer extends SublayerBaseType {
41
+ readonly type: "wms-sublayer";
42
+ /**
43
+ * The name of the WMS sublayer in the service's capabilities.
44
+ *
45
+ * Is optional as a WMS group layer in a WMS service does not need to have a name.
46
+ */
47
+ readonly name: string | undefined;
48
+ }
49
+ /**
50
+ * Constructor for {@link WMSLayer}.
51
+ */
52
+ export interface WMSLayerConstructor {
53
+ prototype: WMSLayer;
54
+ /** Creates a new {@link WMSLayer}. */
55
+ new (config: WMSLayerConfig): WMSLayer;
56
+ }
57
+ export declare const WMSLayer: WMSLayerConstructor;
@@ -0,0 +1,6 @@
1
+ import { WMSLayerImpl } from '../../model/layers/WMSLayerImpl.js';
2
+
3
+ const WMSLayer = WMSLayerImpl;
4
+
5
+ export { WMSLayer };
6
+ //# sourceMappingURL=WMSLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WMSLayer.js","sources":["WMSLayer.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport type { Options as WMSSourceOptions } from \"ol/source/ImageWMS\";\nimport { WMSLayerImpl } from \"../../model/layers/WMSLayerImpl\";\nimport type {\n LayerBaseConfig,\n SublayersCollection,\n LayerConfig,\n LayerBaseType,\n SublayerBaseType\n} from \"./base\";\n\n/**\n * Configuration options to construct a WMS layer.\n */\nexport interface WMSLayerConfig extends LayerConfig {\n /** URL of the WMS service. */\n url: string;\n\n /** Configures the layer's sublayers. */\n sublayers?: WMSSublayerConfig[];\n\n /**\n * Additional source options for the layer's WMS source.\n *\n * NOTE: These options are intended for advanced configuration:\n * the WMS Layer manages some of the OpenLayers source options itself.\n */\n sourceOptions?: Partial<WMSSourceOptions>;\n}\n\n/**\n * Configuration options to construct the sublayers of a WMS layer.\n */\nexport interface WMSSublayerConfig extends LayerBaseConfig {\n /**\n * The name of the WMS sublayer in the service's capabilities.\n * Not mandatory, e.g. for WMS group layer. See [WMS spec](https://www.ogc.org/standard/wms/).\n */\n name?: string;\n\n /** Configuration for nested sublayers. */\n sublayers?: WMSSublayerConfig[];\n}\n\n/** Represents a WMS layer. */\nexport interface WMSLayer extends LayerBaseType {\n readonly type: \"wms\";\n\n readonly sublayers: SublayersCollection<WMSSublayer>;\n readonly layers: undefined;\n\n /** The URL of the WMS service that was used during layer construction. */\n readonly url: string;\n}\n\n/** Represents a WMS sublayer */\nexport interface WMSSublayer extends SublayerBaseType {\n readonly type: \"wms-sublayer\";\n /**\n * The name of the WMS sublayer in the service's capabilities.\n *\n * Is optional as a WMS group layer in a WMS service does not need to have a name.\n */\n readonly name: string | undefined;\n}\n\n/**\n * Constructor for {@link WMSLayer}.\n */\nexport interface WMSLayerConstructor {\n prototype: WMSLayer;\n\n /** Creates a new {@link WMSLayer}. */\n new (config: WMSLayerConfig): WMSLayer;\n}\n\nexport const WMSLayer: WMSLayerConstructor = WMSLayerImpl;\n"],"names":[],"mappings":";;AA6EO,MAAM,QAAgC,GAAA;;;;"}
@@ -0,0 +1,33 @@
1
+ import type { Options as WMSSourceOptions } from "ol/source/ImageWMS";
2
+ import { LayerBaseType, LayerConfig } from "./base";
3
+ export interface WMTSLayerConfig extends LayerConfig {
4
+ /** URL of the WMTS service. */
5
+ url: string;
6
+ /** The name of the WMTS layer in the service's capabilities. */
7
+ name: string;
8
+ /** The name of the tile matrix set in the service's capabilities. */
9
+ matrixSet: string;
10
+ /**
11
+ * Additional source options for the layer's WMTS source.
12
+ *
13
+ * NOTE: These options are intended for advanced configuration:
14
+ * the WMTS Layer manages some of the OpenLayers source options itself.
15
+ */
16
+ sourceOptions?: Partial<WMSSourceOptions>;
17
+ }
18
+ export interface WMTSLayer extends LayerBaseType {
19
+ readonly type: "wmts";
20
+ /** URL of the WMTS service. */
21
+ readonly url: string;
22
+ /** The name of the WMTS layer in the service's capabilities. */
23
+ readonly name: string;
24
+ /** The name of the tile matrix set in the service's capabilities. */
25
+ readonly matrixSet: string;
26
+ readonly layers: undefined;
27
+ }
28
+ export interface WMTSLayerConstructor {
29
+ prototype: WMTSLayer;
30
+ /** Creates a new {@link WMTSLayer}. */
31
+ new (config: WMTSLayerConfig): WMTSLayer;
32
+ }
33
+ export declare const WMTSLayer: WMTSLayerConstructor;
@@ -0,0 +1,6 @@
1
+ import { WMTSLayerImpl } from '../../model/layers/WMTSLayerImpl.js';
2
+
3
+ const WMTSLayer = WMTSLayerImpl;
4
+
5
+ export { WMTSLayer };
6
+ //# sourceMappingURL=WMTSLayer.js.map