itowns 2.42.1-next.2 → 2.42.1-next.21
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/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/entwine_simple_loader.html +24 -8
- package/examples/misc_collada.html +2 -2
- package/examples/misc_instancing.html +1 -1
- package/examples/source_file_gpx_3d.html +2 -2
- package/examples/source_stream_wfs_25d.html +11 -11
- package/examples/source_stream_wfs_3d.html +1 -1
- package/examples/vector_tile_3d_mesh.html +2 -2
- package/examples/vector_tile_raster_2d.html +1 -1
- package/examples/vector_tile_raster_3d.html +1 -1
- package/examples/view_25d_map.html +2 -2
- package/examples/view_3d_map.html +3 -3
- package/examples/view_3d_map_webxr.html +1 -1
- package/examples/view_3d_mns_map.html +3 -3
- package/examples/view_immersive.html +1 -1
- package/examples/view_multi_25d.html +2 -2
- package/examples/widgets_minimap.html +1 -1
- 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 +77 -70
- 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 +26 -40
- 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 +11 -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 +27 -24
- 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 +86 -707
- 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 +31 -21
- package/lib/Parser/LASParser.js +10 -17
- 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 +19 -28
- 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 +224 -94
- package/lib/Renderer/RasterTile.js +18 -30
- 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 +16 -0
- 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/Utils/CameraUtils.js
CHANGED
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.getRig = getRig;
|
|
10
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
-
var _tween = _interopRequireDefault(require("@tweenjs/tween.js"));
|
|
12
|
-
var _DEMUtils = _interopRequireDefault(require("./DEMUtils"));
|
|
13
|
-
var _MainLoop = require("../Core/MainLoop");
|
|
14
|
-
var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
|
|
15
|
-
var _Ellipsoid = _interopRequireDefault(require("../Core/Math/Ellipsoid"));
|
|
16
|
-
var _OBB = _interopRequireDefault(require("../Renderer/OBB"));
|
|
17
|
-
var _View = require("../Core/View");
|
|
18
|
-
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); }
|
|
19
|
-
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 TWEEN from '@tweenjs/tween.js';
|
|
3
|
+
import DEMUtils from "./DEMUtils.js";
|
|
4
|
+
import { MAIN_LOOP_EVENTS } from "../Core/MainLoop.js";
|
|
5
|
+
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
6
|
+
import Ellipsoid from "../Core/Math/Ellipsoid.js";
|
|
7
|
+
import OBB from "../Renderer/OBB.js";
|
|
8
|
+
import { VIEW_EVENTS } from "../Core/View.js";
|
|
20
9
|
THREE.Object3D.DEFAULT_UP.set(0, 0, 1);
|
|
21
10
|
const targetPosition = new THREE.Vector3();
|
|
22
|
-
const targetCoord = new
|
|
23
|
-
const ellipsoid = new
|
|
11
|
+
const targetCoord = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
12
|
+
const ellipsoid = new Ellipsoid();
|
|
24
13
|
const rigs = [];
|
|
25
|
-
const obb = new
|
|
14
|
+
const obb = new OBB();
|
|
26
15
|
const size = new THREE.Vector3();
|
|
27
16
|
const deferred = () => {
|
|
28
17
|
let resolve;
|
|
@@ -44,7 +33,7 @@ function wrapTo180(angle) {
|
|
|
44
33
|
function tileLayer(view) {
|
|
45
34
|
return view.getLayers(l => l.isTiledGeometryLayer)[0];
|
|
46
35
|
}
|
|
47
|
-
function getLookAtFromMath(view, camera) {
|
|
36
|
+
export function getLookAtFromMath(view, camera) {
|
|
48
37
|
const direction = new THREE.Vector3(0, 0, 0.5);
|
|
49
38
|
direction.unproject(camera);
|
|
50
39
|
direction.sub(camera.position).normalize();
|
|
@@ -100,7 +89,7 @@ class CameraRig extends THREE.Object3D {
|
|
|
100
89
|
this.seaLevel.add(this.target);
|
|
101
90
|
this.target.add(this.camera);
|
|
102
91
|
// target's geographic coordinate
|
|
103
|
-
this.coord = new
|
|
92
|
+
this.coord = new Coordinates('EPSG:4978', 0, 0);
|
|
104
93
|
// sea level's worldPoistion
|
|
105
94
|
this.targetWorldPosition = new THREE.Vector3();
|
|
106
95
|
this.removeAll = () => {};
|
|
@@ -117,7 +106,7 @@ class CameraRig extends THREE.Object3D {
|
|
|
117
106
|
this.camera.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale);
|
|
118
107
|
}
|
|
119
108
|
view.dispatchEvent({
|
|
120
|
-
type:
|
|
109
|
+
type: VIEW_EVENTS.CAMERA_MOVED,
|
|
121
110
|
coord: this.coord,
|
|
122
111
|
range: this.range,
|
|
123
112
|
heading: this.heading,
|
|
@@ -148,7 +137,7 @@ class CameraRig extends THREE.Object3D {
|
|
|
148
137
|
setTargetFromCoordinate(view, coord) {
|
|
149
138
|
// compute precise coordinate (coord) altitude and clamp it above seaLevel
|
|
150
139
|
coord.as(tileLayer(view).extent.crs, this.coord);
|
|
151
|
-
const altitude = Math.max(0,
|
|
140
|
+
const altitude = Math.max(0, DEMUtils.getElevationValueAt(tileLayer(view), this.coord, DEMUtils.PRECISE_READ_Z) || this.coord.z);
|
|
152
141
|
this.coord.z = altitude;
|
|
153
142
|
// adjust target's position with clamped altitude
|
|
154
143
|
this.coord.as(view.referenceCrs).toVector3(targetPosition);
|
|
@@ -167,7 +156,7 @@ class CameraRig extends THREE.Object3D {
|
|
|
167
156
|
|
|
168
157
|
// set rig's objects transformation from camera's position and target's position
|
|
169
158
|
setFromPositions(view, cameraPosition) {
|
|
170
|
-
this.setTargetFromCoordinate(view, new
|
|
159
|
+
this.setTargetFromCoordinate(view, new Coordinates(view.referenceCrs, targetPosition));
|
|
171
160
|
this.target.rotation.set(0, 0, 0);
|
|
172
161
|
this.updateMatrixWorld(true);
|
|
173
162
|
this.camera.position.copy(cameraPosition);
|
|
@@ -223,9 +212,9 @@ class CameraRig extends THREE.Object3D {
|
|
|
223
212
|
return this;
|
|
224
213
|
}
|
|
225
214
|
animateCameraToLookAtTarget(view, camera, params) {
|
|
226
|
-
params.easing = params.easing ||
|
|
215
|
+
params.easing = params.easing || TWEEN.Easing.Quartic.InOut;
|
|
227
216
|
this.setfromCamera(view, camera);
|
|
228
|
-
const tweenGroup = new
|
|
217
|
+
const tweenGroup = new TWEEN.Group();
|
|
229
218
|
this.start = (this.start || new CameraRig()).copyObject3D(this);
|
|
230
219
|
this.end = (this.end || new CameraRig()).copyObject3D(this);
|
|
231
220
|
const time = params.time || 2500;
|
|
@@ -242,7 +231,7 @@ class CameraRig extends THREE.Object3D {
|
|
|
242
231
|
if (Math.abs(difference) > Math.PI) {
|
|
243
232
|
this.end.target.rotation.z = this.start.target.rotation.z + difference - Math.sign(difference) * 2 * Math.PI;
|
|
244
233
|
}
|
|
245
|
-
animations.push(new
|
|
234
|
+
animations.push(new TWEEN.Tween(factor, tweenGroup).to({
|
|
246
235
|
t: 1
|
|
247
236
|
}, time).easing(params.easing).onUpdate(d => {
|
|
248
237
|
// rotate to coord destination in geocentric projection
|
|
@@ -259,14 +248,14 @@ class CameraRig extends THREE.Object3D {
|
|
|
259
248
|
|
|
260
249
|
// translate to coordinate destination in planar projection
|
|
261
250
|
if (view.referenceCrs != 'EPSG:4978') {
|
|
262
|
-
animations.push(new
|
|
251
|
+
animations.push(new TWEEN.Tween(this.position, tweenGroup).to(this.end.position, time).easing(params.easing));
|
|
263
252
|
}
|
|
264
253
|
|
|
265
254
|
// translate to altitude zero
|
|
266
|
-
animations.push(new
|
|
255
|
+
animations.push(new TWEEN.Tween(this.seaLevel.position, tweenGroup).to(this.end.seaLevel.position, time).easing(params.easing));
|
|
267
256
|
|
|
268
257
|
// translate camera position
|
|
269
|
-
animations.push(new
|
|
258
|
+
animations.push(new TWEEN.Tween(this.camera.position, tweenGroup).to(this.end.camera.position, time).easing(params.easing));
|
|
270
259
|
|
|
271
260
|
// update animations, transformation and view
|
|
272
261
|
this.animationFrameRequester = () => {
|
|
@@ -285,7 +274,7 @@ class CameraRig extends THREE.Object3D {
|
|
|
285
274
|
this.removeAll = () => {};
|
|
286
275
|
tweenGroup.removeAll();
|
|
287
276
|
if (this.animationFrameRequester) {
|
|
288
|
-
view.removeFrameRequester(
|
|
277
|
+
view.removeFrameRequester(MAIN_LOOP_EVENTS.BEFORE_RENDER, this.animationFrameRequester);
|
|
289
278
|
}
|
|
290
279
|
def.resolve(o !== undefined);
|
|
291
280
|
this.animationFrameRequester = null;
|
|
@@ -295,7 +284,7 @@ class CameraRig extends THREE.Object3D {
|
|
|
295
284
|
// we assume that the animation that completes last is the one that was started last
|
|
296
285
|
animations[animations.length - 1].onComplete(this.removeAll);
|
|
297
286
|
animations.forEach(anim => anim.start());
|
|
298
|
-
view.addFrameRequester(
|
|
287
|
+
view.addFrameRequester(MAIN_LOOP_EVENTS.BEFORE_RENDER, this.animationFrameRequester);
|
|
299
288
|
view.notifyChange(camera);
|
|
300
289
|
return def;
|
|
301
290
|
}
|
|
@@ -313,18 +302,18 @@ class CameraRig extends THREE.Object3D {
|
|
|
313
302
|
if (view && camera) {
|
|
314
303
|
const startAltitude = this.target.position.z;
|
|
315
304
|
this.placeTargetOnGround = () => {
|
|
316
|
-
const altitude = Math.max(0,
|
|
305
|
+
const altitude = Math.max(0, DEMUtils.getElevationValueAt(tileLayer(view), coord || this.coord, DEMUtils.PRECISE_READ_Z) || 0);
|
|
317
306
|
this.target.position.z = startAltitude * (1.0 - options.t) + altitude * options.t;
|
|
318
307
|
this.target.updateMatrixWorld(true);
|
|
319
308
|
this.applyTransformToCamera(view, camera);
|
|
320
309
|
};
|
|
321
310
|
this.placeTargetOnGround();
|
|
322
|
-
view.addFrameRequester(
|
|
311
|
+
view.addFrameRequester(MAIN_LOOP_EVENTS.BEFORE_RENDER, this.placeTargetOnGround);
|
|
323
312
|
}
|
|
324
313
|
}
|
|
325
314
|
removePlaceTargetOnGround(view) {
|
|
326
315
|
if (view && this.placeTargetOnGround) {
|
|
327
|
-
view.removeFrameRequester(
|
|
316
|
+
view.removeFrameRequester(MAIN_LOOP_EVENTS.BEFORE_RENDER, this.placeTargetOnGround);
|
|
328
317
|
this.placeTargetOnGround = null;
|
|
329
318
|
}
|
|
330
319
|
}
|
|
@@ -338,7 +327,7 @@ class CameraRig extends THREE.Object3D {
|
|
|
338
327
|
return this.camera.position.y;
|
|
339
328
|
}
|
|
340
329
|
}
|
|
341
|
-
function getRig(camera) {
|
|
330
|
+
export function getRig(camera) {
|
|
342
331
|
rigs[camera.uuid] = rigs[camera.uuid] || new CameraRig();
|
|
343
332
|
return rigs[camera.uuid];
|
|
344
333
|
}
|
|
@@ -346,7 +335,7 @@ function getRig(camera) {
|
|
|
346
335
|
/**
|
|
347
336
|
* @module CameraUtils
|
|
348
337
|
*/
|
|
349
|
-
|
|
338
|
+
export default {
|
|
350
339
|
/**
|
|
351
340
|
* @typedef {Object} CameraTransformOptions
|
|
352
341
|
* @property {Coordinate} [coord=currentCoordinate] Camera look at geographic coordinate
|
|
@@ -365,7 +354,7 @@ var _default = {
|
|
|
365
354
|
* Default value is false.
|
|
366
355
|
*/
|
|
367
356
|
defaultStopPlaceOnGroundAtEnd: false,
|
|
368
|
-
Easing:
|
|
357
|
+
Easing: TWEEN.Easing,
|
|
369
358
|
/**
|
|
370
359
|
* Stop camera's animation
|
|
371
360
|
*
|
|
@@ -425,7 +414,7 @@ var _default = {
|
|
|
425
414
|
*/
|
|
426
415
|
getCameraTransformOptionsFromExtent(view, camera, extent) {
|
|
427
416
|
const cameraTransformOptions = {
|
|
428
|
-
coord: new
|
|
417
|
+
coord: new Coordinates(extent.crs, 0, 0, 0),
|
|
429
418
|
heading: 0,
|
|
430
419
|
tilt: view.isPlanarView ? 90 : 89.9
|
|
431
420
|
};
|
|
@@ -562,5 +551,4 @@ var _default = {
|
|
|
562
551
|
}
|
|
563
552
|
return diff;
|
|
564
553
|
}
|
|
565
|
-
};
|
|
566
|
-
exports.default = _default;
|
|
554
|
+
};
|
package/lib/Utils/DEMUtils.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
exports.readTextureValueWithBilinearFiltering = readTextureValueWithBilinearFiltering;
|
|
9
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
10
|
-
var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
|
|
11
|
-
var _placeObjectOnGround = _interopRequireDefault(require("./placeObjectOnGround"));
|
|
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; }
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
3
|
+
import placeObjectOnGround from "./placeObjectOnGround.js";
|
|
14
4
|
const FAST_READ_Z = 0;
|
|
15
5
|
const PRECISE_READ_Z = 1;
|
|
16
6
|
|
|
@@ -22,7 +12,7 @@ const PRECISE_READ_Z = 1;
|
|
|
22
12
|
*
|
|
23
13
|
* @module DEMUtils
|
|
24
14
|
*/
|
|
25
|
-
|
|
15
|
+
export default {
|
|
26
16
|
/**
|
|
27
17
|
* Gives the elevation value of a {@link TiledGeometryLayer}, at a specific
|
|
28
18
|
* {@link Coordinates}.
|
|
@@ -95,9 +85,8 @@ var _default = {
|
|
|
95
85
|
},
|
|
96
86
|
FAST_READ_Z,
|
|
97
87
|
PRECISE_READ_Z,
|
|
98
|
-
placeObjectOnGround
|
|
88
|
+
placeObjectOnGround
|
|
99
89
|
};
|
|
100
|
-
exports.default = _default;
|
|
101
90
|
function tileAt(pt, tile) {
|
|
102
91
|
if (tile.extent) {
|
|
103
92
|
if (!tile.extent.isPointInside(pt)) {
|
|
@@ -212,7 +201,7 @@ function _lerpWithUndefinedCheck(x, y, t) {
|
|
|
212
201
|
return THREE.MathUtils.lerp(x, y, t);
|
|
213
202
|
}
|
|
214
203
|
}
|
|
215
|
-
function readTextureValueWithBilinearFiltering(metadata, texture, vertexU, vertexV) {
|
|
204
|
+
export function readTextureValueWithBilinearFiltering(metadata, texture, vertexU, vertexV) {
|
|
216
205
|
const coords = _convertUVtoTextureCoords(texture, vertexU, vertexV);
|
|
217
206
|
const [z11, z21, z12, z22] = _readTextureValueAt(metadata, texture, coords.u1, coords.v1, coords.u2, coords.v1, coords.u1, coords.v2, coords.u2, coords.v2);
|
|
218
207
|
|
|
@@ -282,8 +271,8 @@ function _readZCorrect(layer, texture, uv, tileDimensions, tileOwnerDimensions)
|
|
|
282
271
|
}
|
|
283
272
|
const temp = {
|
|
284
273
|
v: new THREE.Vector3(),
|
|
285
|
-
coord1: new
|
|
286
|
-
coord2: new
|
|
274
|
+
coord1: new Coordinates('EPSG:4978'),
|
|
275
|
+
coord2: new Coordinates('EPSG:4978'),
|
|
287
276
|
offset: new THREE.Vector2()
|
|
288
277
|
};
|
|
289
278
|
const dimension = new THREE.Vector2();
|
|
@@ -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 _Feature = require("../Core/Feature");
|
|
9
|
-
var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
|
|
1
|
+
import { FEATURE_TYPES } from "../Core/Feature.js";
|
|
2
|
+
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
10
3
|
function pointIsOverLine(point, linePoints, epsilon, offset, count, size) {
|
|
11
4
|
const x0 = point.x;
|
|
12
5
|
const y0 = point.y;
|
|
@@ -91,11 +84,11 @@ function pointIsInsidePolygon(point, polygonPoints, epsilon, offset, count, size
|
|
|
91
84
|
return inside;
|
|
92
85
|
}
|
|
93
86
|
function isFeatureSingleGeometryUnderCoordinate(coordinate, type, coordinates, epsilon, offset, count, size) {
|
|
94
|
-
if (type ==
|
|
87
|
+
if (type == FEATURE_TYPES.LINE && pointIsOverLine(coordinate, coordinates, epsilon, offset, count, size)) {
|
|
95
88
|
return true;
|
|
96
|
-
} else if (type ==
|
|
89
|
+
} else if (type == FEATURE_TYPES.POLYGON && pointIsInsidePolygon(coordinate, coordinates, epsilon, offset, count, size)) {
|
|
97
90
|
return true;
|
|
98
|
-
} else if (type ==
|
|
91
|
+
} else if (type == FEATURE_TYPES.POINT) {
|
|
99
92
|
const closestPoint = getClosestPoint(coordinate, coordinates, epsilon, offset, count, size);
|
|
100
93
|
if (closestPoint) {
|
|
101
94
|
return {
|
|
@@ -122,8 +115,8 @@ function isFeatureUnderCoordinate(coordinate, feature, epsilon, result) {
|
|
|
122
115
|
}
|
|
123
116
|
}
|
|
124
117
|
}
|
|
125
|
-
const coord = new
|
|
126
|
-
|
|
118
|
+
const coord = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
119
|
+
export default {
|
|
127
120
|
/**
|
|
128
121
|
* Filter from a list of features, features that are under a coordinate.
|
|
129
122
|
*
|
|
@@ -160,5 +153,4 @@ var _default = {
|
|
|
160
153
|
}
|
|
161
154
|
return result;
|
|
162
155
|
}
|
|
163
|
-
};
|
|
164
|
-
exports.default = _default;
|
|
156
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export default {
|
|
3
|
+
// From chroma spectral http://gka.github.io/chroma.js/
|
|
4
|
+
SPECTRAL: [[0, new THREE.Color(0.3686, 0.3098, 0.6353)], [0.1, new THREE.Color(0.1961, 0.5333, 0.7412)], [0.2, new THREE.Color(0.4000, 0.7608, 0.6471)], [0.3, new THREE.Color(0.6706, 0.8667, 0.6431)], [0.4, new THREE.Color(0.9020, 0.9608, 0.5961)], [0.5, new THREE.Color(1.0000, 1.0000, 0.7490)], [0.6, new THREE.Color(0.9961, 0.8784, 0.5451)], [0.7, new THREE.Color(0.9922, 0.6824, 0.3804)], [0.8, new THREE.Color(0.9569, 0.4275, 0.2627)], [0.9, new THREE.Color(0.8353, 0.2431, 0.3098)], [1, new THREE.Color(0.6196, 0.0039, 0.2588)]],
|
|
5
|
+
PLASMA: [[0.0, new THREE.Color(0.241, 0.015, 0.610)], [0.1, new THREE.Color(0.387, 0.001, 0.654)], [0.2, new THREE.Color(0.524, 0.025, 0.653)], [0.3, new THREE.Color(0.651, 0.125, 0.596)], [0.4, new THREE.Color(0.752, 0.227, 0.513)], [0.5, new THREE.Color(0.837, 0.329, 0.431)], [0.6, new THREE.Color(0.907, 0.435, 0.353)], [0.7, new THREE.Color(0.963, 0.554, 0.272)], [0.8, new THREE.Color(0.992, 0.681, 0.195)], [0.9, new THREE.Color(0.987, 0.822, 0.144)], [1.0, new THREE.Color(0.940, 0.975, 0.131)]],
|
|
6
|
+
YELLOW_GREEN: [[0, new THREE.Color(0.1647, 0.2824, 0.3451)], [0.1, new THREE.Color(0.1338, 0.3555, 0.4227)], [0.2, new THREE.Color(0.0610, 0.4319, 0.4864)], [0.3, new THREE.Color(0.0000, 0.5099, 0.5319)], [0.4, new THREE.Color(0.0000, 0.5881, 0.5569)], [0.5, new THREE.Color(0.1370, 0.6650, 0.5614)], [0.6, new THREE.Color(0.2906, 0.7395, 0.5477)], [0.7, new THREE.Color(0.4453, 0.8099, 0.5201)], [0.8, new THREE.Color(0.6102, 0.8748, 0.4850)], [0.9, new THREE.Color(0.7883, 0.9323, 0.4514)], [1, new THREE.Color(0.9804, 0.9804, 0.4314)]],
|
|
7
|
+
VIRIDIS: [[0.0, new THREE.Color(0.267, 0.005, 0.329)], [0.1, new THREE.Color(0.283, 0.141, 0.458)], [0.2, new THREE.Color(0.254, 0.265, 0.530)], [0.3, new THREE.Color(0.207, 0.372, 0.553)], [0.4, new THREE.Color(0.164, 0.471, 0.558)], [0.5, new THREE.Color(0.128, 0.567, 0.551)], [0.6, new THREE.Color(0.135, 0.659, 0.518)], [0.7, new THREE.Color(0.267, 0.749, 0.441)], [0.8, new THREE.Color(0.478, 0.821, 0.318)], [0.9, new THREE.Color(0.741, 0.873, 0.150)], [1.0, new THREE.Color(0.993, 0.906, 0.144)]],
|
|
8
|
+
INFERNO: [[0.0, new THREE.Color(0.077, 0.042, 0.206)], [0.1, new THREE.Color(0.225, 0.036, 0.388)], [0.2, new THREE.Color(0.373, 0.074, 0.432)], [0.3, new THREE.Color(0.522, 0.128, 0.420)], [0.4, new THREE.Color(0.665, 0.182, 0.370)], [0.5, new THREE.Color(0.797, 0.255, 0.287)], [0.6, new THREE.Color(0.902, 0.364, 0.184)], [0.7, new THREE.Color(0.969, 0.516, 0.063)], [0.8, new THREE.Color(0.988, 0.683, 0.072)], [0.9, new THREE.Color(0.961, 0.859, 0.298)], [1.0, new THREE.Color(0.988, 0.998, 0.645)]],
|
|
9
|
+
GRAYSCALE: [[0, new THREE.Color(0, 0, 0)], [1, new THREE.Color(1, 1, 1)]],
|
|
10
|
+
// 16 samples of the TURBU color scheme
|
|
11
|
+
// values taken from: https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f
|
|
12
|
+
// original file licensed under Apache-2.0
|
|
13
|
+
TURBO: [[0.00, new THREE.Color(0.18995, 0.07176, 0.23217)], [0.07, new THREE.Color(0.25107, 0.25237, 0.63374)], [0.13, new THREE.Color(0.27628, 0.42118, 0.89123)], [0.20, new THREE.Color(0.25862, 0.57958, 0.99876)], [0.27, new THREE.Color(0.15844, 0.73551, 0.92305)], [0.33, new THREE.Color(0.09267, 0.86554, 0.7623)], [0.40, new THREE.Color(0.19659, 0.94901, 0.59466)], [0.47, new THREE.Color(0.42778, 0.99419, 0.38575)], [0.53, new THREE.Color(0.64362, 0.98999, 0.23356)], [0.60, new THREE.Color(0.80473, 0.92452, 0.20459)], [0.67, new THREE.Color(0.93301, 0.81236, 0.22667)], [0.73, new THREE.Color(0.99314, 0.67408, 0.20348)], [0.80, new THREE.Color(0.9836, 0.49291, 0.12849)], [0.87, new THREE.Color(0.92105, 0.31489, 0.05475)], [0.93, new THREE.Color(0.81608, 0.18462, 0.01809)], [1.00, new THREE.Color(0.66449, 0.08436, 0.00424)]],
|
|
14
|
+
RAINBOW: [[0, new THREE.Color(0.278, 0, 0.714)], [1 / 6, new THREE.Color(0, 0, 1)], [2 / 6, new THREE.Color(0, 1, 1)], [3 / 6, new THREE.Color(0, 1, 0)], [4 / 6, new THREE.Color(1, 1, 0)], [5 / 6, new THREE.Color(1, 0.64, 0)], [1, new THREE.Color(1, 0, 0)]],
|
|
15
|
+
CONTOUR: [[0.00, new THREE.Color(0, 0, 0)], [0.03, new THREE.Color(0, 0, 0)], [0.04, new THREE.Color(1, 1, 1)], [1.00, new THREE.Color(1, 1, 1)]]
|
|
16
|
+
};
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _proj = _interopRequireDefault(require("proj4"));
|
|
10
|
-
var _Coordinates = _interopRequireDefault(require("../Core/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; }
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import proj4 from 'proj4';
|
|
3
|
+
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
13
4
|
const DEG2RAD = THREE.MathUtils.DEG2RAD;
|
|
14
5
|
const matrix = new THREE.Matrix4();
|
|
15
6
|
const north = new THREE.Vector3();
|
|
16
7
|
const east = new THREE.Vector3();
|
|
17
8
|
const axis = new THREE.Vector3().set(0, 0, 1);
|
|
18
|
-
const coord = new
|
|
9
|
+
const coord = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
19
10
|
const euler = new THREE.Euler();
|
|
20
11
|
const quat = new THREE.Quaternion();
|
|
21
12
|
function quaternionIdentity(coordinates) {
|
|
@@ -44,7 +35,7 @@ function quaternionIdentity(coordinates) {
|
|
|
44
35
|
*
|
|
45
36
|
* @module OrientationUtils
|
|
46
37
|
*/
|
|
47
|
-
|
|
38
|
+
export default {
|
|
48
39
|
/**
|
|
49
40
|
* @typedef {Object} Attitude
|
|
50
41
|
* Properties are either defined as (omega, phi, kappa) or as (roll, pitch,
|
|
@@ -389,7 +380,7 @@ var _default = {
|
|
|
389
380
|
if (coordinates) {
|
|
390
381
|
return this.quaternionFromEnuToCRS(crsOrProj)(coordinates, target);
|
|
391
382
|
}
|
|
392
|
-
const proj = crsOrProj.projName ? crsOrProj :
|
|
383
|
+
const proj = crsOrProj.projName ? crsOrProj : proj4.defs(crsOrProj);
|
|
393
384
|
switch (proj.projName) {
|
|
394
385
|
case 'geocent':
|
|
395
386
|
return this.quaternionFromEnuToGeocent();
|
|
@@ -420,7 +411,7 @@ var _default = {
|
|
|
420
411
|
if (coordinates) {
|
|
421
412
|
return this.quaternionFromCRSToEnu(crsOrProj)(coordinates, target);
|
|
422
413
|
}
|
|
423
|
-
const proj = crsOrProj.projName ? crsOrProj :
|
|
414
|
+
const proj = crsOrProj.projName ? crsOrProj : proj4.defs(crsOrProj);
|
|
424
415
|
switch (proj.projName) {
|
|
425
416
|
case 'geocent':
|
|
426
417
|
return this.quaternionFromGeocentToEnu();
|
|
@@ -465,5 +456,4 @@ var _default = {
|
|
|
465
456
|
return toCrs(origin, target).multiply(fromCrs(origin, quat));
|
|
466
457
|
};
|
|
467
458
|
}
|
|
468
|
-
};
|
|
469
|
-
exports.default = _default;
|
|
459
|
+
};
|
package/lib/Utils/ThreeUtils.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = disposeThreeMaterial;
|
|
7
|
-
exports.optimizeGeometryGroups = optimizeGeometryGroups;
|
|
8
1
|
/**
|
|
9
2
|
* Find threejs textures from a material
|
|
10
3
|
* @param {Material} material the threejs material holding textures
|
|
@@ -57,7 +50,7 @@ function findTextures(material) {
|
|
|
57
50
|
* won't be freed.
|
|
58
51
|
* @param {Material} material the material to remove
|
|
59
52
|
*/
|
|
60
|
-
function disposeThreeMaterial(material) {
|
|
53
|
+
export default function disposeThreeMaterial(material) {
|
|
61
54
|
const textures = findTextures(material);
|
|
62
55
|
// Remove material
|
|
63
56
|
if (Array.isArray(material)) {
|
|
@@ -79,7 +72,7 @@ function disposeThreeMaterial(material) {
|
|
|
79
72
|
*
|
|
80
73
|
* @param {THREE.Object3D} object3D - object to get optimize
|
|
81
74
|
*/
|
|
82
|
-
function optimizeGeometryGroups(object3D) {
|
|
75
|
+
export function optimizeGeometryGroups(object3D) {
|
|
83
76
|
if (!object3D.geometry) {
|
|
84
77
|
return;
|
|
85
78
|
}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Style = _interopRequireDefault(require("../../Core/Style"));
|
|
9
|
-
var _C3DTilesLayer = require("../../Layer/C3DTilesLayer");
|
|
10
|
-
var _Widget = _interopRequireDefault(require("./Widget"));
|
|
1
|
+
import Style from "../../Core/Style.js";
|
|
2
|
+
import { C3DTILES_LAYER_EVENTS } from "../../Layer/C3DTilesLayer.js";
|
|
3
|
+
import Widget from "./Widget.js";
|
|
11
4
|
const DEFAULT_OPTIONS = {
|
|
12
5
|
width: 200,
|
|
13
6
|
position: 'top-right'
|
|
@@ -27,7 +20,7 @@ const DEFAULT_OPTIONS = {
|
|
|
27
20
|
* @property {HTMLElement} domElement An html div containing the minimap.
|
|
28
21
|
* @property {HTMLElement} parentElement The parent HTML container of `this.domElement`.
|
|
29
22
|
*/
|
|
30
|
-
class C3DTilesStyle extends
|
|
23
|
+
class C3DTilesStyle extends Widget {
|
|
31
24
|
/**
|
|
32
25
|
*
|
|
33
26
|
* @param {View} view view
|
|
@@ -60,7 +53,7 @@ class C3DTilesStyle extends _Widget.default {
|
|
|
60
53
|
selectOptionLayerContent.set(selectC3DTilesLayerOption, layerContent);
|
|
61
54
|
|
|
62
55
|
// wait for C3DTileFeatures to load
|
|
63
|
-
c3DTilesLayer.addEventListener(
|
|
56
|
+
c3DTilesLayer.addEventListener(C3DTILES_LAYER_EVENTS.ON_TILE_CONTENT_LOADED, () => {
|
|
64
57
|
// reset
|
|
65
58
|
while (layerContent.firstChild) {
|
|
66
59
|
layerContent.firstChild.remove();
|
|
@@ -194,7 +187,7 @@ class C3DTilesStyle extends _Widget.default {
|
|
|
194
187
|
}
|
|
195
188
|
|
|
196
189
|
// set style
|
|
197
|
-
c3DTilesLayer.style = new
|
|
190
|
+
c3DTilesLayer.style = new Style({
|
|
198
191
|
fill: {
|
|
199
192
|
color: c3DTileFeature => {
|
|
200
193
|
let result = null;
|
|
@@ -220,5 +213,4 @@ class C3DTilesStyle extends _Widget.default {
|
|
|
220
213
|
return 10;
|
|
221
214
|
}
|
|
222
215
|
}
|
|
223
|
-
|
|
224
|
-
exports.default = _default;
|
|
216
|
+
export default C3DTilesStyle;
|
package/lib/Utils/gui/Main.js
CHANGED
|
@@ -1,48 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _C3DTilesStyle.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "Minimap", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _Minimap.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports, "Navigation", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () {
|
|
22
|
-
return _Navigation.default;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, "Scale", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _Scale.default;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, "Searchbar", {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return _Searchbar.default;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
Object.defineProperty(exports, "Widget", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function () {
|
|
40
|
-
return _Widget.default;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
var _Navigation = _interopRequireDefault(require("./Navigation"));
|
|
44
|
-
var _Minimap = _interopRequireDefault(require("./Minimap"));
|
|
45
|
-
var _Scale = _interopRequireDefault(require("./Scale"));
|
|
46
|
-
var _Searchbar = _interopRequireDefault(require("./Searchbar"));
|
|
47
|
-
var _Widget = _interopRequireDefault(require("./Widget"));
|
|
48
|
-
var _C3DTilesStyle = _interopRequireDefault(require("./C3DTilesStyle"));
|
|
1
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
2
|
+
export { default as Navigation } from "./Navigation.js";
|
|
3
|
+
export { default as Minimap } from "./Minimap.js";
|
|
4
|
+
export { default as Scale } from "./Scale.js";
|
|
5
|
+
export { default as Searchbar } from "./Searchbar.js";
|
|
6
|
+
export { default as Widget } from "./Widget.js";
|
|
7
|
+
export { default as C3DTilesStyle } from "./C3DTilesStyle.js";
|
package/lib/Utils/gui/Minimap.js
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Coordinates = _interopRequireDefault(require("../../Core/Geographic/Coordinates"));
|
|
9
|
-
var _MainLoop = require("../../Core/MainLoop");
|
|
10
|
-
var _PlanarView = _interopRequireDefault(require("../../Core/Prefab/PlanarView"));
|
|
11
|
-
var _Camera = require("../../Renderer/Camera");
|
|
12
|
-
var _Widget = _interopRequireDefault(require("./Widget"));
|
|
1
|
+
import Coordinates from "../../Core/Geographic/Coordinates.js";
|
|
2
|
+
import { MAIN_LOOP_EVENTS } from "../../Core/MainLoop.js";
|
|
3
|
+
import PlanarView from "../../Core/Prefab/PlanarView.js";
|
|
4
|
+
import { CAMERA_TYPE } from "../../Renderer/Camera.js";
|
|
5
|
+
import Widget from "./Widget.js";
|
|
13
6
|
const DEFAULT_OPTIONS = {
|
|
14
7
|
minScale: 1 / 500000,
|
|
15
8
|
maxScale: 1 / 5E8,
|
|
@@ -33,7 +26,7 @@ const DEFAULT_OPTIONS = {
|
|
|
33
26
|
* @property {HTMLElement} domElement An html div containing the minimap.
|
|
34
27
|
* @property {HTMLElement} parentElement The parent HTML container of `this.domElement`.
|
|
35
28
|
*/
|
|
36
|
-
class Minimap extends
|
|
29
|
+
class Minimap extends Widget {
|
|
37
30
|
/**
|
|
38
31
|
* @param {GlobeView} view The iTowns view the minimap should be
|
|
39
32
|
* linked to. Only {@link GlobeView} is
|
|
@@ -111,9 +104,9 @@ class Minimap extends _Widget.default {
|
|
|
111
104
|
|
|
112
105
|
// ---------- CREATE A MINIMAP View AND DISPLAY DATA PASSED IN Layer PARAMETER : ----------
|
|
113
106
|
|
|
114
|
-
this.view = new
|
|
107
|
+
this.view = new PlanarView(this.domElement, layer.source.extent, {
|
|
115
108
|
camera: {
|
|
116
|
-
type:
|
|
109
|
+
type: CAMERA_TYPE.ORTHOGRAPHIC
|
|
117
110
|
},
|
|
118
111
|
placement: layer.source.extent,
|
|
119
112
|
// TODO : the default placement should be the view extent for ortho camera
|
|
@@ -137,10 +130,10 @@ class Minimap extends _Widget.default {
|
|
|
137
130
|
const maxZoom = this.view.camera3D.zoom * this.minScale / initialScale;
|
|
138
131
|
|
|
139
132
|
// Coordinates used to transform position vectors from the main view CRS to the minimap view CRS.
|
|
140
|
-
const mainViewCoordinates = new
|
|
141
|
-
const viewCoordinates = new
|
|
133
|
+
const mainViewCoordinates = new Coordinates(view.referenceCrs);
|
|
134
|
+
const viewCoordinates = new Coordinates(this.view.referenceCrs);
|
|
142
135
|
const targetPosition = view.controls.getCameraTargetPosition();
|
|
143
|
-
view.addFrameRequester(
|
|
136
|
+
view.addFrameRequester(MAIN_LOOP_EVENTS.AFTER_RENDER, () => {
|
|
144
137
|
// Update minimap camera zoom
|
|
145
138
|
const distance = view.camera3D.position.distanceTo(targetPosition);
|
|
146
139
|
const scale = view.getScaleFromDistance(options.pitch, distance);
|
|
@@ -158,5 +151,4 @@ class Minimap extends _Widget.default {
|
|
|
158
151
|
});
|
|
159
152
|
}
|
|
160
153
|
}
|
|
161
|
-
|
|
162
|
-
exports.default = _default;
|
|
154
|
+
export default Minimap;
|
|
@@ -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 _View = require("../../Core/View");
|
|
9
|
-
var _Widget = _interopRequireDefault(require("./Widget"));
|
|
1
|
+
import { VIEW_EVENTS } from "../../Core/View.js";
|
|
2
|
+
import Widget from "./Widget.js";
|
|
10
3
|
const DEFAULT_OPTIONS = {
|
|
11
4
|
displayCompass: true,
|
|
12
5
|
display3DToggle: true,
|
|
@@ -73,7 +66,7 @@ const DEFAULT_BUTTONS = {
|
|
|
73
66
|
* }
|
|
74
67
|
* navigation.zoomIn.onclick = newMethod;
|
|
75
68
|
*/
|
|
76
|
-
class Navigation extends
|
|
69
|
+
class Navigation extends Widget {
|
|
77
70
|
#_view;
|
|
78
71
|
#_action(params) {
|
|
79
72
|
params.time = this.animationDuration;
|
|
@@ -157,7 +150,7 @@ class Navigation extends _Widget.default {
|
|
|
157
150
|
});
|
|
158
151
|
|
|
159
152
|
// Manage compass rotation when the view's camera is moved.
|
|
160
|
-
view.addEventListener(
|
|
153
|
+
view.addEventListener(VIEW_EVENTS.CAMERA_MOVED, event => {
|
|
161
154
|
this.compass.style.transform = `rotate(${-event.heading}deg)`;
|
|
162
155
|
});
|
|
163
156
|
}
|
|
@@ -171,7 +164,7 @@ class Navigation extends _Widget.default {
|
|
|
171
164
|
});
|
|
172
165
|
|
|
173
166
|
// Manage button content toggle when the view's camera is moved.
|
|
174
|
-
view.addEventListener(
|
|
167
|
+
view.addEventListener(VIEW_EVENTS.CAMERA_MOVED, event => {
|
|
175
168
|
this.toggle3D.innerHTML = event.tilt < 89 ? '2D' : '3D';
|
|
176
169
|
});
|
|
177
170
|
}
|
|
@@ -249,5 +242,4 @@ class Navigation extends _Widget.default {
|
|
|
249
242
|
return buttonBar;
|
|
250
243
|
}
|
|
251
244
|
}
|
|
252
|
-
|
|
253
|
-
exports.default = _default;
|
|
245
|
+
export default Navigation;
|