@masterportal/masterportalapi 2.5.1 → 2.6.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 +9 -0
- package/package.json +1 -2
- package/src/layer/oaf.js +5 -2
- package/src/layer/tileset.js +4 -2
- package/src/layer/vectorBase.js +6 -3
- package/test/layer/vectorBase.test.js +17 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
|
|
5
5
|
|
|
6
|
+
## 2.6.0 - 2022-09-06
|
|
7
|
+
### Added
|
|
8
|
+
- Added possibility to set initial features for layer vectorBase.
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- OAF: Fixed oaf recursion and a possibility to disable the CRS parameter is added.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
6
15
|
## 2.5.1 - 2022-08-05
|
|
7
16
|
### Fixed
|
|
8
17
|
- Remove import of `defaultResolutions` for the vectorStyle layer
|
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.6.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Basic functions of the Masterportal as api",
|
|
7
7
|
"repository": {
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
},
|
|
54
54
|
"homepage": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi#readme",
|
|
55
55
|
"directories": {
|
|
56
|
-
"doc": "docs",
|
|
57
56
|
"example": "example",
|
|
58
57
|
"test": "test"
|
|
59
58
|
},
|
package/src/layer/oaf.js
CHANGED
|
@@ -57,7 +57,8 @@ function getNextLinkFromFeatureCollection (featureCollection) {
|
|
|
57
57
|
if (
|
|
58
58
|
typeof featureCollection.links[i] === "object" && featureCollection.links[i] !== null
|
|
59
59
|
&& typeof featureCollection.links[i].href === "string"
|
|
60
|
-
&& featureCollection.links[i].
|
|
60
|
+
&& featureCollection.links[i].rel === "next"
|
|
61
|
+
&& featureCollection.links[i].type === "application/geo+json"
|
|
61
62
|
) {
|
|
62
63
|
return featureCollection.links[i].href;
|
|
63
64
|
}
|
|
@@ -157,7 +158,9 @@ function createUrl (rawLayer) {
|
|
|
157
158
|
url += "bbox=" + appendingString + "&";
|
|
158
159
|
}
|
|
159
160
|
url += typeof rawLayer.bboxCrs === "string" && rawLayer.bboxCrs !== "" ? "bbox-crs=" + encodeURIComponent(rawLayer.bboxCrs) + "&" : "";
|
|
160
|
-
|
|
161
|
+
if (rawLayer.crs !== false) {
|
|
162
|
+
url += "crs=" + encodeURIComponent(typeof rawLayer.crs === "string" && rawLayer.crs !== "" ? rawLayer.crs : crsDefault) + "&";
|
|
163
|
+
}
|
|
161
164
|
url += typeof rawLayer.datetime === "string" && rawLayer.datetime !== "" ? "datetime=" + rawLayer.datetime + "&" : "";
|
|
162
165
|
url += getParamsUrl(rawLayer.params);
|
|
163
166
|
|
package/src/layer/tileset.js
CHANGED
|
@@ -29,8 +29,10 @@ export default function Tileset (rawLayer) {
|
|
|
29
29
|
id: rawLayer.id,
|
|
30
30
|
typ: rawLayer.typ
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
if (Cesium) {
|
|
33
|
+
this.tileset = createTileSet(rawLayer);
|
|
34
|
+
this.tileset.layerReferenceId = rawLayer.id;
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
*
|
package/src/layer/vectorBase.js
CHANGED
|
@@ -4,10 +4,13 @@ import VectorSource from "ol/source/Vector.js";
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Triggered by Layer to create a layerSource
|
|
7
|
+
* @param {Object} attrs attributes of the layer
|
|
7
8
|
* @returns {void}
|
|
8
9
|
*/
|
|
9
|
-
export function createLayerSource () {
|
|
10
|
-
return new VectorSource(
|
|
10
|
+
export function createLayerSource (attrs) {
|
|
11
|
+
return new VectorSource({
|
|
12
|
+
features: attrs.features
|
|
13
|
+
});
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
/**
|
|
@@ -27,7 +30,7 @@ export function updateSource (layer, features) {
|
|
|
27
30
|
* @returns {Object} layer
|
|
28
31
|
*/
|
|
29
32
|
export function createLayer (attrs) {
|
|
30
|
-
const source = this.createLayerSource();
|
|
33
|
+
const source = this.createLayerSource(attrs);
|
|
31
34
|
|
|
32
35
|
return new VectorLayer({
|
|
33
36
|
source: source,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import Feature from "ol/Feature";
|
|
2
|
+
import Point from "ol/geom/Point";
|
|
3
|
+
import Polygon from "ol/geom/Polygon";
|
|
1
4
|
import VectorLayer from "ol/layer/Vector";
|
|
2
5
|
import VectorSource from "ol/source/Vector.js";
|
|
3
6
|
import * as vectorBase from "../../src/layer/vectorBase";
|
|
@@ -5,8 +8,20 @@ import * as vectorBase from "../../src/layer/vectorBase";
|
|
|
5
8
|
describe("vectorBase.js", function () {
|
|
6
9
|
|
|
7
10
|
describe("createLayerSource", function () {
|
|
8
|
-
it("creates a layerSource", function () {
|
|
9
|
-
const
|
|
11
|
+
it("creates a layerSource with features", function () {
|
|
12
|
+
const attr = {
|
|
13
|
+
features: [
|
|
14
|
+
new Feature({geometry: new Polygon([[[565086.1948534324, 5934664.461947621], [565657.6945448224, 5934738.54524095], [565625.9445619675, 5934357.545446689], [565234.3614400891, 5934346.962119071], [565086.1948534324, 5934664.461947621]]])}),
|
|
15
|
+
new Feature({geometry: new Point([565826.38, 5934174.40])})
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
source = vectorBase.createLayerSource(attr);
|
|
19
|
+
|
|
20
|
+
expect(source).toBeInstanceOf(VectorSource);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("creates a layerSource without features", function () {
|
|
24
|
+
const source = vectorBase.createLayerSource({});
|
|
10
25
|
|
|
11
26
|
expect(source).toBeInstanceOf(VectorSource);
|
|
12
27
|
});
|