itowns 2.44.3-next.9 → 2.45.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.
Files changed (214) hide show
  1. package/README.md +3 -129
  2. package/examples/3dtiles_loader.html +20 -6
  3. package/examples/config.json +1 -0
  4. package/examples/copc_simple_loader.html +15 -5
  5. package/examples/effects_stereo.html +2 -2
  6. package/examples/entwine_3d_loader.html +3 -1
  7. package/examples/entwine_simple_loader.html +1 -1
  8. package/examples/images/itowns_logo.svg +123 -0
  9. package/examples/js/plugins/COGParser.js +1 -1
  10. package/examples/jsm/OGC3DTilesHelper.js +6 -1
  11. package/examples/layers/JSONLayers/GeoidMNT.json +3 -1
  12. package/examples/misc_collada.html +2 -2
  13. package/examples/source_file_geojson_3d.html +0 -1
  14. package/examples/source_file_kml_raster_usgs.html +0 -1
  15. package/examples/source_stream_wfs_raster.html +0 -7
  16. package/examples/vector_tile_mapbox_raster.html +91 -0
  17. package/examples/view_3d_map_webxr.html +3 -1
  18. package/examples/view_multi_25d.html +2 -2
  19. package/package.json +21 -75
  20. package/CODING.md +0 -120
  21. package/CONTRIBUTING.md +0 -150
  22. package/CONTRIBUTORS.md +0 -55
  23. package/LICENSE.md +0 -44
  24. package/changelog.md +0 -1361
  25. package/dist/455.js +0 -2
  26. package/dist/455.js.map +0 -1
  27. package/dist/debug.js +0 -3
  28. package/dist/debug.js.LICENSE.txt +0 -13
  29. package/dist/debug.js.map +0 -1
  30. package/dist/itowns.js +0 -3
  31. package/dist/itowns.js.LICENSE.txt +0 -7
  32. package/dist/itowns.js.map +0 -1
  33. package/dist/itowns_lasparser.js +0 -2
  34. package/dist/itowns_lasparser.js.map +0 -1
  35. package/dist/itowns_lasworker.js +0 -2
  36. package/dist/itowns_lasworker.js.map +0 -1
  37. package/dist/itowns_potree2worker.js +0 -2
  38. package/dist/itowns_potree2worker.js.map +0 -1
  39. package/dist/itowns_widgets.js +0 -2
  40. package/dist/itowns_widgets.js.map +0 -1
  41. package/examples/.eslintrc.cjs +0 -35
  42. package/examples/jsm/.eslintrc.cjs +0 -38
  43. package/lib/Controls/FirstPersonControls.js +0 -308
  44. package/lib/Controls/FlyControls.js +0 -175
  45. package/lib/Controls/GlobeControls.js +0 -1162
  46. package/lib/Controls/PlanarControls.js +0 -1025
  47. package/lib/Controls/StateControl.js +0 -429
  48. package/lib/Controls/StreetControls.js +0 -392
  49. package/lib/Converter/Feature2Mesh.js +0 -615
  50. package/lib/Converter/Feature2Texture.js +0 -170
  51. package/lib/Converter/convertToTile.js +0 -75
  52. package/lib/Converter/textureConverter.js +0 -44
  53. package/lib/Core/3DTiles/C3DTBatchTable.js +0 -131
  54. package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.js +0 -96
  55. package/lib/Core/3DTiles/C3DTBoundingVolume.js +0 -157
  56. package/lib/Core/3DTiles/C3DTExtensions.js +0 -97
  57. package/lib/Core/3DTiles/C3DTFeature.js +0 -110
  58. package/lib/Core/3DTiles/C3DTilesEnums.js +0 -20
  59. package/lib/Core/3DTiles/C3DTileset.js +0 -99
  60. package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.js +0 -100
  61. package/lib/Core/AnimationPlayer.js +0 -142
  62. package/lib/Core/CopcNode.js +0 -174
  63. package/lib/Core/Deprecated/Undeprecator.js +0 -75
  64. package/lib/Core/EntwinePointTileNode.js +0 -126
  65. package/lib/Core/Feature.js +0 -490
  66. package/lib/Core/Geographic/CoordStars.js +0 -80
  67. package/lib/Core/Geographic/Coordinates.js +0 -320
  68. package/lib/Core/Geographic/Crs.js +0 -175
  69. package/lib/Core/Geographic/Extent.js +0 -534
  70. package/lib/Core/Geographic/GeoidGrid.js +0 -109
  71. package/lib/Core/Label.js +0 -222
  72. package/lib/Core/MainLoop.js +0 -211
  73. package/lib/Core/Math/Ellipsoid.js +0 -144
  74. package/lib/Core/Picking.js +0 -255
  75. package/lib/Core/PointCloudNode.js +0 -42
  76. package/lib/Core/Potree2Node.js +0 -206
  77. package/lib/Core/Potree2PointAttributes.js +0 -139
  78. package/lib/Core/PotreeNode.js +0 -101
  79. package/lib/Core/Prefab/Globe/Atmosphere.js +0 -299
  80. package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +0 -110
  81. package/lib/Core/Prefab/Globe/GlobeLayer.js +0 -145
  82. package/lib/Core/Prefab/Globe/SkyShader.js +0 -78
  83. package/lib/Core/Prefab/GlobeView.js +0 -161
  84. package/lib/Core/Prefab/Planar/PlanarLayer.js +0 -53
  85. package/lib/Core/Prefab/Planar/PlanarTileBuilder.js +0 -72
  86. package/lib/Core/Prefab/PlanarView.js +0 -62
  87. package/lib/Core/Prefab/TileBuilder.js +0 -80
  88. package/lib/Core/Prefab/computeBufferTileGeometry.js +0 -183
  89. package/lib/Core/Scheduler/Cache.js +0 -256
  90. package/lib/Core/Scheduler/CancelledCommandException.js +0 -15
  91. package/lib/Core/Scheduler/Scheduler.js +0 -294
  92. package/lib/Core/Style.js +0 -1121
  93. package/lib/Core/System/Capabilities.js +0 -63
  94. package/lib/Core/Tile/Tile.js +0 -219
  95. package/lib/Core/Tile/TileGrid.js +0 -46
  96. package/lib/Core/TileGeometry.js +0 -40
  97. package/lib/Core/TileMesh.js +0 -109
  98. package/lib/Core/View.js +0 -1109
  99. package/lib/Layer/C3DTilesLayer.js +0 -456
  100. package/lib/Layer/ColorLayer.js +0 -128
  101. package/lib/Layer/CopcLayer.js +0 -58
  102. package/lib/Layer/ElevationLayer.js +0 -107
  103. package/lib/Layer/EntwinePointTileLayer.js +0 -64
  104. package/lib/Layer/FeatureGeometryLayer.js +0 -63
  105. package/lib/Layer/GeoidLayer.js +0 -80
  106. package/lib/Layer/GeometryLayer.js +0 -202
  107. package/lib/Layer/InfoLayer.js +0 -64
  108. package/lib/Layer/LabelLayer.js +0 -456
  109. package/lib/Layer/Layer.js +0 -304
  110. package/lib/Layer/LayerUpdateState.js +0 -89
  111. package/lib/Layer/LayerUpdateStrategy.js +0 -80
  112. package/lib/Layer/OGC3DTilesLayer.js +0 -412
  113. package/lib/Layer/OrientedImageLayer.js +0 -222
  114. package/lib/Layer/PointCloudLayer.js +0 -359
  115. package/lib/Layer/Potree2Layer.js +0 -164
  116. package/lib/Layer/PotreeLayer.js +0 -65
  117. package/lib/Layer/RasterLayer.js +0 -27
  118. package/lib/Layer/ReferencingLayerProperties.js +0 -62
  119. package/lib/Layer/TiledGeometryLayer.js +0 -403
  120. package/lib/Loader/LASLoader.js +0 -193
  121. package/lib/Loader/Potree2BrotliLoader.js +0 -261
  122. package/lib/Loader/Potree2Loader.js +0 -207
  123. package/lib/Main.js +0 -115
  124. package/lib/MainBundle.js +0 -4
  125. package/lib/Parser/B3dmParser.js +0 -174
  126. package/lib/Parser/CameraCalibrationParser.js +0 -94
  127. package/lib/Parser/GDFParser.js +0 -72
  128. package/lib/Parser/GTXParser.js +0 -75
  129. package/lib/Parser/GeoJsonParser.js +0 -212
  130. package/lib/Parser/GpxParser.js +0 -25
  131. package/lib/Parser/ISGParser.js +0 -71
  132. package/lib/Parser/KMLParser.js +0 -25
  133. package/lib/Parser/LASParser.js +0 -137
  134. package/lib/Parser/MapBoxUrlParser.js +0 -83
  135. package/lib/Parser/PntsParser.js +0 -131
  136. package/lib/Parser/Potree2BinParser.js +0 -92
  137. package/lib/Parser/PotreeBinParser.js +0 -106
  138. package/lib/Parser/PotreeCinParser.js +0 -29
  139. package/lib/Parser/ShapefileParser.js +0 -78
  140. package/lib/Parser/VectorTileParser.js +0 -202
  141. package/lib/Parser/XbilParser.js +0 -119
  142. package/lib/Parser/deprecated/LegacyGLTFLoader.js +0 -1386
  143. package/lib/Parser/iGLTFLoader.js +0 -168
  144. package/lib/Process/3dTilesProcessing.js +0 -304
  145. package/lib/Process/FeatureProcessing.js +0 -76
  146. package/lib/Process/LayeredMaterialNodeProcessing.js +0 -221
  147. package/lib/Process/ObjectRemovalHelper.js +0 -97
  148. package/lib/Process/handlerNodeError.js +0 -23
  149. package/lib/Provider/3dTilesProvider.js +0 -149
  150. package/lib/Provider/DataSourceProvider.js +0 -8
  151. package/lib/Provider/Fetcher.js +0 -229
  152. package/lib/Provider/PointCloudProvider.js +0 -45
  153. package/lib/Provider/TileProvider.js +0 -16
  154. package/lib/Provider/URLBuilder.js +0 -116
  155. package/lib/Renderer/Camera.js +0 -281
  156. package/lib/Renderer/Color.js +0 -56
  157. package/lib/Renderer/ColorLayersOrdering.js +0 -115
  158. package/lib/Renderer/CommonMaterial.js +0 -31
  159. package/lib/Renderer/Label2DRenderer.js +0 -190
  160. package/lib/Renderer/LayeredMaterial.js +0 -243
  161. package/lib/Renderer/OBB.js +0 -153
  162. package/lib/Renderer/OrientedImageCamera.js +0 -118
  163. package/lib/Renderer/OrientedImageMaterial.js +0 -167
  164. package/lib/Renderer/PointsMaterial.js +0 -485
  165. package/lib/Renderer/RasterTile.js +0 -209
  166. package/lib/Renderer/RenderMode.js +0 -31
  167. package/lib/Renderer/Shader/ShaderChunk.js +0 -160
  168. package/lib/Renderer/Shader/ShaderUtils.js +0 -47
  169. package/lib/Renderer/SphereHelper.js +0 -23
  170. package/lib/Renderer/WebXR.js +0 -51
  171. package/lib/Renderer/c3DEngine.js +0 -214
  172. package/lib/Source/C3DTilesGoogleSource.js +0 -74
  173. package/lib/Source/C3DTilesIonSource.js +0 -54
  174. package/lib/Source/C3DTilesSource.js +0 -30
  175. package/lib/Source/CopcSource.js +0 -115
  176. package/lib/Source/EntwinePointTileSource.js +0 -62
  177. package/lib/Source/FileSource.js +0 -189
  178. package/lib/Source/OGC3DTilesGoogleSource.js +0 -29
  179. package/lib/Source/OGC3DTilesIonSource.js +0 -34
  180. package/lib/Source/OGC3DTilesSource.js +0 -21
  181. package/lib/Source/OrientedImageSource.js +0 -59
  182. package/lib/Source/Potree2Source.js +0 -167
  183. package/lib/Source/PotreeSource.js +0 -82
  184. package/lib/Source/Source.js +0 -223
  185. package/lib/Source/TMSSource.js +0 -145
  186. package/lib/Source/VectorTilesSource.js +0 -178
  187. package/lib/Source/WFSSource.js +0 -168
  188. package/lib/Source/WMSSource.js +0 -133
  189. package/lib/Source/WMTSSource.js +0 -86
  190. package/lib/ThreeExtended/capabilities/WebGL.js +0 -69
  191. package/lib/ThreeExtended/libs/ktx-parse.module.js +0 -470
  192. package/lib/ThreeExtended/libs/zstddec.module.js +0 -29
  193. package/lib/ThreeExtended/loaders/DDSLoader.js +0 -200
  194. package/lib/ThreeExtended/loaders/DRACOLoader.js +0 -399
  195. package/lib/ThreeExtended/loaders/GLTFLoader.js +0 -2876
  196. package/lib/ThreeExtended/loaders/KTX2Loader.js +0 -625
  197. package/lib/ThreeExtended/utils/BufferGeometryUtils.js +0 -846
  198. package/lib/ThreeExtended/utils/WorkerPool.js +0 -70
  199. package/lib/Utils/CameraUtils.js +0 -555
  200. package/lib/Utils/DEMUtils.js +0 -350
  201. package/lib/Utils/FeaturesUtils.js +0 -156
  202. package/lib/Utils/Gradients.js +0 -16
  203. package/lib/Utils/OrientationUtils.js +0 -457
  204. package/lib/Utils/ThreeUtils.js +0 -115
  205. package/lib/Utils/gui/C3DTilesStyle.js +0 -215
  206. package/lib/Utils/gui/Main.js +0 -7
  207. package/lib/Utils/gui/Minimap.js +0 -154
  208. package/lib/Utils/gui/Navigation.js +0 -245
  209. package/lib/Utils/gui/Scale.js +0 -107
  210. package/lib/Utils/gui/Searchbar.js +0 -234
  211. package/lib/Utils/gui/Widget.js +0 -80
  212. package/lib/Utils/placeObjectOnGround.js +0 -137
  213. package/lib/Worker/LASLoaderWorker.js +0 -19
  214. package/lib/Worker/Potree2Worker.js +0 -21
@@ -1,107 +0,0 @@
1
- import RasterLayer from "./RasterLayer.js";
2
- import { updateLayeredMaterialNodeElevation } from "../Process/LayeredMaterialNodeProcessing.js";
3
- import { RasterElevationTile } from "../Renderer/RasterTile.js";
4
-
5
- /**
6
- * @property {boolean} isElevationLayer - Used to checkout whether this layer is
7
- * an ElevationLayer. Default is true. You should not change this, as it is used
8
- * internally for optimisation.
9
- * @property {number} noDataValue - Used to specify a **null** or **no data value** in the elevation terrain.
10
- * @property {number} [zmin] - Used to specify a minimum value for the elevation terrain (if the data goes lower, it will be clamped).
11
- * @property {number} [zmax] - Used to specify a maximum value for the elevation terrain (if the data goes higher, it will be clamped)
12
- * @property {number} scale - Used to apply a scale on the elevation value. It
13
- * can be used for exageration of the elevation, like in [this
14
- * example](https://www.itowns-project.org/itowns/examples/#plugins_pyramidal_tiff).
15
- * @property {boolean} useColorTextureElevation - the elevation is computed with one color texture channel,
16
- * `this.colorTextureElevationMaxZ` and `this.colorTextureElevationMinZ`.
17
- *
18
- * The formula is:
19
- *
20
- * ```js
21
- * elevation = color.r * (this.colorTextureElevationMaxZ - this.colorTextureElevationMinZ) + this.colorTextureElevationMinZ
22
- * ```
23
- * @property {number} colorTextureElevationMinZ - elevation minimum in `useColorTextureElevation` mode.
24
- * @property {number} colorTextureElevationMaxZ - elevation maximum in `useColorTextureElevation` mode.
25
- */
26
- class ElevationLayer extends RasterLayer {
27
- /**
28
- * A simple layer, managing an elevation texture to add some reliefs on the
29
- * plane or globe view for example.
30
- *
31
- * @extends Layer
32
- *
33
- * @param {string} id - The id of the layer, that should be unique. It is
34
- * not mandatory, but an error will be emitted if this layer is added a
35
- * {@link View} that already has a layer going by that id.
36
- * @param {Object} [config] - Optional configuration, all elements in it
37
- * will be merged as is in the layer. For example, if the configuration
38
- * contains three elements `name, protocol, extent`, these elements will be
39
- * available using `layer.name` or something else depending on the property
40
- * name.
41
- * @param {number} [config.noDataValue] The value coding the noData in the data set
42
- * @param {Object} [config.clampValues] - Optional information for clamping
43
- * the elevation between a minimum and a maximum value
44
- * @param {number} [config.clampValues.min] The minimum value to clamp the elevation
45
- * @param {number} [config.clampValues.max] The maximum value to clamp the elevation
46
- *
47
- * @example
48
- * // Create an ElevationLayer
49
- * const elevation = new ElevationLayer('IGN_MNT', {
50
- * source: new WMTSSource({
51
- * "url": "https://data.geopf.fr/wmts?",
52
- * "crs": "EPSG:4326",
53
- * "format": "image/x-bil;bits=32",
54
- * "name": "ELEVATION.ELEVATIONGRIDCOVERAGE",
55
- * }),
56
- * });
57
- *
58
- * // Add the layer
59
- * view.addLayer(elevation);
60
- */
61
- constructor(id) {
62
- let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
63
- super(id, config);
64
- if (config.zmin || config.zmax) {
65
- console.warn('Config using zmin and zmax are deprecated, use {clampValues: {min, max}} structure.');
66
- }
67
- this.zmin = config.clampValues?.min ?? config.zmin;
68
- this.zmax = config.clampValues?.max ?? config.zmax;
69
- this.isElevationLayer = true;
70
- this.defineLayerProperty('scale', this.scale || 1.0);
71
- }
72
-
73
- /**
74
- * Setup RasterElevationTile added to TileMesh. This RasterElevationTile handles
75
- * the elevation texture to displace TileMesh vertices.
76
- *
77
- * @param {TileMesh} node The node to apply new RasterElevationTile;
78
- * @return {RasterElevationTile} The raster elevation node added.
79
- */
80
- setupRasterNode(node) {
81
- const rasterElevationNode = new RasterElevationTile(node.material, this);
82
- node.material.addLayer(rasterElevationNode);
83
- node.material.setSequenceElevation(this.id);
84
- // bounding box initialisation
85
- const updateBBox = () => node.setBBoxZ({
86
- min: rasterElevationNode.min,
87
- max: rasterElevationNode.max,
88
- scale: this.scale
89
- });
90
- updateBBox();
91
-
92
- // listen elevation updating
93
- rasterElevationNode.addEventListener('rasterElevationLevelChanged', updateBBox);
94
-
95
- // listen scaling elevation updating
96
- this.addEventListener('scale-property-changed', updateBBox);
97
- // remove scaling elevation updating if node is removed
98
- node.addEventListener('dispose', () => {
99
- this.removeEventListener('scale-property-changed', updateBBox);
100
- });
101
- return rasterElevationNode;
102
- }
103
- update(context, layer, node, parent) {
104
- return updateLayeredMaterialNodeElevation(context, this, node, parent);
105
- }
106
- }
107
- export default ElevationLayer;
@@ -1,64 +0,0 @@
1
- import * as THREE from 'three';
2
- import EntwinePointTileNode from "../Core/EntwinePointTileNode.js";
3
- import PointCloudLayer from "./PointCloudLayer.js";
4
- import Extent from "../Core/Geographic/Extent.js";
5
- const bboxMesh = new THREE.Mesh();
6
- const box3 = new THREE.Box3();
7
- bboxMesh.geometry.boundingBox = box3;
8
-
9
- /**
10
- * @property {boolean} isEntwinePointTileLayer - Used to checkout whether this
11
- * layer is a EntwinePointTileLayer. Default is `true`. You should not change
12
- * this, as it is used internally for optimisation.
13
- */
14
- class EntwinePointTileLayer extends PointCloudLayer {
15
- /**
16
- * Constructs a new instance of Entwine Point Tile layer.
17
- *
18
- * @extends PointCloudLayer
19
- *
20
- * @example
21
- * // Create a new point cloud layer
22
- * const points = new EntwinePointTileLayer('EPT',
23
- * {
24
- * source: new EntwinePointTileSource({
25
- * url: 'https://server.geo/ept-dataset',
26
- * }
27
- * });
28
- *
29
- * View.prototype.addLayer.call(view, points);
30
- *
31
- * @param {string} id - The id of the layer, that should be unique. It is
32
- * not mandatory, but an error will be emitted if this layer is added a
33
- * {@link View} that already has a layer going by that id.
34
- * @param {Object} config - Configuration, all elements in it
35
- * will be merged as is in the layer. For example, if the configuration
36
- * contains three elements `name, protocol, extent`, these elements will be
37
- * available using `layer.name` or something else depending on the property
38
- * name. See the list of properties to know which one can be specified.
39
- * @param {string} [config.crs=ESPG:4326] - The CRS of the {@link View} this
40
- * layer will be attached to. This is used to determine the extent of this
41
- * layer. Default to `EPSG:4326`.
42
- * @param {number} [config.skip=1] - Read one point from every `skip` points
43
- * - see {@link LASParser}.
44
- */
45
- constructor(id, config) {
46
- super(id, config);
47
- this.isEntwinePointTileLayer = true;
48
- this.scale = new THREE.Vector3(1, 1, 1);
49
- const resolve = this.addInitializationStep();
50
- this.whenReady = this.source.whenReady.then(() => {
51
- this.root = new EntwinePointTileNode(0, 0, 0, 0, this, -1);
52
- this.root.bbox.min.fromArray(this.source.boundsConforming, 0);
53
- this.root.bbox.max.fromArray(this.source.boundsConforming, 3);
54
- this.minElevationRange = this.source.boundsConforming[2];
55
- this.maxElevationRange = this.source.boundsConforming[5];
56
- this.extent = Extent.fromBox3(config.crs || 'EPSG:4326', this.root.bbox);
57
- return this.root.loadOctree().then(resolve);
58
- });
59
- }
60
- get spacing() {
61
- return this.source.spacing;
62
- }
63
- }
64
- export default EntwinePointTileLayer;
@@ -1,63 +0,0 @@
1
- import { Group } from 'three';
2
- import GeometryLayer from "./GeometryLayer.js";
3
- import FeatureProcessing from "../Process/FeatureProcessing.js";
4
- import Feature2Mesh from "../Converter/Feature2Mesh.js";
5
-
6
- /**
7
- * `FeatureGeometryLayer` displays geographic vector data (geojson, kml...) in object 3D.
8
- * `FeatureGeometryLayer` is a pre-configured `GeometryLayer` to load and convert vector data.
9
- * In deed, `GeometryLayer` allows customizing data loading (`update` method)
10
- * and their conversion (`convert` method),
11
- *
12
- * @property {boolean} isFeatureGeometryLayer - Used to checkout whether this layer is
13
- * a FeatureGeometryLayer. Default is true. You should not change this, as it is used
14
- * internally for optimisation.
15
- */
16
- class FeatureGeometryLayer extends GeometryLayer {
17
- /**
18
- * @extends GeometryLayer
19
- *
20
- * @param {string} id - The id of the layer, that should be unique. It is
21
- * not mandatory, but an error will be emitted if this layer is added a
22
- * {@link View} that already has a layer going by that id.
23
- * @param {Object} [options] - Optional configuration, all elements in it
24
- * will be merged as is in the layer.
25
- * @param {function} [options.batchId] - optional function to create batchId attribute.
26
- * It is passed the feature property and the feature index.
27
- * As the batchId is using an unsigned int structure on 32 bits, the batchId could be between 0 and 4,294,967,295.
28
- * @param {THREE.Object3D} [options.object3d=new THREE.Group()] root object3d layer.
29
- * @param {function} [options.onMeshCreated] this callback is called when the mesh is created. The callback parameters are the
30
- * `mesh` and the `context`.
31
- * @param {boolean} [options.accurate=TRUE] If `accurate` is `true`, data are re-projected with maximum geographical accuracy.
32
- * With `true`, `proj4` is used to transform data source.
33
- *
34
- * If `accurate` is `false`, re-projecting is faster but less accurate.
35
- * With `false`, an affine transformation is used to transform data source.
36
- * This method is an approximation. The error increases with the extent
37
- * dimension of the object or queries.
38
- *
39
- * For example :
40
- * * for a **100** meter dimension, there's a difference of **0.001** meter with the accurate method
41
- * * for a **500** meter dimension, there's a difference of **0.05** meter with the accurate method
42
- * * for a **20000** meter dimension, there's a difference of **40** meter with the accurate method
43
- *
44
- * **WARNING** If the source is `VectorTilesSource` then `accurate` is always false.
45
- */
46
- constructor(id) {
47
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
48
- options.update = FeatureProcessing.update;
49
- options.convert = Feature2Mesh.convert({
50
- batchId: options.batchId
51
- });
52
- super(id, options.object3d || new Group(), options);
53
- this.isFeatureGeometryLayer = true;
54
- this.accurate = options.accurate ?? true;
55
- this.buildExtent = !this.accurate;
56
- }
57
- preUpdate(context, sources) {
58
- if (sources.has(this.parent)) {
59
- this.object3d.clear();
60
- }
61
- }
62
- }
63
- export default FeatureGeometryLayer;
@@ -1,80 +0,0 @@
1
- import Layer from "./Layer.js";
2
- import LayerUpdateState from "./LayerUpdateState.js";
3
- export function geoidLayerIsVisible(tilelayer) {
4
- return tilelayer?.attachedLayers.filter(l => l.isGeoidLayer)[0]?.visible;
5
- }
6
-
7
- /**
8
- * `GeoidLayer` is a specific `{@link Layer}` which supports geoid height data. When added to a `{@link View}`, it
9
- * vertically translates each of the view's tiles by a proper geoid height value. For a given tile, the geoid height
10
- * value used for translation is the geoid height computed at the center of the tile.
11
- *
12
- * @example
13
- * // Create a GeoidLayer from a GTX geoid heights file.
14
- * const geoidLayer = new GeoidLayer('geoid', {
15
- * source: new FileSource({
16
- * url: 'url-to-some-GTX-geoid-heights-file.gtx',
17
- * crs: 'EPSG:4326',
18
- * format: 'application/gtx',
19
- * }),
20
- * });
21
- */
22
- class GeoidLayer extends Layer {
23
- /**
24
- * Creates a new instance of `GeoidLayer`.
25
- *
26
- * @param {string} id An unique identifier for the layer.
27
- * @param {Object} config The layer configuration. All elements in it will be merged as is in the
28
- * layer. For example, if the configuration contains three elements `name,
29
- * protocol, extent`, these elements will be available using `layer.name` or
30
- * something else depending on the property name. Only `config.source`
31
- * parameter is mandatory.
32
- * @param {Object} config.source The source of the geoid data displayed by the `GeoidLayer`. It is mandatory
33
- * that the source data for a `GeoidLayer` be parsed into a
34
- * `{@link GeoidGrid}`. You can refer to `{@link GTXParser}`,
35
- * `{@link GDFParser}` and `{@link ISGParser}` to see how three standard
36
- * geoid height grid file formats are parsed into `{@link GeoidGrid}`.
37
- */
38
- constructor(id) {
39
- let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
40
- super(id, config);
41
- this.isGeoidLayer = true;
42
- this.defineLayerProperty('visible', true);
43
- }
44
- updateNodeZ(node) {
45
- node.material.geoidHeight = this.visible ? node.geoidHeight : 0;
46
- node.obb.updateZ({
47
- geoidHeight: node.material.geoidHeight
48
- });
49
- }
50
- update(context, layer, node, parent) {
51
- if (!parent || !node.material) {
52
- return;
53
- }
54
-
55
- // Don't update tile if its zoom is not within the layer's zoom limits
56
- const extentsDestination = node.getExtentsByProjection(layer.crs);
57
- const zoom = extentsDestination[0].zoom;
58
- if (zoom > layer.zoom.max || zoom < layer.zoom.min) {
59
- return;
60
- }
61
- if (node.layerUpdateState[layer.id] === undefined) {
62
- node.layerUpdateState[layer.id] = new LayerUpdateState();
63
- const updateNodeZ = () => this.updateNodeZ(node);
64
- layer.addEventListener('visible-property-changed', updateNodeZ);
65
- node.addEventListener('dispose', () => {
66
- layer.removeEventListener('visible-property-changed', updateNodeZ);
67
- });
68
- }
69
- if (layer.frozen || !layer.visible || !node.material.visible || !node.layerUpdateState[layer.id].canTryUpdate()) {
70
- return;
71
- }
72
- node.layerUpdateState[layer.id].newTry();
73
- return this.getData(node.extent, extentsDestination).then(result => {
74
- node.geoidHeight = result.getHeightAtCoordinates(node.extent.center());
75
- this.updateNodeZ(node);
76
- node.layerUpdateState[layer.id].noMoreUpdatePossible();
77
- });
78
- }
79
- }
80
- export default GeoidLayer;
@@ -1,202 +0,0 @@
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";
5
-
6
- /**
7
- * Fires when the opacity of the layer has changed.
8
- * @event GeometryLayer#opacity-property-changed
9
- */
10
-
11
- /**
12
- * @property {boolean} isGeometryLayer - Used to checkout whether this layer is
13
- * a GeometryLayer. Default is true. You should not change this, as it is used
14
- * internally for optimisation.
15
- * @property {number} [zoom.max=Infinity] - this is the maximum zoom beyond which it'll be hidden.
16
- * The `max` is constant and the value is `Infinity` because there's no maximum display level after which it is hidden.
17
- * This property is used only if the layer is attached to {@link TiledGeometryLayer}.
18
- * @property {number} [zoom.min=0] - this is the minimum zoom from which it'll be visible.
19
- * This property is used only if the layer is attached to {@link TiledGeometryLayer}.
20
- */
21
- class GeometryLayer extends Layer {
22
- /**
23
- * A layer usually managing a geometry to display on a view. For example, it
24
- * can be a layer of buildings extruded from a a WFS stream.
25
- *
26
- * @extends Layer
27
- *
28
- * @param {string} id - The id of the layer, that should be unique. It is
29
- * not mandatory, but an error will be emitted if this layer is added a
30
- * {@link View} that already has a layer going by that id.
31
- * @param {THREE.Object3D} object3d - The object3D used to contain the
32
- * geometry of the GeometryLayer. It is usually a `THREE.Group`, but it can
33
- * be anything inheriting from a `THREE.Object3D`.
34
- * @param {Object} [config] - Optional configuration, all elements in it
35
- * will be merged as is in the layer. For example, if the configuration
36
- * contains three elements `name, protocol, extent`, these elements will be
37
- * available using `layer.name` or something else depending on the property
38
- * name.
39
- * @param {Source} [config.source] - Description and options of the source.
40
- *
41
- * @throws {Error} `object3d` must be a valid `THREE.Object3d`.
42
- *
43
- * @example
44
- * // Create a GeometryLayer
45
- * const geometry = new GeometryLayer('buildings', new THREE.Object3D(), {
46
- * source: {
47
- * url: 'http://server.geo/wfs?',
48
- * protocol: 'wfs',
49
- * format: 'application/json'
50
- * },
51
- * });
52
- *
53
- * // Add the layer
54
- * view.addLayer(geometry);
55
- */
56
- constructor(id, object3d) {
57
- let config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
58
- config.cacheLifeTime = config.cacheLifeTime ?? CACHE_POLICIES.GEOMETRY;
59
-
60
- // Remove this part when Object.assign(this, config) will be removed from Layer Constructor
61
- const visible = config.visible;
62
- delete config.visible;
63
- super(id, config);
64
- this.isGeometryLayer = true;
65
- if (!object3d || !object3d.isObject3D) {
66
- throw new Error(`Missing/Invalid object3d parameter (must be a
67
- three.js Object3D instance)`);
68
- }
69
- if (object3d.type === 'Group' && object3d.name === '') {
70
- object3d.name = id;
71
- }
72
- Object.defineProperty(this, 'object3d', {
73
- value: object3d,
74
- writable: false,
75
- configurable: true
76
- });
77
- this.opacity = 1.0;
78
- this.wireframe = false;
79
- this.attachedLayers = [];
80
- this.visible = visible ?? true;
81
- Object.defineProperty(this.zoom, 'max', {
82
- value: Infinity,
83
- writable: false
84
- });
85
-
86
- // Feature options
87
- this.filteringExtent = !this.source.isFileSource;
88
- this.structure = '3d';
89
- }
90
- get visible() {
91
- return this.object3d.visible;
92
- }
93
- set visible(value) {
94
- if (this.object3d.visible !== value) {
95
- const event = {
96
- type: 'visible-property-changed',
97
- previous: {},
98
- new: {}
99
- };
100
- event.previous.visible = this.object3d.visible;
101
- event.new.visible = value;
102
- this.dispatchEvent(event);
103
- this.object3d.visible = value;
104
- }
105
- }
106
-
107
- // Attached layers expect to receive the visual representation of a
108
- // layer (= THREE object with a material). So if a layer's update
109
- // function don't process this kind of object, the layer must provide a
110
- // getObjectToUpdateForAttachedLayers function that returns the correct
111
- // object to update for attached layer.
112
- // See 3dtilesLayer or PotreeLayer for examples.
113
- // eslint-disable-next-line arrow-body-style
114
- getObjectToUpdateForAttachedLayers(obj) {
115
- if (obj.parent && obj.material) {
116
- return {
117
- element: obj,
118
- parent: obj.parent
119
- };
120
- }
121
- }
122
-
123
- // Placeholder
124
- // eslint-disable-next-line
125
- postUpdate() {}
126
-
127
- // Placeholder
128
- // eslint-disable-next-line
129
- culling() {
130
- return true;
131
- }
132
-
133
- /**
134
- * Attach another layer to this one. Layers attached to a GeometryLayer will
135
- * be available in `geometryLayer.attachedLayers`.
136
- *
137
- * @param {Layer} layer - The layer to attach, that must have an `update`
138
- * method.
139
- */
140
- attach(layer) {
141
- if (!layer.update) {
142
- throw new Error(`Missing 'update' function -> can't attach layer
143
- ${layer.id}`);
144
- }
145
- this.attachedLayers.push(layer);
146
- // To traverse GeometryLayer object3d attached
147
- layer.parent = this;
148
- }
149
-
150
- /**
151
- * Detach a layer attached to this one. See {@link attach} to learn how to
152
- * attach a layer.
153
- *
154
- * @param {Layer} layer - The layer to detach.
155
- *
156
- * @return {boolean} Confirmation of the detachment of the layer.
157
- */
158
- detach(layer) {
159
- const count = this.attachedLayers.length;
160
- this.attachedLayers = this.attachedLayers.filter(attached => attached.id != layer.id);
161
- layer.parent = undefined;
162
- return this.attachedLayers.length < count;
163
- }
164
-
165
- /**
166
- * All layer's 3D objects are removed from the scene and disposed from the video device.
167
- * @param {boolean} [clearCache=false] Whether to clear the layer cache or not
168
- */
169
- delete(clearCache) {
170
- if (clearCache) {
171
- this.cache.clear();
172
- }
173
-
174
- // if Layer is attached
175
- if (this.parent) {
176
- ObjectRemovalHelper.removeChildrenAndCleanupRecursively(this, this.parent.object3d);
177
- }
178
- if (this.object3d.parent) {
179
- this.object3d.parent.remove(this.object3d);
180
- }
181
- ObjectRemovalHelper.removeChildrenAndCleanupRecursively(this, this.object3d);
182
- }
183
-
184
- /**
185
- * Picking method for this layer.
186
- *
187
- * @param {View} view - The view instance.
188
- * @param {Object} coordinates - The coordinates to pick in the view. It
189
- * should have at least `x` and `y` properties.
190
- * @param {number} radius - Radius of the picking circle.
191
- * @param {Array} target - target to push result.
192
- *
193
- * @return {Array} An array containing all targets picked under the
194
- * specified coordinates.
195
- */
196
- pickObjectsAt(view, coordinates) {
197
- let radius = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.options.defaultPickingRadius;
198
- let target = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
199
- return Picking.pickObjectsAt(view, coordinates, radius, this.object3d, target);
200
- }
201
- }
202
- export default GeometryLayer;
@@ -1,64 +0,0 @@
1
- import Extent from "../Core/Geographic/Extent.js";
2
- export default class InfoLayer {
3
- constructor(layer) {
4
- this.layer = layer;
5
- }
6
- // eslint-disable-next-line
7
- clear() {}
8
- // eslint-disable-next-line
9
- update() {}
10
- }
11
-
12
- /**
13
- * InfoTiledGeometryLayer that provides some states layer informations. These
14
- * informations are displayed tiles, displayed {@link ColorLayer} and {@link
15
- * ElevationLayer} and extent of displayed tiles.
16
- *
17
- * @class InfoTiledGeometryLayer
18
- *
19
- * @property {object} displayed
20
- * @property {Layer[]} displayed.layers - Displayed {@link ColorLayer} and {@link ElevationLayer}.
21
- * @property {Extent} displayed.extent - {@link Extent} of displayed tiles.
22
- * @property {Set} displayed.tiles - Set of displayed tiles.
23
- */
24
- export class InfoTiledGeometryLayer extends InfoLayer {
25
- constructor(tiledGeometryLayer) {
26
- super(tiledGeometryLayer);
27
- this.displayed = {
28
- tiles: new Set()
29
- };
30
- Object.defineProperty(this.displayed, 'layers', {
31
- get: () => {
32
- let layers = [];
33
- this.displayed.tiles.forEach(tile => {
34
- const m = tile.material;
35
- layers = [...new Set([...layers, ...m.colorLayerIds.filter(id => m.getLayer(id)), ...m.elevationLayerIds])];
36
- });
37
- return this.layer.attachedLayers.filter(l => layers.includes(l.id));
38
- }
39
- });
40
- Object.defineProperty(this.displayed, 'extent', {
41
- get: () => {
42
- const extent = new Extent(this.layer.extent.crs, Infinity, -Infinity, Infinity, -Infinity);
43
- extent.min = +Infinity;
44
- extent.max = -Infinity;
45
- this.displayed.tiles.forEach(tile => {
46
- extent.union(tile.extent);
47
- extent.min = Math.min(tile.obb.z.min, extent.min);
48
- extent.max = Math.max(tile.obb.z.max, extent.max);
49
- });
50
- return extent;
51
- }
52
- });
53
- }
54
- clear() {
55
- this.displayed.tiles.clear();
56
- }
57
- update(tile) {
58
- if (tile.material.visible) {
59
- this.displayed.tiles.add(tile);
60
- } else {
61
- this.displayed.tiles.delete(tile);
62
- }
63
- }
64
- }