@xgis/xgis2d 0.3.58 → 0.4.2

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/dist/Map2D.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'ol/ol.css';
2
- import type { EngineRegistration, IMapEngine } from '@xgis/xgis-common';
2
+ import type { IEngineRegistration, IMapEngine } from '@xgis/xgis-common';
3
3
  interface Map2DProps {
4
- onEngineReady: (engine: IMapEngine) => EngineRegistration;
4
+ onEngineReady: (engine: IMapEngine) => IEngineRegistration;
5
5
  }
6
6
  export declare function Map2D({ onEngineReady }: Map2DProps): import("react/jsx-runtime").JSX.Element;
7
7
  export {};
@@ -5,12 +5,13 @@ export interface MapViewDefaults {
5
5
  readonly zoom: ZoomLevel;
6
6
  readonly rotation: Radians;
7
7
  readonly rotationAllowed: boolean;
8
+ readonly zoomCeiling: ZoomLevel;
8
9
  }
9
10
  /** The first View of a session, or of a projection: nothing carries over from a View in another CRS. */
10
11
  export declare function createMapView(projection: EpsgCode, bounds: MapExtent | null, defaults: MapViewDefaults): OlView;
11
12
  /**
12
- * A View's extent is fixed at construction, so a new area means a new View carrying the old one's
13
- * position. Resolution rather than zoom: zoom is undefined between grid levels, resolution is not.
13
+ * A View's extent and zoom ceiling are fixed at construction, so a new area or zoom ceiling means a new
14
+ * View carrying the old one's position. Resolution rather than zoom: zoom is undefined between grid levels, resolution is not.
14
15
  * Only within one projection: the previous centre means nothing in another CRS.
15
16
  */
16
- export declare function reboundView(bounds: MapExtent | null, previous: OlView, rotationAllowed: boolean): OlView;
17
+ export declare function reboundView(bounds: MapExtent | null, previous: OlView, rotationAllowed: boolean, zoomCeiling: ZoomLevel): OlView;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import 'ol/ol.css';
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';
3
+ import { asMapExtent, CRS, MIN_ZOOM, extentCenter, LEST97_EXTENT, ZOOM_RESOLUTIONS, resolutionForZoom, 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, pickTileTemplate, fallbackTileTemplate, crsAxisOrder, 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
- import { transform, get, transformExtent } from 'ol/proj';
7
6
  import { register } from 'ol/proj/proj4';
8
7
  import { useRef, useEffect, useState, useMemo } from 'react';
8
+ import { transform, get } from 'ol/proj';
9
9
  import OlView from 'ol/View';
10
10
  import { altShiftKeysOnly, mouseOnly, mouseActionButton } from 'ol/events/condition';
11
11
  import { FALSE } from 'ol/functions';
@@ -24,7 +24,6 @@ import TileWMS from 'ol/source/TileWMS';
24
24
  import Projection from 'ol/proj/Projection';
25
25
  import WMTSCapabilities from 'ol/format/WMTSCapabilities';
26
26
  import WMTS, { optionsFromCapabilities } from 'ol/source/WMTS';
27
- import WMTSTileGrid from 'ol/tilegrid/WMTS';
28
27
  import Feature from 'ol/Feature';
29
28
  import Point from 'ol/geom/Point';
30
29
  import { unByKey } from 'ol/Observable';
@@ -156,14 +155,24 @@ function createOlViewLimitsCapability(olMap) {
156
155
  // beat after the topic changes, so this can read the outgoing topic's limit for one render.
157
156
  getZoomFloor(_bounds) {
158
157
  return olMap.getView().getConstrainedZoom(MIN_ZOOM) ?? MIN_ZOOM;
158
+ },
159
+ getZoomCeiling(zoomCeiling) {
160
+ return zoomCeiling;
159
161
  }
160
162
  };
161
163
  }
162
164
 
165
+ function resolutionsUpTo(zoomCeiling) {
166
+ const resolutions = [...ZOOM_RESOLUTIONS];
167
+ if (Number.isInteger(zoomCeiling)) {
168
+ return resolutions;
169
+ }
170
+ return Object.assign(resolutions, { [String(zoomCeiling)]: resolutionForZoom(zoomCeiling) });
171
+ }
163
172
  function buildView(projection, bounds, seed) {
164
173
  return new OlView({
165
174
  projection,
166
- resolutions: [...ZOOM_RESOLUTIONS],
175
+ resolutions: resolutionsUpTo(seed.zoomCeiling),
167
176
  center: seed.center,
168
177
  resolution: seed.resolution,
169
178
  zoom: seed.zoom,
@@ -174,7 +183,7 @@ function buildView(projection, bounds, seed) {
174
183
  smoothExtentConstraint: false,
175
184
  smoothResolutionConstraint: false,
176
185
  minZoom: MIN_ZOOM,
177
- maxZoom: MAX_ZOOM,
186
+ maxZoom: seed.zoomCeiling,
178
187
  enableRotation: seed.rotationAllowed
179
188
  });
180
189
  }
@@ -184,16 +193,18 @@ function createMapView(projection, bounds, defaults) {
184
193
  resolution: void 0,
185
194
  zoom: defaults.zoom,
186
195
  rotation: defaults.rotation,
187
- rotationAllowed: defaults.rotationAllowed
196
+ rotationAllowed: defaults.rotationAllowed,
197
+ zoomCeiling: defaults.zoomCeiling
188
198
  });
189
199
  }
190
- function reboundView(bounds, previous, rotationAllowed) {
200
+ function reboundView(bounds, previous, rotationAllowed, zoomCeiling) {
191
201
  return buildView(previous.getProjection().getCode(), bounds, {
192
202
  center: previous.getCenter(),
193
203
  resolution: previous.getResolution(),
194
204
  zoom: void 0,
195
205
  rotation: previous.getRotation(),
196
- rotationAllowed
206
+ rotationAllowed,
207
+ zoomCeiling
197
208
  });
198
209
  }
199
210
 
@@ -384,12 +395,12 @@ function createStyleFunction(params) {
384
395
  return styles;
385
396
  };
386
397
  }
387
- function createKML(params, extractStyles) {
398
+ function createKML(params, extractStyles, crs) {
388
399
  const kmlFormat = new KML({ extractStyles });
389
400
  const features = kmlFormat.readFeatures(params.objects, {
390
401
  dataProjection: CRS.WGS84,
391
402
  // official KML standard, don't change this
392
- featureProjection: CRS.LEST97
403
+ featureProjection: crs
393
404
  });
394
405
  const vector = new VectorLayer({
395
406
  source: new Vector({
@@ -428,7 +439,7 @@ function createOGCTiles(source, presentation, tileset) {
428
439
  url: withQuery(tileset.url, params),
429
440
  mediaType: source.format,
430
441
  attributions: presentation.copyright,
431
- projection: CRS.LEST97,
442
+ projection: tileset.crs,
432
443
  tileLoadFunction: paramsLoader(params)
433
444
  })
434
445
  });
@@ -442,15 +453,13 @@ function createTMS(source, presentation, capabilitiesText) {
442
453
  if (!tileMap) {
443
454
  return null;
444
455
  }
445
- const sourceProjection = get(tileMap.srs);
446
- if (!sourceProjection) {
456
+ if (!get(tileMap.srs)) {
447
457
  return null;
448
458
  }
449
459
  const base = tmsTileBase(source.href);
450
460
  const suffix = tmsTileSuffix(tileMap.extension);
451
461
  const orders = tmsOrders(tileMap.tileSets);
452
462
  return new TileLayer({
453
- extent: transformExtent(tileMap.extent, sourceProjection, CRS.LEST97),
454
463
  source: new ImageTile({
455
464
  url: tmsTileUrl(base, suffix, orders),
456
465
  projection: tileMap.srs,
@@ -485,6 +494,7 @@ function createWMS(source, presentation, crs, axisOrder) {
485
494
  return new TileLayer({
486
495
  source: new TileWMS({
487
496
  url: source.href,
497
+ tileGrid: new TileGrid({ origin: [0, 0], resolutions: [...ZOOM_RESOLUTIONS] }),
488
498
  params: {
489
499
  ...source.params,
490
500
  LAYERS: source.layers.join(","),
@@ -498,33 +508,64 @@ function createWMS(source, presentation, crs, axisOrder) {
498
508
  });
499
509
  }
500
510
 
501
- function createWMTS(source, presentation, capabilitiesText) {
502
- const capabilities = new WMTSCapabilities().read(capabilitiesText);
503
- const options = optionsFromCapabilities(capabilities, {
511
+ function needsOriginSwap(code) {
512
+ if (get(code)?.getAxisOrientation().startsWith("ne")) {
513
+ return false;
514
+ }
515
+ return crsAxisOrder(code) === "northingFirst";
516
+ }
517
+ function withEastFirstOrigins(set) {
518
+ if (!needsOriginSwap(set.SupportedCRS)) {
519
+ return set;
520
+ }
521
+ return {
522
+ ...set,
523
+ TileMatrix: set.TileMatrix.map((matrix) => ({
524
+ ...matrix,
525
+ TopLeftCorner: [matrix.TopLeftCorner[1], matrix.TopLeftCorner[0]]
526
+ }))
527
+ };
528
+ }
529
+ function createWMTS(source, presentation, capabilitiesText, crs) {
530
+ const parsed = new WMTSCapabilities().read(capabilitiesText);
531
+ if (!parsed?.Contents?.TileMatrixSet) {
532
+ return null;
533
+ }
534
+ const caps = {
535
+ ...parsed,
536
+ Contents: {
537
+ ...parsed.Contents,
538
+ Layer: parsed.Contents.Layer?.map((layer) => ({
539
+ ...layer,
540
+ ResourceURL: layer.ResourceURL ?? []
541
+ })),
542
+ TileMatrixSet: parsed.Contents.TileMatrixSet.map(withEastFirstOrigins)
543
+ }
544
+ };
545
+ const options = optionsFromCapabilities(caps, {
504
546
  layer: source.layer,
505
- matrixSet: CRS.LEST97,
547
+ projection: crs,
506
548
  style: source.styles ?? "default"
507
549
  });
508
550
  if (!options) {
509
551
  return null;
510
552
  }
511
- const url = withQuery(
512
- `${source.href}/1.0.0/{Layer}/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}`,
513
- stringifyParams(source.params)
514
- );
553
+ const resources = caps.Contents.Layer?.find(
554
+ (layer) => layer.Identifier === source.layer
555
+ )?.ResourceURL;
556
+ const template = pickTileTemplate(resources, source.format) ?? fallbackTileTemplate(source.href, source.layer, options.style);
557
+ const url = withQuery(template, stringifyParams(source.params));
515
558
  return new TileLayer({
516
559
  source: new WMTS({
517
560
  url,
518
561
  layer: source.layer,
519
562
  style: options.style,
520
563
  matrixSet: options.matrixSet,
521
- projection: CRS.LEST97,
564
+ projection: options.projection,
522
565
  requestEncoding: "REST",
523
- tileGrid: new WMTSTileGrid({
524
- origin: options.tileGrid.getOrigin(0).reverse(),
525
- resolutions: options.tileGrid.getResolutions(),
526
- matrixIds: options.tileGrid.getMatrixIds()
527
- }),
566
+ dimensions: options.dimensions,
567
+ tileGrid: options.tileGrid,
568
+ wrapX: false,
528
569
  attributions: presentation.copyright
529
570
  })
530
571
  });
@@ -564,9 +605,9 @@ function createOlBaseLayer(entry, crs, axisOrder) {
564
605
  case "wms":
565
606
  return createWMS(source, layer, crs, axisOrder);
566
607
  case "wmts":
567
- return capabilities ? createWMTS(source, layer, capabilities) : null;
608
+ return capabilities ? createWMTS(source, layer, capabilities, crs) : null;
568
609
  case "kml":
569
- return createKML(source.params, kmlExtractStyles(source.params));
610
+ return createKML(source.params, kmlExtractStyles(source.params), crs);
570
611
  case "ogcMaps":
571
612
  return createOGCMaps(source, layer);
572
613
  case "ogcTiles":
@@ -659,26 +700,32 @@ function viewExtentOf(view) {
659
700
  function rotationAllowedOf(view) {
660
701
  return view.getConstraints().rotation !== disable;
661
702
  }
662
- function freshView(projection, bounds, rotationAllowed) {
703
+ const ZOOM_EPSILON = 1e-9;
704
+ function sameZoomCeiling(view, zoomCeiling) {
705
+ return Math.abs(view.getMaxZoom() - zoomCeiling) < ZOOM_EPSILON;
706
+ }
707
+ function freshView(projection, bounds, rotationAllowed, zoomCeiling) {
663
708
  const { rotation } = useMapViewStore.getState();
664
709
  return createMapView(projection, bounds, {
665
710
  bbox: bounds ?? LEST97_EXTENT,
666
711
  zoom: MIN_ZOOM,
667
712
  rotation,
668
- rotationAllowed
713
+ rotationAllowed,
714
+ zoomCeiling
669
715
  });
670
716
  }
671
717
  function useOlViewBounds(olMap) {
672
718
  const projection = useProjectionStore((s) => s.projection);
673
719
  const constraintBbox = useMapViewStore((s) => s.constraintBbox);
674
720
  const rotationAllowed = useMapViewStore((s) => s.rotationAllowed);
721
+ const zoomCeiling = useMapViewStore((s) => s.zoomCeiling);
675
722
  useEffect(() => {
676
723
  const view = olMap.getView();
677
724
  const sameProjection = sameCrs(view.getProjection().getCode(), projection);
678
- if (sameProjection && sameExtent(constraintBbox ?? LEST97_EXTENT, viewExtentOf(view)) && rotationAllowedOf(view) === rotationAllowed) {
725
+ if (sameProjection && sameExtent(constraintBbox ?? LEST97_EXTENT, viewExtentOf(view)) && rotationAllowedOf(view) === rotationAllowed && sameZoomCeiling(view, zoomCeiling)) {
679
726
  return;
680
727
  }
681
- const replacement = sameProjection ? reboundView(constraintBbox, view, rotationAllowed) : freshView(projection, constraintBbox, rotationAllowed);
728
+ const replacement = sameProjection ? reboundView(constraintBbox, view, rotationAllowed, zoomCeiling) : freshView(projection, constraintBbox, rotationAllowed, zoomCeiling);
682
729
  olMap.setView(replacement);
683
730
  const size = olMap.getSize();
684
731
  if (size) {
@@ -687,7 +734,7 @@ function useOlViewBounds(olMap) {
687
734
  if (!sameProjection && size && constraintBbox) {
688
735
  replacement.fit(constraintBbox, { duration: 0 });
689
736
  }
690
- }, [olMap, projection, constraintBbox, rotationAllowed]);
737
+ }, [olMap, projection, constraintBbox, rotationAllowed, zoomCeiling]);
691
738
  }
692
739
 
693
740
  const DOT_STYLE = new Style({
@@ -755,12 +802,11 @@ function useOlUserMarker(olMap) {
755
802
  }
756
803
 
757
804
  register(proj4);
758
- get(CRS.LEST97).setExtent(LEST97_EXTENT);
759
805
  function Map2D({ onEngineReady }) {
760
806
  const t = useTranslate();
761
807
  const mapRef = useRef(null);
762
808
  const olMap = useMemo(() => {
763
- const { bbox, zoom, rotation, constraintBbox, rotationAllowed } = useMapViewStore.getState();
809
+ const { bbox, zoom, rotation, constraintBbox, rotationAllowed, zoomCeiling } = useMapViewStore.getState();
764
810
  const { projection } = useProjectionStore.getState();
765
811
  return new OlMap({
766
812
  controls: [],
@@ -770,7 +816,13 @@ function Map2D({ onEngineReady }) {
770
816
  }),
771
817
  new CursorDragZoom()
772
818
  ]),
773
- view: createMapView(projection, constraintBbox, { bbox, zoom, rotation, rotationAllowed })
819
+ view: createMapView(projection, constraintBbox, {
820
+ bbox,
821
+ zoom,
822
+ rotation,
823
+ rotationAllowed,
824
+ zoomCeiling
825
+ })
774
826
  });
775
827
  }, []);
776
828
  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/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,EAA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AA,MAC1B,SAAS,YAAA,CAAa;AAAA,KACxB;AAEA,IAAA,MAAM,EAAE,UAAA,EAAW,GAAI,aAAA,CAAc,MAAM,CAAA;AAE3C,IAAA,OAAO,MAAM;AACX,MAAA,UAAA,EAAW;AAAA,IACb,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,aAAa,CAAC,CAAA;AAEzB,EAAA,sBAAA,CAAuB,KAAK,CAAA;AAC5B,EAAA,oBAAA,CAAqB,KAAK,CAAA;AAC1B,EAAA,eAAA,CAAgB,KAAK,CAAA;AACrB,EAAA,eAAA,CAAgB,KAAK,CAAA;AAErB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,MAAA;AAAA,MACL,QAAA,EAAU,CAAA;AAAA,MACV,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, IViewChange } 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: IViewChange) => 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: IViewChange = {\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 getZoomCeiling(zoomCeiling) {\n return zoomCeiling\n },\n }\n}\n","import type { EpsgCode, MapExtent, Radians, ZoomLevel } from '@xgis/xgis-common'\nimport {\n extentCenter,\n LEST97_EXTENT,\n MIN_ZOOM,\n resolutionForZoom,\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 readonly zoomCeiling: ZoomLevel\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 readonly zoomCeiling: ZoomLevel\n}\n\nfunction resolutionsUpTo(zoomCeiling: ZoomLevel): number[] {\n const resolutions = [...ZOOM_RESOLUTIONS]\n\n if (Number.isInteger(zoomCeiling)) {\n return resolutions\n }\n\n return Object.assign(resolutions, { [String(zoomCeiling)]: resolutionForZoom(zoomCeiling) })\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: resolutionsUpTo(seed.zoomCeiling),\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: seed.zoomCeiling,\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 zoomCeiling: defaults.zoomCeiling,\n })\n}\n\n/**\n * A View's extent and zoom ceiling are fixed at construction, so a new area or zoom ceiling means a new\n * View carrying the old one's 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 zoomCeiling: ZoomLevel,\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 zoomCeiling,\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 type EpsgCode,\n IKmlParams,\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} 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: IKmlParams): 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: IKmlParams): 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(\n params: IKmlParams,\n extractStyles: boolean,\n crs: EpsgCode,\n): 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,\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 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: tileset.crs,\n tileLoadFunction: paramsLoader(params),\n }),\n })\n}\n","import type { LayerPresentation, TmsSource } from '@xgis/xgis-common'\nimport {\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 } 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 if (!getProjection(tileMap.srs)) {\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 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 {\n type CrsAxisOrder,\n type EpsgCode,\n type LayerPresentation,\n type WmsSource,\n ZOOM_RESOLUTIONS,\n} from '@xgis/xgis-common'\nimport TileLayer from 'ol/layer/Tile'\nimport TileWMS from 'ol/source/TileWMS'\nimport TileGrid from 'ol/tilegrid/TileGrid'\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 tileGrid: new TileGrid({ origin: [0, 0], resolutions: [...ZOOM_RESOLUTIONS] }),\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 { EpsgCode, LayerPresentation, WmtsResourceUrl, WmtsSource } from '@xgis/xgis-common'\nimport {\n crsAxisOrder,\n fallbackTileTemplate,\n pickTileTemplate,\n stringifyParams,\n withQuery,\n} from '@xgis/xgis-common'\nimport type { Coordinate } from 'ol/coordinate'\nimport WMTSCapabilities from 'ol/format/WMTSCapabilities'\nimport TileLayer from 'ol/layer/Tile'\nimport { get as getProjection } from 'ol/proj'\nimport WMTS, { optionsFromCapabilities } from 'ol/source/WMTS'\n\ninterface CapsMatrixSet {\n SupportedCRS: string\n TileMatrix: { TopLeftCorner: Coordinate }[]\n}\n\ninterface CapsLayer {\n Identifier: string\n ResourceURL?: WmtsResourceUrl[]\n}\n\ninterface CapsDocument {\n Contents: { Layer?: CapsLayer[]; TileMatrixSet: CapsMatrixSet[] }\n}\n\n// OL swaps only when the registered projection is `ne*`; proj4 registers `enu` unless the definition sets +axis.\nfunction needsOriginSwap(code: string): boolean {\n if (getProjection(code)?.getAxisOrientation().startsWith('ne')) {\n return false\n }\n\n return crsAxisOrder(code) === 'northingFirst'\n}\n\nfunction withEastFirstOrigins(set: CapsMatrixSet): CapsMatrixSet {\n if (!needsOriginSwap(set.SupportedCRS)) {\n return set\n }\n\n return {\n ...set,\n TileMatrix: set.TileMatrix.map((matrix) => ({\n ...matrix,\n TopLeftCorner: [matrix.TopLeftCorner[1], matrix.TopLeftCorner[0]],\n })),\n }\n}\n\nexport function createWMTS(\n source: WmtsSource,\n presentation: LayerPresentation,\n capabilitiesText: string,\n crs: EpsgCode,\n): TileLayer | null {\n const parsed = new WMTSCapabilities().read(capabilitiesText) as CapsDocument | null\n\n if (!parsed?.Contents?.TileMatrixSet) {\n return null\n }\n\n // OL throws on a layer without ResourceURL unless GetTile advertises KVP.\n const caps: CapsDocument = {\n ...parsed,\n Contents: {\n ...parsed.Contents,\n Layer: parsed.Contents.Layer?.map((layer) => ({\n ...layer,\n ResourceURL: layer.ResourceURL ?? [],\n })),\n TileMatrixSet: parsed.Contents.TileMatrixSet.map(withEastFirstOrigins),\n },\n }\n\n const options = optionsFromCapabilities(caps, {\n layer: source.layer,\n projection: crs,\n style: source.styles ?? 'default',\n })\n\n if (!options) {\n return null\n }\n\n const resources = caps.Contents.Layer?.find(\n (layer) => layer.Identifier === source.layer,\n )?.ResourceURL\n\n const template =\n pickTileTemplate(resources, source.format) ??\n fallbackTileTemplate(source.href, source.layer, options.style)\n\n const url = withQuery(template, stringifyParams(source.params))\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: options.projection,\n requestEncoding: 'REST',\n dimensions: options.dimensions,\n tileGrid: options.tileGrid,\n wrapX: false,\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, crs) : null\n case 'kml':\n return createKML(source.params, kmlExtractStyles(source.params), crs)\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, ZoomLevel } 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// getMaxZoom is derived back from a resolution, so it carries float noise.\nconst ZOOM_EPSILON = 1e-9\n\nfunction sameZoomCeiling(view: OlView, zoomCeiling: ZoomLevel): boolean {\n return Math.abs(view.getMaxZoom() - zoomCeiling) < ZOOM_EPSILON\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 zoomCeiling: ZoomLevel,\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 zoomCeiling,\n })\n}\n\n/**\n * A View's projection, extent, zoom ceiling and rotation constraints are all fixed at\n * construction, so a new topic projection, bbox, minScale 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 const zoomCeiling = useMapViewStore((s) => s.zoomCeiling)\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 sameZoomCeiling(view, zoomCeiling)\n ) {\n return\n }\n\n const replacement = sameProjection\n ? reboundView(constraintBbox, view, rotationAllowed, zoomCeiling)\n : freshView(projection, constraintBbox, rotationAllowed, zoomCeiling)\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, zoomCeiling])\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 { IEngineRegistration, IMapEngine } from '@xgis/xgis-common'\nimport {\n createEngineErrorChannel,\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 { 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\ninterface Map2DProps {\n onEngineReady: (engine: IMapEngine) => IEngineRegistration\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, zoomCeiling } =\n 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, {\n bbox,\n zoom,\n rotation,\n rotationAllowed,\n zoomCeiling,\n }),\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,EAAmC;AACzD,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,GAAsB;AAAA,MAC1B,IAAA,EAAM,WAAA,CAAY,IAAA,EAAK,CAAE,iBAAqD,CAAA;AAAA,MAC9E,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,SAAS,MAAA,GAAe;AACtB,IAAA,UAAA,EAAW;AACX,IAAA,eAAA,CAAgB,OA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A,EAAQ,yBAAyB,KAAK,CAAA;AAAA,QACtC,UAAA,EAAY,6BAA6B,KAAK;AAAA,OAChD;AAAA,MACA,OAAA,GAAU;AACR,QAAA,KAAA,CAAM,UAAU,MAAS,CAAA;AAAA,MAC3B,CAAA;AAAA,MACA,aAAa,YAAA,CAAa,WAAA;AAAA,MAC1B,SAAS,YAAA,CAAa;AAAA,KACxB;AAEA,IAAA,MAAM,EAAE,UAAA,EAAW,GAAI,aAAA,CAAc,MAAM,CAAA;AAE3C,IAAA,OAAO,MAAM;AACX,MAAA,UAAA,EAAW;AAAA,IACb,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,aAAa,CAAC,CAAA;AAEzB,EAAA,sBAAA,CAAuB,KAAK,CAAA;AAC5B,EAAA,oBAAA,CAAqB,KAAK,CAAA;AAC1B,EAAA,eAAA,CAAgB,KAAK,CAAA;AACrB,EAAA,eAAA,CAAgB,KAAK,CAAA;AAErB,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,GAAA,EAAK,MAAA;AAAA,MACL,QAAA,EAAU,CAAA;AAAA,MACV,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 projection, extent and rotation constraints are all fixed at construction, so a new
4
- * topic projection, bbox or mapRotating means a new View.
3
+ * A View's projection, extent, zoom ceiling and rotation constraints are all fixed at
4
+ * construction, so a new topic projection, bbox, minScale or mapRotating means a new View.
5
5
  */
6
6
  export declare function useOlViewBounds(olMap: OlMap): void;
@@ -1,3 +1,3 @@
1
- import { KmlParams } from '@xgis/xgis-common';
1
+ import { type EpsgCode, IKmlParams } from '@xgis/xgis-common';
2
2
  import VectorLayer from 'ol/layer/Vector';
3
- export declare function createKML(params: KmlParams, extractStyles: boolean): VectorLayer | null;
3
+ export declare function createKML(params: IKmlParams, extractStyles: boolean, crs: EpsgCode): VectorLayer | null;
@@ -1,3 +1,3 @@
1
- import type { CrsAxisOrder, EpsgCode, LayerPresentation, WmsSource } from '@xgis/xgis-common';
1
+ import { type CrsAxisOrder, type EpsgCode, type LayerPresentation, type WmsSource } from '@xgis/xgis-common';
2
2
  import TileLayer from 'ol/layer/Tile';
3
3
  export declare function createWMS(source: WmsSource, presentation: LayerPresentation, crs: EpsgCode, axisOrder: CrsAxisOrder): TileLayer;
@@ -1,3 +1,3 @@
1
- import type { LayerPresentation, WmtsSource } from '@xgis/xgis-common';
1
+ import type { EpsgCode, LayerPresentation, WmtsSource } from '@xgis/xgis-common';
2
2
  import TileLayer from 'ol/layer/Tile';
3
- export declare function createWMTS(source: WmtsSource, presentation: LayerPresentation, capabilitiesText: string): TileLayer | null;
3
+ export declare function createWMTS(source: WmtsSource, presentation: LayerPresentation, capabilitiesText: string, crs: EpsgCode): TileLayer | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xgis/xgis2d",
3
- "version": "0.3.58",
3
+ "version": "0.4.2",
4
4
  "description": "XGIS 2D map engine, built on OpenLayers.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "peerDependencies": {
20
20
  "react": "^18.3.1 || ^19.0.0",
21
- "@xgis/xgis-common": "^0.3.58"
21
+ "@xgis/xgis-common": "^0.4.2"
22
22
  },
23
23
  "dependencies": {
24
24
  "ol": "10.11.0"
@@ -29,7 +29,6 @@
29
29
  "@testing-library/react": "^16.3.2",
30
30
  "@types/react": "^19.2.15",
31
31
  "@vitejs/plugin-react": "^4.7.0",
32
- "@vitest/coverage-v8": "^4.1.12",
33
32
  "react": "^19.2.6",
34
33
  "react-dom": "^19.2.6",
35
34
  "typescript": "^6.0.3",
@@ -37,8 +36,8 @@
37
36
  "vitest": "^4.1.12",
38
37
  "@xgis/eslint-config": "0.0.0",
39
38
  "@xgis/tsconfig": "0.0.0",
40
- "@xgis/xgis-common": "0.3.58",
41
- "@xgis/vitest-config": "0.0.0"
39
+ "@xgis/vitest-config": "0.0.0",
40
+ "@xgis/xgis-common": "0.4.2"
42
41
  },
43
42
  "scripts": {
44
43
  "dev": "vite --port 4201",
@@ -47,7 +46,6 @@
47
46
  "lint": "eslint src",
48
47
  "typecheck": "tsc --noEmit",
49
48
  "test": "vitest run",
50
- "test:coverage": "vitest run --coverage",
51
49
  "build:lib": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json"
52
50
  },
53
51
  "main": "./dist/index.js",