@xgis/xgis2d 0.3.23

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Republic of Estonia Land and Spatial Development Board
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # @xgis/xgis2d
2
+
3
+ OpenLayers 2D map engine for XGIS3D. Renders the map, implements engine capabilities, and reconciles
4
+ layers from the shared stores. It is not a standalone map — it is loaded by
5
+ [`@xgis/xgis`](../xgis/README.md) when `mapMode` is `'2d'` or `'both'`.
6
+
7
+ Part of the [XGIS3D monorepo](../../README.md).
8
+
9
+ ## Do not import this directly
10
+
11
+ Consumers call `mountXgis()` and set `mapMode`; the host loads this package on demand
12
+ ([ADR-0001](../../docs/decisions/0001-host-centric-mount-over-standalone-remotes.md)). Importing
13
+ `Map2D` yourself bypasses the adapter registration and coordinator wiring, and the map will not
14
+ respond to store changes.
15
+
16
+ ```bash
17
+ pnpm add @xgis/xgis2d
18
+ ```
19
+
20
+ Install it so the host can resolve it — then forget about it.
21
+
22
+ ## How it fits
23
+
24
+ ```
25
+ mapViewStore / layerStore / basemapStore (@xgis/xgis-common)
26
+ │
27
+ coordinators
28
+ │
29
+ Map2D ──registers──► MapAdapter
30
+ │
31
+ ol.Map (OpenLayers)
32
+ ```
33
+
34
+ `Map2D` builds the OpenLayers map, wraps its native APIs in capability implementations, and hands
35
+ the engine to the host through `onEngineReady`. From then on the engine is driven entirely through
36
+ the stores — nothing outside this package touches an `ol/*` API.
37
+
38
+ ## What lives here
39
+
40
+ | Path | Description |
41
+ | -------------------- | -------------------------------------------------------------------------- |
42
+ | `Map2D.tsx` | The React component; creates `ol.Map`, registers the engine, tears it down |
43
+ | `capabilities/` | `olCamera` — `ICameraCapability` against an OpenLayers `View` |
44
+ | `reconcilers/` | Shallow-diff store state onto OL layer collections; batch and skip no-ops |
45
+ | `useOlUserMarker.ts` | Geolocation marker overlay |
46
+
47
+ The view projection is **EPSG:3301**, registered with proj4 on this package's own proj4 instance.
48
+
49
+ ## Dependency policy
50
+
51
+ `ol` and `proj4` are **exact-pinned dependencies**, not peers. This package defines which OpenLayers
52
+ version XGIS runs on; a consumer floating that version is how the map breaks. If you need a
53
+ different OpenLayers, the change belongs here.
54
+
55
+ ## Licensing note
56
+
57
+ Nothing third-party is bundled into this package — `vite.lib.config.ts` externalises every bare
58
+ specifier, so OpenLayers reaches you as its own npm package under BSD-2-Clause.
59
+
60
+ Worth knowing when you build a deployable bundle: unlike CesiumJS, OpenLayers' `LICENSE.md` carries
61
+ no third-party section, while its own runtime graph includes `pbf` (BSD-3-Clause, Mapbox) and
62
+ `earcut` (ISC, Mapbox). Reproducing the OpenLayers licence alone does not cover those two — an
63
+ application bundling this engine redistributes them and needs their notices as well. Generate them
64
+ from the resolved tree (`pnpm licenses list --prod`) rather than maintaining a list by hand.
65
+
66
+ ## Docs
67
+
68
+ - [Architecture overview](../../docs/architecture.md) — layer pipeline is section 8
69
+ - [Developer guide](../../docs/developer-guide.md) — engine and capability system, sections 7–8
70
+ - [ADRs](../../docs/decisions/)
71
+
72
+ ## License
73
+
74
+ MIT — see [LICENSE](./LICENSE).
@@ -0,0 +1,7 @@
1
+ import 'ol/ol.css';
2
+ import type { EngineRegistration, IMapEngine } from '@xgis/xgis-common';
3
+ interface Map2DProps {
4
+ onEngineReady: (engine: IMapEngine) => EngineRegistration;
5
+ }
6
+ export declare function Map2D({ onEngineReady }: Map2DProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { ICameraCapability } from '@xgis/xgis-common';
2
+ import type OlMap from 'ol/Map';
3
+ export declare function createOlCameraCapability(olMap: OlMap): ICameraCapability;
@@ -0,0 +1,3 @@
1
+ import type { IViewLimitsCapability } from '@xgis/xgis-common';
2
+ import type OlMap from 'ol/Map';
3
+ export declare function createOlViewLimitsCapability(olMap: OlMap): IViewLimitsCapability;
@@ -0,0 +1,15 @@
1
+ import type { Extent3301, Radians, ZoomLevel } from '@xgis/xgis-common';
2
+ import OlView from 'ol/View';
3
+ export declare const ESTONIA_EXTENT: Extent3301;
4
+ export interface MapViewDefaults {
5
+ readonly bbox: Extent3301;
6
+ readonly zoom: ZoomLevel;
7
+ readonly rotation: Radians;
8
+ }
9
+ /** The first View of a session. */
10
+ export declare function createMapView(bounds: Extent3301 | null, defaults: MapViewDefaults): OlView;
11
+ /**
12
+ * A View's extent is fixed at construction, so a new area means a new View carrying the old one's
13
+ * position. Resolution rather than zoom: zoom is undefined between grid levels, resolution is not.
14
+ */
15
+ export declare function reboundView(bounds: Extent3301 | null, previous: OlView): OlView;
@@ -0,0 +1 @@
1
+ export { Map2D } from './Map2D';
package/dist/index.js ADDED
@@ -0,0 +1,695 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import 'ol/ol.css';
3
+ import { asExtent3301, CRS, MIN_ZOOM, LEST97_EXTENT, extentCenter, MAX_ZOOM, KML_LABEL_FONT, KML_LABEL_OUTLINE_COLOR, KML_LABEL_FILL_COLOR, KML_DEFAULT_COLOR, KML_LABEL_OUTLINE_PX, KML_LABEL_GAP_PX, KML_MARKER_SIZE_PX, ogcMapsQuery, ogcMapsMapUrl, parseTmsTileMap, tmsTileBase, tmsTileSuffix, tmsOrders, tmsResolutions, tmsRowFromTileY, kmlExtractStyles, useBasemapStore, useActiveBasemapPlan, useBasemapServiceError, toAlpha, useLayerStore, useMapViewStore, sameExtent, useUserMarkerStore, LEST97_PROJ4, createEngineErrorChannel } from '@xgis/xgis-common';
4
+ import { altShiftKeysOnly, mouseOnly, mouseActionButton, platformModifierKeyOnly } from 'ol/events/condition';
5
+ import { defaults } from 'ol/interaction/defaults';
6
+ import OlMap from 'ol/Map';
7
+ import { transform, get, transformExtent } from 'ol/proj';
8
+ import { register } from 'ol/proj/proj4';
9
+ import proj4 from 'proj4';
10
+ import { useRef, useEffect, useMemo } from 'react';
11
+ import OlView from 'ol/View';
12
+ import { FALSE } from 'ol/functions';
13
+ import PointerInteraction from 'ol/interaction/Pointer';
14
+ import { disable } from 'ol/rotationconstraint';
15
+ import TileLayer from 'ol/layer/Tile';
16
+ import { Vector, OGCMapTile, ImageTile, TileWMS as TileWMS$1 } from 'ol/source';
17
+ import KML from 'ol/format/KML.js';
18
+ import GeometryCollection from 'ol/geom/GeometryCollection';
19
+ import VectorLayer from 'ol/layer/Vector';
20
+ import { Text, Stroke, Fill, Style, Icon, Circle } from 'ol/style';
21
+ import ImageLayer from 'ol/layer/Image';
22
+ import OGCMap from 'ol/source/OGCMap';
23
+ import TileGrid from 'ol/tilegrid/TileGrid';
24
+ import TileWMS from 'ol/source/TileWMS';
25
+ import WMTSCapabilities from 'ol/format/WMTSCapabilities';
26
+ import WMTS, { optionsFromCapabilities } from 'ol/source/WMTS';
27
+ import WMTSTileGrid from 'ol/tilegrid/WMTS';
28
+ import Feature from 'ol/Feature';
29
+ import Point from 'ol/geom/Point';
30
+ import VectorSource from 'ol/source/Vector';
31
+
32
+ const LIVE_EMIT_THROTTLE_MS = 30;
33
+ function createOlCameraCapability(olMap) {
34
+ const view = () => olMap.getView();
35
+ const listeners = /* @__PURE__ */ new Set();
36
+ const rotationListeners = /* @__PURE__ */ new Set();
37
+ function fireChange() {
38
+ const zoom = view().getZoom();
39
+ const change = {
40
+ bbox: asExtent3301(view().calculateExtent()),
41
+ rotation: view().getRotation()
42
+ };
43
+ if (zoom !== void 0) {
44
+ change.zoom = zoom;
45
+ }
46
+ listeners.forEach((cb) => cb(change));
47
+ }
48
+ olMap.on("moveend", fireChange);
49
+ let lastLiveEmit = 0;
50
+ let trailingTimer = null;
51
+ function emitLiveIfInteracting() {
52
+ if (!view().getInteracting()) {
53
+ return;
54
+ }
55
+ fireChange();
56
+ }
57
+ function onViewChangeThrottled() {
58
+ const elapsed = Date.now() - lastLiveEmit;
59
+ if (elapsed >= LIVE_EMIT_THROTTLE_MS) {
60
+ lastLiveEmit = Date.now();
61
+ emitLiveIfInteracting();
62
+ return;
63
+ }
64
+ if (trailingTimer === null) {
65
+ trailingTimer = setTimeout(() => {
66
+ trailingTimer = null;
67
+ lastLiveEmit = Date.now();
68
+ emitLiveIfInteracting();
69
+ }, LIVE_EMIT_THROTTLE_MS - elapsed);
70
+ }
71
+ }
72
+ function fireRotation() {
73
+ const rotation = view().getRotation();
74
+ rotationListeners.forEach((cb) => cb(rotation));
75
+ }
76
+ function bindView(target) {
77
+ target.on("propertychange", onViewChangeThrottled);
78
+ target.on("change:rotation", fireRotation);
79
+ }
80
+ let boundView = view();
81
+ bindView(boundView);
82
+ olMap.on("change:view", () => {
83
+ boundView.un("propertychange", onViewChangeThrottled);
84
+ boundView.un("change:rotation", fireRotation);
85
+ boundView = view();
86
+ bindView(boundView);
87
+ });
88
+ return {
89
+ flyTo(extent) {
90
+ view().fit(extent, { duration: 500 });
91
+ },
92
+ fitExtent(extent) {
93
+ view().fit(extent, { duration: 0 });
94
+ },
95
+ setExtent(extent) {
96
+ view().fit(extent, { duration: 0 });
97
+ },
98
+ setZoom(zoom) {
99
+ view().setZoom(zoom);
100
+ },
101
+ setRotation(rotation) {
102
+ view().setRotation(rotation);
103
+ },
104
+ setPitch() {
105
+ },
106
+ zoomTo(coord, zoom) {
107
+ view().setCenter(coord);
108
+ view().setZoom(zoom);
109
+ },
110
+ flyToPosition(position, zoom) {
111
+ const center = transform([position.lon, position.lat], CRS.WGS84, CRS.LEST97);
112
+ view().animate({ center, zoom, duration: 500 });
113
+ },
114
+ getCenter() {
115
+ const center = view().getCenter();
116
+ return [center[0], center[1]];
117
+ },
118
+ getBbox() {
119
+ return asExtent3301(view().calculateExtent());
120
+ },
121
+ onViewChange(callback) {
122
+ listeners.add(callback);
123
+ return () => {
124
+ listeners.delete(callback);
125
+ };
126
+ },
127
+ onRotationChange(callback) {
128
+ rotationListeners.add(callback);
129
+ return () => {
130
+ rotationListeners.delete(callback);
131
+ };
132
+ }
133
+ };
134
+ }
135
+
136
+ function createOlViewLimitsCapability(olMap) {
137
+ return {
138
+ // `bounds` is unread: the live View already holds it as its extent, and asking OL folds in the
139
+ // rotation and window size that restating the formula here would miss. The View is replaced a
140
+ // beat after the topic changes, so this can read the outgoing topic's limit for one render.
141
+ getZoomFloor(_bounds) {
142
+ return olMap.getView().getConstrainedZoom(MIN_ZOOM) ?? MIN_ZOOM;
143
+ }
144
+ };
145
+ }
146
+
147
+ const ESTONIA_EXTENT = LEST97_EXTENT;
148
+ function buildView(bounds, seed) {
149
+ return new OlView({
150
+ projection: CRS.LEST97,
151
+ center: seed.center,
152
+ resolution: seed.resolution,
153
+ zoom: seed.zoom,
154
+ rotation: seed.rotation,
155
+ extent: bounds ?? ESTONIA_EXTENT,
156
+ constrainOnlyCenter: false,
157
+ showFullExtent: true,
158
+ smoothExtentConstraint: false,
159
+ smoothResolutionConstraint: false,
160
+ minZoom: MIN_ZOOM,
161
+ maxZoom: MAX_ZOOM
162
+ });
163
+ }
164
+ function createMapView(bounds, defaults) {
165
+ return buildView(bounds, {
166
+ center: extentCenter(defaults.bbox),
167
+ resolution: void 0,
168
+ zoom: defaults.zoom,
169
+ rotation: defaults.rotation
170
+ });
171
+ }
172
+ function reboundView(bounds, previous) {
173
+ return buildView(bounds, {
174
+ center: previous.getCenter(),
175
+ resolution: previous.getResolution(),
176
+ zoom: void 0,
177
+ rotation: previous.getRotation()
178
+ });
179
+ }
180
+
181
+ function middleMouseButton(mapBrowserEvent) {
182
+ const originalEvent = mapBrowserEvent.originalEvent;
183
+ return "pointerId" in originalEvent && originalEvent.button === 1;
184
+ }
185
+ const ANCHOR_DRIFT_TOLERANCE_PX = 0.5;
186
+ class CursorDragRotate extends PointerInteraction {
187
+ condition;
188
+ duration;
189
+ rotateRate;
190
+ anchor;
191
+ // The pixel `anchor` should stay pinned at, not the cursor's own (freely moving) pixel.
192
+ anchorPixel;
193
+ lastPixel;
194
+ constructor(options = {}) {
195
+ super({
196
+ stopDown: FALSE
197
+ });
198
+ this.condition = options.condition ?? altShiftKeysOnly;
199
+ this.duration = options.duration ?? 250;
200
+ this.rotateRate = options.rotateRate ?? 1.77;
201
+ }
202
+ handleDownEvent(mapBrowserEvent) {
203
+ if (!mouseOnly(mapBrowserEvent)) {
204
+ return false;
205
+ }
206
+ const leftDrag = mouseActionButton(mapBrowserEvent) && this.condition(mapBrowserEvent);
207
+ if (!leftDrag && !middleMouseButton(mapBrowserEvent)) {
208
+ return false;
209
+ }
210
+ const map = mapBrowserEvent.map;
211
+ const view = map.getView();
212
+ if (view.getConstraints().rotation === disable) {
213
+ return false;
214
+ }
215
+ view.beginInteraction();
216
+ this.anchor = mapBrowserEvent.coordinate;
217
+ this.lastPixel = [mapBrowserEvent.pixel[0], mapBrowserEvent.pixel[1]];
218
+ this.anchorPixel = this.lastPixel;
219
+ return true;
220
+ }
221
+ handleDragEvent(mapBrowserEvent) {
222
+ if (!mouseOnly(mapBrowserEvent)) {
223
+ return;
224
+ }
225
+ if (!this.anchor || !this.lastPixel || !this.anchorPixel) {
226
+ return;
227
+ }
228
+ const map = mapBrowserEvent.map;
229
+ const view = map.getView();
230
+ if (view.getConstraints().rotation === disable) {
231
+ return;
232
+ }
233
+ const size = map.getSize();
234
+ if (!size || size[0] <= 0) {
235
+ return;
236
+ }
237
+ const pixel = mapBrowserEvent.pixel;
238
+ const currentPixel = [pixel[0], pixel[1]];
239
+ const horizontalPixelDelta = this.lastPixel[0] - currentPixel[0];
240
+ const windowRatio = horizontalPixelDelta / size[0];
241
+ const deltaRotation = this.rotateRate * windowRatio * Math.PI * 2;
242
+ view.adjustRotation(deltaRotation, this.anchor);
243
+ const projectedAnchorPixel = map.getPixelFromCoordinate(this.anchor);
244
+ const driftPx = projectedAnchorPixel ? Math.hypot(
245
+ projectedAnchorPixel[0] - this.anchorPixel[0],
246
+ projectedAnchorPixel[1] - this.anchorPixel[1]
247
+ ) : Infinity;
248
+ if (driftPx > ANCHOR_DRIFT_TOLERANCE_PX) {
249
+ const reanchored = map.getCoordinateFromPixel(currentPixel);
250
+ if (reanchored) {
251
+ this.anchor = reanchored;
252
+ this.anchorPixel = currentPixel;
253
+ }
254
+ }
255
+ this.lastPixel = currentPixel;
256
+ }
257
+ handleUpEvent(mapBrowserEvent) {
258
+ if (!mouseOnly(mapBrowserEvent)) {
259
+ return true;
260
+ }
261
+ const view = mapBrowserEvent.map.getView();
262
+ view.endInteraction(this.duration, 0, this.anchor);
263
+ this.anchor = void 0;
264
+ this.anchorPixel = void 0;
265
+ this.lastPixel = void 0;
266
+ return false;
267
+ }
268
+ }
269
+
270
+ const DEFAULT_LINE_THICKNESS = 1;
271
+ const MARKER_RADIUS = KML_MARKER_SIZE_PX / 2;
272
+ const LABEL_STROKE_WIDTH = KML_LABEL_OUTLINE_PX * 2;
273
+ function getStyle(params) {
274
+ const stroke = new Stroke({
275
+ color: params.lineColor ?? KML_DEFAULT_COLOR,
276
+ width: params.lineThickness ?? DEFAULT_LINE_THICKNESS
277
+ });
278
+ const fill = params.fillColor ? new Fill({ color: params.fillColor }) : void 0;
279
+ const image = params.symbol ? new Icon({ src: params.symbol }) : new Circle({
280
+ radius: MARKER_RADIUS,
281
+ fill: fill ?? new Fill({ color: params.lineColor ?? KML_DEFAULT_COLOR })
282
+ });
283
+ return new Style({ stroke, fill, image });
284
+ }
285
+ function placemarkName(feature) {
286
+ const name = feature.get("name");
287
+ return typeof name === "string" && name !== "" ? name : void 0;
288
+ }
289
+ function isPointLike(geometry) {
290
+ const type = geometry.getType();
291
+ return type === "Point" || type === "MultiPoint";
292
+ }
293
+ function labelGeometry(feature) {
294
+ const geometry = feature.getGeometry();
295
+ if (geometry instanceof GeometryCollection) {
296
+ return geometry.getGeometriesArrayRecursive().find(isPointLike);
297
+ }
298
+ if (!geometry) {
299
+ return void 0;
300
+ }
301
+ return isPointLike(geometry) ? geometry : void 0;
302
+ }
303
+ function labelOffsetX(image) {
304
+ const size = image?.getSize();
305
+ const scale = image?.getScaleArray();
306
+ if (!size || !scale) {
307
+ return MARKER_RADIUS + KML_LABEL_GAP_PX;
308
+ }
309
+ return size[0] * scale[0] / 2 + KML_LABEL_GAP_PX;
310
+ }
311
+ function createStyleFunction(params) {
312
+ const base = getStyle(params);
313
+ const image = base.getImage();
314
+ const text = new Text({
315
+ font: KML_LABEL_FONT,
316
+ fill: new Fill({ color: KML_LABEL_FILL_COLOR }),
317
+ stroke: new Stroke({ color: KML_LABEL_OUTLINE_COLOR, width: LABEL_STROKE_WIDTH }),
318
+ textAlign: "left"
319
+ });
320
+ const styles = [base, new Style({ text, geometry: labelGeometry })];
321
+ return (feature) => {
322
+ text.setText(placemarkName(feature));
323
+ text.setOffsetX(labelOffsetX(image));
324
+ return styles;
325
+ };
326
+ }
327
+ function createKML(params, extractStyles) {
328
+ const kmlFormat = new KML({ extractStyles });
329
+ const features = kmlFormat.readFeatures(params.objects, {
330
+ dataProjection: CRS.WGS84,
331
+ // official KML standard, don't change this
332
+ featureProjection: CRS.LEST97
333
+ });
334
+ const vector = new VectorLayer({
335
+ source: new Vector({
336
+ features
337
+ }),
338
+ style: extractStyles ? void 0 : createStyleFunction(params)
339
+ });
340
+ return vector;
341
+ }
342
+
343
+ function createOGCMaps(source, presentation) {
344
+ return new ImageLayer({
345
+ source: new OGCMap({
346
+ url: ogcMapsMapUrl(source),
347
+ params: ogcMapsQuery(source),
348
+ attributions: presentation.copyright
349
+ })
350
+ });
351
+ }
352
+
353
+ function createOGCTiles(source, presentation, tileset) {
354
+ return new TileLayer({
355
+ source: new OGCMapTile({
356
+ url: tileset.url,
357
+ mediaType: source.format,
358
+ attributions: presentation.copyright,
359
+ projection: CRS.LEST97
360
+ })
361
+ });
362
+ }
363
+
364
+ function tmsTileUrl(base, suffix, orders) {
365
+ return (z, x, y) => `${base}${orders[z]}/${x}/${tmsRowFromTileY(y)}${suffix}`;
366
+ }
367
+ function createTMS(source, presentation, capabilitiesText) {
368
+ const tileMap = parseTmsTileMap(capabilitiesText);
369
+ if (!tileMap) {
370
+ return null;
371
+ }
372
+ const sourceProjection = get(tileMap.srs);
373
+ if (!sourceProjection) {
374
+ return null;
375
+ }
376
+ const base = tmsTileBase(source.href);
377
+ const suffix = tmsTileSuffix(tileMap.extension);
378
+ const orders = tmsOrders(tileMap.tileSets);
379
+ return new TileLayer({
380
+ extent: transformExtent(tileMap.extent, sourceProjection, CRS.LEST97),
381
+ source: new ImageTile({
382
+ url: tmsTileUrl(base, suffix, orders),
383
+ projection: tileMap.srs,
384
+ tileGrid: new TileGrid({
385
+ extent: tileMap.extent,
386
+ origin: tileMap.origin,
387
+ resolutions: tmsResolutions(tileMap.tileSets),
388
+ tileSize: [tileMap.tileWidth, tileMap.tileHeight]
389
+ }),
390
+ attributions: presentation.copyright
391
+ })
392
+ });
393
+ }
394
+
395
+ function createWMS(source, presentation) {
396
+ return new TileLayer({
397
+ source: new TileWMS({
398
+ url: source.href,
399
+ params: {
400
+ LAYERS: source.layers.join(","),
401
+ FORMAT: source.format ?? "image/png",
402
+ ...source.version ? { VERSION: source.version } : {},
403
+ ...source.params
404
+ },
405
+ projection: CRS.LEST97,
406
+ attributions: presentation.copyright
407
+ })
408
+ });
409
+ }
410
+
411
+ function createWMTS(source, presentation, capabilitiesText) {
412
+ const capabilities = new WMTSCapabilities().read(capabilitiesText);
413
+ const options = optionsFromCapabilities(capabilities, {
414
+ layer: source.layer,
415
+ matrixSet: CRS.LEST97,
416
+ style: source.styles ?? "default"
417
+ });
418
+ if (!options) {
419
+ return null;
420
+ }
421
+ const url = `${source.href}/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}`;
422
+ return new TileLayer({
423
+ source: new WMTS({
424
+ url,
425
+ layer: source.layer,
426
+ style: options.style,
427
+ matrixSet: options.matrixSet,
428
+ projection: CRS.LEST97,
429
+ requestEncoding: "REST",
430
+ tileGrid: new WMTSTileGrid({
431
+ origin: options.tileGrid.getOrigin(0).reverse(),
432
+ resolutions: options.tileGrid.getResolutions(),
433
+ matrixIds: options.tileGrid.getMatrixIds()
434
+ }),
435
+ attributions: presentation.copyright
436
+ })
437
+ });
438
+ }
439
+
440
+ function createOlLayer(layer, projection = CRS.LEST97) {
441
+ switch (layer.type) {
442
+ case "wms":
443
+ return new TileLayer({
444
+ source: new TileWMS$1({
445
+ url: layer.url,
446
+ params: layer.params ?? {},
447
+ serverType: "mapserver",
448
+ projection
449
+ }),
450
+ opacity: layer.opacity,
451
+ zIndex: layer.zIndex
452
+ });
453
+ case "wmts":
454
+ return new TileLayer({
455
+ source: new TileWMS$1({
456
+ url: layer.url,
457
+ params: layer.params ?? {},
458
+ projection
459
+ }),
460
+ opacity: layer.opacity,
461
+ zIndex: layer.zIndex
462
+ });
463
+ default:
464
+ return null;
465
+ }
466
+ }
467
+ function createOlBaseLayer(entry) {
468
+ const { layer, capabilities, tileset } = entry;
469
+ const { source } = layer;
470
+ switch (source.kind) {
471
+ case "wms":
472
+ return createWMS(source, layer);
473
+ case "wmts":
474
+ return capabilities ? createWMTS(source, layer, capabilities) : null;
475
+ case "kml":
476
+ return createKML(source.params, kmlExtractStyles(source.params));
477
+ case "ogcMaps":
478
+ return createOGCMaps(source, layer);
479
+ case "ogcTiles":
480
+ return tileset ? createOGCTiles(source, layer, tileset) : null;
481
+ case "tms":
482
+ return capabilities ? createTMS(source, layer, capabilities) : null;
483
+ case "tileset3d":
484
+ return null;
485
+ default:
486
+ return source;
487
+ }
488
+ }
489
+
490
+ const LOAD_ERROR_EVENTS = ["tileloaderror", "imageloaderror"];
491
+ function watchLoadErrors(layer, onError) {
492
+ const source = layer.getSource();
493
+ if (!source) {
494
+ return () => {
495
+ };
496
+ }
497
+ for (const event of LOAD_ERROR_EVENTS) {
498
+ source.addEventListener(event, onError);
499
+ }
500
+ return () => {
501
+ for (const event of LOAD_ERROR_EVENTS) {
502
+ source.removeEventListener(event, onError);
503
+ }
504
+ };
505
+ }
506
+
507
+ function useOlBasemapReconciler(olMap) {
508
+ const basemapOpacity = useBasemapStore((s) => s.opacity2d);
509
+ const plan = useActiveBasemapPlan("2d");
510
+ const { entries, ready } = plan;
511
+ const reportServiceError = useBasemapServiceError("2d", plan);
512
+ const currentRef = useRef([]);
513
+ const opacityRef = useRef(basemapOpacity);
514
+ useEffect(() => {
515
+ opacityRef.current = basemapOpacity;
516
+ for (const layer of currentRef.current) {
517
+ layer.setOpacity(toAlpha(basemapOpacity));
518
+ }
519
+ }, [basemapOpacity]);
520
+ useEffect(() => {
521
+ if (!ready) {
522
+ return;
523
+ }
524
+ const created = [];
525
+ try {
526
+ for (const entry of entries) {
527
+ const native = createOlBaseLayer(entry);
528
+ if (native) {
529
+ created.push(native);
530
+ }
531
+ }
532
+ } catch (err) {
533
+ console.error(err);
534
+ return;
535
+ }
536
+ const detachListeners = created.map((native) => watchLoadErrors(native, reportServiceError));
537
+ const previous = currentRef.current;
538
+ currentRef.current = created;
539
+ for (const native of created) {
540
+ olMap.getLayers().insertAt(0, native);
541
+ native.setOpacity(toAlpha(opacityRef.current));
542
+ }
543
+ for (const layer of previous) {
544
+ olMap.removeLayer(layer);
545
+ layer.dispose();
546
+ }
547
+ return () => {
548
+ for (const detach of detachListeners) {
549
+ detach();
550
+ }
551
+ };
552
+ }, [olMap, entries, ready, reportServiceError]);
553
+ }
554
+
555
+ function useOlLayerReconciler(olMap) {
556
+ const layers = useLayerStore((s) => s.layers);
557
+ const nativeRef = useRef(/* @__PURE__ */ new Map());
558
+ const supported = layers.filter((l) => l.visible).filter((l) => !l.supportedEngines || l.supportedEngines.includes("2d"));
559
+ useEffect(() => {
560
+ const prev = nativeRef.current;
561
+ const next = /* @__PURE__ */ new Map();
562
+ for (const layer of supported) {
563
+ const existing = prev.get(layer.id);
564
+ if (existing) {
565
+ existing.setOpacity(layer.opacity);
566
+ existing.setZIndex(layer.zIndex);
567
+ next.set(layer.id, existing);
568
+ prev.delete(layer.id);
569
+ } else {
570
+ const native = createOlLayer(layer);
571
+ if (native) {
572
+ olMap.addLayer(native);
573
+ next.set(layer.id, native);
574
+ }
575
+ }
576
+ }
577
+ for (const [, orphan] of prev) {
578
+ olMap.removeLayer(orphan);
579
+ orphan.dispose();
580
+ }
581
+ nativeRef.current = next;
582
+ }, [olMap, supported]);
583
+ }
584
+
585
+ function viewExtentOf(view) {
586
+ const extent = view.get("extent");
587
+ return extent ? asExtent3301(extent) : null;
588
+ }
589
+ function useOlViewBounds(olMap) {
590
+ const constraintBbox = useMapViewStore((s) => s.constraintBbox);
591
+ useEffect(() => {
592
+ const view = olMap.getView();
593
+ if (sameExtent(constraintBbox ?? ESTONIA_EXTENT, viewExtentOf(view))) {
594
+ return;
595
+ }
596
+ const replacement = reboundView(constraintBbox, view);
597
+ olMap.setView(replacement);
598
+ const size = olMap.getSize();
599
+ if (size) {
600
+ replacement.setViewportSize(size);
601
+ }
602
+ }, [olMap, constraintBbox]);
603
+ }
604
+
605
+ const MARKER_STYLE = new Style({
606
+ image: new Circle({
607
+ radius: 8,
608
+ fill: new Fill({ color: "#2563EB" }),
609
+ stroke: new Stroke({ color: "#FFFFFF", width: 2 })
610
+ })
611
+ });
612
+ function useOlUserMarker(olMap) {
613
+ const marker = useUserMarkerStore((s) => s.marker);
614
+ const sourceRef = useRef(null);
615
+ useEffect(() => {
616
+ const source = new VectorSource();
617
+ const layer = new VectorLayer({ source, zIndex: 100, style: MARKER_STYLE });
618
+ sourceRef.current = source;
619
+ olMap.addLayer(layer);
620
+ return () => {
621
+ olMap.removeLayer(layer);
622
+ sourceRef.current = null;
623
+ };
624
+ }, [olMap]);
625
+ useEffect(() => {
626
+ const source = sourceRef.current;
627
+ if (!source) {
628
+ return;
629
+ }
630
+ source.clear();
631
+ if (marker !== null) {
632
+ const coords = transform([marker.lon, marker.lat], "EPSG:4326", "EPSG:3301");
633
+ source.addFeature(new Feature(new Point(coords)));
634
+ }
635
+ }, [marker]);
636
+ }
637
+
638
+ proj4.defs(CRS.LEST97, LEST97_PROJ4);
639
+ register(proj4);
640
+ get(CRS.LEST97).setExtent(ESTONIA_EXTENT);
641
+ function Map2D({ onEngineReady }) {
642
+ const mapRef = useRef(null);
643
+ const olMap = useMemo(() => {
644
+ const { bbox, zoom, rotation, constraintBbox } = useMapViewStore.getState();
645
+ return new OlMap({
646
+ controls: [],
647
+ interactions: defaults({ altShiftDragRotate: false }).extend([
648
+ new CursorDragRotate({ condition: platformModifierKeyOnly })
649
+ ]),
650
+ view: createMapView(constraintBbox, { bbox, zoom, rotation })
651
+ });
652
+ }, []);
653
+ useEffect(() => {
654
+ if (!mapRef.current) {
655
+ return;
656
+ }
657
+ olMap.setTarget(mapRef.current);
658
+ return () => olMap.setTarget(void 0);
659
+ }, [olMap]);
660
+ useEffect(() => {
661
+ const errorChannel = createEngineErrorChannel();
662
+ const engine = {
663
+ type: "2d",
664
+ capabilities: {
665
+ camera: createOlCameraCapability(olMap),
666
+ viewLimits: createOlViewLimitsCapability(olMap)
667
+ },
668
+ destroy() {
669
+ olMap.setTarget(void 0);
670
+ },
671
+ reportError: errorChannel.reportError,
672
+ onError: errorChannel.onError
673
+ };
674
+ const { unregister } = onEngineReady(engine);
675
+ return () => {
676
+ unregister();
677
+ };
678
+ }, [olMap, onEngineReady]);
679
+ useOlBasemapReconciler(olMap);
680
+ useOlLayerReconciler(olMap);
681
+ useOlViewBounds(olMap);
682
+ useOlUserMarker(olMap);
683
+ return /* @__PURE__ */ jsx(
684
+ "div",
685
+ {
686
+ ref: mapRef,
687
+ tabIndex: 0,
688
+ onClick: () => mapRef.current?.focus(),
689
+ style: { width: "100%", height: "100%" }
690
+ }
691
+ );
692
+ }
693
+
694
+ export { Map2D };
695
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/capabilities/olCamera.ts","../src/capabilities/olViewLimits.ts","../src/createMapView.ts","../src/interactions/cursorDragRotate.ts","../src/utils/createKMLLayer.ts","../src/utils/createOGCMapsLayer.ts","../src/utils/createOGCTilesLayer.ts","../src/utils/createTMSLayer.ts","../src/utils/createWMSLayer.ts","../src/utils/createWMTSLayer.ts","../src/utils/layerCreation.ts","../src/utils/layerLoadErrors.ts","../src/reconcilers/useOlBasemapReconciler.ts","../src/reconcilers/useOlLayerReconciler.ts","../src/reconcilers/useOlViewBounds.ts","../src/useOlUserMarker.ts","../src/Map2D.tsx"],"sourcesContent":["import type { ICameraCapability, ViewChange } from '@xgis/xgis-common'\nimport { asExtent3301, CRS } from '@xgis/xgis-common'\nimport type OlMap from 'ol/Map'\nimport { transform } from 'ol/proj'\nimport type OlView from 'ol/View'\n\n// Throttle for live (mid-gesture) view-change emits. OL `change` can fire several times per frame;\nconst LIVE_EMIT_THROTTLE_MS = 30\n\nexport function createOlCameraCapability(olMap: OlMap): ICameraCapability {\n // The View is replaced when the map's area changes, so resolve it per call rather than capture it.\n const view = (): OlView => olMap.getView()\n const listeners = new Set<(change: ViewChange) => void>()\n const rotationListeners = new Set<(rotation: number) => void>()\n\n // Pure reporter (ADR 0006): emit the settled view on `moveend` (one event per settle, not the\n // high-frequency view `change`) for every change, including the result of a programmatic\n // command. The coordinator owns loop-breaking, so the capability never suppresses its settles.\n function fireChange(): void {\n // Undefined until the view has a resolution at all. Omitted rather than reported as a bogus 0,\n // which would read as \"fully zoomed out\".\n const zoom = view().getZoom()\n\n const change: ViewChange = {\n bbox: asExtent3301(view().calculateExtent() as [number, number, number, number]),\n rotation: view().getRotation(),\n }\n\n if (zoom !== undefined) {\n change.zoom = zoom\n }\n\n listeners.forEach((cb) => cb(change))\n }\n\n olMap.on('moveend', fireChange)\n\n // Live reporting so the 3D camera tracks a 2D gesture instead of lagging until moveend.\n // `propertychange` fires each drag frame (the generic `change` only fires at interaction\n // begin/end). The getInteracting() gate skips programmatic mirror writes so they can't feed back;\n // throttled so a per-frame burst doesn't drive a setView per event on the other engine.\n let lastLiveEmit = 0\n let trailingTimer: ReturnType<typeof setTimeout> | null = null\n\n function emitLiveIfInteracting(): void {\n if (!view().getInteracting()) {\n return\n }\n\n fireChange()\n }\n\n function onViewChangeThrottled(): void {\n const elapsed = Date.now() - lastLiveEmit\n\n if (elapsed >= LIVE_EMIT_THROTTLE_MS) {\n lastLiveEmit = Date.now()\n emitLiveIfInteracting()\n return\n }\n\n if (trailingTimer === null) {\n trailingTimer = setTimeout(() => {\n trailingTimer = null\n lastLiveEmit = Date.now()\n emitLiveIfInteracting()\n }, LIVE_EMIT_THROTTLE_MS - elapsed)\n }\n }\n\n // change:rotation fires continuously while the user rotates (and on programmatic setRotation),\n // unlike moveend which only fires on settle. Kept on its own channel so the high-frequency\n // stream never reaches onViewChange/cameraSync (ADR 0006 keeps that pipeline on settles only).\n function fireRotation(): void {\n const rotation = view().getRotation()\n rotationListeners.forEach((cb) => cb(rotation))\n }\n\n function bindView(target: OlView): void {\n target.on('propertychange', onViewChangeThrottled)\n target.on('change:rotation', fireRotation)\n }\n\n let boundView = view()\n bindView(boundView)\n\n olMap.on('change:view', () => {\n boundView.un('propertychange', onViewChangeThrottled)\n boundView.un('change:rotation', fireRotation)\n boundView = view()\n bindView(boundView)\n })\n\n return {\n flyTo(extent) {\n view().fit(extent, { duration: 500 })\n },\n fitExtent(extent) {\n view().fit(extent, { duration: 0 })\n },\n setExtent(extent) {\n view().fit(extent, { duration: 0 })\n },\n setZoom(zoom) {\n view().setZoom(zoom)\n },\n setRotation(rotation) {\n view().setRotation(rotation)\n },\n setPitch() {\n // 2D is always top-down — no pitch concept.\n },\n zoomTo(coord, zoom) {\n view().setCenter(coord)\n view().setZoom(zoom)\n },\n flyToPosition(position, zoom) {\n const center = transform([position.lon, position.lat], CRS.WGS84, CRS.LEST97)\n view().animate({ center, zoom, duration: 500 })\n },\n getCenter() {\n const center = view().getCenter()!\n return [center[0], center[1]] as [number, number]\n },\n getBbox() {\n return asExtent3301(view().calculateExtent() as [number, number, number, number])\n },\n onViewChange(callback) {\n listeners.add(callback)\n return () => {\n listeners.delete(callback)\n }\n },\n onRotationChange(callback) {\n rotationListeners.add(callback)\n return () => {\n rotationListeners.delete(callback)\n }\n },\n }\n}\n","import type { IViewLimitsCapability } from '@xgis/xgis-common'\nimport { MIN_ZOOM } from '@xgis/xgis-common'\nimport type OlMap from 'ol/Map'\n\nexport function createOlViewLimitsCapability(olMap: OlMap): IViewLimitsCapability {\n return {\n // `bounds` is unread: the live View already holds it as its extent, and asking OL folds in the\n // rotation and window size that restating the formula here would miss. The View is replaced a\n // beat after the topic changes, so this can read the outgoing topic's limit for one render.\n getZoomFloor(_bounds) {\n return olMap.getView().getConstrainedZoom(MIN_ZOOM) ?? MIN_ZOOM\n },\n }\n}\n","import type { Extent3301, Radians, ZoomLevel } from '@xgis/xgis-common'\nimport { CRS, extentCenter, LEST97_EXTENT, MAX_ZOOM, MIN_ZOOM } from '@xgis/xgis-common'\nimport OlView from 'ol/View'\n\n// OL confines a view only through the View's own extent, never the projection's, so this stands in\n// until a topic supplies its area.\nexport const ESTONIA_EXTENT = LEST97_EXTENT\n\nexport interface MapViewDefaults {\n readonly bbox: Extent3301\n readonly zoom: ZoomLevel\n readonly rotation: Radians\n}\n\ninterface ViewSeed {\n readonly center: [number, number] | undefined\n readonly resolution: number | undefined\n readonly zoom: ZoomLevel | undefined\n readonly rotation: Radians\n}\n\n/**\n * `constrainOnlyCenter: false` bounds the whole viewport, `showFullExtent` keeps the topic\n * reachable, and the two smooth flags make the edge a wall instead of a rubber band.\n */\nfunction buildView(bounds: Extent3301 | null, seed: ViewSeed): OlView {\n return new OlView({\n projection: CRS.LEST97,\n center: seed.center,\n resolution: seed.resolution,\n zoom: seed.zoom,\n rotation: seed.rotation,\n extent: bounds ?? ESTONIA_EXTENT,\n constrainOnlyCenter: false,\n showFullExtent: true,\n smoothExtentConstraint: false,\n smoothResolutionConstraint: false,\n minZoom: MIN_ZOOM,\n maxZoom: MAX_ZOOM,\n })\n}\n\n/** The first View of a session. */\nexport function createMapView(bounds: Extent3301 | null, defaults: MapViewDefaults): OlView {\n return buildView(bounds, {\n center: extentCenter(defaults.bbox),\n resolution: undefined,\n zoom: defaults.zoom,\n rotation: defaults.rotation,\n })\n}\n\n/**\n * A View's extent is fixed at construction, so a new area means a new View carrying the old one's\n * position. Resolution rather than zoom: zoom is undefined between grid levels, resolution is not.\n */\nexport function reboundView(bounds: Extent3301 | null, previous: OlView): OlView {\n return buildView(bounds, {\n center: previous.getCenter() as [number, number] | undefined,\n resolution: previous.getResolution(),\n zoom: undefined,\n rotation: previous.getRotation() as Radians,\n })\n}\n","import type { Coordinate } from 'ol/coordinate'\nimport type { Condition } from 'ol/events/condition'\nimport { altShiftKeysOnly, mouseActionButton, mouseOnly } from 'ol/events/condition'\nimport { FALSE } from 'ol/functions'\nimport PointerInteraction from 'ol/interaction/Pointer'\nimport type MapBrowserEvent from 'ol/MapBrowserEvent'\nimport { disable } from 'ol/rotationconstraint'\n\nexport interface CursorDragRotateOptions {\n condition?: Condition\n duration?: number\n rotateRate?: number\n}\n\nfunction middleMouseButton(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean {\n const originalEvent = mapBrowserEvent.originalEvent\n return 'pointerId' in originalEvent && originalEvent.button === 1\n}\n\n// A bbox/extent constraint can refuse the centre shift the anchor needs (see ADR 0022); past this\n// tolerance, re-anchor instead of repeating a request the constraint will keep rejecting.\nconst ANCHOR_DRIFT_TOLERANCE_PX = 0.5\n\nexport class CursorDragRotate extends PointerInteraction {\n private readonly condition: Condition\n private readonly duration: number\n private readonly rotateRate: number\n\n private anchor: Coordinate | undefined\n // The pixel `anchor` should stay pinned at, not the cursor's own (freely moving) pixel.\n private anchorPixel: [number, number] | undefined\n private lastPixel: [number, number] | undefined\n\n constructor(options: CursorDragRotateOptions = {}) {\n super({\n stopDown: FALSE,\n })\n\n this.condition = options.condition ?? altShiftKeysOnly\n this.duration = options.duration ?? 250\n // Approximates Cesium's own rotate rate.\n this.rotateRate = options.rotateRate ?? 1.77\n }\n\n override handleDownEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean {\n if (!mouseOnly(mapBrowserEvent)) {\n return false\n }\n\n const leftDrag = mouseActionButton(mapBrowserEvent) && this.condition(mapBrowserEvent)\n if (!leftDrag && !middleMouseButton(mapBrowserEvent)) {\n return false\n }\n\n const map = mapBrowserEvent.map\n const view = map.getView()\n\n if (view.getConstraints().rotation === disable) {\n return false\n }\n\n view.beginInteraction()\n\n this.anchor = mapBrowserEvent.coordinate\n\n this.lastPixel = [mapBrowserEvent.pixel[0], mapBrowserEvent.pixel[1]]\n this.anchorPixel = this.lastPixel\n\n return true\n }\n\n override handleDragEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): void {\n if (!mouseOnly(mapBrowserEvent)) {\n return\n }\n\n if (!this.anchor || !this.lastPixel || !this.anchorPixel) {\n return\n }\n\n const map = mapBrowserEvent.map\n const view = map.getView()\n\n if (view.getConstraints().rotation === disable) {\n return\n }\n\n const size = map.getSize()\n\n if (!size || size[0] <= 0) {\n return\n }\n\n const pixel = mapBrowserEvent.pixel\n\n const currentPixel: [number, number] = [pixel[0], pixel[1]]\n\n const horizontalPixelDelta = this.lastPixel[0] - currentPixel[0]\n\n const windowRatio = horizontalPixelDelta / size[0]\n\n const deltaRotation = this.rotateRate * windowRatio * Math.PI * 2\n\n view.adjustRotation(deltaRotation, this.anchor)\n\n const projectedAnchorPixel = map.getPixelFromCoordinate(this.anchor)\n const driftPx = projectedAnchorPixel\n ? Math.hypot(\n projectedAnchorPixel[0] - this.anchorPixel[0],\n projectedAnchorPixel[1] - this.anchorPixel[1],\n )\n : Infinity\n if (driftPx > ANCHOR_DRIFT_TOLERANCE_PX) {\n const reanchored = map.getCoordinateFromPixel(currentPixel)\n if (reanchored) {\n this.anchor = reanchored\n this.anchorPixel = currentPixel\n }\n }\n\n this.lastPixel = currentPixel\n }\n\n override handleUpEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean {\n if (!mouseOnly(mapBrowserEvent)) {\n return true\n }\n\n const view = mapBrowserEvent.map.getView()\n\n view.endInteraction(this.duration, 0, this.anchor)\n\n this.anchor = undefined\n this.anchorPixel = undefined\n this.lastPixel = undefined\n\n return false\n }\n}\n","import {\n CRS,\n KML_DEFAULT_COLOR,\n KML_LABEL_FILL_COLOR,\n KML_LABEL_FONT,\n KML_LABEL_GAP_PX,\n KML_LABEL_OUTLINE_COLOR,\n KML_LABEL_OUTLINE_PX,\n KML_MARKER_SIZE_PX,\n KmlParams,\n} from '@xgis/xgis-common'\nimport type { FeatureLike } from 'ol/Feature'\nimport KML from 'ol/format/KML.js'\nimport type Geometry from 'ol/geom/Geometry'\nimport GeometryCollection from 'ol/geom/GeometryCollection'\nimport VectorLayer from 'ol/layer/Vector'\nimport type RenderFeature from 'ol/render/Feature'\nimport { Vector } from 'ol/source'\nimport { Circle, Fill, Icon, Stroke, Style, Text } from 'ol/style'\nimport type ImageStyle from 'ol/style/Image'\nimport type { StyleFunction } from 'ol/style/Style'\n\n// Only 2D sets a width unconditionally; Cesium leaves an unnamed width to its own default of 1.\nconst DEFAULT_LINE_THICKNESS = 1\n\nconst MARKER_RADIUS = KML_MARKER_SIZE_PX / 2\n\n// A canvas stroke straddles the glyph edge, so only half of it shows as outline.\nconst LABEL_STROKE_WIDTH = KML_LABEL_OUTLINE_PX * 2\n\nfunction getStyle(params: KmlParams): Style {\n const stroke = new Stroke({\n color: params.lineColor ?? KML_DEFAULT_COLOR,\n width: params.lineThickness ?? DEFAULT_LINE_THICKNESS,\n })\n\n const fill = params.fillColor ? new Fill({ color: params.fillColor }) : undefined\n\n const image = params.symbol\n ? new Icon({ src: params.symbol })\n : new Circle({\n radius: MARKER_RADIUS,\n fill: fill ?? new Fill({ color: params.lineColor ?? KML_DEFAULT_COLOR }),\n })\n\n return new Style({ stroke, fill, image })\n}\n\nfunction placemarkName(feature: FeatureLike): string | undefined {\n const name = feature.get('name')\n\n return typeof name === 'string' && name !== '' ? name : undefined\n}\n\nfunction isPointLike(geometry: Geometry | RenderFeature): boolean {\n const type = geometry.getType()\n\n return type === 'Point' || type === 'MultiPoint'\n}\n\n// Both engines label points and nothing else — OpenLayers clears the name for any other geometry\n// type, and Cesium builds a label only where it builds a billboard. Undefined here drops the label\n// style before it is rendered, so a named polygon needs no branch in the style function.\nfunction labelGeometry(feature: FeatureLike): Geometry | RenderFeature | undefined {\n const geometry = feature.getGeometry()\n\n if (geometry instanceof GeometryCollection) {\n return geometry.getGeometriesArrayRecursive().find(isPointLike)\n }\n\n if (!geometry) {\n return undefined\n }\n\n return isPointLike(geometry) ? geometry : undefined\n}\n\n// An icon reports no size until its image has loaded, which is why this is resolved per render\n// rather than baked into the style.\nfunction labelOffsetX(image: ImageStyle | null): number {\n const size = image?.getSize()\n const scale = image?.getScaleArray()\n\n if (!size || !scale) {\n return MARKER_RADIUS + KML_LABEL_GAP_PX\n }\n\n return (size[0] * scale[0]) / 2 + KML_LABEL_GAP_PX\n}\n\nfunction createStyleFunction(params: KmlParams): StyleFunction {\n const base = getStyle(params)\n const image = base.getImage()\n\n const text = new Text({\n font: KML_LABEL_FONT,\n fill: new Fill({ color: KML_LABEL_FILL_COLOR }),\n stroke: new Stroke({ color: KML_LABEL_OUTLINE_COLOR, width: LABEL_STROKE_WIDTH }),\n textAlign: 'left',\n })\n\n const styles = [base, new Style({ text, geometry: labelGeometry })]\n\n // OpenLayers serialises a returned style before it draws the next feature, so one text instance\n // carries every label rather than allocating a style per feature per frame.\n return (feature) => {\n text.setText(placemarkName(feature))\n text.setOffsetX(labelOffsetX(image))\n\n return styles\n }\n}\n\nexport function createKML(params: KmlParams, extractStyles: boolean): VectorLayer | null {\n const kmlFormat = new KML({ extractStyles })\n const features = kmlFormat.readFeatures(params.objects, {\n dataProjection: CRS.WGS84, // official KML standard, don't change this\n featureProjection: CRS.LEST97,\n })\n\n const vector = new VectorLayer({\n source: new Vector({\n features: features,\n }),\n style: extractStyles ? undefined : createStyleFunction(params),\n })\n\n return vector\n}\n","import type { LayerPresentation, OgcMapsSource } from '@xgis/xgis-common'\nimport { ogcMapsMapUrl, ogcMapsQuery } from '@xgis/xgis-common'\nimport ImageLayer from 'ol/layer/Image'\nimport OGCMap from 'ol/source/OGCMap'\n\nexport function createOGCMaps(\n source: OgcMapsSource,\n presentation: LayerPresentation,\n): ImageLayer<OGCMap> {\n return new ImageLayer({\n source: new OGCMap({\n url: ogcMapsMapUrl(source),\n params: ogcMapsQuery(source),\n attributions: presentation.copyright,\n }),\n })\n}\n","import {\n CRS,\n type LayerPresentation,\n type OgcTilesSource,\n type ResolvedOgcTileset,\n} from '@xgis/xgis-common'\nimport TileLayer from 'ol/layer/Tile'\nimport { OGCMapTile } from 'ol/source'\n\nexport function createOGCTiles(\n source: OgcTilesSource,\n presentation: LayerPresentation,\n tileset: ResolvedOgcTileset,\n): TileLayer {\n return new TileLayer({\n source: new OGCMapTile({\n url: tileset.url,\n mediaType: source.format,\n attributions: presentation.copyright,\n projection: CRS.LEST97,\n }),\n })\n}\n","import type { LayerPresentation, TmsSource } from '@xgis/xgis-common'\nimport {\n CRS,\n parseTmsTileMap,\n tmsOrders,\n tmsResolutions,\n tmsRowFromTileY,\n tmsTileBase,\n tmsTileSuffix,\n} from '@xgis/xgis-common'\nimport TileLayer from 'ol/layer/Tile'\nimport { get as getProjection, transformExtent } from 'ol/proj'\nimport { ImageTile } from 'ol/source'\nimport TileGrid from 'ol/tilegrid/TileGrid'\n\nfunction tmsTileUrl(base: string, suffix: string, orders: number[]) {\n return (z: number, x: number, y: number): string =>\n `${base}${orders[z]}/${x}/${tmsRowFromTileY(y)}${suffix}`\n}\n\nexport function createTMS(\n source: TmsSource,\n presentation: LayerPresentation,\n capabilitiesText: string,\n): TileLayer | null {\n const tileMap = parseTmsTileMap(capabilitiesText)\n if (!tileMap) {\n return null\n }\n\n const sourceProjection = getProjection(tileMap.srs)\n if (!sourceProjection) {\n return null\n }\n\n const base = tmsTileBase(source.href)\n const suffix = tmsTileSuffix(tileMap.extension)\n const orders = tmsOrders(tileMap.tileSets)\n\n return new TileLayer({\n extent: transformExtent(tileMap.extent, sourceProjection, CRS.LEST97),\n source: new ImageTile({\n url: tmsTileUrl(base, suffix, orders),\n projection: tileMap.srs,\n tileGrid: new TileGrid({\n extent: tileMap.extent,\n origin: tileMap.origin,\n resolutions: tmsResolutions(tileMap.tileSets),\n tileSize: [tileMap.tileWidth, tileMap.tileHeight],\n }),\n attributions: presentation.copyright,\n }),\n })\n}\n","import type { LayerPresentation, WmsSource } from '@xgis/xgis-common'\nimport { CRS } from '@xgis/xgis-common'\nimport TileLayer from 'ol/layer/Tile'\nimport TileWMS from 'ol/source/TileWMS'\n\nexport function createWMS(source: WmsSource, presentation: LayerPresentation): TileLayer {\n return new TileLayer({\n source: new TileWMS({\n url: source.href,\n params: {\n LAYERS: source.layers.join(','),\n FORMAT: source.format ?? 'image/png',\n ...(source.version ? { VERSION: source.version } : {}),\n ...source.params,\n },\n projection: CRS.LEST97,\n attributions: presentation.copyright,\n }),\n })\n}\n","import type { LayerPresentation, WmtsSource } from '@xgis/xgis-common'\nimport { CRS } from '@xgis/xgis-common'\nimport WMTSCapabilities from 'ol/format/WMTSCapabilities'\nimport TileLayer from 'ol/layer/Tile'\nimport WMTS, { optionsFromCapabilities } from 'ol/source/WMTS'\nimport WMTSTileGrid from 'ol/tilegrid/WMTS'\n\nexport function createWMTS(\n source: WmtsSource,\n presentation: LayerPresentation,\n capabilitiesText: string,\n): TileLayer | null {\n const capabilities = new WMTSCapabilities().read(capabilitiesText)\n const options = optionsFromCapabilities(capabilities, {\n layer: source.layer,\n matrixSet: CRS.LEST97,\n style: source.styles ?? 'default',\n })\n\n if (!options) {\n return null\n }\n\n const url = `${source.href}/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}`\n\n return new TileLayer({\n source: new WMTS({\n url,\n layer: source.layer,\n style: options.style,\n matrixSet: options.matrixSet,\n projection: CRS.LEST97,\n requestEncoding: 'REST',\n tileGrid: new WMTSTileGrid({\n origin: options.tileGrid.getOrigin(0).reverse(),\n resolutions: options.tileGrid.getResolutions(),\n matrixIds: options.tileGrid.getMatrixIds(),\n }),\n attributions: presentation.copyright,\n }),\n })\n}\n","import {\n type BasemapPlanEntry,\n CRS,\n type Crs,\n type ILayer,\n kmlExtractStyles,\n} from '@xgis/xgis-common'\nimport type OlBaseLayer from 'ol/layer/Base'\nimport type ImageLayer from 'ol/layer/Image'\nimport TileLayer from 'ol/layer/Tile'\nimport VectorLayer from 'ol/layer/Vector'\nimport { TileWMS } from 'ol/source'\nimport type OGCMap from 'ol/source/OGCMap'\n\nimport { createKML } from './createKMLLayer'\nimport { createOGCMaps } from './createOGCMapsLayer'\nimport { createOGCTiles } from './createOGCTilesLayer'\nimport { createTMS } from './createTMSLayer'\nimport { createWMS } from './createWMSLayer'\nimport { createWMTS } from './createWMTSLayer'\n\nexport type OlBasemapLayer = TileLayer | VectorLayer | ImageLayer<OGCMap>\n\nexport function createOlLayer(layer: ILayer, projection: Crs = CRS.LEST97): OlBaseLayer | null {\n switch (layer.type) {\n case 'wms':\n return new TileLayer({\n source: new TileWMS({\n url: layer.url,\n params: layer.params ?? {},\n serverType: 'mapserver',\n projection,\n }),\n opacity: layer.opacity,\n zIndex: layer.zIndex,\n })\n case 'wmts':\n return new TileLayer({\n source: new TileWMS({\n url: layer.url,\n params: layer.params ?? {},\n projection,\n }),\n opacity: layer.opacity,\n zIndex: layer.zIndex,\n })\n default:\n return null\n }\n}\n\nexport function createOlBaseLayer(entry: BasemapPlanEntry): OlBasemapLayer | null {\n const { layer, capabilities, tileset } = entry\n const { source } = layer\n\n switch (source.kind) {\n case 'wms':\n return createWMS(source, layer)\n case 'wmts':\n return capabilities ? createWMTS(source, layer, capabilities) : null\n case 'kml':\n return createKML(source.params, kmlExtractStyles(source.params))\n case 'ogcMaps':\n return createOGCMaps(source, layer)\n case 'ogcTiles':\n return tileset ? createOGCTiles(source, layer, tileset) : null\n case 'tms':\n return capabilities ? createTMS(source, layer, capabilities) : null\n case 'tileset3d':\n return null\n default:\n return source satisfies never\n }\n}\n","import type { OlBasemapLayer } from './layerCreation'\n\n// OpenLayers emits load failures on the source, not on the layer: tile sources fire\n// `tileloaderror`, image sources `imageloaderror`. Both are registered on every source because\n// `Target.addEventListener` takes any event name — that keeps the layer union unnarrowed, and the\n// name a source never fires costs nothing.\nconst LOAD_ERROR_EVENTS = ['tileloaderror', 'imageloaderror']\n\nexport function watchLoadErrors(layer: OlBasemapLayer, onError: () => void): () => void {\n const source = layer.getSource()\n\n if (!source) {\n return () => {}\n }\n\n for (const event of LOAD_ERROR_EVENTS) {\n source.addEventListener(event, onError)\n }\n\n return () => {\n for (const event of LOAD_ERROR_EVENTS) {\n source.removeEventListener(event, onError)\n }\n }\n}\n","import {\n toAlpha,\n useActiveBasemapPlan,\n useBasemapServiceError,\n useBasemapStore,\n} from '@xgis/xgis-common'\nimport type OlMap from 'ol/Map'\nimport { useEffect, useRef } from 'react'\n\nimport type { OlBasemapLayer } from '../utils/layerCreation'\nimport { createOlBaseLayer } from '../utils/layerCreation'\nimport { watchLoadErrors } from '../utils/layerLoadErrors'\n\nexport function useOlBasemapReconciler(olMap: OlMap): void {\n const basemapOpacity = useBasemapStore((s) => s.opacity2d)\n const plan = useActiveBasemapPlan('2d')\n const { entries, ready } = plan\n\n const reportServiceError = useBasemapServiceError('2d', plan)\n\n const currentRef = useRef<OlBasemapLayer[]>([])\n // Read through a ref so dragging the opacity slider does not rebuild the layers.\n const opacityRef = useRef(basemapOpacity)\n\n useEffect(() => {\n opacityRef.current = basemapOpacity\n\n for (const layer of currentRef.current) {\n layer.setOpacity(toAlpha(basemapOpacity))\n }\n }, [basemapOpacity])\n\n useEffect(() => {\n if (!ready) {\n return\n }\n\n const created: OlBasemapLayer[] = []\n\n try {\n for (const entry of entries) {\n const native = createOlBaseLayer(entry)\n\n if (native) {\n created.push(native)\n }\n }\n } catch (err) {\n console.error(err)\n return\n }\n\n const detachListeners = created.map((native) => watchLoadErrors(native, reportServiceError))\n\n const previous = currentRef.current\n currentRef.current = created\n\n // Engine index works like z-indeks. Bigger is shown above.\n // To match xgis2 we have to reverse config layer list indexes.\n for (const native of created) {\n olMap.getLayers().insertAt(0, native)\n native.setOpacity(toAlpha(opacityRef.current))\n }\n\n for (const layer of previous) {\n olMap.removeLayer(layer)\n layer.dispose()\n }\n\n // Detached before the next run attaches, so a tile still in flight for a basemap the user has\n // left cannot report against the flag the next run just cleared.\n return () => {\n for (const detach of detachListeners) {\n detach()\n }\n }\n }, [olMap, entries, ready, reportServiceError])\n}\n","import { useLayerStore } from '@xgis/xgis-common'\nimport type OlBaseLayer from 'ol/layer/Base'\nimport type OlMap from 'ol/Map'\nimport { useEffect, useRef } from 'react'\n\nimport { createOlLayer } from '../utils/layerCreation'\n\nexport function useOlLayerReconciler(olMap: OlMap): void {\n const layers = useLayerStore((s) => s.layers)\n const nativeRef = useRef<Map<string, OlBaseLayer>>(new Map())\n\n const supported = layers\n .filter((l) => l.visible)\n .filter((l) => !l.supportedEngines || l.supportedEngines.includes('2d'))\n\n useEffect(() => {\n const prev = nativeRef.current\n const next = new Map<string, OlBaseLayer>()\n\n for (const layer of supported) {\n const existing = prev.get(layer.id)\n if (existing) {\n existing.setOpacity(layer.opacity)\n existing.setZIndex(layer.zIndex)\n next.set(layer.id, existing)\n prev.delete(layer.id)\n } else {\n const native = createOlLayer(layer)\n if (native) {\n olMap.addLayer(native)\n next.set(layer.id, native)\n }\n }\n }\n\n for (const [, orphan] of prev) {\n olMap.removeLayer(orphan)\n orphan.dispose()\n }\n\n nativeRef.current = next\n }, [olMap, supported])\n}\n","import type { Extent3301 } from '@xgis/xgis-common'\nimport { asExtent3301, sameExtent, useMapViewStore } from '@xgis/xgis-common'\nimport type OlMap from 'ol/Map'\nimport type OlView from 'ol/View'\nimport { useEffect } from 'react'\n\nimport { ESTONIA_EXTENT, reboundView } from '../createMapView'\n\n// The extent the live View was actually built with. Read back from the View rather than remembered\n// separately, so the two cannot disagree.\nfunction viewExtentOf(view: OlView): Extent3301 | null {\n const extent = view.get('extent') as [number, number, number, number] | undefined\n\n return extent ? asExtent3301(extent) : null\n}\n\n/** A View's extent constraint is fixed at construction, so a new topic bbox means a new View. */\nexport function useOlViewBounds(olMap: OlMap): void {\n const constraintBbox = useMapViewStore((s) => s.constraintBbox)\n\n useEffect(() => {\n const view = olMap.getView()\n\n // Compared as the extent a View would be built with, since a topic with no area of its own\n // resolves to the same fallback. Rebuilding for an identical View would cut any flight short.\n if (sameExtent(constraintBbox ?? ESTONIA_EXTENT, viewExtentOf(view))) {\n return\n }\n\n const replacement = reboundView(constraintBbox, view)\n olMap.setView(replacement)\n\n // A fresh View assumes a placeholder size until told otherwise, so hand it the real one before\n // anything reads a limit back off it.\n const size = olMap.getSize()\n\n if (size) {\n replacement.setViewportSize(size)\n }\n }, [olMap, constraintBbox])\n}\n","import { useUserMarkerStore } from '@xgis/xgis-common'\nimport Feature from 'ol/Feature'\nimport Point from 'ol/geom/Point'\nimport VectorLayer from 'ol/layer/Vector'\nimport type OlMap from 'ol/Map'\nimport { transform } from 'ol/proj'\nimport VectorSource from 'ol/source/Vector'\nimport { Circle as CircleStyle, Fill, Stroke, Style } from 'ol/style'\nimport { useEffect, useRef } from 'react'\n\nconst MARKER_STYLE = new Style({\n image: new CircleStyle({\n radius: 8,\n fill: new Fill({ color: '#2563EB' }),\n stroke: new Stroke({ color: '#FFFFFF', width: 2 }),\n }),\n})\n\nexport function useOlUserMarker(olMap: OlMap): void {\n const marker = useUserMarkerStore((s) => s.marker)\n const sourceRef = useRef<VectorSource | null>(null)\n\n useEffect(() => {\n const source = new VectorSource()\n const layer = new VectorLayer({ source, zIndex: 100, style: MARKER_STYLE })\n sourceRef.current = source\n olMap.addLayer(layer)\n\n return () => {\n olMap.removeLayer(layer)\n sourceRef.current = null\n }\n }, [olMap])\n\n useEffect(() => {\n const source = sourceRef.current\n if (!source) {\n return\n }\n\n source.clear()\n\n if (marker !== null) {\n const coords = transform([marker.lon, marker.lat], 'EPSG:4326', 'EPSG:3301')\n source.addFeature(new Feature(new Point(coords)))\n }\n }, [marker])\n}\n","import 'ol/ol.css'\n\nimport type { EngineRegistration, IMapEngine } from '@xgis/xgis-common'\nimport { createEngineErrorChannel, CRS, LEST97_PROJ4, useMapViewStore } from '@xgis/xgis-common'\nimport { platformModifierKeyOnly } from 'ol/events/condition'\nimport { defaults as defaultInteractions } from 'ol/interaction/defaults'\nimport OlMap from 'ol/Map'\nimport { get as getProjection } from 'ol/proj'\nimport { register } from 'ol/proj/proj4'\nimport proj4 from 'proj4'\nimport { useEffect, useMemo, useRef } from 'react'\n\nimport { createOlCameraCapability } from './capabilities/olCamera'\nimport { createOlViewLimitsCapability } from './capabilities/olViewLimits'\nimport { createMapView, ESTONIA_EXTENT } from './createMapView'\nimport { CursorDragRotate } from './interactions/cursorDragRotate'\nimport { useOlBasemapReconciler } from './reconcilers/useOlBasemapReconciler'\nimport { useOlLayerReconciler } from './reconcilers/useOlLayerReconciler'\nimport { useOlViewBounds } from './reconcilers/useOlViewBounds'\nimport { useOlUserMarker } from './useOlUserMarker'\n\n// OL keeps its own projection registry, so this proj4 instance needs the definition too.\nproj4.defs(CRS.LEST97, LEST97_PROJ4)\nregister(proj4)\n\n// Sets the zoom and tile grid origins. It does not confine the view — that is the View's extent.\ngetProjection(CRS.LEST97)!.setExtent(ESTONIA_EXTENT)\n\ninterface Map2DProps {\n onEngineReady: (engine: IMapEngine) => EngineRegistration\n}\n\nexport function Map2D({ onEngineReady }: Map2DProps) {\n const mapRef = useRef<HTMLDivElement>(null)\n\n const olMap = useMemo(() => {\n const { bbox, zoom, rotation, constraintBbox } = useMapViewStore.getState()\n\n return new OlMap({\n controls: [],\n interactions: defaultInteractions({ altShiftDragRotate: false }).extend([\n new CursorDragRotate({ condition: platformModifierKeyOnly }),\n ]),\n view: createMapView(constraintBbox, { bbox, zoom, rotation }),\n })\n }, [])\n\n useEffect(() => {\n if (!mapRef.current) {\n return\n }\n olMap.setTarget(mapRef.current)\n return () => olMap.setTarget(undefined)\n }, [olMap])\n\n useEffect(() => {\n const errorChannel = createEngineErrorChannel()\n\n const engine: IMapEngine = {\n type: '2d',\n capabilities: {\n camera: createOlCameraCapability(olMap),\n viewLimits: createOlViewLimitsCapability(olMap),\n },\n destroy() {\n olMap.setTarget(undefined)\n },\n reportError: errorChannel.reportError,\n onError: errorChannel.onError,\n }\n\n const { unregister } = onEngineReady(engine)\n\n return () => {\n unregister()\n }\n }, [olMap, onEngineReady])\n\n useOlBasemapReconciler(olMap)\n useOlLayerReconciler(olMap)\n useOlViewBounds(olMap)\n useOlUserMarker(olMap)\n\n return (\n <div\n ref={mapRef}\n tabIndex={0}\n onClick={() => mapRef.current?.focus()}\n style={{ width: '100%', height: '100%' }}\n />\n )\n}\n"],"names":["getProjection","TileWMS","CircleStyle","defaultInteractions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,qBAAA,GAAwB,EAAA;AAEvB,SAAS,yBAAyB,KAAA,EAAiC;AAExE,EAAA,MAAM,IAAA,GAAO,MAAc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K,CAAA;AACrB,EAAA,eAAA,CAAgB,KAAK,CAAA;AAErB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,MAAA;AAAA,MACL,QAAA,EAAU,CAAA;AAAA,MACV,OAAA,EAAS,MAAM,MAAA,CAAO,OAAA,EAAS,KAAA,EAAM;AAAA,MACrC,KAAA,EAAO,EAAE,KAAA,EAAO,MAAA,EAAQ,QAAQ,MAAA;AAAO;AAAA,GACzC;AAEJ;;;;"}
@@ -0,0 +1,20 @@
1
+ import type { Condition } from 'ol/events/condition';
2
+ import PointerInteraction from 'ol/interaction/Pointer';
3
+ import type MapBrowserEvent from 'ol/MapBrowserEvent';
4
+ export interface CursorDragRotateOptions {
5
+ condition?: Condition;
6
+ duration?: number;
7
+ rotateRate?: number;
8
+ }
9
+ export declare class CursorDragRotate extends PointerInteraction {
10
+ private readonly condition;
11
+ private readonly duration;
12
+ private readonly rotateRate;
13
+ private anchor;
14
+ private anchorPixel;
15
+ private lastPixel;
16
+ constructor(options?: CursorDragRotateOptions);
17
+ handleDownEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean;
18
+ handleDragEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): void;
19
+ handleUpEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean;
20
+ }
@@ -0,0 +1,2 @@
1
+ import type OlMap from 'ol/Map';
2
+ export declare function useOlBasemapReconciler(olMap: OlMap): void;
@@ -0,0 +1,2 @@
1
+ import type OlMap from 'ol/Map';
2
+ export declare function useOlLayerReconciler(olMap: OlMap): void;
@@ -0,0 +1,3 @@
1
+ import type OlMap from 'ol/Map';
2
+ /** A View's extent constraint is fixed at construction, so a new topic bbox means a new View. */
3
+ export declare function useOlViewBounds(olMap: OlMap): void;
@@ -0,0 +1,2 @@
1
+ import type OlMap from 'ol/Map';
2
+ export declare function useOlUserMarker(olMap: OlMap): void;
@@ -0,0 +1,3 @@
1
+ import { KmlParams } from '@xgis/xgis-common';
2
+ import VectorLayer from 'ol/layer/Vector';
3
+ export declare function createKML(params: KmlParams, extractStyles: boolean): VectorLayer | null;
@@ -0,0 +1,4 @@
1
+ import type { LayerPresentation, OgcMapsSource } from '@xgis/xgis-common';
2
+ import ImageLayer from 'ol/layer/Image';
3
+ import OGCMap from 'ol/source/OGCMap';
4
+ export declare function createOGCMaps(source: OgcMapsSource, presentation: LayerPresentation): ImageLayer<OGCMap>;
@@ -0,0 +1,3 @@
1
+ import { type LayerPresentation, type OgcTilesSource, type ResolvedOgcTileset } from '@xgis/xgis-common';
2
+ import TileLayer from 'ol/layer/Tile';
3
+ export declare function createOGCTiles(source: OgcTilesSource, presentation: LayerPresentation, tileset: ResolvedOgcTileset): TileLayer;
@@ -0,0 +1,3 @@
1
+ import type { LayerPresentation, TmsSource } from '@xgis/xgis-common';
2
+ import TileLayer from 'ol/layer/Tile';
3
+ export declare function createTMS(source: TmsSource, presentation: LayerPresentation, capabilitiesText: string): TileLayer | null;
@@ -0,0 +1,3 @@
1
+ import type { LayerPresentation, WmsSource } from '@xgis/xgis-common';
2
+ import TileLayer from 'ol/layer/Tile';
3
+ export declare function createWMS(source: WmsSource, presentation: LayerPresentation): TileLayer;
@@ -0,0 +1,3 @@
1
+ import type { LayerPresentation, WmtsSource } from '@xgis/xgis-common';
2
+ import TileLayer from 'ol/layer/Tile';
3
+ export declare function createWMTS(source: WmtsSource, presentation: LayerPresentation, capabilitiesText: string): TileLayer | null;
@@ -0,0 +1,9 @@
1
+ import { type BasemapPlanEntry, type Crs, type ILayer } from '@xgis/xgis-common';
2
+ import type OlBaseLayer from 'ol/layer/Base';
3
+ import type ImageLayer from 'ol/layer/Image';
4
+ import TileLayer from 'ol/layer/Tile';
5
+ import VectorLayer from 'ol/layer/Vector';
6
+ import type OGCMap from 'ol/source/OGCMap';
7
+ export type OlBasemapLayer = TileLayer | VectorLayer | ImageLayer<OGCMap>;
8
+ export declare function createOlLayer(layer: ILayer, projection?: Crs): OlBaseLayer | null;
9
+ export declare function createOlBaseLayer(entry: BasemapPlanEntry): OlBasemapLayer | null;
@@ -0,0 +1,2 @@
1
+ import type { OlBasemapLayer } from './layerCreation';
2
+ export declare function watchLoadErrors(layer: OlBasemapLayer, onError: () => void): () => void;
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@xgis/xgis2d",
3
+ "version": "0.3.23",
4
+ "description": "XGIS 2D map engine, built on OpenLayers.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "peerDependencies": {
20
+ "react": "^18.2.0 || ^19.0.0",
21
+ "@xgis/xgis-common": "^0.3.23"
22
+ },
23
+ "dependencies": {
24
+ "ol": "10.10.0",
25
+ "proj4": "2.20.8"
26
+ },
27
+ "devDependencies": {
28
+ "@module-federation/vite": "^1.16.8",
29
+ "@testing-library/jest-dom": "^6.9.1",
30
+ "@testing-library/react": "^16.3.2",
31
+ "@types/react": "^19.2.15",
32
+ "@vitejs/plugin-react": "^4.7.0",
33
+ "@vitest/coverage-v8": "^4.1.7",
34
+ "react": "^19.2.6",
35
+ "react-dom": "^19.2.6",
36
+ "typescript": "^6.0.3",
37
+ "vite": "^6.4.3",
38
+ "vitest": "^4.1.7",
39
+ "@xgis/eslint-config": "0.0.0",
40
+ "@xgis/xgis-common": "0.3.23",
41
+ "@xgis/vitest-config": "0.0.0",
42
+ "@xgis/tsconfig": "0.0.0"
43
+ },
44
+ "scripts": {
45
+ "dev": "vite --port 4201",
46
+ "build": "vite build",
47
+ "preview": "vite preview --port 4201",
48
+ "lint": "eslint src",
49
+ "typecheck": "tsc --noEmit",
50
+ "test": "vitest run",
51
+ "test:coverage": "vitest run --coverage",
52
+ "build:lib": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json"
53
+ },
54
+ "main": "./dist/index.js",
55
+ "types": "./dist/index.d.ts"
56
+ }