qwc2 2025.12.17 → 2025.12.19

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 (75) hide show
  1. package/components/AttributeForm.js +8 -8
  2. package/components/AttributeTableWidget.js +3 -3
  3. package/components/EditComboField.js +1 -1
  4. package/components/EditUploadField.js +1 -1
  5. package/components/IdentifyViewer.js +3 -4
  6. package/components/LinkFeatureForm.js +21 -4
  7. package/components/MeasureSwitcher.js +115 -0
  8. package/components/OverviewMapButton.js +147 -0
  9. package/components/PluginsContainer.js +3 -2
  10. package/components/QtDesignerForm.js +2 -2
  11. package/components/ResizeableWindow.js +1 -1
  12. package/components/SearchBox.js +7 -7
  13. package/components/map3d/drawtool/EditTool3D.js +1 -1
  14. package/components/style/IdentifyViewer.css +1 -1
  15. package/components/style/LocationRecorder.css +1 -6
  16. package/{plugins/map3d/style/OverviewMap3D.css → components/style/OverviewMapButton.css} +4 -4
  17. package/components/style/PluginsContainer.css +11 -6
  18. package/components/timeline/FixedTimeline.js +2 -2
  19. package/components/timeline/InfiniteTimeline.js +2 -2
  20. package/components/timeline/TimelineFeaturesSlider.js +1 -1
  21. package/components/widgets/LayerCatalogWidget.js +1 -1
  22. package/package.json +1 -1
  23. package/plugins/Editing.js +20 -5
  24. package/plugins/FeatureForm.js +1 -1
  25. package/plugins/FeatureSearch.js +3 -3
  26. package/plugins/GeometryDigitizer.js +40 -26
  27. package/plugins/Identify.js +1 -4
  28. package/plugins/MapExport.js +4 -4
  29. package/plugins/MapFilter.js +10 -10
  30. package/plugins/NewsPopup.js +1 -1
  31. package/plugins/ObliqueView.js +177 -61
  32. package/plugins/Print.js +7 -7
  33. package/plugins/Redlining.js +25 -73
  34. package/plugins/Reports.js +3 -3
  35. package/plugins/Routing.js +4 -4
  36. package/plugins/ValueTool.js +1 -1
  37. package/plugins/View3D.js +2 -2
  38. package/plugins/ZoomButtons.js +1 -1
  39. package/plugins/map/EditingSupport.js +50 -20
  40. package/plugins/map/RedliningSupport.js +4 -4
  41. package/plugins/map/SnapSupport.js +12 -10
  42. package/plugins/map/style/SnappingSupport.css +1 -8
  43. package/plugins/map3d/Draw3D.js +2 -2
  44. package/plugins/map3d/ExportObjects3D.js +2 -2
  45. package/plugins/map3d/MapExport3D.js +4 -4
  46. package/plugins/map3d/OverviewMap3D.js +27 -102
  47. package/plugins/style/ObliqueView.css +6 -2
  48. package/reducers/editing.js +6 -1
  49. package/static/translations/bg-BG.json +39 -74
  50. package/static/translations/ca-ES.json +39 -74
  51. package/static/translations/cs-CZ.json +39 -74
  52. package/static/translations/de-CH.json +39 -74
  53. package/static/translations/de-DE.json +39 -74
  54. package/static/translations/en-US.json +39 -74
  55. package/static/translations/es-ES.json +39 -74
  56. package/static/translations/fi-FI.json +39 -74
  57. package/static/translations/fr-FR.json +39 -74
  58. package/static/translations/hu-HU.json +39 -74
  59. package/static/translations/it-IT.json +39 -74
  60. package/static/translations/ja-JP.json +39 -74
  61. package/static/translations/nl-NL.json +39 -74
  62. package/static/translations/no-NO.json +39 -74
  63. package/static/translations/pl-PL.json +39 -74
  64. package/static/translations/pt-BR.json +39 -74
  65. package/static/translations/pt-PT.json +39 -74
  66. package/static/translations/ro-RO.json +39 -74
  67. package/static/translations/ru-RU.json +39 -74
  68. package/static/translations/sv-SE.json +39 -74
  69. package/static/translations/tr-TR.json +39 -74
  70. package/static/translations/tsconfig.json +30 -67
  71. package/static/translations/uk-UA.json +39 -74
  72. package/utils/EditingUtils.js +2 -2
  73. package/utils/FeatureStyles.js +13 -18
  74. package/utils/IdentifyUtils.js +14 -11
  75. package/utils/SearchProviders.js +1 -1
@@ -1,4 +1,6 @@
1
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2
4
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
3
5
  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
6
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -23,15 +25,18 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
23
25
  import React from 'react';
24
26
  import { connect } from 'react-redux';
25
27
  import axios from 'axios';
28
+ import isEqual from 'lodash.isequal';
26
29
  import ol from 'openlayers';
27
30
  import PropTypes from 'prop-types';
31
+ import { zoomToExtent } from '../actions/map';
28
32
  import { setCurrentTask } from '../actions/task';
29
33
  import Icon from '../components/Icon';
34
+ import OverviewMapButton from '../components/OverviewMapButton';
30
35
  import ResizeableWindow from '../components/ResizeableWindow';
31
- import LayerRegistry from '../components/map/layers/index';
36
+ import OlLayer from '../components/map/OlLayer';
32
37
  import InputContainer from '../components/widgets/InputContainer';
33
38
  import ConfigUtils from '../utils/ConfigUtils';
34
- import LayerUtils from '../utils/LayerUtils';
39
+ import CoordinatesUtils from '../utils/CoordinatesUtils';
35
40
  import LocaleUtils from '../utils/LocaleUtils';
36
41
  import MapUtils from '../utils/MapUtils';
37
42
  import MiscUtils from '../utils/MiscUtils';
@@ -39,6 +44,27 @@ import './style/ObliqueView.css';
39
44
 
40
45
  /**
41
46
  * Display oblique satellite imagery.
47
+ *
48
+ * Requires `obliqueImageryServiceUrl` in `config.json` to point to a `qwc-oblique-imagery-service`.
49
+ *
50
+ * You can configure oblique imagery datasets in the `obliqueDatasets` entry in a QWC theme configuration as follows:
51
+ * ```
52
+ * {
53
+ * ...
54
+ * "obliqueDatasets": [{
55
+ * {
56
+ * "name": "<dataset_name>",
57
+ * "default": <false|true>,
58
+ * "backgroundLayer": "<background_layer_name>",
59
+ * "backgroundOpacity": <0-255>,
60
+ * "title": "<dataset_title>",
61
+ * "titleMsgId": "<dataset_title_msgid>"
62
+ * },
63
+ * ...
64
+ * ]
65
+ * }
66
+ * ```
67
+ * where `dataset_name` is the the name of a dataset configured in the `qwc-oblique-imagery-service`.
42
68
  */
43
69
  var ObliqueView = /*#__PURE__*/function (_React$Component) {
44
70
  function ObliqueView(props) {
@@ -90,6 +116,9 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
90
116
  /* eslint-disable-next-line */
91
117
  console.warn("Failed to load dataset config");
92
118
  });
119
+ } else {
120
+ _this.obliqueImageryLayer.setSource(null);
121
+ _this.closestImage = null;
93
122
  }
94
123
  });
95
124
  _defineProperty(_this, "setupLayer", function () {
@@ -105,7 +134,6 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
105
134
  }, 0);
106
135
  _this.map.setView(new ol.View({
107
136
  projection: projection,
108
- // extent: datasetConfig.extent,
109
137
  center: ol.extent.getCenter(datasetConfig.extent),
110
138
  rotation: _this.getRotation() / 180 * Math.PI,
111
139
  zoom: zoom,
@@ -116,53 +144,25 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
116
144
  _this.setState({
117
145
  currentZoom: zoom
118
146
  });
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
- };
147
+ _this.obliqueImageryLayer.setSource(new ol.source.XYZ({
148
+ projection: projection,
149
+ tileGrid: new ol.tilegrid.TileGrid({
150
+ extent: datasetConfig.extent,
151
+ resolutions: datasetConfig.resolutions,
152
+ tileSize: datasetConfig.tileSize,
153
+ origin: datasetConfig.origin
154
+ }),
155
+ url: datasetConfig.url,
156
+ crossOrigin: "anonymous",
157
+ tileLoadFunction: function tileLoadFunction(tile, src) {
158
+ var _this$closestImage;
159
+ if (((_this$closestImage = _this.closestImage) !== null && _this$closestImage !== void 0 ? _this$closestImage : null) !== null) {
160
+ src += "?img=" + _this.closestImage;
126
161
  }
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));
162
+ tile.getImage().src = src.replace('{direction}', _this.state.currentDirection);
142
163
  }
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);
164
+ }));
165
+ _this.searchClosestImage();
166
166
  });
167
167
  _defineProperty(_this, "searchClosestImage", function () {
168
168
  var _this$state$datasetCo;
@@ -198,6 +198,33 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
198
198
  s: 180
199
199
  }[_this.state.currentDirection];
200
200
  });
201
+ _defineProperty(_this, "sync2DExtent", function () {
202
+ if (!_this.state.datasetConfig) {
203
+ return;
204
+ }
205
+ _this.setState(function (state) {
206
+ var center = CoordinatesUtils.reproject(_this.props.map.center, _this.props.map.projection, state.datasetConfig.crs);
207
+ var resolution = MapUtils.computeForZoom(_this.props.map.resolutions, _this.props.map.zoom);
208
+ _this.map.getView().setCenter(center);
209
+ _this.map.getView().setResolution(resolution);
210
+ return {
211
+ currentCenter: center,
212
+ currentZoom: _this.map.getView().getZoom()
213
+ };
214
+ });
215
+ });
216
+ _defineProperty(_this, "trackFocus", function (ev) {
217
+ var _this$map, _this$map$getTargetEl, _mapEl$contains, _mapObliqueEl$contain;
218
+ var mapEl = document.getElementById("map");
219
+ var mapObliqueEl = (_this$map = _this.map) === null || _this$map === void 0 || (_this$map$getTargetEl = _this$map.getTargetElement) === null || _this$map$getTargetEl === void 0 ? void 0 : _this$map$getTargetEl.call(_this$map);
220
+ if (mapEl !== null && mapEl !== void 0 && (_mapEl$contains = mapEl.contains) !== null && _mapEl$contains !== void 0 && _mapEl$contains.call(mapEl, document.activeElement)) {
221
+ _this.focusedMap = "map";
222
+ } else if (mapObliqueEl !== null && mapObliqueEl !== void 0 && (_mapObliqueEl$contain = mapObliqueEl.contains) !== null && _mapObliqueEl$contain !== void 0 && _mapObliqueEl$contain.call(mapObliqueEl, document.activeElement)) {
223
+ _this.focusedMap = "mapOblique";
224
+ } else {
225
+ _this.focusedMap = null;
226
+ }
227
+ });
201
228
  var controls = ol.control.defaults({
202
229
  zoom: false,
203
230
  attribution: false,
@@ -210,15 +237,40 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
210
237
  controls: controls,
211
238
  interactions: interactions
212
239
  });
213
- _this.map.on('moveend', _this.searchClosestImage);
214
240
  _this.map.on('rotateend', _this.searchClosestImage);
241
+ _this.map.on('moveend', function () {
242
+ _this.searchClosestImage();
243
+ _this.setState(function (state) {
244
+ var newZoom = _this.map.getView().getZoom();
245
+ var newCenter = _this.map.getView().getCenter();
246
+ if (newZoom !== state.currentZoom || !isEqual(newCenter, state.currentCenter)) {
247
+ return {
248
+ currentZoom: newZoom,
249
+ currentCenter: newCenter
250
+ };
251
+ }
252
+ return null;
253
+ });
254
+ });
255
+ _this.obliqueImageryLayer = new ol.layer.Tile();
256
+ _this.map.addLayer(_this.obliqueImageryLayer);
215
257
  _this.closestImage = null;
216
- _this.obliqueImageryLayer = null;
217
258
  _this.state = ObliqueView.defaultState;
259
+ _this.focusedMap = null;
218
260
  return _this;
219
261
  }
220
262
  _inherits(ObliqueView, _React$Component);
221
263
  return _createClass(ObliqueView, [{
264
+ key: "componentDidMount",
265
+ value: function componentDidMount() {
266
+ window.addEventListener('focus', this.trackFocus, true);
267
+ }
268
+ }, {
269
+ key: "componentWillUnmount",
270
+ value: function componentWillUnmount() {
271
+ window.removeEventListener('focus', this.trackFocus);
272
+ }
273
+ }, {
222
274
  key: "componentDidUpdate",
223
275
  value: function componentDidUpdate(prevProps, prevState) {
224
276
  if (this.props.active && !prevProps.active) {
@@ -227,7 +279,7 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
227
279
  });
228
280
  this.props.setCurrentTask(null);
229
281
  }
230
- if (this.props.active && this.props.theme && this.props.theme !== prevProps.theme || this.props.active && !prevProps.active) {
282
+ if (this.state.active && this.props.theme && (this.props.theme !== prevProps.theme || !prevState.active)) {
231
283
  var _datasets$find$name, _datasets$find, _datasets$;
232
284
  var datasets = this.props.theme.obliqueDatasets || [];
233
285
  var defaultDataset = (_datasets$find$name = (_datasets$find = datasets.find(function (entry) {
@@ -240,8 +292,6 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
240
292
  });
241
293
  }
242
294
  if (this.state.selectedDataset !== prevState.selectedDataset) {
243
- this.closestImage = null;
244
- this.obliqueImageryLayer = null;
245
295
  this.queryDatasetConfig();
246
296
  }
247
297
  if (this.state.datasetConfig && this.state.datasetConfig !== prevState.datasetConfig) {
@@ -256,17 +306,49 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
256
306
  var _this$map$getView2, _this$map$getView2$se;
257
307
  (_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
308
  }
309
+ if (this.state.viewsLocked && this.state.datasetConfig) {
310
+ if (this.focusedMap === "map" && this.props.map.bbox !== prevProps.map.bbox) {
311
+ this.sync2DExtent();
312
+ } else if (this.focusedMap === "mapOblique" && (this.state.currentCenter !== prevState.currentCenter || this.state.currentZoom !== prevState.currentZoom)) {
313
+ this.props.zoomToExtent(this.map.getView().calculateExtent(), this.state.datasetConfig.crs);
314
+ }
315
+ }
259
316
  }
260
317
  }, {
261
318
  key: "render",
262
319
  value: function render() {
263
- var _this2 = this;
320
+ var _this2 = this,
321
+ _obliqueConfig$backgr,
322
+ _this$state$selectedD;
264
323
  if (!this.state.active) {
265
324
  return null;
266
325
  }
267
326
  var rot = this.getRotation();
327
+ var extraControls = [{
328
+ icon: "sync",
329
+ callback: this.sync2DExtent,
330
+ title: LocaleUtils.tr("common.sync2dview")
331
+ }, {
332
+ icon: "lock",
333
+ callback: function callback() {
334
+ return _this2.setState(function (state) {
335
+ return {
336
+ viewsLocked: !state.viewsLocked
337
+ };
338
+ });
339
+ },
340
+ title: LocaleUtils.tr("common.lock2dview"),
341
+ active: this.state.viewsLocked
342
+ }];
343
+ var obliqueConfig = this.props.theme.obliqueDatasets.find(function (entry) {
344
+ return entry.name === _this2.state.selectedDataset;
345
+ });
346
+ var basemap = this.props.themes.backgroundLayers.find(function (entry) {
347
+ return entry.name === (obliqueConfig === null || obliqueConfig === void 0 ? void 0 : obliqueConfig.backgroundLayer);
348
+ });
268
349
  return /*#__PURE__*/React.createElement(ResizeableWindow, {
269
350
  dockable: this.props.geometry.side,
351
+ extraControls: extraControls,
270
352
  icon: "oblique",
271
353
  initialHeight: this.props.geometry.initialHeight,
272
354
  initialWidth: this.props.geometry.initialWidth,
@@ -352,9 +434,39 @@ var ObliqueView = /*#__PURE__*/function (_React$Component) {
352
434
  onClick: function onClick() {
353
435
  return _this2.changeZoom(-1);
354
436
  }
355
- })), /*#__PURE__*/React.createElement("div", {
437
+ })), basemap && this.state.datasetConfig ? /*#__PURE__*/React.createElement(OlLayer, {
438
+ map: this.map,
439
+ options: _objectSpread(_objectSpread({}, basemap), {}, {
440
+ opacity: (_obliqueConfig$backgr = obliqueConfig.backgroundOpacity) !== null && _obliqueConfig$backgr !== void 0 ? _obliqueConfig$backgr : 127
441
+ }),
442
+ projection: this.state.datasetConfig.crs,
443
+ zIndex: -1
444
+ }) : null, /*#__PURE__*/React.createElement("div", {
356
445
  className: "obliqueview-bottombar"
357
- }, this.renderScaleChooser())));
446
+ }, /*#__PURE__*/React.createElement("select", {
447
+ onChange: function onChange(ev) {
448
+ return _this2.setState({
449
+ selectedDataset: ev.target.value
450
+ });
451
+ },
452
+ value: (_this$state$selectedD = this.state.selectedDataset) !== null && _this$state$selectedD !== void 0 ? _this$state$selectedD : ""
453
+ }, (this.props.theme.obliqueDatasets || []).map(function (entry) {
454
+ var _entry$title;
455
+ return /*#__PURE__*/React.createElement("option", {
456
+ key: entry.name,
457
+ value: entry.name
458
+ }, LocaleUtils.trWithFallback(entry.titleMsgId, (_entry$title = entry.title) !== null && _entry$title !== void 0 ? _entry$title : entry.name));
459
+ })), /*#__PURE__*/React.createElement("span", {
460
+ className: "obliqueview-bottombar-spacer"
461
+ }), this.renderScaleChooser(), /*#__PURE__*/React.createElement("span", {
462
+ className: "obliqueview-bottombar-spacer"
463
+ }), basemap && this.state.datasetConfig ? /*#__PURE__*/React.createElement(OverviewMapButton, {
464
+ center: this.state.currentCenter,
465
+ coneRotation: this.getRotation() / 180 * Math.PI,
466
+ layer: basemap,
467
+ projection: this.state.datasetConfig.crs,
468
+ resolution: MapUtils.computeForZoom(this.state.datasetConfig.resolutions, this.state.currentZoom) * 0.25
469
+ }) : null)));
358
470
  }
359
471
  }]);
360
472
  }(React.Component);
@@ -371,13 +483,14 @@ _defineProperty(ObliqueView, "propTypes", {
371
483
  }),
372
484
  /** The initial map scale. */
373
485
  initialScale: PropTypes.number,
374
- mapBbox: PropTypes.object,
486
+ map: PropTypes.object,
375
487
  projection: PropTypes.string,
376
488
  /** A list of allowed map scales, in decreasing order. */
377
489
  scales: PropTypes.arrayOf(PropTypes.number),
378
490
  setCurrentTask: PropTypes.func,
379
491
  theme: PropTypes.object,
380
- themes: PropTypes.object
492
+ themes: PropTypes.object,
493
+ zoomToExtent: PropTypes.func
381
494
  });
382
495
  _defineProperty(ObliqueView, "defaultProps", {
383
496
  geometry: {
@@ -396,15 +509,18 @@ _defineProperty(ObliqueView, "defaultState", {
396
509
  selectedDataset: null,
397
510
  datasetConfig: null,
398
511
  currentDirection: null,
399
- currentZoom: 0
512
+ currentZoom: 0,
513
+ currentCenter: null,
514
+ viewsLocked: false
400
515
  });
401
516
  export default connect(function (state) {
402
517
  return {
403
518
  active: state.task.id === "ObliqueView",
404
- mapBbox: state.map.bbox,
519
+ map: state.map,
405
520
  theme: state.theme.current,
406
521
  themes: state.theme.themes
407
522
  };
408
523
  }, {
409
- setCurrentTask: setCurrentTask
524
+ setCurrentTask: setCurrentTask,
525
+ zoomToExtent: zoomToExtent
410
526
  })(ObliqueView);
package/plugins/Print.js CHANGED
@@ -255,7 +255,7 @@ var Print = /*#__PURE__*/function (_React$Component) {
255
255
  key: item.name,
256
256
  value: item.name
257
257
  }, _this.translateLayoutName(item));
258
- })))), _this.props.formats.length > 1 ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.format")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("select", {
258
+ })))), _this.props.formats.length > 1 ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("common.format")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("select", {
259
259
  disabled: _this.state.printSeriesEnabled,
260
260
  name: "FORMAT",
261
261
  onChange: _this.formatChanged,
@@ -287,7 +287,7 @@ var Print = /*#__PURE__*/function (_React$Component) {
287
287
  disabled: true,
288
288
  placeholder: LocaleUtils.tr("print.pickatlasfeature", _this.state.layout.atlasCoverageLayer),
289
289
  type: "text"
290
- }))) : null, isEmpty(_this.state.atlasFeatures) ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.scale")), /*#__PURE__*/React.createElement("td", null, scaleChooser)) : null, resolutionChooser ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.resolution")), /*#__PURE__*/React.createElement("td", null, resolutionChooser)) : null, _this.props.displayRotation ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.rotation")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement(NumberInput, {
290
+ }))) : null, isEmpty(_this.state.atlasFeatures) ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.scale")), /*#__PURE__*/React.createElement("td", null, scaleChooser)) : null, resolutionChooser ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("common.resolution")), /*#__PURE__*/React.createElement("td", null, resolutionChooser)) : null, _this.props.displayRotation ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.rotation")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement(InputContainer, null, /*#__PURE__*/React.createElement(NumberInput, {
291
291
  decimals: 1,
292
292
  mobile: true,
293
293
  name: mapName + ":rotation",
@@ -338,7 +338,7 @@ var Print = /*#__PURE__*/function (_React$Component) {
338
338
  value: _this.state.printSeriesOverlap
339
339
  }), /*#__PURE__*/React.createElement("span", {
340
340
  role: "suffix"
341
- }, _this.state.printSeriesOverlap, "\xA0%")))) : null, !_this.props.inlinePrintOutput && _this.state.printSeriesEnabled ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("print.download")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("select", {
341
+ }, _this.state.printSeriesOverlap, "\xA0%")))) : null, !_this.props.inlinePrintOutput && _this.state.printSeriesEnabled ? /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null, LocaleUtils.tr("common.download")), /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("select", {
342
342
  onChange: _this.changeDownloadMode,
343
343
  role: "input",
344
344
  value: _this.state.downloadMode || ""
@@ -426,7 +426,7 @@ var Print = /*#__PURE__*/function (_React$Component) {
426
426
  type: "submit"
427
427
  }, _this.state.printing ? /*#__PURE__*/React.createElement("span", {
428
428
  className: "print-wait"
429
- }, /*#__PURE__*/React.createElement(Spinner, null), " ", LocaleUtils.tr("print.wait")) : LocaleUtils.tr("print.submit")))));
429
+ }, /*#__PURE__*/React.createElement(Spinner, null), " ", LocaleUtils.tr("common.wait")) : LocaleUtils.tr("print.submit")))));
430
430
  });
431
431
  _defineProperty(_this, "renderPrintLabelField", function (label, opts) {
432
432
  var defaultValue = opts.defaultValue || "";
@@ -562,7 +562,7 @@ var Print = /*#__PURE__*/function (_React$Component) {
562
562
  _defineProperty(_this, "renderPrintOutputWindow", function () {
563
563
  var extraControls = [{
564
564
  icon: 'save',
565
- title: LocaleUtils.tr('print.save'),
565
+ title: LocaleUtils.tr('common.save'),
566
566
  callback: _this.savePrintOutput
567
567
  }];
568
568
  return /*#__PURE__*/React.createElement(ResizeableWindow, {
@@ -585,7 +585,7 @@ var Print = /*#__PURE__*/function (_React$Component) {
585
585
  className: "print-output-window-body"
586
586
  }, !_this.state.outputLoaded ? /*#__PURE__*/React.createElement("span", {
587
587
  className: "print-output-window-wait"
588
- }, /*#__PURE__*/React.createElement(Spinner, null), " ", LocaleUtils.tr("print.wait")) : null, /*#__PURE__*/React.createElement("iframe", {
588
+ }, /*#__PURE__*/React.createElement(Spinner, null), " ", LocaleUtils.tr("common.wait")) : null, /*#__PURE__*/React.createElement("iframe", {
589
589
  name: "print-output-window",
590
590
  src: _this.state.pdfDataUrl
591
591
  })));
@@ -844,7 +844,7 @@ var Print = /*#__PURE__*/function (_React$Component) {
844
844
  key: "render",
845
845
  value: function render() {
846
846
  var _this3 = this;
847
- var minMaxTooltip = this.state.minimized ? LocaleUtils.tr("print.maximize") : LocaleUtils.tr("print.minimize");
847
+ var minMaxTooltip = this.state.minimized ? LocaleUtils.tr("window.maximize") : LocaleUtils.tr("window.minimize");
848
848
  var extraTitlebarContent = /*#__PURE__*/React.createElement(Icon, {
849
849
  className: "print-minimize-maximize",
850
850
  icon: this.state.minimized ? 'chevron-down' : 'chevron-up',
@@ -39,6 +39,7 @@ import { LayerRole, addLayer } from '../actions/layers';
39
39
  import { setSnappingConfig } from '../actions/map';
40
40
  import { changeRedliningState, resetRedliningState } from '../actions/redlining';
41
41
  import Icon from '../components/Icon';
42
+ import MeasureSwitcher from '../components/MeasureSwitcher';
42
43
  import TaskBar from '../components/TaskBar';
43
44
  import ButtonBar from '../components/widgets/ButtonBar';
44
45
  import ColorButton from '../components/widgets/ColorButton';
@@ -114,7 +115,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
114
115
  var activeButton = _this.props.redlining.action === "Draw" ? _this.props.redlining.geomType : _this.props.redlining.action;
115
116
  var drawButtons = [{
116
117
  key: "Point",
117
- tooltip: LocaleUtils.tr("redlining.point"),
118
+ tooltip: LocaleUtils.tr("common.point"),
118
119
  icon: "point",
119
120
  data: {
120
121
  action: "Draw",
@@ -123,7 +124,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
123
124
  }
124
125
  }, {
125
126
  key: "LineString",
126
- tooltip: LocaleUtils.tr("redlining.line"),
127
+ tooltip: LocaleUtils.tr("common.line"),
127
128
  icon: "line",
128
129
  data: {
129
130
  action: "Draw",
@@ -132,7 +133,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
132
133
  }
133
134
  }, [{
134
135
  key: "Polygon",
135
- tooltip: LocaleUtils.tr("redlining.polygon"),
136
+ tooltip: LocaleUtils.tr("common.polygon"),
136
137
  icon: "polygon",
137
138
  data: {
138
139
  action: "Draw",
@@ -141,7 +142,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
141
142
  }
142
143
  }, toolEnabled("Circle") ? {
143
144
  key: "Circle",
144
- tooltip: LocaleUtils.tr("redlining.circle"),
145
+ tooltip: LocaleUtils.tr("common.circle"),
145
146
  icon: "circle",
146
147
  data: {
147
148
  action: "Draw",
@@ -150,7 +151,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
150
151
  }
151
152
  } : null, toolEnabled("Ellipse") ? {
152
153
  key: "Ellipse",
153
- tooltip: LocaleUtils.tr("redlining.ellipse"),
154
+ tooltip: LocaleUtils.tr("common.ellipse"),
154
155
  icon: "ellipse",
155
156
  data: {
156
157
  action: "Draw",
@@ -159,7 +160,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
159
160
  }
160
161
  } : null, toolEnabled("Square") ? {
161
162
  key: "Square",
162
- tooltip: LocaleUtils.tr("redlining.square"),
163
+ tooltip: LocaleUtils.tr("common.square"),
163
164
  icon: "box",
164
165
  data: {
165
166
  action: "Draw",
@@ -168,7 +169,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
168
169
  }
169
170
  } : null, toolEnabled("Box") ? {
170
171
  key: "Box",
171
- tooltip: LocaleUtils.tr("redlining.rectangle"),
172
+ tooltip: LocaleUtils.tr("common.rectangle"),
172
173
  icon: "rect",
173
174
  data: {
174
175
  action: "Draw",
@@ -177,7 +178,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
177
178
  }
178
179
  } : null].filter(Boolean), {
179
180
  key: "Text",
180
- tooltip: LocaleUtils.tr("redlining.text"),
181
+ tooltip: LocaleUtils.tr("common.text"),
181
182
  icon: "text",
182
183
  data: {
183
184
  action: "Draw",
@@ -204,7 +205,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
204
205
  }] : [];
205
206
  var editButtons = [{
206
207
  key: "Pick",
207
- tooltip: LocaleUtils.tr("redlining.pick"),
208
+ tooltip: LocaleUtils.tr("common.pick"),
208
209
  icon: "nodetool",
209
210
  data: {
210
211
  action: "Pick",
@@ -222,7 +223,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
222
223
  }
223
224
  } : null, toolEnabled("Clone") ? {
224
225
  key: "Clone",
225
- tooltip: LocaleUtils.tr("redlining.clone"),
226
+ tooltip: LocaleUtils.tr("common.clone"),
226
227
  icon: "clone",
227
228
  data: {
228
229
  action: "Clone",
@@ -231,7 +232,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
231
232
  disabled: !_this.props.redlining.selectedFeature
232
233
  } : null, {
233
234
  key: "Delete",
234
- tooltip: LocaleUtils.tr("redlining.delete"),
235
+ tooltip: LocaleUtils.tr("common.delete"),
235
236
  icon: "trash",
236
237
  data: {
237
238
  action: "Delete",
@@ -323,7 +324,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
323
324
  disabled: !haveLayer,
324
325
  menuIcon: "export",
325
326
  onActivate: _this["export"],
326
- tooltip: LocaleUtils.tr("redlining.export")
327
+ tooltip: LocaleUtils.tr("common.export")
327
328
  }, /*#__PURE__*/React.createElement("div", {
328
329
  className: "redlining-export-menu-entry",
329
330
  key: "GeoJSON",
@@ -341,7 +342,7 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
341
342
  });
342
343
  });
343
344
  _defineProperty(_this, "renderStandardControls", function () {
344
- var sizeLabel = LocaleUtils.tr("redlining.line");
345
+ var sizeLabel = LocaleUtils.tr("common.line");
345
346
  var showDash = true;
346
347
  if (["Text", "Point"].includes(_this.props.redlining.geomType)) {
347
348
  sizeLabel = LocaleUtils.tr("redlining.size");
@@ -491,21 +492,16 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
491
492
  })))) : null, /*#__PURE__*/React.createElement("div", {
492
493
  className: "redlining-control redlining-control-fill"
493
494
  }, /*#__PURE__*/React.createElement("div", {
494
- className: "controlgroup"
495
- }, _this.props.redlining.geomType !== 'Text' && _this.props.allowGeometryLabels ? /*#__PURE__*/React.createElement("button", {
496
- className: "button" + (_this.props.redlining.measurements ? " pressed" : ""),
497
- onClick: function onClick() {
498
- return _this.props.changeRedliningState({
499
- measurements: !_this.props.redlining.measurements,
500
- style: _objectSpread(_objectSpread({}, _this.props.redlining.style), {}, {
501
- text: ''
502
- })
503
- });
495
+ className: "controlgroup" + (_this.props.redlining.showmeasurements ? " redlining-control-fill" : "")
496
+ }, _this.props.redlining.geomType !== 'Text' && _this.props.allowGeometryLabels ? /*#__PURE__*/React.createElement(MeasureSwitcher, {
497
+ changeMeasureState: function changeMeasureState(diff) {
498
+ return _this.props.changeRedliningState(_objectSpread(_objectSpread({}, diff), {}, {
499
+ text: ''
500
+ }));
504
501
  },
505
- title: LocaleUtils.tr("redlining.measurements")
506
- }, /*#__PURE__*/React.createElement(Icon, {
507
- icon: "measure"
508
- })) : null, (_this.props.redlining.geomType === 'Text' || _this.props.allowGeometryLabels) && !_this.props.redlining.measurements ? /*#__PURE__*/React.createElement("input", {
502
+ geomType: _this.props.redlining.geomType,
503
+ measureState: _this.props.redlining
504
+ }) : null, (_this.props.redlining.geomType === 'Text' || _this.props.allowGeometryLabels) && !_this.props.redlining.showmeasurements ? /*#__PURE__*/React.createElement("input", {
509
505
  className: "controlgroup-fillitem",
510
506
  onChange: function onChange(ev) {
511
507
  return _this.updateRedliningStyle({
@@ -513,57 +509,13 @@ var Redlining = /*#__PURE__*/function (_React$Component) {
513
509
  });
514
510
  },
515
511
  placeholder: labelPlaceholder,
516
- readOnly: _this.props.redlining.measurements,
512
+ readOnly: _this.props.redlining.showmeasurements,
517
513
  ref: function ref(el) {
518
514
  return _this.setLabelRef(el);
519
515
  },
520
516
  type: "text",
521
517
  value: _this.props.redlining.style.text
522
- }) : null, _this.props.redlining.measurements && ['LineString', 'Circle'].includes(_this.props.redlining.geomType) ? /*#__PURE__*/React.createElement("select", {
523
- className: "controlgroup-fillitem",
524
- onChange: function onChange(ev) {
525
- return _this.props.changeRedliningState({
526
- lenUnit: ev.target.value
527
- });
528
- },
529
- value: _this.props.redlining.lenUnit
530
- }, /*#__PURE__*/React.createElement("option", {
531
- value: "metric"
532
- }, LocaleUtils.tr("measureComponent.metric")), /*#__PURE__*/React.createElement("option", {
533
- value: "imperial"
534
- }, LocaleUtils.tr("measureComponent.imperial")), /*#__PURE__*/React.createElement("option", {
535
- value: "m"
536
- }, "m"), /*#__PURE__*/React.createElement("option", {
537
- value: "km"
538
- }, "km"), /*#__PURE__*/React.createElement("option", {
539
- value: "ft"
540
- }, "ft"), /*#__PURE__*/React.createElement("option", {
541
- value: "mi"
542
- }, "mi")) : null, _this.props.redlining.measurements && ['Polygon', 'Ellipse', 'Square', 'Box'].includes(_this.props.redlining.geomType) ? /*#__PURE__*/React.createElement("select", {
543
- className: "controlgroup-fillitem",
544
- onChange: function onChange(ev) {
545
- return _this.props.changeRedliningState({
546
- areaUnit: ev.target.value
547
- });
548
- },
549
- value: _this.props.redlining.areaUnit
550
- }, /*#__PURE__*/React.createElement("option", {
551
- value: "metric"
552
- }, LocaleUtils.tr("measureComponent.metric")), /*#__PURE__*/React.createElement("option", {
553
- value: "imperial"
554
- }, LocaleUtils.tr("measureComponent.imperial")), /*#__PURE__*/React.createElement("option", {
555
- value: "sqm"
556
- }, "m\xB2"), /*#__PURE__*/React.createElement("option", {
557
- value: "ha"
558
- }, "ha"), /*#__PURE__*/React.createElement("option", {
559
- value: "sqkm"
560
- }, "km\xB2"), /*#__PURE__*/React.createElement("option", {
561
- value: "sqft"
562
- }, "ft\xB2"), /*#__PURE__*/React.createElement("option", {
563
- value: "acre"
564
- }, "acre"), /*#__PURE__*/React.createElement("option", {
565
- value: "sqmi"
566
- }, "mi\xB2")) : null)));
518
+ }) : null)));
567
519
  });
568
520
  _defineProperty(_this, "setLabelRef", function (el) {
569
521
  _this.labelInput = el;