@vcmap/core 5.0.0-rc.28 → 5.0.0-rc.29

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 (191) hide show
  1. package/README.md +9 -3
  2. package/build/postinstall.js +13 -2
  3. package/index.d.ts +155 -106
  4. package/package.json +9 -4
  5. package/src/category/category.js +71 -32
  6. package/src/category/categoryCollection.js +27 -18
  7. package/src/cesium/cesiumVcsCameraPrimitive.js +13 -5
  8. package/src/cesium/entity.js +3 -1
  9. package/src/cesium/wallpaperMaterial.js +4 -2
  10. package/src/classRegistry.js +11 -4
  11. package/src/featureProvider/abstractFeatureProvider.js +43 -22
  12. package/src/featureProvider/tileProviderFeatureProvider.js +11 -5
  13. package/src/featureProvider/wmsFeatureProvider.js +37 -15
  14. package/src/interaction/abstractInteraction.js +5 -1
  15. package/src/interaction/coordinateAtPixel.js +34 -12
  16. package/src/interaction/eventHandler.js +63 -23
  17. package/src/interaction/featureAtPixelInteraction.js +96 -32
  18. package/src/interaction/featureProviderInteraction.js +23 -8
  19. package/src/interaction/interactionChain.js +19 -9
  20. package/src/interaction/interactionType.js +23 -26
  21. package/src/layer/cesium/cesiumTilesetCesiumImpl.js +45 -15
  22. package/src/layer/cesium/clusterContext.js +10 -3
  23. package/src/layer/cesium/dataSourceCesiumImpl.js +13 -4
  24. package/src/layer/cesium/openStreetMapCesiumImpl.js +7 -3
  25. package/src/layer/cesium/rasterLayerCesiumImpl.js +6 -2
  26. package/src/layer/cesium/singleImageCesiumImpl.js +14 -3
  27. package/src/layer/cesium/terrainCesiumImpl.js +3 -2
  28. package/src/layer/cesium/tmsCesiumImpl.js +15 -3
  29. package/src/layer/cesium/vectorCesiumImpl.js +69 -25
  30. package/src/layer/cesium/vectorContext.js +25 -5
  31. package/src/layer/cesium/vectorRasterTileCesiumImpl.js +15 -5
  32. package/src/layer/cesium/vectorTileImageryProvider.js +51 -13
  33. package/src/layer/cesium/wmsCesiumImpl.js +15 -3
  34. package/src/layer/cesium/wmtsCesiumImpl.js +18 -6
  35. package/src/layer/cesium/x3dmHelper.js +4 -1
  36. package/src/layer/cesiumTilesetLayer.js +55 -26
  37. package/src/layer/czmlLayer.js +11 -5
  38. package/src/layer/dataSourceLayer.js +25 -17
  39. package/src/layer/featureLayer.js +33 -18
  40. package/src/layer/featureStoreLayer.js +161 -99
  41. package/src/layer/featureStoreLayerChanges.js +57 -17
  42. package/src/layer/featureVisibility.js +89 -59
  43. package/src/layer/geojsonHelpers.js +70 -29
  44. package/src/layer/geojsonLayer.js +17 -11
  45. package/src/layer/globalHider.js +14 -4
  46. package/src/layer/layer.js +77 -44
  47. package/src/layer/layerImplementation.js +12 -4
  48. package/src/layer/oblique/layerObliqueImpl.js +3 -1
  49. package/src/layer/oblique/obliqueHelpers.js +75 -30
  50. package/src/layer/oblique/vectorObliqueImpl.js +175 -69
  51. package/src/layer/openStreetMapLayer.js +34 -20
  52. package/src/layer/openlayers/layerOpenlayersImpl.js +37 -15
  53. package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +3 -1
  54. package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +3 -1
  55. package/src/layer/openlayers/singleImageOpenlayersImpl.js +3 -1
  56. package/src/layer/openlayers/tileDebugOpenlayersImpl.js +3 -1
  57. package/src/layer/openlayers/tmsOpenlayersImpl.js +6 -3
  58. package/src/layer/openlayers/vectorOpenlayersImpl.js +14 -4
  59. package/src/layer/openlayers/vectorTileOpenlayersImpl.js +12 -5
  60. package/src/layer/openlayers/wmsOpenlayersImpl.js +3 -1
  61. package/src/layer/openlayers/wmtsOpenlayersImpl.js +12 -5
  62. package/src/layer/pointCloudLayer.js +21 -10
  63. package/src/layer/rasterLayer.js +73 -22
  64. package/src/layer/singleImageLayer.js +10 -7
  65. package/src/layer/terrainHelpers.js +30 -19
  66. package/src/layer/terrainLayer.js +16 -7
  67. package/src/layer/tileLoadedHelper.js +9 -4
  68. package/src/layer/tileProvider/mvtTileProvider.js +10 -4
  69. package/src/layer/tileProvider/staticGeojsonTileProvider.js +10 -4
  70. package/src/layer/tileProvider/tileProvider.js +163 -87
  71. package/src/layer/tileProvider/urlTemplateTileProvider.js +10 -4
  72. package/src/layer/tmsLayer.js +7 -6
  73. package/src/layer/vectorHelpers.js +34 -25
  74. package/src/layer/vectorLayer.js +77 -36
  75. package/src/layer/vectorProperties.js +245 -74
  76. package/src/layer/vectorSymbols.js +3 -1
  77. package/src/layer/vectorTileLayer.js +121 -70
  78. package/src/layer/wfsLayer.js +19 -8
  79. package/src/layer/wmsHelpers.js +11 -6
  80. package/src/layer/wmsLayer.js +36 -14
  81. package/src/layer/wmtsLayer.js +35 -20
  82. package/src/map/baseOLMap.js +57 -31
  83. package/src/map/cameraLimiter.js +67 -18
  84. package/src/map/cesiumMap.js +307 -95
  85. package/src/map/obliqueMap.js +84 -34
  86. package/src/map/openlayersMap.js +40 -19
  87. package/src/map/vcsMap.js +21 -8
  88. package/src/oblique/helpers.js +212 -64
  89. package/src/oblique/obliqueCollection.js +111 -48
  90. package/src/oblique/obliqueDataSet.js +53 -21
  91. package/src/oblique/obliqueImage.js +50 -17
  92. package/src/oblique/obliqueImageMeta.js +7 -6
  93. package/src/oblique/obliqueProvider.js +75 -27
  94. package/src/oblique/obliqueView.js +18 -7
  95. package/src/oblique/obliqueViewDirection.js +3 -2
  96. package/src/oblique/parseImageJson.js +57 -23
  97. package/src/ol/feature.js +8 -3
  98. package/src/ol/geom/circle.js +12 -3
  99. package/src/ol/geom/geometryCollection.js +11 -4
  100. package/src/ol/render/canvas/canvasTileRenderer.js +11 -9
  101. package/src/overrideClassRegistry.js +13 -3
  102. package/src/style/arcStyle.js +129 -36
  103. package/src/style/arrowStyle.js +57 -22
  104. package/src/style/declarativeStyleItem.js +107 -62
  105. package/src/style/shapesCategory.js +8 -6
  106. package/src/style/styleFactory.js +4 -1
  107. package/src/style/styleHelpers.js +17 -8
  108. package/src/style/styleItem.js +28 -10
  109. package/src/style/vectorStyleItem.js +160 -74
  110. package/src/style/writeStyle.js +5 -7
  111. package/src/util/clipping/clippingObject.js +72 -38
  112. package/src/util/clipping/clippingObjectManager.js +53 -19
  113. package/src/util/clipping/clippingPlaneHelper.js +120 -53
  114. package/src/util/collection.js +12 -6
  115. package/src/util/editor/createFeatureSession.js +21 -6
  116. package/src/util/editor/editFeaturesSession.js +41 -15
  117. package/src/util/editor/editGeometrySession.js +55 -30
  118. package/src/util/editor/editorHelpers.js +114 -29
  119. package/src/util/editor/editorSessionHelpers.js +8 -3
  120. package/src/util/editor/interactions/createBBoxInteraction.js +11 -3
  121. package/src/util/editor/interactions/createCircleInteraction.js +7 -2
  122. package/src/util/editor/interactions/createLineStringInteraction.js +7 -2
  123. package/src/util/editor/interactions/createPolygonInteraction.js +7 -2
  124. package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +7 -5
  125. package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +8 -3
  126. package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +4 -2
  127. package/src/util/editor/interactions/insertVertexInteraction.js +17 -6
  128. package/src/util/editor/interactions/mapInteractionController.js +31 -14
  129. package/src/util/editor/interactions/removeVertexInteraction.js +4 -1
  130. package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +19 -10
  131. package/src/util/editor/interactions/selectMultiFeatureInteraction.js +33 -20
  132. package/src/util/editor/interactions/selectSingleFeatureInteraction.js +14 -8
  133. package/src/util/editor/selectFeaturesSession.js +37 -21
  134. package/src/util/editor/transformation/create2DHandlers.js +82 -37
  135. package/src/util/editor/transformation/create3DHandlers.js +187 -84
  136. package/src/util/editor/transformation/extrudeInteraction.js +20 -5
  137. package/src/util/editor/transformation/rotateInteraction.js +29 -16
  138. package/src/util/editor/transformation/scaleInteraction.js +31 -15
  139. package/src/util/editor/transformation/transformationHandler.js +23 -8
  140. package/src/util/editor/transformation/transformationTypes.js +8 -4
  141. package/src/util/editor/transformation/translateInteraction.js +86 -32
  142. package/src/util/editor/validateGeoemetry.js +3 -1
  143. package/src/util/exclusiveManager.js +6 -3
  144. package/src/util/extent.js +20 -10
  145. package/src/util/featureconverter/arcToCesium.js +46 -12
  146. package/src/util/featureconverter/circleToCesium.js +61 -27
  147. package/src/util/featureconverter/convert.js +85 -13
  148. package/src/util/featureconverter/extent3D.js +69 -28
  149. package/src/util/featureconverter/featureconverterHelper.js +232 -79
  150. package/src/util/featureconverter/lineStringToCesium.js +107 -35
  151. package/src/util/featureconverter/pointHelpers.js +117 -45
  152. package/src/util/featureconverter/pointToCesium.js +128 -31
  153. package/src/util/featureconverter/polygonToCesium.js +50 -16
  154. package/src/util/fetch.js +3 -1
  155. package/src/util/geometryHelpers.js +15 -10
  156. package/src/util/indexedCollection.js +7 -3
  157. package/src/util/isMobile.js +8 -2
  158. package/src/util/layerCollection.js +28 -12
  159. package/src/util/mapCollection.js +37 -18
  160. package/src/util/math.js +35 -19
  161. package/src/util/overrideCollection.js +57 -32
  162. package/src/util/projection.js +21 -5
  163. package/src/util/urlHelpers.js +5 -3
  164. package/src/util/viewpoint.js +66 -33
  165. package/src/vcsApp.js +133 -69
  166. package/src/vcsModule.js +3 -2
  167. package/src/vcsModuleHelpers.js +24 -9
  168. package/src/vcsObject.js +3 -2
  169. package/tests/data/dynamicPointCzml.json +24 -35
  170. package/tests/data/oblique/imageData/imagev34.json +56 -272
  171. package/tests/data/oblique/imageData/imagev35.json +272 -19
  172. package/tests/data/oblique/imageData/imagev35PerImageSize.json +299 -19
  173. package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -1
  174. package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -1
  175. package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -1
  176. package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -1
  177. package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -1
  178. package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -1
  179. package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -1
  180. package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -1
  181. package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -1
  182. package/tests/data/oblique/tiledImageData/image.json +70 -1
  183. package/tests/data/terrain/layer.json +121 -130
  184. package/tests/data/testGeoJSON.json +4 -16
  185. package/tests/unit/helpers/cesiumHelpers.js +58 -33
  186. package/tests/unit/helpers/helpers.js +10 -2
  187. package/tests/unit/helpers/imageHelpers.js +8 -4
  188. package/tests/unit/helpers/obliqueData.js +39 -13
  189. package/tests/unit/helpers/obliqueHelpers.js +12 -9
  190. package/tests/unit/helpers/openlayersHelpers.js +4 -1
  191. package/tests/unit/helpers/terrain/terrainData.js +8 -7
@@ -20,13 +20,20 @@ import Projection from '../projection.js';
20
20
  * @returns {Array<import("@vcmap-cesium/engine").CircleGeometry>}
21
21
  * @private
22
22
  */
23
- export function createSolidGeometries(options, height, perPositionHeight, extrudedHeight) {
24
- return [new CircleGeometry({
25
- ...options,
26
- height,
27
- granularity: 0.02,
28
- extrudedHeight,
29
- })];
23
+ export function createSolidGeometries(
24
+ options,
25
+ height,
26
+ perPositionHeight,
27
+ extrudedHeight,
28
+ ) {
29
+ return [
30
+ new CircleGeometry({
31
+ ...options,
32
+ height,
33
+ granularity: 0.02,
34
+ extrudedHeight,
35
+ }),
36
+ ];
30
37
  }
31
38
 
32
39
  /**
@@ -37,13 +44,20 @@ export function createSolidGeometries(options, height, perPositionHeight, extrud
37
44
  * @returns {Array<import("@vcmap-cesium/engine").CircleOutlineGeometry>}
38
45
  * @private
39
46
  */
40
- export function createOutlineGeometries(options, height, perPositionHeight, extrudedHeight) {
41
- return [new CircleOutlineGeometry({
42
- ...options,
43
- height,
44
- extrudedHeight,
45
- granularity: 0.02,
46
- })];
47
+ export function createOutlineGeometries(
48
+ options,
49
+ height,
50
+ perPositionHeight,
51
+ extrudedHeight,
52
+ ) {
53
+ return [
54
+ new CircleOutlineGeometry({
55
+ ...options,
56
+ height,
57
+ extrudedHeight,
58
+ granularity: 0.02,
59
+ }),
60
+ ];
47
61
  }
48
62
 
49
63
  /**
@@ -73,11 +87,7 @@ export function getLineGeometryOptions(options, style) {
73
87
  ];
74
88
 
75
89
  // circular returns polygon with GeometryLayout.XY
76
- const circlePolygon = circular(
77
- wgs84Center,
78
- radius,
79
- 40,
80
- );
90
+ const circlePolygon = circular(wgs84Center, radius, 40);
81
91
  const pos = circlePolygon.getLinearRing(0).getCoordinates();
82
92
  const positions = pos.map((coord) => {
83
93
  return Cartesian3.fromDegrees(coord[0], coord[1], cartographic.height);
@@ -130,8 +140,16 @@ export function getGeometryOptions(geometry, positionHeightAdjustment) {
130
140
  const wgs84Point = Projection.mercatorToWgs84(olPoint, true);
131
141
 
132
142
  // Cesium coordinates of center and radius
133
- const center = Cartesian3.fromDegrees(wgs84Center[0], wgs84Center[1], wgs84Center[2]);
134
- const point = Cartesian3.fromDegrees(wgs84Point[0], wgs84Point[1], wgs84Center[2]);
143
+ const center = Cartesian3.fromDegrees(
144
+ wgs84Center[0],
145
+ wgs84Center[1],
146
+ wgs84Center[2],
147
+ );
148
+ const point = Cartesian3.fromDegrees(
149
+ wgs84Point[0],
150
+ wgs84Point[1],
151
+ wgs84Center[2],
152
+ );
135
153
 
136
154
  // Computation of radius in Cesium 3D
137
155
  const radius = Cartesian3.distance(center, point);
@@ -187,13 +205,16 @@ export function validateCircle(circle) {
187
205
  const flatCoordinates = circle.getFlatCoordinates();
188
206
  const stride = circle.getStride();
189
207
  // needs at least one full coordinate + a radius value and a non 0 radius
190
- if (flatCoordinates && flatCoordinates.length >= stride + 1 && flatCoordinates[stride] !== flatCoordinates[0]) {
191
- return flatCoordinates.every(value => Number.isFinite(value));
208
+ if (
209
+ flatCoordinates &&
210
+ flatCoordinates.length >= stride + 1 &&
211
+ flatCoordinates[stride] !== flatCoordinates[0]
212
+ ) {
213
+ return flatCoordinates.every((value) => Number.isFinite(value));
192
214
  }
193
215
  return false;
194
216
  }
195
217
 
196
-
197
218
  /**
198
219
  * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
199
220
  * @param {import("ol/style/Style").default} style
@@ -202,13 +223,26 @@ export function validateCircle(circle) {
202
223
  * @param {import("@vcmap-cesium/engine").Scene} scene
203
224
  * @param {import("@vcmap/core").VectorContext|import("@vcmap/core").ClusterContext} context
204
225
  */
205
- export default function circleToCesium(feature, style, geometries, vectorProperties, scene, context) {
226
+ export default function circleToCesium(
227
+ feature,
228
+ style,
229
+ geometries,
230
+ vectorProperties,
231
+ scene,
232
+ context,
233
+ ) {
206
234
  if (!style.getFill() && !style.getStroke()) {
207
235
  return;
208
236
  }
209
237
  const circleGeometryFactory = getGeometryFactory();
210
- const validGeometries = geometries.filter(circle => validateCircle(circle));
238
+ const validGeometries = geometries.filter((circle) => validateCircle(circle));
211
239
  addPrimitivesToContext(
212
- feature, style, validGeometries, vectorProperties, scene, circleGeometryFactory, context,
240
+ feature,
241
+ style,
242
+ validGeometries,
243
+ vectorProperties,
244
+ scene,
245
+ circleGeometryFactory,
246
+ context,
213
247
  );
214
248
  }
@@ -22,28 +22,84 @@ import ArcStyle, { featureArcStruct } from '../../style/arcStyle.js';
22
22
  * @param {import("@vcmap-cesium/engine").Scene} scene
23
23
  * @param {import("@vcmap/core").VectorContext|import("@vcmap/core").ClusterContext} context
24
24
  */
25
- function convertGeometry(feature, geometry, style, vectorProperties, scene, context) {
25
+ function convertGeometry(
26
+ feature,
27
+ geometry,
28
+ style,
29
+ vectorProperties,
30
+ scene,
31
+ context,
32
+ ) {
26
33
  if (geometry instanceof Point) {
27
34
  pointToCesium(feature, style, [geometry], vectorProperties, scene, context);
28
35
  } else if (geometry instanceof Polygon) {
29
- polygonToCesium(feature, style, [geometry], vectorProperties, scene, context);
36
+ polygonToCesium(
37
+ feature,
38
+ style,
39
+ [geometry],
40
+ vectorProperties,
41
+ scene,
42
+ context,
43
+ );
30
44
  } else if (geometry instanceof LineString) {
31
45
  if (style instanceof ArcStyle && feature[featureArcStruct].coordinates) {
32
46
  arcToCesium(feature, style, [geometry], vectorProperties, scene, context);
33
47
  } else {
34
- lineStringToCesium(feature, style, [geometry], vectorProperties, scene, context);
48
+ lineStringToCesium(
49
+ feature,
50
+ style,
51
+ [geometry],
52
+ vectorProperties,
53
+ scene,
54
+ context,
55
+ );
35
56
  }
36
57
  } else if (geometry instanceof Circle) {
37
- circleToCesium(feature, style, [geometry], vectorProperties, scene, context);
58
+ circleToCesium(
59
+ feature,
60
+ style,
61
+ [geometry],
62
+ vectorProperties,
63
+ scene,
64
+ context,
65
+ );
38
66
  } else if (geometry instanceof MultiPoint) {
39
- pointToCesium(feature, style, geometry.getPoints(), vectorProperties, scene, context);
67
+ pointToCesium(
68
+ feature,
69
+ style,
70
+ geometry.getPoints(),
71
+ vectorProperties,
72
+ scene,
73
+ context,
74
+ );
40
75
  } else if (geometry instanceof MultiPolygon) {
41
- polygonToCesium(feature, style, geometry.getPolygons(), vectorProperties, scene, context);
76
+ polygonToCesium(
77
+ feature,
78
+ style,
79
+ geometry.getPolygons(),
80
+ vectorProperties,
81
+ scene,
82
+ context,
83
+ );
42
84
  } else if (geometry instanceof MultiLineString) {
43
- lineStringToCesium(feature, style, geometry.getLineStrings(), vectorProperties, scene, context);
85
+ lineStringToCesium(
86
+ feature,
87
+ style,
88
+ geometry.getLineStrings(),
89
+ vectorProperties,
90
+ scene,
91
+ context,
92
+ );
44
93
  } else if (geometry instanceof GeometryCollection) {
45
94
  geometry.getGeometries().forEach((currentGeometry) => {
46
- convertGeometry(feature, currentGeometry, style, vectorProperties, scene, context);
95
+ convertGeometry(
96
+ feature,
97
+ currentGeometry,
98
+ style,
99
+ vectorProperties,
100
+ scene,
101
+ context,
102
+ );
47
103
  });
48
104
  }
49
105
  }
@@ -57,7 +113,9 @@ function convertGeometry(feature, geometry, style, vectorProperties, scene, cont
57
113
  export function getStylesArray(style, feature, resolution = 1) {
58
114
  const styles = [];
59
115
  if (typeof style === 'function') {
60
- styles.push(...getStylesArray(style(feature, resolution), feature, resolution));
116
+ styles.push(
117
+ ...getStylesArray(style(feature, resolution), feature, resolution),
118
+ );
61
119
  } else if (Array.isArray(style)) {
62
120
  style.forEach((currentStyle) => {
63
121
  styles.push(...getStylesArray(currentStyle, feature, resolution));
@@ -68,7 +126,6 @@ export function getStylesArray(style, feature, resolution = 1) {
68
126
  return styles;
69
127
  }
70
128
 
71
-
72
129
  /**
73
130
  * function to convert a feature to an array of Cesium.Primitives given a style and default properties. the resulting primitives
74
131
  * must be added to the modules collections here
@@ -78,12 +135,27 @@ export function getStylesArray(style, feature, resolution = 1) {
78
135
  * @param {import("@vcmap/core").VectorContext|import("@vcmap/core").ClusterContext} context
79
136
  * @param {import("@vcmap-cesium/engine").Scene} scene
80
137
  */
81
- export default function convert(feature, style, vectorProperties, context, scene) {
138
+ export default function convert(
139
+ feature,
140
+ style,
141
+ vectorProperties,
142
+ context,
143
+ scene,
144
+ ) {
82
145
  const styles = getStylesArray(feature.getStyle() || style, feature, 0);
83
146
  styles.forEach((currentStyle) => {
84
- const geometry = /** @type {import("ol/geom/Geometry").default} */(currentStyle.getGeometryFunction()(feature));
147
+ const geometry = /** @type {import("ol/geom/Geometry").default} */ (
148
+ currentStyle.getGeometryFunction()(feature)
149
+ );
85
150
  if (geometry) {
86
- convertGeometry(feature, geometry, currentStyle, vectorProperties, scene, context);
151
+ convertGeometry(
152
+ feature,
153
+ geometry,
154
+ currentStyle,
155
+ vectorProperties,
156
+ scene,
157
+ context,
158
+ );
87
159
  }
88
160
  });
89
161
  }
@@ -11,7 +11,14 @@ class Extent3D {
11
11
  static fromArray(array) {
12
12
  check(array, [Number]);
13
13
  check(array.length, 6);
14
- return new Extent3D(array[0], array[1], array[2], array[3], array[4], array[5]);
14
+ return new Extent3D(
15
+ array[0],
16
+ array[1],
17
+ array[2],
18
+ array[3],
19
+ array[4],
20
+ array[5],
21
+ );
15
22
  }
16
23
 
17
24
  /**
@@ -56,7 +63,14 @@ class Extent3D {
56
63
  * @param {number} maxY
57
64
  * @param {number} maxZ
58
65
  */
59
- constructor(minX = Infinity, minY = Infinity, minZ = Infinity, maxX = -Infinity, maxY = -Infinity, maxZ = -Infinity) {
66
+ constructor(
67
+ minX = Infinity,
68
+ minY = Infinity,
69
+ minZ = Infinity,
70
+ maxX = -Infinity,
71
+ maxY = -Infinity,
72
+ maxZ = -Infinity,
73
+ ) {
60
74
  /**
61
75
  * @type {number}
62
76
  */
@@ -89,25 +103,31 @@ class Extent3D {
89
103
  extendWithGeometry(geometry) {
90
104
  if (geometry.getType() === 'GeometryCollection') {
91
105
  /** @type {import("ol/geom/GeometryCollection").default} */ (geometry)
92
- .getGeometriesArray().forEach((geom) => { this.extendWithGeometry(geom); });
106
+ .getGeometriesArray()
107
+ .forEach((geom) => {
108
+ this.extendWithGeometry(geom);
109
+ });
93
110
  } else if (geometry.getType() === 'Circle') {
94
- const flatCoordinates = /** @type {import("ol/geom/Circle").default} */ (geometry).getFlatCoordinates();
95
- const stride = /** @type {import("ol/geom/Circle").default} */ (geometry).getStride();
111
+ const flatCoordinates = /** @type {import("ol/geom/Circle").default} */ (
112
+ geometry
113
+ ).getFlatCoordinates();
114
+ const stride = /** @type {import("ol/geom/Circle").default} */ (
115
+ geometry
116
+ ).getStride();
96
117
  const radius = flatCoordinates[stride] - flatCoordinates[0];
97
- this.extendXY(
98
- flatCoordinates[0] - radius,
99
- flatCoordinates[1] - radius,
100
- );
101
- this.extendXY(
102
- flatCoordinates[0] + radius,
103
- flatCoordinates[1] + radius,
104
- );
118
+ this.extendXY(flatCoordinates[0] - radius, flatCoordinates[1] - radius);
119
+ this.extendXY(flatCoordinates[0] + radius, flatCoordinates[1] + radius);
105
120
  if (stride > 2) {
106
121
  this.extendZ(flatCoordinates[2]);
107
122
  }
108
123
  } else {
109
- const flatCoordinates = /** @type {import("ol/geom/SimpleGeometry").default} */ (geometry).getFlatCoordinates();
110
- const stride = /** @type {import("ol/geom/SimpleGeometry").default} */ (geometry).getStride();
124
+ const flatCoordinates =
125
+ /** @type {import("ol/geom/SimpleGeometry").default} */ (
126
+ geometry
127
+ ).getFlatCoordinates();
128
+ const stride = /** @type {import("ol/geom/SimpleGeometry").default} */ (
129
+ geometry
130
+ ).getStride();
111
131
  this.extendFlatCoordinates(flatCoordinates, stride);
112
132
  }
113
133
  }
@@ -118,14 +138,22 @@ class Extent3D {
118
138
  extendWithHeightInfo(heightInfo) {
119
139
  if (heightInfo.extruded) {
120
140
  const calculatedFeatureMaxHeight =
121
- heightInfo.groundLevel + heightInfo.storeyHeightsAboveGround.reduce((accumulator, currentValue) => {
122
- return accumulator + currentValue;
123
- }, 0);
141
+ heightInfo.groundLevel +
142
+ heightInfo.storeyHeightsAboveGround.reduce(
143
+ (accumulator, currentValue) => {
144
+ return accumulator + currentValue;
145
+ },
146
+ 0,
147
+ );
124
148
  this.extendZ(calculatedFeatureMaxHeight);
125
149
  const calculatedFeatureMinHeight =
126
- heightInfo.groundLevel - heightInfo.storeyHeightsBelowGround.reduce((accumulator, currentValue) => {
127
- return accumulator + currentValue;
128
- }, 0);
150
+ heightInfo.groundLevel -
151
+ heightInfo.storeyHeightsBelowGround.reduce(
152
+ (accumulator, currentValue) => {
153
+ return accumulator + currentValue;
154
+ },
155
+ 0,
156
+ );
129
157
  this.extendZ(calculatedFeatureMinHeight);
130
158
  }
131
159
  }
@@ -171,7 +199,11 @@ class Extent3D {
171
199
  const { length } = flatCoordinates;
172
200
  for (let offset = 0; offset < length; offset += stride) {
173
201
  if (stride > 2) {
174
- this.extendXYZ(flatCoordinates[offset], flatCoordinates[offset + 1], flatCoordinates[offset + 2]);
202
+ this.extendXYZ(
203
+ flatCoordinates[offset],
204
+ flatCoordinates[offset + 1],
205
+ flatCoordinates[offset + 2],
206
+ );
175
207
  } else {
176
208
  this.extendXY(flatCoordinates[offset], flatCoordinates[offset + 1]);
177
209
  }
@@ -196,12 +228,14 @@ class Extent3D {
196
228
  * @returns {boolean}
197
229
  */
198
230
  isEmpty() {
199
- return this.minX === Infinity &&
231
+ return (
232
+ this.minX === Infinity &&
200
233
  this.minY === Infinity &&
201
234
  this.minZ === Infinity &&
202
235
  this.maxX === -Infinity &&
203
236
  this.maxY === -Infinity &&
204
- this.maxZ === -Infinity;
237
+ this.maxZ === -Infinity
238
+ );
205
239
  }
206
240
 
207
241
  /**
@@ -212,9 +246,9 @@ class Extent3D {
212
246
  return [0, 0, 0];
213
247
  }
214
248
  return [
215
- this.minX + ((this.maxX - this.minX) / 2),
216
- this.minY + ((this.maxY - this.minY) / 2),
217
- this.minZ + ((this.maxZ - this.minZ) / 2),
249
+ this.minX + (this.maxX - this.minX) / 2,
250
+ this.minY + (this.maxY - this.minY) / 2,
251
+ this.minZ + (this.maxZ - this.minZ) / 2,
218
252
  ];
219
253
  }
220
254
 
@@ -236,7 +270,14 @@ class Extent3D {
236
270
  * @returns {Extent3D}
237
271
  */
238
272
  clone() {
239
- return new Extent3D(this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ);
273
+ return new Extent3D(
274
+ this.minX,
275
+ this.minY,
276
+ this.minZ,
277
+ this.maxX,
278
+ this.maxY,
279
+ this.maxZ,
280
+ );
240
281
  }
241
282
  }
242
283