@masterportal/masterportalapi 2.1.1
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/.editorconfig +15 -0
- package/.eslintignore +6 -0
- package/.eslintrc +184 -0
- package/.husky/pre-push +4 -0
- package/CHANGELOG.md +217 -0
- package/License.txt +21 -0
- package/README.md +24 -0
- package/babel.config.json +6 -0
- package/example/README.md +7 -0
- package/example/config/localGeoJSON.js +956 -0
- package/example/config/portal.json +35 -0
- package/example/config/services.json +79 -0
- package/example/index.html +27 -0
- package/example/index.js +210 -0
- package/example/style.scss +59 -0
- package/jest.config.js +18 -0
- package/jest.setup.js +5 -0
- package/jsdoc.json +15 -0
- package/package.json +62 -0
- package/public/marker.svg +1 -0
- package/public/stringMarker.js +5 -0
- package/src/crs.js +122 -0
- package/src/defaults.js +38 -0
- package/src/index.js +30 -0
- package/src/layer/geojson/index.js +109 -0
- package/src/layer/geojson/style.js +61 -0
- package/src/layer/lib.js +32 -0
- package/src/layer/oaf.js +207 -0
- package/src/layer/terrain.js +72 -0
- package/src/layer/tileset.js +71 -0
- package/src/layer/vector.js +48 -0
- package/src/layer/vectorBase.js +39 -0
- package/src/layer/wfs.js +218 -0
- package/src/layer/wms.js +185 -0
- package/src/lib/coordsToPairs.js +15 -0
- package/src/lib/getInitialLayers.js +22 -0
- package/src/lib/load3DScript.js +22 -0
- package/src/lib/oafUtil.js +22 -0
- package/src/lib/setBackgroundImage.js +23 -0
- package/src/lib/wfsUtil.js +75 -0
- package/src/lib/zoomTo.js +40 -0
- package/src/maps/api.js +5 -0
- package/src/maps/map.js +35 -0
- package/src/maps/mapView.js +54 -0
- package/src/maps/ol/olMap.js +124 -0
- package/src/maps/olcs/3dUtils/fixedOverlaySynchronizer.js +39 -0
- package/src/maps/olcs/3dUtils/wmsRasterSynchronizer.js +348 -0
- package/src/maps/olcs/olcsMap.js +212 -0
- package/src/rawLayerList.js +88 -0
- package/src/searchAddress/gazetteerUrl.js +22 -0
- package/src/searchAddress/index.js +13 -0
- package/src/searchAddress/parse.js +196 -0
- package/src/searchAddress/search.js +184 -0
- package/src/searchAddress/searchGazetteer.js +52 -0
- package/src/searchAddress/showGeographicIdentifier.js +20 -0
- package/src/searchAddress/types.js +17 -0
- package/test/.eslintrc +7 -0
- package/test/crs.test.js +109 -0
- package/test/layer/geojson/index.test.js +133 -0
- package/test/layer/geojson/style.test.js +46 -0
- package/test/layer/lib.test.js +83 -0
- package/test/layer/oaf.test.js +245 -0
- package/test/layer/resources/oafFeatures.js +105 -0
- package/test/layer/resources/wfsFeatures.js +26 -0
- package/test/layer/resources/wfsFilter.js +17 -0
- package/test/layer/terrain.test.js +106 -0
- package/test/layer/tileset.test.js +116 -0
- package/test/layer/vector.test.js +76 -0
- package/test/layer/vectorBase.test.js +48 -0
- package/test/layer/wfs.test.js +388 -0
- package/test/layer/wms.test.js +256 -0
- package/test/lib/coordsToPairs.test.js +9 -0
- package/test/lib/getInitialLayers.test.js +28 -0
- package/test/lib/oafUtil.test.js +24 -0
- package/test/lib/setBackgroundImage.test.js +49 -0
- package/test/lib/wfsUtil.test.js +28 -0
- package/test/lib/zoomTo.test.js +74 -0
- package/test/map.test.js +258 -0
- package/test/mapView.test.js +59 -0
- package/test/rawLayerList.test.js +48 -0
- package/test/searchAddress/gazetteerSearchResults/address.js +175 -0
- package/test/searchAddress/gazetteerSearchResults/district.js +71 -0
- package/test/searchAddress/gazetteerSearchResults/houseNumber.js +32 -0
- package/test/searchAddress/gazetteerSearchResults/index.js +19 -0
- package/test/searchAddress/gazetteerSearchResults/parcel.js +44 -0
- package/test/searchAddress/gazetteerSearchResults/street.js +46 -0
- package/test/searchAddress/gazetteerSearchResults/streetKey.js +51 -0
- package/test/searchAddress/gazetteerUrl.test.js +22 -0
- package/test/searchAddress/parse.test.js +110 -0
- package/test/searchAddress/search.test.js +150 -0
- package/test/searchAddress/searchGazetteer.test.js +58 -0
- package/test/searchAddress/showGeographicIdentifier.test.js +22 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import VectorLayer from "ol/layer/Vector.js";
|
|
2
|
+
import VectorSource from "ol/source/Vector.js";
|
|
3
|
+
import Cluster from "ol/source/Cluster.js";
|
|
4
|
+
import {Style, Icon} from "ol/style.js";
|
|
5
|
+
import map from "../../src/maps/map.js";
|
|
6
|
+
import defaults from "../../src/defaults";
|
|
7
|
+
import GeoJSON from "ol/format/GeoJSON.js";
|
|
8
|
+
import * as oaf from "../../src/layer/oaf";
|
|
9
|
+
import {featureCollection} from "./resources/oafFeatures";
|
|
10
|
+
|
|
11
|
+
jest.mock("../../src/rawLayerList.js", () => {
|
|
12
|
+
const original = jest.requireActual("../../src/rawLayerList.js");
|
|
13
|
+
|
|
14
|
+
original.initializeLayerList = jest.fn();
|
|
15
|
+
return original;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
describe("oaf.js", function () {
|
|
20
|
+
describe("createLayer", function () {
|
|
21
|
+
it("creates a VectorLayer without id", function () {
|
|
22
|
+
const layer = oaf.createLayer();
|
|
23
|
+
|
|
24
|
+
expect(layer).toBeInstanceOf(VectorLayer);
|
|
25
|
+
expect(layer.getSource()).toBeInstanceOf(VectorSource);
|
|
26
|
+
});
|
|
27
|
+
it("creates a VectorLayer with source", function () {
|
|
28
|
+
const attr = {
|
|
29
|
+
"id": "id",
|
|
30
|
+
"name": "Schulen",
|
|
31
|
+
"url": "https://url.de",
|
|
32
|
+
"collection": "staatliche_schulen",
|
|
33
|
+
"typ": "OAF",
|
|
34
|
+
"bbox": "",
|
|
35
|
+
"bboxCrs": "",
|
|
36
|
+
"datetime": "",
|
|
37
|
+
"crs": ""
|
|
38
|
+
},
|
|
39
|
+
layer = oaf.createLayer(attr);
|
|
40
|
+
|
|
41
|
+
expect(layer).toBeInstanceOf(VectorLayer);
|
|
42
|
+
expect(layer.get("id")).toEqual("id");
|
|
43
|
+
expect(layer.getSource()).toBeInstanceOf(VectorSource);
|
|
44
|
+
});
|
|
45
|
+
it("creates a VectorLayer with style in rawLayer", function () {
|
|
46
|
+
function styleFunction () {
|
|
47
|
+
const icon = new Style({
|
|
48
|
+
image: new Icon({
|
|
49
|
+
src: "https://building.png",
|
|
50
|
+
scale: 0.5,
|
|
51
|
+
opacity: 1
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return [icon];
|
|
56
|
+
}
|
|
57
|
+
const layer = oaf.createLayer({id: "id", style: styleFunction});
|
|
58
|
+
|
|
59
|
+
expect(layer).toBeInstanceOf(VectorLayer);
|
|
60
|
+
expect(layer.get("id")).toEqual("id");
|
|
61
|
+
expect(layer.getSource()).toBeInstanceOf(VectorSource);
|
|
62
|
+
expect(layer.getStyleFunction()).toBeDefined();
|
|
63
|
+
expect(layer.getStyleFunction()).toEqual(styleFunction);
|
|
64
|
+
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
describe("createLayer with additional params and options", function () {
|
|
68
|
+
it("creates a VectorLayer with layerParams", function () {
|
|
69
|
+
const layerParams = {
|
|
70
|
+
name: "name",
|
|
71
|
+
layers: "layer1, layer2"
|
|
72
|
+
},
|
|
73
|
+
layer = oaf.createLayer({id: "id"}, {layerParams});
|
|
74
|
+
|
|
75
|
+
expect(layer).toBeInstanceOf(VectorLayer);
|
|
76
|
+
expect(layer.get("id")).toEqual("id");
|
|
77
|
+
expect(layer.getSource()).toBeInstanceOf(VectorSource);
|
|
78
|
+
expect(layer.get("name")).toEqual("name");
|
|
79
|
+
expect(layer.get("layers")).toEqual("layer1, layer2");
|
|
80
|
+
});
|
|
81
|
+
it("creates a VectorLayer with style in options", function () {
|
|
82
|
+
function styleFunction () {
|
|
83
|
+
const icon = new Style({
|
|
84
|
+
image: new Icon({
|
|
85
|
+
src: "https://building.png",
|
|
86
|
+
scale: 0.5,
|
|
87
|
+
opacity: 1
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return [icon];
|
|
92
|
+
}
|
|
93
|
+
const options = {
|
|
94
|
+
style: styleFunction
|
|
95
|
+
},
|
|
96
|
+
layerParams = {
|
|
97
|
+
name: "name",
|
|
98
|
+
layers: "layer1, layer2"
|
|
99
|
+
},
|
|
100
|
+
layer = oaf.createLayer({id: "id"}, {layerParams, options});
|
|
101
|
+
|
|
102
|
+
expect(layer).toBeInstanceOf(VectorLayer);
|
|
103
|
+
expect(layer.get("id")).toEqual("id");
|
|
104
|
+
expect(layer.getSource()).toBeInstanceOf(VectorSource);
|
|
105
|
+
expect(layer.getStyleFunction()).toBeDefined();
|
|
106
|
+
expect(layer.getStyleFunction()).toEqual(styleFunction);
|
|
107
|
+
expect(layer.get("name")).toEqual("name");
|
|
108
|
+
expect(layer.get("layers")).toEqual("layer1, layer2");
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe("createLayerSource", function () {
|
|
112
|
+
const consoleError = console.error;
|
|
113
|
+
|
|
114
|
+
beforeEach(() => {
|
|
115
|
+
if (global.fetch) {
|
|
116
|
+
global.fetch.mockClear();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
// to reset show error on load in console
|
|
120
|
+
afterEach(() => {
|
|
121
|
+
console.error = consoleError;
|
|
122
|
+
});
|
|
123
|
+
it("creates a GeoJSON VectorSource", function () {
|
|
124
|
+
global.fetch = jest.fn().mockImplementationOnce(() => {
|
|
125
|
+
return new Promise((resolve) => {
|
|
126
|
+
resolve({
|
|
127
|
+
ok: true,
|
|
128
|
+
status: 200,
|
|
129
|
+
text: () => {
|
|
130
|
+
return {};
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
console.error = jest.fn();
|
|
136
|
+
|
|
137
|
+
const rawLayer = {
|
|
138
|
+
id: "id",
|
|
139
|
+
name: "Schulen",
|
|
140
|
+
url: "https://url.de",
|
|
141
|
+
collection: "staatliche_schulen",
|
|
142
|
+
typ: "OAF",
|
|
143
|
+
limit: 10,
|
|
144
|
+
bbox: "",
|
|
145
|
+
bboxCrs: "",
|
|
146
|
+
datetime: "",
|
|
147
|
+
crs: ""
|
|
148
|
+
},
|
|
149
|
+
layer = oaf.createLayer(rawLayer);
|
|
150
|
+
|
|
151
|
+
expect(layer.getSource().getFormat()).toBeInstanceOf(GeoJSON);
|
|
152
|
+
});
|
|
153
|
+
it("creates a VectorSource and onLoadingError is called", function () {
|
|
154
|
+
global.fetch = jest.fn().mockImplementationOnce(() => {
|
|
155
|
+
return new Promise((resolve) => {
|
|
156
|
+
resolve({
|
|
157
|
+
ok: false,
|
|
158
|
+
status: 404,
|
|
159
|
+
text: () => {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
// to reset show error on load in console when testing 'onLoadingError'
|
|
166
|
+
console.error = jest.fn();
|
|
167
|
+
|
|
168
|
+
const rawLayer = {
|
|
169
|
+
id: "id",
|
|
170
|
+
name: "Schulen",
|
|
171
|
+
url: "https://url.de",
|
|
172
|
+
collection: "staatliche_schulen",
|
|
173
|
+
typ: "OAF",
|
|
174
|
+
limit: 10,
|
|
175
|
+
bbox: "",
|
|
176
|
+
bboxCrs: "",
|
|
177
|
+
datetime: "",
|
|
178
|
+
crs: ""
|
|
179
|
+
},
|
|
180
|
+
onLoadingErrorMock = jest.fn(),
|
|
181
|
+
options = {
|
|
182
|
+
onLoadingError: onLoadingErrorMock
|
|
183
|
+
},
|
|
184
|
+
layer = oaf.createLayer(rawLayer, {options});
|
|
185
|
+
|
|
186
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
187
|
+
expect(typeof layer.getSource().loader_).toEqual("function");
|
|
188
|
+
layer.getSource().on("featuresloaderror", function () {
|
|
189
|
+
expect(onLoadingErrorMock.mock.calls.length).toBe(2);
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
it("creates a clustered VectorSource and beforeLoading, afterLoading and featuresFilter are called", function () {
|
|
193
|
+
global.fetch = jest.fn().mockImplementationOnce(() => {
|
|
194
|
+
return new Promise((resolve) => {
|
|
195
|
+
resolve({
|
|
196
|
+
ok: true,
|
|
197
|
+
status: 200,
|
|
198
|
+
json: () => {
|
|
199
|
+
return featureCollection;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
console.error = jest.fn();
|
|
205
|
+
|
|
206
|
+
const map2D = map.createMap(defaults),
|
|
207
|
+
rawLayer = {
|
|
208
|
+
id: "id",
|
|
209
|
+
name: "Schulen",
|
|
210
|
+
url: "https://url.de",
|
|
211
|
+
collection: "staatliche_schulen",
|
|
212
|
+
typ: "OAF",
|
|
213
|
+
limit: 10,
|
|
214
|
+
clusterDistance: 40
|
|
215
|
+
},
|
|
216
|
+
beforeLoadingMock = jest.fn(),
|
|
217
|
+
afterLoadingMock = jest.fn(),
|
|
218
|
+
featuresFilterMock = jest.fn((features) => features),
|
|
219
|
+
clusterGeometryFunctionMock = jest.fn(),
|
|
220
|
+
options = {
|
|
221
|
+
beforeLoading: beforeLoadingMock,
|
|
222
|
+
afterLoading: afterLoadingMock,
|
|
223
|
+
featuresFilter: featuresFilterMock,
|
|
224
|
+
clusterGeometryFunction: clusterGeometryFunctionMock
|
|
225
|
+
},
|
|
226
|
+
layer = oaf.createLayer(rawLayer, {options});
|
|
227
|
+
|
|
228
|
+
layer.getSource().getSource().loadFeatures([-1000, -1000, -1000, -1000],
|
|
229
|
+
1,
|
|
230
|
+
map2D.getView().getProjection());
|
|
231
|
+
|
|
232
|
+
expect(layer.getSource()).toBeInstanceOf(Cluster);
|
|
233
|
+
expect(layer.getSource().getDistance()).toEqual(40);
|
|
234
|
+
expect(layer.getSource().getSource().getFormat()).toBeInstanceOf(GeoJSON);
|
|
235
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
236
|
+
expect(typeof layer.getSource().loader_).toEqual("function");
|
|
237
|
+
expect(beforeLoadingMock.mock.calls.length).toBe(1);
|
|
238
|
+
layer.getSource().on("featuresloadend", function () {
|
|
239
|
+
expect(clusterGeometryFunctionMock.mock.calls.length).toBe(1);
|
|
240
|
+
expect(featuresFilterMock.mock.calls.length).toBe(1);
|
|
241
|
+
expect(afterLoadingMock.mock.calls.length).toBe(1);
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export const featureCollection = {
|
|
2
|
+
"type": "FeatureCollection",
|
|
3
|
+
"features": [
|
|
4
|
+
{
|
|
5
|
+
"type": "Feature",
|
|
6
|
+
"id": "DE.HH.UP_STAATLICHE_SCHULEN_441696",
|
|
7
|
+
"geometry": {
|
|
8
|
+
"type": "Point",
|
|
9
|
+
"coordinates": [
|
|
10
|
+
564532,
|
|
11
|
+
5933771
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"properties": {
|
|
15
|
+
"ansprechp_buero": "Karin Stelling",
|
|
16
|
+
"stadtteil": "Neustadt",
|
|
17
|
+
"schul_homepage": "http://www.fsp2.hamburg.de",
|
|
18
|
+
"is_rebbz": "false",
|
|
19
|
+
"schul_email": "BS21@hibb.hamburg.de",
|
|
20
|
+
"schulportrait": "http://hibb.hamburg.de/schulen/schulportraits/bs21",
|
|
21
|
+
"sozialindex": "n.v.",
|
|
22
|
+
"schulaufsicht": "Susanne Kallies",
|
|
23
|
+
"schulform": "Berufsfachschule|Berufsschule|Berufsvorbereitungsschule|Fachschule",
|
|
24
|
+
"fax": "+49 40 428 11-3339",
|
|
25
|
+
"rechtsform": "staatlich",
|
|
26
|
+
"schulname": "Staatliche Fachschule für Sozialpädagogik Altona",
|
|
27
|
+
"lgv_standortk_erwachsenenbildung": "No",
|
|
28
|
+
"adresse_strasse_hausnr": "Zeughausmarkt 32",
|
|
29
|
+
"kernzeitbetreuung": "",
|
|
30
|
+
"anzahl_schueler_gesamt": "1674 an 3 Standorten",
|
|
31
|
+
"schul_id": "5964-3",
|
|
32
|
+
"adresse_ort": "20459 Hamburg",
|
|
33
|
+
"schul_telefonnr": "+49 40 428 11-3313",
|
|
34
|
+
"abschluss": "Abschlusszeugnis|Abschlusszeugnis mit dem schulischen Teil der FHR|Abschlusszeugnis mit erweitertem erstem allgemeinbildenden Schulabschluss|Abschlusszeugnis mit Fachhochschulreife|Abschlusszeugnis mit mittleren Schulabschluss",
|
|
35
|
+
"bezirk": "Hamburg-Mitte",
|
|
36
|
+
"name_schulleiter": "Cornelia Averhoff",
|
|
37
|
+
"schultyp": "Zweigstelle",
|
|
38
|
+
"standort_id": "1078",
|
|
39
|
+
"name_stellv_schulleiter": "Lennart Tienken",
|
|
40
|
+
"kapitelbezeichnung": "Berufliche Schulen"
|
|
41
|
+
},
|
|
42
|
+
"srsName": "EPSG:25832"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"links": [
|
|
46
|
+
{
|
|
47
|
+
"href": "https://api.hamburg.de/datasets/v1/schulen/collections/staatliche_schulen/items?offset=440&crs=EPSG%3A25832&limit=10",
|
|
48
|
+
"rel": "self",
|
|
49
|
+
"type": "application/geo+json",
|
|
50
|
+
"title": "this document as JSON"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"href": "https://api.hamburg.de/datasets/v1/schulen/collections/staatliche_schulen/items?offset=440&crs=EPSG%3A25832&limit=10",
|
|
54
|
+
"rel": "alternate",
|
|
55
|
+
"type": "text/html",
|
|
56
|
+
"title": "this document as HTML"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"href": "https://api.hamburg.de/datasets/v1/schulen/collections/staatliche_schulen/items?offset=440&crs=EPSG%3A25832&limit=10",
|
|
60
|
+
"rel": "alternate",
|
|
61
|
+
"type": "application/gml+xml",
|
|
62
|
+
"title": "this document as GML"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"href": "https://api.hamburg.de/datasets/v1/schulen/collections/staatliche_schulen/items?offset=440&crs=EPSG%3A25832&limit=10",
|
|
66
|
+
"rel": "alternate",
|
|
67
|
+
"type": "application/gml+xml;version=3.2",
|
|
68
|
+
"title": "this document as GML"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"href": "https://api.hamburg.de/datasets/v1/schulen/collections/staatliche_schulen/items?offset=440&crs=EPSG%3A25832&limit=10",
|
|
72
|
+
"rel": "alternate",
|
|
73
|
+
"type": "application/gml+xml;version=3.2;profile=\"http://www.opengis.net/def/profile/ogc/2.0/gml-sf0\"",
|
|
74
|
+
"title": "this document as GML"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"href": "https://api.hamburg.de/datasets/v1/schulen/collections/staatliche_schulen/items?offset=440&crs=EPSG%3A25832&limit=10",
|
|
78
|
+
"rel": "alternate",
|
|
79
|
+
"type": "application/gml+xml;version=3.2;profile=\"http://www.opengis.net/def/profile/ogc/2.0/gml-sf2\"",
|
|
80
|
+
"title": "this document as GML"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"href": "https://api.hamburg.de/datasets/v1/schulen/collections/staatliche_schulen",
|
|
84
|
+
"rel": "collection",
|
|
85
|
+
"type": "application/json",
|
|
86
|
+
"title": "Collection as JSON"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"href": "https://api.hamburg.de/datasets/v1/schulen/collections/staatliche_schulen",
|
|
90
|
+
"rel": "collection",
|
|
91
|
+
"type": "text/html",
|
|
92
|
+
"title": "Collection as HTML"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"href": "https://api.hamburg.de/datasets/v1/schulen/collections/staatliche_schulen",
|
|
96
|
+
"rel": "collection",
|
|
97
|
+
"type": "application/xml",
|
|
98
|
+
"title": "Collection as XML"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"numberMatched": 1,
|
|
102
|
+
"numberReturned": 1,
|
|
103
|
+
"timeStamp": "2022-03-29T13:39:55.511Z",
|
|
104
|
+
"crs": "EPSG:25832"
|
|
105
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const featureCollection = `<?xml version='1.0' encoding='UTF-8'?>
|
|
2
|
+
<wfs:FeatureCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd http://www.deegree.org/app http://geodienste.hamburg.de/HH_WFS_Krankenhaeuser?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&OUTPUTFORMAT=text%2Fxml%3B+subtype%3Dgml%2F3.1.1&TYPENAME=app:krankenhaeuser_hh&NAMESPACE=xmlns(app=http%3A%2F%2Fwww.deegree.org%2Fapp)" xmlns:wfs="http://www.opengis.net/wfs" timeStamp="2017-08-30T12:31:07Z" xmlns:gml="http://www.opengis.net/gml">
|
|
3
|
+
<gml:featureMember>
|
|
4
|
+
<app:krankenhaeuser_hh xmlns:app="http://www.deegree.org/app" gml:id="APP_KRANKENHAEUSER_HH_9">
|
|
5
|
+
<app:kh_nummer>20</app:kh_nummer>
|
|
6
|
+
<app:name>Evangelisches Krankenhaus Alsterdorf</app:name>
|
|
7
|
+
<app:strasse>Bodelschwinghstraße 24</app:strasse>
|
|
8
|
+
<app:ort>22337 Hamburg</app:ort>
|
|
9
|
+
<app:homepage>http://www.evangelisches-krankenhaus-alsterdorf.de</app:homepage>
|
|
10
|
+
<app:krankenhausverzeichnis>www.krankenhausverzeichnis.de|www.google.com|www.hamburg.de</app:krankenhausverzeichnis>
|
|
11
|
+
<app:anzahl_planbetten>252</app:anzahl_planbetten>
|
|
12
|
+
<app:hinweiszeile></app:hinweiszeile>
|
|
13
|
+
<app:anzahl_plaetze_teilstationaer>43</app:anzahl_plaetze_teilstationaer>
|
|
14
|
+
<app:teilnahme_notversorgung>false</app:teilnahme_notversorgung>
|
|
15
|
+
<app:teilnahme_geburtsklinik>Nein</app:teilnahme_geburtsklinik>
|
|
16
|
+
<app:geburtsklinik_differenziert>Nein</app:geburtsklinik_differenziert>
|
|
17
|
+
<app:stand>01.01.2016</app:stand>
|
|
18
|
+
<app:geom>
|
|
19
|
+
<!--Inlined geometry 'APP_KRANKENHAEUSER_HH_9_APP_GEOM'-->
|
|
20
|
+
<gml:Point gml:id="APP_KRANKENHAEUSER_HH_9_APP_GEOM" srsName="EPSG:25832">
|
|
21
|
+
<gml:pos>567708.612 5941076.513</gml:pos>
|
|
22
|
+
</gml:Point>
|
|
23
|
+
</app:geom>
|
|
24
|
+
</app:krankenhaeuser_hh>
|
|
25
|
+
</gml:featureMember>
|
|
26
|
+
</wfs:FeatureCollection>`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const wfsFilterQuery = `<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<wfs:GetFeature service="WFS" version="1.1.0" xmlns:app="http://www.deegree.org/app" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc">
|
|
3
|
+
<wfs:Query typeName="app:staatliche_schulen">
|
|
4
|
+
<ogc:Filter>
|
|
5
|
+
<ogc:And>
|
|
6
|
+
<ogc:PropertyIsEqualTo>
|
|
7
|
+
<ogc:PropertyName>app:kapitelbezeichnung</ogc:PropertyName>
|
|
8
|
+
<ogc:Literal>Grundschulen</ogc:Literal>
|
|
9
|
+
</ogc:PropertyIsEqualTo>
|
|
10
|
+
<ogc:PropertyIsGreaterThan>
|
|
11
|
+
<ogc:PropertyName>app:zuegigkeit_kl_1</ogc:PropertyName>
|
|
12
|
+
<ogc:Literal>0</ogc:Literal>
|
|
13
|
+
</ogc:PropertyIsGreaterThan>
|
|
14
|
+
</ogc:And>
|
|
15
|
+
</ogc:Filter>
|
|
16
|
+
</wfs:Query>
|
|
17
|
+
</wfs:GetFeature>`;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as terrain from "../../src/layer/terrain";
|
|
2
|
+
|
|
3
|
+
describe("terrain.js", function () {
|
|
4
|
+
let attr, map, cesiumTerrainProviderSpy;
|
|
5
|
+
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
global.Cesium = {};
|
|
8
|
+
global.Cesium.CesiumTerrainProvider = jest.fn();
|
|
9
|
+
global.Cesium.EllipsoidTerrainProvider = jest.fn();
|
|
10
|
+
attr = {
|
|
11
|
+
id: "12883",
|
|
12
|
+
name: "Gelaende",
|
|
13
|
+
url: "https://url/Gelaende",
|
|
14
|
+
typ: "Terrain3D",
|
|
15
|
+
cesiumTerrainProviderOptions: {
|
|
16
|
+
requestVertexNormals: true
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
map = {
|
|
20
|
+
getCesiumScene: () => {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
cesiumTerrainProviderSpy = jest.spyOn(global.Cesium, "CesiumTerrainProvider");
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
global.Cesium = null;
|
|
29
|
+
jest.clearAllMocks();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
function checkAttributes (layer, attrs) {
|
|
33
|
+
expect(layer.get("name")).toEqual(attrs.name);
|
|
34
|
+
expect(layer.get("typ")).toEqual(attrs.typ);
|
|
35
|
+
expect(layer.get("id")).toEqual(attrs.id);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
describe("createLayer", function () {
|
|
39
|
+
it("creates a wrapper for terrain layer without map and not selected", function () {
|
|
40
|
+
const layer = terrain.createLayer(attr);
|
|
41
|
+
|
|
42
|
+
checkAttributes(layer, attr);
|
|
43
|
+
});
|
|
44
|
+
it("creates a wrapper for terrain layer with map and not selected", function () {
|
|
45
|
+
attr.isSelected = false;
|
|
46
|
+
const layer = terrain.createLayer(attr, map);
|
|
47
|
+
|
|
48
|
+
checkAttributes(layer, attr);
|
|
49
|
+
expect(cesiumTerrainProviderSpy).toHaveBeenCalledTimes(0);
|
|
50
|
+
});
|
|
51
|
+
it("creates a wrapper for terrain layer with map and selected", function () {
|
|
52
|
+
attr.isSelected = true;
|
|
53
|
+
const layer = terrain.createLayer(attr, map);
|
|
54
|
+
|
|
55
|
+
checkAttributes(layer, attr);
|
|
56
|
+
expect(cesiumTerrainProviderSpy).toHaveBeenCalledTimes(1);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
describe("setVisible", function () {
|
|
60
|
+
it("calls setVisible without map shall not fail", function () {
|
|
61
|
+
const layer = terrain.createLayer(attr, map);
|
|
62
|
+
|
|
63
|
+
layer.setVisible(true, attr);
|
|
64
|
+
|
|
65
|
+
checkAttributes(layer, attr);
|
|
66
|
+
expect(cesiumTerrainProviderSpy).toHaveBeenCalledTimes(0);
|
|
67
|
+
});
|
|
68
|
+
it("calls setVisible without map and attributes shall not fail", function () {
|
|
69
|
+
const layer = terrain.createLayer(attr, map);
|
|
70
|
+
|
|
71
|
+
layer.setVisible(true);
|
|
72
|
+
|
|
73
|
+
checkAttributes(layer, attr);
|
|
74
|
+
expect(cesiumTerrainProviderSpy).toHaveBeenCalledTimes(0);
|
|
75
|
+
});
|
|
76
|
+
it("sets the terrain layer visible by creating a CesiumTerrainProvider", function () {
|
|
77
|
+
const layer = terrain.createLayer(attr, map);
|
|
78
|
+
|
|
79
|
+
layer.setVisible(true, attr, map);
|
|
80
|
+
|
|
81
|
+
checkAttributes(layer, attr);
|
|
82
|
+
expect(cesiumTerrainProviderSpy).toHaveBeenCalledTimes(1);
|
|
83
|
+
});
|
|
84
|
+
it("sets the terrain layer not visible by creating a EllipsoidTerrainProvider", function () {
|
|
85
|
+
const cesiumEllipsoidTerrainProviderSpy = jest.spyOn(global.Cesium, "EllipsoidTerrainProvider"),
|
|
86
|
+
layer = terrain.createLayer(attr, map);
|
|
87
|
+
|
|
88
|
+
layer.setVisible(false, attr, map);
|
|
89
|
+
|
|
90
|
+
checkAttributes(layer, attr);
|
|
91
|
+
expect(cesiumTerrainProviderSpy).toHaveBeenCalledTimes(0);
|
|
92
|
+
expect(cesiumEllipsoidTerrainProviderSpy).toHaveBeenCalledTimes(1);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe("get", function () {
|
|
96
|
+
it("calls get for attributes", function () {
|
|
97
|
+
const layer = terrain.createLayer(attr, map);
|
|
98
|
+
|
|
99
|
+
checkAttributes(layer, attr);
|
|
100
|
+
expect(layer.get(null)).toEqual(undefined);
|
|
101
|
+
expect(layer.get(undefined)).toEqual(undefined);
|
|
102
|
+
expect(layer.get("")).toEqual(undefined);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import Tileset from "../../src/layer/tileset";
|
|
2
|
+
|
|
3
|
+
describe("tileset.js", function () {
|
|
4
|
+
const consoleWarn = console.warn;
|
|
5
|
+
let attr, map, cesium3DTilesetSpy;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
global.Cesium = {};
|
|
9
|
+
global.Cesium.Cesium3DTileset = jest.fn();
|
|
10
|
+
attr = {
|
|
11
|
+
id: "4002",
|
|
12
|
+
name: "Gebäude LoD2",
|
|
13
|
+
url: "https://geoportal-hamburg.de/gdi3d/datasource-data/LoD2",
|
|
14
|
+
typ: "TileSet3D",
|
|
15
|
+
cesium3DTilesetOptions: {
|
|
16
|
+
maximumScreenSpaceError: 6
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
map = {
|
|
20
|
+
getCesiumScene: () => {
|
|
21
|
+
return {
|
|
22
|
+
primitives: {
|
|
23
|
+
contains: jest.fn(),
|
|
24
|
+
add: jest.fn(),
|
|
25
|
+
remove: jest.fn()
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
cesium3DTilesetSpy = jest.spyOn(global.Cesium, "Cesium3DTileset");
|
|
31
|
+
console.warn = jest.fn();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
global.Cesium = null;
|
|
36
|
+
jest.clearAllMocks();
|
|
37
|
+
console.warn = consoleWarn;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
function checkAttributes (layer, attrs) {
|
|
41
|
+
expect(layer.get("name")).toEqual(attrs.name);
|
|
42
|
+
expect(layer.get("typ")).toEqual(attrs.typ);
|
|
43
|
+
expect(layer.get("id")).toEqual(attrs.id);
|
|
44
|
+
expect(layer.tileset.layerReferenceId).toEqual(attrs.id);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
describe("createLayer", function () {
|
|
48
|
+
it("creates tileset layer without map and not selected", function () {
|
|
49
|
+
const layer = new Tileset(attr);
|
|
50
|
+
|
|
51
|
+
checkAttributes(layer, attr);
|
|
52
|
+
expect(layer.tileSet).toEqual(undefined);
|
|
53
|
+
expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
|
|
54
|
+
});
|
|
55
|
+
it("creates tileset layer with map and selected", function () {
|
|
56
|
+
attr.isSelected = true;
|
|
57
|
+
const layer = new Tileset(attr, map);
|
|
58
|
+
|
|
59
|
+
checkAttributes(layer, attr);
|
|
60
|
+
expect(layer.tileset.show).toEqual(true);
|
|
61
|
+
expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
|
|
62
|
+
});
|
|
63
|
+
it("creates 2 tileset layers with map and selected and checks attributes", function () {
|
|
64
|
+
const attr2 = {
|
|
65
|
+
id: "4003",
|
|
66
|
+
name: "name",
|
|
67
|
+
url: "https://url",
|
|
68
|
+
typ: "TileSet3D"
|
|
69
|
+
},
|
|
70
|
+
layer = new Tileset(attr, map),
|
|
71
|
+
layer2 = new Tileset(attr2, map);
|
|
72
|
+
|
|
73
|
+
checkAttributes(layer, attr);
|
|
74
|
+
checkAttributes(layer2, attr2);
|
|
75
|
+
expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(2);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe("setVisible", function () {
|
|
79
|
+
it("calls setVisible without map shall not fail", function () {
|
|
80
|
+
const layer = new Tileset(attr, map);
|
|
81
|
+
|
|
82
|
+
expect(layer.tileset.show).toEqual(undefined);
|
|
83
|
+
layer.setVisible(true);
|
|
84
|
+
|
|
85
|
+
checkAttributes(layer, attr);
|
|
86
|
+
expect(layer.tileset.show).toEqual(undefined);
|
|
87
|
+
expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
|
|
88
|
+
});
|
|
89
|
+
it("sets the tileset layer visible", function () {
|
|
90
|
+
const layer = new Tileset(attr, map);
|
|
91
|
+
|
|
92
|
+
layer.setVisible(true, map);
|
|
93
|
+
checkAttributes(layer, attr);
|
|
94
|
+
expect(layer.tileset.show).toEqual(true);
|
|
95
|
+
expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
|
|
96
|
+
});
|
|
97
|
+
it("sets the tileset layer not visible", function () {
|
|
98
|
+
const layer = new Tileset(attr, map);
|
|
99
|
+
|
|
100
|
+
layer.setVisible(false, map);
|
|
101
|
+
checkAttributes(layer, attr);
|
|
102
|
+
expect(layer.tileset.show).toEqual(false);
|
|
103
|
+
expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(1);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
describe("get", function () {
|
|
107
|
+
it("calls get for attributes", function () {
|
|
108
|
+
const layer = new Tileset(attr, map);
|
|
109
|
+
|
|
110
|
+
checkAttributes(layer, attr);
|
|
111
|
+
expect(layer.get(null)).toEqual(undefined);
|
|
112
|
+
expect(layer.get(undefined)).toEqual(undefined);
|
|
113
|
+
expect(layer.get("")).toEqual(undefined);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
});
|