itowns 2.42.1-next.8 → 2.43.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 +90 -0
- package/dist/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/{.eslintrc.js → .eslintrc.cjs} +1 -1
- package/examples/effects_stereo.html +2 -2
- package/examples/misc_collada.html +2 -2
- package/examples/source_stream_wfs_25d.html +11 -11
- package/examples/source_stream_wfs_3d.html +1 -1
- package/examples/view_25d_map.html +2 -2
- package/examples/view_3d_map.html +2 -2
- package/examples/view_3d_map_webxr.html +1 -1
- package/examples/view_3d_mns_map.html +2 -2
- package/examples/view_immersive.html +1 -1
- package/examples/view_multi_25d.html +2 -2
- package/examples/widgets_searchbar.html +2 -2
- package/lib/Controls/FirstPersonControls.js +5 -12
- package/lib/Controls/FlyControls.js +4 -13
- package/lib/Controls/GlobeControls.js +33 -43
- package/lib/Controls/PlanarControls.js +9 -20
- package/lib/Controls/StateControl.js +2 -11
- package/lib/Controls/StreetControls.js +14 -24
- package/lib/Converter/Feature2Mesh.js +28 -38
- package/lib/Converter/Feature2Texture.js +15 -25
- package/lib/Converter/convertToTile.js +16 -26
- package/lib/Converter/textureConverter.js +9 -19
- package/lib/Core/3DTiles/C3DTBatchTable.js +5 -13
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +1 -8
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +17 -27
- package/lib/Core/3DTiles/C3DTExtensions.js +1 -8
- package/lib/Core/3DTiles/C3DTFeature.js +3 -10
- package/lib/Core/3DTiles/C3DTilesEnums.js +3 -11
- package/lib/Core/3DTiles/C3DTileset.js +7 -16
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +5 -11
- package/lib/Core/AnimationPlayer.js +2 -11
- package/lib/Core/Deprecated/Undeprecator.js +9 -20
- package/lib/Core/EntwinePointTileNode.js +6 -16
- package/lib/Core/Feature.js +16 -30
- package/lib/Core/Geographic/CoordStars.js +3 -12
- package/lib/Core/Geographic/Coordinates.js +12 -22
- package/lib/Core/Geographic/Crs.js +7 -15
- package/lib/Core/Geographic/Extent.js +36 -47
- package/lib/Core/Geographic/GeoidGrid.js +6 -16
- package/lib/Core/Label.js +7 -17
- package/lib/Core/MainLoop.js +7 -16
- package/lib/Core/Math/Ellipsoid.js +6 -17
- package/lib/Core/Picking.js +10 -20
- package/lib/Core/PointCloudNode.js +2 -11
- package/lib/Core/PotreeNode.js +4 -13
- package/lib/Core/Prefab/Globe/Atmosphere.js +17 -26
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +6 -16
- package/lib/Core/Prefab/Globe/GlobeLayer.js +19 -28
- package/lib/Core/Prefab/Globe/SkyShader.js +2 -11
- package/lib/Core/Prefab/GlobeView.js +27 -45
- package/lib/Core/Prefab/Planar/PlanarLayer.js +11 -20
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +6 -16
- package/lib/Core/Prefab/PlanarView.js +10 -25
- package/lib/Core/Prefab/TileBuilder.js +13 -22
- package/lib/Core/Prefab/computeBufferTileGeometry.js +12 -16
- package/lib/Core/Scheduler/Cache.js +2 -10
- package/lib/Core/Scheduler/CancelledCommandException.js +1 -8
- package/lib/Core/Scheduler/Scheduler.js +15 -23
- package/lib/Core/Style.js +24 -38
- package/lib/Core/System/Capabilities.js +2 -13
- package/lib/Core/TileGeometry.js +13 -15
- package/lib/Core/TileMesh.js +6 -15
- package/lib/Core/View.js +43 -58
- package/lib/Layer/C3DTilesLayer.js +29 -41
- package/lib/Layer/ColorLayer.js +10 -16
- package/lib/Layer/ElevationLayer.js +7 -14
- package/lib/Layer/EntwinePointTileLayer.js +9 -18
- package/lib/Layer/FeatureGeometryLayer.js +9 -16
- package/lib/Layer/GeoidLayer.js +6 -15
- package/lib/Layer/GeometryLayer.js +11 -17
- package/lib/Layer/InfoLayer.js +5 -14
- package/lib/Layer/LabelLayer.js +22 -32
- package/lib/Layer/Layer.js +16 -26
- package/lib/Layer/LayerUpdateState.js +1 -8
- package/lib/Layer/LayerUpdateStrategy.js +7 -18
- package/lib/Layer/OrientedImageLayer.js +15 -25
- package/lib/Layer/PointCloudLayer.js +9 -19
- package/lib/Layer/PotreeLayer.js +8 -18
- package/lib/Layer/RasterLayer.js +9 -17
- package/lib/Layer/ReferencingLayerProperties.js +1 -8
- package/lib/Layer/TiledGeometryLayer.js +37 -33
- package/lib/Main.js +87 -708
- package/lib/MainBundle.js +4 -34
- package/lib/Parser/B3dmParser.js +80 -131
- package/lib/Parser/CameraCalibrationParser.js +5 -14
- package/lib/Parser/GDFParser.js +11 -22
- package/lib/Parser/GLTFParser.js +88 -0
- package/lib/Parser/GTXParser.js +9 -21
- package/lib/Parser/GeoJsonParser.js +14 -22
- package/lib/Parser/GpxParser.js +7 -14
- package/lib/Parser/ISGParser.js +19 -28
- package/lib/Parser/KMLParser.js +7 -14
- package/lib/Parser/LASLoader.js +20 -21
- package/lib/Parser/LASParser.js +6 -15
- package/lib/Parser/MapBoxUrlParser.js +2 -9
- package/lib/Parser/PntsParser.js +4 -14
- package/lib/Parser/PotreeBinParser.js +8 -16
- package/lib/Parser/PotreeCinParser.js +3 -12
- package/lib/Parser/ShapefileParser.js +11 -18
- package/lib/Parser/VectorTileParser.js +23 -31
- package/lib/Parser/XbilParser.js +5 -13
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +2 -12
- package/lib/Process/3dTilesProcessing.js +14 -27
- package/lib/Process/FeatureProcessing.js +14 -22
- package/lib/Process/LayeredMaterialNodeProcessing.js +14 -26
- package/lib/Process/ObjectRemovalHelper.js +2 -9
- package/lib/Process/handlerNodeError.js +1 -7
- package/lib/Provider/3dTilesProvider.js +32 -29
- package/lib/Provider/DataSourceProvider.js +2 -9
- package/lib/Provider/Fetcher.js +40 -22
- package/lib/Provider/PointCloudProvider.js +7 -19
- package/lib/Provider/TileProvider.js +4 -12
- package/lib/Provider/URLBuilder.js +4 -12
- package/lib/Renderer/Camera.js +7 -17
- package/lib/Renderer/Color.js +3 -11
- package/lib/Renderer/ColorLayersOrdering.js +14 -22
- package/lib/Renderer/CommonMaterial.js +3 -12
- package/lib/Renderer/Label2DRenderer.js +5 -16
- package/lib/Renderer/LayeredMaterial.js +33 -53
- package/lib/Renderer/OBB.js +12 -21
- package/lib/Renderer/OrientedImageCamera.js +2 -11
- package/lib/Renderer/OrientedImageMaterial.js +17 -35
- package/lib/Renderer/PointsMaterial.js +37 -60
- package/lib/Renderer/RasterTile.js +16 -29
- package/lib/Renderer/RenderMode.js +2 -9
- package/lib/Renderer/Shader/ShaderChunk.js +5 -23
- package/lib/Renderer/Shader/ShaderUtils.js +2 -9
- package/lib/Renderer/SphereHelper.js +2 -11
- package/lib/Renderer/WebXR.js +2 -11
- package/lib/Renderer/c3DEngine.js +20 -53
- package/lib/Source/C3DTilesGoogleSource.js +76 -0
- package/lib/Source/C3DTilesIonSource.js +6 -13
- package/lib/Source/C3DTilesSource.js +5 -12
- package/lib/Source/EntwinePointTileSource.js +12 -19
- package/lib/Source/FileSource.js +7 -14
- package/lib/Source/OrientedImageSource.js +6 -14
- package/lib/Source/PotreeSource.js +9 -16
- package/lib/Source/Source.js +26 -39
- package/lib/Source/TMSSource.js +11 -22
- package/lib/Source/VectorTilesSource.js +75 -34
- package/lib/Source/WFSSource.js +7 -14
- package/lib/Source/WMSSource.js +5 -12
- package/lib/Source/WMTSSource.js +3 -10
- package/lib/ThreeExtended/capabilities/WebGL.js +1 -8
- package/lib/ThreeExtended/libs/ktx-parse.module.js +2 -256
- package/lib/ThreeExtended/libs/zstddec.module.js +2 -8
- package/lib/ThreeExtended/loaders/DDSLoader.js +10 -16
- package/lib/ThreeExtended/loaders/DRACOLoader.js +14 -19
- package/lib/ThreeExtended/loaders/GLTFLoader.js +124 -129
- package/lib/ThreeExtended/loaders/KTX2Loader.js +73 -78
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +40 -59
- package/lib/ThreeExtended/utils/WorkerPool.js +2 -9
- package/lib/Utils/CameraUtils.js +32 -44
- package/lib/Utils/DEMUtils.js +8 -19
- package/lib/Utils/FeaturesUtils.js +8 -16
- package/lib/Utils/Gradients.js +3 -12
- package/lib/Utils/OrientationUtils.js +8 -18
- package/lib/Utils/ThreeUtils.js +2 -9
- package/lib/Utils/gui/C3DTilesStyle.js +7 -15
- package/lib/Utils/gui/Main.js +7 -48
- package/lib/Utils/gui/Minimap.js +12 -20
- package/lib/Utils/gui/Navigation.js +6 -14
- package/lib/Utils/gui/Scale.js +11 -19
- package/lib/Utils/gui/Searchbar.js +5 -13
- package/lib/Utils/gui/Widget.js +1 -8
- package/lib/Utils/placeObjectOnGround.js +13 -23
- package/package.json +13 -8
package/lib/Core/Feature.js
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.FeatureGeometry = exports.FeatureCollection = exports.FeatureBuildingOptions = exports.FEATURE_TYPES = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _Extent = _interopRequireDefault(require("./Geographic/Extent"));
|
|
10
|
-
var _Coordinates = _interopRequireDefault(require("./Geographic/Coordinates"));
|
|
11
|
-
var _Crs = _interopRequireDefault(require("./Geographic/Crs"));
|
|
12
|
-
var _Style = _interopRequireDefault(require("./Style"));
|
|
13
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import Extent from "./Geographic/Extent.js";
|
|
3
|
+
import Coordinates from "./Geographic/Coordinates.js";
|
|
4
|
+
import CRS from "./Geographic/Crs.js";
|
|
5
|
+
import Style from "./Style.js";
|
|
15
6
|
function defaultExtent(crs) {
|
|
16
|
-
return new
|
|
7
|
+
return new Extent(crs, Infinity, -Infinity, Infinity, -Infinity);
|
|
17
8
|
}
|
|
18
9
|
function _extendBuffer(feature, size) {
|
|
19
10
|
feature.vertices.length += size * feature.size;
|
|
@@ -27,8 +18,8 @@ function _setGeometryValues(feature, coord) {
|
|
|
27
18
|
}
|
|
28
19
|
feature._pushValues(coord.x, coord.y, coord.z);
|
|
29
20
|
}
|
|
30
|
-
const coordOut = new
|
|
31
|
-
const FEATURE_TYPES = {
|
|
21
|
+
const coordOut = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
22
|
+
export const FEATURE_TYPES = {
|
|
32
23
|
POINT: 0,
|
|
33
24
|
LINE: 1,
|
|
34
25
|
POLYGON: 2
|
|
@@ -52,8 +43,7 @@ const FEATURE_TYPES = {
|
|
|
52
43
|
* style for all new features.
|
|
53
44
|
*
|
|
54
45
|
*/
|
|
55
|
-
|
|
56
|
-
class FeatureBuildingOptions {}
|
|
46
|
+
export class FeatureBuildingOptions {}
|
|
57
47
|
|
|
58
48
|
/**
|
|
59
49
|
* @property {Extent} extent - The 2D extent containing all the points
|
|
@@ -65,8 +55,7 @@ class FeatureBuildingOptions {}
|
|
|
65
55
|
* @property {Object} properties - Properties of the geometry. It can be
|
|
66
56
|
* anything specified in the GeoJSON under the `properties` property.
|
|
67
57
|
*/
|
|
68
|
-
|
|
69
|
-
class FeatureGeometry {
|
|
58
|
+
export class FeatureGeometry {
|
|
70
59
|
#currentExtent;
|
|
71
60
|
/**
|
|
72
61
|
* @param {Feature} feature geometry
|
|
@@ -188,7 +177,6 @@ class FeatureGeometry {
|
|
|
188
177
|
}
|
|
189
178
|
}
|
|
190
179
|
}
|
|
191
|
-
exports.FeatureGeometry = FeatureGeometry;
|
|
192
180
|
function push2DValues(value0, value1) {
|
|
193
181
|
this.vertices[this._pos++] = value0;
|
|
194
182
|
this.vertices[this._pos++] = value1;
|
|
@@ -260,7 +248,7 @@ class Feature {
|
|
|
260
248
|
}
|
|
261
249
|
this._pos = 0;
|
|
262
250
|
this._pushValues = (this.size === 3 ? push3DValues : push2DValues).bind(this);
|
|
263
|
-
this.style =
|
|
251
|
+
this.style = Style.setFromProperties;
|
|
264
252
|
}
|
|
265
253
|
/**
|
|
266
254
|
* Instance a new {@link FeatureGeometry} and push in {@link Feature}.
|
|
@@ -288,8 +276,7 @@ class Feature {
|
|
|
288
276
|
return this.geometries.length;
|
|
289
277
|
}
|
|
290
278
|
}
|
|
291
|
-
|
|
292
|
-
exports.default = _default;
|
|
279
|
+
export default Feature;
|
|
293
280
|
const doNothing = () => {};
|
|
294
281
|
const transformToLocalSystem3D = (coord, collection) => {
|
|
295
282
|
coord.geodesicNormal.applyNormalMatrix(collection.normalMatrixInverse);
|
|
@@ -344,7 +331,7 @@ const alignYtoEast = new THREE.Quaternion();
|
|
|
344
331
|
*
|
|
345
332
|
*/
|
|
346
333
|
|
|
347
|
-
class FeatureCollection extends THREE.Object3D {
|
|
334
|
+
export class FeatureCollection extends THREE.Object3D {
|
|
348
335
|
#transformToLocalSystem = transformToLocalSystem2D;
|
|
349
336
|
#setLocalSystem = doNothing;
|
|
350
337
|
/**
|
|
@@ -354,7 +341,7 @@ class FeatureCollection extends THREE.Object3D {
|
|
|
354
341
|
var _options$source;
|
|
355
342
|
super();
|
|
356
343
|
this.isFeatureCollection = true;
|
|
357
|
-
this.crs =
|
|
344
|
+
this.crs = CRS.formatToEPSG(options.accurate || !((_options$source = options.source) !== null && _options$source !== void 0 && _options$source.crs) ? options.crs : options.source.crs);
|
|
358
345
|
this.features = [];
|
|
359
346
|
this.mergeFeatures = options.mergeFeatures === undefined ? true : options.mergeFeatures;
|
|
360
347
|
this.size = options.structure == '3d' ? 3 : 2;
|
|
@@ -362,7 +349,7 @@ class FeatureCollection extends THREE.Object3D {
|
|
|
362
349
|
this.style = options.style;
|
|
363
350
|
this.isInverted = false;
|
|
364
351
|
this.matrixWorldInverse = new THREE.Matrix4();
|
|
365
|
-
this.center = new
|
|
352
|
+
this.center = new Coordinates('EPSG:4326', 0, 0);
|
|
366
353
|
if (this.size == 2) {
|
|
367
354
|
this.extent = options.buildExtent === false ? undefined : defaultExtent(options.forcedExtentCrs || this.crs);
|
|
368
355
|
this.#setLocalSystem = center => {
|
|
@@ -501,5 +488,4 @@ class FeatureCollection extends THREE.Object3D {
|
|
|
501
488
|
this.features.push(ref);
|
|
502
489
|
return ref;
|
|
503
490
|
}
|
|
504
|
-
}
|
|
505
|
-
exports.FeatureCollection = FeatureCollection;
|
|
491
|
+
}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Coordinates = _interopRequireDefault(require("./Coordinates"));
|
|
9
1
|
/**
|
|
10
2
|
* Generated On: 2016-02-25
|
|
11
3
|
* Class: CoordStars
|
|
12
4
|
* Description: get coord of stars like earth...
|
|
13
5
|
*/
|
|
14
|
-
|
|
6
|
+
import Coordinates from "./Coordinates.js";
|
|
15
7
|
const CoordStars = {
|
|
16
8
|
getSunPosition() {
|
|
17
9
|
const m = Math;
|
|
@@ -82,9 +74,8 @@ const CoordStars = {
|
|
|
82
74
|
const sun = CoordStars.getSunPosition()(date, lat, lon);
|
|
83
75
|
const dayMilliSec = 24 * 3600000;
|
|
84
76
|
const longitude = sun.ascension + date % dayMilliSec / dayMilliSec * -360 + 180; // cause midday
|
|
85
|
-
const coSunCarto = new
|
|
77
|
+
const coSunCarto = new Coordinates('EPSG:4326', longitude, lat, 50000000).as('EPSG:4978').toVector3();
|
|
86
78
|
return coSunCarto;
|
|
87
79
|
}
|
|
88
80
|
};
|
|
89
|
-
|
|
90
|
-
exports.default = _default;
|
|
81
|
+
export default CoordStars;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _proj = _interopRequireDefault(require("proj4"));
|
|
10
|
-
var _Crs = _interopRequireDefault(require("./Crs"));
|
|
11
|
-
var _Ellipsoid = _interopRequireDefault(require("../Math/Ellipsoid"));
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
_proj.default.defs('EPSG:4978', '+proj=geocent +datum=WGS84 +units=m +no_defs');
|
|
15
|
-
const ellipsoid = new _Ellipsoid.default();
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import proj4 from 'proj4';
|
|
3
|
+
import CRS from "./Crs.js";
|
|
4
|
+
import Ellipsoid from "../Math/Ellipsoid.js";
|
|
5
|
+
proj4.defs('EPSG:4978', '+proj=geocent +datum=WGS84 +units=m +no_defs');
|
|
6
|
+
const ellipsoid = new Ellipsoid();
|
|
16
7
|
const projectionCache = {};
|
|
17
8
|
const v0 = new THREE.Vector3();
|
|
18
9
|
const v1 = new THREE.Vector3();
|
|
@@ -23,7 +14,7 @@ function proj4cache(crsIn, crsOut) {
|
|
|
23
14
|
projectionCache[crsIn] = {};
|
|
24
15
|
}
|
|
25
16
|
if (!projectionCache[crsIn][crsOut]) {
|
|
26
|
-
projectionCache[crsIn][crsOut] = (
|
|
17
|
+
projectionCache[crsIn][crsOut] = proj4(crsIn, crsOut);
|
|
27
18
|
}
|
|
28
19
|
return projectionCache[crsIn][crsOut];
|
|
29
20
|
}
|
|
@@ -77,7 +68,7 @@ class Coordinates {
|
|
|
77
68
|
let v1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
78
69
|
let v2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
79
70
|
this.isCoordinates = true;
|
|
80
|
-
|
|
71
|
+
CRS.isValid(crs);
|
|
81
72
|
this.crs = crs;
|
|
82
73
|
|
|
83
74
|
// Storing the coordinates as is, not in arrays, as it is
|
|
@@ -103,7 +94,7 @@ class Coordinates {
|
|
|
103
94
|
* @param {String} crs Coordinate Reference System (e.g. 'EPSG:4978')
|
|
104
95
|
*/
|
|
105
96
|
setCrs(crs) {
|
|
106
|
-
|
|
97
|
+
CRS.isValid(crs);
|
|
107
98
|
this.crs = crs;
|
|
108
99
|
}
|
|
109
100
|
|
|
@@ -191,7 +182,7 @@ class Coordinates {
|
|
|
191
182
|
get geodesicNormal() {
|
|
192
183
|
if (this._normalNeedsUpdate) {
|
|
193
184
|
this._normalNeedsUpdate = false;
|
|
194
|
-
if (
|
|
185
|
+
if (CRS.is4326(this.crs)) {
|
|
195
186
|
ellipsoid.geodeticSurfaceNormalCartographic(this, this._normal);
|
|
196
187
|
} else if (this.crs == 'EPSG:4978') {
|
|
197
188
|
ellipsoid.geodeticSurfaceNormal(this, this._normal);
|
|
@@ -315,7 +306,7 @@ class Coordinates {
|
|
|
315
306
|
if (this.crs == crs) {
|
|
316
307
|
target.copy(this);
|
|
317
308
|
} else {
|
|
318
|
-
if (
|
|
309
|
+
if (CRS.is4326(this.crs) && crs == 'EPSG:3857') {
|
|
319
310
|
this.y = THREE.MathUtils.clamp(this.y, -89.999999, 89.999999);
|
|
320
311
|
}
|
|
321
312
|
target.setFromArray(proj4cache(this.crs, crs).forward([this.x, this.y, this.z]));
|
|
@@ -326,5 +317,4 @@ class Coordinates {
|
|
|
326
317
|
}
|
|
327
318
|
coord0 = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
328
319
|
coord1 = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
329
|
-
|
|
330
|
-
exports.default = _default;
|
|
320
|
+
export default Coordinates;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _proj = _interopRequireDefault(require("proj4"));
|
|
9
|
-
_proj.default.defs('EPSG:4978', '+proj=geocent +datum=WGS84 +units=m +no_defs');
|
|
1
|
+
import proj4 from 'proj4';
|
|
2
|
+
proj4.defs('EPSG:4978', '+proj=geocent +datum=WGS84 +units=m +no_defs');
|
|
10
3
|
function isString(s) {
|
|
11
4
|
return typeof s === 'string' || s instanceof String;
|
|
12
5
|
}
|
|
@@ -38,7 +31,7 @@ function is4326(crs) {
|
|
|
38
31
|
}
|
|
39
32
|
function isGeocentric(crs) {
|
|
40
33
|
mustBeString(crs);
|
|
41
|
-
const projection =
|
|
34
|
+
const projection = proj4.defs(crs);
|
|
42
35
|
return !projection ? false : projection.projName == 'geocent';
|
|
43
36
|
}
|
|
44
37
|
function _unitFromProj4Unit(projunit) {
|
|
@@ -59,7 +52,7 @@ function toUnit(crs) {
|
|
|
59
52
|
return UNIT.METER;
|
|
60
53
|
default:
|
|
61
54
|
{
|
|
62
|
-
const p =
|
|
55
|
+
const p = proj4.defs(formatToEPSG(crs));
|
|
63
56
|
if (!p) {
|
|
64
57
|
return undefined;
|
|
65
58
|
}
|
|
@@ -81,7 +74,7 @@ function toUnitWithError(crs) {
|
|
|
81
74
|
*
|
|
82
75
|
* @module CRS
|
|
83
76
|
*/
|
|
84
|
-
|
|
77
|
+
export default {
|
|
85
78
|
/**
|
|
86
79
|
* Units that can be used for a CRS.
|
|
87
80
|
*
|
|
@@ -178,6 +171,5 @@ var _default = {
|
|
|
178
171
|
* @param {string} proj4def is the Proj4 definition string for the projection to use
|
|
179
172
|
* @return {undefined}
|
|
180
173
|
*/
|
|
181
|
-
defs: (code, proj4def) =>
|
|
182
|
-
};
|
|
183
|
-
exports.default = _default;
|
|
174
|
+
defs: (code, proj4def) => proj4.defs(code, proj4def)
|
|
175
|
+
};
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.schemeTiles = exports.globalExtentTMS = exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _Coordinates = _interopRequireDefault(require("./Coordinates"));
|
|
10
|
-
var _Crs = _interopRequireDefault(require("./Crs"));
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import Coordinates from "./Coordinates.js";
|
|
3
|
+
import CRS from "./Crs.js";
|
|
4
|
+
|
|
13
5
|
/**
|
|
14
6
|
* Extent is a SIG-area (so 2D)
|
|
15
7
|
* It can use explicit coordinates (e.g: lon/lat) or implicit (WMTS coordinates)
|
|
@@ -27,9 +19,9 @@ const r = {
|
|
|
27
19
|
col: 0,
|
|
28
20
|
invDiff: 0
|
|
29
21
|
};
|
|
30
|
-
const cNorthWest = new
|
|
31
|
-
const cSouthWest = new
|
|
32
|
-
const cNorthEast = new
|
|
22
|
+
const cNorthWest = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
23
|
+
const cSouthWest = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
24
|
+
const cNorthEast = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
33
25
|
const southWest = new THREE.Vector3();
|
|
34
26
|
const northEast = new THREE.Vector3();
|
|
35
27
|
function _rowColfromParent(extent, zoom) {
|
|
@@ -44,18 +36,16 @@ let _extent;
|
|
|
44
36
|
let _extent2;
|
|
45
37
|
const cardinals = new Array(8);
|
|
46
38
|
for (let i = cardinals.length - 1; i >= 0; i--) {
|
|
47
|
-
cardinals[i] = new
|
|
39
|
+
cardinals[i] = new Coordinates('EPSG:4326', 0, 0, 0, 0);
|
|
48
40
|
}
|
|
49
|
-
const _c = new
|
|
50
|
-
const globalExtentTMS = new Map();
|
|
51
|
-
|
|
52
|
-
const schemeTiles = new Map();
|
|
53
|
-
exports.schemeTiles = schemeTiles;
|
|
41
|
+
const _c = new Coordinates('EPSG:4326', 0, 0);
|
|
42
|
+
export const globalExtentTMS = new Map();
|
|
43
|
+
export const schemeTiles = new Map();
|
|
54
44
|
function getInfoTms(crs) {
|
|
55
|
-
const epsg =
|
|
45
|
+
const epsg = CRS.formatToEPSG(crs);
|
|
56
46
|
const globalExtent = globalExtentTMS.get(epsg);
|
|
57
47
|
const globalDimension = globalExtent.planarDimensions(_dim2);
|
|
58
|
-
const tms =
|
|
48
|
+
const tms = CRS.formatToTms(crs);
|
|
59
49
|
const sTs = schemeTiles.get(tms) || schemeTiles.get('default');
|
|
60
50
|
// The isInverted parameter is to be set to the correct value, true or false
|
|
61
51
|
// (default being false) if the computation of the coordinates needs to be
|
|
@@ -73,7 +63,7 @@ function getInfoTms(crs) {
|
|
|
73
63
|
};
|
|
74
64
|
}
|
|
75
65
|
function getCountTiles(crs, zoom) {
|
|
76
|
-
const sTs = schemeTiles.get(
|
|
66
|
+
const sTs = schemeTiles.get(CRS.formatToTms(crs)) || schemeTiles.get('default');
|
|
77
67
|
const count = 2 ** zoom;
|
|
78
68
|
_countTiles.set(count, count).multiply(sTs);
|
|
79
69
|
return _countTiles;
|
|
@@ -95,14 +85,14 @@ class Extent {
|
|
|
95
85
|
* @param {number} [v3] north value
|
|
96
86
|
*/
|
|
97
87
|
constructor(crs, v0, v1, v2, v3) {
|
|
98
|
-
if (
|
|
88
|
+
if (CRS.isGeocentric(crs)) {
|
|
99
89
|
throw new Error(`${crs} is a geocentric projection, it doesn't make sense with a geographical extent`);
|
|
100
90
|
}
|
|
101
91
|
this.isExtent = true;
|
|
102
92
|
this.crs = crs;
|
|
103
93
|
// Scale/zoom
|
|
104
94
|
this.zoom = 0;
|
|
105
|
-
if (
|
|
95
|
+
if (CRS.isTms(this.crs)) {
|
|
106
96
|
this.row = 0;
|
|
107
97
|
this.col = 0;
|
|
108
98
|
} else {
|
|
@@ -119,7 +109,7 @@ class Extent {
|
|
|
119
109
|
* @return {Extent} cloned extent
|
|
120
110
|
*/
|
|
121
111
|
clone() {
|
|
122
|
-
if (
|
|
112
|
+
if (CRS.isTms(this.crs)) {
|
|
123
113
|
return new Extent(this.crs, this.zoom, this.row, this.col);
|
|
124
114
|
} else {
|
|
125
115
|
return new Extent(this.crs, this.west, this.east, this.south, this.north);
|
|
@@ -133,14 +123,14 @@ class Extent {
|
|
|
133
123
|
* @return {Array<Extent>} array of extents covering
|
|
134
124
|
*/
|
|
135
125
|
tiledCovering(crs) {
|
|
136
|
-
if (this.crs == 'EPSG:4326' && crs ==
|
|
126
|
+
if (this.crs == 'EPSG:4326' && crs == CRS.tms_3857) {
|
|
137
127
|
const extents_WMTS_PM = [];
|
|
138
|
-
const extent = _extent.copy(this).as(
|
|
128
|
+
const extent = _extent.copy(this).as(CRS.formatToEPSG(crs), _extent2);
|
|
139
129
|
const {
|
|
140
130
|
globalExtent,
|
|
141
131
|
globalDimension,
|
|
142
132
|
sTs
|
|
143
|
-
} = getInfoTms(
|
|
133
|
+
} = getInfoTms(CRS.formatToEPSG(crs));
|
|
144
134
|
extent.clampByExtent(globalExtent);
|
|
145
135
|
extent.planarDimensions(dimensionTile);
|
|
146
136
|
const zoom = this.zoom + 1 || Math.floor(Math.log2(Math.round(globalDimension.x / (dimensionTile.x * sTs.x))));
|
|
@@ -188,9 +178,9 @@ class Extent {
|
|
|
188
178
|
* @return {Extent}
|
|
189
179
|
*/
|
|
190
180
|
as(crs, target) {
|
|
191
|
-
|
|
181
|
+
CRS.isValid(crs);
|
|
192
182
|
target = target || new Extent('EPSG:4326', [0, 0, 0, 0]);
|
|
193
|
-
if (
|
|
183
|
+
if (CRS.isTms(this.crs)) {
|
|
194
184
|
const {
|
|
195
185
|
epsg,
|
|
196
186
|
globalExtent,
|
|
@@ -205,7 +195,7 @@ class Extent {
|
|
|
205
195
|
target.crs = epsg;
|
|
206
196
|
target.zoom = this.zoom;
|
|
207
197
|
return crs == epsg ? target : target.as(crs, target);
|
|
208
|
-
} else if (
|
|
198
|
+
} else if (CRS.isEpsg(crs)) {
|
|
209
199
|
if (this.crs != crs) {
|
|
210
200
|
// Compute min/max in x/y by projecting 8 cardinal points,
|
|
211
201
|
// and then taking the min/max of each coordinates.
|
|
@@ -247,8 +237,8 @@ class Extent {
|
|
|
247
237
|
* @return {Coordinates}
|
|
248
238
|
*/
|
|
249
239
|
center() {
|
|
250
|
-
let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new
|
|
251
|
-
if (
|
|
240
|
+
let target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Coordinates(this.crs);
|
|
241
|
+
if (CRS.isTms(this.crs)) {
|
|
252
242
|
throw new Error('Invalid operation for WMTS bbox');
|
|
253
243
|
}
|
|
254
244
|
this.planarDimensions(_dim);
|
|
@@ -359,7 +349,7 @@ class Extent {
|
|
|
359
349
|
* @return {boolean}
|
|
360
350
|
*/
|
|
361
351
|
isInside(extent, epsilon) {
|
|
362
|
-
if (
|
|
352
|
+
if (CRS.isTms(this.crs)) {
|
|
363
353
|
if (this.zoom == extent.zoom) {
|
|
364
354
|
return this.row == extent.row && this.col == extent.col;
|
|
365
355
|
} else if (this.zoom < extent.zoom) {
|
|
@@ -370,7 +360,7 @@ class Extent {
|
|
|
370
360
|
}
|
|
371
361
|
} else {
|
|
372
362
|
extent.as(this.crs, _extent);
|
|
373
|
-
epsilon = epsilon == undefined ?
|
|
363
|
+
epsilon = epsilon == undefined ? CRS.reasonnableEpsilon(this.crs) : epsilon;
|
|
374
364
|
return this.east - _extent.east <= epsilon && _extent.west - this.west <= epsilon && this.north - _extent.north <= epsilon && _extent.south - this.south <= epsilon;
|
|
375
365
|
}
|
|
376
366
|
}
|
|
@@ -387,7 +377,7 @@ class Extent {
|
|
|
387
377
|
if (this.crs != extent.crs) {
|
|
388
378
|
throw new Error('unsupported mix');
|
|
389
379
|
}
|
|
390
|
-
if (
|
|
380
|
+
if (CRS.isTms(this.crs)) {
|
|
391
381
|
_rowColfromParent(this, extent.zoom);
|
|
392
382
|
return target.set(this.col * r.invDiff - r.col, this.row * r.invDiff - r.row, r.invDiff, r.invDiff);
|
|
393
383
|
}
|
|
@@ -464,7 +454,7 @@ class Extent {
|
|
|
464
454
|
throw new Error('No values to set in the extent');
|
|
465
455
|
}
|
|
466
456
|
if (v0.isExtent) {
|
|
467
|
-
if (
|
|
457
|
+
if (CRS.isTms(v0.crs)) {
|
|
468
458
|
v1 = v0.row;
|
|
469
459
|
v2 = v0.col;
|
|
470
460
|
v0 = v0.zoom;
|
|
@@ -475,7 +465,7 @@ class Extent {
|
|
|
475
465
|
v0 = v0.west;
|
|
476
466
|
}
|
|
477
467
|
}
|
|
478
|
-
if (
|
|
468
|
+
if (CRS.isTms(this.crs)) {
|
|
479
469
|
this.zoom = v0;
|
|
480
470
|
this.row = v1;
|
|
481
471
|
this.col = v2;
|
|
@@ -588,7 +578,7 @@ class Extent {
|
|
|
588
578
|
* @return {Extent}
|
|
589
579
|
*/
|
|
590
580
|
static fromBox3(crs, box) {
|
|
591
|
-
if (
|
|
581
|
+
if (CRS.isGeocentric(crs)) {
|
|
592
582
|
// if geocentric reproject box on 'EPSG:4326'
|
|
593
583
|
crs = 'EPSG:4326';
|
|
594
584
|
box = _box.copy(box);
|
|
@@ -612,7 +602,7 @@ class Extent {
|
|
|
612
602
|
*/
|
|
613
603
|
toString() {
|
|
614
604
|
let separator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
615
|
-
if (
|
|
605
|
+
if (CRS.isTms(this.crs)) {
|
|
616
606
|
return `${this.zoom}${separator}${this.row}${separator}${this.col}`;
|
|
617
607
|
} else {
|
|
618
608
|
return `${this.east}${separator}${this.north}${separator}${this.west}${separator}${this.south}`;
|
|
@@ -656,7 +646,7 @@ class Extent {
|
|
|
656
646
|
* @return {Extent} return this extent instance.
|
|
657
647
|
*/
|
|
658
648
|
applyMatrix4(matrix) {
|
|
659
|
-
if (!
|
|
649
|
+
if (!CRS.isTms(this.crs)) {
|
|
660
650
|
southWest.set(this.west, this.south, 0).applyMatrix4(matrix);
|
|
661
651
|
northEast.set(this.east, this.north, 0).applyMatrix4(matrix);
|
|
662
652
|
this.west = southWest.x;
|
|
@@ -728,7 +718,6 @@ const extent3857 = globalExtentTMS.get('EPSG:4326').as('EPSG:3857');
|
|
|
728
718
|
extent3857.clampSouthNorth(extent3857.west, extent3857.east);
|
|
729
719
|
globalExtentTMS.set('EPSG:3857', extent3857);
|
|
730
720
|
schemeTiles.set('default', new THREE.Vector2(1, 1));
|
|
731
|
-
schemeTiles.set(
|
|
732
|
-
schemeTiles.set(
|
|
733
|
-
|
|
734
|
-
exports.default = _default;
|
|
721
|
+
schemeTiles.set(CRS.tms_3857, schemeTiles.get('default'));
|
|
722
|
+
schemeTiles.set(CRS.tms_4326, new THREE.Vector2(2, 1));
|
|
723
|
+
export default Extent;
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _Coordinates = _interopRequireDefault(require("./Coordinates"));
|
|
10
|
-
var _Crs = _interopRequireDefault(require("./Crs"));
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
const coord = new _Coordinates.default('EPSG:4326');
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import Coordinates from "./Coordinates.js";
|
|
3
|
+
import CRS from "./Crs.js";
|
|
4
|
+
const coord = new Coordinates('EPSG:4326');
|
|
14
5
|
const indexes = new THREE.Vector2();
|
|
15
6
|
function biLinearInterpolation(indexes, getData) {
|
|
16
7
|
const j = Math.floor(indexes.x);
|
|
@@ -87,7 +78,7 @@ class GeoidGrid {
|
|
|
87
78
|
* the NORTH-EAST corner of your data extent.
|
|
88
79
|
*/
|
|
89
80
|
constructor(extent, step, getData) {
|
|
90
|
-
|
|
81
|
+
CRS.isGeographic(extent.crs);
|
|
91
82
|
this.extent = extent;
|
|
92
83
|
this.step = new THREE.Vector2(step.x, step.y || step.x);
|
|
93
84
|
this.dimensions = this.extent.planarDimensions();
|
|
@@ -115,5 +106,4 @@ class GeoidGrid {
|
|
|
115
106
|
return biLinearInterpolation(indexes, this.getData);
|
|
116
107
|
}
|
|
117
108
|
}
|
|
118
|
-
|
|
119
|
-
exports.default = _default;
|
|
109
|
+
export default GeoidGrid;
|
package/lib/Core/Label.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _DEMUtils = _interopRequireDefault(require("../Utils/DEMUtils"));
|
|
10
|
-
var _Coordinates = _interopRequireDefault(require("./Geographic/Coordinates"));
|
|
11
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
-
const coord = new _Coordinates.default('EPSG:4326');
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import DEMUtils from "../Utils/DEMUtils.js";
|
|
3
|
+
import Coordinates from "./Geographic/Coordinates.js";
|
|
4
|
+
const coord = new Coordinates('EPSG:4326');
|
|
14
5
|
let rect;
|
|
15
6
|
|
|
16
7
|
// set it once
|
|
@@ -215,9 +206,9 @@ class Label extends THREE.Object3D {
|
|
|
215
206
|
if (layer.attachedLayers.filter(l => l.isElevationLayer).length == 0) {
|
|
216
207
|
return;
|
|
217
208
|
}
|
|
218
|
-
let elevation = Math.max(0,
|
|
209
|
+
let elevation = Math.max(0, DEMUtils.getElevationValueAt(layer, this.coordinates, DEMUtils.FAST_READ_Z, nodes));
|
|
219
210
|
if (isNaN(elevation)) {
|
|
220
|
-
elevation = Math.max(0,
|
|
211
|
+
elevation = Math.max(0, DEMUtils.getElevationValueAt(layer, this.coordinates, DEMUtils.FAST_READ_Z));
|
|
221
212
|
}
|
|
222
213
|
if (!isNaN(elevation) && elevation != this.coordinates.z) {
|
|
223
214
|
this.coordinates.z = elevation;
|
|
@@ -229,5 +220,4 @@ class Label extends THREE.Object3D {
|
|
|
229
220
|
}
|
|
230
221
|
}
|
|
231
222
|
}
|
|
232
|
-
|
|
233
|
-
exports.default = _default;
|
|
223
|
+
export default Label;
|
package/lib/Core/MainLoop.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.RENDERING_SCHEDULED = exports.RENDERING_PAUSED = exports.MAIN_LOOP_EVENTS = void 0;
|
|
7
|
-
var _three = require("three");
|
|
8
|
-
const RENDERING_PAUSED = 0;
|
|
9
|
-
exports.RENDERING_PAUSED = RENDERING_PAUSED;
|
|
10
|
-
const RENDERING_SCHEDULED = 1;
|
|
1
|
+
import { EventDispatcher } from 'three';
|
|
2
|
+
export const RENDERING_PAUSED = 0;
|
|
3
|
+
export const RENDERING_SCHEDULED = 1;
|
|
11
4
|
|
|
12
5
|
/**
|
|
13
6
|
* MainLoop's update events list that are fired using
|
|
@@ -22,8 +15,8 @@ const RENDERING_SCHEDULED = 1;
|
|
|
22
15
|
* @property AFTER_RENDER {string} fired after the render
|
|
23
16
|
* @property UPDATE_END {string} fired at the end of the update
|
|
24
17
|
*/
|
|
25
|
-
|
|
26
|
-
const MAIN_LOOP_EVENTS = {
|
|
18
|
+
|
|
19
|
+
export const MAIN_LOOP_EVENTS = {
|
|
27
20
|
UPDATE_START: 'update_start',
|
|
28
21
|
BEFORE_CAMERA_UPDATE: 'before_camera_update',
|
|
29
22
|
AFTER_CAMERA_UPDATE: 'after_camera_update',
|
|
@@ -33,7 +26,6 @@ const MAIN_LOOP_EVENTS = {
|
|
|
33
26
|
AFTER_RENDER: 'after_render',
|
|
34
27
|
UPDATE_END: 'update_end'
|
|
35
28
|
};
|
|
36
|
-
exports.MAIN_LOOP_EVENTS = MAIN_LOOP_EVENTS;
|
|
37
29
|
function updateElements(context, geometryLayer, elements) {
|
|
38
30
|
if (!elements) {
|
|
39
31
|
return;
|
|
@@ -86,7 +78,7 @@ function filterChangeSources(updateSources, geometryLayer) {
|
|
|
86
78
|
});
|
|
87
79
|
return fullUpdate ? new Set([geometryLayer]) : filtered;
|
|
88
80
|
}
|
|
89
|
-
class MainLoop extends
|
|
81
|
+
class MainLoop extends EventDispatcher {
|
|
90
82
|
#needsRedraw = false;
|
|
91
83
|
#updateLoopRestarted = true;
|
|
92
84
|
#lastTimestamp = 0;
|
|
@@ -217,5 +209,4 @@ class MainLoop extends _three.EventDispatcher {
|
|
|
217
209
|
view.execFrameRequesters(MAIN_LOOP_EVENTS.AFTER_RENDER, dt, this.#updateLoopRestarted);
|
|
218
210
|
}
|
|
219
211
|
}
|
|
220
|
-
|
|
221
|
-
exports.default = _default;
|
|
212
|
+
export default MainLoop;
|