qwc2 2026.3.30 → 2026.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/map/layers/MVTLayer.js +15 -15
- package/components/map3d/ColorLayer3D.js +158 -0
- package/components/map3d/Map3D.js +98 -192
- package/components/map3d/drawtool/NumericInput3D.js +2 -2
- package/components/map3d/layers/GeoTIFFLayer3D.js +5 -4
- package/components/map3d/layers/Layer3D.js +168 -0
- package/components/map3d/layers/MVTLayer3D.js +59 -0
- package/components/map3d/layers/VectorLayer3D.js +10 -7
- package/components/map3d/layers/WFSLayer3D.js +8 -7
- package/components/map3d/layers/WMSLayer3D.js +6 -4
- package/components/map3d/layers/WMTSLayer3D.js +4 -3
- package/components/map3d/layers/index.js +3 -2
- package/components/style/AppMenu.css +6 -1
- package/icons/sunexp.svg +129 -0
- package/package.json +6 -4
- package/plugins/Identify.js +30 -6
- package/plugins/TopBar.js +1 -1
- package/plugins/map3d/LayerTree3D.js +2 -2
- package/plugins/map3d/SunExposure3D.js +415 -0
- package/plugins/map3d/TopBar3D.js +1 -1
- package/plugins/map3d/style/SunExposure3D.css +46 -0
- package/scripts/gen-plugin-docs.js +4 -0
- package/static/translations/bg-BG.json +13 -0
- package/static/translations/ca-ES.json +13 -0
- package/static/translations/cs-CZ.json +13 -0
- package/static/translations/de-CH.json +15 -2
- package/static/translations/de-DE.json +15 -2
- package/static/translations/en-US.json +13 -0
- package/static/translations/es-ES.json +13 -0
- package/static/translations/fi-FI.json +13 -0
- package/static/translations/fr-FR.json +13 -0
- package/static/translations/hu-HU.json +13 -0
- package/static/translations/it-IT.json +13 -0
- package/static/translations/ja-JP.json +13 -0
- package/static/translations/nl-NL.json +13 -0
- package/static/translations/no-NO.json +13 -0
- package/static/translations/pl-PL.json +13 -0
- package/static/translations/pt-BR.json +13 -0
- package/static/translations/pt-PT.json +13 -0
- package/static/translations/ro-RO.json +13 -0
- package/static/translations/ru-RU.json +13 -0
- package/static/translations/sv-SE.json +13 -0
- package/static/translations/tr-TR.json +13 -0
- package/static/translations/tsconfig.json +11 -0
- package/static/translations/uk-UA.json +13 -0
|
@@ -15,21 +15,21 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
15
15
|
import axios from 'axios';
|
|
16
16
|
import { applyStyle } from 'ol-mapbox-style';
|
|
17
17
|
import ol from 'openlayers';
|
|
18
|
+
export var createLayer = function createLayer(options) {
|
|
19
|
+
return new ol.layer.VectorTile(_objectSpread({
|
|
20
|
+
minResolution: options.minResolution,
|
|
21
|
+
maxResolution: options.maxResolution,
|
|
22
|
+
declutter: options.declutter,
|
|
23
|
+
source: new ol.source.VectorTile(_objectSpread({
|
|
24
|
+
projection: options.projection,
|
|
25
|
+
format: new ol.format.MVT({}),
|
|
26
|
+
url: options.url,
|
|
27
|
+
tileGrid: options.tileGridConfig ? new ol.tilegrid.TileGrid(_objectSpread({}, options.tileGridConfig)) : undefined
|
|
28
|
+
}, options.sourceConfig || {}))
|
|
29
|
+
}, options.layerConfig || {}));
|
|
30
|
+
};
|
|
18
31
|
export default {
|
|
19
32
|
create: function create(options) {
|
|
20
|
-
var createLayer = function createLayer() {
|
|
21
|
-
return new ol.layer.VectorTile(_objectSpread({
|
|
22
|
-
minResolution: options.minResolution,
|
|
23
|
-
maxResolution: options.maxResolution,
|
|
24
|
-
declutter: options.declutter,
|
|
25
|
-
source: new ol.source.VectorTile(_objectSpread({
|
|
26
|
-
projection: options.projection,
|
|
27
|
-
format: new ol.format.MVT({}),
|
|
28
|
-
url: options.url,
|
|
29
|
-
tileGrid: options.tileGridConfig ? new ol.tilegrid.TileGrid(_objectSpread({}, options.tileGridConfig)) : undefined
|
|
30
|
-
}, options.sourceConfig || {}))
|
|
31
|
-
}, options.layerConfig || {}));
|
|
32
|
-
};
|
|
33
33
|
var group = new ol.layer.Group();
|
|
34
34
|
if (options.style) {
|
|
35
35
|
axios.get(options.style).then(function (response) {
|
|
@@ -40,7 +40,7 @@ export default {
|
|
|
40
40
|
Object.keys(glStyle.sources).forEach(function (styleSource) {
|
|
41
41
|
var _glStyle$sources$styl;
|
|
42
42
|
((_glStyle$sources$styl = glStyle.sources[styleSource].url) === null || _glStyle$sources$styl === void 0 ? void 0 : _glStyle$sources$styl.startsWith(".")) && (glStyle.sources[styleSource].url = new URL(glStyle.sources[styleSource].url, options.style).href);
|
|
43
|
-
var layer = createLayer();
|
|
43
|
+
var layer = createLayer(options);
|
|
44
44
|
applyStyle(layer, glStyle, styleSource, options.styleOptions).then(function () {
|
|
45
45
|
group.getLayers().push(layer);
|
|
46
46
|
})["catch"](function (e) {
|
|
@@ -53,7 +53,7 @@ export default {
|
|
|
53
53
|
console.warn("Unable to load style " + options.style + ": " + String(e));
|
|
54
54
|
});
|
|
55
55
|
} else {
|
|
56
|
-
group.getLayers().push(createLayer());
|
|
56
|
+
group.getLayers().push(createLayer(options));
|
|
57
57
|
}
|
|
58
58
|
return group;
|
|
59
59
|
}
|
|
@@ -0,0 +1,158 @@
|
|
|
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; }
|
|
4
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
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); } }
|
|
6
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
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); }
|
|
9
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
12
|
+
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); }
|
|
13
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
14
|
+
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; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
|
+
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); }
|
|
17
|
+
/**
|
|
18
|
+
* Copyright 2026 Sourcepole AG
|
|
19
|
+
* All rights reserved.
|
|
20
|
+
*
|
|
21
|
+
* This source code is licensed under the BSD-style license found in the
|
|
22
|
+
* LICENSE file in the root directory of this source tree.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React from 'react';
|
|
26
|
+
import DrapedFeatureCollection from '@giro3d/giro3d/entities/DrapedFeatureCollection';
|
|
27
|
+
import PropTypes from 'prop-types';
|
|
28
|
+
import LayerRegistry3D from './layers/index';
|
|
29
|
+
var ColorLayer3D = /*#__PURE__*/function (_React$Component) {
|
|
30
|
+
function ColorLayer3D(props) {
|
|
31
|
+
var _this;
|
|
32
|
+
_classCallCheck(this, ColorLayer3D);
|
|
33
|
+
_this = _callSuper(this, ColorLayer3D, [props]);
|
|
34
|
+
_defineProperty(_this, "applyLayerOptions", function (layerCreator, prevOptions) {
|
|
35
|
+
var _this$props$map$getLa;
|
|
36
|
+
var options = _this.props.options;
|
|
37
|
+
// Reorder layer
|
|
38
|
+
var layerBelow = (_this$props$map$getLa = _this.props.map.getLayers(function (l) {
|
|
39
|
+
return l.userData.layerId === _this.props.prevLayerId;
|
|
40
|
+
})[0]) !== null && _this$props$map$getLa !== void 0 ? _this$props$map$getLa : null;
|
|
41
|
+
_this.mapLayer.moveAfter(layerBelow);
|
|
42
|
+
// WMS layer handles visibility and opacity internally
|
|
43
|
+
if (_this.props.options.type !== "wms") {
|
|
44
|
+
_this.mapLayer.setVisible(options.visibility);
|
|
45
|
+
_this.mapLayer.setOpacity(options.opacity / 255);
|
|
46
|
+
}
|
|
47
|
+
if (_this.props.options.extrusionHeight !== undefined && _this.props.options.extrusionHeight !== 0) {
|
|
48
|
+
_this.createUpdateExtrudedLayer(layerCreator, options, options.features !== (prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.features));
|
|
49
|
+
} else if ((prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.extrusionHeight) !== undefined && (prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.extrusionHeight) !== 0) {
|
|
50
|
+
_this.props.sceneContext.removeSceneObject(_this.props.options.id + ":extruded");
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
_defineProperty(_this, "createUpdateExtrudedLayer", function (layerCreator, options) {
|
|
54
|
+
var _options$features, _options$features$red;
|
|
55
|
+
var forceCreate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
56
|
+
var objId = options.id + ":extruded";
|
|
57
|
+
var makeColor = function makeColor(c) {
|
|
58
|
+
if (Array.isArray(c)) {
|
|
59
|
+
return c[0] << 16 | c[1] << 8 | c[2];
|
|
60
|
+
} else if (typeof c === "string") {
|
|
61
|
+
return parseInt(c.replace("#", ""), 16);
|
|
62
|
+
} else {
|
|
63
|
+
return c;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var obj = _this.props.sceneContext.getSceneObject(objId);
|
|
67
|
+
if (!obj || forceCreate) {
|
|
68
|
+
var _options$color;
|
|
69
|
+
if (obj) {
|
|
70
|
+
_this.props.sceneContext.removeSceneObject(objId);
|
|
71
|
+
}
|
|
72
|
+
var layercolor = makeColor((_options$color = options.color) !== null && _options$color !== void 0 ? _options$color : "#FF0000");
|
|
73
|
+
obj = new DrapedFeatureCollection({
|
|
74
|
+
source: layerCreator.createFeatureSource(_this.mapLayer, options, _this.props.sceneContext.mapCrs),
|
|
75
|
+
drapingMode: 'per-feature',
|
|
76
|
+
extrusionOffset: function extrusionOffset(feature) {
|
|
77
|
+
if (typeof obj.userData.extrusionHeight === "string") {
|
|
78
|
+
return parseFloat(feature.getProperties()[obj.userData.extrusionHeight]) || 0;
|
|
79
|
+
} else {
|
|
80
|
+
return obj.userData.extrusionHeight;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
style: function style(feature) {
|
|
84
|
+
var _obj$userData$feature, _obj$userData$feature2;
|
|
85
|
+
return (_obj$userData$feature = (_obj$userData$feature2 = obj.userData.featureStyles) === null || _obj$userData$feature2 === void 0 ? void 0 : _obj$userData$feature2[feature.getId()]) !== null && _obj$userData$feature !== void 0 ? _obj$userData$feature : {
|
|
86
|
+
fill: {
|
|
87
|
+
color: layercolor,
|
|
88
|
+
shading: true
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
obj.castShadow = true;
|
|
94
|
+
obj.receiveShadow = true;
|
|
95
|
+
_this.props.sceneContext.addSceneObject(objId, obj, false, {}, false, function () {
|
|
96
|
+
obj.attach(_this.props.map);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
obj.userData.extrusionHeight = options.extrusionHeight;
|
|
100
|
+
obj.userData.featureStyles = (_options$features = options.features) === null || _options$features === void 0 || (_options$features$red = _options$features.reduce) === null || _options$features$red === void 0 ? void 0 : _options$features$red.call(_options$features, function (res, feature) {
|
|
101
|
+
return _objectSpread(_objectSpread({}, res), {}, _defineProperty({}, feature.id, {
|
|
102
|
+
fill: {
|
|
103
|
+
color: makeColor(feature.styleOptions.fillColor),
|
|
104
|
+
shading: true
|
|
105
|
+
}
|
|
106
|
+
}));
|
|
107
|
+
}, {});
|
|
108
|
+
obj.opacity = _this.mapLayer.opacity();
|
|
109
|
+
obj.visible = _this.mapLayer.visible();
|
|
110
|
+
if (obj.visible) {
|
|
111
|
+
obj.updateStyles();
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
_this.mapLayer = null;
|
|
115
|
+
return _this;
|
|
116
|
+
}
|
|
117
|
+
_inherits(ColorLayer3D, _React$Component);
|
|
118
|
+
return _createClass(ColorLayer3D, [{
|
|
119
|
+
key: "componentDidMount",
|
|
120
|
+
value: function componentDidMount() {
|
|
121
|
+
var layerCreator = LayerRegistry3D[this.props.options.type];
|
|
122
|
+
if (layerCreator) {
|
|
123
|
+
this.mapLayer = layerCreator.create3d(this.props.options, this.props.sceneContext.mapCrs);
|
|
124
|
+
this.mapLayer.attach(this.props.map);
|
|
125
|
+
this.applyLayerOptions(layerCreator, {});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
129
|
+
key: "componentDidUpdate",
|
|
130
|
+
value: function componentDidUpdate(prevProps) {
|
|
131
|
+
var layerCreator = LayerRegistry3D[this.props.options.type];
|
|
132
|
+
if (this.mapLayer && layerCreator) {
|
|
133
|
+
layerCreator.update3d(this.mapLayer, this.props.options, prevProps.options, this.props.sceneContext.mapCrs);
|
|
134
|
+
this.applyLayerOptions(layerCreator, prevProps.options);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
key: "componentWillUnmount",
|
|
139
|
+
value: function componentWillUnmount() {
|
|
140
|
+
if (this.mapLayer) {
|
|
141
|
+
this.props.sceneContext.removeSceneObject(this.props.options.id + ":extruded");
|
|
142
|
+
this.mapLayer.dispose();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "render",
|
|
147
|
+
value: function render() {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
}]);
|
|
151
|
+
}(React.Component);
|
|
152
|
+
_defineProperty(ColorLayer3D, "propTypes", {
|
|
153
|
+
map: PropTypes.object,
|
|
154
|
+
options: PropTypes.object,
|
|
155
|
+
prevLayerId: PropTypes.string,
|
|
156
|
+
sceneContext: PropTypes.object
|
|
157
|
+
});
|
|
158
|
+
export { ColorLayer3D as default };
|