@masterportal/masterportalapi 2.10.0 → 2.12.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 CHANGED
@@ -3,45 +3,54 @@
3
3
 
4
4
  The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
5
5
 
6
- ## Unreleased - in development
6
+
7
+ ## 2.12.0 - 2022-01-24
7
8
  ### Added
9
+ - Added support for Node LTS version 18.
10
+ - Add possibility to specify additional layerparams for a wmts layer, like opacity for example.
11
+ - Add possibility to make a 3DTilset layer transparent/opaque.
12
+ - In the gazetteer search the prefix `*` can now be switched off with the attribute `searchStreetBeforeWord`
8
13
 
9
14
  ### Changed
15
+ - The following packages have been updated:
16
+ - dependencies:
17
+ - core-js: 3.24.0 to 3.27.1
18
+ - proj4: 2.8.0 to 2.8.1
19
+ - devDependencies:
20
+ - @babel/core: 7.18.9 to 7.20.12
21
+ - @babel/plugin-transform-modules-commonjs: 7.18.6 to 7.20.11
22
+ - canvas: 2.9.3 to 2.11.0
23
+ - eslint: 8.20.0 to 8.31.0
24
+ - husky: 8.0.1 to 8.0.3
25
+ - jest: 28.1.3 to 29.3.1
26
+ - jest-environment-jsdom: 28.1.3 to 29.3.1
27
+ - jsdoc: 3.6.11 to 4.0.0
28
+ - sass: 1.54.0 to 1.57.1
10
29
 
11
- ### Deprecated
30
+ ---
12
31
 
13
- ### Removed
32
+ ## 2.11.0 - 2022-11-24
33
+ ### Added
34
+ - crossOrigin settings can now be passed to WMSSources (TileWMS, ImageWMS) via config.json or services.json
14
35
 
15
36
  ### Fixed
37
+ - Issue #847(Masterportal): searchAddress now keeps searching for house numbers if a digit was entered at the end of the search string
16
38
 
17
39
  ---
18
- ## 2.10.0 - 2022-03-11
40
+
41
+ ## 2.10.0 - 2022-11-03
19
42
  ### Added
20
43
  - DPS-1313: Added custom DragPan interaction to add ability to use 2-Finger-Pan instead of 1-Finger-Pan on mobile devices
21
44
 
22
45
  ### Changed
23
46
  - Exports in src/rawLayerList, src/crs.js and src/lib/load3DScript.js changed to export default {} to provide ES-Syntax.
24
47
 
25
- ### Deprecated
26
-
27
- ### Removed
28
-
29
- ### Fixed
30
-
31
48
  ---
32
49
 
33
50
  ## 2.9.0 - 2022-10-25
34
- ### Added
35
-
36
51
  ### Changed
37
52
  - Exports in src/rawLayerList and src/crs.js changed to module.exports to provide the possibility to stub the functions with sinon in masterportal.
38
53
 
39
- ### Deprecated
40
-
41
- ### Removed
42
-
43
- ### Fixed
44
-
45
54
  ---
46
55
 
47
56
  ## 2.8.0 - 2022-10-04
package/License.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2018-2020 Freie und Hansestadt Hamburg, Landesbetrieb Geoinformation und Vermessung
3
+ Copyright (c) 2018-2023 Freie und Hansestadt Hamburg, Landesbetrieb Geoinformation und Vermessung
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -31,5 +31,5 @@
31
31
  "id": "1001"
32
32
  }
33
33
  ],
34
- "cesiumLib":"https://geoportal-hamburg.de/mastercode/cesium/1_95/Cesium.js"
34
+ "cesiumLib":"https://geoportal-hamburg.de/mastercode/cesium/1_99/Cesium.js"
35
35
  }
package/example/index.js CHANGED
@@ -51,7 +51,7 @@ document.getElementById("enable").addEventListener("click", function () {
51
51
  document.getElementById("layer-visibility").style.display = "none";
52
52
  }
53
53
  else {
54
- const lib = portalConfig.cesiumLib ? portalConfig.cesiumLib : "https://geoportal-hamburg.de/mastercode/cesium/1_95/index.js";
54
+ const lib = portalConfig.cesiumLib ? portalConfig.cesiumLib : "https://geoportal-hamburg.de/mastercode/cesium/1_99/index.js";
55
55
 
56
56
  document.getElementById("layer-visibility").style.display = "block";
57
57
 
package/package.json CHANGED
@@ -1,62 +1,63 @@
1
- {
2
- "name": "@masterportal/masterportalapi",
3
- "author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
4
- "version": "2.10.0",
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.24.0",
23
- "ol": "7.1.0",
24
- "olcs": "^2.13.1",
25
- "proj4": "^2.8.0",
26
- "xml2js": "^0.4.23"
27
- },
28
- "devDependencies": {
29
- "@babel/core": "^7.18.9",
30
- "@babel/plugin-transform-modules-commonjs": "^7.18.6",
31
- "@parcel/transformer-sass": "^2.6.2",
32
- "buffer": "^6.0.3",
33
- "canvas": "^2.9.3",
34
- "eslint": "^8.20.0",
35
- "events": "^3.3.0",
36
- "husky": "^8.0.1",
37
- "jest": "^28.1.3",
38
- "jest-canvas-mock": "^2.4.0",
39
- "jest-environment-jsdom": "^28.1.3",
40
- "jsdoc": "^3.6.11",
41
- "parcel": "^2.6.2",
42
- "process": "^0.11.10",
43
- "sass": "^1.54.0",
44
- "stream-browserify": "^3.0.0",
45
- "timers-browserify": "^2.0.12"
46
- },
47
- "peerDependencies": {
48
- "cesium": "^1.95.0"
49
- },
50
- "engines": {
51
- "node": "^16.13.2",
52
- "npm": "^8.1.2"
53
- },
54
- "homepage": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi#readme",
55
- "directories": {
56
- "example": "example",
57
- "test": "test"
58
- },
59
- "bugs": {
60
- "url": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi/issues"
61
- }
62
- }
1
+ {
2
+ "name": "@masterportal/masterportalapi",
3
+ "author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
4
+ "version": "2.12.0",
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.1.0",
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
+ },
47
+ "peerDependencies": {
48
+ "cesium": "^1.95.0"
49
+ },
50
+ "engines": {
51
+ "node": "^16.13.2 || ^18.12.0",
52
+ "npm": "^8.1.2"
53
+ },
54
+ "homepage": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi#readme",
55
+ "directories": {
56
+ "doc": "docs",
57
+ "example": "example",
58
+ "test": "test"
59
+ },
60
+ "bugs": {
61
+ "url": "https://bitbucket.org/geowerkstatt-hamburg/masterportalapi/issues"
62
+ }
63
+ }
@@ -15,6 +15,7 @@ function createTileSet (rawLayer) {
15
15
  options.url = url;
16
16
  return new Cesium.Cesium3DTileset(options);
17
17
  }
18
+
18
19
  /**
19
20
  * Creates an terrain layer to use in ol-Cesium map. Sets the id of the rawlayer to tileset.layerReferenceId.
20
21
  * @param {Object} rawLayer - layer specification as in services.json
@@ -34,6 +35,30 @@ export default function Tileset (rawLayer) {
34
35
  this.tileset.layerReferenceId = rawLayer.id;
35
36
  }
36
37
  }
38
+
39
+ /**
40
+ * Sets the opacity to the tilset.
41
+ * @param {Numbe} opacity the opacity
42
+ * @returns {void}
43
+ */
44
+ Tileset.prototype.setOpacity = function (opacity) {
45
+ let color = "rgba(255, 255, 255, " + opacity + ")";
46
+
47
+ if (this.tileset.style !== undefined) {
48
+ const splitValues = this.tileset.style.style.color.split(",");
49
+
50
+ if (!splitValues[0].startsWith("rgba") && splitValues[0].startsWith("rgb")) {
51
+ splitValues[0] = splitValues[0].replace("rgb", "rgba");
52
+ splitValues[2] = splitValues[2].split(")")[0];
53
+ }
54
+
55
+ splitValues[3] = ` ${opacity})`;
56
+ color = splitValues.toString();
57
+ }
58
+
59
+ this.tileset.style = new Cesium.Cesium3DTileStyle({color});
60
+ };
61
+
37
62
  /**
38
63
  *
39
64
  * @param {boolean} value if true, terrainProvider is set to map and terrain will be visible
@@ -53,6 +78,7 @@ Tileset.prototype.setVisible = function (value, map) {
53
78
  }
54
79
  }
55
80
  };
81
+
56
82
  /**
57
83
  * Returns the value for the given key of the rawlayer.
58
84
  * @param {String} key to get the value for
package/src/layer/wms.js CHANGED
@@ -82,6 +82,7 @@ export function makeParams (rawLayer) {
82
82
  * @param {string} [rawLayer.gutter] - optional the size in pixels of the gutter around image tiles to ignore
83
83
  * @param {function} [rawLayer.olAttribution] - optional function that takes a module:ol/Map~FrameState and returns a string or an array of strings representing source attributions
84
84
  * @param {string|number} [rawLayer.tilesize] - optional needed to create the tileGrid
85
+ * @param {string|"anonymous"} [rawLayer.crossOrigin] - optional needed for CORS requests of image data, to enable canvas export
85
86
  * @param {object} options - optional resolutions and origin to create the TileGrid
86
87
  * @param {Array} [options.resolutions] - optional resolutions to create the TileGrid, must be in descending order
87
88
  * @param {Array} [options.origin] - optional origin to create the TileGrid
@@ -99,7 +100,8 @@ export function createLayerSource (rawLayer, options) {
99
100
  params,
100
101
  serverType: rawLayer.serverType,
101
102
  projection: projection,
102
- attributions: rawLayer.olAttribution
103
+ attributions: rawLayer.olAttribution,
104
+ crossOrigin: rawLayer.crossOrigin
103
105
  });
104
106
  }
105
107
  if (options && options.resolutions) {
@@ -115,7 +117,8 @@ export function createLayerSource (rawLayer, options) {
115
117
  gutter: rawLayer.gutter || 0,
116
118
  tileGrid: tileGrid,
117
119
  projection: projection,
118
- attributions: rawLayer.olAttribution
120
+ attributions: rawLayer.olAttribution,
121
+ crossOrigin: rawLayer.crossOrigin
119
122
  });
120
123
  }
121
124
 
@@ -130,6 +133,7 @@ export function createLayerSource (rawLayer, options) {
130
133
  * @param {string} [rawLayer.gutter] - optional the size in pixels of the gutter around image tiles to ignore
131
134
  * @param {function} [rawLayer.olAttribution] - optional function that takes a module:ol/Map~FrameState and returns a string or an array of strings representing source attributions
132
135
  * @param {string|number} [rawLayer.tilesize] - optional needed to create the tileGrid
136
+ * @param {string|"anonymous"} [rawLayer.crossOrigin] - optional needed for CORS requests of image data, to enable canvas export
133
137
  * @param {object} layerParams - additional layer params
134
138
  * @param {object} options - optional resolutions and origin to create the TileGrid
135
139
  * @param {Array} [options.resolutions] - optional resolutions to create the TileGrid, must be in descending order
package/src/layer/wmts.js CHANGED
@@ -165,29 +165,30 @@ export function createLayerSourceByCapabilities (attrs, tileLayer) {
165
165
 
166
166
  /**
167
167
  * Creates the WMTSLayer.
168
- * @param {Object} attrs attributes of the layer
168
+ * @param {object} rawLayer - layer specification as in services.json
169
+ * @param {object} layerParams - additional layer params
169
170
  * @returns {void}
170
171
  */
171
- export function createLayer (attrs) {
172
- const tileLayer = new TileLayer({
173
- id: attrs.id,
172
+ export function createLayer (rawLayer, layerParams = {}) {
173
+ const tileLayer = new TileLayer(Object.assign({
174
+ id: rawLayer.id,
174
175
  source: new WMTS({}),
175
- name: attrs.name,
176
- minResolution: attrs.minScale,
177
- maxResolution: attrs.maxScale,
176
+ name: rawLayer.name,
177
+ minResolution: rawLayer.minScale,
178
+ maxResolution: rawLayer.maxScale,
178
179
  supported: ["2D", "3D"],
179
180
  showSettings: true,
180
181
  extent: null,
181
- typ: attrs.typ,
182
- legendURL: attrs.legendURL,
183
- infoFormat: attrs.infoFormat
184
- });
182
+ typ: rawLayer.typ,
183
+ legendURL: rawLayer.legendURL,
184
+ infoFormat: rawLayer.infoFormat
185
+ }, layerParams));
185
186
 
186
- if (attrs.optionsFromCapabilities === undefined) {
187
- createLayerSourceByDefinitions(attrs, tileLayer);
187
+ if (rawLayer.optionsFromCapabilities === undefined) {
188
+ createLayerSourceByDefinitions(rawLayer, tileLayer);
188
189
  }
189
190
  else {
190
- createLayerSourceByCapabilities(attrs, tileLayer);
191
+ createLayerSourceByCapabilities(rawLayer, tileLayer);
191
192
  }
192
193
 
193
194
  return tileLayer;
@@ -10,16 +10,20 @@ let abortController = null;
10
10
  * Chains gazetteer request and response parser.
11
11
  * @param {string} type from searchTypes
12
12
  * @param {(string|string[])} values one or multiple strings, depending on type
13
+ * @param {function} sortFunction a function with two parameters which can be used to sort all results
14
+ * @param {function} filterFunction a function which will be executed to filter results
15
+ * @param {boolean} searchStreetBeforeWord whether to put an star in front of the search for streets (full text search)
13
16
  * @returns {Promise<SearchResult[]>} parsed response
14
17
  * @ignore
15
18
  */
16
- function searchAndParse (type, values) {
19
+ function searchAndParse (type, values, sortFunction = (a, b) => a.name.localeCompare(b.name), filterFunction = () => true, searchStreetBeforeWord) {
17
20
  return new Promise((resolve, reject) => {
18
- searchGazetteer(type, values, abortController)
21
+ searchGazetteer(type, values, abortController, searchStreetBeforeWord)
19
22
  .then(results => {
20
- const parsed = parse(type, results);
21
-
22
- resolve(parsed);
23
+ parse(type, results).then(parsed => {
24
+ resolve(parsed.filter(filterFunction)
25
+ .sort(sortFunction));
26
+ });
23
27
  })
24
28
  .catch(e => reject(e));
25
29
  });
@@ -30,24 +34,34 @@ function searchAndParse (type, values) {
30
34
  * Combines streets with their available house numbers before returning.
31
35
  * @param {string} searchstring string to search for
32
36
  * @param {boolean} searchHouseNumbers whether to additionally search for house numbers
37
+ * @param {boolean} searchStreetBeforeWord whether to put an star in front of the search for streets (full text search)
33
38
  * @returns {Promise<SearchResult[]>} parsed response
34
39
  * @ignore
35
40
  */
36
- function searchAndParseStreetAndHouseNumber (searchstring, searchHouseNumbers) {
41
+ function searchAndParseStreetAndHouseNumber (searchstring, searchHouseNumbers, searchStreetBeforeWord) {
37
42
  return new Promise((resolve, reject) => {
38
- searchGazetteer(searchTypes.STREET, searchstring, abortController)
43
+ searchGazetteer(searchTypes.STREET, searchstring, abortController, searchStreetBeforeWord)
39
44
  .then(streetResults => parse(searchTypes.STREET, streetResults))
40
45
  .then(parsedStreetResults => {
41
- const allSearches = [];
46
+ const allSearches = [],
47
+ matches = searchstring.match(new RegExp("^(.+)[\\s,](\\d+|\\d.*)$"));
42
48
 
43
49
  for (let i = 0; i < parsedStreetResults.length; i++) {
44
50
  // put street in front of street's street+hnr as ordering
45
51
  allSearches.push([parsedStreetResults[i]]);
46
52
  if (searchHouseNumbers) {
47
- allSearches.push(searchAndParse(searchTypes.HOUSE_NUMBERS_FOR_STREET, parsedStreetResults[i].name));
53
+ allSearches.push(searchAndParse(searchTypes.HOUSE_NUMBERS_FOR_STREET, parsedStreetResults[i].name, undefined, undefined, searchStreetBeforeWord));
48
54
  }
49
55
  }
50
56
 
57
+ if (!parsedStreetResults.length && matches?.length && searchHouseNumbers) {
58
+ allSearches.push(searchAndParse(searchTypes.HOUSE_NUMBERS_FOR_STREET,
59
+ matches[1],
60
+ (a, b) => parseInt(a.properties?.hausnummer, 10) - parseInt(b.properties?.hausnummer, 10),
61
+ item => item.properties?.hausnummerkomplett?.indexOf(matches[2]) === 0, // check longer housenumbers and suffixes!,
62
+ searchStreetBeforeWord));
63
+ }
64
+
51
65
  return Promise.all(allSearches);
52
66
  })
53
67
  .then(allResults => resolve([].concat(...allResults)))
@@ -87,6 +101,7 @@ export function search (searchstring, params, abortPreviousSearch = false) {
87
101
  zoomToParams,
88
102
  searchAddress = false,
89
103
  searchStreets = false,
104
+ searchStreetBeforeWord = true,
90
105
  searchDistricts = false,
91
106
  searchParcels = false,
92
107
  searchStreetKey = false,
@@ -122,14 +137,23 @@ export function search (searchstring, params, abortPreviousSearch = false) {
122
137
  }
123
138
 
124
139
  if (searchStreets) {
125
- searches.push(searchAndParseStreetAndHouseNumber(searchstring, searchHouseNumbers));
140
+ searches.push(searchAndParseStreetAndHouseNumber(searchstring, searchHouseNumbers, searchStreetBeforeWord));
126
141
  }
127
142
 
128
143
  if (searchAddress) {
129
144
  // assume pattern like "Streetname 41b", split to ["Streetname", "41", "b"]
130
- const values = searchstring.split(/(\d+)/).map(s => s.trim()).filter(x => x),
131
- // if neither two (no affix like b) or three (with affix like b) parts found, not enough (or too many) params for method - don't search
132
- type = [false, false, searchTypes.ADDRESS_UNAFFIXED, searchTypes.ADDRESS_AFFIXED][values.length];
145
+ let values = searchstring.split(/(\d+)/).map(s => s.trim()).filter(x => x);
146
+
147
+ if (values.length > 3) {
148
+ const streetName = values[0],
149
+ houseNum = values[1],
150
+ appendix = searchstring.replace(values[0], "").replace(values[1], "").trim();
151
+
152
+ values = [streetName, houseNum, appendix];
153
+ }
154
+
155
+ // if neither two (no affix like b) or three (with affix like b) parts found, not enough (or too many) params for method - don't search
156
+ const type = [false, false, searchTypes.ADDRESS_UNAFFIXED, searchTypes.ADDRESS_AFFIXED][values.length];
133
157
 
134
158
  if (type) {
135
159
  searches.push(searchAndParse(type, values));
@@ -16,11 +16,12 @@ export function encode (v) {
16
16
  * @param {string} key internal name for query froms searchTypes
17
17
  * @param {(string[]|string)} v string for single-value queries, string[] for multi-value queries, strings in order of appearance in URL
18
18
  * @returns {string} URL query part like "&StoryQuery_ID=queryName&param=value"
19
+ * @param {boolean} searchStreetBeforeWord whether to put an star in front of the search for streets (full text search)
19
20
  * @ignore
20
21
  */
21
- export function getIdQuery (key, v) {
22
+ export function getIdQuery (key, v, searchStreetBeforeWord = true) {
22
23
  return {
23
- [searchTypes.STREET]: encodedValue => `&StoredQuery_ID=findeStrasse&strassenname=*${encodedValue}`,
24
+ [searchTypes.STREET]: encodedValue => searchStreetBeforeWord ? `&StoredQuery_ID=findeStrasse&strassenname=*${encodedValue}` : `&StoredQuery_ID=findeStrasse&strassenname=${encodedValue}`,
24
25
  [searchTypes.DISTRICT]: encodedValue => `&StoredQuery_ID=findeStadtteil&stadtteilname=${encodedValue}`,
25
26
  [searchTypes.PARCEL]: encodedValue => `&StoredQuery_ID=Flurstueck&gemarkung=${encodedValue[0]}&flurstuecksnummer=${encodedValue[1]}`,
26
27
  [searchTypes.STREET_KEY]: encodedValue => `&StoredQuery_ID=findeStrassenSchluessel&strassenschluessel=${encodedValue}`,
@@ -35,12 +36,13 @@ export function getIdQuery (key, v) {
35
36
  * @param {string} key internal name for query froms searchTypes
36
37
  * @param {(string[]|string)} value value to search for
37
38
  * @param {AbortController} abortController the controller to abort the search
39
+ * @param {boolean} searchStreetBeforeWord whether to put an star in front of the search for streets (full text search)
38
40
  * @returns {Promise<string>} xhr response text
39
41
  * @ignore
40
42
  */
41
- export function searchGazetteer (key, value, abortController) {
43
+ export function searchGazetteer (key, value, abortController, searchStreetBeforeWord) {
42
44
  return new Promise((resolve, reject) => {
43
- const url = getGazetteerUrl() + getIdQuery(key, value);
45
+ const url = getGazetteerUrl() + getIdQuery(key, value, searchStreetBeforeWord);
44
46
 
45
47
  fetch(url, {
46
48
  signal: abortController?.signal,
@@ -7,6 +7,7 @@ describe("tileset.js", function () {
7
7
  beforeEach(() => {
8
8
  global.Cesium = {};
9
9
  global.Cesium.Cesium3DTileset = jest.fn();
10
+ global.Cesium.Cesium3DTileStyle = jest.fn(color => color);
10
11
  attr = {
11
12
  id: "4002",
12
13
  name: "Gebäude LoD2",
@@ -68,6 +69,15 @@ describe("tileset.js", function () {
68
69
  expect(cesium3DTilesetSpy).toHaveBeenCalledTimes(2);
69
70
  });
70
71
  });
72
+ describe("setOpacity", function () {
73
+ it("calls setOpacity sets opacity to terrain style", function () {
74
+ const layer = new Tileset(attr, map);
75
+
76
+ layer.setOpacity(0.5);
77
+
78
+ expect(layer.tileset.style).toEqual({color: "rgba(255, 255, 255, 0.5)"});
79
+ });
80
+ });
71
81
  describe("setVisible", function () {
72
82
  it("calls setVisible without map shall not fail", function () {
73
83
  const layer = new Tileset(attr, map);
@@ -111,6 +111,16 @@ describe("wms.js", function () {
111
111
 
112
112
  expect(source).toBeInstanceOf(ImageWMS);
113
113
  });
114
+ it("creates a LayerSource with crossOrigin set to 'anonymous'", function () {
115
+ // only relevant for TileWMS and ImageWMS instances
116
+ const
117
+ tileWMS = wms.createLayerSource({singleTile: false, crossOrigin: "anonymous"}),
118
+ imageWMS = wms.createLayerSource({singleTile: true, crossOrigin: "anonymous"});
119
+
120
+ // eslint-disable-next-line no-underscore-dangle
121
+ expect(imageWMS.crossOrigin_).toEqual("anonymous");
122
+ expect(tileWMS.crossOrigin).toEqual("anonymous");
123
+ });
114
124
  });
115
125
  describe("createLayerSource with a tileGrid", function () {
116
126
  function attrFunction () {
@@ -33,7 +33,7 @@ jest.mock("../../src/searchAddress/searchGazetteer", () => {
33
33
 
34
34
  import {searchGazetteer as mockedSearchGazetteer} from "../../src/searchAddress/searchGazetteer";
35
35
 
36
- describe("searchAddress", function () {
36
+ describe.only("searchAddress", function () {
37
37
  describe("search", function () {
38
38
  it("rejects if missing configuration of what to search for", function (done) {
39
39
  search("Pflugacker", {}).catch(e => {
@@ -77,15 +77,15 @@ describe("searchAddress", function () {
77
77
  .then(results => {
78
78
  // order of calls may vary, hence using expect.arrayContaining
79
79
  const expected = [
80
- [types.ADDRESS_UNAFFIXED, ["Address", "7"], abortController],
81
- [types.ADDRESS_AFFIXED, ["Address", "7", "b"], abortController],
82
- [types.STREET, "Streetname", abortController],
83
- [types.STREET, "StreetnameAndHnrs", abortController],
84
- [types.HOUSE_NUMBERS_FOR_STREET, "Bargkoppelweg", abortController],
85
- [types.DISTRICT, "Districtname", abortController],
86
- [types.PARCEL, ["1234", "1234"], abortController],
87
- [types.PARCEL, ["1234", "5678"], abortController],
88
- [types.STREET_KEY, "A12345", abortController]
80
+ [types.ADDRESS_UNAFFIXED, ["Address", "7"], abortController, undefined],
81
+ [types.ADDRESS_AFFIXED, ["Address", "7", "b"], abortController, undefined],
82
+ [types.STREET, "Streetname", abortController, true],
83
+ [types.STREET, "StreetnameAndHnrs", abortController, true],
84
+ [types.HOUSE_NUMBERS_FOR_STREET, "Bargkoppelweg", abortController, true],
85
+ [types.DISTRICT, "Districtname", abortController, undefined],
86
+ [types.PARCEL, ["1234", "1234"], abortController, undefined],
87
+ [types.PARCEL, ["1234", "5678"], abortController, undefined],
88
+ [types.STREET_KEY, "A12345", abortController, undefined]
89
89
  ];
90
90
 
91
91
  expect(results[0]).toHaveLength(1);
@@ -15,7 +15,8 @@ describe("searchAddress", function () {
15
15
 
16
16
  describe("getIdQuery", function () {
17
17
  it("encodes given search phrase(s) and builds query fragment from it", function () {
18
- expect(getIdQuery(searchTypes.STREET, "hello world")).toEqual("&StoredQuery_ID=findeStrasse&strassenname=*hello%20world");
18
+ expect(getIdQuery(searchTypes.STREET, "hello world", true)).toEqual("&StoredQuery_ID=findeStrasse&strassenname=*hello%20world");
19
+ expect(getIdQuery(searchTypes.STREET, "hello world", false)).toEqual("&StoredQuery_ID=findeStrasse&strassenname=hello%20world");
19
20
  expect(getIdQuery(searchTypes.DISTRICT, "hello world")).toEqual("&StoredQuery_ID=findeStadtteil&stadtteilname=hello%20world");
20
21
  expect(getIdQuery(searchTypes.PARCEL, ["1 a", "1 b"])).toEqual("&StoredQuery_ID=Flurstueck&gemarkung=1%20a&flurstuecksnummer=1%20b");
21
22
  expect(getIdQuery(searchTypes.STREET_KEY, "A12345")).toEqual("&StoredQuery_ID=findeStrassenSchluessel&strassenschluessel=A12345");