itowns 2.45.1 → 2.45.2-next.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 (220) 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/view_3d_map_webxr.html +2 -5
  21. package/lib/Controls/FirstPersonControls.d.ts +90 -0
  22. package/lib/Controls/FlyControls.d.ts +36 -0
  23. package/lib/Controls/GlobeControls.d.ts +274 -0
  24. package/lib/Controls/PlanarControls.d.ts +339 -0
  25. package/lib/Controls/StateControl.d.ts +140 -0
  26. package/lib/Controls/StreetControls.d.ts +134 -0
  27. package/lib/Controls/VRControls.d.ts +56 -0
  28. package/lib/Controls/VRControls.js +409 -0
  29. package/lib/Converter/Feature2Mesh.d.ts +42 -0
  30. package/lib/Converter/Feature2Texture.d.ts +5 -0
  31. package/lib/Converter/convertToTile.d.ts +5 -0
  32. package/lib/Converter/convertToTile.js +2 -2
  33. package/lib/Converter/textureConverter.d.ts +4 -0
  34. package/lib/Core/3DTiles/C3DTBatchTable.d.ts +49 -0
  35. package/lib/Core/3DTiles/C3DTBatchTableHierarchyExtension.d.ts +37 -0
  36. package/lib/Core/3DTiles/C3DTBoundingVolume.d.ts +39 -0
  37. package/lib/Core/3DTiles/C3DTExtensions.d.ts +75 -0
  38. package/lib/Core/3DTiles/C3DTFeature.d.ts +47 -0
  39. package/lib/Core/3DTiles/C3DTilesEnums.d.ts +14 -0
  40. package/lib/Core/3DTiles/C3DTileset.d.ts +46 -0
  41. package/lib/Core/3DTiles/utils/BinaryPropertyAccessor.d.ts +14 -0
  42. package/lib/Core/AnimationPlayer.d.ts +53 -0
  43. package/lib/Core/CopcNode.d.ts +67 -0
  44. package/lib/Core/CopcNode.js +50 -69
  45. package/lib/Core/Deprecated/Undeprecator.d.ts +6 -0
  46. package/lib/Core/EntwinePointTileNode.d.ts +58 -0
  47. package/lib/Core/EntwinePointTileNode.js +6 -34
  48. package/lib/Core/Feature.d.ts +323 -0
  49. package/lib/Core/Geographic/GeoidGrid.d.ts +86 -0
  50. package/lib/Core/Label.d.ts +86 -0
  51. package/lib/Core/MainLoop.d.ts +23 -0
  52. package/lib/Core/Picking.d.ts +6 -0
  53. package/lib/Core/Picking.js +4 -0
  54. package/lib/Core/PointCloudNode.d.ts +14 -0
  55. package/lib/Core/PointCloudNode.js +28 -0
  56. package/lib/Core/Potree2Node.d.ts +11 -0
  57. package/lib/Core/Potree2Node.js +3 -57
  58. package/lib/Core/Potree2PointAttributes.d.ts +97 -0
  59. package/lib/Core/PotreeNode.d.ts +13 -0
  60. package/lib/Core/PotreeNode.js +17 -17
  61. package/lib/Core/Prefab/Globe/Atmosphere.d.ts +66 -0
  62. package/lib/Core/Prefab/Globe/Atmosphere.js +10 -5
  63. package/lib/Core/Prefab/Globe/GlobeLayer.d.ts +48 -0
  64. package/lib/Core/Prefab/Globe/GlobeTileBuilder.d.ts +38 -0
  65. package/lib/Core/Prefab/Globe/SkyShader.d.ts +5 -0
  66. package/lib/Core/Prefab/Globe/SkyShader.js +3 -3
  67. package/lib/Core/Prefab/GlobeView.d.ts +65 -0
  68. package/lib/Core/Prefab/GlobeView.js +9 -0
  69. package/lib/Core/Prefab/Planar/PlanarLayer.d.ts +38 -0
  70. package/lib/Core/Prefab/Planar/PlanarTileBuilder.d.ts +32 -0
  71. package/lib/Core/Prefab/PlanarView.d.ts +33 -0
  72. package/lib/Core/Prefab/TileBuilder.d.ts +63 -0
  73. package/lib/Core/Prefab/computeBufferTileGeometry.d.ts +17 -0
  74. package/lib/Core/Scheduler/Cache.d.ts +25 -0
  75. package/lib/Core/Scheduler/CancelledCommandException.d.ts +12 -0
  76. package/lib/Core/Scheduler/Scheduler.d.ts +106 -0
  77. package/lib/Core/Style.d.ts +248 -0
  78. package/lib/Core/StyleOptions.d.ts +455 -0
  79. package/lib/Core/System/Capabilities.d.ts +9 -0
  80. package/lib/Core/Tile/Tile.d.ts +70 -0
  81. package/lib/Core/Tile/TileGrid.d.ts +12 -0
  82. package/lib/Core/TileGeometry.d.ts +46 -0
  83. package/lib/Core/TileMesh.d.ts +50 -0
  84. package/lib/Core/TileMesh.js +2 -4
  85. package/lib/Core/View.d.ts +403 -0
  86. package/lib/Core/View.js +1 -7
  87. package/lib/Layer/C3DTilesLayer.d.ts +140 -0
  88. package/lib/Layer/ColorLayer.d.ts +128 -0
  89. package/lib/Layer/ColorLayer.js +4 -4
  90. package/lib/Layer/CopcLayer.d.ts +42 -0
  91. package/lib/Layer/CopcLayer.js +3 -6
  92. package/lib/Layer/ElevationLayer.d.ts +96 -0
  93. package/lib/Layer/ElevationLayer.js +3 -3
  94. package/lib/Layer/EntwinePointTileLayer.d.ts +56 -0
  95. package/lib/Layer/EntwinePointTileLayer.js +4 -3
  96. package/lib/Layer/FeatureGeometryLayer.d.ts +62 -0
  97. package/lib/Layer/GeoidLayer.d.ts +41 -0
  98. package/lib/Layer/GeometryLayer.d.ts +120 -0
  99. package/lib/Layer/InfoLayer.d.ts +24 -0
  100. package/lib/Layer/InfoLayer.js +1 -1
  101. package/lib/Layer/LabelLayer.d.ts +93 -0
  102. package/lib/Layer/LabelLayer.js +2 -2
  103. package/lib/Layer/Layer.d.ts +185 -0
  104. package/lib/Layer/LayerUpdateState.d.ts +24 -0
  105. package/lib/Layer/LayerUpdateStrategy.d.ts +11 -0
  106. package/lib/Layer/LayerUpdateStrategy.js +2 -7
  107. package/lib/Layer/OGC3DTilesLayer.d.ts +277 -0
  108. package/lib/Layer/OGC3DTilesLayer.js +21 -0
  109. package/lib/Layer/OrientedImageLayer.d.ts +53 -0
  110. package/lib/Layer/PointCloudLayer.d.ts +103 -0
  111. package/lib/Layer/PointCloudLayer.js +1 -1
  112. package/lib/Layer/Potree2Layer.d.ts +56 -0
  113. package/lib/Layer/PotreeLayer.d.ts +55 -0
  114. package/lib/Layer/RasterLayer.d.ts +8 -0
  115. package/lib/Layer/RasterLayer.js +2 -2
  116. package/lib/Layer/ReferencingLayerProperties.d.ts +2 -0
  117. package/lib/Layer/ReferencingLayerProperties.js +0 -12
  118. package/lib/Layer/TiledGeometryLayer.d.ts +192 -0
  119. package/lib/Layer/TiledGeometryLayer.js +4 -3
  120. package/lib/Main.d.ts +89 -0
  121. package/lib/Main.js +3 -1
  122. package/lib/Parser/B3dmParser.d.ts +26 -0
  123. package/lib/Parser/CameraCalibrationParser.d.ts +32 -0
  124. package/lib/Parser/GDFParser.d.ts +24 -0
  125. package/lib/Parser/GTXParser.d.ts +28 -0
  126. package/lib/Parser/GeoJsonParser.d.ts +12 -0
  127. package/lib/Parser/GpxParser.d.ts +12 -0
  128. package/lib/Parser/ISGParser.d.ts +23 -0
  129. package/lib/Parser/KMLParser.d.ts +12 -0
  130. package/lib/Parser/LASParser.d.ts +61 -0
  131. package/lib/Parser/MapBoxUrlParser.d.ts +9 -0
  132. package/lib/Parser/PntsParser.d.ts +4 -0
  133. package/lib/Parser/Potree2BinParser.d.ts +8 -0
  134. package/lib/Parser/PotreeBinParser.d.ts +4 -0
  135. package/lib/Parser/PotreeCinParser.d.ts +4 -0
  136. package/lib/Parser/ShapefileParser.d.ts +25 -0
  137. package/lib/Parser/VectorTileParser.d.ts +34 -0
  138. package/lib/Parser/XbilParser.d.ts +18 -0
  139. package/lib/Parser/deprecated/LegacyGLTFLoader.d.ts +32 -0
  140. package/lib/Parser/iGLTFLoader.d.ts +104 -0
  141. package/lib/Process/3dTilesProcessing.d.ts +43 -0
  142. package/lib/Process/FeatureProcessing.d.ts +4 -0
  143. package/lib/Process/LayeredMaterialNodeProcessing.d.ts +3 -0
  144. package/lib/Process/LayeredMaterialNodeProcessing.js +12 -12
  145. package/lib/Process/ObjectRemovalHelper.d.ts +32 -0
  146. package/lib/Process/handlerNodeError.d.ts +1 -0
  147. package/lib/Provider/3dTilesProvider.d.ts +7 -0
  148. package/lib/Provider/DataSourceProvider.d.ts +4 -0
  149. package/lib/Provider/Fetcher.d.ts +101 -0
  150. package/lib/Provider/PointCloudProvider.d.ts +4 -0
  151. package/lib/Provider/TileProvider.d.ts +4 -0
  152. package/lib/Provider/URLBuilder.d.ts +28 -0
  153. package/lib/Renderer/Camera.d.ts +95 -0
  154. package/lib/Renderer/Color.d.ts +3 -0
  155. package/lib/Renderer/ColorLayersOrdering.d.ts +38 -0
  156. package/lib/Renderer/ColorLayersOrdering.js +2 -2
  157. package/lib/Renderer/CommonMaterial.d.ts +6 -0
  158. package/lib/Renderer/Label2DRenderer.d.ts +31 -0
  159. package/lib/Renderer/LayeredMaterial.d.ts +121 -0
  160. package/lib/Renderer/LayeredMaterial.js +221 -141
  161. package/lib/Renderer/OBB.d.ts +65 -0
  162. package/lib/Renderer/OrientedImageCamera.d.ts +36 -0
  163. package/lib/Renderer/OrientedImageMaterial.d.ts +68 -0
  164. package/lib/Renderer/PointsMaterial.d.ts +226 -0
  165. package/lib/Renderer/PointsMaterial.js +60 -22
  166. package/lib/Renderer/RasterTile.d.ts +53 -0
  167. package/lib/Renderer/RasterTile.js +8 -9
  168. package/lib/Renderer/RenderMode.d.ts +11 -0
  169. package/lib/Renderer/RenderMode.js +1 -0
  170. package/lib/Renderer/Shader/ShaderChunk.d.ts +78 -0
  171. package/lib/Renderer/Shader/ShaderUtils.d.ts +5 -0
  172. package/lib/Renderer/WebXR.d.ts +33 -0
  173. package/lib/Renderer/WebXR.js +128 -47
  174. package/lib/Renderer/c3DEngine.d.ts +55 -0
  175. package/lib/Renderer/c3DEngine.js +5 -1
  176. package/lib/Source/C3DTilesGoogleSource.d.ts +38 -0
  177. package/lib/Source/C3DTilesIonSource.d.ts +31 -0
  178. package/lib/Source/C3DTilesSource.d.ts +17 -0
  179. package/lib/Source/CopcSource.d.ts +79 -0
  180. package/lib/Source/EntwinePointTileSource.d.ts +40 -0
  181. package/lib/Source/EntwinePointTileSource.js +0 -5
  182. package/lib/Source/FileSource.d.ts +118 -0
  183. package/lib/Source/OGC3DTilesGoogleSource.d.ts +24 -0
  184. package/lib/Source/OGC3DTilesIonSource.d.ts +26 -0
  185. package/lib/Source/OGC3DTilesSource.d.ts +21 -0
  186. package/lib/Source/OrientedImageSource.d.ts +48 -0
  187. package/lib/Source/Potree2Source.d.ts +157 -0
  188. package/lib/Source/PotreeSource.d.ts +69 -0
  189. package/lib/Source/Source.d.ts +122 -0
  190. package/lib/Source/TMSSource.d.ts +77 -0
  191. package/lib/Source/VectorTilesSource.d.ts +56 -0
  192. package/lib/Source/WFSSource.d.ts +110 -0
  193. package/lib/Source/WMSSource.d.ts +85 -0
  194. package/lib/Source/WMTSSource.d.ts +65 -0
  195. package/lib/ThreeExtended/capabilities/WebGL.d.ts +9 -0
  196. package/lib/ThreeExtended/libs/ktx-parse.module.d.ts +274 -0
  197. package/lib/ThreeExtended/libs/motion-controllers.module.d.ts +64 -0
  198. package/lib/ThreeExtended/libs/motion-controllers.module.js +375 -0
  199. package/lib/ThreeExtended/libs/zstddec.module.d.ts +6 -0
  200. package/lib/ThreeExtended/loaders/DDSLoader.js +40 -1
  201. package/lib/ThreeExtended/loaders/DRACOLoader.d.ts +41 -0
  202. package/lib/ThreeExtended/loaders/GLTFLoader.d.ts +16 -0
  203. package/lib/ThreeExtended/loaders/GLTFLoader.js +22 -3
  204. package/lib/ThreeExtended/loaders/KTX2Loader.d.ts +116 -0
  205. package/lib/ThreeExtended/loaders/KTX2Loader.js +9 -2
  206. package/lib/ThreeExtended/math/ColorSpaces.d.ts +56 -0
  207. package/lib/ThreeExtended/utils/BufferGeometryUtils.d.ts +62 -0
  208. package/lib/ThreeExtended/utils/BufferGeometryUtils.js +2 -2
  209. package/lib/ThreeExtended/utils/WorkerPool.d.ts +19 -0
  210. package/lib/ThreeExtended/webxr/XRControllerModelFactory.d.ts +25 -0
  211. package/lib/ThreeExtended/webxr/XRControllerModelFactory.js +209 -0
  212. package/lib/Utils/CameraUtils.d.ts +132 -0
  213. package/lib/Utils/DEMUtils.d.ts +84 -0
  214. package/lib/Utils/DEMUtils.js +2 -2
  215. package/lib/Utils/FeaturesUtils.d.ts +17 -0
  216. package/lib/Utils/Gradients.d.ts +13 -0
  217. package/lib/Utils/ThreeUtils.d.ts +14 -0
  218. package/lib/Utils/placeObjectOnGround.d.ts +28 -0
  219. package/lib/global.d.js +0 -0
  220. package/package.json +18 -15
@@ -0,0 +1,323 @@
1
+ export namespace FEATURE_TYPES {
2
+ let POINT: number;
3
+ let LINE: number;
4
+ let POLYGON: number;
5
+ }
6
+ /**
7
+ * @typedef {Object} FeatureBuildingOptions
8
+ * @property {string} crs - The CRS to convert the input coordinates to.
9
+ * @property {string} [structure='2d'] - data structure type : 2d or 3d.
10
+ * If the structure is 3d, the feature have 3 dimensions by vertices positions and
11
+ * a normal for each vertices.
12
+ * @property {Extent|boolean} [filteringExtent=undefined] - Optional filter to reject
13
+ * features outside of extent. Extent filtering is file extent if filteringExtent is true.
14
+ * @property {boolean} [buildExtent] - If true the geometry will
15
+ * have an extent property containing the area covered by the geometry.
16
+ * Default value is false if `structure` parameter is set to '3d', and true otherwise.
17
+ * True if the layer does not inherit from {@link GeometryLayer}.
18
+ * @property {string} forcedExtentCrs - force feature extent crs if buildExtent is true.
19
+ * @property {function} [filter] - Filter function to remove features
20
+ * @property {boolean} [mergeFeatures=true] - If true all geometries are merged by type and multi-type.
21
+ * @property {Style} style - The style to inherit when creating
22
+ * style for all new features.
23
+ *
24
+ */
25
+ /**
26
+ * @property {Extent} extent - The 2D extent containing all the points
27
+ * composing the geometry.
28
+ * @property {Object[]} indices - Contains the indices that define the geometry.
29
+ * Objects stored in this array have two properties, an `offset` and a `count`.
30
+ * The offset is related to the overall number of vertices in the Feature.
31
+ *
32
+ * @property {Object} properties - Properties of the geometry. It can be
33
+ * anything specified in the GeoJSON under the `properties` property.
34
+ */
35
+ export class FeatureGeometry {
36
+ /**
37
+ * @param {Feature} feature geometry
38
+ */
39
+ constructor(feature: Feature);
40
+ indices: any[];
41
+ properties: {};
42
+ size: number;
43
+ extent: Extent | undefined;
44
+ /**
45
+ * Add a new marker to indicate the starting of sub geometry and extends the vertices buffer.
46
+ * Then you have to push new the coordinates of sub geometry.
47
+ * The sub geometry stored in indices, see constructor for more information.
48
+ * @param {number} count - count of vertices
49
+ * @param {Feature} feature - the feature containing the geometry
50
+ */
51
+ startSubGeometry(count: number, feature: Feature): void;
52
+ /**
53
+ * After you have pushed new the coordinates of sub geometry without
54
+ * `startSubGeometry`, this function close sub geometry. The sub geometry
55
+ * stored in indices, see constructor for more information.
56
+ * @param {number} count count of vertices
57
+ * @param {Feature} feature - the feature containing the geometry
58
+ */
59
+ closeSubGeometry(count: number, feature: Feature): void;
60
+ getLastSubGeometry(): any;
61
+ /**
62
+ * Push new coordinates in vertices buffer.
63
+ * @param {Feature} feature - the feature containing the geometry
64
+ * @param {Coordinates} coordIn The coordinates to push.
65
+ */
66
+ pushCoordinates(feature: Feature, coordIn: Coordinates): void;
67
+ /**
68
+ * Push new values coordinates in vertices buffer without any transformation.
69
+ * No geographical conversion is made or the normal doesn't stored.
70
+ *
71
+ * @param {Feature} feature - the feature containing the geometry
72
+ * @param {Object} coordIn An object containing the coordinates values to push.
73
+ * @param {number} coordIn.x the x coordinate (in a local system).
74
+ * @param {number} coordIn.y the y coordinate (in a local system).
75
+ * @param {THREE.Vector3} [coordIn.normal] the normal on coordinates (only for `EPSG:4978` projection).
76
+ * @param {Coordinates} [coordProj] An optional argument containing the geodesic coordinates in EPSG:4326
77
+ * It allows the user to get access to the feature coordinates to set style.base_altitude.
78
+ */
79
+ pushCoordinatesValues(feature: Feature, coordIn: {
80
+ x: number;
81
+ y: number;
82
+ normal?: THREE.Vector3 | undefined;
83
+ }, coordProj?: Coordinates, ...args: any[]): void;
84
+ /**
85
+ * update geometry extent with the last sub geometry extent.
86
+ */
87
+ updateExtent(): void;
88
+ #private;
89
+ }
90
+ export default Feature;
91
+ /**
92
+ * An object regrouping a list of [features]{@link Feature} and the extent of this collection.
93
+ * **Warning**, the data (`extent` or `Coordinates`) can be stored in a local system.
94
+ * The local system center is the `center` property.
95
+ * To use `Feature` vertices or `FeatureCollection/Feature` extent in FeatureCollection.crs projection,
96
+ * it's necessary to transform `Coordinates` or `Extent` by `FeatureCollection.matrixWorld`.
97
+ *
98
+ * ```js
99
+ * // To have featureCollection extent in featureCollection.crs projection:
100
+ * featureCollection.extent.applyMatrix4(featureCollection.matrixWorld);
101
+ *
102
+ * // To have feature vertex in featureCollection.crs projection:
103
+ * const vertices = featureCollection.features[0].vertices;
104
+ * coord.crs = featureCollection.crs;
105
+ * coord.setFromArray(vertices)
106
+ * coord.applyMatrix4(featureCollection.matrixWorld);
107
+ *```
108
+ *
109
+ * @extends THREE.Object3D
110
+ *
111
+ * @property {Feature[]} features - The array of features composing the
112
+ * collection.
113
+ * @property {Extent?} extent - The 2D extent containing all the features
114
+ * composing the collection. The extent projection is the same local projection `FeatureCollection`.
115
+ * To transform `FeatureCollection.extent` to `FeatureCollection.crs` projection, the transformation matrix must be applied.
116
+ *
117
+ * **WARNING** if crs is `EPSG:4978` because the 3d geocentric system doesn't work with 2D `Extent`,
118
+ * The FeatureCollection.extent projection is the original projection.
119
+ * In this case, there isn't need to transform the extent.
120
+ *
121
+ * @property {string} crs - Geographic or Geocentric coordinates system.
122
+ * @property {boolean} isFeatureCollection - Used to check whether this is FeatureCollection.
123
+ * @property {number} size - The size structure, it's 3 for 3d and 2 for 2d.
124
+ * @property {Style} style - The collection style used to display the feature collection.
125
+ * @property {boolean} isInverted - This option is to be set to the
126
+ * correct value, true or false (default being false), if the computation of
127
+ * the coordinates needs to be inverted to same scheme as OSM, Google Maps
128
+ * or other system. See [this link](
129
+ * https://alastaira.wordpress.com/2011/07/06/converting-tms-tile-coordinates-to-googlebingosm-tile-coordinates)
130
+ * for more informations.
131
+ * @property {THREE.Matrix4} matrixWorldInverse - The matrix world inverse.
132
+ * @property {Coordinates} center - The local center coordinates in `EPSG:4326`.
133
+ * The local system is centred in this center.
134
+ *
135
+ */
136
+ export class FeatureCollection extends THREE.Object3D<THREE.Object3DEventMap> {
137
+ /**
138
+ * @param {FeatureBuildingOptions|Layer} options The building options .
139
+ */
140
+ constructor(options: FeatureBuildingOptions | Layer);
141
+ isFeatureCollection: boolean;
142
+ crs: any;
143
+ features: any[];
144
+ mergeFeatures: any;
145
+ size: number;
146
+ filterExtent: any;
147
+ style: any;
148
+ isInverted: boolean;
149
+ matrixWorldInverse: THREE.Matrix4;
150
+ center: Coordinates;
151
+ extent: Extent | undefined;
152
+ normalMatrixInverse: THREE.Matrix3;
153
+ /**
154
+ * Apply the matrix World inverse on the coordinates.
155
+ * This method is used when the coordinates is pushed
156
+ * to transform it in local system.
157
+ *
158
+ * @param {Coordinates} coordinates The coordinates
159
+ * @returns {Coordinates} The coordinates in local system
160
+ */
161
+ transformToLocalSystem(coordinates: Coordinates): Coordinates;
162
+ /**
163
+ * Update FeatureCollection extent with `extent` or all features extent if
164
+ * `extent` is `undefined`.
165
+ * @param {Extent} extent
166
+ */
167
+ updateExtent(extent: Extent): void;
168
+ /**
169
+ * Updates the global transform of the object and its descendants.
170
+ *
171
+ * @param {boolean} force The force
172
+ */
173
+ updateMatrixWorld(force: boolean): void;
174
+ /**
175
+ * Remove features that don't have {@link FeatureGeometry}.
176
+ */
177
+ removeEmptyFeature(): void;
178
+ /**
179
+ * Push the `feature` in FeatureCollection.
180
+ * @param {Feature} feature
181
+ */
182
+ pushFeature(feature: Feature): void;
183
+ requestFeature(type: any, callback: any): any;
184
+ /**
185
+ * Returns the Feature by type if `mergeFeatures` is `true` or returns the
186
+ * new instance of typed Feature.
187
+ *
188
+ * @param {string} type the type requested
189
+ * @returns {Feature}
190
+ */
191
+ requestFeatureByType(type: string): Feature;
192
+ /**
193
+ * Returns the Feature by type if `mergeFeatures` is `true` or returns the
194
+ * new instance of typed Feature.
195
+ *
196
+ * @param {string} id the id requested
197
+ * @param {string} type the type requested
198
+ * @returns {Feature}
199
+ */
200
+ requestFeatureById(id: string, type: string): Feature;
201
+ /**
202
+ * Add a new feature with references to all properties.
203
+ * It allows to have features with different styles
204
+ * without having to duplicate the geometry.
205
+ * @param {Feature} feature The feature to reference.
206
+ * @return {Feature} The new referenced feature
207
+ */
208
+ newFeatureByReference(feature: Feature): Feature;
209
+ #private;
210
+ }
211
+ export type FeatureBuildingOptions = {
212
+ /**
213
+ * - The CRS to convert the input coordinates to.
214
+ */
215
+ crs: string;
216
+ /**
217
+ * - data structure type : 2d or 3d.
218
+ * If the structure is 3d, the feature have 3 dimensions by vertices positions and
219
+ * a normal for each vertices.
220
+ */
221
+ structure?: string | undefined;
222
+ /**
223
+ * - Optional filter to reject
224
+ * features outside of extent. Extent filtering is file extent if filteringExtent is true.
225
+ */
226
+ filteringExtent?: boolean | Extent | undefined;
227
+ /**
228
+ * - If true the geometry will
229
+ * have an extent property containing the area covered by the geometry.
230
+ * Default value is false if `structure` parameter is set to '3d', and true otherwise.
231
+ * True if the layer does not inherit from {@link GeometryLayer}.
232
+ */
233
+ buildExtent?: boolean | undefined;
234
+ /**
235
+ * - force feature extent crs if buildExtent is true.
236
+ */
237
+ forcedExtentCrs: string;
238
+ /**
239
+ * - Filter function to remove features
240
+ */
241
+ filter?: Function | undefined;
242
+ /**
243
+ * - If true all geometries are merged by type and multi-type.
244
+ */
245
+ mergeFeatures?: boolean | undefined;
246
+ /**
247
+ * - The style to inherit when creating
248
+ * style for all new features.
249
+ */
250
+ style: Style;
251
+ };
252
+ import { Extent } from '@itowns/geographic';
253
+ /**
254
+ *
255
+ * This class improves and simplifies the construction and conversion of geographic data structures.
256
+ * It's an intermediary structure between geomatic formats and THREE objects.
257
+ *
258
+ * **Warning**, the data (`extent` or `Coordinates`) can be stored in a local system.
259
+ * To use vertices or extent in `Feature.crs` projection,
260
+ * it's necessary to transform `Coordinates` or `Extent` by `FeatureCollection.matrixWorld`.
261
+ *
262
+ * ```js
263
+ * // To have feature extent in featureCollection.crs projection:
264
+ * feature.extent.applyMatrix4(featureCollection.matrixWorld);
265
+ *
266
+ * // To have feature vertex in feature.crs projection:
267
+ * coord.crs = feature.crs;
268
+ * coord.setFromArray(feature.vertices)
269
+ * coord.applyMatrix4(featureCollection.matrixWorld);
270
+ *```
271
+ *
272
+ * @property {string} type - Geometry type, can be `point`, `line`, or
273
+ * `polygon`.
274
+ * @property {number[]} vertices - All the vertices of the Feature.
275
+ * @property {number[]} normals - All the normals of the Feature.
276
+ * @property {number} size - the number of values of the array that should be associated with a coordinates.
277
+ * The size is 3 with altitude and 2 without altitude.
278
+ * @property {boolean} hasRawElevationData - indicates if the geographic coordinates, from original source, has an elevation,
279
+ * the coordinates has a third coordinate.
280
+ * @property {string} crs - Geographic or Geocentric coordinates system.
281
+ * @property {FeatureGeometry[]} geometries - An array containing all {@link
282
+ * FeatureGeometry}.
283
+ * @property {Extent?} extent - The extent containing all the geometries
284
+ * composing the feature.
285
+ */
286
+ declare class Feature {
287
+ /**
288
+ *
289
+ * @param {string} type type of Feature. It can be 'point', 'line' or 'polygon'.
290
+ * @param {FeatureCollection} collection Parent feature collection.
291
+ */
292
+ constructor(type: string, collection: FeatureCollection);
293
+ type: string;
294
+ geometries: any[];
295
+ vertices: any[];
296
+ crs: any;
297
+ size: number;
298
+ normals: never[] | undefined;
299
+ hasRawElevationData: boolean;
300
+ transformToLocalSystem: (coordinates: Coordinates) => Coordinates;
301
+ extent: Extent | undefined;
302
+ useCrsOut: boolean | undefined;
303
+ _pos: number;
304
+ _pushValues: typeof push3DValues;
305
+ style: (properties: Object, featCtx: FeatureContext) => StyleOptions;
306
+ /**
307
+ * Instance a new {@link FeatureGeometry} and push in {@link Feature}.
308
+ * @returns {FeatureGeometry} the instancied geometry.
309
+ */
310
+ bindNewGeometry(): FeatureGeometry;
311
+ /**
312
+ * Update {@link Extent} feature with {@link Extent} geometry
313
+ * @param {FeatureGeometry} geometry used to update Feature {@link Extent}
314
+ */
315
+ updateExtent(geometry: FeatureGeometry): void;
316
+ /**
317
+ * @returns {number} the count of geometry.
318
+ */
319
+ get geometryCount(): number;
320
+ }
321
+ import { Coordinates } from '@itowns/geographic';
322
+ import * as THREE from 'three';
323
+ declare function push3DValues(value0: any, value1: any, value2?: number): void;
@@ -0,0 +1,86 @@
1
+ export default GeoidGrid;
2
+ /**
3
+ * An instance of `GeoidGrid` allows accessing some geoid height grid data from geographic instances (like some
4
+ * {@link Coordinates}). The geoid height grid data must contain geoid height values for a set of geographic points
5
+ * regularly dispatched on a planar surface.
6
+ *
7
+ * @property {Extent} extent The geographic extent of the geoid height grid data.
8
+ * @property {THREE.Vector2} step The distance between two consecutive points of the geoid height grid. The
9
+ * `x` value stands for the distance along the West-East direction, and the
10
+ * `y` value stands for the distance along the South-North direction.
11
+ * @property {THREE.Vector2} dimensions The planar dimensions of the geoid height grid data extent.
12
+ * @property {THREE.Vector2} dataSize The number of values in the gridded data along the West-East direction (`x`
13
+ * axis) and the South-North direction (`y` axis).
14
+ *
15
+ * @example
16
+ * // Create a set of gridded data.
17
+ * const data = [
18
+ * [1, 2, 3],
19
+ * [2, 3, 4],
20
+ * [3, 4, 5],
21
+ * ];
22
+ * // This set of data presents the following spatial distribution of geoid heights values :
23
+ * //
24
+ * // Latitudes ^
25
+ * // |
26
+ * // 41.0 | 3 4 5
27
+ * // 40.5 | 2 3 4
28
+ * // 40.0 | 1 2 3
29
+ * // |------------->
30
+ * // 1 2 3 Longitudes
31
+ *
32
+ * // Create a GeoidGrid allowing to access the gridded data.
33
+ * const geoidGrid = new GeoidGrid(
34
+ * new Extent('EPSG:4326', 1, 3, 40, 41),
35
+ * new THREE.Vector2(1, 0.5),
36
+ * (verticalIndex, horizontalIndex) => data[verticalIndex][horizontalIndex],
37
+ * );
38
+ *
39
+ * // Access a value of geoid height at some geographic coordinates.
40
+ * // The value is interpolated from the gridded data.
41
+ * const value = geoidGrid.getHeightAtCoordinates(
42
+ * new Coordinates('EPSG:4326', 1.5, 40.25)
43
+ * );
44
+ * // This should return 2.0, which is the result from the bi-linear
45
+ * // interpolation at the center of the `[[1, 2], [2, 3]]` subsection
46
+ * // of the grid data.
47
+ */
48
+ declare class GeoidGrid {
49
+ /**
50
+ * @param {Extent} extent The geographic extent of the geoid height grid data.
51
+ * @param {THREE.Vector2} step The distance between two consecutive points of the geoid height grid. The
52
+ * `x` value stands for the distance along the West-East direction, and the
53
+ * `y` value stands for the distance along the South-North direction.
54
+ * @param {function} getData A method that allows reading a value in the geoid height grid from its
55
+ * vertical and horizontal indexes. The lower an index, the lower the
56
+ * coordinate on the corresponding axis - 0 being the index of the minimal
57
+ * coordinate of the gridded data on a given axis. In other words :
58
+ * - `getData(0, 0)` must return the geoid height value at the SOUTH-WEST
59
+ * corner of your data extent.
60
+ * - `getData(0, j)` must return a geoid height on the southern limit of your
61
+ * data extent.
62
+ * - `getData(i, 0)` must return a geoid height on the western limit of your
63
+ * data extent.
64
+ * - if your gridded data has dimensions (rowNumber, colNumber),
65
+ * `getData(rowNumber - 1, colNumber - 1)` must return the geoid height at
66
+ * the NORTH-EAST corner of your data extent.
67
+ */
68
+ constructor(extent: Extent, step: THREE.Vector2, getData: Function);
69
+ extent: Extent;
70
+ step: THREE.Vector2;
71
+ dimensions: any;
72
+ dataSize: THREE.Vector2;
73
+ getData: Function;
74
+ /**
75
+ * Get the value of the geoid height at given geographic {@link Coordinates}. The geoid height value is
76
+ * bi-linearly interpolated from the gridded data accessed by the `GeoidGrid` instance.
77
+ *
78
+ * @param {Coordinates} coordinates Geographic coordinates to get the geoid height value at.
79
+ *
80
+ * @returns {number} The geoid height value at the given {@link Coordinates}, bi-interpolated from the gridded
81
+ * data accessed by the `GeoidGrid` instance.
82
+ */
83
+ getHeightAtCoordinates(coordinates: Coordinates): number;
84
+ }
85
+ import * as THREE from 'three';
86
+ import { Coordinates } from '@itowns/geographic';
@@ -0,0 +1,86 @@
1
+ export default Label;
2
+ /**
3
+ * An object that handles the display of a text and/or an icon, linked to a 3D
4
+ * position. The content of the `Label` is managed through a DOM object, in a
5
+ * `<div>` handled by the `Label2DRenderer`.
6
+ *
7
+ * @property {boolean} isLabel - Used to checkout whether this object is a
8
+ * Label. Default is true. You should not change this, as it is used internally
9
+ * for optimisation.
10
+ * @property {Element} content - The DOM object that contains the content of the
11
+ * label. The style and the position are applied on this object. All labels
12
+ * contain the `itowns-label` class, as well as a specific class related to the
13
+ * layer linked to it: `itowns-label-[layer-id]` (replace `[layer-id]` by the
14
+ * correct string).
15
+ * @property {THREE.Vector3} position - The position in the 3D world of the
16
+ * label.
17
+ * @property {number} padding - sets the padding area on all four sides of an element at once.
18
+ * @property {Coordinates} coordinates - The coordinates of the label.
19
+ * @property {number} order - Order of the label that will be read from the
20
+ * style. It helps sorting and prioritizing a Label during render.
21
+ */
22
+ declare class Label extends THREE.Object3D<THREE.Object3DEventMap> {
23
+ /**
24
+ * @param {Element|string} content - The content; can be a
25
+ * string, with or without HTML tags in it, or it can be an Element.
26
+ * @param {Coordinates} coordinates - The world coordinates, where to place
27
+ * the Label.
28
+ * @param {Style} style - The style to apply to the content. Once the style
29
+ * is applied, it cannot be changed directly. However, if it really needed,
30
+ * it can be accessed through `label.content.style`, but it is highly
31
+ * discouraged to do so.
32
+ */
33
+ constructor(content: (Element | string) | undefined, coordinates: Coordinates, style?: Style, ...args: any[]);
34
+ isLabel: boolean;
35
+ coordinates: Coordinates;
36
+ projectedPosition: {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ boundaries: {
41
+ left: number;
42
+ right: number;
43
+ top: number;
44
+ bottom: number;
45
+ };
46
+ content: Node;
47
+ anchor: any;
48
+ styleOffset: any;
49
+ icon: any;
50
+ iconOffset: {
51
+ left: number;
52
+ right: number;
53
+ top: number;
54
+ bottom: number;
55
+ };
56
+ zoom: {
57
+ min: any;
58
+ max: any;
59
+ };
60
+ order: any;
61
+ padding: number;
62
+ /**
63
+ * Moves a label on the screen, using screen coordinates. It updates the
64
+ * boundaries as it moves it.
65
+ *
66
+ * @param {number} x - X coordinates in pixels, from left.
67
+ * @param {number} y - Y coordinates in pixels, from top.
68
+ */
69
+ updateProjectedPosition(x: number, y: number): void;
70
+ updateCSSPosition(): void;
71
+ /**
72
+ * Updates the screen dimensions of the label, using
73
+ * `getBoundingClientRect`. It updates `width` and `height` property of the
74
+ * label, and the boundaries.
75
+ */
76
+ initDimensions(): void;
77
+ offset: {
78
+ left: any;
79
+ top: any;
80
+ } | undefined;
81
+ update3dPosition(crs: any): void;
82
+ updateElevationFromLayer(layer: any, nodes: any): void;
83
+ updateHorizonCullingPoint(): void;
84
+ }
85
+ import * as THREE from 'three';
86
+ import { Coordinates } from '@itowns/geographic';
@@ -0,0 +1,23 @@
1
+ export const RENDERING_PAUSED: 0;
2
+ export const RENDERING_SCHEDULED: 1;
3
+ export namespace MAIN_LOOP_EVENTS {
4
+ let UPDATE_START: string;
5
+ let BEFORE_CAMERA_UPDATE: string;
6
+ let AFTER_CAMERA_UPDATE: string;
7
+ let BEFORE_LAYER_UPDATE: string;
8
+ let AFTER_LAYER_UPDATE: string;
9
+ let BEFORE_RENDER: string;
10
+ let AFTER_RENDER: string;
11
+ let UPDATE_END: string;
12
+ }
13
+ export default MainLoop;
14
+ declare class MainLoop extends EventDispatcher<any> {
15
+ constructor(scheduler: any, engine: any);
16
+ renderingState: number;
17
+ scheduler: any;
18
+ gfxEngine: any;
19
+ scheduleViewUpdate(view: any, forceRedraw: any): void;
20
+ step(view: any, timestamp: any): void;
21
+ #private;
22
+ }
23
+ import { EventDispatcher } from 'three';
@@ -0,0 +1,6 @@
1
+ declare namespace _default {
2
+ function pickTilesAt(view: any, viewCoords: any, radius: any, layer: any, results?: any[]): any[];
3
+ function pickPointsAt(view: any, viewCoords: any, radius: any, layer: any, result?: any[]): any[] | undefined;
4
+ function pickObjectsAt(view: any, viewCoords: any, radius: any, object: any, target?: any[]): any[];
5
+ }
6
+ export default _default;
@@ -157,6 +157,10 @@ export default {
157
157
  // disable picking mode
158
158
  o.material.enablePicking(false);
159
159
 
160
+ // Skip if geometry is invalid or missing position attribute
161
+ if (!o.geometry || !o.geometry.attributes || !o.geometry.attributes.position) {
162
+ return;
163
+ }
160
164
  // if baseId matches objId, the clicked point belongs to `o`
161
165
  for (let i = 0; i < candidates.length; i++) {
162
166
  if (candidates[i].objId == o.baseId) {
@@ -0,0 +1,14 @@
1
+ export default PointCloudNode;
2
+ declare class PointCloudNode extends THREE.EventDispatcher<any> {
3
+ constructor(numPoints: number | undefined, layer: any);
4
+ numPoints: number;
5
+ layer: any;
6
+ children: any[];
7
+ bbox: THREE.Box3;
8
+ sse: number;
9
+ add(node: any, indexChild: any): void;
10
+ createChildAABB(node: any): void;
11
+ load(): any;
12
+ findCommonAncestor(node: any): any;
13
+ }
14
+ import * as THREE from 'three';
@@ -1,4 +1,7 @@
1
1
  import * as THREE from 'three';
2
+ const size = new THREE.Vector3();
3
+ const position = new THREE.Vector3();
4
+ const translation = new THREE.Vector3();
2
5
  class PointCloudNode extends THREE.EventDispatcher {
3
6
  constructor() {
4
7
  let numPoints = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
@@ -15,6 +18,31 @@ class PointCloudNode extends THREE.EventDispatcher {
15
18
  node.parent = this;
16
19
  this.createChildAABB(node, indexChild);
17
20
  }
21
+ createChildAABB(node) {
22
+ // factor to apply, based on the depth difference (can be > 1)
23
+ const f = 2 ** (node.depth - this.depth);
24
+
25
+ // size of the child node bbox (Vector3), based on the size of the
26
+ // parent node, and divided by the factor
27
+ this.bbox.getSize(size).divideScalar(f);
28
+
29
+ // initialize the child node bbox at the location of the parent node bbox
30
+ node.bbox.min.copy(this.bbox.min);
31
+
32
+ // position of the parent node, if it was at the same depth than the
33
+ // child, found by multiplying the tree position by the factor
34
+ position.copy(this).multiplyScalar(f);
35
+
36
+ // difference in position between the two nodes, at child depth, and
37
+ // scale it using the size
38
+ translation.subVectors(node, position).multiply(size);
39
+
40
+ // apply the translation to the child node bbox
41
+ node.bbox.min.add(translation);
42
+
43
+ // use the size computed above to set the max
44
+ node.bbox.max.copy(node.bbox.min).add(size);
45
+ }
18
46
  load() {
19
47
  // Query octree/HRC if we don't have children potreeNode yet.
20
48
  if (!this.octreeIsLoaded) {
@@ -0,0 +1,11 @@
1
+ export default Potree2Node;
2
+ declare class Potree2Node extends PotreeNode {
3
+ networkOptions(byteOffset: any, byteSize: any): any;
4
+ load(): Promise<any>;
5
+ loaded: boolean | undefined;
6
+ loading: boolean | undefined;
7
+ loadOctree(): Promise<void>;
8
+ loadHierarchy(): Promise<void>;
9
+ parseHierarchy(buffer: any): void;
10
+ }
11
+ import PotreeNode from '../Core/PotreeNode';
@@ -33,72 +33,18 @@ of the authors and should not be interpreted as representing official policies,
33
33
  either expressed or implied, of the FreeBSD Project.
34
34
  */
35
35
 
36
- import * as THREE from 'three';
37
- import PointCloudNode from "./PointCloudNode.js";
38
-
39
- // Create an A(xis)A(ligned)B(ounding)B(ox) for the child `childIndex` of one aabb.
40
- // (PotreeConverter protocol builds implicit octree hierarchy by applying the same
41
- // subdivision algo recursively)
42
- const dHalfLength = new THREE.Vector3();
36
+ import PotreeNode from "./PotreeNode.js";
43
37
  const NODE_TYPE = {
44
38
  NORMAL: 0,
45
39
  LEAF: 1,
46
40
  PROXY: 2
47
41
  };
48
- class Potree2Node extends PointCloudNode {
42
+ class Potree2Node extends PotreeNode {
49
43
  constructor() {
50
44
  let numPoints = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
51
45
  let childrenBitField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
52
46
  let layer = arguments.length > 2 ? arguments[2] : undefined;
53
- super(numPoints, layer);
54
- this.childrenBitField = childrenBitField;
55
- this.id = '';
56
- this.depth = 0;
57
- this.baseurl = layer.source.baseurl;
58
- }
59
- add(node, indexChild) {
60
- super.add(node, indexChild);
61
- node.id = this.id + indexChild;
62
- node.depth = this.depth + 1;
63
- }
64
- createChildAABB(node, childIndex) {
65
- // Code inspired from potree
66
- node.bbox.copy(this.bbox);
67
- this.bbox.getCenter(node.bbox.max);
68
- dHalfLength.copy(node.bbox.max).sub(this.bbox.min);
69
- if (childIndex === 1) {
70
- node.bbox.min.z += dHalfLength.z;
71
- node.bbox.max.z += dHalfLength.z;
72
- } else if (childIndex === 3) {
73
- node.bbox.min.z += dHalfLength.z;
74
- node.bbox.max.z += dHalfLength.z;
75
- node.bbox.min.y += dHalfLength.y;
76
- node.bbox.max.y += dHalfLength.y;
77
- } else if (childIndex === 0) {
78
- //
79
- } else if (childIndex === 2) {
80
- node.bbox.min.y += dHalfLength.y;
81
- node.bbox.max.y += dHalfLength.y;
82
- } else if (childIndex === 5) {
83
- node.bbox.min.z += dHalfLength.z;
84
- node.bbox.max.z += dHalfLength.z;
85
- node.bbox.min.x += dHalfLength.x;
86
- node.bbox.max.x += dHalfLength.x;
87
- } else if (childIndex === 7) {
88
- node.bbox.min.add(dHalfLength);
89
- node.bbox.max.add(dHalfLength);
90
- } else if (childIndex === 4) {
91
- node.bbox.min.x += dHalfLength.x;
92
- node.bbox.max.x += dHalfLength.x;
93
- } else if (childIndex === 6) {
94
- node.bbox.min.y += dHalfLength.y;
95
- node.bbox.max.y += dHalfLength.y;
96
- node.bbox.min.x += dHalfLength.x;
97
- node.bbox.max.x += dHalfLength.x;
98
- }
99
- }
100
- get octreeIsLoaded() {
101
- return !(this.childrenBitField && this.children.length === 0);
47
+ super(numPoints, childrenBitField, layer);
102
48
  }
103
49
  get url() {
104
50
  return `${this.baseurl}/octree.bin`;