itowns 2.44.3-next.24 → 2.44.3-next.26
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/dist/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/lib/Controls/GlobeControls.js +4 -4
- package/lib/Converter/convertToTile.js +0 -5
- package/lib/Core/Deprecated/Undeprecator.js +0 -1
- package/lib/Core/Geographic/Crs.js +19 -0
- package/lib/Core/Prefab/Globe/Atmosphere.js +0 -6
- package/lib/Layer/OrientedImageLayer.js +0 -2
- package/lib/Renderer/SphereHelper.js +0 -6
- package/lib/Source/FileSource.js +0 -2
- package/lib/Source/Source.js +0 -3
- package/lib/Source/VectorTilesSource.js +0 -2
- package/lib/Source/WMSSource.js +38 -10
- package/lib/Utils/placeObjectOnGround.js +0 -1
- package/package.json +1 -1
|
@@ -1035,7 +1035,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
1035
1035
|
*
|
|
1036
1036
|
* @deprecated Use View#getScale instead.
|
|
1037
1037
|
*/
|
|
1038
|
-
getScale(pitch)
|
|
1038
|
+
getScale(pitch) {
|
|
1039
1039
|
console.warn('Deprecated, use View#getScale instead.');
|
|
1040
1040
|
return this.view.getScale(pitch);
|
|
1041
1041
|
}
|
|
@@ -1048,7 +1048,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
1048
1048
|
*
|
|
1049
1049
|
* @deprecated Use `View#getPixelsToMeters` instead.
|
|
1050
1050
|
*/
|
|
1051
|
-
pixelsToMeters(pixels)
|
|
1051
|
+
pixelsToMeters(pixels) {
|
|
1052
1052
|
let pixelPitch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.28;
|
|
1053
1053
|
console.warn('Deprecated use View#getPixelsToMeters instead.');
|
|
1054
1054
|
const scaled = this.getScale(pixelPitch);
|
|
@@ -1064,7 +1064,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
1064
1064
|
* @deprecated Use `View#getPixelsToMeters` and `GlobeControls#metersToDegrees`
|
|
1065
1065
|
* instead.
|
|
1066
1066
|
*/
|
|
1067
|
-
pixelsToDegrees(pixels)
|
|
1067
|
+
pixelsToDegrees(pixels) {
|
|
1068
1068
|
let pixelPitch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.28;
|
|
1069
1069
|
console.warn('Deprecated, use View#getPixelsToMeters and GlobeControls#getMetersToDegrees instead.');
|
|
1070
1070
|
const chord = this.pixelsToMeters(pixels, pixelPitch);
|
|
@@ -1079,7 +1079,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
1079
1079
|
*
|
|
1080
1080
|
* @deprecated Use `View#getMetersToPixels` instead.
|
|
1081
1081
|
*/
|
|
1082
|
-
metersToPixels(value)
|
|
1082
|
+
metersToPixels(value) {
|
|
1083
1083
|
let pixelPitch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.28;
|
|
1084
1084
|
console.warn('Deprecated, use View#getMetersToPixels instead.');
|
|
1085
1085
|
const scaled = this.getScale(pixelPitch);
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* To change this license header, choose License Headers in Project Properties.
|
|
3
|
-
* To change this template file, choose Tools | Templates
|
|
4
|
-
* and open the template in the editor.
|
|
5
|
-
*/
|
|
6
1
|
import * as THREE from 'three';
|
|
7
2
|
import TileMesh from "../Core/TileMesh.js";
|
|
8
3
|
import LayeredMaterial from "../Renderer/LayeredMaterial.js";
|
|
@@ -13,7 +13,6 @@ export const deprecatedColorLayerOptions = options => {
|
|
|
13
13
|
return options;
|
|
14
14
|
};
|
|
15
15
|
export const deprecatedParsingOptionsToNewOne = options => {
|
|
16
|
-
/* istanbul ignore next */
|
|
17
16
|
if (options.crsOut || options.crsIn) {
|
|
18
17
|
console.warn('Parsing options with crsIn and crsOut are deprecated, use { in, out } structure.');
|
|
19
18
|
const newOptions = {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import proj4 from 'proj4';
|
|
2
2
|
proj4.defs('EPSG:4978', '+proj=geocent +datum=WGS84 +units=m +no_defs');
|
|
3
3
|
|
|
4
|
+
// Redefining proj4 global projections to match epsg.org database axis order.
|
|
5
|
+
// See https://github.com/iTowns/itowns/pull/2465#issuecomment-2517024859
|
|
6
|
+
proj4.defs('EPSG:4326').axis = 'neu';
|
|
7
|
+
proj4.defs('EPSG:4269').axis = 'neu';
|
|
8
|
+
proj4.defs('WGS84').axis = 'neu';
|
|
9
|
+
|
|
4
10
|
/**
|
|
5
11
|
* A projection as a CRS identifier string. This identifier references a
|
|
6
12
|
* projection definition previously defined with
|
|
@@ -133,6 +139,19 @@ export function reasonableEpsilon(crs) {
|
|
|
133
139
|
}
|
|
134
140
|
}
|
|
135
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Returns the axis parameter defined in proj4 for the provided crs.
|
|
144
|
+
* Might be undefined depending on crs definition.
|
|
145
|
+
*
|
|
146
|
+
* @param crs - The CRS to get axis from.
|
|
147
|
+
* @returns the matching proj4 axis string, 'enu' for instance (east, north, up)
|
|
148
|
+
*/
|
|
149
|
+
export function axisOrder(crs) {
|
|
150
|
+
mustBeString(crs);
|
|
151
|
+
const projection = proj4.defs(crs);
|
|
152
|
+
return !projection ? undefined : projection.axis;
|
|
153
|
+
}
|
|
154
|
+
|
|
136
155
|
/**
|
|
137
156
|
* Defines a proj4 projection as a named alias.
|
|
138
157
|
* This function is a specialized wrapper over the
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* To change this license header, choose License Headers in Project Properties.
|
|
3
|
-
* To change this template file, choose Tools | Templates
|
|
4
|
-
* and open the template in the editor.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import * as THREE from 'three';
|
|
8
2
|
import GeometryLayer from "../../../Layer/GeometryLayer.js";
|
|
9
3
|
import Coordinates from "../../Geographic/Coordinates.js";
|
|
@@ -103,8 +103,6 @@ class OrientedImageLayer extends GeometryLayer {
|
|
|
103
103
|
getCamerasNameFromFeature = () => {},
|
|
104
104
|
...geometryOptions
|
|
105
105
|
} = config;
|
|
106
|
-
|
|
107
|
-
/* istanbul ignore next */
|
|
108
106
|
if (config.projection) {
|
|
109
107
|
console.warn('OrientedImageLayer projection parameter is deprecated, use crs instead.');
|
|
110
108
|
config.crs = config.crs || config.projection;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* To change this license header, choose License Headers in Project Properties.
|
|
3
|
-
* To change this template file, choose Tools | Templates
|
|
4
|
-
* and open the template in the editor.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
1
|
import * as THREE from 'three';
|
|
8
2
|
function SphereHelper(radius) {
|
|
9
3
|
THREE.Mesh.call(this);
|
package/lib/Source/FileSource.js
CHANGED
|
@@ -103,12 +103,10 @@ class FileSource extends Source {
|
|
|
103
103
|
* presents in `features` under the property `crs`, it is fine.
|
|
104
104
|
*/
|
|
105
105
|
constructor(source) {
|
|
106
|
-
/* istanbul ignore next */
|
|
107
106
|
if (source.parsedData) {
|
|
108
107
|
console.warn('FileSource parsedData parameter is deprecated, use features instead of.');
|
|
109
108
|
source.features = source.features || source.parsedData;
|
|
110
109
|
}
|
|
111
|
-
/* istanbul ignore next */
|
|
112
110
|
if (source.projection) {
|
|
113
111
|
console.warn('FileSource projection parameter is deprecated, use crs instead.');
|
|
114
112
|
source.crs = source.crs || source.projection;
|
package/lib/Source/Source.js
CHANGED
|
@@ -30,7 +30,6 @@ const noCache = {
|
|
|
30
30
|
*/
|
|
31
31
|
class InformationsData {
|
|
32
32
|
constructor(options) {
|
|
33
|
-
/* istanbul ignore next */
|
|
34
33
|
if (options.projection) {
|
|
35
34
|
console.warn('Source projection parameter is deprecated, use crs instead.');
|
|
36
35
|
options.crs = options.crs || options.projection;
|
|
@@ -166,8 +165,6 @@ class Source extends InformationsData {
|
|
|
166
165
|
in: this,
|
|
167
166
|
extent
|
|
168
167
|
})).catch(err => this.handlingError(err)), key);
|
|
169
|
-
|
|
170
|
-
/* istanbul ignore next */
|
|
171
168
|
if (this.onParsedFile) {
|
|
172
169
|
features.then(feat => {
|
|
173
170
|
this.onParsedFile(feat);
|
|
@@ -162,8 +162,6 @@ class VectorTilesSource extends TMSSource {
|
|
|
162
162
|
in: this,
|
|
163
163
|
extent
|
|
164
164
|
})))).then(collections => mergeCollections(collections)).catch(err => this.handlingError(err)), key);
|
|
165
|
-
|
|
166
|
-
/* istanbul ignore next */
|
|
167
165
|
if (this.onParsedFile) {
|
|
168
166
|
features.then(feat => {
|
|
169
167
|
this.onParsedFile(feat);
|
package/lib/Source/WMSSource.js
CHANGED
|
@@ -1,8 +1,37 @@
|
|
|
1
1
|
import Source from "./Source.js";
|
|
2
2
|
import URLBuilder from "../Provider/URLBuilder.js";
|
|
3
3
|
import Extent from "../Core/Geographic/Extent.js";
|
|
4
|
+
import * as CRS from "../Core/Geographic/Crs.js";
|
|
4
5
|
const _extent = new Extent('EPSG:4326', [0, 0, 0, 0]);
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Proj provides an optional param to define axis order and orientation for a
|
|
9
|
+
* given projection. 'enu' for instance stands for east, north, up.
|
|
10
|
+
* Elevation is not needed here. The two first characters are sufficient to map
|
|
11
|
+
* proj axis to iTowns bbox order formalism.
|
|
12
|
+
* 'enu' corresponds to 'wsen' because bbox starts by lower value coordinates
|
|
13
|
+
* and preserves axis ordering, here long/lat.
|
|
14
|
+
*/
|
|
15
|
+
const projAxisToBboxMappings = {
|
|
16
|
+
en: 'wsen',
|
|
17
|
+
es: 'wnes',
|
|
18
|
+
wn: 'eswn',
|
|
19
|
+
ws: 'enws',
|
|
20
|
+
ne: 'swne',
|
|
21
|
+
se: 'nwse',
|
|
22
|
+
nw: 'senw',
|
|
23
|
+
sw: 'nesw'
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Provides the bbox axis order matching provided proj4 axis
|
|
28
|
+
* @param {string} projAxis the CRS axis order as defined in proj4
|
|
29
|
+
* @returns {string} the corresponding bbox axis order to use for WMS 1.3.0
|
|
30
|
+
*/
|
|
31
|
+
function projAxisToWmsBbox(projAxis) {
|
|
32
|
+
return projAxis && projAxisToBboxMappings[projAxis.slice(0, 2)] || 'wsen';
|
|
33
|
+
}
|
|
34
|
+
|
|
6
35
|
/**
|
|
7
36
|
* An object defining the source of images to get from a
|
|
8
37
|
* [WMS](http://www.opengeospatial.org/standards/wms) server. It inherits
|
|
@@ -97,16 +126,15 @@ class WMSSource extends Source {
|
|
|
97
126
|
this.version = source.version || '1.3.0';
|
|
98
127
|
this.transparent = source.transparent || false;
|
|
99
128
|
this.bboxDigits = source.bboxDigits;
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
129
|
+
if (source.axisOrder) {
|
|
130
|
+
this.axisOrder = source.axisOrder;
|
|
131
|
+
} else if (this.version === '1.3.0') {
|
|
132
|
+
// If not set, axis order depends on WMS version
|
|
133
|
+
// Version 1.3.0 depends on CRS axis order as defined in epsg.org database
|
|
134
|
+
this.axisOrder = projAxisToWmsBbox(CRS.axisOrder(this.crs));
|
|
135
|
+
} else {
|
|
136
|
+
// Versions 1.X.X mandate long/lat order, east-north orientation
|
|
137
|
+
this.axisOrder = 'wsen';
|
|
110
138
|
}
|
|
111
139
|
const crsPropName = this.version === '1.3.0' ? 'CRS' : 'SRS';
|
|
112
140
|
const urlObj = new URL(this.url);
|
|
@@ -55,7 +55,6 @@ function _updateVector3(layer, method, nodes, vecCRS, vec, offset) {
|
|
|
55
55
|
*
|
|
56
56
|
* @return {boolean} true if successful, false if we couldn't lookup the elevation at the given coords
|
|
57
57
|
*/
|
|
58
|
-
/* istanbul ignore next */
|
|
59
58
|
function placeObjectOnGround(layer, crs, obj) {
|
|
60
59
|
let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
61
60
|
let tileHint = arguments.length > 4 ? arguments[4] : undefined;
|