@vcmap/core 6.0.0-rc.4 → 6.0.0-rc.6

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 (209) hide show
  1. package/dist/cesium.d.ts +11 -0
  2. package/dist/index.d.ts +23 -16
  3. package/dist/index.js +21 -14
  4. package/dist/index.js.map +1 -1
  5. package/dist/ol.d.ts +15 -2
  6. package/dist/src/layer/cesium/clusterContext.d.ts +8 -14
  7. package/dist/src/layer/cesium/clusterContext.js +62 -41
  8. package/dist/src/layer/cesium/clusterContext.js.map +1 -1
  9. package/dist/src/layer/cesium/vectorCesiumImpl.d.ts +2 -3
  10. package/dist/src/layer/cesium/vectorCesiumImpl.js +16 -10
  11. package/dist/src/layer/cesium/vectorCesiumImpl.js.map +1 -1
  12. package/dist/src/layer/cesium/vectorContext.d.ts +10 -53
  13. package/dist/src/layer/cesium/vectorContext.js +88 -172
  14. package/dist/src/layer/cesium/vectorContext.js.map +1 -1
  15. package/dist/src/layer/geojsonHelpers.d.ts +1 -1
  16. package/dist/src/layer/geojsonHelpers.js +5 -10
  17. package/dist/src/layer/geojsonHelpers.js.map +1 -1
  18. package/dist/src/layer/oblique/obliqueHelpers.js +6 -6
  19. package/dist/src/layer/oblique/obliqueHelpers.js.map +1 -1
  20. package/dist/src/layer/vectorLayer.d.ts +0 -37
  21. package/dist/src/layer/vectorLayer.js.map +1 -1
  22. package/dist/src/layer/vectorProperties.d.ts +8 -3
  23. package/dist/src/layer/vectorProperties.js +30 -5
  24. package/dist/src/layer/vectorProperties.js.map +1 -1
  25. package/dist/src/map/baseOLMap.js +1 -1
  26. package/dist/src/map/baseOLMap.js.map +1 -1
  27. package/dist/src/map/obliqueMap.d.ts +3 -0
  28. package/dist/src/map/obliqueMap.js +27 -6
  29. package/dist/src/map/obliqueMap.js.map +1 -1
  30. package/dist/src/map/vcsMap.d.ts +8 -0
  31. package/dist/src/map/vcsMap.js +11 -0
  32. package/dist/src/map/vcsMap.js.map +1 -1
  33. package/dist/src/oblique/helpers.js +5 -5
  34. package/dist/src/oblique/helpers.js.map +1 -1
  35. package/dist/src/oblique/obliqueDataSet.js +4 -4
  36. package/dist/src/oblique/obliqueDataSet.js.map +1 -1
  37. package/dist/src/ol/geom/geometryCollection.js +19 -2
  38. package/dist/src/ol/geom/geometryCollection.js.map +1 -1
  39. package/dist/src/style/arcStyle.js +1 -0
  40. package/dist/src/style/arcStyle.js.map +1 -1
  41. package/dist/src/util/editor/createFeatureSession.d.ts +5 -1
  42. package/dist/src/util/editor/createFeatureSession.js +48 -4
  43. package/dist/src/util/editor/createFeatureSession.js.map +1 -1
  44. package/dist/src/util/editor/editFeaturesSession.d.ts +10 -4
  45. package/dist/src/util/editor/editFeaturesSession.js +74 -37
  46. package/dist/src/util/editor/editFeaturesSession.js.map +1 -1
  47. package/dist/src/util/editor/editGeometrySession.d.ts +5 -1
  48. package/dist/src/util/editor/editGeometrySession.js +77 -55
  49. package/dist/src/util/editor/editGeometrySession.js.map +1 -1
  50. package/dist/src/util/editor/editorHelpers.d.ts +12 -6
  51. package/dist/src/util/editor/editorHelpers.js +47 -20
  52. package/dist/src/util/editor/editorHelpers.js.map +1 -1
  53. package/dist/src/util/editor/editorSessionHelpers.d.ts +5 -0
  54. package/dist/src/util/editor/editorSessionHelpers.js +1 -0
  55. package/dist/src/util/editor/editorSessionHelpers.js.map +1 -1
  56. package/dist/src/util/editor/editorSymbols.d.ts +1 -1
  57. package/dist/src/util/editor/editorSymbols.js +1 -1
  58. package/dist/src/util/editor/editorSymbols.js.map +1 -1
  59. package/dist/src/util/editor/interactions/createBBoxInteraction.d.ts +1 -0
  60. package/dist/src/util/editor/interactions/createBBoxInteraction.js +20 -16
  61. package/dist/src/util/editor/interactions/createBBoxInteraction.js.map +1 -1
  62. package/dist/src/util/editor/interactions/createCircleInteraction.js +1 -1
  63. package/dist/src/util/editor/interactions/createCircleInteraction.js.map +1 -1
  64. package/dist/src/util/editor/interactions/createLineStringInteraction.js +3 -3
  65. package/dist/src/util/editor/interactions/createLineStringInteraction.js.map +1 -1
  66. package/dist/src/util/editor/interactions/createPointInteraction.js +1 -1
  67. package/dist/src/util/editor/interactions/createPointInteraction.js.map +1 -1
  68. package/dist/src/util/editor/interactions/createPolygonInteraction.d.ts +4 -0
  69. package/dist/src/util/editor/interactions/createPolygonInteraction.js +9 -3
  70. package/dist/src/util/editor/interactions/createPolygonInteraction.js.map +1 -1
  71. package/dist/src/util/editor/interactions/creationSnapping.d.ts +26 -0
  72. package/dist/src/util/editor/interactions/creationSnapping.js +139 -0
  73. package/dist/src/util/editor/interactions/creationSnapping.js.map +1 -0
  74. package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js +3 -2
  75. package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js.map +1 -1
  76. package/dist/src/util/editor/interactions/insertVertexInteraction.d.ts +3 -1
  77. package/dist/src/util/editor/interactions/insertVertexInteraction.js +14 -6
  78. package/dist/src/util/editor/interactions/insertVertexInteraction.js.map +1 -1
  79. package/dist/src/util/editor/interactions/layerSnapping.d.ts +19 -0
  80. package/dist/src/util/editor/interactions/layerSnapping.js +87 -0
  81. package/dist/src/util/editor/interactions/layerSnapping.js.map +1 -0
  82. package/dist/src/util/editor/interactions/translateVertexInteraction.js +2 -2
  83. package/dist/src/util/editor/interactions/translateVertexInteraction.js.map +1 -1
  84. package/dist/src/util/editor/interactions/translationSnapping.d.ts +25 -0
  85. package/dist/src/util/editor/interactions/translationSnapping.js +179 -0
  86. package/dist/src/util/editor/interactions/translationSnapping.js.map +1 -0
  87. package/dist/src/util/editor/snappingHelpers.d.ts +44 -0
  88. package/dist/src/util/editor/snappingHelpers.js +329 -0
  89. package/dist/src/util/editor/snappingHelpers.js.map +1 -0
  90. package/dist/src/util/editor/transformation/create2DHandlers.js +26 -26
  91. package/dist/src/util/editor/transformation/create2DHandlers.js.map +1 -1
  92. package/dist/src/util/editor/transformation/create3DHandlers.js +65 -14
  93. package/dist/src/util/editor/transformation/create3DHandlers.js.map +1 -1
  94. package/dist/src/util/editor/transformation/scaleInteraction.js +27 -5
  95. package/dist/src/util/editor/transformation/scaleInteraction.js.map +1 -1
  96. package/dist/src/util/editor/transformation/transformationHandler.js +56 -38
  97. package/dist/src/util/editor/transformation/transformationHandler.js.map +1 -1
  98. package/dist/src/util/editor/transformation/transformationTypes.d.ts +2 -0
  99. package/dist/src/util/editor/transformation/transformationTypes.js +4 -0
  100. package/dist/src/util/editor/transformation/transformationTypes.js.map +1 -1
  101. package/dist/src/util/featureconverter/arcToCesium.d.ts +5 -19
  102. package/dist/src/util/featureconverter/arcToCesium.js +15 -42
  103. package/dist/src/util/featureconverter/arcToCesium.js.map +1 -1
  104. package/dist/src/util/featureconverter/circleToCesium.d.ts +2 -27
  105. package/dist/src/util/featureconverter/circleToCesium.js +84 -63
  106. package/dist/src/util/featureconverter/circleToCesium.js.map +1 -1
  107. package/dist/src/util/featureconverter/clampedPrimitive.d.ts +2 -0
  108. package/dist/src/util/featureconverter/clampedPrimitive.js +29 -0
  109. package/dist/src/util/featureconverter/clampedPrimitive.js.map +1 -0
  110. package/dist/src/util/featureconverter/convert.d.ts +26 -7
  111. package/dist/src/util/featureconverter/convert.js +221 -44
  112. package/dist/src/util/featureconverter/convert.js.map +1 -1
  113. package/dist/src/util/featureconverter/extent3D.d.ts +4 -3
  114. package/dist/src/util/featureconverter/extent3D.js +4 -3
  115. package/dist/src/util/featureconverter/extent3D.js.map +1 -1
  116. package/dist/src/util/featureconverter/lineStringToCesium.d.ts +12 -27
  117. package/dist/src/util/featureconverter/lineStringToCesium.js +85 -107
  118. package/dist/src/util/featureconverter/lineStringToCesium.js.map +1 -1
  119. package/dist/src/util/featureconverter/pointHelpers.d.ts +8 -11
  120. package/dist/src/util/featureconverter/pointHelpers.js +134 -120
  121. package/dist/src/util/featureconverter/pointHelpers.js.map +1 -1
  122. package/dist/src/util/featureconverter/pointToCesium.d.ts +14 -17
  123. package/dist/src/util/featureconverter/pointToCesium.js +47 -96
  124. package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
  125. package/dist/src/util/featureconverter/polygonToCesium.d.ts +2 -26
  126. package/dist/src/util/featureconverter/polygonToCesium.js +62 -72
  127. package/dist/src/util/featureconverter/polygonToCesium.js.map +1 -1
  128. package/dist/src/util/featureconverter/storeyHelpers.d.ts +17 -0
  129. package/dist/src/util/featureconverter/storeyHelpers.js +78 -0
  130. package/dist/src/util/featureconverter/storeyHelpers.js.map +1 -0
  131. package/dist/src/util/featureconverter/vectorGeometryFactory.d.ts +54 -0
  132. package/dist/src/util/featureconverter/vectorGeometryFactory.js +278 -0
  133. package/dist/src/util/featureconverter/vectorGeometryFactory.js.map +1 -0
  134. package/dist/src/util/featureconverter/vectorHeightInfo.d.ts +86 -0
  135. package/dist/src/util/featureconverter/vectorHeightInfo.js +242 -0
  136. package/dist/src/util/featureconverter/vectorHeightInfo.js.map +1 -0
  137. package/dist/src/util/geometryHelpers.d.ts +22 -1
  138. package/dist/src/util/geometryHelpers.js +65 -2
  139. package/dist/src/util/geometryHelpers.js.map +1 -1
  140. package/dist/src/util/mapCollection.js +8 -0
  141. package/dist/src/util/mapCollection.js.map +1 -1
  142. package/dist/src/util/math.d.ts +6 -2
  143. package/dist/src/util/math.js +34 -12
  144. package/dist/src/util/math.js.map +1 -1
  145. package/dist/tests/unit/helpers/cesiumHelpers.js +3 -1
  146. package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
  147. package/dist/tests/unit/helpers/helpers.d.ts +2 -9
  148. package/dist/tests/unit/helpers/helpers.js +2 -8
  149. package/dist/tests/unit/helpers/helpers.js.map +1 -1
  150. package/index.ts +74 -35
  151. package/package.json +3 -3
  152. package/src/cesium/cesium.d.ts +11 -0
  153. package/src/layer/cesium/clusterContext.ts +82 -91
  154. package/src/layer/cesium/vectorCesiumImpl.ts +17 -11
  155. package/src/layer/cesium/vectorContext.ts +120 -348
  156. package/src/layer/geojsonHelpers.ts +9 -12
  157. package/src/layer/oblique/obliqueHelpers.ts +6 -6
  158. package/src/layer/vectorLayer.ts +0 -71
  159. package/src/layer/vectorProperties.ts +46 -9
  160. package/src/map/baseOLMap.ts +1 -1
  161. package/src/map/obliqueMap.ts +46 -6
  162. package/src/map/vcsMap.ts +20 -2
  163. package/src/oblique/helpers.ts +11 -5
  164. package/src/oblique/obliqueDataSet.ts +4 -4
  165. package/src/ol/geom/geometryCollection.js +21 -2
  166. package/src/ol/ol.d.ts +15 -2
  167. package/src/style/arcStyle.ts +1 -0
  168. package/src/util/editor/createFeatureSession.ts +64 -6
  169. package/src/util/editor/editFeaturesSession.ts +105 -39
  170. package/src/util/editor/editGeometrySession.ts +118 -75
  171. package/src/util/editor/editorHelpers.ts +78 -30
  172. package/src/util/editor/editorSessionHelpers.ts +7 -0
  173. package/src/util/editor/editorSymbols.ts +1 -1
  174. package/src/util/editor/interactions/createBBoxInteraction.ts +25 -16
  175. package/src/util/editor/interactions/createCircleInteraction.ts +1 -1
  176. package/src/util/editor/interactions/createLineStringInteraction.ts +9 -3
  177. package/src/util/editor/interactions/createPointInteraction.ts +1 -1
  178. package/src/util/editor/interactions/createPolygonInteraction.ts +16 -3
  179. package/src/util/editor/interactions/creationSnapping.ts +226 -0
  180. package/src/util/editor/interactions/editGeometryMouseOverInteraction.ts +3 -2
  181. package/src/util/editor/interactions/insertVertexInteraction.ts +27 -7
  182. package/src/util/editor/interactions/layerSnapping.ts +136 -0
  183. package/src/util/editor/interactions/translateVertexInteraction.ts +8 -2
  184. package/src/util/editor/interactions/translationSnapping.ts +302 -0
  185. package/src/util/editor/snappingHelpers.ts +490 -0
  186. package/src/util/editor/transformation/create2DHandlers.ts +38 -26
  187. package/src/util/editor/transformation/create3DHandlers.ts +84 -22
  188. package/src/util/editor/transformation/scaleInteraction.ts +28 -5
  189. package/src/util/editor/transformation/transformationHandler.ts +72 -41
  190. package/src/util/editor/transformation/transformationTypes.ts +5 -0
  191. package/src/util/featureconverter/arcToCesium.ts +25 -95
  192. package/src/util/featureconverter/circleToCesium.ts +127 -113
  193. package/src/util/featureconverter/clampedPrimitive.ts +70 -0
  194. package/src/util/featureconverter/convert.ts +446 -114
  195. package/src/util/featureconverter/extent3D.ts +13 -6
  196. package/src/util/featureconverter/lineStringToCesium.ts +132 -179
  197. package/src/util/featureconverter/pointHelpers.ts +271 -214
  198. package/src/util/featureconverter/pointToCesium.ts +111 -175
  199. package/src/util/featureconverter/polygonToCesium.ts +98 -117
  200. package/src/util/featureconverter/storeyHelpers.ts +104 -0
  201. package/src/util/featureconverter/vectorGeometryFactory.ts +601 -0
  202. package/src/util/featureconverter/vectorHeightInfo.ts +393 -0
  203. package/src/util/geometryHelpers.ts +79 -5
  204. package/src/util/mapCollection.ts +8 -0
  205. package/src/util/math.ts +59 -12
  206. package/dist/src/util/featureconverter/featureconverterHelper.d.ts +0 -35
  207. package/dist/src/util/featureconverter/featureconverterHelper.js +0 -404
  208. package/dist/src/util/featureconverter/featureconverterHelper.js.map +0 -1
  209. package/src/util/featureconverter/featureconverterHelper.ts +0 -672
@@ -1,60 +1,33 @@
1
- import { ArcType, Cartesian3, HeightReference, } from '@vcmap-cesium/engine';
2
- import Projection from '../projection.js';
3
- import { addPrimitivesToContext } from './featureconverterHelper.js';
4
- import { createFillGeometries, createGroundLineGeometries, createLineGeometries, createOutlineGeometries, createSolidGeometries, validateLineString, getCoordinates as getLineStringCoordinates, getGeometryOptions as getLineStringGeometryOptions, addArrowsToContext, } from './lineStringToCesium.js';
5
- import { featureArcStruct } from '../../style/arcStyle.js';
1
+ import { ArcType, HeightReference } from '@vcmap-cesium/engine';
2
+ import { createGroundLineGeometries, createLineGeometries, createOutlineGeometries, createSolidGeometries, validateLineString, getGeometryOptions as getLineStringGeometryOptions, } from './lineStringToCesium.js';
3
+ import { mercatorToCartesianTransformerForHeightInfo, } from './vectorHeightInfo.js';
6
4
  /**
7
5
  * Creates the positions & arcType option for the PolylineGeometry
8
6
  */
9
- export function getGeometryOptions(coords, _geometry, positionHeightAdjustment, perPositionHeight, groundLevelOrMinHeight) {
10
- const positions = coords.map((coord) => {
11
- const wgs84Coords = Projection.mercatorToWgs84(coord);
12
- if (!perPositionHeight && groundLevelOrMinHeight) {
13
- wgs84Coords[2] = groundLevelOrMinHeight;
14
- }
15
- else if (wgs84Coords[2] != null) {
16
- wgs84Coords[2] += positionHeightAdjustment;
17
- }
18
- return Cartesian3.fromDegrees(wgs84Coords[0], wgs84Coords[1], wgs84Coords[2]);
19
- });
7
+ function getGeometryOptions(coords, _geometry, heightInfo) {
8
+ const coordinateTransformer = mercatorToCartesianTransformerForHeightInfo(heightInfo);
9
+ const positions = coords.map(coordinateTransformer);
20
10
  return { positions, arcType: ArcType.NONE };
21
11
  }
22
12
  /**
23
- * In this special case, the coordinates are not taken from the geometries array
13
+ * @param arcCoords - the coordinates of the arc to use instead of the geometries coordinates if height mode is absolute
14
+ * @param altitudeMode
24
15
  */
25
- // eslint-disable-next-line no-unused-vars
26
- export function getCoordinates(coords, _geometries) {
27
- return coords;
28
- }
29
- /**
30
- * @param arcCoords - the coordinates of the arc to use instead of the geometries coordinates if height mode is absolute
31
- */
32
- function getGeometryFactory(arcCoords, altitudeMode) {
16
+ // eslint-disable-next-line import/prefer-default-export
17
+ export function getArcGeometryFactory(arcCoords, altitudeMode) {
33
18
  return {
34
- getCoordinates: altitudeMode === HeightReference.NONE
35
- ? getCoordinates.bind(null, arcCoords)
36
- : getLineStringCoordinates,
19
+ type: 'arc',
37
20
  getGeometryOptions: altitudeMode === HeightReference.NONE
38
21
  ? getGeometryOptions.bind(null, arcCoords)
39
22
  : getLineStringGeometryOptions,
40
23
  createSolidGeometries,
41
24
  createOutlineGeometries,
42
- createFillGeometries,
25
+ createFillGeometries() {
26
+ return [];
27
+ },
43
28
  createGroundLineGeometries,
44
29
  createLineGeometries,
30
+ validateGeometry: validateLineString,
45
31
  };
46
32
  }
47
- /**
48
- * converts a linestring with an ArcStyle to a a cesium primitive
49
- */
50
- export default async function arcToCesium(feature, style, geometries, vectorProperties, scene, context) {
51
- if (!style.getFill() && !style.getStroke()) {
52
- return;
53
- }
54
- const altitudeMode = vectorProperties.getAltitudeMode(feature);
55
- const arcGeometryFactory = getGeometryFactory(feature[featureArcStruct].coordinates, altitudeMode);
56
- const validGeometries = geometries.filter((lineString) => validateLineString(lineString));
57
- addPrimitivesToContext(feature, style, validGeometries, vectorProperties, scene, arcGeometryFactory, context);
58
- await addArrowsToContext(feature, style, validGeometries, vectorProperties, scene, arcGeometryFactory, context); // IDEA what about labels?
59
- }
60
33
  //# sourceMappingURL=arcToCesium.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"arcToCesium.js","sourceRoot":"","sources":["../../../../src/util/featureconverter/arcToCesium.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,UAAU,EACV,eAAe,GAEhB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,IAAI,wBAAwB,EAC1C,kBAAkB,IAAI,4BAA4B,EAClD,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAiB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAKrE;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAoB,EACpB,SAAqB,EACrB,wBAAgC,EAChC,iBAA0B,EAC1B,sBAA8B;IAE9B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACrC,MAAM,WAAW,GAAG,UAAU,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACtD,IAAI,CAAC,iBAAiB,IAAI,sBAAsB,EAAE;YAChD,WAAW,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC;SACzC;aAAM,I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,kBAAkB,GAAG,kBAAkB,CAC3C,OAAO,CAAC,gBAAgB,CAAE,CAAC,WAAY,EACvC,YAAY,CACb,CAAC;IACF,MAAM,eAAe,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CACvD,kBAAkB,CAAC,UAAU,CAAC,CAC/B,CAAC;IACF,sBAAsB,CACpB,OAAO,EACP,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,KAAK,EACL,kBAAkB,EAClB,OAAO,CACR,CAAC;IACF,MAAM,kBAAkB,CACtB,OAAO,EACP,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,KAAK,EACL,kBAAkB,EAClB,OAAO,CACR,CAAC,CAAC,0BAA0B;AAC/B,CAAC"}
1
+ {"version":3,"file":"arcToCesium.js","sourceRoot":"","sources":["../../../../src/util/featureconverter/arcToCesium.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIhE,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,IAAI,4BAA4B,GACnD,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,2CAA2C,GAE5C,MAAM,uBAAuB,CAAC;AAM/B;;GAEG;AACH,SAAS,kBAAkB,CACzB,MAAoB,EACpB,SAAqB,EACrB,UAA4B;IAE5B,MAAM,qBAAqB,GACzB,2CAA2C,CAAC,UAAU,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACpD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,wDAAwD;AACxD,MAAM,UAAU,qBAAqB,CACnC,SAAuB,EACvB,YAA6B;IAE7B,OAAO;QACL,IAAI,EAAE,KAAK;QACX,kBAAkB,EAChB,YAAY,KAAK,eAAe,CAAC,IAAI;YACnC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC;YAC1C,CAAC,CAAC,4BAA4B;QAClC,qBAAqB;QACrB,uBAAuB;QACvB,oBAAoB;YAClB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,0BAA0B;QAC1B,oBAAoB;QACpB,gBAAgB,EAAE,kBAAkB;KACrC,CAAC;AACJ,CAAC"}
@@ -1,32 +1,7 @@
1
- import type { Style } from 'ol/style.js';
2
1
  import type { Circle } from 'ol/geom.js';
3
- import type { Coordinate } from 'ol/coordinate.js';
4
- import type { Feature } from 'ol/index.js';
5
- import { Cartesian3, CircleGeometry, GroundPolylineGeometry, CircleOutlineGeometry, PolylineGeometry, type Scene } from '@vcmap-cesium/engine';
6
- import type VectorProperties from '../../layer/vectorProperties.js';
7
- import type { AsyncCesiumVectorContext } from '../../layer/cesium/vectorContext.js';
8
- export declare function createSolidGeometries(options: ConstructorParameters<typeof CircleGeometry>[0], height: number, _perPositionHeight: boolean, extrudedHeight?: number): CircleGeometry[];
9
- export declare function createOutlineGeometries(options: ConstructorParameters<typeof CircleGeometry>[0], height: number, _perPositionHeight: boolean, extrudedHeight?: number): CircleOutlineGeometry[];
10
- export declare function createFillGeometries(options: ConstructorParameters<typeof CircleGeometry>[0], height: number, perPositionHeight: boolean): CircleGeometry[];
11
- export declare function getLineGeometryOptions(options: ConstructorParameters<typeof CircleGeometry>[0], style: Style): {
12
- width: number;
13
- positions: Cartesian3[];
14
- };
15
- export declare function createGroundLineGeometries(options: ConstructorParameters<typeof CircleGeometry>[0], style: Style): GroundPolylineGeometry[];
16
- export declare function createLineGeometries(options: ConstructorParameters<typeof CircleGeometry>[0], style: Style): PolylineGeometry[];
17
- /**
18
- * extracts the center and radius from the CircleGeometry and converts it to Cartesian3/radius in m
19
- * @param geometry
20
- * @param positionHeightAdjustment
21
- * @param perPositionHeight
22
- * @param groundLevelOrMinHeight
23
- * @returns
24
- * @private
25
- */
26
- export declare function getGeometryOptions(geometry: Circle, positionHeightAdjustment: number, perPositionHeight: boolean, groundLevelOrMinHeight: number): ConstructorParameters<typeof CircleGeometry>[0];
27
- export declare function getCoordinates(geometries: Circle[]): Coordinate[];
2
+ import { VectorGeometryFactory } from './vectorGeometryFactory.js';
28
3
  /**
29
4
  * validates if a point is renderable
30
5
  */
31
6
  export declare function validateCircle(circle: Circle): boolean;
32
- export default function circleToCesium(feature: Feature, style: Style, geometries: Circle[], vectorProperties: VectorProperties, scene: Scene, context: AsyncCesiumVectorContext): void;
7
+ export declare function getCircleGeometryFactory(): VectorGeometryFactory<'circle'>;
@@ -1,32 +1,62 @@
1
1
  import { circular } from 'ol/geom/Polygon.js';
2
2
  import { Cartesian3, CircleGeometry, GroundPolylineGeometry, CircleOutlineGeometry, Math as CesiumMath, Cartographic, PolylineGeometry, } from '@vcmap-cesium/engine';
3
3
  import { parseNumber } from '@vcsuite/parsers';
4
- import { addPrimitivesToContext } from './featureconverterHelper.js';
5
- import Projection from '../projection.js';
6
- export function createSolidGeometries(options, height, _perPositionHeight, extrudedHeight) {
4
+ import { mercatorToCartesianTransformerForHeightInfo, } from './vectorHeightInfo.js';
5
+ function createCircleGeometry(options, height, perPositionHeight, extrudedHeight) {
6
+ const geometryOptions = {
7
+ ...options,
8
+ granularity: 0.02,
9
+ extrudedHeight,
10
+ };
11
+ if (!perPositionHeight) {
12
+ geometryOptions.height = height;
13
+ }
14
+ else {
15
+ const cartographic = Cartographic.fromCartesian(options.center);
16
+ geometryOptions.height = cartographic.height;
17
+ }
18
+ return new CircleGeometry(geometryOptions);
19
+ }
20
+ function createSolidGeometries(options, heightInfo, height, perPositionHeight, extrudedHeight) {
7
21
  return [
8
- new CircleGeometry({
9
- ...options,
10
- height,
11
- granularity: 0.02,
12
- extrudedHeight,
13
- }),
22
+ {
23
+ type: 'solid',
24
+ geometry: createCircleGeometry(options, height, perPositionHeight, extrudedHeight),
25
+ heightInfo,
26
+ },
14
27
  ];
15
28
  }
16
- export function createOutlineGeometries(options, height, _perPositionHeight, extrudedHeight) {
29
+ function createOutlineGeometries(options, heightInfo, height, perPositionHeight, extrudedHeight) {
30
+ const geometryOptions = {
31
+ ...options,
32
+ granularity: 0.02,
33
+ extrudedHeight,
34
+ };
35
+ if (!perPositionHeight) {
36
+ geometryOptions.height = height;
37
+ }
38
+ else {
39
+ const cartographic = Cartographic.fromCartesian(options.center);
40
+ geometryOptions.height = cartographic.height;
41
+ }
17
42
  return [
18
- new CircleOutlineGeometry({
19
- ...options,
20
- height,
21
- extrudedHeight,
22
- granularity: 0.02,
23
- }),
43
+ {
44
+ type: 'outline',
45
+ geometry: new CircleOutlineGeometry(geometryOptions),
46
+ heightInfo,
47
+ },
24
48
  ];
25
49
  }
26
- export function createFillGeometries(options, height, perPositionHeight) {
27
- return createSolidGeometries(options, height, perPositionHeight, undefined);
50
+ function createFillGeometries(options, heightInfo, height, perPositionHeight) {
51
+ return [
52
+ {
53
+ type: 'fill',
54
+ geometry: createCircleGeometry(options, height, perPositionHeight),
55
+ heightInfo,
56
+ },
57
+ ];
28
58
  }
29
- export function getLineGeometryOptions(options, style) {
59
+ function getLineGeometryOptions(options, style) {
30
60
  const width = parseNumber(style.getStroke()?.getWidth(), 1.0);
31
61
  const { center, radius } = options;
32
62
  const cartographic = Cartographic.fromCartesian(center);
@@ -45,39 +75,42 @@ export function getLineGeometryOptions(options, style) {
45
75
  width,
46
76
  };
47
77
  }
48
- export function createGroundLineGeometries(options, style) {
78
+ function createGroundLineGeometries(options, heightInfo, style) {
49
79
  const lineOptions = getLineGeometryOptions(options, style);
50
- return [new GroundPolylineGeometry(lineOptions)];
80
+ return [
81
+ {
82
+ type: 'groundLine',
83
+ geometry: new GroundPolylineGeometry(lineOptions),
84
+ heightInfo,
85
+ },
86
+ ];
51
87
  }
52
- export function createLineGeometries(options, style) {
88
+ function createLineGeometries(options, heightInfo, style) {
53
89
  const lineOptions = getLineGeometryOptions(options, style);
54
- return [new PolylineGeometry(lineOptions)];
90
+ return [
91
+ {
92
+ type: 'line',
93
+ geometry: new PolylineGeometry(lineOptions),
94
+ heightInfo,
95
+ },
96
+ ];
55
97
  }
56
98
  /**
57
99
  * extracts the center and radius from the CircleGeometry and converts it to Cartesian3/radius in m
58
100
  * @param geometry
59
- * @param positionHeightAdjustment
60
- * @param perPositionHeight
61
- * @param groundLevelOrMinHeight
101
+ * @param heightInfo
62
102
  * @returns
63
103
  * @private
64
104
  */
65
- export function getGeometryOptions(geometry, positionHeightAdjustment, perPositionHeight, groundLevelOrMinHeight) {
105
+ function getGeometryOptions(geometry, heightInfo) {
66
106
  // olCoordinates of center and radius in WGS84
67
107
  const olCenter = geometry.getCenter();
68
108
  const olPoint = olCenter.slice();
69
109
  olPoint[0] += geometry.getRadius();
70
- const wgs84Center = Projection.mercatorToWgs84(olCenter, true);
71
- if (!perPositionHeight && groundLevelOrMinHeight) {
72
- wgs84Center[2] = groundLevelOrMinHeight;
73
- }
74
- else if (wgs84Center[2] != null) {
75
- wgs84Center[2] += positionHeightAdjustment;
76
- }
77
- const wgs84Point = Projection.mercatorToWgs84(olPoint, true);
110
+ const coordinateTransformer = mercatorToCartesianTransformerForHeightInfo(heightInfo);
78
111
  // Cesium coordinates of center and radius
79
- const center = Cartesian3.fromDegrees(wgs84Center[0], wgs84Center[1], wgs84Center[2]);
80
- const point = Cartesian3.fromDegrees(wgs84Point[0], wgs84Point[1], wgs84Center[2]);
112
+ const center = coordinateTransformer(olCenter);
113
+ const point = coordinateTransformer(olPoint);
81
114
  // Computation of radius in Cesium 3D
82
115
  const radius = Cartesian3.distance(center, point);
83
116
  return {
@@ -85,26 +118,6 @@ export function getGeometryOptions(geometry, positionHeightAdjustment, perPositi
85
118
  center,
86
119
  };
87
120
  }
88
- export function getCoordinates(geometries) {
89
- return geometries.map((circle) => {
90
- return circle.getCenter();
91
- });
92
- }
93
- let geometryFactory = null;
94
- function getGeometryFactory() {
95
- if (!geometryFactory) {
96
- geometryFactory = {
97
- getCoordinates,
98
- getGeometryOptions,
99
- createSolidGeometries,
100
- createOutlineGeometries,
101
- createFillGeometries,
102
- createGroundLineGeometries,
103
- createLineGeometries,
104
- };
105
- }
106
- return geometryFactory;
107
- }
108
121
  /**
109
122
  * validates if a point is renderable
110
123
  */
@@ -122,12 +135,20 @@ export function validateCircle(circle) {
122
135
  }
123
136
  return false;
124
137
  }
125
- export default function circleToCesium(feature, style, geometries, vectorProperties, scene, context) {
126
- if (!style.getFill() && !style.getStroke()) {
127
- return;
138
+ let geometryFactory;
139
+ export function getCircleGeometryFactory() {
140
+ if (!geometryFactory) {
141
+ geometryFactory = {
142
+ type: 'circle',
143
+ getGeometryOptions,
144
+ createSolidGeometries,
145
+ createOutlineGeometries,
146
+ createFillGeometries,
147
+ createGroundLineGeometries,
148
+ createLineGeometries,
149
+ validateGeometry: validateCircle,
150
+ };
128
151
  }
129
- const circleGeometryFactory = getGeometryFactory();
130
- const validGeometries = geometries.filter((circle) => validateCircle(circle));
131
- addPrimitivesToContext(feature, style, validGeometries, vectorProperties, scene, circleGeometryFactory, context);
152
+ return geometryFactory;
132
153
  }
133
154
  //# sourceMappingURL=circleToCesium.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"circleToCesium.js","sourceRoot":"","sources":["../../../../src/util/featureconverter/circleToCesium.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAM9C,OAAO,EACL,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,IAAI,IAAI,UAAU,EAClB,YAAY,EACZ,gBAAgB,GAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAK1C,MAAM,UAAU,qBAAqB,CACnC,OAAwD,EACxD,MAAc,EACd,kBAA2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MAAM,CAAC,KAAK,eAAe,CAAC,CAAC,CAAC,EAC9C;QACA,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;KACjE;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAgB,EAChB,KAAY,EACZ,UAAoB,EACpB,gBAAkC,EAClC,KAAY,EACZ,OAAiC;IAEjC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE;QAC1C,OAAO;KACR;IACD,MAAM,qBAAqB,GAAG,kBAAkB,EAAE,CAAC;IACnD,MAAM,eAAe,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,sBAAsB,CACpB,OAAO,EACP,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,KAAK,EACL,qBAAqB,EACrB,OAAO,CACR,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"circleToCesium.js","sourceRoot":"","sources":["../../../../src/util/featureconverter/circleToCesium.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EACL,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,IAAI,IAAI,UAAU,EAClB,YAAY,EACZ,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,2CAA2C,GAE5C,MAAM,uBAAuB,CAAC;AAO/B,SAAS,oBAAoB,CAC3B,OAA8B,EAC9B,MAAc,EACd,iBAA0B,EAC1B,cAAuB;IAEvB,MAAM,eAAe,GAAG;QACtB,GAAG,OAAO;QACV,WAAW,EAAE,IAAI;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C,CAAC,CAAC,EAC9C;QACA,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;KACjE;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,IAAI,eAA4D,CAAC;AAEjE,MAAM,UAAU,wBAAwB;IACtC,IAAI,CAAC,eAAe,EAAE;QACpB,eAAe,GAAG;YAChB,IAAI,EAAE,QAAQ;YACd,kBAAkB;YAClB,qBAAqB;YACrB,uBAAuB;YACvB,oBAAoB;YACpB,0BAA0B;YAC1B,oBAAoB;YACpB,gBAAgB,EAAE,cAAc;SACjC,CAAC;KACH;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { HeightReference, Model, Primitive, Scene } from '@vcmap-cesium/engine';
2
+ export declare function setupClampedPrimitive(scene: Scene, primitive: Primitive | Model, origin: [number, number], heightReference: HeightReference): void;
@@ -0,0 +1,29 @@
1
+ import { Cartesian3, Cartographic, Matrix4, } from '@vcmap-cesium/engine';
2
+ import { mercatorToCartographic } from '../math.js';
3
+ const scratchUpdateHeightCartesian = new Cartesian3();
4
+ function getUpdateHeightCallback(primitive, originalPosition) {
5
+ return function updatePrimitiveHeight(clampedPosition) {
6
+ Cartographic.toCartesian(clampedPosition, undefined, scratchUpdateHeightCartesian);
7
+ Cartesian3.subtract(scratchUpdateHeightCartesian, originalPosition, scratchUpdateHeightCartesian);
8
+ const { modelMatrix } = primitive;
9
+ primitive.modelMatrix = Matrix4.setTranslation(modelMatrix, scratchUpdateHeightCartesian, new Matrix4());
10
+ };
11
+ }
12
+ // eslint-disable-next-line import/prefer-default-export
13
+ export function setupClampedPrimitive(scene, primitive, origin, heightReference) {
14
+ const destroy = primitive.destroy.bind(primitive);
15
+ const originCartographic = mercatorToCartographic(origin);
16
+ const callback = getUpdateHeightCallback(primitive, Cartographic.toCartesian(originCartographic));
17
+ const callbackHandler = scene.updateHeight(originCartographic, callback, heightReference);
18
+ const height = scene.getHeight(originCartographic, heightReference);
19
+ if (height) {
20
+ const updatedHeightCarto = originCartographic.clone();
21
+ updatedHeightCarto.height = height;
22
+ callback(updatedHeightCarto);
23
+ }
24
+ primitive.destroy = () => {
25
+ callbackHandler();
26
+ destroy();
27
+ };
28
+ }
29
+ //# sourceMappingURL=clampedPrimitive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clampedPrimitive.js","sourceRoot":"","sources":["../../../../src/util/featureconverter/clampedPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,EAEZ,OAAO,GAIR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,4BAA4B,GAAG,IAAI,UAAU,EAAE,CAAC;AAEtD,SAAS,uBAAuB,CAC9B,SAA4B,EAC5B,gBAA4B;IAE5B,OAAO,SAAS,qBAAqB,CAAC,eAA6B;QACjE,YAAY,CAAC,WAAW,CACtB,eAAe,EACf,SAAS,EACT,4BAA4B,CAC7B,CAAC;QAEF,UAAU,CAAC,QAAQ,CACjB,4BAA4B,EAC5B,gBAAgB,EAChB,4BAA4B,CAC7B,CAAC;QAEF,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;QAClC,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,cAAc,CAC5C,WAAW,EACX,4BAA4B,EAC5B,IAAI,OAAO,EAAE,CACd,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,qBAAqB,CACnC,KAAY,EACZ,SAA4B,EAC5B,MAAwB,EACxB,eAAgC;IAEhC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,uBAAuB,CACtC,SAAS,EACT,YAAY,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAC7C,CAAC;IACF,MAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CACxC,kBAAkB,EAClB,QAAQ,EACR,eAAe,CAChB,CAAC;IAEF,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;IACpE,IAAI,MAAM,EAAE;QACV,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,KAAK,EAAE,CAAC;QACtD,kBAAkB,CAAC,MAAM,GAAG,MAAM,CAAC;QACnC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;KAC9B;IAED,SAAS,CAAC,OAAO,GAAG,GAAS,EAAE;QAC7B,eAAe,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC"}
@@ -1,16 +1,35 @@
1
- import type { Scene } from '@vcmap-cesium/engine';
1
+ import { ClassificationPrimitive, GroundPolylinePrimitive, GroundPrimitive, Model, Primitive, Scene } from '@vcmap-cesium/engine';
2
2
  import Style, { type StyleLike } from 'ol/style/Style.js';
3
3
  import type { Feature } from 'ol/index.js';
4
- import type VectorProperties from '../../layer/vectorProperties.js';
5
- import type { AsyncCesiumVectorContext } from '../../layer/cesium/vectorContext.js';
4
+ import { BillboardOptions, LabelOptions } from './pointToCesium.js';
5
+ import VectorProperties from '../../layer/vectorProperties.js';
6
+ export type PrimitiveType = Primitive | GroundPrimitive | GroundPolylinePrimitive | ClassificationPrimitive | Model;
7
+ export type ConvertedItemType = 'primitive' | 'billboard' | 'label';
8
+ export type ConvertedItem<T extends ConvertedItemType = ConvertedItemType> = T extends 'primitive' ? {
9
+ type: T;
10
+ item: PrimitiveType;
11
+ autoScale?: boolean;
12
+ } : T extends 'billboard' ? {
13
+ type: T;
14
+ item: BillboardOptions;
15
+ } : T extends 'label' ? {
16
+ type: T;
17
+ item: LabelOptions;
18
+ } : never;
6
19
  export declare function getStylesArray(style: StyleLike, feature: Feature, resolution?: number): Style[];
7
20
  /**
8
- * function to convert a feature to an array of Cesium.Primitives given a style and default properties. the resulting primitives
9
- * must be added to the modules collections here
21
+ * Converts a feature and all its associated geometries to items which can be added to
22
+ * cesium collections directly: Primitives, BillboardOptions or LabelOptions. This is
23
+ * an internal API, typically it is enough to simple use a `VectorLayer` to handle conversions for you.
24
+ * 1. All styles provided by the style like are flattened.
25
+ * 2. All single OL geometries which should be rendered with each style are extracted
26
+ * 3. Cesium geometry options are extracted from each OL geometry based on the geometry, feature & vector properties
27
+ * 4. Cesium geometries which can be batched into a single primitive (for instance, an extruded volume would have all its solids batched and all its outlines batched
28
+ * In case of relativeTo* altitude modes, primitives are batched based _on the clamp origin_
29
+ * 5. The converted items are returned, typically to the vector context which called convert in the first place.
10
30
  * @param feature
11
31
  * @param style
12
32
  * @param vectorProperties
13
- * @param context
14
33
  * @param scene
15
34
  */
16
- export default function convert(feature: Feature, style: StyleLike, vectorProperties: VectorProperties, context: AsyncCesiumVectorContext, scene: Scene): Promise<void>;
35
+ export default function convert(feature: Feature, style: StyleLike, vectorProperties: VectorProperties, scene: Scene): Promise<ConvertedItem[]>;