@vcmap/core 5.3.3 → 6.0.0-rc.10

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 (400) hide show
  1. package/dist/cesium.d.ts +12 -0
  2. package/dist/index.d.ts +27 -19
  3. package/dist/index.js +22 -14
  4. package/dist/index.js.map +1 -1
  5. package/dist/ol.d.ts +15 -2
  6. package/dist/src/category/category.d.ts +5 -4
  7. package/dist/src/category/category.js +2 -1
  8. package/dist/src/category/category.js.map +1 -1
  9. package/dist/src/category/categoryCollection.js.map +1 -1
  10. package/dist/src/cesium/cesiumVcsCameraPrimitive.d.ts +1 -0
  11. package/dist/src/cesium/cesiumVcsCameraPrimitive.js +4 -0
  12. package/dist/src/cesium/cesiumVcsCameraPrimitive.js.map +1 -1
  13. package/dist/src/classRegistry.d.ts +4 -3
  14. package/dist/src/classRegistry.js +2 -0
  15. package/dist/src/classRegistry.js.map +1 -1
  16. package/dist/src/featureProvider/abstractFeatureProvider.js.map +1 -1
  17. package/dist/src/featureProvider/wmsFeatureProvider.js.map +1 -1
  18. package/dist/src/interaction/abstractInteraction.js.map +1 -1
  19. package/dist/src/interaction/coordinateAtPixel.js.map +1 -1
  20. package/dist/src/interaction/eventHandler.js.map +1 -1
  21. package/dist/src/interaction/featureAtPixelInteraction.d.ts +4 -12
  22. package/dist/src/interaction/featureAtPixelInteraction.js +5 -21
  23. package/dist/src/interaction/featureAtPixelInteraction.js.map +1 -1
  24. package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
  25. package/dist/src/interaction/interactionChain.js.map +1 -1
  26. package/dist/src/interaction/interactionType.js +4 -4
  27. package/dist/src/interaction/interactionType.js.map +1 -1
  28. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js.map +1 -1
  29. package/dist/src/layer/cesium/clusterContext.d.ts +12 -16
  30. package/dist/src/layer/cesium/clusterContext.js +75 -43
  31. package/dist/src/layer/cesium/clusterContext.js.map +1 -1
  32. package/dist/src/layer/cesium/dataSourceCesiumImpl.js.map +1 -1
  33. package/dist/src/layer/cesium/rasterLayerCesiumImpl.js.map +1 -1
  34. package/dist/src/layer/cesium/resourceHelper.js.map +1 -1
  35. package/dist/src/layer/cesium/singleImageCesiumImpl.js.map +1 -1
  36. package/dist/src/layer/cesium/terrainCesiumImpl.js.map +1 -1
  37. package/dist/src/layer/cesium/tmsCesiumImpl.js.map +1 -1
  38. package/dist/src/layer/cesium/vectorCesiumImpl.d.ts +2 -3
  39. package/dist/src/layer/cesium/vectorCesiumImpl.js +16 -10
  40. package/dist/src/layer/cesium/vectorCesiumImpl.js.map +1 -1
  41. package/dist/src/layer/cesium/vectorContext.d.ts +11 -54
  42. package/dist/src/layer/cesium/vectorContext.js +154 -171
  43. package/dist/src/layer/cesium/vectorContext.js.map +1 -1
  44. package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js.map +1 -1
  45. package/dist/src/layer/cesium/vectorTileImageryProvider.js.map +1 -1
  46. package/dist/src/layer/cesium/wmsCesiumImpl.js.map +1 -1
  47. package/dist/src/layer/cesiumTilesetLayer.js.map +1 -1
  48. package/dist/src/layer/czmlLayer.js.map +1 -1
  49. package/dist/src/layer/dataSourceLayer.js.map +1 -1
  50. package/dist/src/layer/featureLayer.js.map +1 -1
  51. package/dist/src/layer/featureStoreFeatureVisibility.js.map +1 -1
  52. package/dist/src/layer/featureStoreLayer.js.map +1 -1
  53. package/dist/src/layer/featureStoreLayerChanges.js.map +1 -1
  54. package/dist/src/layer/featureVisibility.js +4 -5
  55. package/dist/src/layer/featureVisibility.js.map +1 -1
  56. package/dist/src/layer/geojsonHelpers.d.ts +1 -1
  57. package/dist/src/layer/geojsonHelpers.js +5 -10
  58. package/dist/src/layer/geojsonHelpers.js.map +1 -1
  59. package/dist/src/layer/geojsonLayer.js.map +1 -1
  60. package/dist/src/layer/globalHider.js.map +1 -1
  61. package/dist/src/layer/layer.js.map +1 -1
  62. package/dist/src/layer/layerImplementation.js.map +1 -1
  63. package/dist/src/layer/oblique/layerObliqueImpl.js.map +1 -1
  64. package/dist/src/layer/oblique/obliqueHelpers.js +9 -9
  65. package/dist/src/layer/oblique/obliqueHelpers.js.map +1 -1
  66. package/dist/src/layer/oblique/vectorObliqueImpl.d.ts +3 -3
  67. package/dist/src/layer/oblique/vectorObliqueImpl.js.map +1 -1
  68. package/dist/src/layer/openStreetMapLayer.js.map +1 -1
  69. package/dist/src/layer/openlayers/layerOpenlayersImpl.js.map +1 -1
  70. package/dist/src/layer/openlayers/rasterLayerOpenlayersImpl.js.map +1 -1
  71. package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js.map +1 -1
  72. package/dist/src/layer/openlayers/tmsOpenlayersImpl.js.map +1 -1
  73. package/dist/src/layer/openlayers/vectorOpenlayersImpl.d.ts +2 -2
  74. package/dist/src/layer/openlayers/vectorOpenlayersImpl.js.map +1 -1
  75. package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.d.ts +1 -7
  76. package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js +18 -47
  77. package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js.map +1 -1
  78. package/dist/src/layer/openlayers/wmsOpenlayersImpl.js.map +1 -1
  79. package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js.map +1 -1
  80. package/dist/src/layer/pointCloudLayer.js.map +1 -1
  81. package/dist/src/layer/rasterLayer.js +1 -1
  82. package/dist/src/layer/rasterLayer.js.map +1 -1
  83. package/dist/src/layer/singleImageLayer.js.map +1 -1
  84. package/dist/src/layer/terrainHelpers.js.map +1 -1
  85. package/dist/src/layer/terrainLayer.js.map +1 -1
  86. package/dist/src/layer/tileLoadedHelper.js.map +1 -1
  87. package/dist/src/layer/tileProvider/mvtTileProvider.js.map +1 -1
  88. package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js.map +1 -1
  89. package/dist/src/layer/tileProvider/tileProvider.js.map +1 -1
  90. package/dist/src/layer/tileProvider/urlTemplateTileProvider.js.map +1 -1
  91. package/dist/src/layer/tmsLayer.js.map +1 -1
  92. package/dist/src/layer/vectorHelpers.js.map +1 -1
  93. package/dist/src/layer/vectorLayer.d.ts +0 -37
  94. package/dist/src/layer/vectorLayer.js +1 -3
  95. package/dist/src/layer/vectorLayer.js.map +1 -1
  96. package/dist/src/layer/vectorProperties.d.ts +10 -5
  97. package/dist/src/layer/vectorProperties.js +59 -10
  98. package/dist/src/layer/vectorProperties.js.map +1 -1
  99. package/dist/src/layer/vectorTileLayer.js.map +1 -1
  100. package/dist/src/layer/wfsLayer.js.map +1 -1
  101. package/dist/src/layer/wmsHelpers.js.map +1 -1
  102. package/dist/src/layer/wmsLayer.js.map +1 -1
  103. package/dist/src/layer/wmtsLayer.js.map +1 -1
  104. package/dist/src/map/baseOLMap.js +1 -1
  105. package/dist/src/map/baseOLMap.js.map +1 -1
  106. package/dist/src/map/cameraLimiter.js +1 -1
  107. package/dist/src/map/cameraLimiter.js.map +1 -1
  108. package/dist/src/map/cesiumMap.js.map +1 -1
  109. package/dist/src/map/obliqueMap.js.map +1 -1
  110. package/dist/src/map/openlayersMap.js +1 -1
  111. package/dist/src/map/openlayersMap.js.map +1 -1
  112. package/dist/src/map/vcsMap.js.map +1 -1
  113. package/dist/src/oblique/helpers.js +5 -5
  114. package/dist/src/oblique/helpers.js.map +1 -1
  115. package/dist/src/oblique/obliqueCollection.js.map +1 -1
  116. package/dist/src/oblique/obliqueDataSet.js +5 -5
  117. package/dist/src/oblique/obliqueDataSet.js.map +1 -1
  118. package/dist/src/oblique/obliqueImage.js.map +1 -1
  119. package/dist/src/oblique/obliqueImageMeta.js.map +1 -1
  120. package/dist/src/oblique/obliqueProvider.js.map +1 -1
  121. package/dist/src/oblique/obliqueView.js.map +1 -1
  122. package/dist/src/oblique/obliqueViewDirection.js +1 -1
  123. package/dist/src/oblique/obliqueViewDirection.js.map +1 -1
  124. package/dist/src/oblique/parseImageJson.js.map +1 -1
  125. package/dist/src/ol/feature.js.map +1 -1
  126. package/dist/src/ol/geom/geometryCollection.js +80 -6
  127. package/dist/src/ol/geom/geometryCollection.js.map +1 -1
  128. package/dist/src/ol/render/canvas/canvasTileRenderer.js.map +1 -1
  129. package/dist/src/ol/source/ClusterEnhancedVectorSource.js.map +1 -1
  130. package/dist/src/ol/source/VcsCluster.js.map +1 -1
  131. package/dist/src/overrideClassRegistry.d.ts +2 -2
  132. package/dist/src/overrideClassRegistry.js +5 -3
  133. package/dist/src/overrideClassRegistry.js.map +1 -1
  134. package/dist/src/style/arcStyle.js +1 -0
  135. package/dist/src/style/arcStyle.js.map +1 -1
  136. package/dist/src/style/arrowStyle.js +6 -6
  137. package/dist/src/style/arrowStyle.js.map +1 -1
  138. package/dist/src/style/declarativeStyleItem.js.map +1 -1
  139. package/dist/src/style/shapesCategory.js.map +1 -1
  140. package/dist/src/style/styleFactory.js.map +1 -1
  141. package/dist/src/style/styleHelpers.js +4 -2
  142. package/dist/src/style/styleHelpers.js.map +1 -1
  143. package/dist/src/style/styleItem.js.map +1 -1
  144. package/dist/src/style/vectorStyleItem.js +9 -9
  145. package/dist/src/style/vectorStyleItem.js.map +1 -1
  146. package/dist/src/style/writeStyle.js.map +1 -1
  147. package/dist/src/util/clipping/clippingObject.js.map +1 -1
  148. package/dist/src/util/clipping/clippingObjectManager.js.map +1 -1
  149. package/dist/src/util/clipping/clippingPlaneHelper.js +2 -2
  150. package/dist/src/util/clipping/clippingPlaneHelper.js.map +1 -1
  151. package/dist/src/util/collection.js.map +1 -1
  152. package/dist/src/util/displayQuality/displayQuality.d.ts +1 -0
  153. package/dist/src/util/displayQuality/displayQuality.js +13 -2
  154. package/dist/src/util/displayQuality/displayQuality.js.map +1 -1
  155. package/dist/src/util/editor/createFeatureSession.d.ts +10 -2
  156. package/dist/src/util/editor/createFeatureSession.js +75 -9
  157. package/dist/src/util/editor/createFeatureSession.js.map +1 -1
  158. package/dist/src/util/editor/editFeaturesSession.d.ts +10 -4
  159. package/dist/src/util/editor/editFeaturesSession.js +74 -37
  160. package/dist/src/util/editor/editFeaturesSession.js.map +1 -1
  161. package/dist/src/util/editor/editGeometrySession.d.ts +7 -2
  162. package/dist/src/util/editor/editGeometrySession.js +109 -66
  163. package/dist/src/util/editor/editGeometrySession.js.map +1 -1
  164. package/dist/src/util/editor/editorHelpers.d.ts +13 -6
  165. package/dist/src/util/editor/editorHelpers.js +53 -23
  166. package/dist/src/util/editor/editorHelpers.js.map +1 -1
  167. package/dist/src/util/editor/editorSessionHelpers.d.ts +6 -6
  168. package/dist/src/util/editor/editorSessionHelpers.js +8 -18
  169. package/dist/src/util/editor/editorSessionHelpers.js.map +1 -1
  170. package/dist/src/util/editor/editorSymbols.d.ts +1 -1
  171. package/dist/src/util/editor/editorSymbols.js +1 -1
  172. package/dist/src/util/editor/editorSymbols.js.map +1 -1
  173. package/dist/src/util/editor/interactions/createBBoxInteraction.d.ts +1 -0
  174. package/dist/src/util/editor/interactions/createBBoxInteraction.js +20 -16
  175. package/dist/src/util/editor/interactions/createBBoxInteraction.js.map +1 -1
  176. package/dist/src/util/editor/interactions/createCircleInteraction.js +1 -1
  177. package/dist/src/util/editor/interactions/createCircleInteraction.js.map +1 -1
  178. package/dist/src/util/editor/interactions/createLineStringInteraction.js +3 -3
  179. package/dist/src/util/editor/interactions/createLineStringInteraction.js.map +1 -1
  180. package/dist/src/util/editor/interactions/createPointInteraction.js +1 -1
  181. package/dist/src/util/editor/interactions/createPointInteraction.js.map +1 -1
  182. package/dist/src/util/editor/interactions/createPolygonInteraction.d.ts +4 -0
  183. package/dist/src/util/editor/interactions/createPolygonInteraction.js +9 -3
  184. package/dist/src/util/editor/interactions/createPolygonInteraction.js.map +1 -1
  185. package/dist/src/util/editor/interactions/creationSnapping.d.ts +26 -0
  186. package/dist/src/util/editor/interactions/creationSnapping.js +139 -0
  187. package/dist/src/util/editor/interactions/creationSnapping.js.map +1 -0
  188. package/dist/src/util/editor/interactions/editFeaturesMouseOverInteraction.js.map +1 -1
  189. package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js +11 -9
  190. package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js.map +1 -1
  191. package/dist/src/util/editor/interactions/ensureHandlerSelectionInteraction.js.map +1 -1
  192. package/dist/src/util/editor/interactions/insertVertexInteraction.d.ts +3 -1
  193. package/dist/src/util/editor/interactions/insertVertexInteraction.js +14 -6
  194. package/dist/src/util/editor/interactions/insertVertexInteraction.js.map +1 -1
  195. package/dist/src/util/editor/interactions/layerSnapping.d.ts +19 -0
  196. package/dist/src/util/editor/interactions/layerSnapping.js +87 -0
  197. package/dist/src/util/editor/interactions/layerSnapping.js.map +1 -0
  198. package/dist/src/util/editor/interactions/mapInteractionController.js.map +1 -1
  199. package/dist/src/util/editor/interactions/removeVertexInteraction.d.ts +1 -1
  200. package/dist/src/util/editor/interactions/removeVertexInteraction.js +2 -2
  201. package/dist/src/util/editor/interactions/removeVertexInteraction.js.map +1 -1
  202. package/dist/src/util/editor/interactions/segmentLengthInteraction.d.ts +16 -0
  203. package/dist/src/util/editor/interactions/segmentLengthInteraction.js +167 -0
  204. package/dist/src/util/editor/interactions/segmentLengthInteraction.js.map +1 -0
  205. package/dist/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +1 -1
  206. package/dist/src/util/editor/interactions/selectFeatureMouseOverInteraction.js.map +1 -1
  207. package/dist/src/util/editor/interactions/selectMultiFeatureInteraction.d.ts +1 -1
  208. package/dist/src/util/editor/interactions/selectMultiFeatureInteraction.js.map +1 -1
  209. package/dist/src/util/editor/interactions/selectSingleFeatureInteraction.d.ts +1 -1
  210. package/dist/src/util/editor/interactions/selectSingleFeatureInteraction.js.map +1 -1
  211. package/dist/src/util/editor/interactions/translateVertexInteraction.js +4 -8
  212. package/dist/src/util/editor/interactions/translateVertexInteraction.js.map +1 -1
  213. package/dist/src/util/editor/interactions/translationSnapping.d.ts +25 -0
  214. package/dist/src/util/editor/interactions/translationSnapping.js +180 -0
  215. package/dist/src/util/editor/interactions/translationSnapping.js.map +1 -0
  216. package/dist/src/util/editor/selectFeaturesSession.js.map +1 -1
  217. package/dist/src/util/editor/snappingHelpers.d.ts +44 -0
  218. package/dist/src/util/editor/snappingHelpers.js +329 -0
  219. package/dist/src/util/editor/snappingHelpers.js.map +1 -0
  220. package/dist/src/util/editor/transformation/create2DHandlers.js +26 -26
  221. package/dist/src/util/editor/transformation/create2DHandlers.js.map +1 -1
  222. package/dist/src/util/editor/transformation/create3DHandlers.js +65 -14
  223. package/dist/src/util/editor/transformation/create3DHandlers.js.map +1 -1
  224. package/dist/src/util/editor/transformation/extrudeInteraction.js.map +1 -1
  225. package/dist/src/util/editor/transformation/rotateInteraction.js.map +1 -1
  226. package/dist/src/util/editor/transformation/scaleInteraction.js +27 -5
  227. package/dist/src/util/editor/transformation/scaleInteraction.js.map +1 -1
  228. package/dist/src/util/editor/transformation/transformationHandler.js +56 -38
  229. package/dist/src/util/editor/transformation/transformationHandler.js.map +1 -1
  230. package/dist/src/util/editor/transformation/transformationTypes.d.ts +2 -0
  231. package/dist/src/util/editor/transformation/transformationTypes.js +6 -2
  232. package/dist/src/util/editor/transformation/transformationTypes.js.map +1 -1
  233. package/dist/src/util/editor/transformation/translateInteraction.js.map +1 -1
  234. package/dist/src/util/editor/validateGeoemetry.js.map +1 -1
  235. package/dist/src/util/exclusiveManager.js.map +1 -1
  236. package/dist/src/util/extent.js.map +1 -1
  237. package/dist/src/util/featureconverter/arcToCesium.d.ts +5 -19
  238. package/dist/src/util/featureconverter/arcToCesium.js +15 -42
  239. package/dist/src/util/featureconverter/arcToCesium.js.map +1 -1
  240. package/dist/src/util/featureconverter/circleToCesium.d.ts +2 -27
  241. package/dist/src/util/featureconverter/circleToCesium.js +85 -64
  242. package/dist/src/util/featureconverter/circleToCesium.js.map +1 -1
  243. package/dist/src/util/featureconverter/clampedPrimitive.d.ts +2 -0
  244. package/dist/src/util/featureconverter/clampedPrimitive.js +29 -0
  245. package/dist/src/util/featureconverter/clampedPrimitive.js.map +1 -0
  246. package/dist/src/util/featureconverter/convert.d.ts +30 -7
  247. package/dist/src/util/featureconverter/convert.js +221 -44
  248. package/dist/src/util/featureconverter/convert.js.map +1 -1
  249. package/dist/src/util/featureconverter/extent3D.d.ts +4 -3
  250. package/dist/src/util/featureconverter/extent3D.js +4 -3
  251. package/dist/src/util/featureconverter/extent3D.js.map +1 -1
  252. package/dist/src/util/featureconverter/lineStringToCesium.d.ts +12 -27
  253. package/dist/src/util/featureconverter/lineStringToCesium.js +85 -107
  254. package/dist/src/util/featureconverter/lineStringToCesium.js.map +1 -1
  255. package/dist/src/util/featureconverter/pointHelpers.d.ts +8 -11
  256. package/dist/src/util/featureconverter/pointHelpers.js +141 -121
  257. package/dist/src/util/featureconverter/pointHelpers.js.map +1 -1
  258. package/dist/src/util/featureconverter/pointToCesium.d.ts +14 -17
  259. package/dist/src/util/featureconverter/pointToCesium.js +50 -98
  260. package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
  261. package/dist/src/util/featureconverter/polygonToCesium.d.ts +2 -26
  262. package/dist/src/util/featureconverter/polygonToCesium.js +63 -73
  263. package/dist/src/util/featureconverter/polygonToCesium.js.map +1 -1
  264. package/dist/src/util/featureconverter/storeyHelpers.d.ts +17 -0
  265. package/dist/src/util/featureconverter/storeyHelpers.js +78 -0
  266. package/dist/src/util/featureconverter/storeyHelpers.js.map +1 -0
  267. package/dist/src/util/featureconverter/vectorGeometryFactory.d.ts +54 -0
  268. package/dist/src/util/featureconverter/vectorGeometryFactory.js +278 -0
  269. package/dist/src/util/featureconverter/vectorGeometryFactory.js.map +1 -0
  270. package/dist/src/util/featureconverter/vectorHeightInfo.d.ts +86 -0
  271. package/dist/src/util/featureconverter/vectorHeightInfo.js +240 -0
  272. package/dist/src/util/featureconverter/vectorHeightInfo.js.map +1 -0
  273. package/dist/src/util/fetch.js.map +1 -1
  274. package/dist/src/util/flight/flightAnchor.js.map +1 -1
  275. package/dist/src/util/flight/flightCollection.js.map +1 -1
  276. package/dist/src/util/flight/flightHelpers.js.map +1 -1
  277. package/dist/src/util/flight/flightInstance.js.map +1 -1
  278. package/dist/src/util/flight/flightPlayer.d.ts +11 -6
  279. package/dist/src/util/flight/flightPlayer.js +52 -16
  280. package/dist/src/util/flight/flightPlayer.js.map +1 -1
  281. package/dist/src/util/flight/flightVisualizer.js.map +1 -1
  282. package/dist/src/util/geometryHelpers.d.ts +34 -2
  283. package/dist/src/util/geometryHelpers.js +172 -4
  284. package/dist/src/util/geometryHelpers.js.map +1 -1
  285. package/dist/src/util/hiddenObjects.js.map +1 -1
  286. package/dist/src/util/indexedCollection.js.map +1 -1
  287. package/dist/src/util/layerCollection.js.map +1 -1
  288. package/dist/src/util/locale.js.map +1 -1
  289. package/dist/src/util/mapCollection.js.map +1 -1
  290. package/dist/src/util/math.d.ts +18 -2
  291. package/dist/src/util/math.js +55 -12
  292. package/dist/src/util/math.js.map +1 -1
  293. package/dist/src/util/overrideCollection.d.ts +7 -7
  294. package/dist/src/util/overrideCollection.js +10 -7
  295. package/dist/src/util/overrideCollection.js.map +1 -1
  296. package/dist/src/util/projection.js.map +1 -1
  297. package/dist/src/util/urlHelpers.js.map +1 -1
  298. package/dist/src/util/viewpoint.js.map +1 -1
  299. package/dist/src/vcsApp.d.ts +3 -3
  300. package/dist/src/vcsApp.js +1 -0
  301. package/dist/src/vcsApp.js.map +1 -1
  302. package/dist/src/vcsEvent.js.map +1 -1
  303. package/dist/src/vcsModule.js.map +1 -1
  304. package/dist/src/vcsModuleHelpers.d.ts +1 -0
  305. package/dist/src/vcsModuleHelpers.js +16 -2
  306. package/dist/src/vcsModuleHelpers.js.map +1 -1
  307. package/dist/src/vcsObject.js.map +1 -1
  308. package/dist/tests/unit/helpers/cesiumHelpers.d.ts +11 -11
  309. package/dist/tests/unit/helpers/cesiumHelpers.js +6 -1
  310. package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
  311. package/dist/tests/unit/helpers/helpers.d.ts +2 -9
  312. package/dist/tests/unit/helpers/helpers.js +4 -10
  313. package/dist/tests/unit/helpers/helpers.js.map +1 -1
  314. package/dist/tests/unit/helpers/importJSON.js.map +1 -1
  315. package/dist/tests/unit/helpers/obliqueHelpers.js.map +1 -1
  316. package/index.ts +84 -36
  317. package/package.json +21 -21
  318. package/src/category/category.ts +11 -9
  319. package/src/category/categoryCollection.ts +1 -1
  320. package/src/cesium/cesium.d.ts +12 -0
  321. package/src/cesium/cesiumVcsCameraPrimitive.ts +5 -0
  322. package/src/classRegistry.ts +7 -4
  323. package/src/featureProvider/wmsFeatureProvider.ts +1 -1
  324. package/src/global.d.ts +6 -1
  325. package/src/interaction/featureAtPixelInteraction.ts +7 -26
  326. package/src/layer/cesium/clusterContext.ts +97 -93
  327. package/src/layer/cesium/vectorCesiumImpl.ts +17 -11
  328. package/src/layer/cesium/vectorContext.ts +229 -348
  329. package/src/layer/featureVisibility.ts +3 -6
  330. package/src/layer/geojsonHelpers.ts +9 -12
  331. package/src/layer/oblique/obliqueHelpers.ts +9 -9
  332. package/src/layer/oblique/vectorObliqueImpl.ts +2 -2
  333. package/src/layer/openlayers/vectorOpenlayersImpl.ts +2 -2
  334. package/src/layer/openlayers/vectorTileOpenlayersImpl.ts +23 -53
  335. package/src/layer/tileLoadedHelper.ts +1 -3
  336. package/src/layer/tileProvider/mvtTileProvider.ts +2 -2
  337. package/src/layer/vectorLayer.ts +1 -74
  338. package/src/layer/vectorProperties.ts +80 -16
  339. package/src/map/baseOLMap.ts +1 -1
  340. package/src/oblique/helpers.ts +11 -5
  341. package/src/oblique/obliqueDataSet.ts +4 -4
  342. package/src/ol/geom/geometryCollection.js +96 -6
  343. package/src/ol/ol.d.ts +15 -2
  344. package/src/overrideClassRegistry.ts +13 -7
  345. package/src/style/arcStyle.ts +1 -0
  346. package/src/style/arrowStyle.ts +7 -7
  347. package/src/style/declarativeStyleItem.ts +2 -2
  348. package/src/style/styleHelpers.ts +15 -13
  349. package/src/style/vectorStyleItem.ts +14 -14
  350. package/src/util/clipping/clippingObject.ts +1 -3
  351. package/src/util/clipping/clippingPlaneHelper.ts +3 -4
  352. package/src/util/displayQuality/displayQuality.ts +13 -1
  353. package/src/util/editor/createFeatureSession.ts +107 -13
  354. package/src/util/editor/editFeaturesSession.ts +105 -39
  355. package/src/util/editor/editGeometrySession.ts +157 -83
  356. package/src/util/editor/editorHelpers.ts +85 -33
  357. package/src/util/editor/editorSessionHelpers.ts +13 -20
  358. package/src/util/editor/editorSymbols.ts +1 -1
  359. package/src/util/editor/interactions/createBBoxInteraction.ts +25 -16
  360. package/src/util/editor/interactions/createCircleInteraction.ts +1 -1
  361. package/src/util/editor/interactions/createLineStringInteraction.ts +9 -3
  362. package/src/util/editor/interactions/createPointInteraction.ts +1 -1
  363. package/src/util/editor/interactions/createPolygonInteraction.ts +16 -3
  364. package/src/util/editor/interactions/creationSnapping.ts +226 -0
  365. package/src/util/editor/interactions/editGeometryMouseOverInteraction.ts +7 -6
  366. package/src/util/editor/interactions/insertVertexInteraction.ts +27 -7
  367. package/src/util/editor/interactions/layerSnapping.ts +136 -0
  368. package/src/util/editor/interactions/removeVertexInteraction.ts +3 -4
  369. package/src/util/editor/interactions/segmentLengthInteraction.ts +227 -0
  370. package/src/util/editor/interactions/translateVertexInteraction.ts +11 -12
  371. package/src/util/editor/interactions/translationSnapping.ts +302 -0
  372. package/src/util/editor/snappingHelpers.ts +490 -0
  373. package/src/util/editor/transformation/create2DHandlers.ts +38 -26
  374. package/src/util/editor/transformation/create3DHandlers.ts +84 -22
  375. package/src/util/editor/transformation/scaleInteraction.ts +28 -5
  376. package/src/util/editor/transformation/transformationHandler.ts +72 -41
  377. package/src/util/editor/transformation/transformationTypes.ts +5 -0
  378. package/src/util/featureconverter/arcToCesium.ts +25 -95
  379. package/src/util/featureconverter/circleToCesium.ts +128 -114
  380. package/src/util/featureconverter/clampedPrimitive.ts +70 -0
  381. package/src/util/featureconverter/convert.ts +447 -113
  382. package/src/util/featureconverter/extent3D.ts +13 -6
  383. package/src/util/featureconverter/lineStringToCesium.ts +134 -181
  384. package/src/util/featureconverter/pointHelpers.ts +285 -219
  385. package/src/util/featureconverter/pointToCesium.ts +117 -177
  386. package/src/util/featureconverter/polygonToCesium.ts +99 -118
  387. package/src/util/featureconverter/storeyHelpers.ts +104 -0
  388. package/src/util/featureconverter/vectorGeometryFactory.ts +601 -0
  389. package/src/util/featureconverter/vectorHeightInfo.ts +392 -0
  390. package/src/util/flight/flightPlayer.ts +64 -22
  391. package/src/util/geometryHelpers.ts +239 -9
  392. package/src/util/hiddenObjects.ts +4 -4
  393. package/src/util/math.ts +87 -12
  394. package/src/util/overrideCollection.ts +33 -21
  395. package/src/vcsApp.ts +11 -4
  396. package/src/vcsModuleHelpers.ts +25 -2
  397. package/dist/src/util/featureconverter/featureconverterHelper.d.ts +0 -35
  398. package/dist/src/util/featureconverter/featureconverterHelper.js +0 -403
  399. package/dist/src/util/featureconverter/featureconverterHelper.js.map +0 -1
  400. package/src/util/featureconverter/featureconverterHelper.ts +0 -668
@@ -2,16 +2,16 @@ import { getLogger } from '@vcsuite/logger';
2
2
  import { unByKey } from 'ol/Observable.js';
3
3
  import type { Feature } from 'ol/index.js';
4
4
  import type {
5
- LineString,
6
5
  Circle,
7
- Polygon,
8
- Point,
9
- LinearRing,
10
6
  Geometry,
7
+ LinearRing,
8
+ LineString,
9
+ Point,
10
+ Polygon,
11
11
  } from 'ol/geom.js';
12
12
  import { EventsKey } from 'ol/events.js';
13
13
  import {
14
- createPickingBehavior,
14
+ setupPickingBehavior,
15
15
  EditorSession,
16
16
  GeometryType,
17
17
  SessionType,
@@ -26,8 +26,9 @@ import RemoveVertexInteraction from './interactions/removeVertexInteraction.js';
26
26
  import {
27
27
  createVertex,
28
28
  geometryChangeKeys,
29
+ getCoordinatesAndLayoutFromVertices,
29
30
  getOlcsPropsFromFeature,
30
- vectorPropertyChangeKeys,
31
+ syncScratchLayerVectorProperties,
31
32
  } from './editorHelpers.js';
32
33
  import InsertVertexInteraction from './interactions/insertVertexInteraction.js';
33
34
  import EditGeometryMouseOverInteraction from './interactions/editGeometryMouseOverInteraction.js';
@@ -37,15 +38,19 @@ import geometryIsValid from './validateGeoemetry.js';
37
38
  import MapInteractionController from './interactions/mapInteractionController.js';
38
39
  import type VectorLayer from '../../layer/vectorLayer.js';
39
40
  import type VcsApp from '../../vcsApp.js';
40
- import type {
41
- // eslint-disable-next-line import/no-named-default
42
- default as VectorProperties,
43
- PropertyChangedKey,
44
- } from '../../layer/vectorProperties.js';
41
+ // eslint-disable-next-line import/no-named-default
42
+ import type { default as VectorProperties } from '../../layer/vectorProperties.js';
43
+ import TranslationSnapping from './interactions/translationSnapping.js';
44
+ import { vertexIndexSymbol } from './editorSymbols.js';
45
+ import LayerSnapping from './interactions/layerSnapping.js';
46
+ import { EventType } from '../../interaction/interactionType.js';
47
+ import { SnapType, snapTypes } from './snappingHelpers.js';
48
+ import SegmentLengthInteraction from './interactions/segmentLengthInteraction.js';
45
49
 
46
50
  export type EditGeometrySession = EditorSession<SessionType.EDIT_GEOMETRY> & {
47
51
  setFeature(feature?: Feature): void;
48
52
  feature: Feature | null;
53
+ snapToLayers: VectorLayer[];
49
54
  };
50
55
 
51
56
  type EditGeometryInteraction = {
@@ -53,51 +58,59 @@ type EditGeometryInteraction = {
53
58
  destroy(): void;
54
59
  };
55
60
 
56
- function assignVectorProperty<
57
- K extends PropertyChangedKey,
58
- V extends VectorProperties[K],
59
- >(props: VectorProperties, key: K, value: V): void {
60
- props[key] = value;
61
- }
62
-
63
- type EditGeometrySessionOptions = {
61
+ export type EditGeometrySessionOptions = {
64
62
  denyInsertion?: boolean;
65
63
  denyRemoval?: boolean;
64
+ initialSnapToLayers?: VectorLayer[];
65
+ snapTo?: SnapType[];
66
+ hideSegmentLength?: boolean;
66
67
  };
67
68
 
68
- /**
69
- * Create the editing interaction for a feature with a line geometry
70
- * @param feature
71
- * @param scratchLayer
72
- * @group Editor
73
- */
74
69
  function createEditLineStringGeometryInteraction(
75
70
  feature: Feature<LineString>,
76
71
  scratchLayer: VectorLayer,
72
+ vectorProperties: VectorProperties,
77
73
  options: EditGeometrySessionOptions,
74
+ snapTo: SnapType[],
78
75
  ): EditGeometryInteraction {
79
76
  const geometry =
80
77
  feature[obliqueGeometry] ?? (feature.getGeometry() as LineString);
81
78
  const olcsProps = getOlcsPropsFromFeature(feature);
82
79
  const vertices = geometry
83
80
  .getCoordinates()
84
- .map((c) => createVertex(c, olcsProps));
81
+ .map((c, i) => createVertex(c, olcsProps, i));
85
82
  scratchLayer.addFeatures(vertices);
86
83
  const resetGeometry = (): void => {
87
- geometry.setCoordinates(
88
- vertices.map((f) => f.getGeometry()!.getCoordinates()),
89
- );
84
+ const { coordinates, layout } =
85
+ getCoordinatesAndLayoutFromVertices(vertices);
86
+ geometry.setCoordinates(coordinates, layout);
90
87
  };
91
88
  const translateVertex = new TranslateVertexInteraction(feature);
92
89
  translateVertex.vertexChanged.addEventListener(resetGeometry);
93
90
 
94
- const interactions: AbstractInteraction[] = [translateVertex];
91
+ const interactions: AbstractInteraction[] = [
92
+ new TranslationSnapping(scratchLayer, geometry, snapTo),
93
+ translateVertex,
94
+ ];
95
+
96
+ if (!options.hideSegmentLength) {
97
+ const segmentLength = new SegmentLengthInteraction(scratchLayer, false);
98
+ segmentLength.setGeometry(geometry);
99
+ interactions.push(segmentLength);
100
+ }
95
101
 
96
102
  if (!options.denyInsertion) {
97
- const insertVertex = new InsertVertexInteraction(feature, geometry);
103
+ const insertVertex = new InsertVertexInteraction(
104
+ feature,
105
+ geometry,
106
+ vectorProperties,
107
+ );
98
108
  insertVertex.vertexInserted.addEventListener(({ vertex, index }) => {
99
109
  scratchLayer.addFeatures([vertex]);
100
110
  vertices.splice(index, 0, vertex);
111
+ vertices.forEach((v, i) => {
112
+ v[vertexIndexSymbol] = i;
113
+ });
101
114
  resetGeometry();
102
115
  });
103
116
  interactions.push(insertVertex);
@@ -132,13 +145,14 @@ function createEditLineStringGeometryInteraction(
132
145
  function createEditCircleGeometryInteraction(
133
146
  feature: Feature<Circle>,
134
147
  scratchLayer: VectorLayer,
148
+ options: EditGeometrySessionOptions,
135
149
  ): EditGeometryInteraction {
136
150
  const geometry =
137
151
  feature[obliqueGeometry] ?? (feature.getGeometry() as Circle);
138
152
  const olcsProps = getOlcsPropsFromFeature(feature);
139
153
  const vertices = geometry
140
154
  .getCoordinates()
141
- .map((c) => createVertex(c, olcsProps));
155
+ .map((c, i) => createVertex(c, olcsProps, i));
142
156
  scratchLayer.addFeatures(vertices);
143
157
 
144
158
  const translateVertex = new TranslateVertexInteraction(feature);
@@ -151,8 +165,13 @@ function createEditCircleGeometryInteraction(
151
165
  const newRadius = cartesian2DDistance(coords[0], coords[1]);
152
166
  geometry.setRadius(newRadius);
153
167
  } else {
154
- geometry.setCenter(vertex.getGeometry()!.getCoordinates());
155
- vertices[1].getGeometry()!.setCoordinates(geometry.getCoordinates()[1]);
168
+ const { coordinates, layout } = getCoordinatesAndLayoutFromVertices([
169
+ vertex,
170
+ ]);
171
+ geometry.setCenterAndRadius(coordinates[0], geometry.getRadius(), layout);
172
+ vertices[1]
173
+ .getGeometry()!
174
+ .setCoordinates(geometry.getCoordinates()[1], layout);
156
175
  }
157
176
  suspend = false;
158
177
  });
@@ -165,7 +184,14 @@ function createEditCircleGeometryInteraction(
165
184
  }
166
185
  });
167
186
 
168
- const interactionChain = new InteractionChain([translateVertex]);
187
+ const interactions: AbstractInteraction[] = [translateVertex];
188
+ if (!options.hideSegmentLength) {
189
+ const segmentLength = new SegmentLengthInteraction(scratchLayer, false);
190
+ segmentLength.setGeometry(geometry);
191
+ interactions.push(segmentLength);
192
+ }
193
+
194
+ const interactionChain = new InteractionChain(interactions);
169
195
 
170
196
  return {
171
197
  interactionChain,
@@ -182,22 +208,23 @@ function createEditCircleGeometryInteraction(
182
208
  function createEditBBoxGeometryInteraction(
183
209
  feature: Feature<Polygon>,
184
210
  scratchLayer: VectorLayer,
211
+ options: EditGeometrySessionOptions,
185
212
  ): EditGeometryInteraction {
186
213
  const geometry =
187
214
  feature[obliqueGeometry] ?? (feature.getGeometry() as Polygon);
188
215
  const olcsProps = getOlcsPropsFromFeature(feature);
189
216
  const vertices = geometry
190
217
  .getCoordinates()[0]
191
- .map((c) => createVertex(c, olcsProps));
218
+ .map((c, i) => createVertex(c, olcsProps, i));
192
219
 
193
220
  scratchLayer.addFeatures(vertices);
194
221
  let suspend = false;
195
222
  const translateVertex = new TranslateVertexInteraction(feature);
196
223
  translateVertex.vertexChanged.addEventListener((vertex) => {
197
- const vertexIndex = vertices.indexOf(vertex);
198
- const originIndex = modulo(vertexIndex + 2, 4);
199
- const rightOfIndex = modulo(vertexIndex + 1, 4);
200
- const leftOfIndex = modulo(vertexIndex - 1, 4);
224
+ const index = vertices.indexOf(vertex);
225
+ const originIndex = modulo(index + 2, 4);
226
+ const rightOfIndex = modulo(index + 1, 4);
227
+ const leftOfIndex = modulo(index - 1, 4);
201
228
 
202
229
  const originCoords = vertices[originIndex].getGeometry()!.getCoordinates();
203
230
  const vertexCoords = vertex.getGeometry()!.getCoordinates();
@@ -231,20 +258,30 @@ function createEditBBoxGeometryInteraction(
231
258
  updateOtherVertex(leftOfIndex);
232
259
 
233
260
  suspend = true;
234
- geometry.setCoordinates([
235
- vertices.map((f) => f.getGeometry()!.getCoordinates()),
236
- ]);
261
+ const { coordinates, layout } =
262
+ getCoordinatesAndLayoutFromVertices(vertices);
263
+ geometry.setCoordinates([coordinates], layout);
237
264
  suspend = false;
238
265
  });
239
266
 
240
267
  const geometryListener = geometry.on('change', () => {
241
268
  if (!suspend) {
269
+ const layout = geometry.getLayout();
242
270
  geometry.getCoordinates()[0].forEach((c, index) => {
243
- vertices[index].getGeometry()!.setCoordinates(c);
271
+ vertices[index].getGeometry()!.setCoordinates(c, layout);
244
272
  });
245
273
  }
246
274
  });
247
- const interactionChain = new InteractionChain([translateVertex]);
275
+
276
+ const interactions: AbstractInteraction[] = [translateVertex];
277
+
278
+ if (!options.hideSegmentLength) {
279
+ const segmentLength = new SegmentLengthInteraction(scratchLayer, false);
280
+ segmentLength.setGeometry(geometry);
281
+ interactions.push(segmentLength);
282
+ }
283
+
284
+ const interactionChain = new InteractionChain(interactions);
248
285
 
249
286
  return {
250
287
  interactionChain,
@@ -261,7 +298,9 @@ function createEditBBoxGeometryInteraction(
261
298
  function createEditSimplePolygonInteraction(
262
299
  feature: Feature<Polygon>,
263
300
  scratchLayer: VectorLayer,
301
+ vectorProperties: VectorProperties,
264
302
  options: EditGeometrySessionOptions,
303
+ snapTo: SnapType[],
265
304
  ): EditGeometryInteraction {
266
305
  const geometry =
267
306
  feature[obliqueGeometry] ?? (feature.getGeometry() as Polygon);
@@ -270,26 +309,41 @@ function createEditSimplePolygonInteraction(
270
309
 
271
310
  const vertices = linearRing
272
311
  .getCoordinates()
273
- .map((c) => createVertex(c, olcsProps));
312
+ .map((c, i) => createVertex(c, olcsProps, i));
274
313
  scratchLayer.addFeatures(vertices);
275
314
  const resetGeometry = (): void => {
276
- const coordinates = vertices.map((f) => f.getGeometry()!.getCoordinates());
277
- linearRing.setCoordinates(coordinates); // update linear ring for proper vertex insertion
278
- geometry.setCoordinates([
279
- vertices.map((f) => f.getGeometry()!.getCoordinates()),
280
- ]); // update actual geometry, since linear ring is a clone and not a ref
315
+ const { coordinates, layout } =
316
+ getCoordinatesAndLayoutFromVertices(vertices);
317
+ linearRing.setCoordinates(coordinates, layout); // update linear ring for proper vertex insertion
318
+ geometry.setCoordinates([coordinates], layout); // update actual geometry, since linear ring is a clone and not a ref
281
319
  };
282
320
 
283
321
  const translateVertex = new TranslateVertexInteraction(feature);
284
322
  translateVertex.vertexChanged.addEventListener(resetGeometry);
285
323
 
286
- const interactions: AbstractInteraction[] = [translateVertex];
324
+ const interactions: AbstractInteraction[] = [
325
+ new TranslationSnapping(scratchLayer, geometry, snapTo),
326
+ translateVertex,
327
+ ];
328
+
329
+ if (!options.hideSegmentLength) {
330
+ const segmentLength = new SegmentLengthInteraction(scratchLayer, false);
331
+ segmentLength.setGeometry(geometry);
332
+ interactions.push(segmentLength);
333
+ }
287
334
 
288
335
  if (!options.denyInsertion) {
289
- const insertVertex = new InsertVertexInteraction(feature, linearRing);
336
+ const insertVertex = new InsertVertexInteraction(
337
+ feature,
338
+ linearRing,
339
+ vectorProperties,
340
+ );
290
341
  insertVertex.vertexInserted.addEventListener(({ vertex, index }) => {
291
342
  scratchLayer.addFeatures([vertex]);
292
343
  vertices.splice(index, 0, vertex);
344
+ vertices.forEach((v, i) => {
345
+ v[vertexIndexSymbol] = i;
346
+ });
293
347
  resetGeometry();
294
348
  });
295
349
  interactions.push(insertVertex);
@@ -329,7 +383,7 @@ function createEditPointInteraction(
329
383
  const geometry = feature[obliqueGeometry] ?? (feature.getGeometry() as Point);
330
384
  const olcsProps = getOlcsPropsFromFeature(feature);
331
385
 
332
- const vertex = createVertex(geometry.getCoordinates(), olcsProps);
386
+ const vertex = createVertex(geometry.getCoordinates(), olcsProps, 0);
333
387
  const featureIdArray = [feature.getId() as string];
334
388
  layer.featureVisibility.hideObjects(featureIdArray);
335
389
  vertex[createSync] = true;
@@ -338,13 +392,18 @@ function createEditPointInteraction(
338
392
  let suspend = false;
339
393
  translateVertex.vertexChanged.addEventListener(() => {
340
394
  suspend = true;
341
- geometry.setCoordinates(vertex.getGeometry()!.getCoordinates());
395
+ const { coordinates, layout } = getCoordinatesAndLayoutFromVertices([
396
+ vertex,
397
+ ]);
398
+ geometry.setCoordinates(coordinates[0], layout);
342
399
  suspend = false;
343
400
  });
344
401
 
345
402
  const geometryListener = geometry.on('change', () => {
346
403
  if (!suspend) {
347
- vertex.getGeometry()!.setCoordinates(geometry.getCoordinates());
404
+ vertex
405
+ .getGeometry()!
406
+ .setCoordinates(geometry.getCoordinates(), geometry.getLayout());
348
407
  }
349
408
  });
350
409
 
@@ -365,7 +424,7 @@ function createEditPointInteraction(
365
424
  * Creates the edit geometry session.
366
425
  * @param app
367
426
  * @param layer
368
- * @param [interactionId] id for registering mutliple exclusive interaction. Needed to run a selection session at the same time as a edit features session.
427
+ * @param [interactionId] id for registering multiple exclusive interaction. Needed to run a selection session at the same time as a edit features session.
369
428
  * @param [editVertexOptions={}]
370
429
  */
371
430
  function startEditGeometrySession(
@@ -396,38 +455,25 @@ function startEditGeometrySession(
396
455
  * The feature that is set for the edit session.
397
456
  */
398
457
  let currentFeature: Feature | null = null;
458
+ let layerSnappingInteraction: LayerSnapping | null = null;
459
+ let snapToLayers: VectorLayer[] =
460
+ editVertexOptions?.initialSnapToLayers?.slice() ?? [layer];
461
+
462
+ const snapTo = editVertexOptions?.snapTo ?? [...snapTypes];
399
463
 
400
- const pickingBehavior = createPickingBehavior(app);
464
+ const resetPickingBehavior = setupPickingBehavior(app);
401
465
  const altitudeModeChanged = (): void => {
402
- const altitudeMode = currentFeature
466
+ scratchLayer.vectorProperties.altitudeMode = currentFeature
403
467
  ? layer.vectorProperties.getAltitudeMode(currentFeature)
404
468
  : layer.vectorProperties.altitudeMode;
405
- pickingBehavior.setForAltitudeMode(altitudeMode);
406
469
  };
407
470
  altitudeModeChanged();
408
- vectorPropertyChangeKeys.forEach((key) => {
409
- assignVectorProperty(
410
- scratchLayer.vectorProperties,
411
- key,
412
- layer.vectorProperties[key],
413
- );
414
- });
415
471
 
416
- const vectorPropertiesChangedListener =
417
- layer.vectorProperties.propertyChanged.addEventListener((props) => {
418
- vectorPropertyChangeKeys.forEach((key) => {
419
- if (props.includes(key)) {
420
- assignVectorProperty(
421
- scratchLayer.vectorProperties,
422
- key,
423
- layer.vectorProperties[key],
424
- );
425
- if (key === 'altitudeMode') {
426
- altitudeModeChanged();
427
- }
428
- }
429
- });
430
- });
472
+ const vectorPropertiesChangedListener = syncScratchLayerVectorProperties(
473
+ scratchLayer,
474
+ layer,
475
+ altitudeModeChanged,
476
+ );
431
477
 
432
478
  const destroyCurrentInteractionSet = (): void => {
433
479
  if (currentInteractionSet) {
@@ -436,6 +482,7 @@ function startEditGeometrySession(
436
482
  );
437
483
  currentInteractionSet.destroy();
438
484
  currentInteractionSet = null;
485
+ layerSnappingInteraction = null; // destroyed in current interaction set
439
486
  }
440
487
 
441
488
  if (currentFeature) {
@@ -478,19 +525,24 @@ function startEditGeometrySession(
478
525
  currentInteractionSet = createEditBBoxGeometryInteraction(
479
526
  feature as Feature<Polygon>,
480
527
  scratchLayer,
528
+ editVertexOptions,
481
529
  );
482
530
  } else if ((geometry as Polygon).getLinearRingCount() === 1) {
483
531
  currentInteractionSet = createEditSimplePolygonInteraction(
484
532
  feature as Feature<Polygon>,
485
533
  scratchLayer,
534
+ layer.vectorProperties,
486
535
  editVertexOptions,
536
+ snapTo,
487
537
  );
488
538
  }
489
539
  } else if (geometryType === GeometryType.LineString) {
490
540
  currentInteractionSet = createEditLineStringGeometryInteraction(
491
541
  feature as Feature<LineString>,
492
542
  scratchLayer,
543
+ layer.vectorProperties,
493
544
  editVertexOptions,
545
+ snapTo,
494
546
  );
495
547
  } else if (geometryType === GeometryType.Point) {
496
548
  currentInteractionSet = createEditPointInteraction(
@@ -502,10 +554,22 @@ function startEditGeometrySession(
502
554
  currentInteractionSet = createEditCircleGeometryInteraction(
503
555
  feature as Feature<Circle>,
504
556
  scratchLayer,
557
+ editVertexOptions,
505
558
  );
506
559
  }
507
560
 
508
561
  if (currentInteractionSet) {
562
+ layerSnappingInteraction = new LayerSnapping(
563
+ snapToLayers,
564
+ scratchLayer,
565
+ (f) => f !== feature,
566
+ snapTo,
567
+ EventType.DRAGEVENTS,
568
+ );
569
+ currentInteractionSet.interactionChain.addInteraction(
570
+ layerSnappingInteraction,
571
+ 0,
572
+ );
509
573
  interactionChain.addInteraction(currentInteractionSet.interactionChain);
510
574
  altitudeModeChanged();
511
575
  } else {
@@ -529,6 +593,7 @@ function startEditGeometrySession(
529
593
 
530
594
  const stop = (): void => {
531
595
  app.layers.remove(scratchLayer);
596
+ scratchLayer.destroy();
532
597
  if (featureListener) {
533
598
  unByKey(featureListener);
534
599
  }
@@ -538,7 +603,7 @@ function startEditGeometrySession(
538
603
  destroyCurrentInteractionSet();
539
604
  destroyInteractionChain();
540
605
  vectorPropertiesChangedListener();
541
- pickingBehavior.reset();
606
+ resetPickingBehavior();
542
607
  stopped.raiseEvent();
543
608
  stopped.destroy();
544
609
  };
@@ -554,6 +619,15 @@ function startEditGeometrySession(
554
619
  get feature(): Feature | null {
555
620
  return currentFeature;
556
621
  },
622
+ get snapToLayers(): VectorLayer[] {
623
+ return snapToLayers.slice();
624
+ },
625
+ set snapToLayers(layers: VectorLayer[]) {
626
+ snapToLayers = layers.slice();
627
+ if (layerSnappingInteraction) {
628
+ layerSnappingInteraction.layers = snapToLayers;
629
+ }
630
+ },
557
631
  };
558
632
  }
559
633
 
@@ -2,6 +2,7 @@ import Point from 'ol/geom/Point.js';
2
2
  import Feature from 'ol/Feature.js';
3
3
  import type { Coordinate } from 'ol/coordinate.js';
4
4
  import type { Geometry } from 'ol/geom.js';
5
+ import { GeometryLayout } from 'ol/geom/Geometry.js';
5
6
 
6
7
  import {
7
8
  Cartesian2,
@@ -11,26 +12,27 @@ import {
11
12
  Ray,
12
13
  IntersectionTests,
13
14
  Cartographic,
14
- HeightReference,
15
15
  Cesium3DTileFeature,
16
16
  type Scene,
17
17
  type Camera,
18
18
  } from '@vcmap-cesium/engine';
19
19
 
20
20
  import { mercatorToCartesian } from '../math.js';
21
- import { getFlatCoordinatesFromGeometry } from '../geometryHelpers.js';
21
+ import { getFlatCoordinateReferences } from '../geometryHelpers.js';
22
22
  import CesiumMap from '../../map/cesiumMap.js';
23
- import { vertexSymbol } from './editorSymbols.js';
23
+ import { vertexIndexSymbol, vertexSymbol } from './editorSymbols.js';
24
24
  import {
25
25
  alreadyTransformedToImage,
26
26
  createSync,
27
27
  doNotTransform,
28
28
  } from '../../layer/vectorSymbols.js';
29
- import type VectorLayer from '../../layer/vectorLayer.js';
30
29
  import type VcsMap from '../../map/vcsMap.js';
31
- import { PropertyChangedKey } from '../../layer/vectorProperties.js';
30
+ import VectorProperties, {
31
+ PropertyChangedKey,
32
+ } from '../../layer/vectorProperties.js';
33
+ import VectorLayer from '../../layer/vectorLayer.js';
32
34
 
33
- export type Vertex = Feature<Point>;
35
+ export type Vertex = Feature<Point> & { [vertexIndexSymbol]: number };
34
36
 
35
37
  export type SelectableFeatureType = Feature | Cesium3DTileFeature;
36
38
  export interface SelectFeatureInteraction {
@@ -53,6 +55,42 @@ export const vectorPropertyChangeKeys: PropertyChangedKey[] = [
53
55
  'heightAboveGround',
54
56
  ];
55
57
 
58
+ function assignVectorProperty<
59
+ K extends PropertyChangedKey,
60
+ V extends VectorProperties[K],
61
+ >(props: VectorProperties, key: K, value: V): void {
62
+ props[key] = value;
63
+ }
64
+
65
+ export function syncScratchLayerVectorProperties(
66
+ scratchLayer: VectorLayer,
67
+ layer: VectorLayer,
68
+ altitudeModeChanged?: () => void,
69
+ ): () => void {
70
+ vectorPropertyChangeKeys.forEach((key) => {
71
+ assignVectorProperty(
72
+ scratchLayer.vectorProperties,
73
+ key,
74
+ layer.vectorProperties[key],
75
+ );
76
+ });
77
+
78
+ return layer.vectorProperties.propertyChanged.addEventListener((props) => {
79
+ vectorPropertyChangeKeys.forEach((key) => {
80
+ if (props.includes(key)) {
81
+ assignVectorProperty(
82
+ scratchLayer.vectorProperties,
83
+ key,
84
+ layer.vectorProperties[key],
85
+ );
86
+ if (key === 'altitudeMode') {
87
+ altitudeModeChanged?.();
88
+ }
89
+ }
90
+ });
91
+ });
92
+ }
93
+
56
94
  export function getOlcsPropsFromFeature(
57
95
  feature: Feature,
58
96
  ): Record<string, number | string> {
@@ -70,19 +108,54 @@ export function getOlcsPropsFromFeature(
70
108
  export function createVertex(
71
109
  coordinate: Coordinate,
72
110
  olcsProps: Record<string, number | string>,
111
+ index: number,
73
112
  ): Vertex {
74
113
  const geometry = new Point(coordinate);
75
114
  geometry[alreadyTransformedToImage] = true;
76
115
  const vertex = new Feature({
77
116
  geometry,
78
117
  ...olcsProps,
79
- });
118
+ }) as Vertex;
80
119
  vertex[vertexSymbol] = true;
120
+ vertex[vertexIndexSymbol] = index;
81
121
  vertex[doNotTransform] = true;
82
122
  vertex[createSync] = true;
83
123
  return vertex;
84
124
  }
85
125
 
126
+ export function isVertex(f?: unknown): f is Vertex {
127
+ return f instanceof Feature && !!f[vertexSymbol];
128
+ }
129
+
130
+ export function getCoordinatesAndLayoutFromVertices(vertices: Vertex[]): {
131
+ coordinates: Coordinate[];
132
+ layout: GeometryLayout;
133
+ } {
134
+ let is2D = false;
135
+ const flatCoordinates = new Array<number>(vertices.length * 3);
136
+ vertices.forEach((v, i) => {
137
+ const vertexCoordinates = v.getGeometry()!.getCoordinates();
138
+ is2D = is2D || vertexCoordinates.length === 2;
139
+ flatCoordinates[i * 3] = vertexCoordinates[0];
140
+ flatCoordinates[i * 3 + 1] = vertexCoordinates[1];
141
+ flatCoordinates[i * 3 + 2] = vertexCoordinates[2];
142
+ });
143
+
144
+ const coordinates = new Array<Coordinate>(vertices.length);
145
+ for (let i = 0; i < vertices.length; i++) {
146
+ const coordinate = [flatCoordinates[i * 3], flatCoordinates[i * 3 + 1]];
147
+ if (!is2D) {
148
+ coordinate[2] = flatCoordinates[i * 3 + 2];
149
+ }
150
+ coordinates[i] = coordinate;
151
+ }
152
+
153
+ return {
154
+ coordinates,
155
+ layout: is2D ? 'XY' : 'XYZ',
156
+ };
157
+ }
158
+
86
159
  let scratchCartesian21 = new Cartesian2();
87
160
  let scratchCartesian22 = new Cartesian2();
88
161
  let scratchCartesian23 = new Cartesian2();
@@ -124,6 +197,7 @@ export function getClosestPointOn2DLine(
124
197
  lambda,
125
198
  scratchCartesian21,
126
199
  );
200
+
127
201
  return [
128
202
  scratchCartesian21.x + start[0],
129
203
  scratchCartesian21.y + start[1],
@@ -295,9 +369,9 @@ export async function drapeGeometryOnTerrain(
295
369
  ): Promise<void> {
296
370
  if (map instanceof CesiumMap) {
297
371
  const coordinates = geometry.getCoordinates() as any[];
298
- const flats = getFlatCoordinatesFromGeometry(geometry, coordinates);
372
+ const flats = getFlatCoordinateReferences(geometry, coordinates);
299
373
  await map.getHeightFromTerrain(flats);
300
- geometry.setCoordinates(coordinates);
374
+ geometry.setCoordinates(coordinates, 'XYZ');
301
375
  }
302
376
  }
303
377
 
@@ -312,7 +386,7 @@ export async function placeGeometryOnTerrain(
312
386
  ): Promise<void> {
313
387
  if (map instanceof CesiumMap) {
314
388
  const coordinates = geometry.getCoordinates() as any[];
315
- const flats = getFlatCoordinatesFromGeometry(geometry, coordinates);
389
+ const flats = getFlatCoordinateReferences(geometry, coordinates);
316
390
  await map.getHeightFromTerrain(flats);
317
391
  let minHeight = Infinity;
318
392
  flats.forEach((coord) => {
@@ -323,28 +397,6 @@ export async function placeGeometryOnTerrain(
323
397
  flats.forEach((coord) => {
324
398
  coord[2] = minHeight;
325
399
  });
326
- geometry.setCoordinates(coordinates);
400
+ geometry.setCoordinates(coordinates, 'XYZ');
327
401
  }
328
402
  }
329
-
330
- export async function ensureFeatureAbsolute(
331
- feature: Feature,
332
- layer: VectorLayer,
333
- cesiumMap: CesiumMap,
334
- ): Promise<void> {
335
- // XXX this does not ensure 3D coordinates
336
- const layerIsClamped =
337
- layer.vectorProperties.altitudeMode === HeightReference.CLAMP_TO_GROUND;
338
- const altitudeMode = feature.get('olcs_altitudeMode') as string;
339
- if (altitudeMode === 'clampToGround' || (!altitudeMode && layerIsClamped)) {
340
- feature.set('olcs_altitudeMode', 'absolute', true);
341
- const geometry = feature.getGeometry();
342
- if (geometry) {
343
- await placeGeometryOnTerrain(geometry, cesiumMap);
344
- }
345
- }
346
- }
347
-
348
- export function clampFeature(feature: import('ol').Feature): void {
349
- feature.set('olcs_altitudeMode', 'clampToGround');
350
- }