@xgis/xgis2d 0.3.25 → 0.3.36

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/README.md CHANGED
@@ -1,15 +1,13 @@
1
1
  # @xgis/xgis2d
2
2
 
3
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).
4
+ layers from the shared stores. The host
5
+ [`@xgis/xgis`](https://www.npmjs.com/package/@xgis/xgis) loads it when `mapMode` is `'2d'` or
6
+ `'both'`; it is not used on its own.
8
7
 
9
8
  ## Do not import this directly
10
9
 
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
10
+ Consumers call `mountXgis()` and set `mapMode`; the host loads this package on demand. Importing
13
11
  `Map2D` yourself bypasses the adapter registration and coordinator wiring, and the map will not
14
12
  respond to store changes.
15
13
 
@@ -17,7 +15,7 @@ respond to store changes.
17
15
  pnpm add @xgis/xgis2d
18
16
  ```
19
17
 
20
- Install it so the host can resolve it — then forget about it.
18
+ Install it so the host can resolve it.
21
19
 
22
20
  ## How it fits
23
21
 
@@ -32,43 +30,21 @@ Install it so the host can resolve it — then forget about it.
32
30
  ```
33
31
 
34
32
  `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 |
33
+ the engine to the host through `onEngineReady`. From then on the engine is driven through the stores.
46
34
 
47
- The view projection is **EPSG:3301**, registered with proj4 on this package's own proj4 instance.
35
+ The view projection is **EPSG:3301**, registered with proj4.
48
36
 
49
37
  ## Dependency policy
50
38
 
51
39
  `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.
40
+ version XGIS runs on. A consumer does not choose it.
54
41
 
55
42
  ## Licensing note
56
43
 
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/)
44
+ An application bundling this engine redistributes OpenLayers (BSD-2-Clause) and its own runtime
45
+ dependencies, whose notices the OpenLayers licence does not cover. Generate them from the resolved
46
+ tree: `pnpm licenses list --prod`.
71
47
 
72
48
  ## License
73
49
 
74
- MIT — see [LICENSE](./LICENSE).
50
+ MIT. See the LICENSE file in this package.
@@ -5,6 +5,7 @@ export interface MapViewDefaults {
5
5
  readonly bbox: Extent3301;
6
6
  readonly zoom: ZoomLevel;
7
7
  readonly rotation: Radians;
8
+ readonly rotationAllowed: boolean;
8
9
  }
9
10
  /** The first View of a session. */
10
11
  export declare function createMapView(bounds: Extent3301 | null, defaults: MapViewDefaults): OlView;
@@ -12,4 +13,4 @@ export declare function createMapView(bounds: Extent3301 | null, defaults: MapVi
12
13
  * A View's extent is fixed at construction, so a new area means a new View carrying the old one's
13
14
  * position. Resolution rather than zoom: zoom is undefined between grid levels, resolution is not.
14
15
  */
15
- export declare function reboundView(bounds: Extent3301 | null, previous: OlView): OlView;
16
+ export declare function reboundView(bounds: Extent3301 | null, previous: OlView, rotationAllowed: boolean): OlView;
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
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';
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, toAlpha, useLayerStore, useMapViewStore, sameExtent, useUserMarkerStore, LEST97_PROJ4, platformModifierOnly, createEngineErrorChannel } from '@xgis/xgis-common';
5
4
  import { defaults } from 'ol/interaction/defaults';
6
5
  import OlMap from 'ol/Map';
7
6
  import { transform, get, transformExtent } from 'ol/proj';
@@ -9,6 +8,7 @@ import { register } from 'ol/proj/proj4';
9
8
  import proj4 from 'proj4';
10
9
  import { useRef, useEffect, useMemo } from 'react';
11
10
  import OlView from 'ol/View';
11
+ import { altShiftKeysOnly, mouseOnly, mouseActionButton } from 'ol/events/condition';
12
12
  import { FALSE } from 'ol/functions';
13
13
  import PointerInteraction from 'ol/interaction/Pointer';
14
14
  import { disable } from 'ol/rotationconstraint';
@@ -158,7 +158,8 @@ function buildView(bounds, seed) {
158
158
  smoothExtentConstraint: false,
159
159
  smoothResolutionConstraint: false,
160
160
  minZoom: MIN_ZOOM,
161
- maxZoom: MAX_ZOOM
161
+ maxZoom: MAX_ZOOM,
162
+ enableRotation: seed.rotationAllowed
162
163
  });
163
164
  }
164
165
  function createMapView(bounds, defaults) {
@@ -166,15 +167,17 @@ function createMapView(bounds, defaults) {
166
167
  center: extentCenter(defaults.bbox),
167
168
  resolution: void 0,
168
169
  zoom: defaults.zoom,
169
- rotation: defaults.rotation
170
+ rotation: defaults.rotation,
171
+ rotationAllowed: defaults.rotationAllowed
170
172
  });
171
173
  }
172
- function reboundView(bounds, previous) {
174
+ function reboundView(bounds, previous, rotationAllowed) {
173
175
  return buildView(bounds, {
174
176
  center: previous.getCenter(),
175
177
  resolution: previous.getResolution(),
176
178
  zoom: void 0,
177
- rotation: previous.getRotation()
179
+ rotation: previous.getRotation(),
180
+ rotationAllowed
178
181
  });
179
182
  }
180
183
 
@@ -182,14 +185,10 @@ function middleMouseButton(mapBrowserEvent) {
182
185
  const originalEvent = mapBrowserEvent.originalEvent;
183
186
  return "pointerId" in originalEvent && originalEvent.button === 1;
184
187
  }
185
- const ANCHOR_DRIFT_TOLERANCE_PX = 0.5;
186
- class CursorDragRotate extends PointerInteraction {
188
+ class CenterDragRotate extends PointerInteraction {
187
189
  condition;
188
190
  duration;
189
191
  rotateRate;
190
- anchor;
191
- // The pixel `anchor` should stay pinned at, not the cursor's own (freely moving) pixel.
192
- anchorPixel;
193
192
  lastPixel;
194
193
  constructor(options = {}) {
195
194
  super({
@@ -207,22 +206,19 @@ class CursorDragRotate extends PointerInteraction {
207
206
  if (!leftDrag && !middleMouseButton(mapBrowserEvent)) {
208
207
  return false;
209
208
  }
210
- const map = mapBrowserEvent.map;
211
- const view = map.getView();
209
+ const view = mapBrowserEvent.map.getView();
212
210
  if (view.getConstraints().rotation === disable) {
213
211
  return false;
214
212
  }
215
213
  view.beginInteraction();
216
- this.anchor = mapBrowserEvent.coordinate;
217
214
  this.lastPixel = [mapBrowserEvent.pixel[0], mapBrowserEvent.pixel[1]];
218
- this.anchorPixel = this.lastPixel;
219
215
  return true;
220
216
  }
221
217
  handleDragEvent(mapBrowserEvent) {
222
218
  if (!mouseOnly(mapBrowserEvent)) {
223
219
  return;
224
220
  }
225
- if (!this.anchor || !this.lastPixel || !this.anchorPixel) {
221
+ if (!this.lastPixel) {
226
222
  return;
227
223
  }
228
224
  const map = mapBrowserEvent.map;
@@ -239,30 +235,78 @@ class CursorDragRotate extends PointerInteraction {
239
235
  const horizontalPixelDelta = this.lastPixel[0] - currentPixel[0];
240
236
  const windowRatio = horizontalPixelDelta / size[0];
241
237
  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
- }
238
+ view.adjustRotation(deltaRotation);
255
239
  this.lastPixel = currentPixel;
256
240
  }
257
241
  handleUpEvent(mapBrowserEvent) {
258
242
  if (!mouseOnly(mapBrowserEvent)) {
259
243
  return true;
260
244
  }
245
+ mapBrowserEvent.map.getView().endInteraction(this.duration);
246
+ this.lastPixel = void 0;
247
+ return false;
248
+ }
249
+ }
250
+
251
+ const RIGHT_BUTTON = 2;
252
+ const ZOOM_FACTOR = 5;
253
+ const MAX_MOVEMENT_RATIO = 0.1;
254
+ class CursorDragZoom extends PointerInteraction {
255
+ anchor;
256
+ lastY;
257
+ constructor() {
258
+ super({
259
+ stopDown: FALSE
260
+ });
261
+ }
262
+ // macOS raises contextmenu on press, and the open menu ends pointer delivery before a drag can
263
+ // be told from a click. Cesium suppresses it on its own canvas for the same reason.
264
+ swallowContextMenu = (event) => {
265
+ event.preventDefault();
266
+ };
267
+ setMap(map) {
268
+ this.getMap()?.getViewport().removeEventListener("contextmenu", this.swallowContextMenu);
269
+ super.setMap(map);
270
+ map?.getViewport().addEventListener("contextmenu", this.swallowContextMenu);
271
+ }
272
+ handleDownEvent(mapBrowserEvent) {
273
+ if (!mouseOnly(mapBrowserEvent) || mapBrowserEvent.originalEvent.button !== RIGHT_BUTTON) {
274
+ return false;
275
+ }
276
+ mapBrowserEvent.map.getView().beginInteraction();
277
+ this.anchor = mapBrowserEvent.coordinate;
278
+ this.lastY = mapBrowserEvent.pixel[1];
279
+ return true;
280
+ }
281
+ handleDragEvent(mapBrowserEvent) {
282
+ if (!mouseOnly(mapBrowserEvent) || this.lastY === void 0) {
283
+ return;
284
+ }
285
+ const height = mapBrowserEvent.map.getSize()?.[1];
286
+ if (!height) {
287
+ return;
288
+ }
289
+ const y = mapBrowserEvent.pixel[1];
290
+ const windowRatio = Math.min((y - this.lastY) / height, MAX_MOVEMENT_RATIO);
291
+ this.lastY = y;
261
292
  const view = mapBrowserEvent.map.getView();
262
- view.endInteraction(this.duration, 0, this.anchor);
293
+ const resolution = view.getResolution();
294
+ if (resolution === void 0) {
295
+ return;
296
+ }
297
+ const target = view.getConstrainedResolution(resolution * (1 - ZOOM_FACTOR * windowRatio));
298
+ if (target === void 0 || target === resolution) {
299
+ return;
300
+ }
301
+ view.adjustResolution(target / resolution, this.anchor);
302
+ }
303
+ handleUpEvent(mapBrowserEvent) {
304
+ if (!mouseOnly(mapBrowserEvent)) {
305
+ return true;
306
+ }
307
+ mapBrowserEvent.map.getView().endInteraction();
263
308
  this.anchor = void 0;
264
- this.anchorPixel = void 0;
265
- this.lastPixel = void 0;
309
+ this.lastY = void 0;
266
310
  return false;
267
311
  }
268
312
  }
@@ -487,28 +531,9 @@ function createOlBaseLayer(entry) {
487
531
  }
488
532
  }
489
533
 
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
534
  function useOlBasemapReconciler(olMap) {
508
535
  const basemapOpacity = useBasemapStore((s) => s.opacity2d);
509
- const plan = useActiveBasemapPlan("2d");
510
- const { entries, ready } = plan;
511
- const reportServiceError = useBasemapServiceError("2d", plan);
536
+ const { entries, ready } = useActiveBasemapPlan("2d");
512
537
  const currentRef = useRef([]);
513
538
  const opacityRef = useRef(basemapOpacity);
514
539
  useEffect(() => {
@@ -533,7 +558,6 @@ function useOlBasemapReconciler(olMap) {
533
558
  console.error(err);
534
559
  return;
535
560
  }
536
- const detachListeners = created.map((native) => watchLoadErrors(native, reportServiceError));
537
561
  const previous = currentRef.current;
538
562
  currentRef.current = created;
539
563
  for (const native of created) {
@@ -544,12 +568,7 @@ function useOlBasemapReconciler(olMap) {
544
568
  olMap.removeLayer(layer);
545
569
  layer.dispose();
546
570
  }
547
- return () => {
548
- for (const detach of detachListeners) {
549
- detach();
550
- }
551
- };
552
- }, [olMap, entries, ready, reportServiceError]);
571
+ }, [olMap, entries, ready]);
553
572
  }
554
573
 
555
574
  function useOlLayerReconciler(olMap) {
@@ -586,20 +605,24 @@ function viewExtentOf(view) {
586
605
  const extent = view.get("extent");
587
606
  return extent ? asExtent3301(extent) : null;
588
607
  }
608
+ function rotationAllowedOf(view) {
609
+ return view.getConstraints().rotation !== disable;
610
+ }
589
611
  function useOlViewBounds(olMap) {
590
612
  const constraintBbox = useMapViewStore((s) => s.constraintBbox);
613
+ const rotationAllowed = useMapViewStore((s) => s.rotationAllowed);
591
614
  useEffect(() => {
592
615
  const view = olMap.getView();
593
- if (sameExtent(constraintBbox ?? ESTONIA_EXTENT, viewExtentOf(view))) {
616
+ if (sameExtent(constraintBbox ?? ESTONIA_EXTENT, viewExtentOf(view)) && rotationAllowedOf(view) === rotationAllowed) {
594
617
  return;
595
618
  }
596
- const replacement = reboundView(constraintBbox, view);
619
+ const replacement = reboundView(constraintBbox, view, rotationAllowed);
597
620
  olMap.setView(replacement);
598
621
  const size = olMap.getSize();
599
622
  if (size) {
600
623
  replacement.setViewportSize(size);
601
624
  }
602
- }, [olMap, constraintBbox]);
625
+ }, [olMap, constraintBbox, rotationAllowed]);
603
626
  }
604
627
 
605
628
  const DOT_STYLE = new Style({
@@ -666,13 +689,16 @@ get(CRS.LEST97).setExtent(ESTONIA_EXTENT);
666
689
  function Map2D({ onEngineReady }) {
667
690
  const mapRef = useRef(null);
668
691
  const olMap = useMemo(() => {
669
- const { bbox, zoom, rotation, constraintBbox } = useMapViewStore.getState();
692
+ const { bbox, zoom, rotation, constraintBbox, rotationAllowed } = useMapViewStore.getState();
670
693
  return new OlMap({
671
694
  controls: [],
672
695
  interactions: defaults({ altShiftDragRotate: false }).extend([
673
- new CursorDragRotate({ condition: platformModifierKeyOnly })
696
+ new CenterDragRotate({
697
+ condition: (event) => platformModifierOnly(event.originalEvent)
698
+ }),
699
+ new CursorDragZoom()
674
700
  ]),
675
- view: createMapView(constraintBbox, { bbox, zoom, rotation })
701
+ view: createMapView(constraintBbox, { bbox, zoom, rotation, rotationAllowed })
676
702
  });
677
703
  }, []);
678
704
  useEffect(() => {
package/dist/index.js.map CHANGED
@@ -1 +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/userMarkerStyle.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 type { Radians } from '@xgis/xgis-common'\nimport { Circle as CircleStyle, Fill, Icon, Stroke, Style } from 'ol/style'\n\nconst DOT_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\nconst CONE_FILL_COLOR = 'rgba(37, 99, 235, 0.35)'\n\n// Apex at the bottom-center (icon anchor), fanning out toward the heading direction above it —\n// mirrors the 3D ground cone so both engines read the same way.\nconst CONE_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"44\" height=\"44\" viewBox=\"0 0 44 44\">' +\n `<path d=\"M22,44 L4,4 A20,20 0 0 1 40,4 Z\" fill=\"${CONE_FILL_COLOR}\" /></svg>`\n\nconst CONE_IMAGE_URL = `data:image/svg+xml,${encodeURIComponent(CONE_SVG)}`\n\n// rotateWithView keeps the cone true to heading as the user manually rotates the 2D map.\nexport function buildUserMarkerStyle(heading: Radians | null): Style[] {\n if (heading === null) {\n return [DOT_STYLE]\n }\n\n const coneStyle = new Style({\n image: new Icon({\n src: CONE_IMAGE_URL,\n anchor: [0.5, 1],\n rotation: heading,\n rotateWithView: true,\n }),\n })\n\n return [coneStyle, DOT_STYLE]\n}\n","import { useUserMarkerStore } from '@xgis/xgis-common'\nimport type { FeatureLike } from 'ol/Feature'\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 { useEffect, useRef } from 'react'\n\nimport { buildUserMarkerStyle } from './userMarkerStyle'\n\nconst HEADING_PROPERTY = 'heading'\n\nfunction styleFunction(feature: FeatureLike) {\n return buildUserMarkerStyle(feature.get(HEADING_PROPERTY) ?? null)\n}\n\nexport function useOlUserMarker(olMap: OlMap): void {\n const marker = useUserMarkerStore((s) => s.marker)\n const heading = useUserMarkerStore((s) => s.heading)\n const sourceRef = useRef<VectorSource | null>(null)\n\n useEffect(() => {\n const source = new VectorSource()\n const layer = new VectorLayer({ source, zIndex: 100, style: styleFunction })\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 const feature = new Feature(new Point(coords))\n feature.set(HEADING_PROPERTY, heading)\n source.addFeature(feature)\n }\n }, [marker, heading])\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,KAAA,CAAM,OAAA,EAAQ;AACzC,EAAA,MAAM,SAAA,uBAAgB,GAAA,EAAkC;AACxD,EAAA,MAAM,iBAAA,uBAAwB,GAAA,EAAgC;AAK9D,EAAA,SAAS,UAAA,GAAmB;AAG1B,IAAA,MAAM,IAAA,GAAO,IAAA,EAAK,CAAE,OAAA,EAAQ;AAE5B,IAAA,MAAM,MAAA,GAAqB;AAAA,MACzB,IAAA,EAAM,YAAA,CAAa,IAAA,EAAK,CAAE,iBAAqD,CAAA;AAAA,MAC/E,QAAA,EAAU,IAAA,EAAK,CAAE,WAAA;AAAY,KAC/B;AAEA,IAAA,IAAI,SAAS,MAAA,EAAW;AACtB,MAAA,MAAA,CAAO,IAAA,GAAO,IAAA;AAAA,IAChB;AAEA,IAAA,SAAA,CAAU,OAAA,CAAQ,CAAC,EAAA,KAAO,EAAA,CAAG,MAAM,CAAC,CAAA;AAAA,EACtC;AAEA,EAAA,KAAA,CAAM,EAAA,CAAG,W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A,MAC1B,SAAS,YAAA,CAAa;AAAA,KACxB;AAEA,IAAA,MAAM,EAAE,UAAA,EAAW,GAAI,aAAA,CAAc,MAAM,CAAA;AAE3C,IAAA,OAAO,MAAM;AACX,MAAA,UAAA,EAAW;AAAA,IACb,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,aAAa,CAAC,CAAA;AAEzB,EAAA,sBAAA,CAAuB,KAAK,CAAA;AAC5B,EAAA,oBAAA,CAAqB,KAAK,CAAA;AAC1B,EAAA,eAAA,CAAgB,KAAK,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;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/capabilities/olCamera.ts","../src/capabilities/olViewLimits.ts","../src/createMapView.ts","../src/interactions/centerDragRotate.ts","../src/interactions/cursorDragZoom.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/reconcilers/useOlBasemapReconciler.ts","../src/reconcilers/useOlLayerReconciler.ts","../src/reconcilers/useOlViewBounds.ts","../src/userMarkerStyle.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 readonly rotationAllowed: boolean\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 readonly rotationAllowed: boolean\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 * `enableRotation: false` is what CursorDragRotate's `disable` check gates on.\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 enableRotation: seed.rotationAllowed,\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 rotationAllowed: defaults.rotationAllowed,\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(\n bounds: Extent3301 | null,\n previous: OlView,\n rotationAllowed: boolean,\n): 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 rotationAllowed,\n })\n}\n","import 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 CenterDragRotateOptions {\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\nexport class CenterDragRotate extends PointerInteraction {\n private readonly condition: Condition\n private readonly duration: number\n private readonly rotateRate: number\n\n private lastPixel: [number, number] | undefined\n\n constructor(options: CenterDragRotateOptions = {}) {\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 view = mapBrowserEvent.map.getView()\n\n if (view.getConstraints().rotation === disable) {\n return false\n }\n\n view.beginInteraction()\n\n this.lastPixel = [mapBrowserEvent.pixel[0], mapBrowserEvent.pixel[1]]\n\n return true\n }\n\n override handleDragEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): void {\n if (!mouseOnly(mapBrowserEvent)) {\n return\n }\n\n if (!this.lastPixel) {\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)\n\n this.lastPixel = currentPixel\n }\n\n override handleUpEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean {\n if (!mouseOnly(mapBrowserEvent)) {\n return true\n }\n\n mapBrowserEvent.map.getView().endInteraction(this.duration)\n\n this.lastPixel = undefined\n\n return false\n }\n}\n","import type { Coordinate } from 'ol/coordinate'\nimport { mouseOnly } from 'ol/events/condition'\nimport { FALSE } from 'ol/functions'\nimport PointerInteraction from 'ol/interaction/Pointer'\nimport type OlMap from 'ol/Map'\nimport type MapBrowserEvent from 'ol/MapBrowserEvent'\n\nconst RIGHT_BUTTON = 2\n\n// Cesium's ScreenSpaceCameraController.zoomFactor, which puts a zoom level at H*ln2/5 px of drag.\nconst ZOOM_FACTOR = 5\n\n// Cesium's maximumMovementRatio, one-sided as it is there. Load-bearing, not cosmetic: past\n// dy/H = 0.2 the ratio below turns negative, and a stalled main thread coalescing pointer events\n// can deliver that in one step. Zooming out has no such bound and stays uncapped.\nconst MAX_MOVEMENT_RATIO = 0.1\n\nexport class CursorDragZoom extends PointerInteraction {\n private anchor: Coordinate | undefined\n private lastY: number | undefined\n\n constructor() {\n super({\n stopDown: FALSE,\n })\n }\n\n // macOS raises contextmenu on press, and the open menu ends pointer delivery before a drag can\n // be told from a click. Cesium suppresses it on its own canvas for the same reason.\n private readonly swallowContextMenu = (event: Event): void => {\n event.preventDefault()\n }\n\n override setMap(map: OlMap | null): void {\n this.getMap()?.getViewport().removeEventListener('contextmenu', this.swallowContextMenu)\n\n super.setMap(map)\n\n map?.getViewport().addEventListener('contextmenu', this.swallowContextMenu)\n }\n\n override handleDownEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean {\n if (!mouseOnly(mapBrowserEvent) || mapBrowserEvent.originalEvent.button !== RIGHT_BUTTON) {\n return false\n }\n\n mapBrowserEvent.map.getView().beginInteraction()\n\n this.anchor = mapBrowserEvent.coordinate\n this.lastY = mapBrowserEvent.pixel[1]\n\n return true\n }\n\n override handleDragEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): void {\n if (!mouseOnly(mapBrowserEvent) || this.lastY === undefined) {\n return\n }\n\n const height = mapBrowserEvent.map.getSize()?.[1]\n\n if (!height) {\n return\n }\n\n const y = mapBrowserEvent.pixel[1]\n const windowRatio = Math.min((y - this.lastY) / height, MAX_MOVEMENT_RATIO)\n\n this.lastY = y\n\n const view = mapBrowserEvent.map.getView()\n const resolution = view.getResolution()\n\n if (resolution === undefined) {\n return\n }\n\n // Through the view's own constraint rather than the raw ratio: `adjustResolution` multiplies\n // its target unconstrained and clamps only what it applies, so an overshoot past a zoom stop\n // banks, and the drag then moves nothing until it is paid back.\n const target = view.getConstrainedResolution(resolution * (1 - ZOOM_FACTOR * windowRatio))\n\n if (target === undefined || target === resolution) {\n return\n }\n\n view.adjustResolution(target / resolution, this.anchor)\n }\n\n override handleUpEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean {\n if (!mouseOnly(mapBrowserEvent)) {\n return true\n }\n\n mapBrowserEvent.map.getView().endInteraction()\n\n this.anchor = undefined\n this.lastY = 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 { toAlpha, useActiveBasemapPlan, useBasemapStore } 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'\n\nexport function useOlBasemapReconciler(olMap: OlMap): void {\n const basemapOpacity = useBasemapStore((s) => s.opacity2d)\n const { entries, ready } = useActiveBasemapPlan('2d')\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 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 }, [olMap, entries, ready])\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 { disable } from 'ol/rotationconstraint'\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\nfunction rotationAllowedOf(view: OlView): boolean {\n return view.getConstraints().rotation !== disable\n}\n\n/**\n * A View's extent and rotation constraints are both fixed at construction, so either a new topic\n * bbox or a new topic's mapRotating means a new View.\n */\nexport function useOlViewBounds(olMap: OlMap): void {\n const constraintBbox = useMapViewStore((s) => s.constraintBbox)\n const rotationAllowed = useMapViewStore((s) => s.rotationAllowed)\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 (\n sameExtent(constraintBbox ?? ESTONIA_EXTENT, viewExtentOf(view)) &&\n rotationAllowedOf(view) === rotationAllowed\n ) {\n return\n }\n\n const replacement = reboundView(constraintBbox, view, rotationAllowed)\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, rotationAllowed])\n}\n","import type { Radians } from '@xgis/xgis-common'\nimport { Circle as CircleStyle, Fill, Icon, Stroke, Style } from 'ol/style'\n\nconst DOT_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\nconst CONE_FILL_COLOR = 'rgba(37, 99, 235, 0.35)'\n\n// Apex at the bottom-center (icon anchor), fanning out toward the heading direction above it —\n// mirrors the 3D ground cone so both engines read the same way.\nconst CONE_SVG =\n '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"44\" height=\"44\" viewBox=\"0 0 44 44\">' +\n `<path d=\"M22,44 L4,4 A20,20 0 0 1 40,4 Z\" fill=\"${CONE_FILL_COLOR}\" /></svg>`\n\nconst CONE_IMAGE_URL = `data:image/svg+xml,${encodeURIComponent(CONE_SVG)}`\n\n// rotateWithView keeps the cone true to heading as the user manually rotates the 2D map.\nexport function buildUserMarkerStyle(heading: Radians | null): Style[] {\n if (heading === null) {\n return [DOT_STYLE]\n }\n\n const coneStyle = new Style({\n image: new Icon({\n src: CONE_IMAGE_URL,\n anchor: [0.5, 1],\n rotation: heading,\n rotateWithView: true,\n }),\n })\n\n return [coneStyle, DOT_STYLE]\n}\n","import { useUserMarkerStore } from '@xgis/xgis-common'\nimport type { FeatureLike } from 'ol/Feature'\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 { useEffect, useRef } from 'react'\n\nimport { buildUserMarkerStyle } from './userMarkerStyle'\n\nconst HEADING_PROPERTY = 'heading'\n\nfunction styleFunction(feature: FeatureLike) {\n return buildUserMarkerStyle(feature.get(HEADING_PROPERTY) ?? null)\n}\n\nexport function useOlUserMarker(olMap: OlMap): void {\n const marker = useUserMarkerStore((s) => s.marker)\n const heading = useUserMarkerStore((s) => s.heading)\n const sourceRef = useRef<VectorSource | null>(null)\n\n useEffect(() => {\n const source = new VectorSource()\n const layer = new VectorLayer({ source, zIndex: 100, style: styleFunction })\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 const feature = new Feature(new Point(coords))\n feature.set(HEADING_PROPERTY, heading)\n source.addFeature(feature)\n }\n }, [marker, heading])\n}\n","import 'ol/ol.css'\n\nimport type { EngineRegistration, IMapEngine } from '@xgis/xgis-common'\nimport {\n createEngineErrorChannel,\n CRS,\n LEST97_PROJ4,\n platformModifierOnly,\n useMapViewStore,\n} from '@xgis/xgis-common'\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 { CenterDragRotate } from './interactions/centerDragRotate'\nimport { CursorDragZoom } from './interactions/cursorDragZoom'\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, rotationAllowed } = useMapViewStore.getState()\n\n return new OlMap({\n controls: [],\n interactions: defaultInteractions({ altShiftDragRotate: false }).extend([\n new CenterDragRotate({\n condition: (event) => platformModifierOnly(event.originalEvent),\n }),\n new CursorDragZoom(),\n ]),\n view: createMapView(constraintBbox, { bbox, zoom, rotation, rotationAllowed }),\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,KAAA,CAAM,OAAA,EAAQ;AACzC,EAAA,MAAM,SAAA,uBAAgB,GAAA,EAAkC;AACxD,EAAA,MAAM,iBAAA,uBAAwB,GAAA,EAAgC;AAK9D,EAAA,SAAS,UAAA,GAAmB;AAG1B,IAAA,MAAM,IAAA,GAAO,IAAA,EAAK,CAAE,OAAA,EAAQ;AAE5B,IAAA,MAAM,MAAA,GAAqB;AAAA,MACzB,IAAA,EAAM,YAAA,CAAa,IAAA,EAAK,CAAE,iBAAqD,CAAA;AAAA,MAC/E,QAAA,EAAU,IAAA,EAAK,CAAE,WAAA;AAAY,KAC/B;AAEA,IAAA,IAAI,SAAS,MAAA,EAAW;AACtB,MAAA,MAAA,CAAO,IAAA,GAAO,IAAA;AAAA,IAChB;AAEA,IAAA,SAAA,CAAU,OAAA,CAAQ,CAAC,EAAA,KAAO,EAAA,CAAG,MAAM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AAa,CAAC,CAAA;AAEzB,EAAA,sBAAA,CAAuB,KAAK,CAAA;AAC5B,EAAA,oBAAA,CAAqB,KAAK,CAAA;AAC1B,EAAA,eAAA,CAAgB,KAAK,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;;;;"}
@@ -1,19 +1,17 @@
1
1
  import type { Condition } from 'ol/events/condition';
2
2
  import PointerInteraction from 'ol/interaction/Pointer';
3
3
  import type MapBrowserEvent from 'ol/MapBrowserEvent';
4
- export interface CursorDragRotateOptions {
4
+ export interface CenterDragRotateOptions {
5
5
  condition?: Condition;
6
6
  duration?: number;
7
7
  rotateRate?: number;
8
8
  }
9
- export declare class CursorDragRotate extends PointerInteraction {
9
+ export declare class CenterDragRotate extends PointerInteraction {
10
10
  private readonly condition;
11
11
  private readonly duration;
12
12
  private readonly rotateRate;
13
- private anchor;
14
- private anchorPixel;
15
13
  private lastPixel;
16
- constructor(options?: CursorDragRotateOptions);
14
+ constructor(options?: CenterDragRotateOptions);
17
15
  handleDownEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean;
18
16
  handleDragEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): void;
19
17
  handleUpEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean;
@@ -0,0 +1,13 @@
1
+ import PointerInteraction from 'ol/interaction/Pointer';
2
+ import type OlMap from 'ol/Map';
3
+ import type MapBrowserEvent from 'ol/MapBrowserEvent';
4
+ export declare class CursorDragZoom extends PointerInteraction {
5
+ private anchor;
6
+ private lastY;
7
+ constructor();
8
+ private readonly swallowContextMenu;
9
+ setMap(map: OlMap | null): void;
10
+ handleDownEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean;
11
+ handleDragEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): void;
12
+ handleUpEvent(mapBrowserEvent: MapBrowserEvent<PointerEvent>): boolean;
13
+ }
@@ -1,3 +1,6 @@
1
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. */
2
+ /**
3
+ * A View's extent and rotation constraints are both fixed at construction, so either a new topic
4
+ * bbox or a new topic's mapRotating means a new View.
5
+ */
3
6
  export declare function useOlViewBounds(olMap: OlMap): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xgis/xgis2d",
3
- "version": "0.3.25",
3
+ "version": "0.3.36",
4
4
  "description": "XGIS 2D map engine, built on OpenLayers.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "peerDependencies": {
20
20
  "react": "^18.2.0 || ^19.0.0",
21
- "@xgis/xgis-common": "^0.3.25"
21
+ "@xgis/xgis-common": "^0.3.36"
22
22
  },
23
23
  "dependencies": {
24
24
  "ol": "10.10.0",
@@ -37,9 +37,9 @@
37
37
  "vite": "^6.4.3",
38
38
  "vitest": "^4.1.7",
39
39
  "@xgis/eslint-config": "0.0.0",
40
- "@xgis/xgis-common": "0.3.25",
40
+ "@xgis/tsconfig": "0.0.0",
41
41
  "@xgis/vitest-config": "0.0.0",
42
- "@xgis/tsconfig": "0.0.0"
42
+ "@xgis/xgis-common": "0.3.36"
43
43
  },
44
44
  "scripts": {
45
45
  "dev": "vite --port 4201",
@@ -1,2 +0,0 @@
1
- import type { OlBasemapLayer } from './layerCreation';
2
- export declare function watchLoadErrors(layer: OlBasemapLayer, onError: () => void): () => void;