itowns 2.45.1 → 2.45.2-next.1

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 (224) hide show
  1. package/dist/455.js +1 -1
  2. package/dist/455.js.map +1 -1
  3. package/dist/debug.js +1 -1
  4. package/dist/debug.js.LICENSE.txt +8 -2
  5. package/dist/debug.js.map +1 -1
  6. package/dist/itowns.js +1 -1
  7. package/dist/itowns.js.LICENSE.txt +1 -1
  8. package/dist/itowns.js.map +1 -1
  9. package/dist/itowns_lasparser.js +1 -1
  10. package/dist/itowns_lasparser.js.map +1 -1
  11. package/dist/itowns_lasworker.js +1 -1
  12. package/dist/itowns_lasworker.js.map +1 -1
  13. package/dist/itowns_potree2worker.js +1 -1
  14. package/dist/itowns_potree2worker.js.map +1 -1
  15. package/dist/itowns_widgets.js +1 -1
  16. package/dist/itowns_widgets.js.map +1 -1
  17. package/examples/copc_simple_loader.html +3 -3
  18. package/examples/entwine_3d_loader.html +2 -2
  19. package/examples/entwine_simple_loader.html +10 -6
  20. package/examples/potree2_25d_map.html +2 -2
  21. package/examples/potree_25d_map.html +2 -2
  22. package/examples/potree_3d_map.html +2 -2
  23. package/examples/view_3d_map_webxr.html +2 -5
  24. package/lib/Controls/FirstPersonControls.d.ts +90 -0
  25. package/lib/Controls/FlyControls.d.ts +36 -0
  26. package/lib/Controls/GlobeControls.d.ts +274 -0
  27. package/lib/Controls/PlanarControls.d.ts +339 -0
  28. package/lib/Controls/StateControl.d.ts +140 -0
  29. package/lib/Controls/StreetControls.d.ts +134 -0
  30. package/lib/Controls/VRControls.d.ts +56 -0
  31. package/lib/Controls/VRControls.js +409 -0
  32. package/lib/Converter/Feature2Mesh.d.ts +42 -0
  33. package/lib/Converter/Feature2Texture.d.ts +5 -0
  34. package/lib/Converter/convertToTile.d.ts +5 -0
  35. package/lib/Converter/convertToTile.js +2 -2
  36. package/lib/Converter/textureConverter.d.ts +4 -0
  37. package/lib/Core/3DTiles/C3DTBatchTable.d.ts +49 -0
  38. package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.d.ts +37 -0
  39. package/lib/Core/3DTiles/C3DTBoundingVolume.d.ts +39 -0
  40. package/lib/Core/3DTiles/C3DTExtensions.d.ts +75 -0
  41. package/lib/Core/3DTiles/C3DTFeature.d.ts +47 -0
  42. package/lib/Core/3DTiles/C3DTilesEnums.d.ts +14 -0
  43. package/lib/Core/3DTiles/C3DTileset.d.ts +46 -0
  44. package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.d.ts +14 -0
  45. package/lib/Core/AnimationPlayer.d.ts +53 -0
  46. package/lib/Core/CopcNode.d.ts +68 -0
  47. package/lib/Core/CopcNode.js +57 -74
  48. package/lib/Core/Deprecated/Undeprecator.d.ts +6 -0
  49. package/lib/Core/EntwinePointTileNode.d.ts +59 -0
  50. package/lib/Core/EntwinePointTileNode.js +16 -41
  51. package/lib/Core/Feature.d.ts +323 -0
  52. package/lib/Core/Geographic/GeoidGrid.d.ts +86 -0
  53. package/lib/Core/Label.d.ts +86 -0
  54. package/lib/Core/MainLoop.d.ts +23 -0
  55. package/lib/Core/Picking.d.ts +6 -0
  56. package/lib/Core/Picking.js +4 -0
  57. package/lib/Core/PointCloudNode.d.ts +16 -0
  58. package/lib/Core/PointCloudNode.js +34 -4
  59. package/lib/Core/Potree2Node.d.ts +11 -0
  60. package/lib/Core/Potree2Node.js +5 -60
  61. package/lib/Core/Potree2PointAttributes.d.ts +97 -0
  62. package/lib/Core/PotreeNode.d.ts +14 -0
  63. package/lib/Core/PotreeNode.js +28 -18
  64. package/lib/Core/Prefab/Globe/Atmosphere.d.ts +66 -0
  65. package/lib/Core/Prefab/Globe/Atmosphere.js +10 -5
  66. package/lib/Core/Prefab/Globe/GlobeLayer.d.ts +48 -0
  67. package/lib/Core/Prefab/Globe/GlobeTileBuilder.d.ts +38 -0
  68. package/lib/Core/Prefab/Globe/SkyShader.d.ts +5 -0
  69. package/lib/Core/Prefab/Globe/SkyShader.js +3 -3
  70. package/lib/Core/Prefab/GlobeView.d.ts +65 -0
  71. package/lib/Core/Prefab/GlobeView.js +9 -0
  72. package/lib/Core/Prefab/Planar/PlanarLayer.d.ts +38 -0
  73. package/lib/Core/Prefab/Planar/PlanarTileBuilder.d.ts +32 -0
  74. package/lib/Core/Prefab/PlanarView.d.ts +33 -0
  75. package/lib/Core/Prefab/TileBuilder.d.ts +63 -0
  76. package/lib/Core/Prefab/computeBufferTileGeometry.d.ts +17 -0
  77. package/lib/Core/Scheduler/Cache.d.ts +25 -0
  78. package/lib/Core/Scheduler/CancelledCommandException.d.ts +12 -0
  79. package/lib/Core/Scheduler/Scheduler.d.ts +106 -0
  80. package/lib/Core/Style.d.ts +248 -0
  81. package/lib/Core/StyleOptions.d.ts +455 -0
  82. package/lib/Core/System/Capabilities.d.ts +9 -0
  83. package/lib/Core/Tile/Tile.d.ts +70 -0
  84. package/lib/Core/Tile/TileGrid.d.ts +12 -0
  85. package/lib/Core/TileGeometry.d.ts +46 -0
  86. package/lib/Core/TileMesh.d.ts +50 -0
  87. package/lib/Core/TileMesh.js +2 -4
  88. package/lib/Core/View.d.ts +403 -0
  89. package/lib/Core/View.js +1 -7
  90. package/lib/Layer/C3DTilesLayer.d.ts +140 -0
  91. package/lib/Layer/ColorLayer.d.ts +128 -0
  92. package/lib/Layer/ColorLayer.js +4 -4
  93. package/lib/Layer/CopcLayer.d.ts +42 -0
  94. package/lib/Layer/CopcLayer.js +3 -6
  95. package/lib/Layer/ElevationLayer.d.ts +96 -0
  96. package/lib/Layer/ElevationLayer.js +3 -3
  97. package/lib/Layer/EntwinePointTileLayer.d.ts +56 -0
  98. package/lib/Layer/EntwinePointTileLayer.js +4 -3
  99. package/lib/Layer/FeatureGeometryLayer.d.ts +62 -0
  100. package/lib/Layer/GeoidLayer.d.ts +41 -0
  101. package/lib/Layer/GeometryLayer.d.ts +120 -0
  102. package/lib/Layer/InfoLayer.d.ts +24 -0
  103. package/lib/Layer/InfoLayer.js +1 -1
  104. package/lib/Layer/LabelLayer.d.ts +93 -0
  105. package/lib/Layer/LabelLayer.js +2 -2
  106. package/lib/Layer/Layer.d.ts +185 -0
  107. package/lib/Layer/LayerUpdateState.d.ts +24 -0
  108. package/lib/Layer/LayerUpdateStrategy.d.ts +11 -0
  109. package/lib/Layer/LayerUpdateStrategy.js +2 -7
  110. package/lib/Layer/OGC3DTilesLayer.d.ts +277 -0
  111. package/lib/Layer/OGC3DTilesLayer.js +21 -0
  112. package/lib/Layer/OrientedImageLayer.d.ts +53 -0
  113. package/lib/Layer/PointCloudLayer.d.ts +103 -0
  114. package/lib/Layer/PointCloudLayer.js +8 -11
  115. package/lib/Layer/Potree2Layer.d.ts +56 -0
  116. package/lib/Layer/Potree2Layer.js +0 -2
  117. package/lib/Layer/PotreeLayer.d.ts +55 -0
  118. package/lib/Layer/RasterLayer.d.ts +8 -0
  119. package/lib/Layer/RasterLayer.js +2 -2
  120. package/lib/Layer/ReferencingLayerProperties.d.ts +2 -0
  121. package/lib/Layer/ReferencingLayerProperties.js +0 -12
  122. package/lib/Layer/TiledGeometryLayer.d.ts +192 -0
  123. package/lib/Layer/TiledGeometryLayer.js +4 -3
  124. package/lib/Main.d.ts +89 -0
  125. package/lib/Main.js +3 -1
  126. package/lib/Parser/B3dmParser.d.ts +26 -0
  127. package/lib/Parser/CameraCalibrationParser.d.ts +32 -0
  128. package/lib/Parser/GDFParser.d.ts +24 -0
  129. package/lib/Parser/GTXParser.d.ts +28 -0
  130. package/lib/Parser/GeoJsonParser.d.ts +12 -0
  131. package/lib/Parser/GpxParser.d.ts +12 -0
  132. package/lib/Parser/ISGParser.d.ts +23 -0
  133. package/lib/Parser/KMLParser.d.ts +12 -0
  134. package/lib/Parser/LASParser.d.ts +61 -0
  135. package/lib/Parser/MapBoxUrlParser.d.ts +9 -0
  136. package/lib/Parser/PntsParser.d.ts +4 -0
  137. package/lib/Parser/Potree2BinParser.d.ts +8 -0
  138. package/lib/Parser/PotreeBinParser.d.ts +4 -0
  139. package/lib/Parser/PotreeCinParser.d.ts +4 -0
  140. package/lib/Parser/ShapefileParser.d.ts +25 -0
  141. package/lib/Parser/VectorTileParser.d.ts +34 -0
  142. package/lib/Parser/XbilParser.d.ts +18 -0
  143. package/lib/Parser/deprecated/LegacyGLTFLoader.d.ts +32 -0
  144. package/lib/Parser/iGLTFLoader.d.ts +104 -0
  145. package/lib/Process/3dTilesProcessing.d.ts +43 -0
  146. package/lib/Process/FeatureProcessing.d.ts +4 -0
  147. package/lib/Process/LayeredMaterialNodeProcessing.d.ts +3 -0
  148. package/lib/Process/LayeredMaterialNodeProcessing.js +12 -12
  149. package/lib/Process/ObjectRemovalHelper.d.ts +32 -0
  150. package/lib/Process/handlerNodeError.d.ts +1 -0
  151. package/lib/Provider/3dTilesProvider.d.ts +7 -0
  152. package/lib/Provider/DataSourceProvider.d.ts +4 -0
  153. package/lib/Provider/Fetcher.d.ts +101 -0
  154. package/lib/Provider/PointCloudProvider.d.ts +4 -0
  155. package/lib/Provider/TileProvider.d.ts +4 -0
  156. package/lib/Provider/URLBuilder.d.ts +28 -0
  157. package/lib/Renderer/Camera.d.ts +95 -0
  158. package/lib/Renderer/Color.d.ts +3 -0
  159. package/lib/Renderer/ColorLayersOrdering.d.ts +38 -0
  160. package/lib/Renderer/ColorLayersOrdering.js +2 -2
  161. package/lib/Renderer/CommonMaterial.d.ts +6 -0
  162. package/lib/Renderer/Label2DRenderer.d.ts +31 -0
  163. package/lib/Renderer/LayeredMaterial.d.ts +121 -0
  164. package/lib/Renderer/LayeredMaterial.js +221 -141
  165. package/lib/Renderer/OBB.d.ts +65 -0
  166. package/lib/Renderer/OrientedImageCamera.d.ts +36 -0
  167. package/lib/Renderer/OrientedImageMaterial.d.ts +68 -0
  168. package/lib/Renderer/PointsMaterial.d.ts +226 -0
  169. package/lib/Renderer/PointsMaterial.js +60 -22
  170. package/lib/Renderer/RasterTile.d.ts +53 -0
  171. package/lib/Renderer/RasterTile.js +8 -9
  172. package/lib/Renderer/RenderMode.d.ts +11 -0
  173. package/lib/Renderer/RenderMode.js +1 -0
  174. package/lib/Renderer/Shader/ShaderChunk.d.ts +78 -0
  175. package/lib/Renderer/Shader/ShaderUtils.d.ts +5 -0
  176. package/lib/Renderer/WebXR.d.ts +33 -0
  177. package/lib/Renderer/WebXR.js +128 -47
  178. package/lib/Renderer/c3DEngine.d.ts +55 -0
  179. package/lib/Renderer/c3DEngine.js +5 -1
  180. package/lib/Source/C3DTilesGoogleSource.d.ts +38 -0
  181. package/lib/Source/C3DTilesIonSource.d.ts +31 -0
  182. package/lib/Source/C3DTilesSource.d.ts +17 -0
  183. package/lib/Source/CopcSource.d.ts +79 -0
  184. package/lib/Source/EntwinePointTileSource.d.ts +40 -0
  185. package/lib/Source/EntwinePointTileSource.js +0 -5
  186. package/lib/Source/FileSource.d.ts +118 -0
  187. package/lib/Source/OGC3DTilesGoogleSource.d.ts +24 -0
  188. package/lib/Source/OGC3DTilesIonSource.d.ts +26 -0
  189. package/lib/Source/OGC3DTilesSource.d.ts +21 -0
  190. package/lib/Source/OrientedImageSource.d.ts +48 -0
  191. package/lib/Source/Potree2Source.d.ts +157 -0
  192. package/lib/Source/PotreeSource.d.ts +69 -0
  193. package/lib/Source/Source.d.ts +122 -0
  194. package/lib/Source/TMSSource.d.ts +77 -0
  195. package/lib/Source/VectorTilesSource.d.ts +56 -0
  196. package/lib/Source/WFSSource.d.ts +110 -0
  197. package/lib/Source/WMSSource.d.ts +85 -0
  198. package/lib/Source/WMTSSource.d.ts +65 -0
  199. package/lib/ThreeExtended/capabilities/WebGL.d.ts +9 -0
  200. package/lib/ThreeExtended/libs/ktx-parse.module.d.ts +274 -0
  201. package/lib/ThreeExtended/libs/motion-controllers.module.d.ts +64 -0
  202. package/lib/ThreeExtended/libs/motion-controllers.module.js +375 -0
  203. package/lib/ThreeExtended/libs/zstddec.module.d.ts +6 -0
  204. package/lib/ThreeExtended/loaders/DDSLoader.js +40 -1
  205. package/lib/ThreeExtended/loaders/DRACOLoader.d.ts +41 -0
  206. package/lib/ThreeExtended/loaders/GLTFLoader.d.ts +16 -0
  207. package/lib/ThreeExtended/loaders/GLTFLoader.js +22 -3
  208. package/lib/ThreeExtended/loaders/KTX2Loader.d.ts +116 -0
  209. package/lib/ThreeExtended/loaders/KTX2Loader.js +9 -2
  210. package/lib/ThreeExtended/math/ColorSpaces.d.ts +56 -0
  211. package/lib/ThreeExtended/utils/BufferGeometryUtils.d.ts +62 -0
  212. package/lib/ThreeExtended/utils/BufferGeometryUtils.js +2 -2
  213. package/lib/ThreeExtended/utils/WorkerPool.d.ts +19 -0
  214. package/lib/ThreeExtended/webxr/XRControllerModelFactory.d.ts +25 -0
  215. package/lib/ThreeExtended/webxr/XRControllerModelFactory.js +209 -0
  216. package/lib/Utils/CameraUtils.d.ts +132 -0
  217. package/lib/Utils/DEMUtils.d.ts +84 -0
  218. package/lib/Utils/DEMUtils.js +2 -2
  219. package/lib/Utils/FeaturesUtils.d.ts +17 -0
  220. package/lib/Utils/Gradients.d.ts +13 -0
  221. package/lib/Utils/ThreeUtils.d.ts +14 -0
  222. package/lib/Utils/placeObjectOnGround.d.ts +28 -0
  223. package/lib/global.d.js +0 -0
  224. package/package.json +18 -15
@@ -0,0 +1,93 @@
1
+ export default LabelLayer;
2
+ /**
3
+ * A layer to handle a bunch of `Label`. This layer can be created on its own,
4
+ * but it is better to use the option `addLabelLayer` on another `Layer` to let
5
+ * it work with it (see the `vector_tile_raster_2d` example). Supported for Points features, not yet
6
+ * for Lines and Polygons features.
7
+ *
8
+ * @property {boolean} isLabelLayer - Used to checkout whether this layer is a
9
+ * LabelLayer. Default is true. You should not change this, as it is used
10
+ * internally for optimisation.
11
+ */
12
+ declare class LabelLayer extends GeometryLayer {
13
+ /**
14
+ * @extends Layer
15
+ *
16
+ * @param {string} id - The id of the layer, that should be unique. It is
17
+ * not mandatory, but an error will be emitted if this layer is added a
18
+ * {@link View} that already has a layer going by that id.
19
+ * @param {Object} [config] - Optional configuration, all elements in it
20
+ * will be merged as is in the layer. For example, if the configuration
21
+ * contains three elements `name, protocol, extent`, these elements will be
22
+ * available using `layer.name` or something else depending on the property
23
+ * name.
24
+ * @param {boolean} [config.performance=true] - remove labels that have no chance of being visible.
25
+ * if the `config.performance` is set to true then the performance is improved
26
+ * proportional to the amount of unnecessary labels that are removed.
27
+ * Indeed, even in the best case, labels will never be displayed. By example, if there's many labels.
28
+ * We advise you to not use this option if your data is optimized.
29
+ * @param {domElement|function} config.domElement - An HTML domElement.
30
+ * If set, all `Label` displayed within the current instance `LabelLayer`
31
+ * will be this domElement.
32
+ *
33
+ * It can be set to a method. The single parameter of this method gives the
34
+ * properties of each feature on which a `Label` is created.
35
+ *
36
+ * If set, all the parameters set in the `LabelLayer` `Style.text` will be overridden,
37
+ * except for the `Style.text.anchor` parameter which can help place the label.
38
+ */
39
+ constructor(id: string, config?: {
40
+ performance?: boolean | undefined;
41
+ domElement: any;
42
+ });
43
+ isLabelLayer: boolean;
44
+ domElement: DomNode;
45
+ buildExtent: boolean;
46
+ performance: boolean;
47
+ forceClampToTerrain: any;
48
+ margin: any;
49
+ toHide: THREE.Group<THREE.Object3DEventMap>;
50
+ labelDomelement: any;
51
+ get submittedLabelNodes(): any;
52
+ /**
53
+ * Reads each {@link FeatureGeometry} that contains label configuration, and
54
+ * creates the corresponding {@link Label}. To create a `Label`, a geometry
55
+ * needs to have a `label` object with at least a few properties:
56
+ * - `content`, which refers to `Label#content`
57
+ * - `position`, which refers to `Label#position`
58
+ * - (optional) `config`, containing miscellaneous configuration for the
59
+ * label
60
+ *
61
+ * The geometry (or its parent Feature) needs to have a Style set.
62
+ *
63
+ * @param {FeatureCollection} data - The FeatureCollection to read the
64
+ * labels from.
65
+ * @param {Extent|Tile} extentOrTile
66
+ *
67
+ * @return {Label[]} An array containing all the created labels.
68
+ */
69
+ convert(data: FeatureCollection, extentOrTile: Extent | Tile): Label[];
70
+ preUpdate(context: any, sources: any): void;
71
+ update(context: any, layer: any, node: any, parent: any): any;
72
+ removeLabelsFromNodeRecursive(node: any): void;
73
+ removeNodeDomElement(node: any): void;
74
+ #private;
75
+ }
76
+ import GeometryLayer from '../Layer/GeometryLayer';
77
+ /**
78
+ * DomNode is a node in the tree data structure of labels divs.
79
+ *
80
+ * @class DomNode
81
+ */
82
+ declare class DomNode {
83
+ dom: HTMLDivElement;
84
+ set visible(v: boolean);
85
+ get visible(): boolean;
86
+ hide(): void;
87
+ show(): void;
88
+ add(node: any): void;
89
+ #private;
90
+ }
91
+ import * as THREE from 'three';
92
+ import { Extent } from '@itowns/geographic';
93
+ import Label from '../Core/Label';
@@ -425,8 +425,8 @@ class LabelLayer extends GeometryLayer {
425
425
 
426
426
  // Necessary event listener, to remove any Label attached to
427
427
  node.addEventListener('removed', () => this.removeNodeDomElement(node));
428
- if (labelsNode.needsAltitude && node.material.getElevationLayer()) {
429
- node.material.getElevationLayer().addEventListener('rasterElevationLevelChanged', () => {
428
+ if (labelsNode.needsAltitude && node.material.getElevationTile()) {
429
+ node.material.getElevationTile().addEventListener('rasterElevationLevelChanged', () => {
430
430
  labelsNode.needsUpdate = true;
431
431
  });
432
432
  }
@@ -0,0 +1,185 @@
1
+ export default Layer;
2
+ export namespace ImageryLayers {
3
+ function moveLayerToIndex(layer: any, newIndex: any, imageryLayers: any): void;
4
+ function moveLayerDown(layer: any, imageryLayers: any): void;
5
+ function moveLayerUp(layer: any, imageryLayers: any): void;
6
+ function getColorLayersIdOrderedBySequence(imageryLayers: any): any[];
7
+ }
8
+ /**
9
+ * @property {boolean} isLayer - Used to checkout whether this layer is a Layer.
10
+ * Default is true. You should not change this, as it is used internally for
11
+ * optimisation.
12
+ * @property {boolean} ready - This property is false when the layer isn't added.
13
+ * It's true when the layer is added and all initializations are done.
14
+ * @property {Source} source - This source determines the datas to be displayed with the layer.
15
+ * The layer determines how this data are displayed.
16
+ * By example:
17
+ * * For ColorLayer/ElevationLayer, the source datas are rasterised (if it's necessary).
18
+ * * For GeometryLayer, the source datas are converted to meshes (not possible for the raster data sources).
19
+ * @property {Promise} whenReady - this promise is resolved when the layer is added and all initializations are done.
20
+ * This promise is resolved with this layer.
21
+ * This promise is returned by [View#addLayer]{@link View}.
22
+ * @property {object} [zoom] - This property is used only the layer is attached
23
+ * to {@link TiledGeometryLayer}.
24
+ * By example,
25
+ * The layer checks the tile zoom level to determine if the layer is visible in this tile.
26
+ *
27
+ * ![tiled geometry](/docs/static/images/wfszoommaxmin.jpeg)
28
+ * _In `GlobeView`, **red lines** represents the **WGS84 grid** and **orange lines** the Pseudo-mercator grid_
29
+ * _In this example [WFS to 3D objects](http://www.itowns-project.org/itowns/examples/index.html#source_stream_wfs_3d), the building layer zoom min is 14._
30
+ * _In the lower part of the picture, the zoom tiles 14 have buildings, while in the upper part of the picture, the level 13 tiles have no buildings._
31
+ *
32
+ * @property {number} [zoom.max=Infinity] - this is the maximum zoom beyond which it'll be hidden.
33
+ * @property {number} [zoom.min=0] - this is the minimum zoom from which it'll be visible.
34
+ *
35
+ */
36
+ declare class Layer extends THREE.EventDispatcher<any> {
37
+ /**
38
+ * Don't use directly constructor to instance a new Layer. Instead, use
39
+ * another available type of Layer, implement a new one inheriting from this
40
+ * one or use [View#addLayer]{@link View}.
41
+ *
42
+ * @protected
43
+ *
44
+ * @param {string} id - The id of the layer, that should be unique. It is
45
+ * not mandatory, but an error will be emitted if this layer is added a
46
+ * {@link View} that already has a layer going by that id.
47
+ * @param {Object} config - configuration, all elements in it
48
+ * will be merged as is in the layer. For example, if the configuration
49
+ * contains three elements `name, extent`, these elements will be
50
+ * available using `layer.name` or something else depending on the property
51
+ * name.
52
+ * @param {Source|boolean} config.source - instantiated Source specifies data source to display.
53
+ * if config.source is a boolean, it can only be false. if config.source is false,
54
+ * the layer doesn't need Source (like debug Layer or procedural layer).
55
+ * @param {StyleOptions} [config.style] - an object that contain any properties
56
+ * (order, zoom, fill, stroke, point, text or/and icon)
57
+ * and sub properties of a Style (@see {@link StyleOptions}). Or directly a {@link Style} .<br/>
58
+ * When entering a StyleOptions the missing style properties will be look for in the data (if any)
59
+ * what won't be done when you use a Style.
60
+ * @param {number} [config.cacheLifeTime=Infinity] - set life time value in cache.
61
+ * This value is used for cache expiration mechanism.
62
+ * @param {(boolean|Object)} [config.addLabelLayer] - Used to tell if this layer has
63
+ * labels to display from its data. For example, it needs to be set to `true`
64
+ * for a layer with vector tiles. If it's `true` a new `LabelLayer` is added and attached to this `Layer`.
65
+ * You can also configure it with {@link LabelLayer} options described below such as: `addLabelLayer: { performance: true }`.
66
+ * @param {boolean} [config.addLabelLayer.performance=false] - In case label layer adding, so remove labels that have no chance of being visible.
67
+ * Indeed, even in the best case, labels will never be displayed. By example, if there's many labels.
68
+ * @param {boolean} [config.addLabelLayer.forceClampToTerrain=false] - use elevation layer to clamp label on terrain.
69
+ * @param {number} [config.subdivisionThreshold=256] - set the texture size and, if applied to the globe, affects the tile subdivision.
70
+ *
71
+ * @example
72
+ * // Add and create a new Layer
73
+ * const newLayer = new Layer('id', options);
74
+ * view.addLayer(newLayer);
75
+ *
76
+ * // Change layer's visibility
77
+ * const layerToChange = view.getLayerById('idLayerToChange');
78
+ * layerToChange.visible = false;
79
+ * view.notifyChange(); // update viewer
80
+ *
81
+ * // Change layer's opacity
82
+ * const layerToChange = view.getLayerById('idLayerToChange');
83
+ * layerToChange.opacity = 0.5;
84
+ * view.notifyChange(); // update viewer
85
+ *
86
+ * // Listen properties
87
+ * const layerToListen = view.getLayerById('idLayerToListen');
88
+ * layerToListen.addEventListener('visible-property-changed', (event) => console.log(event));
89
+ * layerToListen.addEventListener('opacity-property-changed', (event) => console.log(event));
90
+ */
91
+ protected constructor();
92
+ /**
93
+ * @type {boolean}
94
+ * @readonly
95
+ */
96
+ readonly isLayer: boolean;
97
+ /**
98
+ * @type {string}
99
+ * @readonly
100
+ */
101
+ readonly id: string;
102
+ /**
103
+ * @type {string}
104
+ */
105
+ name: string;
106
+ /**
107
+ * @type {Source}
108
+ */
109
+ source: Source;
110
+ crs: any;
111
+ style: any;
112
+ /**
113
+ * @type {number}
114
+ */
115
+ subdivisionThreshold: number;
116
+ sizeDiagonalTexture: number;
117
+ addLabelLayer: boolean | Object;
118
+ options: any;
119
+ updateStrategy: any;
120
+ zoom: {
121
+ min: any;
122
+ max: any;
123
+ };
124
+ info: InfoLayer;
125
+ /**
126
+ * @type {boolean}
127
+ */
128
+ ready: boolean;
129
+ /**
130
+ * @type {Array<Promise<any>>}
131
+ * @protected
132
+ */
133
+ protected _promises: Array<Promise<any>>;
134
+ /**
135
+ * @type {Promise<this>}
136
+ */
137
+ whenReady: Promise<this>;
138
+ _resolve: (value: any) => void;
139
+ _reject: (reason?: any) => void;
140
+ /**
141
+ * @type {Cache}
142
+ */
143
+ cache: Cache;
144
+ mergeFeatures: any;
145
+ addInitializationStep(): undefined;
146
+ /**
147
+ * Defines a property for this layer, with a default value and a callback
148
+ * executed when the property changes.
149
+ * <br><br>
150
+ * When changing the property, it also emits an event, named following this
151
+ * convention: `${propertyName}-property-changed`, with `${propertyName}`
152
+ * being replaced by the name of the property. For example, if the added
153
+ * property name is `frozen`, it will emit a `frozen-property-changed`.
154
+ * <br><br>
155
+ * @example <caption>The emitted event has some properties assigned to it</caption>
156
+ * event = {
157
+ * new: {
158
+ * ${propertyName}: * // the new value of the property
159
+ * },
160
+ * previous: {
161
+ * ${propertyName}: * // the previous value of the property
162
+ * },
163
+ * target: Layer // the layer it has been dispatched from
164
+ * type: string // the name of the emitted event
165
+ * }
166
+ *
167
+ * @param {string} propertyName - The name of the property, also used in
168
+ * the emitted event name.
169
+ * @param {*} defaultValue - The default set value.
170
+ * @param {function} [onChange] - The function executed when the property is
171
+ * changed. Parameters are the layer the property is defined on, and the
172
+ * name of the property.
173
+ */
174
+ defineLayerProperty(propertyName: string, defaultValue: any, onChange?: Function): void;
175
+ convert(data: any): any;
176
+ getData(from: any, to: any): any;
177
+ /**
178
+ * Remove and dispose all objects from layer.
179
+ * @param {boolean} [clearCache=false] Whether to clear the layer cache or not
180
+ */
181
+ delete(clearCache?: boolean): void;
182
+ }
183
+ import * as THREE from 'three';
184
+ import Source from '../Source/Source';
185
+ import InfoLayer from '../Layer/InfoLayer';
@@ -0,0 +1,24 @@
1
+ export default LayerUpdateState;
2
+ /**
3
+ * LayerUpdateState is the update state of a layer, for a given object (e.g tile).
4
+ * It stores information to allow smart update decisions, and especially network
5
+ * error handling.
6
+ * @constructor
7
+ */
8
+ declare class LayerUpdateState {
9
+ state: number;
10
+ lastErrorTimestamp: number;
11
+ errorCount: number;
12
+ failureParams: {
13
+ lowestLevelError: number;
14
+ };
15
+ hasFinished(): boolean;
16
+ canTryUpdate(timestamp?: number): boolean;
17
+ secondsUntilNextTry(): number;
18
+ newTry(): void;
19
+ success(): void;
20
+ noMoreUpdatePossible(): void;
21
+ noData(failureParams: any): void;
22
+ failure(timestamp: any, definitive: any, failureParams: any): void;
23
+ inError(): boolean;
24
+ }
@@ -0,0 +1,11 @@
1
+ export function chooseNextLevelToFetch(strategy: any, node: any, nodeLevel: any, currentLevel: any, layer: any, failureParams: any): any;
2
+ /**
3
+ * This modules implements various layer update strategies.
4
+ *
5
+ * Default strategy is STRATEGY_MIN_NETWORK_TRAFFIC which aims
6
+ * to reduce the amount of network traffic.
7
+ */
8
+ export const STRATEGY_MIN_NETWORK_TRAFFIC: 0;
9
+ export const STRATEGY_GROUP: 1;
10
+ export const STRATEGY_PROGRESSIVE: 2;
11
+ export const STRATEGY_DICHOTOMY: 3;
@@ -10,12 +10,7 @@ export const STRATEGY_MIN_NETWORK_TRAFFIC = 0;
10
10
  export const STRATEGY_GROUP = 1;
11
11
  export const STRATEGY_PROGRESSIVE = 2;
12
12
  export const STRATEGY_DICHOTOMY = 3;
13
- function _minimizeNetworkTraffic(node, nodeLevel, currentLevel, source) {
14
- // TO DO source.isVectorTileSource is a temp fix for pendingSubdivision.
15
- // see issue https://github.com/iTowns/itowns/issues/2214
16
- if (node.pendingSubdivision && !source.isVectorTileSource) {
17
- return currentLevel;
18
- }
13
+ function _minimizeNetworkTraffic(nodeLevel) {
19
14
  return nodeLevel;
20
15
  }
21
16
 
@@ -72,7 +67,7 @@ export function chooseNextLevelToFetch(strategy, node) {
72
67
  // default strategy
73
68
  case STRATEGY_MIN_NETWORK_TRAFFIC:
74
69
  default:
75
- nextLevelToFetch = _minimizeNetworkTraffic(node, nodeLevel, currentLevel, layer.source);
70
+ nextLevelToFetch = _minimizeNetworkTraffic(nodeLevel);
76
71
  }
77
72
  nextLevelToFetch = Math.min(nextLevelToFetch, maxZoom);
78
73
  }
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Enable loading 3D Tiles with [Draco](https://google.github.io/draco/) geometry extension.
3
+ *
4
+ * @param {String} path path to draco library folder containing the JS and WASM decoder libraries. They can be found in
5
+ * [itowns examples](https://github.com/iTowns/itowns/tree/master/examples/libs/draco).
6
+ * @param {Object} [config] optional configuration for Draco decoder (see threejs'
7
+ * [setDecoderConfig](https://threejs.org/docs/index.html?q=draco#examples/en/loaders/DRACOLoader.setDecoderConfig) that
8
+ * is called under the hood with this configuration for details.
9
+ */
10
+ export function enableDracoLoader(path: string, config?: Object): void;
11
+ /**
12
+ * Enable loading 3D Tiles with [KTX2](https://www.khronos.org/ktx/) texture extension.
13
+ *
14
+ * @param {String} path path to ktx2 library folder containing the JS and WASM decoder libraries. They can be found in
15
+ * [itowns examples](https://github.com/iTowns/itowns/tree/master/examples/libs/basis).
16
+ * @param {THREE.WebGLRenderer} renderer the threejs renderer
17
+ */
18
+ export function enableKtx2Loader(path: string, renderer: THREE.WebGLRenderer): void;
19
+ /**
20
+ * Enable loading 3D Tiles and GLTF with
21
+ * [meshopt](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_meshopt_compression/README.md) compression extension.
22
+ *
23
+ * @param {MeshOptDecoder.constructor} MeshOptDecoder - The Meshopt decoder
24
+ * module.
25
+ *
26
+ * @example
27
+ * import * as itowns from 'itowns';
28
+ * import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';
29
+ *
30
+ * // Enable support of EXT_meshopt_compression
31
+ * itowns.enableMeshoptDecoder(MeshoptDecoder);
32
+ */
33
+ export function enableMeshoptDecoder(MeshOptDecoder: MeshOptDecoder.constructor): void;
34
+ export const itownsGLTFLoader: iGLTFLoader;
35
+ export namespace OGC3DTILES_LAYER_EVENTS {
36
+ let LOAD_TILE_SET: Object;
37
+ let LOAD_MODEL: Object;
38
+ let DISPOSE_MODEL: Object;
39
+ let TILE_VISIBILITY_CHANGE: Object;
40
+ let TILES_LOAD_START: string;
41
+ let TILES_LOAD_END: string;
42
+ }
43
+ export default OGC3DTilesLayer;
44
+ import * as THREE from 'three';
45
+ import iGLTFLoader from '../Parser/iGLTFLoader';
46
+ declare class OGC3DTilesLayer extends GeometryLayer {
47
+ /**
48
+ * Layer for [3D Tiles](https://www.ogc.org/standard/3dtiles/) datasets.
49
+ *
50
+ * Advanced configuration note: 3D Tiles rendering is delegated to 3DTilesRendererJS that exposes several
51
+ * configuration options accessible through the tilesRenderer property of this class. see the
52
+ * [3DTilesRendererJS doc](https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/master/README.md). Also note that
53
+ * the cache is shared amongst 3D tiles layers and can be configured through tilesRenderer.lruCache (see the
54
+ * [following documentation](https://github.com/NASA-AMMOS/3DTilesRendererJS/blob/master/README.md#lrucache-1).
55
+ *
56
+ * @extends Layer
57
+ *
58
+ * @param {String} id - unique layer id.
59
+ * @param {Object} config - layer specific configuration
60
+ * @param {OGC3DTilesSource} config.source - data source configuration
61
+ * @param {String} [config.pntsMode = PNTS_MODE.COLOR] Point cloud coloring mode (passed to {@link PointsMaterial}).
62
+ * Only 'COLOR' or 'CLASSIFICATION' are possible. COLOR uses RGB colors of the points,
63
+ * CLASSIFICATION uses a classification property of the batch table to color points.
64
+ * @param {ClassificationScheme} [config.classificationScheme = ClassificationScheme.DEFAULT] {@link PointsMaterial} classification scheme
65
+ * @param {String} [config.pntsShape = PNTS_SHAPE.CIRCLE] Point cloud point shape. Only 'CIRCLE' or 'SQUARE' are possible.
66
+ * (passed to {@link PointsMaterial}).
67
+ * @param {String} [config.pntsSizeMode = PNTS_SIZE_MODE.VALUE] {@link PointsMaterial} Point cloud size mode (passed to {@link PointsMaterial}).
68
+ * Only 'VALUE' or 'ATTENUATED' are possible. VALUE use constant size, ATTENUATED compute size depending on distance
69
+ * from point to camera.
70
+ * @param {Number} [config.pntsMinAttenuatedSize = 3] Minimum scale used by 'ATTENUATED' size mode.
71
+ * @param {Number} [config.pntsMaxAttenuatedSize = 10] Maximum scale used by 'ATTENUATED' size mode.
72
+ */
73
+ constructor(id: string, config: {
74
+ source: OGC3DTilesSource;
75
+ pntsMode?: string | undefined;
76
+ classificationScheme?: {
77
+ DEFAULT: {
78
+ 0: {
79
+ visible: boolean;
80
+ name: string;
81
+ color: THREE.Color;
82
+ opacity: number;
83
+ };
84
+ 1: {
85
+ visible: boolean;
86
+ name: string;
87
+ color: THREE.Color;
88
+ opacity: number;
89
+ };
90
+ 2: {
91
+ visible: boolean;
92
+ name: string;
93
+ color: THREE.Color;
94
+ opacity: number;
95
+ };
96
+ 3: {
97
+ visible: boolean;
98
+ name: string;
99
+ color: THREE.Color;
100
+ opacity: number;
101
+ };
102
+ 4: {
103
+ visible: boolean;
104
+ name: string;
105
+ color: THREE.Color;
106
+ opacity: number;
107
+ };
108
+ 5: {
109
+ visible: boolean;
110
+ name: string;
111
+ color: THREE.Color;
112
+ opacity: number;
113
+ };
114
+ 6: {
115
+ visible: boolean;
116
+ name: string;
117
+ color: THREE.Color;
118
+ opacity: number;
119
+ };
120
+ 7: {
121
+ visible: boolean;
122
+ name: string;
123
+ color: THREE.Color;
124
+ opacity: number;
125
+ };
126
+ 8: {
127
+ visible: boolean;
128
+ name: string;
129
+ color: THREE.Color;
130
+ opacity: number;
131
+ };
132
+ 9: {
133
+ visible: boolean;
134
+ name: string;
135
+ color: THREE.Color;
136
+ opacity: number;
137
+ };
138
+ 10: {
139
+ visible: boolean;
140
+ name: string;
141
+ color: THREE.Color;
142
+ opacity: number;
143
+ };
144
+ 11: {
145
+ visible: boolean;
146
+ name: string;
147
+ color: THREE.Color;
148
+ opacity: number;
149
+ };
150
+ 12: {
151
+ visible: boolean;
152
+ name: string;
153
+ color: THREE.Color;
154
+ opacity: number;
155
+ };
156
+ DEFAULT: {
157
+ visible: boolean;
158
+ name: string;
159
+ color: THREE.Color;
160
+ opacity: number;
161
+ };
162
+ };
163
+ } | undefined;
164
+ pntsShape?: string | undefined;
165
+ pntsSizeMode?: string | undefined;
166
+ pntsMinAttenuatedSize?: number | undefined;
167
+ pntsMaxAttenuatedSize?: number | undefined;
168
+ });
169
+ isOGC3DTilesLayer: boolean;
170
+ pntsMode: string | number;
171
+ pntsShape: string | number;
172
+ classification: any;
173
+ pntsSizeMode: string | number;
174
+ pntsMinAttenuatedSize: number;
175
+ pntsMaxAttenuatedSize: number;
176
+ /** @type{any} */
177
+ tilesRenderer: any;
178
+ _res: any;
179
+ /**
180
+ * @type {number}
181
+ */
182
+ sseThreshold: number;
183
+ tasks: any[];
184
+ tilesSchedulingCB: (func: any) => void;
185
+ /**
186
+ * Sets the lruCache and download and parse queues so they are shared amongst
187
+ * all tilesets from a same {@link View} view.
188
+ * @param {View} view - view associated to this layer.
189
+ * @private
190
+ */
191
+ private _setupCacheAndQueues;
192
+ /**
193
+ * Binds 3d-tiles-renderer events to this layer.
194
+ * @private
195
+ */
196
+ private _setupEvents;
197
+ /**
198
+ * Setup 3D tiles renderer js TilesRenderer with the camera, binds events and start updating. Executed when the
199
+ * layer has been added to the view.
200
+ * @param {View} view - the view the layer has been added to.
201
+ * @private
202
+ */
203
+ private _setup;
204
+ /**
205
+ * Replace materials from GLTFLoader by our own custom materials. Note that
206
+ * the replaced materials are not compiled yet and will be disposed by the
207
+ * GC.
208
+ * @param {Object3D} model
209
+ * @private
210
+ */
211
+ private _assignFinalMaterial;
212
+ /**
213
+ * @param {Object3D} model
214
+ * @private
215
+ */
216
+ private _assignFinalAttributes;
217
+ handleTasks(): void;
218
+ preUpdate(context: any): null;
219
+ scale: any;
220
+ update(): void;
221
+ /**
222
+ * Deletes the layer and frees associated memory
223
+ */
224
+ delete(): void;
225
+ /**
226
+ * Get the [metadata](https://github.com/CesiumGS/3d-tiles/tree/main/specification/Metadata)
227
+ * of the closest intersected object from a list of intersections.
228
+ *
229
+ * This method retrieves structured metadata stored in GLTF 2.0 assets using
230
+ * the [`EXT_structural_metadata`](https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata)
231
+ * extension.
232
+ *
233
+ * Internally, it uses the closest intersected point to index metadata
234
+ * stored in property attributes and textures.
235
+ *
236
+ * If present in GLTF 2.0 assets, this method leverages the
237
+ * [`EXT_mesh_features`](`https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features)
238
+ * extension and the returned featured to index metadata stored in property tables.
239
+ *
240
+ * @param {Array<THREE.Intersection>} intersections
241
+ * @returns {Promise<Object | null>} - the intersected object's metadata
242
+ */
243
+ getMetadataFromIntersections(intersections: Array<THREE.Intersection>): Promise<Object | null>;
244
+ /**
245
+ * Get the attributes for the closest intersection from a list of
246
+ * intersects.
247
+ * @param {Array<THREE.Intersection>} intersects - An array containing all
248
+ * objects picked under mouse coordinates computed with view.pickObjectsAt(..).
249
+ * @returns {Object | null} - An object containing
250
+ */
251
+ getC3DTileFeatureFromIntersectsArray(intersects: Array<THREE.Intersection>): Object | null;
252
+ /**
253
+ * Get all 3D objects (mesh and points primitives) as intersects at the
254
+ * given non-normalized screen coordinates.
255
+ * @param {View} view - The view instance.
256
+ * @param {THREE.Vector2} coords - The coordinates to pick in the view. It
257
+ * should have at least `x` and `y` properties.
258
+ * @param {number} radius - Radius of the picking circle.
259
+ * @param {Array} [target=[]] - Target array to push results too
260
+ * @returns {Array} Array containing all target objects picked under the
261
+ * specified coordinates.
262
+ */
263
+ pickObjectsAt(view: View, coords: THREE.Vector2, radius: number, target?: any[]): any[];
264
+ attach(layer: any): void;
265
+ detach(layer: any): boolean;
266
+ getObjectToUpdateForAttachedLayers(obj: any): null;
267
+ /**
268
+ * Executes a callback for each tile of this layer tileset.
269
+ *
270
+ * @param {Function} callback The callback to execute for each tile. Has the following two parameters:
271
+ * 1. tile (Object) - the JSON tile
272
+ * 2. scene (THREE.Object3D | null) - The tile content. Contains a `batchTable` property. Can be null if the tile
273
+ * has not yet been loaded.
274
+ */
275
+ forEachTile(callback: Function): void;
276
+ }
277
+ import GeometryLayer from '../Layer/GeometryLayer';
@@ -253,6 +253,8 @@ class OGC3DTilesLayer extends GeometryLayer {
253
253
  this.pntsSizeMode = pntsSizeMode;
254
254
  this.pntsMinAttenuatedSize = pntsMinAttenuatedSize;
255
255
  this.pntsMaxAttenuatedSize = pntsMaxAttenuatedSize;
256
+
257
+ /** @type{any} */
256
258
  this.tilesRenderer = new TilesRenderer(this.source.url);
257
259
  if (config.source.isOGC3DTilesIonSource) {
258
260
  this.tilesRenderer.registerPlugin(new CesiumIonAuthPlugin({
@@ -289,6 +291,16 @@ class OGC3DTilesLayer extends GeometryLayer {
289
291
  if (config.sseThreshold) {
290
292
  this.sseThreshold = config.sseThreshold;
291
293
  }
294
+ // Used for custom schedule callbacks (VR)
295
+ this.tasks = [];
296
+ this.tilesSchedulingCB = func => {
297
+ this.tasks.push(func);
298
+ };
299
+ // We set our scheduling callback for tiles downloading and parsing -> MANDATORY for VR
300
+ // (WebXR session has its own requestAnimationFrame method separate from that of the window
301
+ // https://github.com/NASA-AMMOS/3DTilesRendererJS/issues/213#issuecomment-947943386)
302
+ this.tilesRenderer.downloadQueue.schedulingCallback = this.tilesSchedulingCB;
303
+ this.tilesRenderer.parseQueue.schedulingCallback = this.tilesSchedulingCB;
292
304
  }
293
305
 
294
306
  /**
@@ -382,8 +394,10 @@ class OGC3DTilesLayer extends GeometryLayer {
382
394
  });
383
395
  pointsMaterial.copy(material);
384
396
  material = pointsMaterial;
397
+ material.depthWrite = false;
385
398
  }
386
399
  if (material) {
400
+ material.transparent = true;
387
401
  ReferLayerProperties(material, this);
388
402
  }
389
403
  model.material = material;
@@ -405,8 +419,15 @@ class OGC3DTilesLayer extends GeometryLayer {
405
419
  }
406
420
  }
407
421
  }
422
+ handleTasks() {
423
+ for (let t = 0, l = this.tasks.length; t < l; t++) {
424
+ this.tasks[t]();
425
+ }
426
+ this.tasks.length = 0;
427
+ }
408
428
  preUpdate(context) {
409
429
  this.scale = context.camera._preSSE;
430
+ this.handleTasks();
410
431
  this.tilesRenderer.update();
411
432
  return null; // don't return any element because 3d-tiles-renderer already updates them
412
433
  }