itowns 2.42.1-next.8 → 2.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +90 -0
- package/dist/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_widgets.js +1 -1
- package/dist/itowns_widgets.js.map +1 -1
- package/examples/{.eslintrc.js → .eslintrc.cjs} +1 -1
- package/examples/effects_stereo.html +2 -2
- package/examples/misc_collada.html +2 -2
- package/examples/source_stream_wfs_25d.html +11 -11
- package/examples/source_stream_wfs_3d.html +1 -1
- package/examples/view_25d_map.html +2 -2
- package/examples/view_3d_map.html +2 -2
- package/examples/view_3d_map_webxr.html +1 -1
- package/examples/view_3d_mns_map.html +2 -2
- package/examples/view_immersive.html +1 -1
- package/examples/view_multi_25d.html +2 -2
- package/examples/widgets_searchbar.html +2 -2
- package/lib/Controls/FirstPersonControls.js +5 -12
- package/lib/Controls/FlyControls.js +4 -13
- package/lib/Controls/GlobeControls.js +33 -43
- package/lib/Controls/PlanarControls.js +9 -20
- package/lib/Controls/StateControl.js +2 -11
- package/lib/Controls/StreetControls.js +14 -24
- package/lib/Converter/Feature2Mesh.js +28 -38
- package/lib/Converter/Feature2Texture.js +15 -25
- package/lib/Converter/convertToTile.js +16 -26
- package/lib/Converter/textureConverter.js +9 -19
- package/lib/Core/3DTiles/C3DTBatchTable.js +5 -13
- package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +1 -8
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +17 -27
- package/lib/Core/3DTiles/C3DTExtensions.js +1 -8
- package/lib/Core/3DTiles/C3DTFeature.js +3 -10
- package/lib/Core/3DTiles/C3DTilesEnums.js +3 -11
- package/lib/Core/3DTiles/C3DTileset.js +7 -16
- package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +5 -11
- package/lib/Core/AnimationPlayer.js +2 -11
- package/lib/Core/Deprecated/Undeprecator.js +9 -20
- package/lib/Core/EntwinePointTileNode.js +6 -16
- package/lib/Core/Feature.js +16 -30
- package/lib/Core/Geographic/CoordStars.js +3 -12
- package/lib/Core/Geographic/Coordinates.js +12 -22
- package/lib/Core/Geographic/Crs.js +7 -15
- package/lib/Core/Geographic/Extent.js +36 -47
- package/lib/Core/Geographic/GeoidGrid.js +6 -16
- package/lib/Core/Label.js +7 -17
- package/lib/Core/MainLoop.js +7 -16
- package/lib/Core/Math/Ellipsoid.js +6 -17
- package/lib/Core/Picking.js +10 -20
- package/lib/Core/PointCloudNode.js +2 -11
- package/lib/Core/PotreeNode.js +4 -13
- package/lib/Core/Prefab/Globe/Atmosphere.js +17 -26
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +6 -16
- package/lib/Core/Prefab/Globe/GlobeLayer.js +19 -28
- package/lib/Core/Prefab/Globe/SkyShader.js +2 -11
- package/lib/Core/Prefab/GlobeView.js +27 -45
- package/lib/Core/Prefab/Planar/PlanarLayer.js +11 -20
- package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +6 -16
- package/lib/Core/Prefab/PlanarView.js +10 -25
- package/lib/Core/Prefab/TileBuilder.js +13 -22
- package/lib/Core/Prefab/computeBufferTileGeometry.js +12 -16
- package/lib/Core/Scheduler/Cache.js +2 -10
- package/lib/Core/Scheduler/CancelledCommandException.js +1 -8
- package/lib/Core/Scheduler/Scheduler.js +15 -23
- package/lib/Core/Style.js +24 -38
- package/lib/Core/System/Capabilities.js +2 -13
- package/lib/Core/TileGeometry.js +13 -15
- package/lib/Core/TileMesh.js +6 -15
- package/lib/Core/View.js +43 -58
- package/lib/Layer/C3DTilesLayer.js +29 -41
- package/lib/Layer/ColorLayer.js +10 -16
- package/lib/Layer/ElevationLayer.js +7 -14
- package/lib/Layer/EntwinePointTileLayer.js +9 -18
- package/lib/Layer/FeatureGeometryLayer.js +9 -16
- package/lib/Layer/GeoidLayer.js +6 -15
- package/lib/Layer/GeometryLayer.js +11 -17
- package/lib/Layer/InfoLayer.js +5 -14
- package/lib/Layer/LabelLayer.js +22 -32
- package/lib/Layer/Layer.js +16 -26
- package/lib/Layer/LayerUpdateState.js +1 -8
- package/lib/Layer/LayerUpdateStrategy.js +7 -18
- package/lib/Layer/OrientedImageLayer.js +15 -25
- package/lib/Layer/PointCloudLayer.js +9 -19
- package/lib/Layer/PotreeLayer.js +8 -18
- package/lib/Layer/RasterLayer.js +9 -17
- package/lib/Layer/ReferencingLayerProperties.js +1 -8
- package/lib/Layer/TiledGeometryLayer.js +37 -33
- package/lib/Main.js +87 -708
- package/lib/MainBundle.js +4 -34
- package/lib/Parser/B3dmParser.js +80 -131
- package/lib/Parser/CameraCalibrationParser.js +5 -14
- package/lib/Parser/GDFParser.js +11 -22
- package/lib/Parser/GLTFParser.js +88 -0
- package/lib/Parser/GTXParser.js +9 -21
- package/lib/Parser/GeoJsonParser.js +14 -22
- package/lib/Parser/GpxParser.js +7 -14
- package/lib/Parser/ISGParser.js +19 -28
- package/lib/Parser/KMLParser.js +7 -14
- package/lib/Parser/LASLoader.js +20 -21
- package/lib/Parser/LASParser.js +6 -15
- package/lib/Parser/MapBoxUrlParser.js +2 -9
- package/lib/Parser/PntsParser.js +4 -14
- package/lib/Parser/PotreeBinParser.js +8 -16
- package/lib/Parser/PotreeCinParser.js +3 -12
- package/lib/Parser/ShapefileParser.js +11 -18
- package/lib/Parser/VectorTileParser.js +23 -31
- package/lib/Parser/XbilParser.js +5 -13
- package/lib/Parser/deprecated/LegacyGLTFLoader.js +2 -12
- package/lib/Process/3dTilesProcessing.js +14 -27
- package/lib/Process/FeatureProcessing.js +14 -22
- package/lib/Process/LayeredMaterialNodeProcessing.js +14 -26
- package/lib/Process/ObjectRemovalHelper.js +2 -9
- package/lib/Process/handlerNodeError.js +1 -7
- package/lib/Provider/3dTilesProvider.js +32 -29
- package/lib/Provider/DataSourceProvider.js +2 -9
- package/lib/Provider/Fetcher.js +40 -22
- package/lib/Provider/PointCloudProvider.js +7 -19
- package/lib/Provider/TileProvider.js +4 -12
- package/lib/Provider/URLBuilder.js +4 -12
- package/lib/Renderer/Camera.js +7 -17
- package/lib/Renderer/Color.js +3 -11
- package/lib/Renderer/ColorLayersOrdering.js +14 -22
- package/lib/Renderer/CommonMaterial.js +3 -12
- package/lib/Renderer/Label2DRenderer.js +5 -16
- package/lib/Renderer/LayeredMaterial.js +33 -53
- package/lib/Renderer/OBB.js +12 -21
- package/lib/Renderer/OrientedImageCamera.js +2 -11
- package/lib/Renderer/OrientedImageMaterial.js +17 -35
- package/lib/Renderer/PointsMaterial.js +37 -60
- package/lib/Renderer/RasterTile.js +16 -29
- package/lib/Renderer/RenderMode.js +2 -9
- package/lib/Renderer/Shader/ShaderChunk.js +5 -23
- package/lib/Renderer/Shader/ShaderUtils.js +2 -9
- package/lib/Renderer/SphereHelper.js +2 -11
- package/lib/Renderer/WebXR.js +2 -11
- package/lib/Renderer/c3DEngine.js +20 -53
- package/lib/Source/C3DTilesGoogleSource.js +76 -0
- package/lib/Source/C3DTilesIonSource.js +6 -13
- package/lib/Source/C3DTilesSource.js +5 -12
- package/lib/Source/EntwinePointTileSource.js +12 -19
- package/lib/Source/FileSource.js +7 -14
- package/lib/Source/OrientedImageSource.js +6 -14
- package/lib/Source/PotreeSource.js +9 -16
- package/lib/Source/Source.js +26 -39
- package/lib/Source/TMSSource.js +11 -22
- package/lib/Source/VectorTilesSource.js +75 -34
- package/lib/Source/WFSSource.js +7 -14
- package/lib/Source/WMSSource.js +5 -12
- package/lib/Source/WMTSSource.js +3 -10
- package/lib/ThreeExtended/capabilities/WebGL.js +1 -8
- package/lib/ThreeExtended/libs/ktx-parse.module.js +2 -256
- package/lib/ThreeExtended/libs/zstddec.module.js +2 -8
- package/lib/ThreeExtended/loaders/DDSLoader.js +10 -16
- package/lib/ThreeExtended/loaders/DRACOLoader.js +14 -19
- package/lib/ThreeExtended/loaders/GLTFLoader.js +124 -129
- package/lib/ThreeExtended/loaders/KTX2Loader.js +73 -78
- package/lib/ThreeExtended/utils/BufferGeometryUtils.js +40 -59
- package/lib/ThreeExtended/utils/WorkerPool.js +2 -9
- package/lib/Utils/CameraUtils.js +32 -44
- package/lib/Utils/DEMUtils.js +8 -19
- package/lib/Utils/FeaturesUtils.js +8 -16
- package/lib/Utils/Gradients.js +3 -12
- package/lib/Utils/OrientationUtils.js +8 -18
- package/lib/Utils/ThreeUtils.js +2 -9
- package/lib/Utils/gui/C3DTilesStyle.js +7 -15
- package/lib/Utils/gui/Main.js +7 -48
- package/lib/Utils/gui/Minimap.js +12 -20
- package/lib/Utils/gui/Navigation.js +6 -14
- package/lib/Utils/gui/Scale.js +11 -19
- package/lib/Utils/gui/Searchbar.js +5 -13
- package/lib/Utils/gui/Widget.js +1 -8
- package/lib/Utils/placeObjectOnGround.js +13 -23
- package/package.json +13 -8
package/lib/Layer/GeoidLayer.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
exports.geoidLayerIsVisible = geoidLayerIsVisible;
|
|
9
|
-
var _Layer = _interopRequireDefault(require("./Layer"));
|
|
10
|
-
var _LayerUpdateState = _interopRequireDefault(require("./LayerUpdateState"));
|
|
11
|
-
function geoidLayerIsVisible(tilelayer) {
|
|
1
|
+
import Layer from "./Layer.js";
|
|
2
|
+
import LayerUpdateState from "./LayerUpdateState.js";
|
|
3
|
+
export function geoidLayerIsVisible(tilelayer) {
|
|
12
4
|
var _tilelayer$attachedLa;
|
|
13
5
|
return tilelayer === null || tilelayer === void 0 ? void 0 : (_tilelayer$attachedLa = tilelayer.attachedLayers.filter(l => l.isGeoidLayer)[0]) === null || _tilelayer$attachedLa === void 0 ? void 0 : _tilelayer$attachedLa.visible;
|
|
14
6
|
}
|
|
@@ -28,7 +20,7 @@ function geoidLayerIsVisible(tilelayer) {
|
|
|
28
20
|
* }),
|
|
29
21
|
* });
|
|
30
22
|
*/
|
|
31
|
-
class GeoidLayer extends
|
|
23
|
+
class GeoidLayer extends Layer {
|
|
32
24
|
/**
|
|
33
25
|
* Creates a new instance of `GeoidLayer`.
|
|
34
26
|
*
|
|
@@ -68,7 +60,7 @@ class GeoidLayer extends _Layer.default {
|
|
|
68
60
|
return;
|
|
69
61
|
}
|
|
70
62
|
if (node.layerUpdateState[layer.id] === undefined) {
|
|
71
|
-
node.layerUpdateState[layer.id] = new
|
|
63
|
+
node.layerUpdateState[layer.id] = new LayerUpdateState();
|
|
72
64
|
const updateNodeZ = () => this.updateNodeZ(node);
|
|
73
65
|
layer.addEventListener('visible-property-changed', updateNodeZ);
|
|
74
66
|
node.addEventListener('dispose', () => {
|
|
@@ -86,5 +78,4 @@ class GeoidLayer extends _Layer.default {
|
|
|
86
78
|
});
|
|
87
79
|
}
|
|
88
80
|
}
|
|
89
|
-
|
|
90
|
-
exports.default = _default;
|
|
81
|
+
export default GeoidLayer;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import Layer from "./Layer.js";
|
|
2
|
+
import Picking from "../Core/Picking.js";
|
|
3
|
+
import { CACHE_POLICIES } from "../Core/Scheduler/Cache.js";
|
|
4
|
+
import ObjectRemovalHelper from "../Process/ObjectRemovalHelper.js";
|
|
2
5
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Layer = _interopRequireDefault(require("./Layer"));
|
|
9
|
-
var _Picking = _interopRequireDefault(require("../Core/Picking"));
|
|
10
|
-
var _Cache = require("../Core/Scheduler/Cache");
|
|
11
|
-
var _ObjectRemovalHelper = _interopRequireDefault(require("../Process/ObjectRemovalHelper"));
|
|
12
6
|
/**
|
|
13
7
|
* Fires when the opacity of the layer has changed.
|
|
14
8
|
* @event GeometryLayer#opacity-property-changed
|
|
15
9
|
*/
|
|
10
|
+
|
|
16
11
|
/**
|
|
17
12
|
* @property {boolean} isGeometryLayer - Used to checkout whether this layer is
|
|
18
13
|
* a GeometryLayer. Default is true. You should not change this, as it is used
|
|
@@ -23,7 +18,7 @@ var _ObjectRemovalHelper = _interopRequireDefault(require("../Process/ObjectRemo
|
|
|
23
18
|
* @property {number} [zoom.min=0] - this is the minimum zoom from which it'll be visible.
|
|
24
19
|
* This property is used only if the layer is attached to [TiledGeometryLayer]{@link TiledGeometryLayer}.
|
|
25
20
|
*/
|
|
26
|
-
class GeometryLayer extends
|
|
21
|
+
class GeometryLayer extends Layer {
|
|
27
22
|
/**
|
|
28
23
|
* A layer usually managing a geometry to display on a view. For example, it
|
|
29
24
|
* can be a layer of buildings extruded from a a WFS stream.
|
|
@@ -61,7 +56,7 @@ class GeometryLayer extends _Layer.default {
|
|
|
61
56
|
*/
|
|
62
57
|
constructor(id, object3d) {
|
|
63
58
|
let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
64
|
-
config.cacheLifeTime = config.cacheLifeTime ??
|
|
59
|
+
config.cacheLifeTime = config.cacheLifeTime ?? CACHE_POLICIES.GEOMETRY;
|
|
65
60
|
|
|
66
61
|
// Remove this part when Object.assign(this, config) will be removed from Layer Constructor
|
|
67
62
|
const visible = config.visible;
|
|
@@ -179,12 +174,12 @@ class GeometryLayer extends _Layer.default {
|
|
|
179
174
|
|
|
180
175
|
// if Layer is attached
|
|
181
176
|
if (this.parent) {
|
|
182
|
-
|
|
177
|
+
ObjectRemovalHelper.removeChildrenAndCleanupRecursively(this, this.parent.object3d);
|
|
183
178
|
}
|
|
184
179
|
if (this.object3d.parent) {
|
|
185
180
|
this.object3d.parent.remove(this.object3d);
|
|
186
181
|
}
|
|
187
|
-
|
|
182
|
+
ObjectRemovalHelper.removeChildrenAndCleanupRecursively(this, this.object3d);
|
|
188
183
|
}
|
|
189
184
|
|
|
190
185
|
/**
|
|
@@ -203,8 +198,7 @@ class GeometryLayer extends _Layer.default {
|
|
|
203
198
|
pickObjectsAt(view, coordinates) {
|
|
204
199
|
let radius = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.options.defaultPickingRadius;
|
|
205
200
|
let target = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
206
|
-
return
|
|
201
|
+
return Picking.pickObjectsAt(view, coordinates, radius, this.object3d, target);
|
|
207
202
|
}
|
|
208
203
|
}
|
|
209
|
-
|
|
210
|
-
exports.default = _default;
|
|
204
|
+
export default GeometryLayer;
|
package/lib/Layer/InfoLayer.js
CHANGED
|
@@ -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 = exports.InfoTiledGeometryLayer = void 0;
|
|
8
|
-
var _Extent = _interopRequireDefault(require("../Core/Geographic/Extent"));
|
|
9
|
-
class InfoLayer {
|
|
1
|
+
import Extent from "../Core/Geographic/Extent.js";
|
|
2
|
+
export default class InfoLayer {
|
|
10
3
|
constructor(layer) {
|
|
11
4
|
this.layer = layer;
|
|
12
5
|
}
|
|
@@ -28,8 +21,7 @@ class InfoLayer {
|
|
|
28
21
|
* @property {Extent} displayed.extent - {@link Extent} of displayed tiles.
|
|
29
22
|
* @property {Set} displayed.tiles - Set of displayed tiles.
|
|
30
23
|
*/
|
|
31
|
-
|
|
32
|
-
class InfoTiledGeometryLayer extends InfoLayer {
|
|
24
|
+
export class InfoTiledGeometryLayer extends InfoLayer {
|
|
33
25
|
constructor(tiledGeometryLayer) {
|
|
34
26
|
super(tiledGeometryLayer);
|
|
35
27
|
this.displayed = {
|
|
@@ -47,7 +39,7 @@ class InfoTiledGeometryLayer extends InfoLayer {
|
|
|
47
39
|
});
|
|
48
40
|
Object.defineProperty(this.displayed, 'extent', {
|
|
49
41
|
get: () => {
|
|
50
|
-
const extent = new
|
|
42
|
+
const extent = new Extent(this.layer.extent.crs, Infinity, -Infinity, Infinity, -Infinity);
|
|
51
43
|
extent.min = +Infinity;
|
|
52
44
|
extent.max = -Infinity;
|
|
53
45
|
this.displayed.tiles.forEach(tile => {
|
|
@@ -69,5 +61,4 @@ class InfoTiledGeometryLayer extends InfoLayer {
|
|
|
69
61
|
this.displayed.tiles.delete(tile);
|
|
70
62
|
}
|
|
71
63
|
}
|
|
72
|
-
}
|
|
73
|
-
exports.InfoTiledGeometryLayer = InfoTiledGeometryLayer;
|
|
64
|
+
}
|
package/lib/Layer/LabelLayer.js
CHANGED
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _Label = _interopRequireDefault(require("../Core/Label"));
|
|
15
|
-
var _Feature = require("../Core/Feature");
|
|
16
|
-
var _Style = require("../Core/Style");
|
|
17
|
-
var _Label2DRenderer = require("../Renderer/Label2DRenderer");
|
|
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 context = new _Style.StyleContext();
|
|
21
|
-
const coord = new _Coordinates.default('EPSG:4326', 0, 0, 0);
|
|
22
|
-
const _extent = new _Extent.default('EPSG:4326', 0, 0, 0, 0);
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import LayerUpdateState from "./LayerUpdateState.js";
|
|
3
|
+
import ObjectRemovalHelper from "../Process/ObjectRemovalHelper.js";
|
|
4
|
+
import GeometryLayer from "./GeometryLayer.js";
|
|
5
|
+
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
6
|
+
import Extent from "../Core/Geographic/Extent.js";
|
|
7
|
+
import Label from "../Core/Label.js";
|
|
8
|
+
import { FEATURE_TYPES } from "../Core/Feature.js";
|
|
9
|
+
import { readExpression, StyleContext } from "../Core/Style.js";
|
|
10
|
+
import { ScreenGrid } from "../Renderer/Label2DRenderer.js";
|
|
11
|
+
const context = new StyleContext();
|
|
12
|
+
const coord = new Coordinates('EPSG:4326', 0, 0, 0);
|
|
13
|
+
const _extent = new Extent('EPSG:4326', 0, 0, 0, 0);
|
|
23
14
|
const nodeDimensions = new THREE.Vector2();
|
|
24
15
|
const westNorthNode = new THREE.Vector2();
|
|
25
16
|
const labelPosition = new THREE.Vector2();
|
|
@@ -147,8 +138,8 @@ class LabelsNode extends THREE.Group {
|
|
|
147
138
|
* LabelLayer. Default is true. You should not change this, as it is used
|
|
148
139
|
* internally for optimisation.
|
|
149
140
|
*/
|
|
150
|
-
class LabelLayer extends
|
|
151
|
-
#filterGrid = new
|
|
141
|
+
class LabelLayer extends GeometryLayer {
|
|
142
|
+
#filterGrid = new ScreenGrid();
|
|
152
143
|
/**
|
|
153
144
|
* @constructor
|
|
154
145
|
* @extends Layer
|
|
@@ -242,7 +233,7 @@ class LabelLayer extends _GeometryLayer.default {
|
|
|
242
233
|
data.features.forEach(f => {
|
|
243
234
|
var _f$style, _f$style$text, _f$style2, _f$style2$point;
|
|
244
235
|
// TODO: add support for LINE and POLYGON
|
|
245
|
-
if (f.type !==
|
|
236
|
+
if (f.type !== FEATURE_TYPES.POINT) {
|
|
246
237
|
return;
|
|
247
238
|
}
|
|
248
239
|
context.setFeature(f);
|
|
@@ -269,14 +260,14 @@ class LabelLayer extends _GeometryLayer.default {
|
|
|
269
260
|
this.style.setContext(context);
|
|
270
261
|
const layerField = this.style.text && this.style.text.field;
|
|
271
262
|
if (this.labelDomelement) {
|
|
272
|
-
content =
|
|
263
|
+
content = readExpression(this.labelDomelement, context);
|
|
273
264
|
} else if (!geometryField && !featureField && !layerField) {
|
|
274
265
|
// Check if there is an icon, with no text
|
|
275
266
|
if (!(g.properties.style && (g.properties.style.icon.source || g.properties.style.icon.key)) && !(f.style && f.style.icon && (f.style.icon.source || f.style.icon.key)) && !(this.style.icon && (this.style.icon.source || this.style.icon.key))) {
|
|
276
267
|
return;
|
|
277
268
|
}
|
|
278
269
|
}
|
|
279
|
-
const label = new
|
|
270
|
+
const label = new Label(content, coord.clone(), this.style);
|
|
280
271
|
label.layerId = this.id;
|
|
281
272
|
label.padding = this.margin || label.padding;
|
|
282
273
|
labels.push(label);
|
|
@@ -355,7 +346,7 @@ class LabelLayer extends _GeometryLayer.default {
|
|
|
355
346
|
update(context, layer, node, parent) {
|
|
356
347
|
if (!parent && node.link[layer.id]) {
|
|
357
348
|
// if node has been removed dispose three.js resource
|
|
358
|
-
|
|
349
|
+
ObjectRemovalHelper.removeChildrenAndCleanupRecursively(this, node);
|
|
359
350
|
return;
|
|
360
351
|
}
|
|
361
352
|
const labelsNode = node.link[layer.id] || new LabelsNode(node);
|
|
@@ -372,7 +363,7 @@ class LabelLayer extends _GeometryLayer.default {
|
|
|
372
363
|
return this.#disallowToRendering(labelsNode);
|
|
373
364
|
}
|
|
374
365
|
if (node.layerUpdateState[this.id] === undefined) {
|
|
375
|
-
node.layerUpdateState[this.id] = new
|
|
366
|
+
node.layerUpdateState[this.id] = new LayerUpdateState();
|
|
376
367
|
}
|
|
377
368
|
if (!this.source.extentInsideLimit(node.extent, zoomDest)) {
|
|
378
369
|
node.layerUpdateState[this.id].noMoreUpdatePossible();
|
|
@@ -404,7 +395,7 @@ class LabelLayer extends _GeometryLayer.default {
|
|
|
404
395
|
// Clean if there isnt' parent
|
|
405
396
|
if (!node.parent) {
|
|
406
397
|
labels.forEach(l => {
|
|
407
|
-
|
|
398
|
+
ObjectRemovalHelper.removeChildrenAndCleanupRecursively(this, l);
|
|
408
399
|
renderer.removeLabelDOM(l);
|
|
409
400
|
});
|
|
410
401
|
return;
|
|
@@ -468,5 +459,4 @@ class LabelLayer extends _GeometryLayer.default {
|
|
|
468
459
|
this.parent.level0Nodes.forEach(obj => this.removeLabelsFromNodeRecursive(obj));
|
|
469
460
|
}
|
|
470
461
|
}
|
|
471
|
-
|
|
472
|
-
exports.default = _default;
|
|
462
|
+
export default LabelLayer;
|
package/lib/Layer/Layer.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { STRATEGY_MIN_NETWORK_TRAFFIC } from "./LayerUpdateStrategy.js";
|
|
3
|
+
import InfoLayer from "./InfoLayer.js";
|
|
4
|
+
import Source from "../Source/Source.js";
|
|
5
|
+
import Cache from "../Core/Scheduler/Cache.js";
|
|
6
|
+
import Style from "../Core/Style.js";
|
|
2
7
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.ImageryLayers = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _LayerUpdateStrategy = require("./LayerUpdateStrategy");
|
|
10
|
-
var _InfoLayer = _interopRequireDefault(require("./InfoLayer"));
|
|
11
|
-
var _Source = _interopRequireDefault(require("../Source/Source"));
|
|
12
|
-
var _Cache = _interopRequireDefault(require("../Core/Scheduler/Cache"));
|
|
13
|
-
var _Style = _interopRequireDefault(require("../Core/Style"));
|
|
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
8
|
/**
|
|
17
9
|
* @property {boolean} isLayer - Used to checkout whether this layer is a Layer.
|
|
18
10
|
* Default is true. You should not change this, as it is used internally for
|
|
@@ -107,7 +99,7 @@ class Layer extends THREE.EventDispatcher {
|
|
|
107
99
|
}
|
|
108
100
|
super();
|
|
109
101
|
this.isLayer = true;
|
|
110
|
-
if (config.style && !(config.style instanceof
|
|
102
|
+
if (config.style && !(config.style instanceof Style)) {
|
|
111
103
|
var _config$style$fill;
|
|
112
104
|
if (typeof ((_config$style$fill = config.style.fill) === null || _config$style$fill === void 0 ? void 0 : _config$style$fill.pattern) === 'string') {
|
|
113
105
|
console.warn('Using style.fill.pattern = { source: Img|url } is adviced');
|
|
@@ -115,9 +107,9 @@ class Layer extends THREE.EventDispatcher {
|
|
|
115
107
|
source: config.style.fill.pattern
|
|
116
108
|
};
|
|
117
109
|
}
|
|
118
|
-
config.style = new
|
|
110
|
+
config.style = new Style(config.style);
|
|
119
111
|
}
|
|
120
|
-
this.style = config.style || new
|
|
112
|
+
this.style = config.style || new Style();
|
|
121
113
|
Object.assign(this, config);
|
|
122
114
|
Object.defineProperty(this, 'id', {
|
|
123
115
|
value: id,
|
|
@@ -127,7 +119,7 @@ class Layer extends THREE.EventDispatcher {
|
|
|
127
119
|
this.options = config.options || {};
|
|
128
120
|
if (!this.updateStrategy) {
|
|
129
121
|
this.updateStrategy = {
|
|
130
|
-
type:
|
|
122
|
+
type: STRATEGY_MIN_NETWORK_TRAFFIC,
|
|
131
123
|
options: {}
|
|
132
124
|
};
|
|
133
125
|
}
|
|
@@ -146,8 +138,8 @@ class Layer extends THREE.EventDispatcher {
|
|
|
146
138
|
min: 0
|
|
147
139
|
};
|
|
148
140
|
}
|
|
149
|
-
this.info = new
|
|
150
|
-
this.source = this.source || new
|
|
141
|
+
this.info = new InfoLayer(this);
|
|
142
|
+
this.source = this.source || new Source({
|
|
151
143
|
url: 'none'
|
|
152
144
|
});
|
|
153
145
|
this.ready = false;
|
|
@@ -163,7 +155,7 @@ class Layer extends THREE.EventDispatcher {
|
|
|
163
155
|
return this;
|
|
164
156
|
});
|
|
165
157
|
this._promises.push(this.source.whenReady);
|
|
166
|
-
this.cache = new
|
|
158
|
+
this.cache = new Cache(config.cacheLifeTime);
|
|
167
159
|
this.mergeFeatures = this.mergeFeatures === undefined ? true : config.mergeFeatures;
|
|
168
160
|
|
|
169
161
|
// TODO: verify but this.source.filter seems be always undefined.
|
|
@@ -267,9 +259,8 @@ class Layer extends THREE.EventDispatcher {
|
|
|
267
259
|
console.warn('Function delete doesn\'t exist for this layer');
|
|
268
260
|
}
|
|
269
261
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
const ImageryLayers = {
|
|
262
|
+
export default Layer;
|
|
263
|
+
export const ImageryLayers = {
|
|
273
264
|
// move this to new index
|
|
274
265
|
// After the modification :
|
|
275
266
|
// * the minimum sequence will always be 0
|
|
@@ -308,5 +299,4 @@ const ImageryLayers = {
|
|
|
308
299
|
copy.sort((a, b) => a.sequence - b.sequence);
|
|
309
300
|
return copy.map(l => l.id);
|
|
310
301
|
}
|
|
311
|
-
};
|
|
312
|
-
exports.ImageryLayers = ImageryLayers;
|
|
302
|
+
};
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
1
|
const UPDATE_STATE = {
|
|
8
2
|
IDLE: 0,
|
|
9
3
|
PENDING: 1,
|
|
@@ -92,5 +86,4 @@ class LayerUpdateState {
|
|
|
92
86
|
return this.state == UPDATE_STATE.DEFINITIVE_ERROR || this.state == UPDATE_STATE.ERROR;
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
|
-
|
|
96
|
-
exports.default = _default;
|
|
89
|
+
export default LayerUpdateState;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.STRATEGY_PROGRESSIVE = exports.STRATEGY_MIN_NETWORK_TRAFFIC = exports.STRATEGY_GROUP = exports.STRATEGY_DICHOTOMY = void 0;
|
|
7
|
-
exports.chooseNextLevelToFetch = chooseNextLevelToFetch;
|
|
8
|
-
var _RasterTile = require("../Renderer/RasterTile");
|
|
1
|
+
import { EMPTY_TEXTURE_ZOOM } from "../Renderer/RasterTile.js";
|
|
9
2
|
/**
|
|
10
3
|
* This modules implements various layer update strategies.
|
|
11
4
|
*
|
|
@@ -13,14 +6,10 @@ var _RasterTile = require("../Renderer/RasterTile");
|
|
|
13
6
|
* to reduce the amount of network traffic.
|
|
14
7
|
*/
|
|
15
8
|
|
|
16
|
-
const STRATEGY_MIN_NETWORK_TRAFFIC = 0;
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const STRATEGY_PROGRESSIVE = 2;
|
|
21
|
-
exports.STRATEGY_PROGRESSIVE = STRATEGY_PROGRESSIVE;
|
|
22
|
-
const STRATEGY_DICHOTOMY = 3;
|
|
23
|
-
exports.STRATEGY_DICHOTOMY = STRATEGY_DICHOTOMY;
|
|
9
|
+
export const STRATEGY_MIN_NETWORK_TRAFFIC = 0;
|
|
10
|
+
export const STRATEGY_GROUP = 1;
|
|
11
|
+
export const STRATEGY_PROGRESSIVE = 2;
|
|
12
|
+
export const STRATEGY_DICHOTOMY = 3;
|
|
24
13
|
function _minimizeNetworkTraffic(node, nodeLevel, currentLevel, source) {
|
|
25
14
|
// TO DO source.isVectorTileSource is a temp fix for pendingSubdivision.
|
|
26
15
|
// see issue https://github.com/iTowns/itowns/issues/2214
|
|
@@ -49,12 +38,12 @@ function _progressive(nodeLevel, currentLevel, options) {
|
|
|
49
38
|
// tiles thanks to caching.
|
|
50
39
|
function _dichotomy(nodeLevel, currentLevel) {
|
|
51
40
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
52
|
-
if (currentLevel ==
|
|
41
|
+
if (currentLevel == EMPTY_TEXTURE_ZOOM) {
|
|
53
42
|
return options.zoom ? options.zoom.min : 0;
|
|
54
43
|
}
|
|
55
44
|
return Math.min(nodeLevel, Math.ceil((currentLevel + nodeLevel) / 2));
|
|
56
45
|
}
|
|
57
|
-
function chooseNextLevelToFetch(strategy, node) {
|
|
46
|
+
export function chooseNextLevelToFetch(strategy, node) {
|
|
58
47
|
let nodeLevel = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : node.level;
|
|
59
48
|
let currentLevel = arguments.length > 3 ? arguments[3] : undefined;
|
|
60
49
|
let layer = arguments.length > 4 ? arguments[4] : undefined;
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _GeometryLayer = _interopRequireDefault(require("./GeometryLayer"));
|
|
10
|
-
var _OrientedImageMaterial = _interopRequireDefault(require("../Renderer/OrientedImageMaterial"));
|
|
11
|
-
var _GeoJsonParser = _interopRequireDefault(require("../Parser/GeoJsonParser"));
|
|
12
|
-
var _CameraCalibrationParser = _interopRequireDefault(require("../Parser/CameraCalibrationParser"));
|
|
13
|
-
var _Coordinates = _interopRequireDefault(require("../Core/Geographic/Coordinates"));
|
|
14
|
-
var _OrientationUtils = _interopRequireDefault(require("../Utils/OrientationUtils"));
|
|
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; }
|
|
17
|
-
const coord = new _Coordinates.default('EPSG:4978', 0, 0, 0);
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import GeometryLayer from "./GeometryLayer.js";
|
|
3
|
+
import OrientedImageMaterial from "../Renderer/OrientedImageMaterial.js";
|
|
4
|
+
import GeoJsonParser from "../Parser/GeoJsonParser.js";
|
|
5
|
+
import CameraCalibrationParser from "../Parser/CameraCalibrationParser.js";
|
|
6
|
+
import Coordinates from "../Core/Geographic/Coordinates.js";
|
|
7
|
+
import OrientationUtils from "../Utils/OrientationUtils.js";
|
|
8
|
+
const coord = new Coordinates('EPSG:4978', 0, 0, 0);
|
|
18
9
|
const commandCancellation = cmd => cmd.requester.id !== cmd.layer.currentPano.id;
|
|
19
10
|
function updatePano(context, camera, layer) {
|
|
20
11
|
const newPano = layer.mostNearPano(camera.position);
|
|
@@ -89,7 +80,7 @@ function createBackground(radius) {
|
|
|
89
80
|
* It creates an {@link OrientedImageMaterial} used to do projective texture mapping on the scene.
|
|
90
81
|
* @extends GeometryLayer
|
|
91
82
|
*/
|
|
92
|
-
class OrientedImageLayer extends
|
|
83
|
+
class OrientedImageLayer extends GeometryLayer {
|
|
93
84
|
/**
|
|
94
85
|
* @constructor
|
|
95
86
|
* @param { string } id - The id of the layer, a unique name.
|
|
@@ -138,14 +129,14 @@ class OrientedImageLayer extends _GeometryLayer.default {
|
|
|
138
129
|
|
|
139
130
|
// panos is an array of feature point, representing many panoramics.
|
|
140
131
|
// for each point, there is a position and a quaternion attribute.
|
|
141
|
-
this.source.whenReady.then(metadata =>
|
|
132
|
+
this.source.whenReady.then(metadata => GeoJsonParser.parse(config.orientation || metadata.orientation, options).then(orientation => {
|
|
142
133
|
this.panos = orientation.features;
|
|
143
134
|
|
|
144
135
|
// the crs input is parsed in geojson parser
|
|
145
136
|
// and returned in options.in
|
|
146
137
|
const crsIn = options.in.crs;
|
|
147
138
|
const crsOut = config.crs;
|
|
148
|
-
const crs2crs =
|
|
139
|
+
const crs2crs = OrientationUtils.quaternionFromCRSToCRS(crsIn, crsOut);
|
|
149
140
|
const quat = new THREE.Quaternion();
|
|
150
141
|
|
|
151
142
|
// add position and quaternion attributes from point feature
|
|
@@ -158,16 +149,16 @@ class OrientedImageLayer extends _GeometryLayer.default {
|
|
|
158
149
|
|
|
159
150
|
// set quaternion
|
|
160
151
|
crs2crs(coord, quat);
|
|
161
|
-
pano.quaternion =
|
|
152
|
+
pano.quaternion = OrientationUtils.quaternionFromAttitude(pano.geometries[0].properties).premultiply(quat);
|
|
162
153
|
pano.id = pano.geometries[0].properties.id;
|
|
163
154
|
pano.index = i++;
|
|
164
155
|
}
|
|
165
156
|
}).then(() => {
|
|
166
157
|
// array of cameras, represent the projective texture configuration for each panoramic.
|
|
167
|
-
|
|
158
|
+
CameraCalibrationParser.parse(config.calibration || metadata.calibration, config).then(cameras => {
|
|
168
159
|
this.cameras = cameras;
|
|
169
160
|
// create the material
|
|
170
|
-
this.material = new
|
|
161
|
+
this.material = new OrientedImageMaterial(this.cameras, config);
|
|
171
162
|
resolve();
|
|
172
163
|
});
|
|
173
164
|
}));
|
|
@@ -228,5 +219,4 @@ class OrientedImageLayer extends _GeometryLayer.default {
|
|
|
228
219
|
return nearPano;
|
|
229
220
|
}
|
|
230
221
|
}
|
|
231
|
-
|
|
232
|
-
exports.default = _default;
|
|
222
|
+
export default OrientedImageLayer;
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _GeometryLayer = _interopRequireDefault(require("./GeometryLayer"));
|
|
10
|
-
var _PointsMaterial = _interopRequireWildcard(require("../Renderer/PointsMaterial"));
|
|
11
|
-
var _Picking = _interopRequireDefault(require("../Core/Picking"));
|
|
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 GeometryLayer from "./GeometryLayer.js";
|
|
3
|
+
import PointsMaterial, { PNTS_MODE } from "../Renderer/PointsMaterial.js";
|
|
4
|
+
import Picking from "../Core/Picking.js";
|
|
14
5
|
const point = new THREE.Vector3();
|
|
15
6
|
const bboxMesh = new THREE.Mesh();
|
|
16
7
|
const box3 = new THREE.Box3();
|
|
@@ -126,7 +117,7 @@ function changeAngleRange(layer) {
|
|
|
126
117
|
* layer. Changing this value will affect the material, if it has the
|
|
127
118
|
* corresponding uniform. The value is normalized between 0 and 1.
|
|
128
119
|
*/
|
|
129
|
-
class PointCloudLayer extends
|
|
120
|
+
class PointCloudLayer extends GeometryLayer {
|
|
130
121
|
/**
|
|
131
122
|
* Constructs a new instance of point cloud layer.
|
|
132
123
|
* Constructs a new instance of a Point Cloud Layer. This should not be used
|
|
@@ -173,10 +164,10 @@ class PointCloudLayer extends _GeometryLayer.default {
|
|
|
173
164
|
config.material.intensityRange = new THREE.Vector2(this.minIntensityRange, this.maxIntensityRange);
|
|
174
165
|
config.material.elevationRange = new THREE.Vector2(this.minElevationRange, this.maxElevationRange);
|
|
175
166
|
config.material.angleRange = new THREE.Vector2(this.minAngleRange, this.maxAngleRange);
|
|
176
|
-
this.material = new
|
|
167
|
+
this.material = new PointsMaterial(config.material);
|
|
177
168
|
}
|
|
178
169
|
this.material.defines = this.material.defines || {};
|
|
179
|
-
this.mode = config.mode ||
|
|
170
|
+
this.mode = config.mode || PNTS_MODE.COLOR;
|
|
180
171
|
}
|
|
181
172
|
preUpdate(context, changeSources) {
|
|
182
173
|
// See https://cesiumjs.org/hosted-apps/massiveworlds/downloads/Ring/WorldScaleTerrainRendering.pptx
|
|
@@ -350,7 +341,7 @@ class PointCloudLayer extends _GeometryLayer.default {
|
|
|
350
341
|
}
|
|
351
342
|
pickObjectsAt(view, mouse, radius) {
|
|
352
343
|
let target = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
353
|
-
return
|
|
344
|
+
return Picking.pickPointsAt(view, mouse, radius, this, target);
|
|
354
345
|
}
|
|
355
346
|
getObjectToUpdateForAttachedLayers(meta) {
|
|
356
347
|
if (meta.obj) {
|
|
@@ -368,5 +359,4 @@ class PointCloudLayer extends _GeometryLayer.default {
|
|
|
368
359
|
}
|
|
369
360
|
}
|
|
370
361
|
}
|
|
371
|
-
|
|
372
|
-
exports.default = _default;
|
|
362
|
+
export default PointCloudLayer;
|
package/lib/Layer/PotreeLayer.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var THREE = _interopRequireWildcard(require("three"));
|
|
9
|
-
var _PointCloudLayer = _interopRequireDefault(require("./PointCloudLayer"));
|
|
10
|
-
var _PotreeNode = _interopRequireDefault(require("../Core/PotreeNode"));
|
|
11
|
-
var _Extent = _interopRequireDefault(require("../Core/Geographic/Extent"));
|
|
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 PointCloudLayer from "./PointCloudLayer.js";
|
|
3
|
+
import PotreeNode from "../Core/PotreeNode.js";
|
|
4
|
+
import Extent from "../Core/Geographic/Extent.js";
|
|
14
5
|
const bboxMesh = new THREE.Mesh();
|
|
15
6
|
const box3 = new THREE.Box3();
|
|
16
7
|
bboxMesh.geometry.boundingBox = box3;
|
|
@@ -20,7 +11,7 @@ bboxMesh.geometry.boundingBox = box3;
|
|
|
20
11
|
* is a PotreeLayer. Default is `true`. You should not change this, as it is
|
|
21
12
|
* used internally for optimisation.
|
|
22
13
|
*/
|
|
23
|
-
class PotreeLayer extends
|
|
14
|
+
class PotreeLayer extends PointCloudLayer {
|
|
24
15
|
/**
|
|
25
16
|
* Constructs a new instance of Potree layer.
|
|
26
17
|
*
|
|
@@ -64,13 +55,12 @@ class PotreeLayer extends _PointCloudLayer.default {
|
|
|
64
55
|
this.material.defines[normal] = 1;
|
|
65
56
|
}
|
|
66
57
|
this.supportsProgressiveDisplay = this.source.extension === 'cin';
|
|
67
|
-
this.root = new
|
|
58
|
+
this.root = new PotreeNode(0, 0, this);
|
|
68
59
|
this.root.bbox.min.set(cloud.boundingBox.lx, cloud.boundingBox.ly, cloud.boundingBox.lz);
|
|
69
60
|
this.root.bbox.max.set(cloud.boundingBox.ux, cloud.boundingBox.uy, cloud.boundingBox.uz);
|
|
70
|
-
this.extent =
|
|
61
|
+
this.extent = Extent.fromBox3(this.source.crs || 'EPSG:4326', this.root.bbox);
|
|
71
62
|
return this.root.loadOctree().then(resolve);
|
|
72
63
|
});
|
|
73
64
|
}
|
|
74
65
|
}
|
|
75
|
-
|
|
76
|
-
exports.default = _default;
|
|
66
|
+
export default PotreeLayer;
|
package/lib/Layer/RasterLayer.js
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _Layer = _interopRequireDefault(require("./Layer"));
|
|
9
|
-
var _LayeredMaterialNodeProcessing = require("../Process/LayeredMaterialNodeProcessing");
|
|
10
|
-
var _textureConverter = _interopRequireDefault(require("../Converter/textureConverter"));
|
|
11
|
-
var _Cache = require("../Core/Scheduler/Cache");
|
|
12
|
-
class RasterLayer extends _Layer.default {
|
|
1
|
+
import Layer from "./Layer.js";
|
|
2
|
+
import { removeLayeredMaterialNodeLayer } from "../Process/LayeredMaterialNodeProcessing.js";
|
|
3
|
+
import textureConverter from "../Converter/textureConverter.js";
|
|
4
|
+
import { CACHE_POLICIES } from "../Core/Scheduler/Cache.js";
|
|
5
|
+
class RasterLayer extends Layer {
|
|
13
6
|
constructor(id, config) {
|
|
14
|
-
config.cacheLifeTime = config.cacheLifeTime ??
|
|
7
|
+
config.cacheLifeTime = config.cacheLifeTime ?? CACHE_POLICIES.TEXTURE;
|
|
15
8
|
super(id, config);
|
|
16
9
|
}
|
|
17
10
|
convert(data, extentDestination) {
|
|
18
|
-
return
|
|
11
|
+
return textureConverter.convert(data, extentDestination, this);
|
|
19
12
|
}
|
|
20
13
|
|
|
21
14
|
/**
|
|
@@ -27,9 +20,8 @@ class RasterLayer extends _Layer.default {
|
|
|
27
20
|
this.cache.clear();
|
|
28
21
|
}
|
|
29
22
|
for (const root of this.parent.level0Nodes) {
|
|
30
|
-
root.traverse(
|
|
23
|
+
root.traverse(removeLayeredMaterialNodeLayer(this.id));
|
|
31
24
|
}
|
|
32
25
|
}
|
|
33
26
|
}
|
|
34
|
-
|
|
35
|
-
exports.default = _default;
|
|
27
|
+
export default RasterLayer;
|