qwc2 2025.12.2 → 2025.12.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/actions/windows.js +2 -0
  2. package/components/Icon.js +9 -2
  3. package/components/IdentifyViewer.js +1 -1
  4. package/components/map3d/MapControls3D.js +7 -9
  5. package/components/map3d/style/MapControls3D.css +7 -2
  6. package/icons/oblique.svg +53 -0
  7. package/package.json +3 -2
  8. package/plugins/Cyclomedia.js +2 -1
  9. package/plugins/MapTip.js +1 -1
  10. package/plugins/ObliqueView.js +410 -0
  11. package/plugins/style/Map.css +4 -2
  12. package/plugins/style/ObliqueView.css +112 -0
  13. package/scripts/themesConfig.js +2 -0
  14. package/scripts/themesConfig.py +3 -0
  15. package/static/translations/bg-BG.json +5 -0
  16. package/static/translations/ca-ES.json +5 -0
  17. package/static/translations/cs-CZ.json +5 -0
  18. package/static/translations/de-CH.json +5 -0
  19. package/static/translations/de-DE.json +5 -0
  20. package/static/translations/en-US.json +5 -0
  21. package/static/translations/es-ES.json +5 -0
  22. package/static/translations/fi-FI.json +5 -0
  23. package/static/translations/fr-FR.json +5 -0
  24. package/static/translations/hu-HU.json +5 -0
  25. package/static/translations/it-IT.json +5 -0
  26. package/static/translations/ja-JP.json +5 -0
  27. package/static/translations/nl-NL.json +5 -0
  28. package/static/translations/no-NO.json +5 -0
  29. package/static/translations/pl-PL.json +5 -0
  30. package/static/translations/pt-BR.json +5 -0
  31. package/static/translations/pt-PT.json +5 -0
  32. package/static/translations/ro-RO.json +5 -0
  33. package/static/translations/ru-RU.json +5 -0
  34. package/static/translations/sv-SE.json +5 -0
  35. package/static/translations/tr-TR.json +5 -0
  36. package/static/translations/tsconfig.json +3 -0
  37. package/static/translations/uk-UA.json +5 -0
  38. package/utils/CoordinatesUtils.js +2 -0
  39. package/utils/EditingInterface.js +11 -2
  40. package/utils/MiscUtils.js +23 -0
  41. package/utils/VectorLayerUtils.js +10 -3
@@ -22,6 +22,7 @@ import ReducerIndex from '../reducers/index';
22
22
  import windowsReducer from '../reducers/windows';
23
23
  import ConfigUtils from '../utils/ConfigUtils';
24
24
  import CoordinatesUtils from '../utils/CoordinatesUtils';
25
+ import LocaleUtils from '../utils/LocaleUtils';
25
26
  import MapUtils from '../utils/MapUtils';
26
27
  import { UrlParams } from '../utils/PermaLinkUtils';
27
28
  ReducerIndex.register("windows", windowsReducer);
@@ -153,6 +154,7 @@ export function openExternalUrl(url) {
153
154
  url = url.replace('$y$', y);
154
155
  url = url.replace('$crs$', proj);
155
156
  url = url.replace('$user$', ConfigUtils.getConfigProp("username") || "");
157
+ url = url.replace('$lang$', LocaleUtils.lang());
156
158
  if (target.startsWith(":iframedialog")) {
157
159
  var targetParts = target.split(":");
158
160
  var options = targetParts.slice(2).reduce(function (res, cur) {
@@ -40,8 +40,15 @@ var Icon = /*#__PURE__*/function (_React$Component) {
40
40
  icon_disabled: this.props.disabled,
41
41
  icon_clickable: !!this.props.onClick || !!this.props.onMouseDown || !!this.props.onPointerDown
42
42
  }, "icon-" + this.props.icon, true), "icon_" + this.props.size, !!this.props.size), this.props.className, !!this.props.className));
43
- var tabIndex = this.props.onClick ? 0 : undefined;
44
- var onKeyDown = tabIndex !== undefined ? MiscUtils.checkKeyActivate : null;
43
+ var tabIndex = undefined;
44
+ var onKeyDown = null;
45
+ if (this.props.onClick) {
46
+ tabIndex = 0;
47
+ onKeyDown = MiscUtils.checkKeyActivate;
48
+ } else if (this.props.onPointerDown) {
49
+ tabIndex = 0;
50
+ onKeyDown = MiscUtils.checkKeyActivatePointerDown;
51
+ }
45
52
  if (this.props.icon.startsWith(":/")) {
46
53
  var assetsPath = ConfigUtils.getAssetsPath();
47
54
  var src = assetsPath + this.props.icon.substr(1);
@@ -1100,7 +1100,7 @@ var IdentifyViewer = /*#__PURE__*/function (_React$Component) {
1100
1100
  return htmlReactParser(text, options);
1101
1101
  });
1102
1102
  _defineProperty(_this, "attributeLinkClicked", function (ev) {
1103
- _this.props.openExternalUrl(ev.currentTarget.href, ev.target.target, {
1103
+ _this.props.openExternalUrl(ev.currentTarget.href, ev.currentTarget.target, {
1104
1104
  docked: _this.props.iframeDialogsInitiallyDocked
1105
1105
  });
1106
1106
  ev.preventDefault();
@@ -348,28 +348,26 @@ var MapControls3D = /*#__PURE__*/function (_React$Component) {
348
348
  style: {
349
349
  order: 998
350
350
  }
351
- }, /*#__PURE__*/React.createElement("div", {
351
+ }, /*#__PURE__*/React.createElement(Icon, {
352
+ icon: "plus",
352
353
  onPointerDown: function onPointerDown(ev) {
353
354
  return _this2.zoom(ev, +1);
354
355
  }
355
- }, /*#__PURE__*/React.createElement(Icon, {
356
- icon: "plus"
357
- })), /*#__PURE__*/React.createElement("div", {
356
+ }), /*#__PURE__*/React.createElement(Icon, {
357
+ icon: "minus",
358
358
  onPointerDown: function onPointerDown(ev) {
359
359
  return _this2.zoom(ev, -1);
360
360
  }
361
- }, /*#__PURE__*/React.createElement(Icon, {
362
- icon: "minus"
363
- }))) : null, this.context), /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", {
361
+ })) : null, this.context), /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", {
364
362
  className: firstPersonButtonClasses,
365
363
  "data-slot": 0,
366
364
  key: "MapControlsFirstPerson",
367
- onClick: this.toggleFirstPersonControls,
368
365
  style: {
369
366
  order: 997
370
367
  }
371
368
  }, /*#__PURE__*/React.createElement(Icon, {
372
- icon: "person"
369
+ icon: "person",
370
+ onClick: this.toggleFirstPersonControls
373
371
  })), this.context), this.props.controlsPosition !== 'bottom' ? /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", {
374
372
  className: "map3d-nav-spacer",
375
373
  key: "MapControlsSpacer",
@@ -39,7 +39,7 @@ div.map3d-nav-zoom {
39
39
  margin: 0 1em 0.5em 1em;
40
40
  }
41
41
 
42
- div.map3d-nav-zoom > div {
42
+ div.map3d-nav-zoom > span {
43
43
  height: 2em;
44
44
  width: 1.5em;
45
45
  display: flex;
@@ -47,7 +47,7 @@ div.map3d-nav-zoom > div {
47
47
  justify-content: center;
48
48
  }
49
49
 
50
- div.map3d-nav-zoom > div:first-child {
50
+ div.map3d-nav-zoom > span:first-child {
51
51
  border-bottom: 1px solid var(--map-button-text-color);
52
52
  }
53
53
 
@@ -74,6 +74,11 @@ div.map3d-firstperson-button-active {
74
74
  color: var(--map-button-bg-color);
75
75
  }
76
76
 
77
+ div.map3d-firstperson-button > span {
78
+ width: 2em;
79
+ height: 2em;
80
+ }
81
+
77
82
  div.map3d-nav-spacer {
78
83
  display: inline-block;
79
84
  width: 1em;
@@ -0,0 +1,53 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ width="24"
4
+ height="24"
5
+ version="1.1"
6
+ id="svg1"
7
+ sodipodi:docname="oblique.svg"
8
+ inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
9
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ xmlns:svg="http://www.w3.org/2000/svg">
13
+ <defs
14
+ id="defs1">
15
+ <inkscape:path-effect
16
+ effect="perspective-envelope"
17
+ up_left_point="31.84,8.235"
18
+ up_right_point="118.21,8.235"
19
+ down_left_point="6.84,117.332"
20
+ down_right_point="143.209,117.332"
21
+ id="path-effect1"
22
+ is_visible="true"
23
+ lpeversion="1"
24
+ deform_type="perspective"
25
+ horizontal_mirror="false"
26
+ vertical_mirror="false"
27
+ overflow_perspective="false" />
28
+ </defs>
29
+ <sodipodi:namedview
30
+ id="namedview1"
31
+ pagecolor="#ffffff"
32
+ bordercolor="#666666"
33
+ borderopacity="1.0"
34
+ inkscape:showpageshadow="2"
35
+ inkscape:pageopacity="0.0"
36
+ inkscape:pagecheckerboard="0"
37
+ inkscape:deskcolor="#d1d1d1"
38
+ inkscape:zoom="3.59479"
39
+ inkscape:cx="50.211556"
40
+ inkscape:cy="55.775164"
41
+ inkscape:window-width="1600"
42
+ inkscape:window-height="842"
43
+ inkscape:window-x="0"
44
+ inkscape:window-y="0"
45
+ inkscape:window-maximized="1"
46
+ inkscape:current-layer="svg1" />
47
+ <path
48
+ d="m 139.33138,100.40986 c 2.07628,9.061 -1.23538,16.92214 -7.48538,16.92214 H 18.203 c -6.25,0 -9.5619324,-7.85964 -7.485227,-16.92214 L 30.125343,15.717557 C 31.084946,11.529963 35.078345,8.235 39.036814,8.235 h 71.976376 c 3.95847,0 7.95183,3.294963 8.9114,7.482557 z M 37.902612,14.17429 c -0.788552,0 -1.627148,0.722405 -1.790034,1.542582 L 19.292985,100.40846 c -0.338692,1.70541 0.375285,3.22606 1.525768,3.22606 H 129.23037 c 1.14762,0 1.86732,-1.52065 1.52863,-3.22606 L 113.93933,15.716872 c -0.16289,-0.820177 -1.00606,-1.542582 -1.792,-1.542582 z m 9.9385,28.041591 c -5.628345,0 -9.313113,-5.26189 -8.279299,-11.413497 0.976861,-5.812713 5.854252,-10.301547 10.933143,-10.301547 5.076868,0 8.852895,4.488834 8.40881,10.301547 -0.469976,6.151607 -5.435804,11.413497 -11.062654,11.413497 z M 120.62564,91.150498 H 29.419956 L 32.243929,74.346727 53.872491,50.541182 62.079678,61.858035 89.407567,29.014214 114.54115,54.940506 Z"
49
+ id="path1"
50
+ inkscape:path-effect="#path-effect1"
51
+ inkscape:original-d="m 143.209,105.968 c 0,6.25 -5.113,11.364 -11.363,11.364 H 18.203 c -6.25,0 -11.363,-5.113 -11.363,-11.364 v -86.37 c 0,-6.25 5.113,-11.363 11.363,-11.363 h 113.643 c 6.25,0 11.363,5.113 11.363,11.363 z M 18.203,17.326 c -1.207,0 -2.271,1.068 -2.271,2.271 v 86.37 c 0,1.207 1.065,2.271 2.271,2.271 h 113.643 c 1.203,0 2.274,-1.064 2.274,-2.271 v -86.37 c 0,-1.203 -1.071,-2.271 -2.274,-2.271 H 18.203 Z m 20.458,36.365 c -7.529,0 -13.641,-6.108 -13.641,-13.635 0,-7.527 6.112,-13.638 13.641,-13.638 7.526,0 13.632,6.111 13.632,13.638 0,7.527 -6.105,13.635 -13.632,13.635 z M 125.025,99.15 H 25.02 V 85.51 l 22.73,-22.724 11.363,11.36 36.365,-36.361 29.547,29.547 z"
52
+ transform="matrix(0.16942427,0,0,0.16942427,-0.71096897,1.3629513)" />
53
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qwc2",
3
- "version": "2025.12.02",
3
+ "version": "2025.12.15",
4
4
  "description": "QGIS Web Client",
5
5
  "author": "Sourcepole AG",
6
6
  "license": "BSD-2-Clause",
@@ -17,7 +17,6 @@
17
17
  ],
18
18
  "dependencies": {
19
19
  "@furkot/webfonts-generator": "^2.0.2",
20
- "@sourcepole/qwc-giro3d": "^0.44.0-dev",
21
20
  "@kayahr/text-encoding": "^2.0.0",
22
21
  "@loaders.gl/core": "^4.3.3",
23
22
  "@loaders.gl/shapefile": "^4.3.3",
@@ -26,7 +25,9 @@
26
25
  "@norbulcz/num-parse": "^0.1.0",
27
26
  "@panoramax/web-viewer": "^4.0.1",
28
27
  "@reduxjs/toolkit": "^2.4.0",
28
+ "@sourcepole/qwc-giro3d": "^0.44.0-dev",
29
29
  "@turf/buffer": "^6.5.0",
30
+ "@turf/clean-coords": "^7.3.1",
30
31
  "@turf/helpers": "^6.5.0",
31
32
  "@vtaits/react-color-picker": "^2.0.0",
32
33
  "any-date-parser": "^1.5.4",
@@ -173,6 +173,7 @@ var Cyclomedia = /*#__PURE__*/function (_React$Component) {
173
173
  }
174
174
  });
175
175
  _defineProperty(_this, "cyclomediaIndexHtml", function () {
176
+ var _window$__CSP_NONCE__, _window$__CSP_NONCE__2, _window$__CSP_NONCE__3, _window$__CSP_NONCE__4;
176
177
  var supportedLang = ["de", "en-GB", "en-US", "fi", "fr", "nl", "tr", "pl"];
177
178
  var lang = LocaleUtils.lang();
178
179
  if (supportedLang.indexOf(lang) < 0) {
@@ -182,7 +183,7 @@ var Cyclomedia = /*#__PURE__*/function (_React$Component) {
182
183
  }
183
184
  }
184
185
  var loginOauth = !!_this.props.clientId && !_this.state.loginFailed;
185
- return "\n <!DOCTYPE html>\n <html>\n <head>\n <script type=\"text/javascript\" src=\"https://unpkg.com/react@18.3.1/umd/react.production.min.js\"></script>\n <script type=\"text/javascript\" src=\"https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js\"></script>\n <script type=\"text/javascript\" src=\"https://streetsmart.cyclomedia.com/api/v".concat(_this.props.cyclomediaVersion, "/StreetSmartApi.js\"></script>\n <script type=\"text/javascript\">\n let apiInitialized = false;\n let initCallback = null;\n let posCallback = null;\n let measureCallback = null;\n\n function initApi() {\n StreetSmartApi.init({\n targetElement: document.getElementById(\"streetsmartApi\"),\n username: \"").concat(_this.state.username || undefined, "\",\n password: \"").concat(_this.state.password || undefined, "\",\n apiKey: \"").concat(_this.props.apikey, "\",\n clientId: \"").concat(_this.props.clientId, "\",\n loginOauth: ").concat(loginOauth, ",\n loginRedirectUri: \"").concat(_this.props.loginRedirectUri, "\",\n logoutRedirectUri: \"").concat(_this.props.logoutRedirectUri, "\",\n srs: \"").concat(_this.props.projection, "\",\n locale: \"").concat(lang, "\",\n configurationUrl: 'https://atlas.cyclomedia.com/configuration',\n addressSettings: {\n locale: \"us\",\n database: \"Nokia\"\n }\n }).then(() => {\n apiInitialized = true;\n if (initCallback) {\n initCallback(true);\n }\n }, (e) => {\n apiInitialized = false;\n if (initCallback) {\n initCallback(false, e.message);\n }\n });\n }\n function openImage(posStr, crs) {\n if (!apiInitialized) {\n return;\n }\n StreetSmartApi.open(posStr, {\n viewerType: StreetSmartApi.ViewerType.PANORAMA,\n srs: crs,\n panoramaViewer: {\n closable: false,\n maximizable: true,\n replace: true,\n recordingsVisible: true,\n navbarVisible: true,\n timeTravelVisible: true,\n measureTypeButtonVisible: true,\n measureTypeButtonStart: true,\n measureTypeButtonToggle: true,\n },\n }).then((result) => {\n if (result && result[0]){\n window.panoramaViewer = result[0];\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.IMAGE_CHANGE, changeView);\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.VIEW_CHANGE, changeView);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_CHANGED, changeMeasurement);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_STOPPED, stopMeasurement);\n }\n }).catch((reason) => {\n console.log('Failed to create component(s) through API: ' + reason);\n });\n }\n function changeView() {\n if (posCallback) {\n const recording = window.panoramaViewer.getRecording();\n const orientation = window.panoramaViewer.getOrientation();\n const pos = recording.xyz;\n const posData = {\n pos: [pos[0], pos[1]],\n crs: recording.srs,\n yaw: orientation.yaw * Math.PI / 180,\n hFov: orientation.hFov * Math.PI / 180.0\n }\n posCallback(posData);\n }\n }\n function changeMeasurement(e) {\n measureCallback(e.detail.activeMeasurement);\n }\n function stopMeasurement() {\n measureCallback(null);\n }\n function registerCallbacks(_initCallback, _posCallback, _measureCallback) {\n initCallback = _initCallback;\n posCallback = _posCallback;\n measureCallback = _measureCallback;\n }\n </script>\n <style>\n html, body, #streetsmartApi {height: 100%;}\n </style>\n </head>\n <body style=\"margin: 0\">\n <div id=\"streetsmartApi\">\n </div>\n </body>\n </html>\n ");
186
+ return "\n <!DOCTYPE html>\n <html>\n <head>\n <script nonce=\"".concat((_window$__CSP_NONCE__ = window.__CSP_NONCE__) !== null && _window$__CSP_NONCE__ !== void 0 ? _window$__CSP_NONCE__ : '', "\" type=\"text/javascript\" src=\"https://unpkg.com/react@18.3.1/umd/react.production.min.js\"></script>\n <script nonce=\"").concat((_window$__CSP_NONCE__2 = window.__CSP_NONCE__) !== null && _window$__CSP_NONCE__2 !== void 0 ? _window$__CSP_NONCE__2 : '', "\" type=\"text/javascript\" src=\"https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js\"></script>\n <script nonce=\"").concat((_window$__CSP_NONCE__3 = window.__CSP_NONCE__) !== null && _window$__CSP_NONCE__3 !== void 0 ? _window$__CSP_NONCE__3 : '', "\" type=\"text/javascript\" src=\"https://streetsmart.cyclomedia.com/api/v").concat(_this.props.cyclomediaVersion, "/StreetSmartApi.js\"></script>\n <script nonce=\"").concat((_window$__CSP_NONCE__4 = window.__CSP_NONCE__) !== null && _window$__CSP_NONCE__4 !== void 0 ? _window$__CSP_NONCE__4 : '', "\" type=\"text/javascript\">\n let apiInitialized = false;\n let initCallback = null;\n let posCallback = null;\n let measureCallback = null;\n\n function initApi() {\n StreetSmartApi.init({\n targetElement: document.getElementById(\"streetsmartApi\"),\n username: \"").concat(_this.state.username || undefined, "\",\n password: \"").concat(_this.state.password || undefined, "\",\n apiKey: \"").concat(_this.props.apikey, "\",\n clientId: \"").concat(_this.props.clientId, "\",\n loginOauth: ").concat(loginOauth, ",\n loginRedirectUri: \"").concat(_this.props.loginRedirectUri, "\",\n logoutRedirectUri: \"").concat(_this.props.logoutRedirectUri, "\",\n srs: \"").concat(_this.props.projection, "\",\n locale: \"").concat(lang, "\",\n configurationUrl: 'https://atlas.cyclomedia.com/configuration',\n addressSettings: {\n locale: \"us\",\n database: \"Nokia\"\n }\n }).then(() => {\n apiInitialized = true;\n if (initCallback) {\n initCallback(true);\n }\n }, (e) => {\n apiInitialized = false;\n if (initCallback) {\n initCallback(false, e.message);\n }\n });\n }\n function openImage(posStr, crs) {\n if (!apiInitialized) {\n return;\n }\n StreetSmartApi.open(posStr, {\n viewerType: StreetSmartApi.ViewerType.PANORAMA,\n srs: crs,\n panoramaViewer: {\n closable: false,\n maximizable: true,\n replace: true,\n recordingsVisible: true,\n navbarVisible: true,\n timeTravelVisible: true,\n measureTypeButtonVisible: true,\n measureTypeButtonStart: true,\n measureTypeButtonToggle: true,\n },\n }).then((result) => {\n if (result && result[0]){\n window.panoramaViewer = result[0];\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.IMAGE_CHANGE, changeView);\n window.panoramaViewer.on(StreetSmartApi.Events.panoramaViewer.VIEW_CHANGE, changeView);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_CHANGED, changeMeasurement);\n StreetSmartApi.on(StreetSmartApi.Events.measurement.MEASUREMENT_STOPPED, stopMeasurement);\n }\n }).catch((reason) => {\n console.log('Failed to create component(s) through API: ' + reason);\n });\n }\n function changeView() {\n if (posCallback) {\n const recording = window.panoramaViewer.getRecording();\n const orientation = window.panoramaViewer.getOrientation();\n const pos = recording.xyz;\n const posData = {\n pos: [pos[0], pos[1]],\n crs: recording.srs,\n yaw: orientation.yaw * Math.PI / 180,\n hFov: orientation.hFov * Math.PI / 180.0\n }\n posCallback(posData);\n }\n }\n function changeMeasurement(e) {\n measureCallback(e.detail.activeMeasurement);\n }\n function stopMeasurement() {\n measureCallback(null);\n }\n function registerCallbacks(_initCallback, _posCallback, _measureCallback) {\n initCallback = _initCallback;\n posCallback = _posCallback;\n measureCallback = _measureCallback;\n }\n </script>\n <style>\n html, body, #streetsmartApi {height: 100%;}\n </style>\n </head>\n <body style=\"margin: 0\">\n <div id=\"streetsmartApi\">\n </div>\n </body>\n </html>\n ");
186
187
  });
187
188
  _defineProperty(_this, "addRecordingsWFS", function () {
188
189
  var layer = {
package/plugins/MapTip.js CHANGED
@@ -177,7 +177,7 @@ var MapTip = /*#__PURE__*/function (_React$Component) {
177
177
  return htmlReactParser(text, options);
178
178
  });
179
179
  _defineProperty(_this, "attributeLinkClicked", function (ev) {
180
- _this.props.openExternalUrl(ev.currentTarget.href, ev.target.target, {
180
+ _this.props.openExternalUrl(ev.currentTarget.href, ev.currentTarget.target, {
181
181
  docked: _this.props.iframeDialogsInitiallyDocked
182
182
  });
183
183
  ev.preventDefault();
@@ -0,0 +1,410 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
4
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
5
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
6
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
7
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
8
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
9
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
10
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
11
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
12
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ /**
16
+ * Copyright 2025 Sourcepole AG
17
+ * All rights reserved.
18
+ *
19
+ * This source code is licensed under the BSD-style license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ */
22
+
23
+ import React from 'react';
24
+ import { connect } from 'react-redux';
25
+ import axios from 'axios';
26
+ import ol from 'openlayers';
27
+ import PropTypes from 'prop-types';
28
+ import { setCurrentTask } from '../actions/task';
29
+ import Icon from '../components/Icon';
30
+ import ResizeableWindow from '../components/ResizeableWindow';
31
+ import LayerRegistry from '../components/map/layers/index';
32
+ import InputContainer from '../components/widgets/InputContainer';
33
+ import ConfigUtils from '../utils/ConfigUtils';
34
+ import LayerUtils from '../utils/LayerUtils';
35
+ import LocaleUtils from '../utils/LocaleUtils';
36
+ import MapUtils from '../utils/MapUtils';
37
+ import MiscUtils from '../utils/MiscUtils';
38
+ import './style/ObliqueView.css';
39
+
40
+ /**
41
+ * Display oblique satellite imagery.
42
+ */
43
+ var ObliqueView = /*#__PURE__*/function (_React$Component) {
44
+ function ObliqueView(props) {
45
+ var _this;
46
+ _classCallCheck(this, ObliqueView);
47
+ _this = _callSuper(this, ObliqueView, [props]);
48
+ _defineProperty(_this, "onClose", function () {
49
+ _this.setState(ObliqueView.defaultState);
50
+ });
51
+ _defineProperty(_this, "renderScaleChooser", function () {
52
+ return /*#__PURE__*/React.createElement("div", {
53
+ className: "obliqueview-scalechooser"
54
+ }, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("bottombar.scale_label"), ":\xA0"), /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement("span", {
55
+ role: "prefix"
56
+ }, " 1 : "), /*#__PURE__*/React.createElement("select", {
57
+ onChange: function onChange(ev) {
58
+ return _this.setState({
59
+ currentZoom: parseInt(ev.target.value, 10)
60
+ });
61
+ },
62
+ role: "input",
63
+ value: _this.state.currentZoom
64
+ }, _this.props.scales.map(function (item, index) {
65
+ return /*#__PURE__*/React.createElement("option", {
66
+ key: index,
67
+ value: index
68
+ }, LocaleUtils.toLocaleFixed(item, 0));
69
+ }))));
70
+ });
71
+ _defineProperty(_this, "changeZoom", function (delta) {
72
+ _this.setState(function (state) {
73
+ return {
74
+ currentZoom: Math.max(0, Math.min(state.currentZoom + delta, _this.props.scales.length - 1))
75
+ };
76
+ });
77
+ });
78
+ _defineProperty(_this, "queryDatasetConfig", function () {
79
+ var obliqueImageryServiceUrl = ConfigUtils.getConfigProp('obliqueImageryServiceUrl');
80
+ if (_this.state.selectedDataset && obliqueImageryServiceUrl) {
81
+ var reqUrl = obliqueImageryServiceUrl.replace(/\/$/, '') + "/".concat(_this.state.selectedDataset, "/config");
82
+ axios.get(reqUrl).then(function (response) {
83
+ var datasetConfig = response.data;
84
+ var direction = 'n' in datasetConfig.image_centers ? 'n' : Object.keys(datasetConfig.image_centers)[0];
85
+ _this.setState({
86
+ datasetConfig: datasetConfig,
87
+ currentDirection: direction
88
+ });
89
+ })["catch"](function () {
90
+ /* eslint-disable-next-line */
91
+ console.warn("Failed to load dataset config");
92
+ });
93
+ }
94
+ });
95
+ _defineProperty(_this, "setupLayer", function () {
96
+ var datasetConfig = _this.state.datasetConfig;
97
+ var projection = new ol.proj.Projection({
98
+ code: datasetConfig.crs,
99
+ extent: datasetConfig.extent,
100
+ units: "m"
101
+ });
102
+ var targetScale = _this.props.initialScale;
103
+ var zoom = _this.props.scales.reduce(function (best, v, i) {
104
+ return Math.abs(v - targetScale) < Math.abs(_this.props.scales[best] - targetScale) ? i : best;
105
+ }, 0);
106
+ _this.map.setView(new ol.View({
107
+ projection: projection,
108
+ // extent: datasetConfig.extent,
109
+ center: ol.extent.getCenter(datasetConfig.extent),
110
+ rotation: _this.getRotation() / 180 * Math.PI,
111
+ zoom: zoom,
112
+ resolutions: MapUtils.getResolutionsForScales(_this.props.scales, datasetConfig.crs),
113
+ constrainResolution: true
114
+ // showFullExtent: true
115
+ }));
116
+ _this.setState({
117
+ currentZoom: zoom
118
+ });
119
+ _this.map.on('moveend', function () {
120
+ _this.setState(function (state) {
121
+ var newZoom = _this.map.getView().getZoom();
122
+ if (newZoom !== state.currentZoom) {
123
+ return {
124
+ currentZoom: newZoom
125
+ };
126
+ }
127
+ return null;
128
+ });
129
+ });
130
+ var layers = [];
131
+ var themeConfig = _this.props.theme.obliqueDatasets.find(function (entry) {
132
+ return entry.name === _this.state.selectedDataset;
133
+ });
134
+ if (themeConfig.backgroundLayer) {
135
+ var _themeConfig$backgrou;
136
+ var layerConfig = LayerUtils.splitLayerUrlParam(themeConfig.backgroundLayer);
137
+ layerConfig.version = _this.props.themes.defaultWMSVersion || "1.3.0";
138
+ layerConfig.opacity = (_themeConfig$backgrou = themeConfig.backgroundOpacity) !== null && _themeConfig$backgrou !== void 0 ? _themeConfig$backgrou : 127;
139
+ var layerCreator = LayerRegistry[layerConfig.type];
140
+ if (layerCreator) {
141
+ layers.push(layerCreator.create(layerConfig, _this.map));
142
+ }
143
+ }
144
+ _this.obliqueImageryLayer = new ol.layer.Tile({
145
+ source: new ol.source.XYZ({
146
+ projection: projection,
147
+ tileGrid: new ol.tilegrid.TileGrid({
148
+ extent: datasetConfig.extent,
149
+ resolutions: datasetConfig.resolutions,
150
+ tileSize: datasetConfig.tileSize,
151
+ origin: datasetConfig.origin
152
+ }),
153
+ url: datasetConfig.url,
154
+ crossOrigin: "anonymous",
155
+ tileLoadFunction: function tileLoadFunction(tile, src) {
156
+ var _this$closestImage;
157
+ if (((_this$closestImage = _this.closestImage) !== null && _this$closestImage !== void 0 ? _this$closestImage : null) !== null) {
158
+ src += "?img=" + _this.closestImage;
159
+ }
160
+ tile.getImage().src = src.replace('{direction}', _this.state.currentDirection);
161
+ }
162
+ })
163
+ });
164
+ layers.push(_this.obliqueImageryLayer);
165
+ _this.map.setLayers(layers);
166
+ });
167
+ _defineProperty(_this, "searchClosestImage", function () {
168
+ var _this$state$datasetCo;
169
+ var best = null;
170
+ var imageCenters = (_this$state$datasetCo = _this.state.datasetConfig) === null || _this$state$datasetCo === void 0 || (_this$state$datasetCo = _this$state$datasetCo.image_centers) === null || _this$state$datasetCo === void 0 ? void 0 : _this$state$datasetCo[_this.state.currentDirection];
171
+ if (imageCenters) {
172
+ var center = _this.map.getView().getCenter();
173
+ var dsqr = function dsqr(p, q) {
174
+ return (p[0] - q[0]) * (p[0] - q[0]) + (p[1] - q[1]) * (p[1] - q[1]);
175
+ };
176
+ best = 0;
177
+ var bestDist = dsqr(center, imageCenters[0]);
178
+ for (var i = 1; i < imageCenters.length; ++i) {
179
+ var dist = dsqr(center, imageCenters[i]);
180
+ if (dist < bestDist) {
181
+ bestDist = dist;
182
+ best = i;
183
+ }
184
+ }
185
+ }
186
+ if (best !== _this.closestImage) {
187
+ if (_this.obliqueImageryLayer) {
188
+ _this.obliqueImageryLayer.getSource().refresh();
189
+ }
190
+ _this.closestImage = best;
191
+ }
192
+ });
193
+ _defineProperty(_this, "getRotation", function () {
194
+ return {
195
+ n: 0,
196
+ w: 90,
197
+ e: -90,
198
+ s: 180
199
+ }[_this.state.currentDirection];
200
+ });
201
+ var controls = ol.control.defaults({
202
+ zoom: false,
203
+ attribution: false,
204
+ rotate: false
205
+ });
206
+ var interactions = ol.interaction.defaults({
207
+ onFocusOnly: false
208
+ });
209
+ _this.map = new ol.Map({
210
+ controls: controls,
211
+ interactions: interactions
212
+ });
213
+ _this.map.on('moveend', _this.searchClosestImage);
214
+ _this.map.on('rotateend', _this.searchClosestImage);
215
+ _this.closestImage = null;
216
+ _this.obliqueImageryLayer = null;
217
+ _this.state = ObliqueView.defaultState;
218
+ return _this;
219
+ }
220
+ _inherits(ObliqueView, _React$Component);
221
+ return _createClass(ObliqueView, [{
222
+ key: "componentDidUpdate",
223
+ value: function componentDidUpdate(prevProps, prevState) {
224
+ if (this.props.active && !prevProps.active) {
225
+ this.setState({
226
+ active: true
227
+ });
228
+ this.props.setCurrentTask(null);
229
+ }
230
+ if (this.props.active && this.props.theme && this.props.theme !== prevProps.theme || this.props.active && !prevProps.active) {
231
+ var _datasets$find$name, _datasets$find, _datasets$;
232
+ var datasets = this.props.theme.obliqueDatasets || [];
233
+ var defaultDataset = (_datasets$find$name = (_datasets$find = datasets.find(function (entry) {
234
+ return entry["default"];
235
+ })) === null || _datasets$find === void 0 ? void 0 : _datasets$find.name) !== null && _datasets$find$name !== void 0 ? _datasets$find$name : (_datasets$ = datasets[0]) === null || _datasets$ === void 0 ? void 0 : _datasets$.name;
236
+ this.setState({
237
+ selectedDataset: defaultDataset,
238
+ datasetConfig: null,
239
+ currentDirection: null
240
+ });
241
+ }
242
+ if (this.state.selectedDataset !== prevState.selectedDataset) {
243
+ this.closestImage = null;
244
+ this.obliqueImageryLayer = null;
245
+ this.queryDatasetConfig();
246
+ }
247
+ if (this.state.datasetConfig && this.state.datasetConfig !== prevState.datasetConfig) {
248
+ this.setupLayer();
249
+ }
250
+ if (this.state.datasetConfig && this.state.currentDirection !== prevState.currentDirection) {
251
+ var _this$obliqueImageryL, _this$obliqueImageryL2, _this$obliqueImageryL3, _this$map$getView, _this$map$getView$set;
252
+ (_this$obliqueImageryL = this.obliqueImageryLayer) === null || _this$obliqueImageryL === void 0 || (_this$obliqueImageryL2 = _this$obliqueImageryL.getSource) === null || _this$obliqueImageryL2 === void 0 || (_this$obliqueImageryL2 = _this$obliqueImageryL2.call(_this$obliqueImageryL)) === null || _this$obliqueImageryL2 === void 0 || (_this$obliqueImageryL3 = _this$obliqueImageryL2.refresh) === null || _this$obliqueImageryL3 === void 0 || _this$obliqueImageryL3.call(_this$obliqueImageryL2);
253
+ (_this$map$getView = this.map.getView()) === null || _this$map$getView === void 0 || (_this$map$getView$set = _this$map$getView.setRotation) === null || _this$map$getView$set === void 0 || _this$map$getView$set.call(_this$map$getView, this.getRotation() / 180 * Math.PI);
254
+ }
255
+ if (this.state.datasetConfig && this.state.currentZoom !== prevState.currentZoom) {
256
+ var _this$map$getView2, _this$map$getView2$se;
257
+ (_this$map$getView2 = this.map.getView()) === null || _this$map$getView2 === void 0 || (_this$map$getView2$se = _this$map$getView2.setZoom) === null || _this$map$getView2$se === void 0 || _this$map$getView2$se.call(_this$map$getView2, this.state.currentZoom);
258
+ }
259
+ }
260
+ }, {
261
+ key: "render",
262
+ value: function render() {
263
+ var _this2 = this;
264
+ if (!this.state.active) {
265
+ return null;
266
+ }
267
+ var rot = this.getRotation();
268
+ return /*#__PURE__*/React.createElement(ResizeableWindow, {
269
+ dockable: this.props.geometry.side,
270
+ icon: "oblique",
271
+ initialHeight: this.props.geometry.initialHeight,
272
+ initialWidth: this.props.geometry.initialWidth,
273
+ initialX: this.props.geometry.initialX,
274
+ initialY: this.props.geometry.initialY,
275
+ initiallyDocked: this.props.geometry.initiallyDocked,
276
+ onClose: this.onClose,
277
+ splitScreenWhenDocked: true,
278
+ splitTopAndBottomBar: true,
279
+ title: LocaleUtils.tr("obliqueview.title")
280
+ }, /*#__PURE__*/React.createElement("div", {
281
+ className: "obliqueview-body"
282
+ }, /*#__PURE__*/React.createElement("div", {
283
+ className: "obliqueview-map",
284
+ ref: function ref(el) {
285
+ return _this2.map.setTarget(el);
286
+ },
287
+ tabIndex: 0
288
+ }), !this.state.selectedDataset && /*#__PURE__*/React.createElement("div", {
289
+ className: "obliqueview-empty-overlay"
290
+ }, LocaleUtils.tr("obliqueview.nodataset")), /*#__PURE__*/React.createElement("div", {
291
+ className: "obliqueview-nav-rotate",
292
+ style: {
293
+ transform: "rotate(".concat(rot, "deg)")
294
+ }
295
+ }, /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", {
296
+ className: "obliqueview-nav-dir",
297
+ onClick: function onClick() {
298
+ return _this2.setState({
299
+ currentDirection: "n"
300
+ });
301
+ },
302
+ onKeyDown: MiscUtils.checkKeyActivate,
303
+ style: {
304
+ transform: "rotate(".concat(-rot, "deg)")
305
+ },
306
+ tabIndex: 0
307
+ }, "N"), /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", {
308
+ className: "obliqueview-nav-dir",
309
+ onClick: function onClick() {
310
+ return _this2.setState({
311
+ currentDirection: "w"
312
+ });
313
+ },
314
+ onKeyDown: MiscUtils.checkKeyActivate,
315
+ style: {
316
+ transform: "rotate(".concat(-rot, "deg)")
317
+ },
318
+ tabIndex: 0
319
+ }, "W"), /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", {
320
+ className: "obliqueview-nav-dir",
321
+ onClick: function onClick() {
322
+ return _this2.setState({
323
+ currentDirection: "e"
324
+ });
325
+ },
326
+ onKeyDown: MiscUtils.checkKeyActivate,
327
+ style: {
328
+ transform: "rotate(".concat(-rot, "deg)")
329
+ },
330
+ tabIndex: 0
331
+ }, "E"), /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("span", {
332
+ className: "obliqueview-nav-dir",
333
+ onClick: function onClick() {
334
+ return _this2.setState({
335
+ currentDirection: "s"
336
+ });
337
+ },
338
+ onKeyDown: MiscUtils.checkKeyActivate,
339
+ style: {
340
+ transform: "rotate(".concat(-rot, "deg)")
341
+ },
342
+ tabIndex: 0
343
+ }, "S"), /*#__PURE__*/React.createElement("span", null)), /*#__PURE__*/React.createElement("div", {
344
+ className: "obliqueview-nav-zoom"
345
+ }, /*#__PURE__*/React.createElement(Icon, {
346
+ icon: "plus",
347
+ onClick: function onClick() {
348
+ return _this2.changeZoom(+1);
349
+ }
350
+ }), /*#__PURE__*/React.createElement(Icon, {
351
+ icon: "minus",
352
+ onClick: function onClick() {
353
+ return _this2.changeZoom(-1);
354
+ }
355
+ })), /*#__PURE__*/React.createElement("div", {
356
+ className: "obliqueview-bottombar"
357
+ }, this.renderScaleChooser())));
358
+ }
359
+ }]);
360
+ }(React.Component);
361
+ _defineProperty(ObliqueView, "propTypes", {
362
+ active: PropTypes.bool,
363
+ /** Default window geometry with size, position and docking status. Positive position values (including '0') are related to top (InitialY) and left (InitialX), negative values (including '-0') to bottom (InitialY) and right (InitialX). */
364
+ geometry: PropTypes.shape({
365
+ initialWidth: PropTypes.number,
366
+ initialHeight: PropTypes.number,
367
+ initialX: PropTypes.number,
368
+ initialY: PropTypes.number,
369
+ initiallyDocked: PropTypes.bool,
370
+ side: PropTypes.string
371
+ }),
372
+ /** The initial map scale. */
373
+ initialScale: PropTypes.number,
374
+ mapBbox: PropTypes.object,
375
+ projection: PropTypes.string,
376
+ /** A list of allowed map scales, in decreasing order. */
377
+ scales: PropTypes.arrayOf(PropTypes.number),
378
+ setCurrentTask: PropTypes.func,
379
+ theme: PropTypes.object,
380
+ themes: PropTypes.object
381
+ });
382
+ _defineProperty(ObliqueView, "defaultProps", {
383
+ geometry: {
384
+ initialWidth: 480,
385
+ initialHeight: 640,
386
+ initialX: 0,
387
+ initialY: 0,
388
+ initiallyDocked: true,
389
+ side: 'left'
390
+ },
391
+ initialScale: 1000,
392
+ scales: [20000, 10000, 5000, 2500, 1000, 500, 250]
393
+ });
394
+ _defineProperty(ObliqueView, "defaultState", {
395
+ active: false,
396
+ selectedDataset: null,
397
+ datasetConfig: null,
398
+ currentDirection: null,
399
+ currentZoom: 0
400
+ });
401
+ export default connect(function (state) {
402
+ return {
403
+ active: state.task.id === "ObliqueView",
404
+ mapBbox: state.map.bbox,
405
+ theme: state.theme.current,
406
+ themes: state.theme.themes
407
+ };
408
+ }, {
409
+ setCurrentTask: setCurrentTask
410
+ })(ObliqueView);