@xgis/xgis2d 0.3.55 → 0.3.58

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
@@ -32,7 +32,8 @@ Install it so the host can resolve it.
32
32
  `Map2D` builds the OpenLayers map, wraps its native APIs in capability implementations, and hands
33
33
  the engine to the host through `onEngineReady`. From then on the engine is driven through the stores.
34
34
 
35
- The view projection is **EPSG:3301**, registered with proj4.
35
+ The view projection is the topic's configured projection, read from `useProjectionStore`. Every
36
+ proj4 code is registered with OpenLayers.
36
37
 
37
38
  ## Dependency policy
38
39
 
@@ -1,16 +1,16 @@
1
- import type { Extent3301, Radians, ZoomLevel } from '@xgis/xgis-common';
1
+ import type { EpsgCode, MapExtent, Radians, ZoomLevel } from '@xgis/xgis-common';
2
2
  import OlView from 'ol/View';
3
- export declare const ESTONIA_EXTENT: Extent3301;
4
3
  export interface MapViewDefaults {
5
- readonly bbox: Extent3301;
4
+ readonly bbox: MapExtent;
6
5
  readonly zoom: ZoomLevel;
7
6
  readonly rotation: Radians;
8
7
  readonly rotationAllowed: boolean;
9
8
  }
10
- /** The first View of a session. */
11
- export declare function createMapView(bounds: Extent3301 | null, defaults: MapViewDefaults): OlView;
9
+ /** The first View of a session, or of a projection: nothing carries over from a View in another CRS. */
10
+ export declare function createMapView(projection: EpsgCode, bounds: MapExtent | null, defaults: MapViewDefaults): OlView;
12
11
  /**
13
12
  * A View's extent is fixed at construction, so a new area means a new View carrying the old one's
14
13
  * position. Resolution rather than zoom: zoom is undefined between grid levels, resolution is not.
14
+ * Only within one projection: the previous centre means nothing in another CRS.
15
15
  */
16
- export declare function reboundView(bounds: Extent3301 | null, previous: OlView, rotationAllowed: boolean): OlView;
16
+ export declare function reboundView(bounds: MapExtent | null, previous: OlView, rotationAllowed: boolean): OlView;
package/dist/index.js CHANGED
@@ -1,12 +1,11 @@
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, stringifyParams, withQuery, parseTmsTileMap, tmsTileBase, tmsTileSuffix, tmsOrders, tmsResolutions, tmsRowFromTileY, kmlExtractStyles, useBasemapStore, useActiveBasemapPlan, toAlpha, useLayerStore, useMapViewStore, sameExtent, useUserMarkerStore, LEST97_PROJ4, useTranslate, platformModifierOnly, createEngineErrorChannel } from '@xgis/xgis-common';
3
+ import { asMapExtent, CRS, MIN_ZOOM, extentCenter, MAX_ZOOM, LEST97_EXTENT, ZOOM_RESOLUTIONS, 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, stringifyParams, withQuery, parseTmsTileMap, tmsTileBase, tmsTileSuffix, tmsOrders, tmsResolutions, tmsRowFromTileY, kmlExtractStyles, useBasemapStore, useActiveBasemapPlan, useProjectionStore, toAlpha, useLayerStore, useMapViewStore, sameCrs, sameExtent, useUserMarkerStore, proj4, useTranslate, platformModifierOnly, createEngineErrorChannel } from '@xgis/xgis-common';
4
4
  import { defaults } from 'ol/interaction/defaults';
5
5
  import OlMap from 'ol/Map';
6
6
  import { transform, get, transformExtent } from 'ol/proj';
7
7
  import { register } from 'ol/proj/proj4';
8
- import proj4 from 'proj4';
9
- import { useRef, useEffect, useMemo } from 'react';
8
+ import { useRef, useEffect, useState, useMemo } from 'react';
10
9
  import OlView from 'ol/View';
11
10
  import { altShiftKeysOnly, mouseOnly, mouseActionButton } from 'ol/events/condition';
12
11
  import { FALSE } from 'ol/functions';
@@ -21,13 +20,14 @@ import { Text, Stroke, Fill, Style, Icon, Circle } from 'ol/style';
21
20
  import ImageLayer from 'ol/layer/Image';
22
21
  import OGCMap from 'ol/source/OGCMap';
23
22
  import TileGrid from 'ol/tilegrid/TileGrid';
24
- import Projection from 'ol/proj/Projection';
25
23
  import TileWMS from 'ol/source/TileWMS';
24
+ import Projection from 'ol/proj/Projection';
26
25
  import WMTSCapabilities from 'ol/format/WMTSCapabilities';
27
26
  import WMTS, { optionsFromCapabilities } from 'ol/source/WMTS';
28
27
  import WMTSTileGrid from 'ol/tilegrid/WMTS';
29
28
  import Feature from 'ol/Feature';
30
29
  import Point from 'ol/geom/Point';
30
+ import { unByKey } from 'ol/Observable';
31
31
  import VectorSource from 'ol/source/Vector';
32
32
 
33
33
  const LIVE_EMIT_THROTTLE_MS = 30;
@@ -35,10 +35,11 @@ function createOlCameraCapability(olMap) {
35
35
  const view = () => olMap.getView();
36
36
  const listeners = /* @__PURE__ */ new Set();
37
37
  const rotationListeners = /* @__PURE__ */ new Set();
38
+ const movingListeners = /* @__PURE__ */ new Set();
38
39
  function fireChange() {
39
40
  const zoom = view().getZoom();
40
41
  const change = {
41
- bbox: asExtent3301(view().calculateExtent()),
42
+ bbox: asMapExtent(view().calculateExtent()),
42
43
  rotation: view().getRotation()
43
44
  };
44
45
  if (zoom !== void 0) {
@@ -46,7 +47,12 @@ function createOlCameraCapability(olMap) {
46
47
  }
47
48
  listeners.forEach((cb) => cb(change));
48
49
  }
49
- olMap.on("moveend", fireChange);
50
+ function settle() {
51
+ fireChange();
52
+ movingListeners.forEach((cb) => cb(false));
53
+ }
54
+ olMap.on("movestart", () => movingListeners.forEach((cb) => cb(true)));
55
+ olMap.on("moveend", settle);
50
56
  let lastLiveEmit = 0;
51
57
  let trailingTimer = null;
52
58
  function emitLiveIfInteracting() {
@@ -109,7 +115,7 @@ function createOlCameraCapability(olMap) {
109
115
  view().setZoom(zoom);
110
116
  },
111
117
  flyToPosition(position, zoom) {
112
- const center = transform([position.lon, position.lat], CRS.WGS84, CRS.LEST97);
118
+ const center = transform([position.lon, position.lat], CRS.WGS84, view().getProjection());
113
119
  view().animate({ center, zoom, duration: 500 });
114
120
  },
115
121
  getCenter() {
@@ -117,7 +123,7 @@ function createOlCameraCapability(olMap) {
117
123
  return [center[0], center[1]];
118
124
  },
119
125
  getBbox() {
120
- return asExtent3301(view().calculateExtent());
126
+ return asMapExtent(view().calculateExtent());
121
127
  },
122
128
  getRotation() {
123
129
  return view().getRotation();
@@ -133,6 +139,12 @@ function createOlCameraCapability(olMap) {
133
139
  return () => {
134
140
  rotationListeners.delete(callback);
135
141
  };
142
+ },
143
+ onMovingChange(callback) {
144
+ movingListeners.add(callback);
145
+ return () => {
146
+ movingListeners.delete(callback);
147
+ };
136
148
  }
137
149
  };
138
150
  }
@@ -148,15 +160,15 @@ function createOlViewLimitsCapability(olMap) {
148
160
  };
149
161
  }
150
162
 
151
- const ESTONIA_EXTENT = LEST97_EXTENT;
152
- function buildView(bounds, seed) {
163
+ function buildView(projection, bounds, seed) {
153
164
  return new OlView({
154
- projection: CRS.LEST97,
165
+ projection,
166
+ resolutions: [...ZOOM_RESOLUTIONS],
155
167
  center: seed.center,
156
168
  resolution: seed.resolution,
157
169
  zoom: seed.zoom,
158
170
  rotation: seed.rotation,
159
- extent: bounds ?? ESTONIA_EXTENT,
171
+ extent: bounds ?? LEST97_EXTENT,
160
172
  constrainOnlyCenter: false,
161
173
  showFullExtent: true,
162
174
  smoothExtentConstraint: false,
@@ -166,8 +178,8 @@ function buildView(bounds, seed) {
166
178
  enableRotation: seed.rotationAllowed
167
179
  });
168
180
  }
169
- function createMapView(bounds, defaults) {
170
- return buildView(bounds, {
181
+ function createMapView(projection, bounds, defaults) {
182
+ return buildView(projection, bounds, {
171
183
  center: extentCenter(defaults.bbox),
172
184
  resolution: void 0,
173
185
  zoom: defaults.zoom,
@@ -176,7 +188,7 @@ function createMapView(bounds, defaults) {
176
188
  });
177
189
  }
178
190
  function reboundView(bounds, previous, rotationAllowed) {
179
- return buildView(bounds, {
191
+ return buildView(previous.getProjection().getCode(), bounds, {
180
192
  center: previous.getCenter(),
181
193
  resolution: previous.getResolution(),
182
194
  zoom: void 0,
@@ -269,9 +281,9 @@ class CursorDragZoom extends PointerInteraction {
269
281
  event.preventDefault();
270
282
  };
271
283
  setMap(map) {
272
- this.getMap()?.getViewport().removeEventListener("contextmenu", this.swallowContextMenu);
284
+ this.getMap()?.getViewport()?.removeEventListener("contextmenu", this.swallowContextMenu);
273
285
  super.setMap(map);
274
- map?.getViewport().addEventListener("contextmenu", this.swallowContextMenu);
286
+ map?.getViewport()?.addEventListener("contextmenu", this.swallowContextMenu);
275
287
  }
276
288
  handleDownEvent(mapBrowserEvent) {
277
289
  if (!mouseOnly(mapBrowserEvent) || mapBrowserEvent.originalEvent.button !== RIGHT_BUTTON) {
@@ -453,14 +465,23 @@ function createTMS(source, presentation, capabilitiesText) {
453
465
  });
454
466
  }
455
467
 
456
- const LEST97_NORTH_EAST = new Projection({
457
- code: CRS.LEST97,
458
- units: "m",
459
- extent: LEST97_EXTENT,
460
- axisOrientation: "neu"
461
- });
462
- function createWMS(source, presentation) {
463
- const { version } = source;
468
+ function requestProjection(code, axisOrder) {
469
+ const registered = get(code);
470
+ if (!registered) {
471
+ throw new Error(`Projection ${code} is not registered with OpenLayers`);
472
+ }
473
+ return new Projection({
474
+ code,
475
+ units: registered.getUnits(),
476
+ metersPerUnit: registered.getMetersPerUnit(),
477
+ extent: registered.getExtent() ?? void 0,
478
+ worldExtent: registered.getWorldExtent() ?? void 0,
479
+ global: registered.isGlobal(),
480
+ axisOrientation: axisOrder === "northingFirst" ? "neu" : "enu"
481
+ });
482
+ }
483
+
484
+ function createWMS(source, presentation, crs, axisOrder) {
464
485
  return new TileLayer({
465
486
  source: new TileWMS({
466
487
  url: source.href,
@@ -469,9 +490,9 @@ function createWMS(source, presentation) {
469
490
  LAYERS: source.layers.join(","),
470
491
  FORMAT: source.format ?? "image/png",
471
492
  STYLES: source.styles ?? "",
472
- VERSION: version
493
+ VERSION: source.version
473
494
  },
474
- projection: version === "1.3.0" ? LEST97_NORTH_EAST : CRS.LEST97,
495
+ projection: requestProjection(crs, axisOrder),
475
496
  attributions: presentation.copyright
476
497
  })
477
498
  });
@@ -536,12 +557,12 @@ function createOlLayer(layer, projection = CRS.LEST97) {
536
557
  return null;
537
558
  }
538
559
  }
539
- function createOlBaseLayer(entry) {
560
+ function createOlBaseLayer(entry, crs, axisOrder) {
540
561
  const { layer, capabilities, tileset } = entry;
541
562
  const { source } = layer;
542
563
  switch (source.kind) {
543
564
  case "wms":
544
- return createWMS(source, layer);
565
+ return createWMS(source, layer, crs, axisOrder);
545
566
  case "wmts":
546
567
  return capabilities ? createWMTS(source, layer, capabilities) : null;
547
568
  case "kml":
@@ -562,6 +583,8 @@ function createOlBaseLayer(entry) {
562
583
  function useOlBasemapReconciler(olMap) {
563
584
  const basemapOpacity = useBasemapStore((s) => s.opacity2d);
564
585
  const { entries, ready } = useActiveBasemapPlan("2d");
586
+ const crs = useProjectionStore((s) => s.projection);
587
+ const axisOrder = useProjectionStore((s) => s.axisOrder);
565
588
  const currentRef = useRef([]);
566
589
  const opacityRef = useRef(basemapOpacity);
567
590
  useEffect(() => {
@@ -577,7 +600,7 @@ function useOlBasemapReconciler(olMap) {
577
600
  const created = [];
578
601
  try {
579
602
  for (const entry of entries) {
580
- const native = createOlBaseLayer(entry);
603
+ const native = createOlBaseLayer(entry, crs, axisOrder);
581
604
  if (native) {
582
605
  created.push(native);
583
606
  }
@@ -596,7 +619,7 @@ function useOlBasemapReconciler(olMap) {
596
619
  olMap.removeLayer(layer);
597
620
  layer.dispose();
598
621
  }
599
- }, [olMap, entries, ready]);
622
+ }, [olMap, entries, ready, crs, axisOrder]);
600
623
  }
601
624
 
602
625
  function useOlLayerReconciler(olMap) {
@@ -631,26 +654,40 @@ function useOlLayerReconciler(olMap) {
631
654
 
632
655
  function viewExtentOf(view) {
633
656
  const extent = view.get("extent");
634
- return extent ? asExtent3301(extent) : null;
657
+ return extent ? asMapExtent(extent) : null;
635
658
  }
636
659
  function rotationAllowedOf(view) {
637
660
  return view.getConstraints().rotation !== disable;
638
661
  }
662
+ function freshView(projection, bounds, rotationAllowed) {
663
+ const { rotation } = useMapViewStore.getState();
664
+ return createMapView(projection, bounds, {
665
+ bbox: bounds ?? LEST97_EXTENT,
666
+ zoom: MIN_ZOOM,
667
+ rotation,
668
+ rotationAllowed
669
+ });
670
+ }
639
671
  function useOlViewBounds(olMap) {
672
+ const projection = useProjectionStore((s) => s.projection);
640
673
  const constraintBbox = useMapViewStore((s) => s.constraintBbox);
641
674
  const rotationAllowed = useMapViewStore((s) => s.rotationAllowed);
642
675
  useEffect(() => {
643
676
  const view = olMap.getView();
644
- if (sameExtent(constraintBbox ?? ESTONIA_EXTENT, viewExtentOf(view)) && rotationAllowedOf(view) === rotationAllowed) {
677
+ const sameProjection = sameCrs(view.getProjection().getCode(), projection);
678
+ if (sameProjection && sameExtent(constraintBbox ?? LEST97_EXTENT, viewExtentOf(view)) && rotationAllowedOf(view) === rotationAllowed) {
645
679
  return;
646
680
  }
647
- const replacement = reboundView(constraintBbox, view, rotationAllowed);
681
+ const replacement = sameProjection ? reboundView(constraintBbox, view, rotationAllowed) : freshView(projection, constraintBbox, rotationAllowed);
648
682
  olMap.setView(replacement);
649
683
  const size = olMap.getSize();
650
684
  if (size) {
651
685
  replacement.setViewportSize(size);
652
686
  }
653
- }, [olMap, constraintBbox, rotationAllowed]);
687
+ if (!sameProjection && size && constraintBbox) {
688
+ replacement.fit(constraintBbox, { duration: 0 });
689
+ }
690
+ }, [olMap, projection, constraintBbox, rotationAllowed]);
654
691
  }
655
692
 
656
693
  const DOT_STYLE = new Style({
@@ -685,6 +722,7 @@ function styleFunction(feature) {
685
722
  function useOlUserMarker(olMap) {
686
723
  const marker = useUserMarkerStore((s) => s.marker);
687
724
  const heading = useUserMarkerStore((s) => s.heading);
725
+ const [view, setView] = useState(() => olMap.getView());
688
726
  const sourceRef = useRef(null);
689
727
  useEffect(() => {
690
728
  const source = new VectorSource();
@@ -696,6 +734,11 @@ function useOlUserMarker(olMap) {
696
734
  sourceRef.current = null;
697
735
  };
698
736
  }, [olMap]);
737
+ useEffect(() => {
738
+ setView(olMap.getView());
739
+ const key = olMap.on("change:view", () => setView(olMap.getView()));
740
+ return () => unByKey(key);
741
+ }, [olMap]);
699
742
  useEffect(() => {
700
743
  const source = sourceRef.current;
701
744
  if (!source) {
@@ -703,22 +746,22 @@ function useOlUserMarker(olMap) {
703
746
  }
704
747
  source.clear();
705
748
  if (marker !== null) {
706
- const coords = transform([marker.lon, marker.lat], "EPSG:4326", "EPSG:3301");
749
+ const coords = transform([marker.lon, marker.lat], CRS.WGS84, view.getProjection());
707
750
  const feature = new Feature(new Point(coords));
708
751
  feature.set(HEADING_PROPERTY, heading);
709
752
  source.addFeature(feature);
710
753
  }
711
- }, [marker, heading]);
754
+ }, [view, marker, heading]);
712
755
  }
713
756
 
714
- proj4.defs(CRS.LEST97, LEST97_PROJ4);
715
757
  register(proj4);
716
- get(CRS.LEST97).setExtent(ESTONIA_EXTENT);
758
+ get(CRS.LEST97).setExtent(LEST97_EXTENT);
717
759
  function Map2D({ onEngineReady }) {
718
760
  const t = useTranslate();
719
761
  const mapRef = useRef(null);
720
762
  const olMap = useMemo(() => {
721
763
  const { bbox, zoom, rotation, constraintBbox, rotationAllowed } = useMapViewStore.getState();
764
+ const { projection } = useProjectionStore.getState();
722
765
  return new OlMap({
723
766
  controls: [],
724
767
  interactions: defaults({ altShiftDragRotate: false }).extend([
@@ -727,7 +770,7 @@ function Map2D({ onEngineReady }) {
727
770
  }),
728
771
  new CursorDragZoom()
729
772
  ]),
730
- view: createMapView(constraintBbox, { bbox, zoom, rotation, rotationAllowed })
773
+ view: createMapView(projection, constraintBbox, { bbox, zoom, rotation, rotationAllowed })
731
774
  });
732
775
  }, []);
733
776
  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/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 getRotation() {\n return view().getRotation()\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 stringifyParams,\n withQuery,\n} from '@xgis/xgis-common'\nimport type ImageTile from 'ol/ImageTile'\nimport TileLayer from 'ol/layer/Tile'\nimport { OGCMapTile } from 'ol/source'\nimport type { LoadFunction } from 'ol/Tile'\n\n//without this openlayers removes the additional params from the tile load request!\nfunction paramsLoader(params: Record<string, string>): LoadFunction | undefined {\n if (Object.keys(params).length === 0) {\n return undefined\n }\n\n return (tile, src) => {\n const image = (tile as ImageTile).getImage()\n\n if (image instanceof HTMLImageElement) {\n image.src = withQuery(src, params)\n }\n }\n}\n\nexport function createOGCTiles(\n source: OgcTilesSource,\n presentation: LayerPresentation,\n tileset: ResolvedOgcTileset,\n): TileLayer {\n const params = stringifyParams(source.params)\n\n return new TileLayer({\n source: new OGCMapTile({\n url: withQuery(tileset.url, params),\n mediaType: source.format,\n attributions: presentation.copyright,\n projection: CRS.LEST97,\n tileLoadFunction: paramsLoader(params),\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, LEST97_EXTENT } from '@xgis/xgis-common'\nimport TileLayer from 'ol/layer/Tile'\nimport Projection from 'ol/proj/Projection'\nimport TileWMS from 'ol/source/TileWMS'\n\nconst LEST97_NORTH_EAST = new Projection({\n code: CRS.LEST97,\n units: 'm',\n extent: LEST97_EXTENT,\n axisOrientation: 'neu',\n})\n\nexport function createWMS(source: WmsSource, presentation: LayerPresentation): TileLayer {\n const { version } = source\n\n return new TileLayer({\n source: new TileWMS({\n url: source.href,\n params: {\n ...source.params,\n LAYERS: source.layers.join(','),\n FORMAT: source.format ?? 'image/png',\n STYLES: source.styles ?? '',\n VERSION: version,\n },\n projection: version === '1.3.0' ? LEST97_NORTH_EAST : CRS.LEST97,\n attributions: presentation.copyright,\n }),\n })\n}\n","import type { LayerPresentation, WmtsSource } from '@xgis/xgis-common'\nimport { CRS, stringifyParams, withQuery } 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 = withQuery(\n `${source.href}/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}`,\n stringifyParams(source.params),\n )\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 useTranslate,\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 t = useTranslate()\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 role=\"application\"\n aria-label={t('map.2d.aria')}\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,CA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AA,MACV,IAAA,EAAK,aAAA;AAAA,MACL,YAAA,EAAY,EAAE,aAAa,CAAA;AAAA,MAC3B,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/requestProjection.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 { asMapExtent, 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 const movingListeners = new Set<(moving: boolean) => 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: asMapExtent(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 function settle(): void {\n fireChange()\n movingListeners.forEach((cb) => cb(false))\n }\n\n olMap.on('movestart', () => movingListeners.forEach((cb) => cb(true)))\n olMap.on('moveend', settle)\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, view().getProjection())\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 asMapExtent(view().calculateExtent() as [number, number, number, number])\n },\n getRotation() {\n return view().getRotation()\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 onMovingChange(callback) {\n movingListeners.add(callback)\n return () => {\n movingListeners.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 { EpsgCode, MapExtent, Radians, ZoomLevel } from '@xgis/xgis-common'\nimport {\n extentCenter,\n LEST97_EXTENT,\n MAX_ZOOM,\n MIN_ZOOM,\n ZOOM_RESOLUTIONS,\n} from '@xgis/xgis-common'\nimport OlView from 'ol/View'\n\nexport interface MapViewDefaults {\n readonly bbox: MapExtent\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(projection: EpsgCode, bounds: MapExtent | null, seed: ViewSeed): OlView {\n return new OlView({\n projection,\n resolutions: [...ZOOM_RESOLUTIONS],\n center: seed.center,\n resolution: seed.resolution,\n zoom: seed.zoom,\n rotation: seed.rotation,\n extent: bounds ?? LEST97_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, or of a projection: nothing carries over from a View in another CRS. */\nexport function createMapView(\n projection: EpsgCode,\n bounds: MapExtent | null,\n defaults: MapViewDefaults,\n): OlView {\n return buildView(projection, 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 * Only within one projection: the previous centre means nothing in another CRS.\n */\nexport function reboundView(\n bounds: MapExtent | null,\n previous: OlView,\n rotationAllowed: boolean,\n): OlView {\n return buildView(previous.getProjection().getCode() as EpsgCode, 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 stringifyParams,\n withQuery,\n} from '@xgis/xgis-common'\nimport type ImageTile from 'ol/ImageTile'\nimport TileLayer from 'ol/layer/Tile'\nimport { OGCMapTile } from 'ol/source'\nimport type { LoadFunction } from 'ol/Tile'\n\n//without this openlayers removes the additional params from the tile load request!\nfunction paramsLoader(params: Record<string, string>): LoadFunction | undefined {\n if (Object.keys(params).length === 0) {\n return undefined\n }\n\n return (tile, src) => {\n const image = (tile as ImageTile).getImage()\n\n if (image instanceof HTMLImageElement) {\n image.src = withQuery(src, params)\n }\n }\n}\n\nexport function createOGCTiles(\n source: OgcTilesSource,\n presentation: LayerPresentation,\n tileset: ResolvedOgcTileset,\n): TileLayer {\n const params = stringifyParams(source.params)\n\n return new TileLayer({\n source: new OGCMapTile({\n url: withQuery(tileset.url, params),\n mediaType: source.format,\n attributions: presentation.copyright,\n projection: CRS.LEST97,\n tileLoadFunction: paramsLoader(params),\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 { CrsAxisOrder, EpsgCode } from '@xgis/xgis-common'\nimport { get as getProjection } from 'ol/proj'\nimport Projection from 'ol/proj/Projection'\n\nexport function requestProjection(code: EpsgCode, axisOrder: CrsAxisOrder): Projection {\n const registered = getProjection(code)\n\n if (!registered) {\n throw new Error(`Projection ${code} is not registered with OpenLayers`)\n }\n\n return new Projection({\n code,\n units: registered.getUnits(),\n metersPerUnit: registered.getMetersPerUnit(),\n extent: registered.getExtent() ?? undefined,\n worldExtent: registered.getWorldExtent() ?? undefined,\n global: registered.isGlobal(),\n axisOrientation: axisOrder === 'northingFirst' ? 'neu' : 'enu',\n })\n}\n","import type { CrsAxisOrder, EpsgCode, LayerPresentation, WmsSource } from '@xgis/xgis-common'\nimport TileLayer from 'ol/layer/Tile'\nimport TileWMS from 'ol/source/TileWMS'\n\nimport { requestProjection } from './requestProjection'\n\nexport function createWMS(\n source: WmsSource,\n presentation: LayerPresentation,\n crs: EpsgCode,\n axisOrder: CrsAxisOrder,\n): TileLayer {\n return new TileLayer({\n source: new TileWMS({\n url: source.href,\n params: {\n ...source.params,\n LAYERS: source.layers.join(','),\n FORMAT: source.format ?? 'image/png',\n STYLES: source.styles ?? '',\n VERSION: source.version,\n },\n projection: requestProjection(crs, axisOrder),\n attributions: presentation.copyright,\n }),\n })\n}\n","import type { LayerPresentation, WmtsSource } from '@xgis/xgis-common'\nimport { CRS, stringifyParams, withQuery } 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 = withQuery(\n `${source.href}/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}`,\n stringifyParams(source.params),\n )\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 CrsAxisOrder,\n type EpsgCode,\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(\n entry: BasemapPlanEntry,\n crs: EpsgCode,\n axisOrder: CrsAxisOrder,\n): 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, crs, axisOrder)\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 {\n toAlpha,\n useActiveBasemapPlan,\n useBasemapStore,\n useProjectionStore,\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'\n\nexport function useOlBasemapReconciler(olMap: OlMap): void {\n const basemapOpacity = useBasemapStore((s) => s.opacity2d)\n const { entries, ready } = useActiveBasemapPlan('2d')\n const crs = useProjectionStore((s) => s.projection)\n const axisOrder = useProjectionStore((s) => s.axisOrder)\n\n const currentRef = useRef<OlBasemapLayer[]>([])\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, crs, axisOrder)\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, crs, axisOrder])\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 { EpsgCode, MapExtent } from '@xgis/xgis-common'\nimport {\n asMapExtent,\n LEST97_EXTENT,\n MIN_ZOOM,\n sameCrs,\n sameExtent,\n useMapViewStore,\n useProjectionStore,\n} 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 { createMapView, 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): MapExtent | null {\n const extent = view.get('extent') as [number, number, number, number] | undefined\n\n return extent ? asMapExtent(extent) : null\n}\n\nfunction rotationAllowedOf(view: OlView): boolean {\n return view.getConstraints().rotation !== disable\n}\n\n// The topic's fit reaches the old View before this effect runs, so a View in a new projection\n// frames the topic itself.\nfunction freshView(\n projection: EpsgCode,\n bounds: MapExtent | null,\n rotationAllowed: boolean,\n): OlView {\n const { rotation } = useMapViewStore.getState()\n\n return createMapView(projection, bounds, {\n bbox: bounds ?? LEST97_EXTENT,\n zoom: MIN_ZOOM,\n rotation,\n rotationAllowed,\n })\n}\n\n/**\n * A View's projection, extent and rotation constraints are all fixed at construction, so a new\n * topic projection, bbox or mapRotating means a new View.\n */\nexport function useOlViewBounds(olMap: OlMap): void {\n const projection = useProjectionStore((s) => s.projection)\n const constraintBbox = useMapViewStore((s) => s.constraintBbox)\n const rotationAllowed = useMapViewStore((s) => s.rotationAllowed)\n\n useEffect(() => {\n const view = olMap.getView()\n const sameProjection = sameCrs(view.getProjection().getCode(), projection)\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 sameProjection &&\n sameExtent(constraintBbox ?? LEST97_EXTENT, viewExtentOf(view)) &&\n rotationAllowedOf(view) === rotationAllowed\n ) {\n return\n }\n\n const replacement = sameProjection\n ? reboundView(constraintBbox, view, rotationAllowed)\n : freshView(projection, constraintBbox, 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\n if (!sameProjection && size && constraintBbox) {\n replacement.fit(constraintBbox, { duration: 0 })\n }\n }, [olMap, projection, 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 { CRS, 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 { unByKey } from 'ol/Observable'\nimport { transform } from 'ol/proj'\nimport VectorSource from 'ol/source/Vector'\nimport { useEffect, useRef, useState } 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 [view, setView] = useState(() => olMap.getView())\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 setView(olMap.getView())\n const key = olMap.on('change:view', () => setView(olMap.getView()))\n\n return () => unByKey(key)\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], CRS.WGS84, view.getProjection())\n const feature = new Feature(new Point(coords))\n feature.set(HEADING_PROPERTY, heading)\n source.addFeature(feature)\n }\n }, [view, marker, heading])\n}\n","import 'ol/ol.css'\n\nimport type { EngineRegistration, IMapEngine } from '@xgis/xgis-common'\nimport {\n createEngineErrorChannel,\n CRS,\n LEST97_EXTENT,\n platformModifierOnly,\n proj4,\n useMapViewStore,\n useProjectionStore,\n useTranslate,\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 { useEffect, useMemo, useRef } from 'react'\n\nimport { createOlCameraCapability } from './capabilities/olCamera'\nimport { createOlViewLimitsCapability } from './capabilities/olViewLimits'\nimport { createMapView } 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\nregister(proj4)\n\n// Default tile grids of sources without their own derive from this. It does not confine the view —\n// that is the View's extent.\ngetProjection(CRS.LEST97)!.setExtent(LEST97_EXTENT)\n\ninterface Map2DProps {\n onEngineReady: (engine: IMapEngine) => EngineRegistration\n}\n\nexport function Map2D({ onEngineReady }: Map2DProps) {\n const t = useTranslate()\n const mapRef = useRef<HTMLDivElement>(null)\n\n const olMap = useMemo(() => {\n const { bbox, zoom, rotation, constraintBbox, rotationAllowed } = useMapViewStore.getState()\n const { projection } = useProjectionStore.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(projection, 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 role=\"application\"\n aria-label={t('map.2d.aria')}\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;AAC9D,EAAA,MAAM,eAAA,uBAAsB,GAAA,EAA+B;AAK3D,EAAA,SAAS,UAAA,GAAmB;AAG1B,IAAA,MAAM,IAAA,GAAO,IAAA,EAAK,CAAE,OAAA,EAAQ;AAE5B,IAAA,MAAM,MAAA,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,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,IAAA,EAAK,aAAA;AAAA,MACL,YAAA,EAAY,EAAE,aAAa,CAAA;AAAA,MAC3B,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,6 +1,6 @@
1
1
  import type OlMap from 'ol/Map';
2
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.
3
+ * A View's projection, extent and rotation constraints are all fixed at construction, so a new
4
+ * topic projection, bbox or mapRotating means a new View.
5
5
  */
6
6
  export declare function useOlViewBounds(olMap: OlMap): void;
@@ -1,3 +1,3 @@
1
- import type { LayerPresentation, WmsSource } from '@xgis/xgis-common';
1
+ import type { CrsAxisOrder, EpsgCode, LayerPresentation, WmsSource } from '@xgis/xgis-common';
2
2
  import TileLayer from 'ol/layer/Tile';
3
- export declare function createWMS(source: WmsSource, presentation: LayerPresentation): TileLayer;
3
+ export declare function createWMS(source: WmsSource, presentation: LayerPresentation, crs: EpsgCode, axisOrder: CrsAxisOrder): TileLayer;
@@ -1,4 +1,4 @@
1
- import { type BasemapPlanEntry, type Crs, type ILayer } from '@xgis/xgis-common';
1
+ import { type BasemapPlanEntry, type Crs, type CrsAxisOrder, type EpsgCode, type ILayer } from '@xgis/xgis-common';
2
2
  import type OlBaseLayer from 'ol/layer/Base';
3
3
  import type ImageLayer from 'ol/layer/Image';
4
4
  import TileLayer from 'ol/layer/Tile';
@@ -6,4 +6,4 @@ import VectorLayer from 'ol/layer/Vector';
6
6
  import type OGCMap from 'ol/source/OGCMap';
7
7
  export type OlBasemapLayer = TileLayer | VectorLayer | ImageLayer<OGCMap>;
8
8
  export declare function createOlLayer(layer: ILayer, projection?: Crs): OlBaseLayer | null;
9
- export declare function createOlBaseLayer(entry: BasemapPlanEntry): OlBasemapLayer | null;
9
+ export declare function createOlBaseLayer(entry: BasemapPlanEntry, crs: EpsgCode, axisOrder: CrsAxisOrder): OlBasemapLayer | null;
@@ -0,0 +1,3 @@
1
+ import type { CrsAxisOrder, EpsgCode } from '@xgis/xgis-common';
2
+ import Projection from 'ol/proj/Projection';
3
+ export declare function requestProjection(code: EpsgCode, axisOrder: CrsAxisOrder): Projection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xgis/xgis2d",
3
- "version": "0.3.55",
3
+ "version": "0.3.58",
4
4
  "description": "XGIS 2D map engine, built on OpenLayers.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,11 +18,10 @@
18
18
  },
19
19
  "peerDependencies": {
20
20
  "react": "^18.3.1 || ^19.0.0",
21
- "@xgis/xgis-common": "^0.3.55"
21
+ "@xgis/xgis-common": "^0.3.58"
22
22
  },
23
23
  "dependencies": {
24
- "ol": "10.10.0",
25
- "proj4": "2.20.8"
24
+ "ol": "10.11.0"
26
25
  },
27
26
  "devDependencies": {
28
27
  "@module-federation/vite": "^1.16.8",
@@ -38,8 +37,8 @@
38
37
  "vitest": "^4.1.12",
39
38
  "@xgis/eslint-config": "0.0.0",
40
39
  "@xgis/tsconfig": "0.0.0",
41
- "@xgis/vitest-config": "0.0.0",
42
- "@xgis/xgis-common": "0.3.55"
40
+ "@xgis/xgis-common": "0.3.58",
41
+ "@xgis/vitest-config": "0.0.0"
43
42
  },
44
43
  "scripts": {
45
44
  "dev": "vite --port 4201",