itowns 2.44.3-next.11 → 2.44.3-next.13

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.
@@ -257,7 +257,7 @@ class StateControl extends THREE.EventDispatcher {
257
257
  touchToState(finger) {
258
258
  for (const key of Object.keys(DEFAULT_STATES)) {
259
259
  const state = this[key];
260
- if (state.enable && finger == state.finger) {
260
+ if (state.enable && finger === state.finger) {
261
261
  return state;
262
262
  }
263
263
  }
@@ -377,7 +377,7 @@ class StateControl extends THREE.EventDispatcher {
377
377
  event.preventDefault();
378
378
  if (this.enabled && this.ZOOM.enable) {
379
379
  viewCoords.copy(this._view.eventToViewCoords(event));
380
- this.currentState = this.NONE;
380
+ this.currentState = this.ZOOM;
381
381
  this.dispatchEvent({
382
382
  type: this.ZOOM._event,
383
383
  delta: event.deltaY,
@@ -120,22 +120,25 @@ class WFSSource extends Source {
120
120
  this.typeName = source.typeName;
121
121
  this.version = source.version || '2.0.2';
122
122
  this.bboxDigits = source.bboxDigits;
123
-
124
- // Add ? at the end of the url if it is not already in the given URL
125
- if (!this.url.endsWith('?')) {
126
- this.url = `${this.url}?`;
127
- }
128
- this.url = `${source.url}SERVICE=WFS&REQUEST=GetFeature&typeName=${this.typeName}&VERSION=${this.version}&SRSNAME=${this.crs}&outputFormat=${this.format}&BBOX=%bbox,${this.crs}`;
129
123
  this.zoom = {
130
124
  min: 0,
131
125
  max: Infinity
132
126
  };
127
+ const urlObj = new URL(source.url);
128
+ urlObj.searchParams.set('SERVICE', 'WFS');
129
+ urlObj.searchParams.set('REQUEST', 'GetFeature');
130
+ urlObj.searchParams.set('typeName', this.typeName);
131
+ urlObj.searchParams.set('VERSION', this.version);
132
+ urlObj.searchParams.set('SRSNAME', this.crs);
133
+ urlObj.searchParams.set('outputFormat', this.format);
134
+ urlObj.searchParams.set('BBOX', `%bbox,${this.crs}`);
133
135
  this.vendorSpecific = source.vendorSpecific;
134
136
  for (const name in this.vendorSpecific) {
135
137
  if (Object.prototype.hasOwnProperty.call(this.vendorSpecific, name)) {
136
- this.url = `${this.url}&${name}=${this.vendorSpecific[name]}`;
138
+ urlObj.searchParams.set(name, this.vendorSpecific[name]);
137
139
  }
138
140
  }
141
+ this.url = decodeURIComponent(urlObj.toString());
139
142
  }
140
143
  handlingError(err) {
141
144
  if (err.response && err.response.status == 400) {
@@ -109,18 +109,25 @@ class WMSSource extends Source {
109
109
  }
110
110
  }
111
111
  const crsPropName = this.version === '1.3.0' ? 'CRS' : 'SRS';
112
-
113
- // Add ? at the end of the url if it is not already in the given URL
114
- if (!this.url.endsWith('?')) {
115
- this.url = `${this.url}?`;
116
- }
117
- this.url = `${this.url}SERVICE=WMS&REQUEST=GetMap&LAYERS=${this.name}&VERSION=${this.version}&STYLES=${this.style}&FORMAT=${this.format}&TRANSPARENT=${this.transparent}&BBOX=%bbox&${crsPropName}=${this.crs}&WIDTH=${this.width}&HEIGHT=${this.height}`;
112
+ const urlObj = new URL(this.url);
113
+ urlObj.searchParams.set('SERVICE', 'WMS');
114
+ urlObj.searchParams.set('REQUEST', 'GetMap');
115
+ urlObj.searchParams.set('LAYERS', this.name);
116
+ urlObj.searchParams.set('VERSION', this.version);
117
+ urlObj.searchParams.set('STYLES', this.style);
118
+ urlObj.searchParams.set('FORMAT', this.format);
119
+ urlObj.searchParams.set('TRANSPARENT', this.transparent);
120
+ urlObj.searchParams.set('BBOX', '%bbox');
121
+ urlObj.searchParams.set(crsPropName, this.crs);
122
+ urlObj.searchParams.set('WIDTH', this.width);
123
+ urlObj.searchParams.set('HEIGHT', this.height);
118
124
  this.vendorSpecific = source.vendorSpecific;
119
125
  for (const name in this.vendorSpecific) {
120
126
  if (Object.prototype.hasOwnProperty.call(this.vendorSpecific, name)) {
121
- this.url = `${this.url}&${name}=${this.vendorSpecific[name]}`;
127
+ urlObj.searchParams.set(name, this.vendorSpecific[name]);
122
128
  }
123
129
  }
130
+ this.url = decodeURIComponent(urlObj.toString());
124
131
  }
125
132
  urlFromExtent(extentOrTile) {
126
133
  const extent = extentOrTile.isExtent ? extentOrTile.as(this.crs, _extent) : extentOrTile.toExtent(this.crs, _extent);
@@ -69,18 +69,24 @@ class WMTSSource extends TMSSource {
69
69
  }
70
70
  super(source);
71
71
  this.isWMTSSource = true;
72
-
73
- // Add ? at the end of the url if it is not already in the given URL
74
- if (!this.url.endsWith('?')) {
75
- this.url = `${this.url}?`;
76
- }
77
- this.url = `${this.url}` + `LAYER=${source.name}` + `&FORMAT=${this.format}` + '&SERVICE=WMTS' + `&VERSION=${source.version || '1.0.0'}` + '&REQUEST=GetTile' + `&STYLE=${source.style || 'normal'}` + `&TILEMATRIXSET=${source.tileMatrixSet}` + '&TILEMATRIX=%TILEMATRIX&TILEROW=%ROW&TILECOL=%COL';
72
+ const urlObj = new URL(this.url);
73
+ urlObj.searchParams.set('LAYER', source.name);
74
+ urlObj.searchParams.set('FORMAT', this.format);
75
+ urlObj.searchParams.set('SERVICE', 'WMTS');
76
+ urlObj.searchParams.set('VERSION', source.version || '1.0.0');
77
+ urlObj.searchParams.set('REQUEST', 'GetTile');
78
+ urlObj.searchParams.set('STYLE', source.style || 'normal');
79
+ urlObj.searchParams.set('TILEMATRIXSET', source.tileMatrixSet);
80
+ urlObj.searchParams.set('TILEMATRIX', '%TILEMATRIX');
81
+ urlObj.searchParams.set('TILEROW', '%ROW');
82
+ urlObj.searchParams.set('TILECOL', '%COL');
78
83
  this.vendorSpecific = source.vendorSpecific;
79
84
  for (const name in this.vendorSpecific) {
80
85
  if (Object.prototype.hasOwnProperty.call(this.vendorSpecific, name)) {
81
- this.url = `${this.url}&${name}=${this.vendorSpecific[name]}`;
86
+ urlObj.searchParams.set(name, this.vendorSpecific[name]);
82
87
  }
83
88
  }
89
+ this.url = decodeURIComponent(urlObj.toString());
84
90
  }
85
91
  }
86
92
  export default WMTSSource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itowns",
3
- "version": "2.44.3-next.11",
3
+ "version": "2.44.3-next.13",
4
4
  "description": "A JS/WebGL framework for 3D geospatial data visualization",
5
5
  "type": "module",
6
6
  "main": "lib/Main.js",