itowns 2.42.1-next.14 → 2.42.1-next.16
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/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 +13 -24
- 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 +8 -19
- 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 -37
- 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 -20
- package/lib/Core/Prefab/TileBuilder.js +10 -19
- package/lib/Core/Prefab/computeBufferTileGeometry.js +3 -12
- 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 +21 -34
- package/lib/Core/System/Capabilities.js +2 -9
- package/lib/Core/TileGeometry.js +5 -14
- package/lib/Core/TileMesh.js +6 -15
- package/lib/Core/View.js +43 -53
- package/lib/Layer/C3DTilesLayer.js +25 -37
- package/lib/Layer/ColorLayer.js +10 -16
- package/lib/Layer/ElevationLayer.js +7 -14
- package/lib/Layer/EntwinePointTileLayer.js +8 -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 +21 -31
- package/lib/Main.js +86 -720
- package/lib/MainBundle.js +4 -34
- package/lib/Parser/B3dmParser.js +20 -28
- package/lib/Parser/CameraCalibrationParser.js +5 -14
- package/lib/Parser/GDFParser.js +11 -22
- package/lib/Parser/GLTFParser.js +13 -28
- 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 +11 -16
- package/lib/Parser/LASParser.js +5 -15
- package/lib/Parser/MapBoxUrlParser.js +2 -9
- package/lib/Parser/PntsParser.js +4 -14
- package/lib/Parser/PotreeBinParser.js +3 -11
- 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 +16 -27
- package/lib/Provider/DataSourceProvider.js +2 -9
- package/lib/Provider/Fetcher.js +37 -13
- package/lib/Provider/PointCloudProvider.js +5 -15
- 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 +27 -41
- package/lib/Renderer/OBB.js +10 -19
- package/lib/Renderer/OrientedImageCamera.js +2 -11
- package/lib/Renderer/OrientedImageMaterial.js +7 -17
- package/lib/Renderer/PointsMaterial.js +34 -48
- package/lib/Renderer/RasterTile.js +16 -29
- package/lib/Renderer/RenderMode.js +2 -9
- package/lib/Renderer/Shader/ShaderChunk.js +2 -11
- 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 +18 -28
- package/lib/Source/C3DTilesGoogleSource.js +5 -13
- 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 +10 -7
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _AnimationPlayer = _interopRequireDefault(require("../Core/AnimationPlayer"));
|
|
10
|
-
var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
|
|
11
|
-
var _Ellipsoid = require("../Core/Math/Ellipsoid");
|
|
12
|
-
var _CameraUtils = _interopRequireDefault(require("../Utils/CameraUtils"));
|
|
13
|
-
var _StateControl = _interopRequireDefault(require("./StateControl"));
|
|
14
|
-
var _View = require("../Core/View");
|
|
15
|
-
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); }
|
|
16
|
-
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 AnimationPlayer from "../Core/AnimationPlayer.js";
|
|
3
|
+
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
4
|
+
import { ellipsoidSizes } from "../Core/Math/Ellipsoid.js";
|
|
5
|
+
import CameraUtils from "../Utils/CameraUtils.js";
|
|
6
|
+
import StateControl from "./StateControl.js";
|
|
7
|
+
import { VIEW_EVENTS } from "../Core/View.js";
|
|
8
|
+
|
|
17
9
|
// private members
|
|
18
10
|
const EPS = 0.000001;
|
|
19
11
|
const direction = {
|
|
@@ -46,10 +38,10 @@ let dollyScale;
|
|
|
46
38
|
// Globe move
|
|
47
39
|
const moveAroundGlobe = new THREE.Quaternion();
|
|
48
40
|
const cameraTarget = new THREE.Object3D();
|
|
49
|
-
const coordCameraTarget = new
|
|
41
|
+
const coordCameraTarget = new Coordinates('EPSG:4978');
|
|
50
42
|
cameraTarget.matrixWorldInverse = new THREE.Matrix4();
|
|
51
|
-
const xyz = new
|
|
52
|
-
const c = new
|
|
43
|
+
const xyz = new Coordinates('EPSG:4978', 0, 0, 0);
|
|
44
|
+
const c = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
53
45
|
// Position object on globe
|
|
54
46
|
function positionObject(newPosition, object) {
|
|
55
47
|
xyz.setFromVector3(newPosition).as('EPSG:4326', c);
|
|
@@ -130,13 +122,12 @@ const helpers = {};
|
|
|
130
122
|
* @property CAMERA_TARGET_CHANGED {string} Fires when camera's target change
|
|
131
123
|
*/
|
|
132
124
|
|
|
133
|
-
const CONTROL_EVENTS = {
|
|
125
|
+
export const CONTROL_EVENTS = {
|
|
134
126
|
PAN_CHANGED: 'pan-changed',
|
|
135
127
|
ORIENTATION_CHANGED: 'orientation-changed',
|
|
136
128
|
RANGE_CHANGED: 'range-changed',
|
|
137
129
|
CAMERA_TARGET_CHANGED: 'camera-target-changed'
|
|
138
130
|
};
|
|
139
|
-
exports.CONTROL_EVENTS = CONTROL_EVENTS;
|
|
140
131
|
const quaterPano = new THREE.Quaternion();
|
|
141
132
|
const quaterAxis = new THREE.Quaternion();
|
|
142
133
|
const axisX = new THREE.Vector3(1, 0, 0);
|
|
@@ -184,12 +175,12 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
184
175
|
constructor(view, placement) {
|
|
185
176
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
186
177
|
super();
|
|
187
|
-
this.player = new
|
|
178
|
+
this.player = new AnimationPlayer();
|
|
188
179
|
this.view = view;
|
|
189
180
|
this.camera = view.camera3D;
|
|
190
181
|
|
|
191
182
|
// State control
|
|
192
|
-
this.states = new
|
|
183
|
+
this.states = new StateControl(this.view);
|
|
193
184
|
|
|
194
185
|
// this.enabled property has moved to StateControl
|
|
195
186
|
Object.defineProperty(this, 'enabled', {
|
|
@@ -210,7 +201,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
210
201
|
|
|
211
202
|
// Limits to how far you can dolly in and out ( PerspectiveCamera only )
|
|
212
203
|
this.minDistance = options.minDistance || 250;
|
|
213
|
-
this.maxDistance = options.maxDistance ||
|
|
204
|
+
this.maxDistance = options.maxDistance || ellipsoidSizes.x * 8.0;
|
|
214
205
|
|
|
215
206
|
// Limits to how far you can zoom in and out ( OrthographicCamera only )
|
|
216
207
|
this.minZoom = options.minZoom || 0;
|
|
@@ -523,7 +514,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
523
514
|
this.player.playLater(durationDampingOrbital, 2);
|
|
524
515
|
}
|
|
525
516
|
this.view.dispatchEvent({
|
|
526
|
-
type:
|
|
517
|
+
type: VIEW_EVENTS.CAMERA_MOVED,
|
|
527
518
|
coord: coordCameraTarget.setFromVector3(cameraTarget.position),
|
|
528
519
|
range: spherical.radius,
|
|
529
520
|
heading: -THREE.MathUtils.radToDeg(spherical.theta),
|
|
@@ -539,7 +530,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
539
530
|
|
|
540
531
|
// Stop CameraUtils ongoing animations, which can for instance be triggered with `this.travel` or
|
|
541
532
|
// `this.lookAtCoordinate` methods.
|
|
542
|
-
|
|
533
|
+
CameraUtils.stop(this.view, this.camera);
|
|
543
534
|
|
|
544
535
|
// Dispatch events which specify if changes occurred in camera transform options.
|
|
545
536
|
this.onEndingMove();
|
|
@@ -549,7 +540,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
549
540
|
|
|
550
541
|
// Update camera transform options.
|
|
551
542
|
this.updateTarget();
|
|
552
|
-
previous =
|
|
543
|
+
previous = CameraUtils.getTransformCameraLookingAtTarget(this.view, this.camera, pickedPosition);
|
|
553
544
|
|
|
554
545
|
// Initialize rotation and panoramic movements.
|
|
555
546
|
rotateStart.copy(event.viewCoords);
|
|
@@ -667,8 +658,8 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
667
658
|
}
|
|
668
659
|
}
|
|
669
660
|
handlingEvent(current) {
|
|
670
|
-
current = current ||
|
|
671
|
-
const diff =
|
|
661
|
+
current = current || CameraUtils.getTransformCameraLookingAtTarget(this.view, this.camera);
|
|
662
|
+
const diff = CameraUtils.getDiffParams(previous, current);
|
|
672
663
|
if (diff) {
|
|
673
664
|
if (diff.range) {
|
|
674
665
|
this.dispatchEvent({
|
|
@@ -712,7 +703,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
712
703
|
const range = this.getRange(point);
|
|
713
704
|
if (point && range > this.minDistance) {
|
|
714
705
|
return this.lookAtCoordinate({
|
|
715
|
-
coord: new
|
|
706
|
+
coord: new Coordinates('EPSG:4978', point),
|
|
716
707
|
range: range * (event.direction === 'out' ? 1 / 0.6 : 0.6),
|
|
717
708
|
time: 1500
|
|
718
709
|
});
|
|
@@ -720,7 +711,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
720
711
|
}
|
|
721
712
|
handleZoom(event) {
|
|
722
713
|
this.player.stop();
|
|
723
|
-
|
|
714
|
+
CameraUtils.stop(this.view, this.camera);
|
|
724
715
|
this.updateTarget();
|
|
725
716
|
const delta = -event.delta;
|
|
726
717
|
this.dolly(delta);
|
|
@@ -918,7 +909,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
918
909
|
* @return {number} number
|
|
919
910
|
*/
|
|
920
911
|
getRange(position) {
|
|
921
|
-
return
|
|
912
|
+
return CameraUtils.getTransformCameraLookingAtTarget(this.view, this.camera, position).range;
|
|
922
913
|
}
|
|
923
914
|
|
|
924
915
|
/**
|
|
@@ -928,7 +919,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
928
919
|
* @return {number} The angle of the rotation in degrees.
|
|
929
920
|
*/
|
|
930
921
|
getTilt(position) {
|
|
931
|
-
return
|
|
922
|
+
return CameraUtils.getTransformCameraLookingAtTarget(this.view, this.camera, position).tilt;
|
|
932
923
|
}
|
|
933
924
|
|
|
934
925
|
/**
|
|
@@ -938,7 +929,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
938
929
|
* @return {number} The angle of the rotation in degrees.
|
|
939
930
|
*/
|
|
940
931
|
getHeading(position) {
|
|
941
|
-
return
|
|
932
|
+
return CameraUtils.getTransformCameraLookingAtTarget(this.view, this.camera, position).heading;
|
|
942
933
|
}
|
|
943
934
|
|
|
944
935
|
/**
|
|
@@ -968,7 +959,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
968
959
|
*/
|
|
969
960
|
|
|
970
961
|
getCameraCoordinate() {
|
|
971
|
-
return new
|
|
962
|
+
return new Coordinates('EPSG:4978', this.camera.position).as('EPSG:4326');
|
|
972
963
|
}
|
|
973
964
|
|
|
974
965
|
/**
|
|
@@ -976,7 +967,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
976
967
|
* @return {Coordinates} coordinate
|
|
977
968
|
*/
|
|
978
969
|
getLookAtCoordinate() {
|
|
979
|
-
return
|
|
970
|
+
return CameraUtils.getTransformCameraLookingAtTarget(this.view, this.camera).coord;
|
|
980
971
|
}
|
|
981
972
|
|
|
982
973
|
/**
|
|
@@ -1058,7 +1049,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
1058
1049
|
let pixelPitch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.28;
|
|
1059
1050
|
console.warn('Deprecated, use View#getPixelsToMeters and GlobeControls#getMetersToDegrees instead.');
|
|
1060
1051
|
const chord = this.pixelsToMeters(pixels, pixelPitch);
|
|
1061
|
-
return THREE.MathUtils.radToDeg(2 * Math.asin(chord / (2 *
|
|
1052
|
+
return THREE.MathUtils.radToDeg(2 * Math.asin(chord / (2 * ellipsoidSizes.x)));
|
|
1062
1053
|
}
|
|
1063
1054
|
|
|
1064
1055
|
/**
|
|
@@ -1130,13 +1121,13 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
1130
1121
|
}
|
|
1131
1122
|
}
|
|
1132
1123
|
}
|
|
1133
|
-
previous =
|
|
1124
|
+
previous = CameraUtils.getTransformCameraLookingAtTarget(this.view, this.camera);
|
|
1134
1125
|
if (isAnimated) {
|
|
1135
1126
|
params.callback = r => cameraTarget.position.copy(r.targetWorldPosition);
|
|
1136
1127
|
this.dispatchEvent({
|
|
1137
1128
|
type: 'animation-started'
|
|
1138
1129
|
});
|
|
1139
|
-
return
|
|
1130
|
+
return CameraUtils.animateCameraToLookAtTarget(this.view, this.camera, params).then(result => {
|
|
1140
1131
|
this.dispatchEvent({
|
|
1141
1132
|
type: 'animation-ended'
|
|
1142
1133
|
});
|
|
@@ -1144,7 +1135,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
1144
1135
|
return result;
|
|
1145
1136
|
});
|
|
1146
1137
|
} else {
|
|
1147
|
-
return
|
|
1138
|
+
return CameraUtils.transformCameraToLookAtTarget(this.view, this.camera, params).then(result => {
|
|
1148
1139
|
cameraTarget.position.copy(result.targetWorldPosition);
|
|
1149
1140
|
this.handlingEvent(result);
|
|
1150
1141
|
return result;
|
|
@@ -1163,8 +1154,7 @@ class GlobeControls extends THREE.EventDispatcher {
|
|
|
1163
1154
|
if (!pickedPosition) {
|
|
1164
1155
|
return;
|
|
1165
1156
|
}
|
|
1166
|
-
return new
|
|
1157
|
+
return new Coordinates('EPSG:4978', pickedPosition).as('EPSG:4326');
|
|
1167
1158
|
}
|
|
1168
1159
|
}
|
|
1169
|
-
|
|
1170
|
-
exports.default = _default;
|
|
1160
|
+
export default GlobeControls;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.keys = exports.default = exports.STATE = exports.PLANAR_CONTROL_EVENT = void 0;
|
|
7
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
8
|
-
var _MainLoop = require("../Core/MainLoop");
|
|
9
|
-
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); }
|
|
10
|
-
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 { MAIN_LOOP_EVENTS } from "../Core/MainLoop.js";
|
|
3
|
+
|
|
11
4
|
// event keycode
|
|
12
|
-
const keys = {
|
|
5
|
+
export const keys = {
|
|
13
6
|
CTRL: 17,
|
|
14
7
|
SPACE: 32,
|
|
15
8
|
T: 84,
|
|
16
9
|
Y: 89
|
|
17
10
|
};
|
|
18
|
-
exports.keys = keys;
|
|
19
11
|
const mouseButtons = {
|
|
20
12
|
LEFTCLICK: THREE.MOUSE.LEFT,
|
|
21
13
|
MIDDLECLICK: THREE.MOUSE.MIDDLE,
|
|
@@ -33,7 +25,7 @@ let cameraInitialZoom = 0;
|
|
|
33
25
|
const pointUnderCursor = new THREE.Vector3();
|
|
34
26
|
|
|
35
27
|
// control state
|
|
36
|
-
const STATE = {
|
|
28
|
+
export const STATE = {
|
|
37
29
|
NONE: -1,
|
|
38
30
|
DRAG: 0,
|
|
39
31
|
PAN: 1,
|
|
@@ -43,7 +35,6 @@ const STATE = {
|
|
|
43
35
|
};
|
|
44
36
|
|
|
45
37
|
// cursor shape linked to control state
|
|
46
|
-
exports.STATE = STATE;
|
|
47
38
|
const cursor = {
|
|
48
39
|
default: 'auto',
|
|
49
40
|
drag: 'move',
|
|
@@ -120,7 +111,7 @@ const defaultOptions = {
|
|
|
120
111
|
enableSmartTravel: true,
|
|
121
112
|
enablePan: true
|
|
122
113
|
};
|
|
123
|
-
const PLANAR_CONTROL_EVENT = {
|
|
114
|
+
export const PLANAR_CONTROL_EVENT = {
|
|
124
115
|
MOVED: 'moved'
|
|
125
116
|
};
|
|
126
117
|
|
|
@@ -174,7 +165,6 @@ const PLANAR_CONTROL_EVENT = {
|
|
|
174
165
|
* rotation, in degrees.
|
|
175
166
|
* @param {boolean} [options.handleCollision=true]
|
|
176
167
|
*/
|
|
177
|
-
exports.PLANAR_CONTROL_EVENT = PLANAR_CONTROL_EVENT;
|
|
178
168
|
class PlanarControls extends THREE.EventDispatcher {
|
|
179
169
|
constructor(view) {
|
|
180
170
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -308,14 +298,14 @@ class PlanarControls extends THREE.EventDispatcher {
|
|
|
308
298
|
|
|
309
299
|
// add this PlanarControl instance to the view's frameRequesters
|
|
310
300
|
// with this, PlanarControl.update() will be called each frame
|
|
311
|
-
this.view.addFrameRequester(
|
|
301
|
+
this.view.addFrameRequester(MAIN_LOOP_EVENTS.AFTER_CAMERA_UPDATE, this._handlerUpdate);
|
|
312
302
|
|
|
313
303
|
// event listeners for user input (to activate the controls)
|
|
314
304
|
this.addInputListeners();
|
|
315
305
|
}
|
|
316
306
|
dispose() {
|
|
317
307
|
this.removeInputListeners();
|
|
318
|
-
this.view.removeFrameRequester(
|
|
308
|
+
this.view.removeFrameRequester(MAIN_LOOP_EVENTS.AFTER_CAMERA_UPDATE, this._handlerUpdate);
|
|
319
309
|
}
|
|
320
310
|
|
|
321
311
|
/**
|
|
@@ -1032,5 +1022,4 @@ class PlanarControls extends THREE.EventDispatcher {
|
|
|
1032
1022
|
return (value ** 2 * (3 - 2 * value)) ** 1.20;
|
|
1033
1023
|
}
|
|
1034
1024
|
}
|
|
1035
|
-
|
|
1036
|
-
exports.default = _default;
|
|
1025
|
+
export default PlanarControls;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
8
|
-
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); }
|
|
9
|
-
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';
|
|
10
2
|
const CONTROL_KEYS = {
|
|
11
3
|
LEFT: 37,
|
|
12
4
|
UP: 38,
|
|
@@ -434,5 +426,4 @@ class StateControl extends THREE.EventDispatcher {
|
|
|
434
426
|
this._domElement.removeEventListener('contextmenu', this._onContextMenu, false);
|
|
435
427
|
}
|
|
436
428
|
}
|
|
437
|
-
|
|
438
|
-
exports.default = _default;
|
|
429
|
+
export default StateControl;
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _tween = _interopRequireDefault(require("@tweenjs/tween.js"));
|
|
9
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
10
|
-
var _MainLoop = require("../Core/MainLoop");
|
|
11
|
-
var _FirstPersonControls = _interopRequireDefault(require("./FirstPersonControls"));
|
|
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 TWEEN from '@tweenjs/tween.js';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { MAIN_LOOP_EVENTS } from "../Core/MainLoop.js";
|
|
4
|
+
import FirstPersonControls from "./FirstPersonControls.js";
|
|
14
5
|
const material = new THREE.MeshBasicMaterial({
|
|
15
6
|
color: 0xffffff,
|
|
16
7
|
depthTest: false,
|
|
@@ -119,7 +110,7 @@ function computeTime(distance) {
|
|
|
119
110
|
* @property {number} keySetCameraToCurrentPositionAndLookAtPrevious key code set camera to current position, default to 81 for key Q
|
|
120
111
|
* @extends FirstPersonControls
|
|
121
112
|
*/
|
|
122
|
-
class StreetControls extends
|
|
113
|
+
class StreetControls extends FirstPersonControls {
|
|
123
114
|
/**
|
|
124
115
|
* @constructor
|
|
125
116
|
* @param { View } view - View where this control will be used
|
|
@@ -149,7 +140,7 @@ class StreetControls extends _FirstPersonControls.default {
|
|
|
149
140
|
this.keySetCameraToCurrentPositionAndLookAtPrevious = 81;
|
|
150
141
|
|
|
151
142
|
// Tween is used to make smooth animations
|
|
152
|
-
this.tweenGroup = new
|
|
143
|
+
this.tweenGroup = new TWEEN.Group();
|
|
153
144
|
|
|
154
145
|
// init surfaces used as helper for end user
|
|
155
146
|
this.surfaceGround = options.surfaceGround || createCircle();
|
|
@@ -298,11 +289,11 @@ class StreetControls extends _FirstPersonControls.default {
|
|
|
298
289
|
startQuaternion.copy(this.camera.quaternion);
|
|
299
290
|
this.end.copy(this.camera);
|
|
300
291
|
this.end.lookAt(position);
|
|
301
|
-
this.tween = new
|
|
292
|
+
this.tween = new TWEEN.Tween({
|
|
302
293
|
t: 0
|
|
303
294
|
}, this.tweenGroup).to({
|
|
304
295
|
t: 1
|
|
305
|
-
}, time).easing(
|
|
296
|
+
}, time).easing(TWEEN.Easing.Quadratic.Out).onComplete(() => {
|
|
306
297
|
this.stopAnimations();
|
|
307
298
|
}).onUpdate(d => {
|
|
308
299
|
// 'manually' slerp the Quaternion to avoid rotation issues
|
|
@@ -314,7 +305,7 @@ class StreetControls extends _FirstPersonControls.default {
|
|
|
314
305
|
this.reset();
|
|
315
306
|
this.view.notifyChange(this.camera);
|
|
316
307
|
};
|
|
317
|
-
this.view.addFrameRequester(
|
|
308
|
+
this.view.addFrameRequester(MAIN_LOOP_EVENTS.BEFORE_RENDER, this.animationFrameRequester);
|
|
318
309
|
this.view.notifyChange(this.camera);
|
|
319
310
|
}
|
|
320
311
|
|
|
@@ -335,8 +326,8 @@ class StreetControls extends _FirstPersonControls.default {
|
|
|
335
326
|
resolve = r;
|
|
336
327
|
});
|
|
337
328
|
this.stopAnimations();
|
|
338
|
-
this.tween = new
|
|
339
|
-
.to(position.clone(), time).easing(
|
|
329
|
+
this.tween = new TWEEN.Tween(this.camera.position, this.tweenGroup) // Create a new tween that modifies camera position
|
|
330
|
+
.to(position.clone(), time).easing(TWEEN.Easing.Quadratic.Out) // Use an easing function to make the animation smooth.
|
|
340
331
|
.onComplete(() => {
|
|
341
332
|
this.stopAnimations();
|
|
342
333
|
resolve();
|
|
@@ -345,7 +336,7 @@ class StreetControls extends _FirstPersonControls.default {
|
|
|
345
336
|
this.tweenGroup.update();
|
|
346
337
|
this.view.notifyChange(this.camera);
|
|
347
338
|
};
|
|
348
|
-
this.view.addFrameRequester(
|
|
339
|
+
this.view.addFrameRequester(MAIN_LOOP_EVENTS.BEFORE_RENDER, this.animationFrameRequester);
|
|
349
340
|
this.view.notifyChange(this.camera);
|
|
350
341
|
return promise;
|
|
351
342
|
}
|
|
@@ -355,7 +346,7 @@ class StreetControls extends _FirstPersonControls.default {
|
|
|
355
346
|
this.tween = undefined;
|
|
356
347
|
}
|
|
357
348
|
if (this.animationFrameRequester) {
|
|
358
|
-
this.view.removeFrameRequester(
|
|
349
|
+
this.view.removeFrameRequester(MAIN_LOOP_EVENTS.BEFORE_RENDER, this.animationFrameRequester);
|
|
359
350
|
this.animationFrameRequester = null;
|
|
360
351
|
}
|
|
361
352
|
}
|
|
@@ -396,5 +387,4 @@ class StreetControls extends _FirstPersonControls.default {
|
|
|
396
387
|
super.dispose();
|
|
397
388
|
}
|
|
398
389
|
}
|
|
399
|
-
|
|
400
|
-
exports.default = _default;
|
|
390
|
+
export default StreetControls;
|
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _Crs = _interopRequireDefault(require("../Core/Geographic/Crs"));
|
|
15
|
-
var _OrientationUtils = _interopRequireDefault(require("../Utils/OrientationUtils"));
|
|
16
|
-
var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
|
|
17
|
-
var _Style = _interopRequireWildcard(require("../Core/Style"));
|
|
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; }
|
|
20
|
-
const coord = new _Coordinates.default('EPSG:4326', 0, 0, 0);
|
|
21
|
-
const context = new _Style.StyleContext();
|
|
22
|
-
const defaultStyle = new _Style.default();
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import Earcut from 'earcut';
|
|
3
|
+
import { FEATURE_TYPES } from "../Core/Feature.js";
|
|
4
|
+
import ReferLayerProperties from "../Layer/ReferencingLayerProperties.js";
|
|
5
|
+
import { deprecatedFeature2MeshOptions } from "../Core/Deprecated/Undeprecator.js";
|
|
6
|
+
import Extent from "../Core/Geographic/Extent.js";
|
|
7
|
+
import Crs from "../Core/Geographic/Crs.js";
|
|
8
|
+
import OrientationUtils from "../Utils/OrientationUtils.js";
|
|
9
|
+
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
10
|
+
import Style, { StyleContext } from "../Core/Style.js";
|
|
11
|
+
const coord = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
12
|
+
const context = new StyleContext();
|
|
13
|
+
const defaultStyle = new Style();
|
|
23
14
|
let style;
|
|
24
15
|
const dim_ref = new THREE.Vector2();
|
|
25
16
|
const dim = new THREE.Vector2();
|
|
@@ -27,7 +18,7 @@ const normal = new THREE.Vector3();
|
|
|
27
18
|
const baseCoord = new THREE.Vector3();
|
|
28
19
|
const topCoord = new THREE.Vector3();
|
|
29
20
|
const inverseScale = new THREE.Vector3();
|
|
30
|
-
const extent = new
|
|
21
|
+
const extent = new Extent('EPSG:4326', 0, 0, 0, 0);
|
|
31
22
|
const _color = new THREE.Color();
|
|
32
23
|
const maxValueUint8 = 2 ** 8 - 1;
|
|
33
24
|
const maxValueUint16 = 2 ** 16 - 1;
|
|
@@ -63,7 +54,7 @@ class FeatureMesh extends THREE.Group {
|
|
|
63
54
|
} else {
|
|
64
55
|
// calculate the scale transformation to transform the feature.extent
|
|
65
56
|
// to feature.extent.as(crs)
|
|
66
|
-
coord.crs =
|
|
57
|
+
coord.crs = Crs.formatToEPSG(this.#originalCrs);
|
|
67
58
|
extent.copy(this.extent).applyMatrix4(this.#collection.matrix);
|
|
68
59
|
extent.as(coord.crs, extent);
|
|
69
60
|
extent.spatialEuclideanDimensions(dim_ref);
|
|
@@ -81,7 +72,7 @@ class FeatureMesh extends THREE.Group {
|
|
|
81
72
|
|
|
82
73
|
// get method to calculate orientation
|
|
83
74
|
const crsInput = this.#originalCrs == 'EPSG:3857' ? crsWGS84 : this.#originalCrs;
|
|
84
|
-
const crs2crs =
|
|
75
|
+
const crs2crs = OrientationUtils.quaternionFromCRSToCRS(crsInput, crs);
|
|
85
76
|
// calculate orientation to crs
|
|
86
77
|
crs2crs(coord.as(crsWGS84), this.quaternion);
|
|
87
78
|
|
|
@@ -347,7 +338,7 @@ function featureToPolygon(feature, options) {
|
|
|
347
338
|
featureId++;
|
|
348
339
|
const geomVertices = vertices.slice(start * 3, end * 3);
|
|
349
340
|
const holesOffsets = geometry.indices.map(i => i.offset - start).slice(1);
|
|
350
|
-
const triangles = (
|
|
341
|
+
const triangles = Earcut(geomVertices, holesOffsets, 3);
|
|
351
342
|
const startIndice = indices.length;
|
|
352
343
|
indices.length += triangles.length;
|
|
353
344
|
for (let i = 0; i < triangles.length; i++) {
|
|
@@ -429,7 +420,7 @@ function featureToExtrudedPolygon(feature, options) {
|
|
|
429
420
|
featureId++;
|
|
430
421
|
const geomVertices = vertices.slice(startTop * 3, (end + totalVertices) * 3);
|
|
431
422
|
const holesOffsets = geometry.indices.map(i => i.offset - start).slice(1);
|
|
432
|
-
const triangles = (
|
|
423
|
+
const triangles = Earcut(geomVertices, holesOffsets, 3);
|
|
433
424
|
const startIndice = indices.length;
|
|
434
425
|
indices.length += triangles.length;
|
|
435
426
|
for (let i = 0; i < triangles.length; i++) {
|
|
@@ -511,7 +502,7 @@ function featureToMesh(feature, options) {
|
|
|
511
502
|
}
|
|
512
503
|
let mesh;
|
|
513
504
|
switch (feature.type) {
|
|
514
|
-
case
|
|
505
|
+
case FEATURE_TYPES.POINT:
|
|
515
506
|
if ((_style$point = style.point) !== null && _style$point !== void 0 && (_style$point$model = _style$point.model) !== null && _style$point$model !== void 0 && _style$point$model.object) {
|
|
516
507
|
try {
|
|
517
508
|
mesh = pointsToInstancedMeshes(feature);
|
|
@@ -523,10 +514,10 @@ function featureToMesh(feature, options) {
|
|
|
523
514
|
mesh = featureToPoint(feature, options);
|
|
524
515
|
}
|
|
525
516
|
break;
|
|
526
|
-
case
|
|
517
|
+
case FEATURE_TYPES.LINE:
|
|
527
518
|
mesh = featureToLine(feature, options);
|
|
528
519
|
break;
|
|
529
|
-
case
|
|
520
|
+
case FEATURE_TYPES.POLYGON:
|
|
530
521
|
if (style.fill && Object.keys(style.fill).includes('extrusion_height')) {
|
|
531
522
|
mesh = featureToExtrudedPolygon(feature, options);
|
|
532
523
|
} else {
|
|
@@ -546,7 +537,7 @@ function featureToMesh(feature, options) {
|
|
|
546
537
|
/**
|
|
547
538
|
* @module Feature2Mesh
|
|
548
539
|
*/
|
|
549
|
-
|
|
540
|
+
export default {
|
|
550
541
|
/**
|
|
551
542
|
* Return a function that converts [Features]{@link module:GeoJsonParser} to Meshes. Feature collection will be converted to a
|
|
552
543
|
* a THREE.Group.
|
|
@@ -584,7 +575,7 @@ var _default = {
|
|
|
584
575
|
*/
|
|
585
576
|
convert() {
|
|
586
577
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
587
|
-
|
|
578
|
+
deprecatedFeature2MeshOptions(options);
|
|
588
579
|
return function (collection) {
|
|
589
580
|
if (!collection) {
|
|
590
581
|
return;
|
|
@@ -592,16 +583,16 @@ var _default = {
|
|
|
592
583
|
if (!options.pointMaterial) {
|
|
593
584
|
// Opacity and wireframe refered with layer properties
|
|
594
585
|
// TODO: next step is move these properties to Style
|
|
595
|
-
options.pointMaterial = (
|
|
596
|
-
options.lineMaterial = (
|
|
597
|
-
options.polygonMaterial = (
|
|
586
|
+
options.pointMaterial = ReferLayerProperties(new THREE.PointsMaterial(), this);
|
|
587
|
+
options.lineMaterial = ReferLayerProperties(new THREE.LineBasicMaterial(), this);
|
|
588
|
+
options.polygonMaterial = ReferLayerProperties(new THREE.MeshBasicMaterial(), this);
|
|
598
589
|
}
|
|
599
590
|
|
|
600
591
|
// In the case we didn't instanciate the layer (this) before the convert, we can pass
|
|
601
592
|
// style properties (@link StyleOptions) using options.style.
|
|
602
593
|
// This is usually done in some tests and if you want to use Feature2Mesh.convert()
|
|
603
594
|
// as in examples/source_file_gpx_3d.html.
|
|
604
|
-
style = (this === null || this === void 0 ? void 0 : this.style) || (options.style ? new
|
|
595
|
+
style = (this === null || this === void 0 ? void 0 : this.style) || (options.style ? new Style(options.style) : defaultStyle);
|
|
605
596
|
context.setCollection(collection);
|
|
606
597
|
const features = collection.features;
|
|
607
598
|
if (!features || features.length == 0) {
|
|
@@ -616,5 +607,4 @@ var _default = {
|
|
|
616
607
|
return featureNode;
|
|
617
608
|
};
|
|
618
609
|
}
|
|
619
|
-
};
|
|
620
|
-
exports.default = _default;
|
|
610
|
+
};
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _Feature = require("../Core/Feature");
|
|
10
|
-
var _Extent = _interopRequireDefault(require("../Core/Geographic/Extent"));
|
|
11
|
-
var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
|
|
12
|
-
var _Style = _interopRequireWildcard(require("../Core/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; }
|
|
15
|
-
const defaultStyle = new _Style.default();
|
|
16
|
-
const context = new _Style.StyleContext();
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { FEATURE_TYPES } from "../Core/Feature.js";
|
|
3
|
+
import Extent from "../Core/Geographic/Extent.js";
|
|
4
|
+
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
5
|
+
import Style, { StyleContext } from "../Core/Style.js";
|
|
6
|
+
const defaultStyle = new Style();
|
|
7
|
+
const context = new StyleContext();
|
|
17
8
|
let style;
|
|
18
9
|
|
|
19
10
|
/**
|
|
@@ -45,7 +36,7 @@ function drawPolygon(ctx, vertices) {
|
|
|
45
36
|
// build contour
|
|
46
37
|
const path = new Path2D();
|
|
47
38
|
for (const indice of indices) {
|
|
48
|
-
if (indice.extent &&
|
|
39
|
+
if (indice.extent && Extent.intersectsExtent(indice.extent, extent)) {
|
|
49
40
|
const offset = indice.offset * size;
|
|
50
41
|
const count = offset + indice.count * size;
|
|
51
42
|
path.moveTo(vertices[offset], vertices[offset + 1]);
|
|
@@ -73,14 +64,14 @@ function drawPoint(ctx, x, y, invCtxScale) {
|
|
|
73
64
|
ctx.stroke();
|
|
74
65
|
}
|
|
75
66
|
}
|
|
76
|
-
const coord = new
|
|
67
|
+
const coord = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
77
68
|
function drawFeature(ctx, feature, extent, invCtxScale) {
|
|
78
69
|
const extentDim = extent.planarDimensions();
|
|
79
70
|
const scaleRadius = extentDim.x / ctx.canvas.width;
|
|
80
71
|
for (const geometry of feature.geometries) {
|
|
81
|
-
if (
|
|
72
|
+
if (Extent.intersectsExtent(geometry.extent, extent)) {
|
|
82
73
|
context.setGeometry(geometry);
|
|
83
|
-
if (feature.type ===
|
|
74
|
+
if (feature.type === FEATURE_TYPES.POINT && style.point) {
|
|
84
75
|
// cross multiplication to know in the extent system the real size of
|
|
85
76
|
// the point
|
|
86
77
|
const px = (Math.round(style.point.radius * invCtxScale) || 3 * invCtxScale) * scaleRadius;
|
|
@@ -95,7 +86,7 @@ function drawFeature(ctx, feature, extent, invCtxScale) {
|
|
|
95
86
|
}
|
|
96
87
|
}
|
|
97
88
|
} else {
|
|
98
|
-
drawPolygon(ctx, feature.vertices, geometry.indices, feature.size, extent, invCtxScale, feature.type ==
|
|
89
|
+
drawPolygon(ctx, feature.vertices, geometry.indices, feature.size, extent, invCtxScale, feature.type == FEATURE_TYPES.POLYGON);
|
|
99
90
|
}
|
|
100
91
|
}
|
|
101
92
|
}
|
|
@@ -107,8 +98,8 @@ const quaternion = new THREE.Quaternion();
|
|
|
107
98
|
const world2texture = new THREE.Matrix4();
|
|
108
99
|
const feature2texture = new THREE.Matrix4();
|
|
109
100
|
const worldTextureOrigin = new THREE.Vector3();
|
|
110
|
-
const featureExtent = new
|
|
111
|
-
|
|
101
|
+
const featureExtent = new Extent('EPSG:4326', 0, 0, 0, 0);
|
|
102
|
+
export default {
|
|
112
103
|
// backgroundColor is a THREE.Color to specify a color to fill the texture
|
|
113
104
|
// with, given there is no feature passed in parameter
|
|
114
105
|
createTextureFromFeature(collection, extent, sizeTexture, layerStyle, backgroundColor) {
|
|
@@ -176,5 +167,4 @@ var _default = {
|
|
|
176
167
|
}
|
|
177
168
|
return texture;
|
|
178
169
|
}
|
|
179
|
-
};
|
|
180
|
-
exports.default = _default;
|
|
170
|
+
};
|