qwc2 2026.8.13 → 2026.8.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/components/AttributeTableWidget.js +121 -285
- package/components/BookmarkPanel.js +3 -2
- package/components/IdentifyViewer.js +39 -20
- package/components/ImportLayer.js +6 -392
- package/components/QtDesignerForm.js +1 -1
- package/components/ResizeableWindow.js +10 -0
- package/components/map3d/style/Map3D.css +1 -0
- package/components/style/AttributeTableWidget.css +1 -140
- package/components/widgets/FeaturesTable.js +30 -31
- package/components/widgets/MenuButton.js +10 -10
- package/components/widgets/TextInput.js +0 -10
- package/components/widgets/style/FeaturesTable.css +46 -19
- package/icons/public.svg +63 -0
- package/package.json +1 -1
- package/plugins/BottomBar.js +123 -111
- package/plugins/MapDropImport.js +135 -0
- package/plugins/map3d/Viewshed3D.js +171 -52
- package/plugins/map3d/style/Viewshed3D.css +4 -0
- package/plugins/style/BottomBar.css +10 -3
- package/plugins/style/MapDropImport.css +19 -0
- package/static/translations/bg-BG.json +8 -0
- package/static/translations/ca-ES.json +8 -0
- package/static/translations/cs-CZ.json +8 -0
- package/static/translations/de-CH.json +8 -0
- package/static/translations/de-DE.json +8 -0
- package/static/translations/en-US.json +8 -0
- package/static/translations/es-ES.json +8 -0
- package/static/translations/fi-FI.json +8 -0
- package/static/translations/fr-FR.json +8 -0
- package/static/translations/hu-HU.json +8 -0
- package/static/translations/it-IT.json +8 -0
- package/static/translations/ja-JP.json +8 -0
- package/static/translations/nl-NL.json +8 -0
- package/static/translations/no-NO.json +8 -0
- package/static/translations/pl-PL.json +8 -0
- package/static/translations/pt-BR.json +8 -0
- package/static/translations/pt-PT.json +8 -0
- package/static/translations/ro-RO.json +8 -0
- package/static/translations/ru-RU.json +8 -0
- package/static/translations/sv-SE.json +8 -0
- package/static/translations/tr-TR.json +8 -0
- package/static/translations/tsconfig.json +4 -0
- package/static/translations/uk-UA.json +8 -0
- package/utils/FileImportUtils.js +390 -0
- package/utils/LayerUtils.js +2 -2
package/plugins/BottomBar.js
CHANGED
|
@@ -156,132 +156,144 @@ var BottomBar = /*#__PURE__*/function (_React$Component) {
|
|
|
156
156
|
key: "render",
|
|
157
157
|
value: function render() {
|
|
158
158
|
var _this2 = this;
|
|
159
|
-
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
var leftBottomLinks = (this.props.additionalBottomBarLinks || []).filter(function (entry) {
|
|
163
|
-
return entry.side === "left";
|
|
164
|
-
}).map(this.renderLink);
|
|
165
|
-
var rightBottomLinks = (this.props.additionalBottomBarLinks || []).filter(function (entry) {
|
|
166
|
-
return entry.side !== "left";
|
|
167
|
-
}).map(this.renderLink);
|
|
168
|
-
if (this.props.viewertitleUrl) {
|
|
169
|
-
var entry = {
|
|
170
|
-
url: this.props.viewertitleUrl,
|
|
171
|
-
urlTarget: this.props.viewertitleUrlTarget,
|
|
172
|
-
label: LocaleUtils.tr("bottombar.viewertitle_label"),
|
|
173
|
-
icon: this.props.viewertitleUrlIcon
|
|
174
|
-
};
|
|
175
|
-
rightBottomLinks.push(this.renderLink(entry));
|
|
176
|
-
}
|
|
177
|
-
if (this.props.termsUrl) {
|
|
178
|
-
var _entry = {
|
|
179
|
-
url: this.props.termsUrl,
|
|
180
|
-
urlTarget: this.props.termsUrlTarget,
|
|
181
|
-
label: LocaleUtils.tr("bottombar.terms_label"),
|
|
182
|
-
icon: this.props.termsUrlIcon
|
|
183
|
-
};
|
|
184
|
-
rightBottomLinks.push(this.renderLink(_entry));
|
|
185
|
-
}
|
|
186
|
-
var enabledMouseCrs = [].concat(_toConsumableArray(this.props.additionalMouseCrs || []), [this.props.map.projection, "EPSG:4326"]);
|
|
187
|
-
var availableCRS = Object.fromEntries(Object.entries(CoordinatesUtils.getAvailableCRS()).filter(function (_ref) {
|
|
188
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
189
|
-
key = _ref2[0],
|
|
190
|
-
value = _ref2[1];
|
|
191
|
-
return enabledMouseCrs.includes(key);
|
|
192
|
-
}));
|
|
193
|
-
var scalebar = null;
|
|
159
|
+
var widgets = [];
|
|
194
160
|
if (this.props.displayScalebar) {
|
|
195
|
-
|
|
161
|
+
widgets.push(/*#__PURE__*/React.createElement("div", {
|
|
196
162
|
className: "bottombar-scalebar-container",
|
|
163
|
+
key: "scalebar",
|
|
197
164
|
ref: this.initScaleBar
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
var coordinates = null;
|
|
201
|
-
if (this.props.displayCoordinates) {
|
|
202
|
-
coordinates = /*#__PURE__*/React.createElement("div", {
|
|
203
|
-
className: "controlgroup"
|
|
204
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
205
|
-
className: "bottombar-mousepos-label"
|
|
206
|
-
}, LocaleUtils.tr("bottombar.mousepos_label"), ":\xA0"), /*#__PURE__*/React.createElement(CoordinateDisplayer, {
|
|
207
|
-
className: "bottombar-mousepos",
|
|
208
|
-
coordinateFormatter: this.props.coordinateFormatter,
|
|
209
|
-
displayCrs: this.props.map.displayCrs,
|
|
210
|
-
mapCrs: this.props.map.projection
|
|
211
|
-
}), /*#__PURE__*/React.createElement("select", {
|
|
212
|
-
onChange: function onChange(ev) {
|
|
213
|
-
return _this2.props.setDisplayCrs(ev.target.value);
|
|
214
|
-
},
|
|
215
|
-
value: this.props.map.displayCrs
|
|
216
|
-
}, Object.keys(availableCRS).map(function (crs) {
|
|
217
|
-
return /*#__PURE__*/React.createElement("option", {
|
|
218
|
-
key: crs,
|
|
219
|
-
value: crs
|
|
220
|
-
}, availableCRS[crs].label);
|
|
221
|
-
})));
|
|
222
|
-
}
|
|
223
|
-
var scales = null;
|
|
224
|
-
if (this.props.displayScales) {
|
|
225
|
-
scales = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
|
|
226
|
-
className: "bottombar-scales-label"
|
|
227
|
-
}, LocaleUtils.tr("bottombar.scale_label"), ":\xA0"), /*#__PURE__*/React.createElement(InputContainer, {
|
|
228
|
-
className: "bottombar-scale-combo"
|
|
229
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
230
|
-
className: "bottombar-scale-combo-prefix",
|
|
231
|
-
role: "prefix"
|
|
232
|
-
}, " 1 : "), /*#__PURE__*/React.createElement("select", {
|
|
233
|
-
onChange: function onChange(ev) {
|
|
234
|
-
return _this2.props.changeZoomLevel(parseInt(ev.target.value, 10));
|
|
235
|
-
},
|
|
236
|
-
role: "input",
|
|
237
|
-
value: Math.round(this.props.map.zoom)
|
|
238
|
-
}, this.props.map.scales.map(function (item, index) {
|
|
239
|
-
return /*#__PURE__*/React.createElement("option", {
|
|
240
|
-
key: index,
|
|
241
|
-
value: index
|
|
242
|
-
}, LocaleUtils.toLocaleFixed(item, 0));
|
|
243
|
-
})), /*#__PURE__*/React.createElement(NumberInput, {
|
|
244
|
-
decimals: 0,
|
|
245
|
-
hideArrows: true,
|
|
246
|
-
onChange: this.setScale,
|
|
247
|
-
role: "input",
|
|
248
|
-
value: this.state.scale
|
|
249
|
-
})));
|
|
165
|
+
}));
|
|
250
166
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
var
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
167
|
+
if (!this.props.fullscreen) {
|
|
168
|
+
var _this$props$bookmarks, _this$props$visibilit;
|
|
169
|
+
var leftBottomLinks = (this.props.additionalBottomBarLinks || []).filter(function (entry) {
|
|
170
|
+
return entry.side === "left";
|
|
171
|
+
}).map(this.renderLink);
|
|
172
|
+
widgets.push(/*#__PURE__*/React.createElement("span", {
|
|
173
|
+
className: "bottombar-links",
|
|
174
|
+
key: "leftlinks"
|
|
175
|
+
}, leftBottomLinks));
|
|
176
|
+
widgets.push(/*#__PURE__*/React.createElement("span", {
|
|
177
|
+
className: "bottombar-spacer",
|
|
178
|
+
key: "spacer1"
|
|
259
179
|
}));
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
180
|
+
if (this.props.displayCoordinates) {
|
|
181
|
+
var enabledMouseCrs = [].concat(_toConsumableArray(this.props.additionalMouseCrs || []), [this.props.map.projection, "EPSG:4326"]);
|
|
182
|
+
var availableCRS = Object.fromEntries(Object.entries(CoordinatesUtils.getAvailableCRS()).filter(function (_ref) {
|
|
183
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
184
|
+
key = _ref2[0],
|
|
185
|
+
value = _ref2[1];
|
|
186
|
+
return enabledMouseCrs.includes(key);
|
|
187
|
+
}));
|
|
188
|
+
widgets.push(/*#__PURE__*/React.createElement("div", {
|
|
189
|
+
className: "controlgroup",
|
|
190
|
+
key: "coordinates"
|
|
191
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
192
|
+
className: "bottombar-mousepos-label"
|
|
193
|
+
}, LocaleUtils.tr("bottombar.mousepos_label"), ":\xA0"), /*#__PURE__*/React.createElement(CoordinateDisplayer, {
|
|
194
|
+
className: "bottombar-mousepos",
|
|
195
|
+
coordinateFormatter: this.props.coordinateFormatter,
|
|
196
|
+
displayCrs: this.props.map.displayCrs,
|
|
197
|
+
mapCrs: this.props.map.projection
|
|
198
|
+
}), /*#__PURE__*/React.createElement("select", {
|
|
199
|
+
onChange: function onChange(ev) {
|
|
200
|
+
return _this2.props.setDisplayCrs(ev.target.value);
|
|
201
|
+
},
|
|
202
|
+
value: this.props.map.displayCrs
|
|
203
|
+
}, Object.keys(availableCRS).map(function (crs) {
|
|
204
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
205
|
+
key: crs,
|
|
206
|
+
value: crs
|
|
207
|
+
}, availableCRS[crs].label);
|
|
208
|
+
}))));
|
|
209
|
+
}
|
|
210
|
+
if (this.props.displayScales) {
|
|
211
|
+
widgets.push(/*#__PURE__*/React.createElement("div", {
|
|
212
|
+
key: "scales"
|
|
213
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
214
|
+
className: "bottombar-scales-label"
|
|
215
|
+
}, LocaleUtils.tr("bottombar.scale_label"), ":\xA0"), /*#__PURE__*/React.createElement(InputContainer, {
|
|
216
|
+
className: "bottombar-scale-combo"
|
|
217
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
218
|
+
className: "bottombar-scale-combo-prefix",
|
|
219
|
+
role: "prefix"
|
|
220
|
+
}, " 1 : "), /*#__PURE__*/React.createElement("select", {
|
|
221
|
+
onChange: function onChange(ev) {
|
|
222
|
+
return _this2.props.changeZoomLevel(parseInt(ev.target.value, 10));
|
|
223
|
+
},
|
|
224
|
+
role: "input",
|
|
225
|
+
value: Math.round(this.props.map.zoom)
|
|
226
|
+
}, this.props.map.scales.map(function (item, index) {
|
|
227
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
228
|
+
key: index,
|
|
229
|
+
value: index
|
|
230
|
+
}, LocaleUtils.toLocaleFixed(item, 0));
|
|
231
|
+
})), /*#__PURE__*/React.createElement(NumberInput, {
|
|
232
|
+
decimals: 0,
|
|
233
|
+
hideArrows: true,
|
|
234
|
+
onChange: this.setScale,
|
|
235
|
+
role: "input",
|
|
236
|
+
value: this.state.scale
|
|
237
|
+
}))));
|
|
238
|
+
}
|
|
239
|
+
if (this.props.displayQuickSelectDropdown && (((_this$props$bookmarks = this.props.bookmarks) === null || _this$props$bookmarks === void 0 ? void 0 : _this$props$bookmarks.length) > 0 || ((_this$props$visibilit = this.props.visibilityPresets) === null || _this$props$visibilit === void 0 ? void 0 : _this$props$visibilit.length) > 0)) {
|
|
240
|
+
var bookmarks = this.filterByActiveTheme(this.props.bookmarks || []);
|
|
241
|
+
var visibilityPresets = this.filterByActiveTheme(this.props.visibilityPresets || []);
|
|
242
|
+
var options = _defineProperty(_defineProperty({}, LocaleUtils.tr("appmenu.items.Bookmark"), bookmarks.map(function (bm) {
|
|
243
|
+
return ["bk:" + bm.key, bm.description];
|
|
244
|
+
})), LocaleUtils.tr("appmenu.items.VisibilityPresets"), visibilityPresets.map(function (bm) {
|
|
245
|
+
return ["vp:" + bm.key, bm.description];
|
|
246
|
+
}));
|
|
247
|
+
widgets.push(/*#__PURE__*/React.createElement("div", {
|
|
248
|
+
key: "quickselect"
|
|
249
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
250
|
+
className: "bottombar-quick-select-label"
|
|
251
|
+
}, LocaleUtils.tr("bottombar.quick_select_label"), ":\xA0"), /*#__PURE__*/React.createElement(GroupSelect, {
|
|
252
|
+
onChange: this.openBookmarkOrPreset,
|
|
253
|
+
options: options,
|
|
254
|
+
placeholder: LocaleUtils.tr("common.select")
|
|
255
|
+
})));
|
|
256
|
+
}
|
|
257
|
+
var rightBottomLinks = (this.props.additionalBottomBarLinks || []).filter(function (entry) {
|
|
258
|
+
return entry.side !== "left";
|
|
259
|
+
}).map(this.renderLink);
|
|
260
|
+
if (this.props.viewertitleUrl) {
|
|
261
|
+
var entry = {
|
|
262
|
+
url: this.props.viewertitleUrl,
|
|
263
|
+
urlTarget: this.props.viewertitleUrlTarget,
|
|
264
|
+
label: LocaleUtils.tr("bottombar.viewertitle_label"),
|
|
265
|
+
icon: this.props.viewertitleUrlIcon
|
|
266
|
+
};
|
|
267
|
+
rightBottomLinks.push(this.renderLink(entry));
|
|
268
|
+
}
|
|
269
|
+
if (this.props.termsUrl) {
|
|
270
|
+
var _entry = {
|
|
271
|
+
url: this.props.termsUrl,
|
|
272
|
+
urlTarget: this.props.termsUrlTarget,
|
|
273
|
+
label: LocaleUtils.tr("bottombar.terms_label"),
|
|
274
|
+
icon: this.props.termsUrlIcon
|
|
275
|
+
};
|
|
276
|
+
rightBottomLinks.push(this.renderLink(_entry));
|
|
277
|
+
}
|
|
278
|
+
widgets.push(/*#__PURE__*/React.createElement("span", {
|
|
279
|
+
className: "bottombar-spacer",
|
|
280
|
+
key: "spacer2"
|
|
266
281
|
}));
|
|
282
|
+
widgets.push(/*#__PURE__*/React.createElement("span", {
|
|
283
|
+
className: "bottombar-links",
|
|
284
|
+
key: "rightlinks"
|
|
285
|
+
}, rightBottomLinks));
|
|
267
286
|
}
|
|
268
287
|
var style = {
|
|
269
288
|
marginLeft: this.props.mapMargins.outerLeft + 'px',
|
|
270
289
|
marginRight: this.props.mapMargins.outerRight + 'px'
|
|
271
290
|
};
|
|
272
291
|
return /*#__PURE__*/React.createElement("div", {
|
|
292
|
+
className: this.props.fullscreen ? "bottombar-fullscreen" : "",
|
|
273
293
|
id: "BottomBar",
|
|
274
294
|
ref: this.storeHeight,
|
|
275
295
|
style: style
|
|
276
|
-
},
|
|
277
|
-
className: "bottombar-links"
|
|
278
|
-
}, leftBottomLinks), /*#__PURE__*/React.createElement("span", {
|
|
279
|
-
className: "bottombar-spacer"
|
|
280
|
-
}), coordinates, scales, quickSelectDropdown, /*#__PURE__*/React.createElement("span", {
|
|
281
|
-
className: "bottombar-spacer"
|
|
282
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
283
|
-
className: "bottombar-links"
|
|
284
|
-
}, rightBottomLinks));
|
|
296
|
+
}, widgets);
|
|
285
297
|
}
|
|
286
298
|
}]);
|
|
287
299
|
}(React.Component);
|
|
@@ -0,0 +1,135 @@
|
|
|
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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
6
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
7
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
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); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
|
+
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); }
|
|
13
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
14
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
15
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
16
|
+
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); }
|
|
17
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
18
|
+
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; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
20
|
+
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); }
|
|
21
|
+
/**
|
|
22
|
+
* Copyright 2026 Gustavo Werle
|
|
23
|
+
* All rights reserved.
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the BSD-style license found in the
|
|
26
|
+
* LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import React from 'react';
|
|
30
|
+
import { connect } from 'react-redux';
|
|
31
|
+
import PropTypes from 'prop-types';
|
|
32
|
+
import { addLayer, addLayerFeatures } from '../actions/layers';
|
|
33
|
+
import ConfigUtils from '../utils/ConfigUtils';
|
|
34
|
+
import FileImportUtils from '../utils/FileImportUtils';
|
|
35
|
+
import LocaleUtils from '../utils/LocaleUtils';
|
|
36
|
+
import './style/MapDropImport.css';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Adds layers by dropping supported files (KML, KMZ, GeoJSON, zipped Shapefile, GeoPDF) onto the map.
|
|
40
|
+
*
|
|
41
|
+
* Disabled if `disableImportingLocalLayers` is set in the theme or global config.
|
|
42
|
+
*/
|
|
43
|
+
var MapDropImport = /*#__PURE__*/function (_React$Component) {
|
|
44
|
+
function MapDropImport() {
|
|
45
|
+
var _this;
|
|
46
|
+
_classCallCheck(this, MapDropImport);
|
|
47
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
48
|
+
args[_key] = arguments[_key];
|
|
49
|
+
}
|
|
50
|
+
_this = _callSuper(this, MapDropImport, [].concat(args));
|
|
51
|
+
_defineProperty(_this, "state", {
|
|
52
|
+
dragging: false
|
|
53
|
+
});
|
|
54
|
+
_defineProperty(_this, "dropAllowed", function (ev) {
|
|
55
|
+
var _ev$dataTransfer;
|
|
56
|
+
return !ConfigUtils.getConfigProp("disableImportingLocalLayers", _this.props.theme) && _toConsumableArray(((_ev$dataTransfer = ev.dataTransfer) === null || _ev$dataTransfer === void 0 ? void 0 : _ev$dataTransfer.types) || []).includes("Files") && ev.target instanceof Element && ev.target.closest("#map") !== null;
|
|
57
|
+
});
|
|
58
|
+
_defineProperty(_this, "onDragOver", function (ev) {
|
|
59
|
+
if (_this.dropAllowed(ev)) {
|
|
60
|
+
ev.preventDefault();
|
|
61
|
+
ev.dataTransfer.dropEffect = 'copy';
|
|
62
|
+
if (!_this.state.dragging) {
|
|
63
|
+
_this.setState({
|
|
64
|
+
dragging: true
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
} else if (_this.state.dragging) {
|
|
68
|
+
_this.setState({
|
|
69
|
+
dragging: false
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
_defineProperty(_this, "onDragLeave", function (ev) {
|
|
74
|
+
// relatedTarget is null when the drag leaves the window
|
|
75
|
+
if (ev.relatedTarget === null && _this.state.dragging) {
|
|
76
|
+
_this.setState({
|
|
77
|
+
dragging: false
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
_defineProperty(_this, "onDrop", function (ev) {
|
|
82
|
+
if (_this.dropAllowed(ev)) {
|
|
83
|
+
ev.preventDefault();
|
|
84
|
+
_toConsumableArray(ev.dataTransfer.files).forEach(function (file) {
|
|
85
|
+
FileImportUtils.importFile(file, _this.props.mapCrs, _this.props.addLayer, _this.props.addLayerFeatures);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
_this.setState({
|
|
89
|
+
dragging: false
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
return _this;
|
|
93
|
+
}
|
|
94
|
+
_inherits(MapDropImport, _React$Component);
|
|
95
|
+
return _createClass(MapDropImport, [{
|
|
96
|
+
key: "componentDidMount",
|
|
97
|
+
value: function componentDidMount() {
|
|
98
|
+
document.addEventListener('dragover', this.onDragOver);
|
|
99
|
+
document.addEventListener('dragleave', this.onDragLeave);
|
|
100
|
+
document.addEventListener('drop', this.onDrop);
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
key: "componentWillUnmount",
|
|
104
|
+
value: function componentWillUnmount() {
|
|
105
|
+
document.removeEventListener('dragover', this.onDragOver);
|
|
106
|
+
document.removeEventListener('dragleave', this.onDragLeave);
|
|
107
|
+
document.removeEventListener('drop', this.onDrop);
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "render",
|
|
111
|
+
value: function render() {
|
|
112
|
+
if (!this.state.dragging) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
className: "map-drop-import-overlay"
|
|
117
|
+
}, /*#__PURE__*/React.createElement("span", null, LocaleUtils.tr("mapdropimport.dropfiles")));
|
|
118
|
+
}
|
|
119
|
+
}]);
|
|
120
|
+
}(React.Component);
|
|
121
|
+
_defineProperty(MapDropImport, "propTypes", {
|
|
122
|
+
addLayer: PropTypes.func,
|
|
123
|
+
addLayerFeatures: PropTypes.func,
|
|
124
|
+
mapCrs: PropTypes.string,
|
|
125
|
+
theme: PropTypes.object
|
|
126
|
+
});
|
|
127
|
+
export default connect(function (state) {
|
|
128
|
+
return {
|
|
129
|
+
mapCrs: state.map.projection,
|
|
130
|
+
theme: state.theme.current
|
|
131
|
+
};
|
|
132
|
+
}, {
|
|
133
|
+
addLayer: addLayer,
|
|
134
|
+
addLayerFeatures: addLayerFeatures
|
|
135
|
+
})(MapDropImport);
|