@masterportal/masterportalapi 2.16.0 → 2.18.0
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/CHANGELOG.md +35 -0
- package/example/config/portal.json +2 -1
- package/example/config/services.json +4 -4
- package/example/index.js +1 -1
- package/package.json +13 -13
- package/src/layer/vectorTile.js +20 -8
- package/src/maps/ol/olMap.js +17 -12
- package/src/maps/olcs/3dUtils/wmsRasterSynchronizer.js +5 -5
- package/src/vectorStyle/styleList.js +6 -3
- package/src/vectorStyle/styles/point/stylePointNominal.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
|
|
4
4
|
The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
|
|
5
5
|
|
|
6
|
+
## 2.18.0 - 2023-05-10
|
|
7
|
+
### Changed
|
|
8
|
+
- The following packages have been updated:
|
|
9
|
+
- dependencies:
|
|
10
|
+
- core-js: 3.29.1 to 3.30.2
|
|
11
|
+
- olcs: 2.13.1 to 2.14.0
|
|
12
|
+
- devDependencies:
|
|
13
|
+
- @babel/core: 7.21.3 to 7.21.8
|
|
14
|
+
- @babel/plugin-transform-modules-commonjs: 7.21.2 to 7.21.5
|
|
15
|
+
- @parcel/transformer-sass: 2.6.0 to 2.8.3
|
|
16
|
+
- canvas: 2.11.0 to 2.11.2
|
|
17
|
+
- eslint: 8.36.0 to 8.40.0
|
|
18
|
+
- jest-canvas-mock: 2.4.0 to 2.5.0
|
|
19
|
+
- parcel: 2.6.0 to 2.8.3
|
|
20
|
+
- sass: 1.59.3 to 1.62.1
|
|
21
|
+
- The devDependency `buffer` ist downgrade from 6.0.3 to 5.7.1 because parcel requires a version 5
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2.17.0 - 2023-04-27
|
|
26
|
+
### Added
|
|
27
|
+
- Added functionality for mapbox style raster sources for vector tile layer.
|
|
28
|
+
- Added possibility to use zoomToFeatureId in vectorStyle.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- ol map default interactions and keyboardEventTarget can now be set by config parameters.
|
|
32
|
+
- The following packages have been updated:
|
|
33
|
+
- dependencies:
|
|
34
|
+
- xml2js: 0.4.23 to 0.5.0
|
|
35
|
+
|
|
36
|
+
### Fix
|
|
37
|
+
- Fix vectorStyle for circlesegments.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
6
41
|
## 2.16.0 - 2023-03-28
|
|
7
42
|
### Added
|
|
8
43
|
- Added support for `npm` version ^9.1.3.
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
{
|
|
3
3
|
"id": "1001",
|
|
4
4
|
"typ": "WMS",
|
|
5
|
-
"name": "
|
|
6
|
-
"url": "https://
|
|
5
|
+
"name" : "Geobasiskarten (HamburgDE)",
|
|
6
|
+
"url" : "https://geodienste.hamburg.de/HH_WMS_HamburgDE",
|
|
7
7
|
"format": "image/png",
|
|
8
8
|
"version": "1.3.0",
|
|
9
|
-
"layers": "
|
|
9
|
+
"layers" : "Geobasiskarten_HHde",
|
|
10
10
|
"transparent": true,
|
|
11
11
|
"singleTile": false,
|
|
12
|
-
"tilesize":
|
|
12
|
+
"tilesize" : 512,
|
|
13
13
|
"gutter": 0,
|
|
14
14
|
"minScale": 1,
|
|
15
15
|
"maxScale": 200
|
package/example/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masterportal/masterportalapi",
|
|
3
3
|
"author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.18.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Basic functions of the Masterportal as api",
|
|
7
7
|
"repository": {
|
|
@@ -19,28 +19,28 @@
|
|
|
19
19
|
"prepare": "husky install"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"core-js": "^3.
|
|
22
|
+
"core-js": "^3.30.2",
|
|
23
23
|
"ol": "7.3.0",
|
|
24
|
-
"olcs": "^2.
|
|
24
|
+
"olcs": "^2.14.0",
|
|
25
25
|
"proj4": "^2.9.0",
|
|
26
|
-
"xml2js": "^0.
|
|
26
|
+
"xml2js": "^0.5.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@babel/core": "^7.21.
|
|
30
|
-
"@babel/plugin-transform-modules-commonjs": "^7.21.
|
|
31
|
-
"@parcel/transformer-sass": "^2.
|
|
32
|
-
"buffer": "^
|
|
33
|
-
"canvas": "^2.11.
|
|
34
|
-
"eslint": "^8.
|
|
29
|
+
"@babel/core": "^7.21.8",
|
|
30
|
+
"@babel/plugin-transform-modules-commonjs": "^7.21.5",
|
|
31
|
+
"@parcel/transformer-sass": "^2.8.3",
|
|
32
|
+
"buffer": "^5.7.1",
|
|
33
|
+
"canvas": "^2.11.2",
|
|
34
|
+
"eslint": "^8.40.0",
|
|
35
35
|
"events": "^3.3.0",
|
|
36
36
|
"husky": "^8.0.3",
|
|
37
37
|
"jest": "^29.5.0",
|
|
38
|
-
"jest-canvas-mock": "^2.
|
|
38
|
+
"jest-canvas-mock": "^2.5.0",
|
|
39
39
|
"jest-environment-jsdom": "^29.5.0",
|
|
40
40
|
"jsdoc": "^4.0.2",
|
|
41
|
-
"parcel": "^2.
|
|
41
|
+
"parcel": "^2.8.3",
|
|
42
42
|
"process": "^0.11.10",
|
|
43
|
-
"sass": "^1.
|
|
43
|
+
"sass": "^1.62.1",
|
|
44
44
|
"stream-browserify": "^3.0.0",
|
|
45
45
|
"timers-browserify": "^2.0.12",
|
|
46
46
|
"use-resize-observer": "^9.1.0"
|
package/src/layer/vectorTile.js
CHANGED
|
@@ -4,7 +4,7 @@ import VectorTileSource from "ol/source/VectorTile";
|
|
|
4
4
|
import OpenLayersTileGrid from "ol/tilegrid/TileGrid";
|
|
5
5
|
import {extentFromProjection} from "ol/tilegrid";
|
|
6
6
|
|
|
7
|
-
import {stylefunction} from "ol-mapbox-style";
|
|
7
|
+
import {stylefunction, apply} from "ol-mapbox-style";
|
|
8
8
|
|
|
9
9
|
import defaults from "../defaults";
|
|
10
10
|
|
|
@@ -161,13 +161,25 @@ export function createLayer (rawLayer = {}, {layerParams = {}, options = {}} = {
|
|
|
161
161
|
* @param {ol.layer.VectorTile} layer - layer to style
|
|
162
162
|
* @param {object} glStyle - MapBox style definition
|
|
163
163
|
* @param {options} [styleParams={}] - Additional options for style specification
|
|
164
|
+
* @param {string} url - MapBox style url
|
|
164
165
|
* @returns {void}
|
|
165
166
|
*/
|
|
166
|
-
export function setStyle (layer, glStyle, {options = {}} = {}) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
export function setStyle (layer, glStyle, {options = {}} = {}, url) {
|
|
168
|
+
Object.keys(glStyle.sources).forEach((key) => {
|
|
169
|
+
const glStyleSourceId = key;
|
|
170
|
+
|
|
171
|
+
if (glStyle.sources[key].type !== "vector" && glStyle.sources[key].type !== "geojson") {
|
|
172
|
+
const olMap = layer.get("map");
|
|
173
|
+
|
|
174
|
+
apply(olMap, url);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
stylefunction(layer, glStyle,
|
|
178
|
+
options.sourceId ? options.sourceId : glStyleSourceId,
|
|
179
|
+
options.resolutions,
|
|
180
|
+
options.spriteData,
|
|
181
|
+
options.spriteImageUrl,
|
|
182
|
+
options.getFonts);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
173
185
|
}
|
package/src/maps/ol/olMap.js
CHANGED
|
@@ -150,18 +150,23 @@ export function createMap (config = defaults, {mapParams, callback, errorCallbac
|
|
|
150
150
|
crs.registerProjections(config.namedProjections);
|
|
151
151
|
setBackgroundImage(config);
|
|
152
152
|
setGazetteerUrl(config.gazetteerUrl);
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
153
|
+
const selectedInteractions = config.mapInteractions?.interactionModes ? config.mapInteractions?.interactionModes : {dragPan: false, altShiftDragRotate: false, pinchRotate: false},
|
|
154
|
+
map = new Map(Object.assign({
|
|
155
|
+
target: config.target || defaults.target,
|
|
156
|
+
interactions: olDefaultInteractions(selectedInteractions).extend([
|
|
157
|
+
new DragPan({
|
|
158
|
+
condition: function (event) {
|
|
159
|
+
if (event.originalEvent.shiftKey) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
return (!event.originalEvent.pointerType || event.originalEvent.pointerType === "mouse") || (config.twoFingerPan && this.getPointerCount() === 2) || !config.twoFingerPan;
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
]),
|
|
166
|
+
controls: [],
|
|
167
|
+
view: createMapView(config),
|
|
168
|
+
keyboardEventTarget: config.mapInteractions?.keyboardEventTarget ? config.mapInteractions?.keyboardEventTarget : false
|
|
169
|
+
}, mapParams));
|
|
165
170
|
|
|
166
171
|
map.set("mapMode", "2D");
|
|
167
172
|
map.set("id", `map2D_${mapIdCounter++}`);
|
|
@@ -7,7 +7,7 @@ import TileWMS from "ol/source/TileWMS.js";
|
|
|
7
7
|
import ImageWMS from "ol/source/ImageWMS.js";
|
|
8
8
|
import WMTS from "ol/source/WMTS.js";
|
|
9
9
|
import olcsAbstractSynchronizer from "olcs/AbstractSynchronizer.js";
|
|
10
|
-
import
|
|
10
|
+
import {extentToRectangle, tileLayerToImageryLayer, updateCesiumLayerProperties} from "olcs/core.js";
|
|
11
11
|
import {Tile, Image as ImageLayer} from "ol/layer.js";
|
|
12
12
|
import {stableSort} from "ol/array.js";
|
|
13
13
|
import {getBottomLeft, getBottomRight, getTopRight, getTopLeft} from "ol/extent.js";
|
|
@@ -162,7 +162,7 @@ class WMSRasterSynchronizer extends olcsAbstractSynchronizer {
|
|
|
162
162
|
const ext = olLayer.getExtent();
|
|
163
163
|
|
|
164
164
|
if (ext && viewProj) {
|
|
165
|
-
options.rectangle =
|
|
165
|
+
options.rectangle = extentToRectangle(ext, viewProj);
|
|
166
166
|
const minMax = this.getMinMaxLevelFromTileGrid(tileGrid, ext, viewProj);
|
|
167
167
|
|
|
168
168
|
options.tileWidth = tileGrid.getTileSize(0)[0];
|
|
@@ -182,7 +182,7 @@ class WMSRasterSynchronizer extends olcsAbstractSynchronizer {
|
|
|
182
182
|
* @returns {Cesium.ImageryLayer} The imagery layer.
|
|
183
183
|
*/
|
|
184
184
|
createImageryLayerForImageWMS (olLayer, viewProj) {
|
|
185
|
-
return
|
|
185
|
+
return tileLayerToImageryLayer(this.map, olLayer, viewProj);
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
/**
|
|
@@ -298,13 +298,13 @@ class WMSRasterSynchronizer extends olcsAbstractSynchronizer {
|
|
|
298
298
|
console.assert(cesiumObjects);
|
|
299
299
|
/* eslint-enable no-console */
|
|
300
300
|
for (let i = 0; i < cesiumObjects.length; ++i) {
|
|
301
|
-
|
|
301
|
+
updateCesiumLayerProperties(olLayerWithParents, cesiumObjects[i]);
|
|
302
302
|
}
|
|
303
303
|
}));
|
|
304
304
|
});
|
|
305
305
|
|
|
306
306
|
for (let i = 0; i < cesiumObjects.length; ++i) {
|
|
307
|
-
|
|
307
|
+
updateCesiumLayerProperties(olLayerWithParents, cesiumObjects[i]);
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
// there is no way to modify Cesium layer extent,
|
|
@@ -18,7 +18,8 @@ let styleList,
|
|
|
18
18
|
highlightFeaturesPolygonStyleId,
|
|
19
19
|
highlightFeaturesLineStyleId,
|
|
20
20
|
styleConf,
|
|
21
|
-
featureViaUrlLayers
|
|
21
|
+
featureViaUrlLayers,
|
|
22
|
+
zoomToFeatureId;
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Gathers the styleIds of the layers.
|
|
@@ -196,9 +197,10 @@ function parseStyles (data) {
|
|
|
196
197
|
getStyleIdForHighlightFeaturesPolygon(),
|
|
197
198
|
getStyleIdForHighlightFeaturesLine(),
|
|
198
199
|
getStyleIdsFromTools(),
|
|
199
|
-
getFeatureViaURLStyles()
|
|
200
|
+
getFeatureViaURLStyles(),
|
|
201
|
+
zoomToFeatureId);
|
|
200
202
|
|
|
201
|
-
styleIds = styleIds.reduce((acc, val) => acc.concat(val), []);
|
|
203
|
+
styleIds = styleIds.reduce((acc, val) => acc.concat(val), []).filter(item => item);
|
|
202
204
|
filteredData = dataWithDefaultValue.filter(styleObject => styleIds.includes(styleObject.styleId));
|
|
203
205
|
|
|
204
206
|
return filteredData;
|
|
@@ -223,6 +225,7 @@ function initializeStyleList (styleGetters, Config, layers, tools, callback) {
|
|
|
223
225
|
highlightFeaturesPointStyleId = styleGetters.highlightFeaturesPointStyleId;
|
|
224
226
|
highlightFeaturesPolygonStyleId = styleGetters.highlightFeaturesPolygonStyleId;
|
|
225
227
|
highlightFeaturesLineStyleId = styleGetters.highlightFeaturesLineStyleId;
|
|
228
|
+
zoomToFeatureId = styleGetters.zoomToFeatureId;
|
|
226
229
|
|
|
227
230
|
styleConf = Config.styleConf;
|
|
228
231
|
featureViaUrlLayers = Config.featureViaURL?.layers;
|
|
@@ -220,11 +220,14 @@ export function createNominalPointStyle (attributes, feature, defaultImageName)
|
|
|
220
220
|
if (styleScalingShape === "CIRCLESEGMENTS") {
|
|
221
221
|
svgPath = createNominalCircleSegments(workingFeature, attributes);
|
|
222
222
|
style = createSVGStyle(svgPath, 5);
|
|
223
|
+
style.type = "CIRCLESEGMENTS";
|
|
224
|
+
style.scalingAttribute = workingFeature.get(attributes.scalingAttribute);
|
|
223
225
|
}
|
|
224
226
|
|
|
225
227
|
// create style from svg and image
|
|
226
228
|
if (imageName !== defaultImageName) {
|
|
227
229
|
imageStyle = createIconStyle(attributes, feature);
|
|
230
|
+
imageStyle.type = "imageStyle";
|
|
228
231
|
style = [style, imageStyle];
|
|
229
232
|
}
|
|
230
233
|
|