@masterportal/masterportalapi 2.15.1 → 2.15.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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
3
3
|
|
|
4
4
|
The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
|
|
5
5
|
|
|
6
|
+
## Unreleased - in development
|
|
7
|
+
###
|
|
8
|
+
Added
|
|
9
|
+
###
|
|
10
|
+
Changed
|
|
11
|
+
###
|
|
12
|
+
Deprecated
|
|
13
|
+
###
|
|
14
|
+
Removed
|
|
15
|
+
###
|
|
16
|
+
Fixed
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 2.15.2 - 2023-03-14
|
|
20
|
+
###
|
|
21
|
+
Changed
|
|
22
|
+
- Update parameters for getGeometryTypeFromService.getGeometryTypeFromWFS and getGeometryTypeFromService.getGeometryTypeFromOAF to pass wfsImgPath.
|
|
23
|
+
### Fixed
|
|
24
|
+
- Fix imports in createLegendInfo.js
|
|
25
|
+
---
|
|
26
|
+
|
|
6
27
|
## 2.15.1 - 2023-03-09
|
|
7
28
|
### Fixed
|
|
8
29
|
- The `labelField` attribute is now evaluated correctly for a text style.
|
package/package.json
CHANGED
|
@@ -1,64 +1,63 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@masterportal/masterportalapi",
|
|
3
|
-
"author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
|
|
4
|
-
"version": "2.15.
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"description": "Basic functions of the Masterportal as api",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://bitbucket.org/geowerkstatt-hamburg/masterportalapi.git"
|
|
10
|
-
},
|
|
11
|
-
"main": "src/index.js",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "jest .test.js --config ./jest.config.js --collectCoverage",
|
|
14
|
-
"test:trace": "node --trace-warnings node_modules/jest/bin/jest.js ./test/layer/wfs.test.js --config ./jest.config.js",
|
|
15
|
-
"test:watch": "jest .test.js --config ./jest.config.js --watch",
|
|
16
|
-
"example": "parcel example/index.html",
|
|
17
|
-
"generate-jsdoc": "jsdoc ./src -r -d ./docs/ -R ./README.md -c jsdoc.json",
|
|
18
|
-
"prePushHook": "eslint --max-warnings 0 \"./**/*.js\" && npm run test",
|
|
19
|
-
"prepare": "husky install"
|
|
20
|
-
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"core-js": "^3.27.1",
|
|
23
|
-
"ol": "7.2.2",
|
|
24
|
-
"olcs": "^2.13.1",
|
|
25
|
-
"proj4": "^2.8.1",
|
|
26
|
-
"xml2js": "^0.4.23"
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@babel/core": "^7.20.12",
|
|
30
|
-
"@babel/plugin-transform-modules-commonjs": "^7.20.11",
|
|
31
|
-
"@parcel/transformer-sass": "^2.6.0",
|
|
32
|
-
"buffer": "^6.0.3",
|
|
33
|
-
"canvas": "^2.11.0",
|
|
34
|
-
"eslint": "^8.31.0",
|
|
35
|
-
"events": "^3.3.0",
|
|
36
|
-
"husky": "^8.0.3",
|
|
37
|
-
"jest": "^29.3.1",
|
|
38
|
-
"jest-canvas-mock": "^2.4.0",
|
|
39
|
-
"jest-environment-jsdom": "^29.3.1",
|
|
40
|
-
"jsdoc": "^4.0.0",
|
|
41
|
-
"parcel": "^2.6.0",
|
|
42
|
-
"process": "^0.11.10",
|
|
43
|
-
"sass": "^1.57.1",
|
|
44
|
-
"stream-browserify": "^3.0.0",
|
|
45
|
-
"timers-browserify": "^2.0.12",
|
|
46
|
-
"use-resize-observer": "^9.1.0"
|
|
47
|
-
},
|
|
48
|
-
"peerDependencies": {
|
|
49
|
-
"cesium": "^1.95.0"
|
|
50
|
-
},
|
|
51
|
-
"engines": {
|
|
52
|
-
"node": "^16.13.2 || ^18.12.0",
|
|
53
|
-
"npm": "^8.1.2"
|
|
54
|
-
},
|
|
55
|
-
"homepage": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi#readme",
|
|
56
|
-
"directories": {
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@masterportal/masterportalapi",
|
|
3
|
+
"author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
|
|
4
|
+
"version": "2.15.2",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Basic functions of the Masterportal as api",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://bitbucket.org/geowerkstatt-hamburg/masterportalapi.git"
|
|
10
|
+
},
|
|
11
|
+
"main": "src/index.js",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "jest .test.js --config ./jest.config.js --collectCoverage",
|
|
14
|
+
"test:trace": "node --trace-warnings node_modules/jest/bin/jest.js ./test/layer/wfs.test.js --config ./jest.config.js",
|
|
15
|
+
"test:watch": "jest .test.js --config ./jest.config.js --watch",
|
|
16
|
+
"example": "parcel example/index.html",
|
|
17
|
+
"generate-jsdoc": "jsdoc ./src -r -d ./docs/ -R ./README.md -c jsdoc.json",
|
|
18
|
+
"prePushHook": "eslint --max-warnings 0 \"./**/*.js\" && npm run test",
|
|
19
|
+
"prepare": "husky install"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"core-js": "^3.27.1",
|
|
23
|
+
"ol": "7.2.2",
|
|
24
|
+
"olcs": "^2.13.1",
|
|
25
|
+
"proj4": "^2.8.1",
|
|
26
|
+
"xml2js": "^0.4.23"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@babel/core": "^7.20.12",
|
|
30
|
+
"@babel/plugin-transform-modules-commonjs": "^7.20.11",
|
|
31
|
+
"@parcel/transformer-sass": "^2.6.0",
|
|
32
|
+
"buffer": "^6.0.3",
|
|
33
|
+
"canvas": "^2.11.0",
|
|
34
|
+
"eslint": "^8.31.0",
|
|
35
|
+
"events": "^3.3.0",
|
|
36
|
+
"husky": "^8.0.3",
|
|
37
|
+
"jest": "^29.3.1",
|
|
38
|
+
"jest-canvas-mock": "^2.4.0",
|
|
39
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
40
|
+
"jsdoc": "^4.0.0",
|
|
41
|
+
"parcel": "^2.6.0",
|
|
42
|
+
"process": "^0.11.10",
|
|
43
|
+
"sass": "^1.57.1",
|
|
44
|
+
"stream-browserify": "^3.0.0",
|
|
45
|
+
"timers-browserify": "^2.0.12",
|
|
46
|
+
"use-resize-observer": "^9.1.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"cesium": "^1.95.0"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": "^16.13.2 || ^18.12.0",
|
|
53
|
+
"npm": "^8.1.2"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi#readme",
|
|
56
|
+
"directories": {
|
|
57
|
+
"example": "example",
|
|
58
|
+
"test": "test"
|
|
59
|
+
},
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi/issues"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import
|
|
1
|
+
import createStyle from "../createStyle";
|
|
2
2
|
/**
|
|
3
3
|
* Creates the style objects for the layer
|
|
4
4
|
* @param {object[]} rules styling rules from the styleObject
|
|
5
5
|
* @param {string[]} geometryType Array of geometry types
|
|
6
|
+
* @param {String} wfsImgPath path to wfsImg from Config
|
|
6
7
|
* @returns {void}
|
|
7
8
|
*/
|
|
8
|
-
export function createLegendInfo (rules, geometryType) {
|
|
9
|
+
export function createLegendInfo (rules, geometryType, wfsImgPath) {
|
|
9
10
|
let styleObject,
|
|
10
11
|
simpleGeom;
|
|
11
12
|
|
|
12
13
|
geometryType.forEach(geom => rules.forEach(rule => {
|
|
13
14
|
if (geom === "MultiSurface") {
|
|
14
15
|
simpleGeom = "Polygon";
|
|
15
|
-
styleObject = getSimpleGeometryStyle(simpleGeom, "", rule, false);
|
|
16
|
+
styleObject = createStyle.getSimpleGeometryStyle(simpleGeom, "", rule, false, wfsImgPath);
|
|
16
17
|
return styleObject;
|
|
17
18
|
}
|
|
18
19
|
else if (geom.includes("Multi")) {
|
|
19
20
|
simpleGeom = geom.replace("Multi", "");
|
|
20
|
-
styleObject = getMultiGeometryStyle(simpleGeom, "", rule, false);
|
|
21
|
+
styleObject = createStyle.getMultiGeometryStyle(simpleGeom, "", rule, false, wfsImgPath);
|
|
21
22
|
return styleObject;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
simpleGeom = geom;
|
|
25
|
-
styleObject = getSimpleGeometryStyle(simpleGeom, "", rule, false);
|
|
26
|
+
styleObject = createStyle.getSimpleGeometryStyle(simpleGeom, "", rule, false, wfsImgPath);
|
|
26
27
|
return styleObject;
|
|
27
28
|
}));
|
|
28
29
|
}
|
|
@@ -86,11 +86,12 @@ function getTypeAttributesFromSubelements (subElements = [], styleGeometryType =
|
|
|
86
86
|
* @param {string} featureType wfs feature type from layer
|
|
87
87
|
* @param {string[] | string} styleGeometryType The configured geometry type of the layer
|
|
88
88
|
* @param {boolean} isSecured true if wfs is secured
|
|
89
|
+
* @param {String} wfsImgPath path to wfsImg from Config
|
|
89
90
|
* @param {function} [callback] - called with services after loaded; called with false and error on error
|
|
90
91
|
* @returns {void}
|
|
91
92
|
*/
|
|
92
93
|
// eslint-disable-next-line max-params
|
|
93
|
-
function getGeometryTypeFromWFS (rules, wfsURL, version, featureType, styleGeometryType, isSecured, callback) {
|
|
94
|
+
function getGeometryTypeFromWFS (rules, wfsURL, version, featureType, styleGeometryType, isSecured, wfsImgPath, callback) {
|
|
94
95
|
const params = {
|
|
95
96
|
"SERVICE": "WFS",
|
|
96
97
|
"VERSION": version,
|
|
@@ -114,7 +115,7 @@ function getGeometryTypeFromWFS (rules, wfsURL, version, featureType, styleGeome
|
|
|
114
115
|
const subElements = getSubelementsFromXML(responseXML, featureType),
|
|
115
116
|
geometryTypes = getTypeAttributesFromSubelements(subElements, styleGeometryType);
|
|
116
117
|
|
|
117
|
-
createLegendInfo(rules, geometryTypes);
|
|
118
|
+
createLegendInfo(rules, geometryTypes, wfsImgPath);
|
|
118
119
|
}).catch(error => {
|
|
119
120
|
return callback(error);
|
|
120
121
|
});
|
|
@@ -125,10 +126,11 @@ function getGeometryTypeFromWFS (rules, wfsURL, version, featureType, styleGeome
|
|
|
125
126
|
* @param {object[]} rules styling rules from the styleObject
|
|
126
127
|
* @param {string} oafURL url from layer
|
|
127
128
|
* @param {String} collection the collection name to fetch geometry type for
|
|
129
|
+
* @param {String} wfsImgPath path to wfsImg from Config
|
|
128
130
|
* @param {function} [callback] - called with services after loaded; called with false and error on error
|
|
129
131
|
* @returns {void}
|
|
130
132
|
*/
|
|
131
|
-
function getGeometryTypeFromOAF (rules, oafURL, collection, callback) {
|
|
133
|
+
function getGeometryTypeFromOAF (rules, oafURL, collection, wfsImgPath, callback) {
|
|
132
134
|
const url = oafURL + "/collections/" + collection + "/items?limit=1";
|
|
133
135
|
|
|
134
136
|
fetch(url, {
|
|
@@ -140,7 +142,7 @@ function getGeometryTypeFromOAF (rules, oafURL, collection, callback) {
|
|
|
140
142
|
const geometryType = response.data?.features[0]?.geometry?.type;
|
|
141
143
|
|
|
142
144
|
if (geometryType) {
|
|
143
|
-
createLegendInfo(rules, [geometryType]);
|
|
145
|
+
createLegendInfo(rules, [geometryType], wfsImgPath);
|
|
144
146
|
}
|
|
145
147
|
}).catch(error => {
|
|
146
148
|
return callback(error);
|
|
@@ -52,7 +52,7 @@ export function createIconStyle (attributes, feature, isClustered) {
|
|
|
52
52
|
if (!showCluster) {
|
|
53
53
|
iconOptions.anchorXUnits = attributes.imageOffsetXUnit;
|
|
54
54
|
iconOptions.anchorYUnits = attributes.imageOffsetYUnit;
|
|
55
|
-
iconOptions.rotation = getRotationValue(attributes.rotation, feature.getProperties());
|
|
55
|
+
iconOptions.rotation = feature ? getRotationValue(attributes.rotation, feature.getProperties()) : 0;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
return new Style({
|