qwc2 2026.3.30 → 2026.4.3

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 (49) hide show
  1. package/LICENSE +1 -6
  2. package/README.md +8 -4
  3. package/components/map/layers/MVTLayer.js +71 -33
  4. package/components/map3d/ColorLayer3D.js +159 -0
  5. package/components/map3d/Map3D.js +98 -192
  6. package/components/map3d/drawtool/NumericInput3D.js +2 -2
  7. package/components/map3d/layers/GeoTIFFLayer3D.js +5 -4
  8. package/components/map3d/layers/Layer3D.js +168 -0
  9. package/components/map3d/layers/MVTLayer3D.js +40 -0
  10. package/components/map3d/layers/VectorLayer3D.js +10 -7
  11. package/components/map3d/layers/WFSLayer3D.js +8 -7
  12. package/components/map3d/layers/WMSLayer3D.js +6 -4
  13. package/components/map3d/layers/WMTSLayer3D.js +4 -3
  14. package/components/map3d/layers/index.js +3 -2
  15. package/components/style/AppMenu.css +6 -1
  16. package/icons/sunexp.svg +129 -0
  17. package/package.json +6 -4
  18. package/plugins/Identify.js +30 -6
  19. package/plugins/SensorThingsTool.js +71 -8
  20. package/plugins/TopBar.js +1 -1
  21. package/plugins/map3d/LayerTree3D.js +2 -2
  22. package/plugins/map3d/SunExposure3D.js +415 -0
  23. package/plugins/map3d/TopBar3D.js +1 -1
  24. package/plugins/map3d/style/SunExposure3D.css +46 -0
  25. package/plugins/style/SensorThingsTool.css +27 -1
  26. package/scripts/gen-plugin-docs.js +4 -0
  27. package/static/translations/bg-BG.json +15 -0
  28. package/static/translations/ca-ES.json +15 -0
  29. package/static/translations/cs-CZ.json +15 -0
  30. package/static/translations/de-CH.json +17 -2
  31. package/static/translations/de-DE.json +17 -2
  32. package/static/translations/en-US.json +15 -0
  33. package/static/translations/es-ES.json +15 -0
  34. package/static/translations/fi-FI.json +15 -0
  35. package/static/translations/fr-FR.json +15 -0
  36. package/static/translations/hu-HU.json +15 -0
  37. package/static/translations/it-IT.json +15 -0
  38. package/static/translations/ja-JP.json +15 -0
  39. package/static/translations/nl-NL.json +15 -0
  40. package/static/translations/no-NO.json +15 -0
  41. package/static/translations/pl-PL.json +15 -0
  42. package/static/translations/pt-BR.json +15 -0
  43. package/static/translations/pt-PT.json +15 -0
  44. package/static/translations/ro-RO.json +15 -0
  45. package/static/translations/ru-RU.json +15 -0
  46. package/static/translations/sv-SE.json +15 -0
  47. package/static/translations/tr-TR.json +15 -0
  48. package/static/translations/tsconfig.json +13 -0
  49. package/static/translations/uk-UA.json +15 -0
package/LICENSE CHANGED
@@ -1,6 +1,5 @@
1
1
  Copyright (c) 2015-2016 GeoSolutions Sas
2
- Copyright (c) 2016-2024 Sourcepole AG
3
- Copyright (c) 2021 Oslandia SAS <infos+qwc2@oslandia.com>
2
+ Copyright (c) QWC Contributors <https://github.com/qgis/qwc2/graphs/contributors>
4
3
  All rights reserved.
5
4
 
6
5
  Redistribution and use in source and binary forms, with or without modification, are
@@ -22,7 +21,3 @@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRU
22
21
  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
23
22
  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
23
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
-
26
- The views and conclusions contained in the software and documentation are those
27
- of the authors and should not be interpreted as representing official policies,
28
- either expressed or implied, of the MapStore2 Project.
package/README.md CHANGED
@@ -8,18 +8,22 @@ The `qwc2` NPM package can be used as a dependency to build a custom QWC applica
8
8
 
9
9
  ![Screenshot](https://github.com/qgis/qwc2/blob/gh-pages/Screenshot.jpg?raw=true)
10
10
 
11
- ### Main Features
11
+ ## Homepage
12
+
13
+ See [qwc.app](https://qwc.app).
14
+
15
+ ## Main Features
12
16
 
13
17
  See [qwc.app/features](https://qwc.app/features).
14
18
 
15
19
  ## Quick start
16
20
 
17
- See [qwc-services.github.io/master/QuickStart/](https://qwc-services.github.io/master/QuickStart/)
21
+ See [docs.qwc.app/master/QuickStart/](https://docs.qwc.app/master/QuickStart/).
18
22
 
19
23
  ## Documentation
20
24
 
21
- * [qwc-services.github.io](https://qwc-services.github.io/)
22
- * [ChangeLog](https://qwc-services.github.io/master/release_notes/ChangeLog/)
25
+ * [docs.qwc.app](https://docs.qwc.app)
26
+ * [ChangeLog](https://docs.qwc.app/master/release_notes/ChangeLog/)
23
27
 
24
28
  ## Help
25
29
 
@@ -15,45 +15,83 @@ 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
+ function createLayer(url, 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: url,
27
+ tileGrid: options.tileGridConfig ? new ol.tilegrid.TileGrid(_objectSpread({}, options.tileGridConfig)) : undefined
28
+ }, options.sourceConfig || {}))
29
+ }, options.layerConfig || {}));
30
+ }
31
+ export function createFromStyle(style, options, callback) {
32
+ axios.get(style).then(function (response) {
33
+ var _glStyle$sprite, _glStyle$glyphs;
34
+ var glStyle = response.data;
35
+ ((_glStyle$sprite = glStyle.sprite) === null || _glStyle$sprite === void 0 ? void 0 : _glStyle$sprite.startsWith(".")) && (glStyle.sprite = new URL(glStyle.sprite, options.style).href);
36
+ ((_glStyle$glyphs = glStyle.glyphs) === null || _glStyle$glyphs === void 0 ? void 0 : _glStyle$glyphs.startsWith(".")) && (glStyle.glyphs = new URL(glStyle.glyphs, options.style).href);
37
+ // Collect used sources
38
+ var usedSources = new Set(glStyle.layers.map(function (l) {
39
+ return l.source;
40
+ }).filter(Boolean));
41
+ // Create layer for each source
42
+ usedSources.forEach(function (sourceName) {
43
+ var _source$url, _source$tiles;
44
+ var source = glStyle.sources[sourceName];
45
+ if (source.type !== 'vector' && source.type !== 'geojson') {
46
+ return;
47
+ }
48
+ ((_source$url = source.url) === null || _source$url === void 0 ? void 0 : _source$url.startsWith(".")) && (source.url = new URL(source.url, options.style).href);
49
+ if ((_source$tiles = source.tiles) !== null && _source$tiles !== void 0 && _source$tiles.length) {
50
+ var layer = createLayer(source.tiles[0], options);
51
+ applyStyle(layer, style, sourceName, options.styleOptions).then(function () {
52
+ callback(layer);
53
+ })["catch"](function (e) {
54
+ /* eslint-disable-next-line */
55
+ console.warn("Unable to apply style " + sourceName + ": " + String(e));
56
+ });
57
+ } else if (source.url) {
58
+ axios.get(source.url).then(function (response2) {
59
+ var _response2$data;
60
+ if ((_response2$data = response2.data) !== null && _response2$data !== void 0 && (_response2$data = _response2$data.tiles) !== null && _response2$data !== void 0 && _response2$data.length) {
61
+ var _layer = createLayer(response2.data.tiles[0], options, callback);
62
+ applyStyle(_layer, style, sourceName, options.styleOptions).then(function () {
63
+ callback(_layer);
64
+ })["catch"](function (e) {
65
+ /* eslint-disable-next-line */
66
+ console.warn("Unable to apply style " + sourceName + ": " + String(e));
67
+ });
68
+ } else {
69
+ /* eslint-disable-next-line */
70
+ console.warn("Could not find source tile URL for style " + sourceName);
71
+ }
72
+ })["catch"](function () {
73
+ /* eslint-disable-next-line */
74
+ console.warn("Could not find source tile URL for style " + sourceName);
75
+ });
76
+ } else {
77
+ /* eslint-disable-next-line */
78
+ console.warn("Could not find source tile URL for style " + sourceName);
79
+ }
80
+ });
81
+ })["catch"](function (e) {
82
+ /* eslint-disable-next-line */
83
+ console.warn("Unable to load style " + options.style + ": " + String(e));
84
+ });
85
+ }
18
86
  export default {
19
87
  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
88
  var group = new ol.layer.Group();
34
89
  if (options.style) {
35
- axios.get(options.style).then(function (response) {
36
- var _glStyle$sprite, _glStyle$glyphs;
37
- var glStyle = response.data;
38
- ((_glStyle$sprite = glStyle.sprite) === null || _glStyle$sprite === void 0 ? void 0 : _glStyle$sprite.startsWith(".")) && (glStyle.sprite = new URL(glStyle.sprite, options.style).href);
39
- ((_glStyle$glyphs = glStyle.glyphs) === null || _glStyle$glyphs === void 0 ? void 0 : _glStyle$glyphs.startsWith(".")) && (glStyle.glyphs = new URL(glStyle.glyphs, options.style).href);
40
- Object.keys(glStyle.sources).forEach(function (styleSource) {
41
- var _glStyle$sources$styl;
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();
44
- applyStyle(layer, glStyle, styleSource, options.styleOptions).then(function () {
45
- group.getLayers().push(layer);
46
- })["catch"](function (e) {
47
- /* eslint-disable-next-line */
48
- console.warn("Unable to apply style " + options.style + ": " + String(e));
49
- });
50
- });
51
- })["catch"](function (e) {
52
- /* eslint-disable-next-line */
53
- console.warn("Unable to load style " + options.style + ": " + String(e));
90
+ createFromStyle(options.style, options, function (layer) {
91
+ group.getLayers().push(layer);
54
92
  });
55
93
  } else {
56
- group.getLayers().push(createLayer());
94
+ group.getLayers().push(createLayer(options.url, options));
57
95
  }
58
96
  return group;
59
97
  }
@@ -0,0 +1,159 @@
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
+ var _layerCreator$update;
134
+ (_layerCreator$update = layerCreator.update3d) === null || _layerCreator$update === void 0 || _layerCreator$update.call(layerCreator, this.mapLayer, this.props.options, prevProps.options, this.props.sceneContext.mapCrs);
135
+ this.applyLayerOptions(layerCreator, prevProps.options);
136
+ }
137
+ }
138
+ }, {
139
+ key: "componentWillUnmount",
140
+ value: function componentWillUnmount() {
141
+ if (this.mapLayer) {
142
+ this.props.sceneContext.removeSceneObject(this.props.options.id + ":extruded");
143
+ this.mapLayer.dispose();
144
+ }
145
+ }
146
+ }, {
147
+ key: "render",
148
+ value: function render() {
149
+ return null;
150
+ }
151
+ }]);
152
+ }(React.Component);
153
+ _defineProperty(ColorLayer3D, "propTypes", {
154
+ map: PropTypes.object,
155
+ options: PropTypes.object,
156
+ prevLayerId: PropTypes.string,
157
+ sceneContext: PropTypes.object
158
+ });
159
+ export { ColorLayer3D as default };