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
|
@@ -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,33 +1,24 @@
|
|
|
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();
|
|
26
17
|
const normal = new THREE.Vector3();
|
|
27
|
-
const
|
|
28
|
-
const
|
|
18
|
+
const baseCoord = new THREE.Vector3();
|
|
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;
|
|
@@ -44,13 +35,6 @@ class FeatureMesh extends THREE.Group {
|
|
|
44
35
|
this.#collection = new THREE.Group().add(this.meshes);
|
|
45
36
|
this.#collection.quaternion.copy(collection.quaternion);
|
|
46
37
|
this.#collection.position.copy(collection.position);
|
|
47
|
-
if (collection.crs == 'EPSG:4978') {
|
|
48
|
-
normal.copy(collection.center.geodesicNormal);
|
|
49
|
-
} else {
|
|
50
|
-
normal.set(0, 0, 1);
|
|
51
|
-
}
|
|
52
|
-
normal.multiplyScalar(collection.center.z);
|
|
53
|
-
this.#collection.position.sub(normal);
|
|
54
38
|
this.#collection.scale.copy(collection.scale);
|
|
55
39
|
this.#collection.updateMatrix();
|
|
56
40
|
this.#originalCrs = collection.crs;
|
|
@@ -70,7 +54,7 @@ class FeatureMesh extends THREE.Group {
|
|
|
70
54
|
} else {
|
|
71
55
|
// calculate the scale transformation to transform the feature.extent
|
|
72
56
|
// to feature.extent.as(crs)
|
|
73
|
-
coord.crs =
|
|
57
|
+
coord.crs = Crs.formatToEPSG(this.#originalCrs);
|
|
74
58
|
extent.copy(this.extent).applyMatrix4(this.#collection.matrix);
|
|
75
59
|
extent.as(coord.crs, extent);
|
|
76
60
|
extent.spatialEuclideanDimensions(dim_ref);
|
|
@@ -88,7 +72,7 @@ class FeatureMesh extends THREE.Group {
|
|
|
88
72
|
|
|
89
73
|
// get method to calculate orientation
|
|
90
74
|
const crsInput = this.#originalCrs == 'EPSG:3857' ? crsWGS84 : this.#originalCrs;
|
|
91
|
-
const crs2crs =
|
|
75
|
+
const crs2crs = OrientationUtils.quaternionFromCRSToCRS(crsInput, crs);
|
|
92
76
|
// calculate orientation to crs
|
|
93
77
|
crs2crs(coord.as(crsWGS84), this.quaternion);
|
|
94
78
|
|
|
@@ -194,21 +178,27 @@ function featureToPoint(feature, options) {
|
|
|
194
178
|
if (feature.normals) {
|
|
195
179
|
normal.fromArray(feature.normals, v).multiply(inverseScale);
|
|
196
180
|
}
|
|
197
|
-
|
|
181
|
+
const localCoord = context.setLocalCoordinatesFromArray(feature.vertices, v);
|
|
198
182
|
style.setContext(context);
|
|
199
183
|
const {
|
|
200
184
|
base_altitude,
|
|
201
185
|
color,
|
|
202
186
|
radius
|
|
203
187
|
} = style.point;
|
|
204
|
-
coord.
|
|
205
|
-
if (
|
|
206
|
-
|
|
188
|
+
coord.copy(localCoord).applyMatrix4(context.collection.matrixWorld);
|
|
189
|
+
if (coord.crs == 'EPSG:4978') {
|
|
190
|
+
// altitude convertion from geocentered to elevation (from ground)
|
|
191
|
+
coord.as('EPSG:4326', coord);
|
|
207
192
|
}
|
|
208
193
|
|
|
209
|
-
//
|
|
210
|
-
|
|
194
|
+
// Calculate the new coordinates using the elevation shift (baseCoord)
|
|
195
|
+
baseCoord.copy(normal).multiplyScalar(base_altitude - coord.z).add(localCoord)
|
|
196
|
+
// and update the geometry buffer (vertices).
|
|
197
|
+
.toArray(vertices, v);
|
|
211
198
|
toColor(color).multiplyScalar(255).toArray(colors, v);
|
|
199
|
+
if (!pointMaterialSize.includes(radius)) {
|
|
200
|
+
pointMaterialSize.push(radius);
|
|
201
|
+
}
|
|
212
202
|
batchIds[j] = id;
|
|
213
203
|
}
|
|
214
204
|
featureId++;
|
|
@@ -233,7 +223,6 @@ function featureToLine(feature, options) {
|
|
|
233
223
|
let featureId = 0;
|
|
234
224
|
const vertices = new Float32Array(ptsIn.length);
|
|
235
225
|
const geom = new THREE.BufferGeometry();
|
|
236
|
-
geom.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
|
237
226
|
const lineMaterialWidth = [];
|
|
238
227
|
context.setFeature(feature);
|
|
239
228
|
const countIndices = (count - feature.geometries.length) * 2;
|
|
@@ -265,21 +254,27 @@ function featureToLine(feature, options) {
|
|
|
265
254
|
if (feature.normals) {
|
|
266
255
|
normal.fromArray(feature.normals, v).multiply(inverseScale);
|
|
267
256
|
}
|
|
268
|
-
|
|
257
|
+
const localCoord = context.setLocalCoordinatesFromArray(feature.vertices, v);
|
|
269
258
|
style.setContext(context);
|
|
270
259
|
const {
|
|
271
260
|
base_altitude,
|
|
272
261
|
color,
|
|
273
262
|
width
|
|
274
263
|
} = style.stroke;
|
|
275
|
-
coord.
|
|
276
|
-
if (
|
|
277
|
-
|
|
264
|
+
coord.copy(localCoord).applyMatrix4(context.collection.matrixWorld);
|
|
265
|
+
if (coord.crs == 'EPSG:4978') {
|
|
266
|
+
// altitude convertion from geocentered to elevation (from ground)
|
|
267
|
+
coord.as('EPSG:4326', coord);
|
|
278
268
|
}
|
|
279
269
|
|
|
280
|
-
//
|
|
281
|
-
|
|
270
|
+
// Calculate the new coordinates using the elevation shift (baseCoord)
|
|
271
|
+
baseCoord.copy(normal).multiplyScalar(base_altitude - coord.z).add(localCoord)
|
|
272
|
+
// and update the geometry buffer (vertices).
|
|
273
|
+
.toArray(vertices, v);
|
|
282
274
|
toColor(color).multiplyScalar(255).toArray(colors, v);
|
|
275
|
+
if (!lineMaterialWidth.includes(width)) {
|
|
276
|
+
lineMaterialWidth.push(width);
|
|
277
|
+
}
|
|
283
278
|
batchIds[j] = id;
|
|
284
279
|
}
|
|
285
280
|
featureId++;
|
|
@@ -289,6 +284,7 @@ function featureToLine(feature, options) {
|
|
|
289
284
|
// TODO CREATE material for each feature
|
|
290
285
|
console.warn('Too many differents stroke.width, only the first one will be used');
|
|
291
286
|
}
|
|
287
|
+
geom.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
|
292
288
|
geom.setAttribute('color', new THREE.BufferAttribute(colors, 3, true));
|
|
293
289
|
geom.setAttribute('batchId', new THREE.BufferAttribute(batchIds, 1));
|
|
294
290
|
geom.setIndex(new THREE.BufferAttribute(indices, 1));
|
|
@@ -320,23 +316,29 @@ function featureToPolygon(feature, options) {
|
|
|
320
316
|
if (feature.normals) {
|
|
321
317
|
normal.fromArray(feature.normals, i).multiply(inverseScale);
|
|
322
318
|
}
|
|
323
|
-
|
|
319
|
+
const localCoord = context.setLocalCoordinatesFromArray(feature.vertices, i);
|
|
324
320
|
style.setContext(context);
|
|
325
321
|
const {
|
|
326
322
|
base_altitude,
|
|
327
323
|
color
|
|
328
324
|
} = style.fill;
|
|
329
|
-
coord.
|
|
325
|
+
coord.copy(localCoord).applyMatrix4(context.collection.matrixWorld);
|
|
326
|
+
if (coord.crs == 'EPSG:4978') {
|
|
327
|
+
// altitude convertion from geocentered to elevation (from ground)
|
|
328
|
+
coord.as('EPSG:4326', coord);
|
|
329
|
+
}
|
|
330
330
|
|
|
331
|
-
//
|
|
332
|
-
|
|
333
|
-
|
|
331
|
+
// Calculate the new coordinates using the elevation shift (baseCoord)
|
|
332
|
+
baseCoord.copy(normal).multiplyScalar(base_altitude - coord.z).add(localCoord)
|
|
333
|
+
// and update the geometry buffer (vertices).
|
|
334
|
+
.toArray(vertices, i);
|
|
334
335
|
toColor(color).multiplyScalar(255).toArray(colors, i);
|
|
336
|
+
batchIds[b] = id;
|
|
335
337
|
}
|
|
336
338
|
featureId++;
|
|
337
339
|
const geomVertices = vertices.slice(start * 3, end * 3);
|
|
338
340
|
const holesOffsets = geometry.indices.map(i => i.offset - start).slice(1);
|
|
339
|
-
const triangles = (
|
|
341
|
+
const triangles = Earcut(geomVertices, holesOffsets, 3);
|
|
340
342
|
const startIndice = indices.length;
|
|
341
343
|
indices.length += triangles.length;
|
|
342
344
|
for (let i = 0; i < triangles.length; i++) {
|
|
@@ -386,21 +388,27 @@ function featureToExtrudedPolygon(feature, options) {
|
|
|
386
388
|
if (feature.normals) {
|
|
387
389
|
normal.fromArray(feature.normals, i).multiply(inverseScale);
|
|
388
390
|
}
|
|
389
|
-
|
|
391
|
+
const localCoord = context.setLocalCoordinatesFromArray(ptsIn, i);
|
|
390
392
|
style.setContext(context);
|
|
391
393
|
const {
|
|
392
394
|
base_altitude,
|
|
393
395
|
extrusion_height,
|
|
394
396
|
color
|
|
395
397
|
} = style.fill;
|
|
396
|
-
coord.
|
|
398
|
+
coord.copy(localCoord).applyMatrix4(context.collection.matrixWorld);
|
|
399
|
+
if (coord.crs == 'EPSG:4978') {
|
|
400
|
+
// altitude convertion from geocentered to elevation (from ground)
|
|
401
|
+
coord.as('EPSG:4326', coord);
|
|
402
|
+
}
|
|
397
403
|
|
|
398
|
-
//
|
|
399
|
-
|
|
404
|
+
// Calculate the new base coordinates using the elevation shift (baseCoord)
|
|
405
|
+
baseCoord.copy(normal).multiplyScalar(base_altitude - coord.z).add(localCoord)
|
|
406
|
+
// and update the geometry buffer (vertices).
|
|
407
|
+
.toArray(vertices, i);
|
|
400
408
|
batchIds[b] = id;
|
|
401
409
|
|
|
402
410
|
// populate top geometry buffers
|
|
403
|
-
|
|
411
|
+
topCoord.copy(normal).multiplyScalar(extrusion_height).add(baseCoord).toArray(vertices, t);
|
|
404
412
|
batchIds[b + totalVertices] = id;
|
|
405
413
|
|
|
406
414
|
// coloring base and top mesh
|
|
@@ -412,7 +420,7 @@ function featureToExtrudedPolygon(feature, options) {
|
|
|
412
420
|
featureId++;
|
|
413
421
|
const geomVertices = vertices.slice(startTop * 3, (end + totalVertices) * 3);
|
|
414
422
|
const holesOffsets = geometry.indices.map(i => i.offset - start).slice(1);
|
|
415
|
-
const triangles = (
|
|
423
|
+
const triangles = Earcut(geomVertices, holesOffsets, 3);
|
|
416
424
|
const startIndice = indices.length;
|
|
417
425
|
indices.length += triangles.length;
|
|
418
426
|
for (let i = 0; i < triangles.length; i++) {
|
|
@@ -494,7 +502,7 @@ function featureToMesh(feature, options) {
|
|
|
494
502
|
}
|
|
495
503
|
let mesh;
|
|
496
504
|
switch (feature.type) {
|
|
497
|
-
case
|
|
505
|
+
case FEATURE_TYPES.POINT:
|
|
498
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) {
|
|
499
507
|
try {
|
|
500
508
|
mesh = pointsToInstancedMeshes(feature);
|
|
@@ -506,10 +514,10 @@ function featureToMesh(feature, options) {
|
|
|
506
514
|
mesh = featureToPoint(feature, options);
|
|
507
515
|
}
|
|
508
516
|
break;
|
|
509
|
-
case
|
|
517
|
+
case FEATURE_TYPES.LINE:
|
|
510
518
|
mesh = featureToLine(feature, options);
|
|
511
519
|
break;
|
|
512
|
-
case
|
|
520
|
+
case FEATURE_TYPES.POLYGON:
|
|
513
521
|
if (style.fill && Object.keys(style.fill).includes('extrusion_height')) {
|
|
514
522
|
mesh = featureToExtrudedPolygon(feature, options);
|
|
515
523
|
} else {
|
|
@@ -529,7 +537,7 @@ function featureToMesh(feature, options) {
|
|
|
529
537
|
/**
|
|
530
538
|
* @module Feature2Mesh
|
|
531
539
|
*/
|
|
532
|
-
|
|
540
|
+
export default {
|
|
533
541
|
/**
|
|
534
542
|
* Return a function that converts [Features]{@link module:GeoJsonParser} to Meshes. Feature collection will be converted to a
|
|
535
543
|
* a THREE.Group.
|
|
@@ -567,7 +575,7 @@ var _default = {
|
|
|
567
575
|
*/
|
|
568
576
|
convert() {
|
|
569
577
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
570
|
-
|
|
578
|
+
deprecatedFeature2MeshOptions(options);
|
|
571
579
|
return function (collection) {
|
|
572
580
|
if (!collection) {
|
|
573
581
|
return;
|
|
@@ -575,16 +583,16 @@ var _default = {
|
|
|
575
583
|
if (!options.pointMaterial) {
|
|
576
584
|
// Opacity and wireframe refered with layer properties
|
|
577
585
|
// TODO: next step is move these properties to Style
|
|
578
|
-
options.pointMaterial = (
|
|
579
|
-
options.lineMaterial = (
|
|
580
|
-
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);
|
|
581
589
|
}
|
|
582
590
|
|
|
583
591
|
// In the case we didn't instanciate the layer (this) before the convert, we can pass
|
|
584
592
|
// style properties (@link StyleOptions) using options.style.
|
|
585
593
|
// This is usually done in some tests and if you want to use Feature2Mesh.convert()
|
|
586
594
|
// as in examples/source_file_gpx_3d.html.
|
|
587
|
-
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);
|
|
588
596
|
context.setCollection(collection);
|
|
589
597
|
const features = collection.features;
|
|
590
598
|
if (!features || features.length == 0) {
|
|
@@ -599,5 +607,4 @@ var _default = {
|
|
|
599
607
|
return featureNode;
|
|
600
608
|
};
|
|
601
609
|
}
|
|
602
|
-
};
|
|
603
|
-
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
|
+
};
|
|
@@ -1,24 +1,14 @@
|
|
|
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 THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _TileMesh = _interopRequireDefault(require("../Core/TileMesh"));
|
|
10
|
-
var _LayeredMaterial = _interopRequireDefault(require("../Renderer/LayeredMaterial"));
|
|
11
|
-
var _TileBuilder = _interopRequireDefault(require("../Core/Prefab/TileBuilder"));
|
|
12
|
-
var _ReferencingLayerProperties = _interopRequireDefault(require("../Layer/ReferencingLayerProperties"));
|
|
13
|
-
var _GeoidLayer = require("../Layer/GeoidLayer");
|
|
14
|
-
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); }
|
|
15
|
-
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; }
|
|
16
1
|
/*
|
|
17
2
|
* To change this license header, choose License Headers in Project Properties.
|
|
18
3
|
* To change this template file, choose Tools | Templates
|
|
19
4
|
* and open the template in the editor.
|
|
20
5
|
*/
|
|
21
|
-
|
|
6
|
+
import * as THREE from 'three';
|
|
7
|
+
import TileMesh from "../Core/TileMesh.js";
|
|
8
|
+
import LayeredMaterial from "../Renderer/LayeredMaterial.js";
|
|
9
|
+
import newTileGeometry from "../Core/Prefab/TileBuilder.js";
|
|
10
|
+
import ReferLayerProperties from "../Layer/ReferencingLayerProperties.js";
|
|
11
|
+
import { geoidLayerIsVisible } from "../Layer/GeoidLayer.js";
|
|
22
12
|
const dimensions = new THREE.Vector2();
|
|
23
13
|
function setTileFromTiledLayer(tile, tileLayer) {
|
|
24
14
|
if (tileLayer.diffuse) {
|
|
@@ -38,7 +28,7 @@ function setTileFromTiledLayer(tile, tileLayer) {
|
|
|
38
28
|
tile.horizonCullingPointElevationScaled = tile.horizonCullingPoint.clone();
|
|
39
29
|
}
|
|
40
30
|
}
|
|
41
|
-
|
|
31
|
+
export default {
|
|
42
32
|
convert(requester, extent, layer) {
|
|
43
33
|
const builder = layer.builder;
|
|
44
34
|
const parent = requester;
|
|
@@ -46,16 +36,17 @@ var _default = {
|
|
|
46
36
|
const paramsGeometry = {
|
|
47
37
|
extent,
|
|
48
38
|
level,
|
|
49
|
-
|
|
50
|
-
disableSkirt: layer.disableSkirt
|
|
39
|
+
segments: layer.segments || 16,
|
|
40
|
+
disableSkirt: layer.disableSkirt,
|
|
41
|
+
hideSkirt: layer.hideSkirt
|
|
51
42
|
};
|
|
52
|
-
return (
|
|
43
|
+
return newTileGeometry(builder, paramsGeometry).then(result => {
|
|
53
44
|
// build tile mesh
|
|
54
45
|
result.geometry._count++;
|
|
55
46
|
const crsCount = layer.tileMatrixSets.length;
|
|
56
|
-
const material = new
|
|
57
|
-
(
|
|
58
|
-
const tile = new
|
|
47
|
+
const material = new LayeredMaterial(layer.materialOptions, crsCount);
|
|
48
|
+
ReferLayerProperties(material, layer);
|
|
49
|
+
const tile = new TileMesh(result.geometry, material, layer, extent, level);
|
|
59
50
|
if (parent && parent.isTileMesh) {
|
|
60
51
|
// get parent extent transformation
|
|
61
52
|
const pTrans = builder.computeSharableExtent(parent.extent);
|
|
@@ -70,7 +61,7 @@ var _default = {
|
|
|
70
61
|
setTileFromTiledLayer(tile, layer);
|
|
71
62
|
if (parent) {
|
|
72
63
|
tile.geoidHeight = parent.geoidHeight;
|
|
73
|
-
const geoidHeight =
|
|
64
|
+
const geoidHeight = geoidLayerIsVisible(layer) ? tile.geoidHeight : 0;
|
|
74
65
|
tile.setBBoxZ({
|
|
75
66
|
min: parent.obb.z.min,
|
|
76
67
|
max: parent.obb.z.max,
|
|
@@ -81,5 +72,4 @@ var _default = {
|
|
|
81
72
|
return tile;
|
|
82
73
|
});
|
|
83
74
|
}
|
|
84
|
-
};
|
|
85
|
-
exports.default = _default;
|
|
75
|
+
};
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _Feature2Texture = _interopRequireDefault(require("./Feature2Texture"));
|
|
10
|
-
var _Extent = _interopRequireDefault(require("../Core/Geographic/Extent"));
|
|
11
|
-
var _Crs = _interopRequireDefault(require("../Core/Geographic/Crs"));
|
|
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
|
-
const extentTexture = new _Extent.default('EPSG:4326', [0, 0, 0, 0]);
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import Feature2Texture from "./Feature2Texture.js";
|
|
3
|
+
import Extent from "../Core/Geographic/Extent.js";
|
|
4
|
+
import CRS from "../Core/Geographic/Crs.js";
|
|
5
|
+
const extentTexture = new Extent('EPSG:4326', [0, 0, 0, 0]);
|
|
15
6
|
const textureLayer = (texture, layer) => {
|
|
16
7
|
texture.generateMipmaps = false;
|
|
17
8
|
texture.magFilter = layer.magFilter || THREE.LinearFilter;
|
|
@@ -23,14 +14,14 @@ function textureColorLayer(texture, layer) {
|
|
|
23
14
|
texture.premultiplyAlpha = layer.transparent;
|
|
24
15
|
return textureLayer(texture, layer);
|
|
25
16
|
}
|
|
26
|
-
|
|
17
|
+
export default {
|
|
27
18
|
convert(data, extentDestination, layer) {
|
|
28
19
|
let texture;
|
|
29
20
|
if (data.isFeatureCollection) {
|
|
30
21
|
const backgroundLayer = layer.source.backgroundLayer;
|
|
31
22
|
const backgroundColor = backgroundLayer && backgroundLayer.paint ? new THREE.Color(backgroundLayer.paint['background-color']) : undefined;
|
|
32
|
-
extentDestination.as(
|
|
33
|
-
texture =
|
|
23
|
+
extentDestination.as(CRS.formatToEPSG(layer.crs), extentTexture);
|
|
24
|
+
texture = Feature2Texture.createTextureFromFeature(data, extentTexture, 256, layer.style, backgroundColor);
|
|
34
25
|
texture.features = data;
|
|
35
26
|
texture.extent = extentDestination;
|
|
36
27
|
} else if (data.isTexture) {
|
|
@@ -50,5 +41,4 @@ var _default = {
|
|
|
50
41
|
return textureLayer(texture, layer);
|
|
51
42
|
}
|
|
52
43
|
}
|
|
53
|
-
};
|
|
54
|
-
exports.default = _default;
|
|
44
|
+
};
|