@vcmap/core 5.0.3 → 5.1.0-rc.2

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 (307) hide show
  1. package/dist/geojson.d.ts +27 -0
  2. package/dist/index.d.ts +14 -4
  3. package/dist/index.js +9 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/classRegistry.js +2 -2
  6. package/dist/src/classRegistry.js.map +1 -1
  7. package/dist/src/featureProvider/abstractFeatureProvider.d.ts +2 -1
  8. package/dist/src/featureProvider/abstractFeatureProvider.js +2 -1
  9. package/dist/src/featureProvider/abstractFeatureProvider.js.map +1 -1
  10. package/dist/src/featureProvider/tileProviderFeatureProvider.d.ts +1 -1
  11. package/dist/src/featureProvider/tileProviderFeatureProvider.js +2 -2
  12. package/dist/src/featureProvider/tileProviderFeatureProvider.js.map +1 -1
  13. package/dist/src/featureProvider/wmsFeatureProvider.d.ts +1 -1
  14. package/dist/src/featureProvider/wmsFeatureProvider.js +4 -3
  15. package/dist/src/featureProvider/wmsFeatureProvider.js.map +1 -1
  16. package/dist/src/interaction/eventHandler.js +3 -3
  17. package/dist/src/interaction/eventHandler.js.map +1 -1
  18. package/dist/src/interaction/featureProviderInteraction.js +1 -1
  19. package/dist/src/interaction/featureProviderInteraction.js.map +1 -1
  20. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.d.ts +4 -1
  21. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js +31 -2
  22. package/dist/src/layer/cesium/cesiumTilesetCesiumImpl.js.map +1 -1
  23. package/dist/src/layer/cesium/resourceHelper.d.ts +2 -0
  24. package/dist/src/layer/cesium/resourceHelper.js +12 -0
  25. package/dist/src/layer/cesium/resourceHelper.js.map +1 -0
  26. package/dist/src/layer/cesium/singleImageCesiumImpl.js +2 -1
  27. package/dist/src/layer/cesium/singleImageCesiumImpl.js.map +1 -1
  28. package/dist/src/layer/cesium/terrainCesiumImpl.js +1 -1
  29. package/dist/src/layer/cesium/terrainCesiumImpl.js.map +1 -1
  30. package/dist/src/layer/cesium/tmsCesiumImpl.js +2 -1
  31. package/dist/src/layer/cesium/tmsCesiumImpl.js.map +1 -1
  32. package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js +1 -0
  33. package/dist/src/layer/cesium/vectorRasterTileCesiumImpl.js.map +1 -1
  34. package/dist/src/layer/cesium/vectorTileImageryProvider.d.ts +2 -0
  35. package/dist/src/layer/cesium/vectorTileImageryProvider.js +3 -1
  36. package/dist/src/layer/cesium/vectorTileImageryProvider.js.map +1 -1
  37. package/dist/src/layer/cesium/wmsCesiumImpl.js +2 -1
  38. package/dist/src/layer/cesium/wmsCesiumImpl.js.map +1 -1
  39. package/dist/src/layer/cesium/wmtsCesiumImpl.js +2 -1
  40. package/dist/src/layer/cesium/wmtsCesiumImpl.js.map +1 -1
  41. package/dist/src/layer/cesiumTilesetLayer.d.ts +5 -1
  42. package/dist/src/layer/cesiumTilesetLayer.js +17 -7
  43. package/dist/src/layer/cesiumTilesetLayer.js.map +1 -1
  44. package/dist/src/layer/czmlLayer.js +2 -1
  45. package/dist/src/layer/czmlLayer.js.map +1 -1
  46. package/dist/src/layer/featureLayer.js +2 -2
  47. package/dist/src/layer/featureLayer.js.map +1 -1
  48. package/dist/src/layer/featureStoreLayer.js +8 -5
  49. package/dist/src/layer/featureStoreLayer.js.map +1 -1
  50. package/dist/src/layer/featureStoreLayerChanges.d.ts +20 -8
  51. package/dist/src/layer/featureStoreLayerChanges.js +26 -26
  52. package/dist/src/layer/featureStoreLayerChanges.js.map +1 -1
  53. package/dist/src/layer/featureStoreLayerState.d.ts +1 -5
  54. package/dist/src/layer/featureStoreLayerState.js +0 -9
  55. package/dist/src/layer/featureStoreLayerState.js.map +1 -1
  56. package/dist/src/layer/geojsonLayer.js +3 -2
  57. package/dist/src/layer/geojsonLayer.js.map +1 -1
  58. package/dist/src/layer/layer.d.ts +15 -0
  59. package/dist/src/layer/layer.js +30 -4
  60. package/dist/src/layer/layer.js.map +1 -1
  61. package/dist/src/layer/layerImplementation.d.ts +1 -0
  62. package/dist/src/layer/layerImplementation.js +2 -0
  63. package/dist/src/layer/layerImplementation.js.map +1 -1
  64. package/dist/src/layer/oblique/vectorObliqueImpl.js +17 -7
  65. package/dist/src/layer/oblique/vectorObliqueImpl.js.map +1 -1
  66. package/dist/src/layer/openlayers/loadFunctionHelpers.d.ts +2 -0
  67. package/dist/src/layer/openlayers/loadFunctionHelpers.js +20 -0
  68. package/dist/src/layer/openlayers/loadFunctionHelpers.js.map +1 -0
  69. package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js +25 -1
  70. package/dist/src/layer/openlayers/singleImageOpenlayersImpl.js.map +1 -1
  71. package/dist/src/layer/openlayers/tmsOpenlayersImpl.js +9 -1
  72. package/dist/src/layer/openlayers/tmsOpenlayersImpl.js.map +1 -1
  73. package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js +1 -1
  74. package/dist/src/layer/openlayers/vectorTileOpenlayersImpl.js.map +1 -1
  75. package/dist/src/layer/openlayers/wmsOpenlayersImpl.d.ts +4 -1
  76. package/dist/src/layer/openlayers/wmsOpenlayersImpl.js +20 -1
  77. package/dist/src/layer/openlayers/wmsOpenlayersImpl.js.map +1 -1
  78. package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js +9 -1
  79. package/dist/src/layer/openlayers/wmtsOpenlayersImpl.js.map +1 -1
  80. package/dist/src/layer/pointCloudLayer.js +2 -2
  81. package/dist/src/layer/pointCloudLayer.js.map +1 -1
  82. package/dist/src/layer/terrainHelpers.d.ts +3 -3
  83. package/dist/src/layer/terrainHelpers.js +12 -7
  84. package/dist/src/layer/terrainHelpers.js.map +1 -1
  85. package/dist/src/layer/terrainLayer.js +1 -1
  86. package/dist/src/layer/terrainLayer.js.map +1 -1
  87. package/dist/src/layer/tileProvider/mvtTileProvider.d.ts +1 -1
  88. package/dist/src/layer/tileProvider/mvtTileProvider.js +4 -3
  89. package/dist/src/layer/tileProvider/mvtTileProvider.js.map +1 -1
  90. package/dist/src/layer/tileProvider/staticGeojsonTileProvider.d.ts +1 -1
  91. package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js +4 -3
  92. package/dist/src/layer/tileProvider/staticGeojsonTileProvider.js.map +1 -1
  93. package/dist/src/layer/tileProvider/tileProvider.d.ts +14 -11
  94. package/dist/src/layer/tileProvider/tileProvider.js +23 -20
  95. package/dist/src/layer/tileProvider/tileProvider.js.map +1 -1
  96. package/dist/src/layer/tileProvider/urlTemplateTileProvider.d.ts +1 -1
  97. package/dist/src/layer/tileProvider/urlTemplateTileProvider.js +4 -3
  98. package/dist/src/layer/tileProvider/urlTemplateTileProvider.js.map +1 -1
  99. package/dist/src/layer/vectorLayer.d.ts +1 -2
  100. package/dist/src/layer/vectorLayer.js +3 -3
  101. package/dist/src/layer/vectorLayer.js.map +1 -1
  102. package/dist/src/layer/vectorProperties.d.ts +11 -16
  103. package/dist/src/layer/vectorProperties.js +16 -13
  104. package/dist/src/layer/vectorProperties.js.map +1 -1
  105. package/dist/src/layer/wfsLayer.js +9 -6
  106. package/dist/src/layer/wfsLayer.js.map +1 -1
  107. package/dist/src/layer/wmsHelpers.d.ts +10 -0
  108. package/dist/src/layer/wmsHelpers.js +53 -12
  109. package/dist/src/layer/wmsHelpers.js.map +1 -1
  110. package/dist/src/layer/wmsLayer.d.ts +6 -0
  111. package/dist/src/layer/wmsLayer.js +5 -2
  112. package/dist/src/layer/wmsLayer.js.map +1 -1
  113. package/dist/src/map/cameraLimiter.d.ts +5 -0
  114. package/dist/src/map/cameraLimiter.js +11 -4
  115. package/dist/src/map/cameraLimiter.js.map +1 -1
  116. package/dist/src/map/cesiumMap.d.ts +20 -1
  117. package/dist/src/map/cesiumMap.js +51 -2
  118. package/dist/src/map/cesiumMap.js.map +1 -1
  119. package/dist/src/map/vcsMap.js +2 -2
  120. package/dist/src/map/vcsMap.js.map +1 -1
  121. package/dist/src/oblique/helpers.d.ts +1 -1
  122. package/dist/src/oblique/helpers.js +5 -9
  123. package/dist/src/oblique/helpers.js.map +1 -1
  124. package/dist/src/oblique/obliqueCollection.d.ts +1 -0
  125. package/dist/src/oblique/obliqueCollection.js +1 -1
  126. package/dist/src/oblique/obliqueCollection.js.map +1 -1
  127. package/dist/src/oblique/obliqueDataSet.d.ts +3 -1
  128. package/dist/src/oblique/obliqueDataSet.js +13 -6
  129. package/dist/src/oblique/obliqueDataSet.js.map +1 -1
  130. package/dist/src/oblique/obliqueImageMeta.d.ts +2 -0
  131. package/dist/src/oblique/obliqueImageMeta.js +2 -0
  132. package/dist/src/oblique/obliqueImageMeta.js.map +1 -1
  133. package/dist/src/oblique/obliqueView.d.ts +1 -0
  134. package/dist/src/oblique/obliqueView.js +12 -2
  135. package/dist/src/oblique/obliqueView.js.map +1 -1
  136. package/dist/src/oblique/parseImageJson.d.ts +6 -5
  137. package/dist/src/oblique/parseImageJson.js +7 -5
  138. package/dist/src/oblique/parseImageJson.js.map +1 -1
  139. package/dist/src/ol/geom/circle.js.map +1 -1
  140. package/dist/src/style/declarativeStyleItem.js +10 -2
  141. package/dist/src/style/declarativeStyleItem.js.map +1 -1
  142. package/dist/src/style/styleFactory.js +2 -2
  143. package/dist/src/style/styleFactory.js.map +1 -1
  144. package/dist/src/style/styleHelpers.js +13 -3
  145. package/dist/src/style/styleHelpers.js.map +1 -1
  146. package/dist/src/style/vectorStyleItem.js +29 -16
  147. package/dist/src/style/vectorStyleItem.js.map +1 -1
  148. package/dist/src/util/clipping/clippingPlaneHelper.js +3 -3
  149. package/dist/src/util/clipping/clippingPlaneHelper.js.map +1 -1
  150. package/dist/src/util/editor/createFeatureSession.d.ts +2 -2
  151. package/dist/src/util/editor/createFeatureSession.js +2 -2
  152. package/dist/src/util/editor/createFeatureSession.js.map +1 -1
  153. package/dist/src/util/editor/editFeaturesSession.d.ts +2 -2
  154. package/dist/src/util/editor/editGeometrySession.d.ts +2 -2
  155. package/dist/src/util/editor/editorSessionHelpers.d.ts +2 -2
  156. package/dist/src/util/editor/selectFeaturesSession.d.ts +2 -2
  157. package/dist/src/util/editor/selectFeaturesSession.js +2 -2
  158. package/dist/src/util/editor/selectFeaturesSession.js.map +1 -1
  159. package/dist/src/util/featureconverter/arcToCesium.d.ts +1 -1
  160. package/dist/src/util/featureconverter/arcToCesium.js +5 -2
  161. package/dist/src/util/featureconverter/arcToCesium.js.map +1 -1
  162. package/dist/src/util/featureconverter/circleToCesium.d.ts +4 -2
  163. package/dist/src/util/featureconverter/circleToCesium.js +8 -3
  164. package/dist/src/util/featureconverter/circleToCesium.js.map +1 -1
  165. package/dist/src/util/featureconverter/extent3D.js.map +1 -1
  166. package/dist/src/util/featureconverter/featureconverterHelper.js +2 -2
  167. package/dist/src/util/featureconverter/featureconverterHelper.js.map +1 -1
  168. package/dist/src/util/featureconverter/lineStringToCesium.d.ts +3 -1
  169. package/dist/src/util/featureconverter/lineStringToCesium.js +7 -2
  170. package/dist/src/util/featureconverter/lineStringToCesium.js.map +1 -1
  171. package/dist/src/util/featureconverter/pointToCesium.js +1 -1
  172. package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
  173. package/dist/src/util/featureconverter/polygonToCesium.d.ts +3 -3
  174. package/dist/src/util/featureconverter/polygonToCesium.js +9 -15
  175. package/dist/src/util/featureconverter/polygonToCesium.js.map +1 -1
  176. package/dist/src/util/fetch.d.ts +2 -0
  177. package/dist/src/util/fetch.js +16 -0
  178. package/dist/src/util/fetch.js.map +1 -1
  179. package/dist/src/util/flight/flightAnchor.d.ts +23 -0
  180. package/dist/src/util/flight/flightAnchor.js +152 -0
  181. package/dist/src/util/flight/flightAnchor.js.map +1 -0
  182. package/dist/src/util/flight/flightCollection.d.ts +25 -0
  183. package/dist/src/util/flight/flightCollection.js +63 -0
  184. package/dist/src/util/flight/flightCollection.js.map +1 -0
  185. package/dist/src/util/flight/flightHelpers.d.ts +29 -0
  186. package/dist/src/util/flight/flightHelpers.js +134 -0
  187. package/dist/src/util/flight/flightHelpers.js.map +1 -0
  188. package/dist/src/util/flight/flightInstance.d.ts +57 -0
  189. package/dist/src/util/flight/flightInstance.js +166 -0
  190. package/dist/src/util/flight/flightInstance.js.map +1 -0
  191. package/dist/src/util/flight/flightPlayer.d.ts +30 -0
  192. package/dist/src/util/flight/flightPlayer.js +247 -0
  193. package/dist/src/util/flight/flightPlayer.js.map +1 -0
  194. package/dist/src/util/flight/flightVisualizer.d.ts +18 -0
  195. package/dist/src/util/flight/flightVisualizer.js +151 -0
  196. package/dist/src/util/flight/flightVisualizer.js.map +1 -0
  197. package/dist/src/util/hiddenObjects.d.ts +8 -0
  198. package/dist/src/util/hiddenObjects.js +17 -0
  199. package/dist/src/util/hiddenObjects.js.map +1 -0
  200. package/dist/src/util/mapCollection.js +2 -2
  201. package/dist/src/util/mapCollection.js.map +1 -1
  202. package/dist/src/util/overrideCollection.d.ts +8 -3
  203. package/dist/src/util/overrideCollection.js +17 -0
  204. package/dist/src/util/overrideCollection.js.map +1 -1
  205. package/dist/src/util/projection.js +5 -2
  206. package/dist/src/util/projection.js.map +1 -1
  207. package/dist/src/util/viewpoint.d.ts +1 -0
  208. package/dist/src/util/viewpoint.js +24 -7
  209. package/dist/src/util/viewpoint.js.map +1 -1
  210. package/dist/src/vcsApp.d.ts +10 -3
  211. package/dist/src/vcsApp.js +34 -15
  212. package/dist/src/vcsApp.js.map +1 -1
  213. package/dist/src/vcsModule.d.ts +4 -0
  214. package/dist/src/vcsModule.js.map +1 -1
  215. package/dist/tests/unit/helpers/cesiumHelpers.d.ts +2 -2
  216. package/dist/tests/unit/helpers/cesiumHelpers.js +2 -1
  217. package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
  218. package/dist/tests/unit/helpers/terrain/terrainData.d.ts +7 -0
  219. package/dist/tests/unit/helpers/terrain/terrainData.js +2 -2
  220. package/dist/tests/unit/helpers/terrain/terrainData.js.map +1 -1
  221. package/index.ts +39 -1
  222. package/package.json +3 -2
  223. package/src/classRegistry.ts +2 -2
  224. package/src/featureProvider/abstractFeatureProvider.ts +2 -0
  225. package/src/featureProvider/tileProviderFeatureProvider.ts +2 -0
  226. package/src/featureProvider/wmsFeatureProvider.ts +4 -2
  227. package/src/interaction/eventHandler.ts +3 -3
  228. package/src/interaction/featureProviderInteraction.ts +1 -0
  229. package/src/layer/cesium/cesiumTilesetCesiumImpl.ts +44 -5
  230. package/src/layer/cesium/resourceHelper.ts +15 -0
  231. package/src/layer/cesium/singleImageCesiumImpl.ts +2 -1
  232. package/src/layer/cesium/terrainCesiumImpl.ts +2 -1
  233. package/src/layer/cesium/tmsCesiumImpl.ts +2 -1
  234. package/src/layer/cesium/vectorRasterTileCesiumImpl.ts +1 -0
  235. package/src/layer/cesium/vectorTileImageryProvider.ts +10 -1
  236. package/src/layer/cesium/wmsCesiumImpl.ts +2 -1
  237. package/src/layer/cesium/wmtsCesiumImpl.ts +4 -2
  238. package/src/layer/cesiumTilesetLayer.ts +25 -7
  239. package/src/layer/czmlLayer.ts +2 -1
  240. package/src/layer/featureLayer.ts +2 -2
  241. package/src/layer/featureStoreLayer.ts +8 -8
  242. package/src/layer/featureStoreLayerChanges.ts +63 -45
  243. package/src/layer/featureStoreLayerState.ts +6 -5
  244. package/src/layer/geojsonLayer.ts +3 -3
  245. package/src/layer/layer.ts +41 -4
  246. package/src/layer/layerImplementation.ts +3 -0
  247. package/src/layer/oblique/vectorObliqueImpl.ts +18 -12
  248. package/src/layer/openlayers/loadFunctionHelpers.ts +24 -0
  249. package/src/layer/openlayers/singleImageOpenlayersImpl.ts +25 -1
  250. package/src/layer/openlayers/tmsOpenlayersImpl.ts +8 -1
  251. package/src/layer/openlayers/vectorTileOpenlayersImpl.ts +1 -0
  252. package/src/layer/openlayers/wmsOpenlayersImpl.ts +23 -2
  253. package/src/layer/openlayers/wmtsOpenlayersImpl.ts +8 -1
  254. package/src/layer/pointCloudLayer.ts +2 -2
  255. package/src/layer/terrainHelpers.ts +19 -6
  256. package/src/layer/terrainLayer.ts +8 -4
  257. package/src/layer/tileProvider/mvtTileProvider.ts +9 -3
  258. package/src/layer/tileProvider/staticGeojsonTileProvider.ts +9 -3
  259. package/src/layer/tileProvider/tileProvider.ts +49 -13
  260. package/src/layer/tileProvider/urlTemplateTileProvider.ts +10 -3
  261. package/src/layer/vectorLayer.ts +9 -9
  262. package/src/layer/vectorProperties.ts +46 -22
  263. package/src/layer/wfsLayer.ts +9 -6
  264. package/src/layer/wmsHelpers.ts +78 -10
  265. package/src/layer/wmsLayer.ts +11 -2
  266. package/src/map/cameraLimiter.ts +21 -2
  267. package/src/map/cesiumMap.ts +67 -2
  268. package/src/map/vcsMap.ts +2 -2
  269. package/src/oblique/helpers.ts +5 -13
  270. package/src/oblique/obliqueCollection.ts +2 -0
  271. package/src/oblique/obliqueDataSet.ts +16 -2
  272. package/src/oblique/obliqueImageMeta.ts +4 -0
  273. package/src/oblique/obliqueView.ts +12 -2
  274. package/src/oblique/parseImageJson.ts +7 -4
  275. package/src/ol/geojson.d.ts +1 -2
  276. package/src/ol/geom/circle.ts +1 -1
  277. package/src/style/declarativeStyleItem.ts +10 -2
  278. package/src/style/styleFactory.ts +2 -2
  279. package/src/style/styleHelpers.ts +13 -4
  280. package/src/style/vectorStyleItem.ts +32 -20
  281. package/src/util/clipping/clippingPlaneHelper.ts +3 -3
  282. package/src/util/editor/createFeatureSession.ts +9 -8
  283. package/src/util/editor/editFeaturesSession.ts +1 -1
  284. package/src/util/editor/editGeometrySession.ts +1 -1
  285. package/src/util/editor/editorSessionHelpers.ts +2 -2
  286. package/src/util/editor/selectFeaturesSession.ts +3 -3
  287. package/src/util/featureconverter/arcToCesium.ts +5 -1
  288. package/src/util/featureconverter/circleToCesium.ts +8 -2
  289. package/src/util/featureconverter/extent3D.ts +1 -1
  290. package/src/util/featureconverter/featureconverterHelper.ts +3 -5
  291. package/src/util/featureconverter/lineStringToCesium.ts +8 -1
  292. package/src/util/featureconverter/pointToCesium.ts +1 -1
  293. package/src/util/featureconverter/polygonToCesium.ts +6 -15
  294. package/src/util/fetch.ts +25 -0
  295. package/src/util/flight/flightAnchor.ts +195 -0
  296. package/src/util/flight/flightCollection.ts +78 -0
  297. package/src/util/flight/flightHelpers.ts +208 -0
  298. package/src/util/flight/flightInstance.ts +240 -0
  299. package/src/util/flight/flightPlayer.ts +326 -0
  300. package/src/util/flight/flightVisualizer.ts +202 -0
  301. package/src/util/hiddenObjects.ts +35 -0
  302. package/src/util/mapCollection.ts +2 -2
  303. package/src/util/overrideCollection.ts +26 -3
  304. package/src/util/projection.ts +5 -2
  305. package/src/util/viewpoint.ts +27 -7
  306. package/src/vcsApp.ts +56 -15
  307. package/src/vcsModule.ts +4 -0
@@ -0,0 +1,202 @@
1
+ import {
2
+ PrimitiveCollection,
3
+ Camera,
4
+ Cartesian3,
5
+ HeadingPitchRoll,
6
+ Scene,
7
+ } from '@vcmap-cesium/engine';
8
+ import { createEmpty, isEmpty } from 'ol/extent.js';
9
+ import Feature from 'ol/Feature.js';
10
+ import { Point, LineString } from 'ol/geom.js';
11
+ import { check } from '@vcsuite/check';
12
+
13
+ import { mercatorToWgs84Transformer, wgs84Projection } from '../projection.js';
14
+ import VectorLayer from '../../layer/vectorLayer.js';
15
+ import Viewpoint from '../viewpoint.js';
16
+ import CesiumMap from '../../map/cesiumMap.js';
17
+ import VcsCameraPrimitive from '../../cesium/cesiumVcsCameraPrimitive.js';
18
+ import FlightInstance from './flightInstance.js';
19
+ import type VcsApp from '../../vcsApp.js';
20
+ import { getFlightPathCoordinatesFromInstance } from './flightHelpers.js';
21
+ import LayerState from '../../layer/layerState.js';
22
+ import VcsEvent from '../../vcsEvent.js';
23
+ import DeclarativeStyleItem from '../../style/declarativeStyleItem.js';
24
+ import { markVolatile } from '../../vcsModule.js';
25
+
26
+ export type FlightVisualization = {
27
+ readonly state: LayerState;
28
+ readonly stateChanged: VcsEvent<LayerState>;
29
+ readonly destroyed: VcsEvent<void>;
30
+ deactivate(): void;
31
+ activate(): Promise<void>;
32
+ destroy(): void;
33
+ zoomToExtent(): Promise<void>;
34
+ };
35
+
36
+ const flightVisualizationSymbol = Symbol('flightVisualization');
37
+ export async function createFlightVisualization(
38
+ instance: FlightInstance & {
39
+ [flightVisualizationSymbol]?: FlightVisualization;
40
+ },
41
+ app: VcsApp,
42
+ ): Promise<FlightVisualization> {
43
+ check(instance, FlightInstance);
44
+ if (instance[flightVisualizationSymbol]) {
45
+ return instance[flightVisualizationSymbol];
46
+ }
47
+ await instance.initialize();
48
+ let extent = createEmpty();
49
+
50
+ const primitives = new PrimitiveCollection();
51
+ primitives.show = false;
52
+ const layer = new VectorLayer({
53
+ projection: wgs84Projection.toJSON(),
54
+ name: `flightLayer-${instance.name}`,
55
+ style: {
56
+ type: DeclarativeStyleItem.className,
57
+ declarativeStyle: {
58
+ // eslint-disable-next-line no-template-curly-in-string
59
+ labelText: '${title}',
60
+ image: 'false',
61
+ color: 'color("#333333")',
62
+ strokeWidth: '2',
63
+ },
64
+ },
65
+ vectorProperties: {
66
+ altitudeMode: 'absolute',
67
+ },
68
+ });
69
+ markVolatile(layer);
70
+
71
+ let scene: Scene | undefined;
72
+ const [cesiumMap] = app.maps.getByType(CesiumMap.className) as CesiumMap[];
73
+ if (cesiumMap) {
74
+ scene = cesiumMap.getScene();
75
+ if (scene && !scene.primitives.contains(primitives)) {
76
+ scene.primitives.add(primitives);
77
+ }
78
+ }
79
+
80
+ app.layers.add(layer);
81
+ const setFeatures = (): void => {
82
+ layer.removeAllFeatures();
83
+ primitives.removeAll();
84
+
85
+ const features: Feature<Point | LineString>[] = [];
86
+ for (const anchor of instance.anchors) {
87
+ if (scene) {
88
+ const camera = new Camera(scene);
89
+ camera.frustum.far = 200;
90
+ camera.frustum.near = 10;
91
+ camera.setView({
92
+ destination: Cartesian3.fromDegrees(
93
+ anchor.coordinate[0],
94
+ anchor.coordinate[1],
95
+ anchor.coordinate[2],
96
+ ),
97
+ orientation: HeadingPitchRoll.fromDegrees(
98
+ anchor.heading,
99
+ anchor.pitch,
100
+ anchor.roll,
101
+ ),
102
+ });
103
+ primitives.add(new VcsCameraPrimitive({ camera, allowPicking: false }));
104
+ }
105
+
106
+ features.push(
107
+ new Feature({
108
+ geometry: new Point(anchor.coordinate, 'XYZ'),
109
+ title: anchor.title ?? anchor.name,
110
+ duration: anchor.duration,
111
+ }),
112
+ );
113
+ }
114
+
115
+ if (instance.isValid()) {
116
+ const pathCoordinates = getFlightPathCoordinatesFromInstance(instance);
117
+
118
+ const flightPath = new Feature({
119
+ geometry: new LineString(pathCoordinates, 'XYZ'),
120
+ });
121
+ flightPath.setId('flightPathGeom');
122
+
123
+ features.push(flightPath);
124
+ }
125
+
126
+ layer.addFeatures(features);
127
+ const mercatorExtent = layer.getSource().getExtent();
128
+ extent = mercatorToWgs84Transformer(mercatorExtent, mercatorExtent, 2);
129
+ };
130
+ setFeatures();
131
+
132
+ const changeListeners = [
133
+ instance.anchorsChanged.addEventListener(setFeatures),
134
+ instance.propertyChanged.addEventListener((property) => {
135
+ if (property === 'loop' || property === 'interpolation') {
136
+ setFeatures();
137
+ }
138
+ }),
139
+ ];
140
+
141
+ const destroyed = new VcsEvent<void>();
142
+ const destroy = (): void => {
143
+ layer.deactivate();
144
+ app.layers.remove(layer);
145
+ layer.destroy();
146
+
147
+ if (scene && scene.primitives.contains(primitives)) {
148
+ scene.primitives.remove(primitives);
149
+ }
150
+ changeListeners.forEach((cb) => {
151
+ cb();
152
+ });
153
+ destroyed.raiseEvent();
154
+ destroyed.destroy();
155
+ delete instance[flightVisualizationSymbol];
156
+ };
157
+
158
+ changeListeners.push(
159
+ app.flights.removed.addEventListener((flight) => {
160
+ if (flight === instance) {
161
+ destroy();
162
+ }
163
+ }),
164
+ app.flights.added.addEventListener((flight) => {
165
+ if (flight.name === instance.name) {
166
+ destroy();
167
+ }
168
+ }),
169
+ );
170
+
171
+ const visualization: FlightVisualization = {
172
+ get state(): LayerState {
173
+ return layer.state;
174
+ },
175
+ get stateChanged(): VcsEvent<LayerState> {
176
+ return layer.stateChanged;
177
+ },
178
+ get destroyed(): VcsEvent<void> {
179
+ return destroyed;
180
+ },
181
+ async activate(): Promise<void> {
182
+ await layer.activate();
183
+ primitives.show = true;
184
+ },
185
+ deactivate(): void {
186
+ layer.deactivate();
187
+ primitives.show = false;
188
+ },
189
+ destroy,
190
+ async zoomToExtent(): Promise<void> {
191
+ if (!instance.isValid() || isEmpty(extent)) {
192
+ return;
193
+ }
194
+ const viewpoint = Viewpoint.createViewpointFromExtent(extent);
195
+ if (viewpoint) {
196
+ await app.maps.activeMap?.gotoViewpoint(viewpoint);
197
+ }
198
+ },
199
+ };
200
+ instance[flightVisualizationSymbol] = visualization;
201
+ return visualization;
202
+ }
@@ -0,0 +1,35 @@
1
+ import type GlobalHider from '../layer/globalHider.js';
2
+ import makeOverrideCollection, {
3
+ OverrideCollection,
4
+ } from './overrideCollection.js';
5
+ import Collection from './collection.js';
6
+ import { moduleIdSymbol } from '../moduleIdSymbol.js';
7
+
8
+ export type HiddenObject = {
9
+ id: string;
10
+ [moduleIdSymbol]?: string;
11
+ };
12
+
13
+ export function createHiddenObjectsCollection(
14
+ getDynamicModuleId: () => string,
15
+ globalHider: GlobalHider,
16
+ ): OverrideCollection<HiddenObject> {
17
+ const collection = makeOverrideCollection<
18
+ HiddenObject,
19
+ Collection<HiddenObject>
20
+ >(new Collection<HiddenObject>('id'), getDynamicModuleId);
21
+
22
+ collection.added.addEventListener(({ id }) => {
23
+ globalHider.hideObjects([id]);
24
+ });
25
+
26
+ collection.replaced.addEventListener(({ new: item }) => {
27
+ globalHider.showObjects([item.id]);
28
+ });
29
+
30
+ collection.removed.addEventListener(({ id }) => {
31
+ globalHider.showObjects([id]);
32
+ });
33
+
34
+ return collection;
35
+ }
@@ -1,4 +1,4 @@
1
- import { check, checkMaybe } from '@vcsuite/check';
1
+ import { check, maybe, oneOf } from '@vcsuite/check';
2
2
  import { getLogger } from '@vcsuite/logger';
3
3
  import VcsEvent from '../vcsEvent.js';
4
4
  import Collection from './collection.js';
@@ -240,7 +240,7 @@ class MapCollection extends Collection<VcsMap> {
240
240
  * Set the target for these maps.
241
241
  */
242
242
  setTarget(target: string | HTMLElement): void {
243
- checkMaybe(target, [String, HTMLElement]);
243
+ check(target, maybe(oneOf(String, HTMLElement)));
244
244
 
245
245
  this._target =
246
246
  typeof target === 'string' ? document.getElementById(target) : target;
@@ -27,14 +27,19 @@ export type OverrideCollectionItem = {
27
27
  /**
28
28
  * The override collection adds the ability to override a unique item and re-creating it, should the override
29
29
  * be removed. This does change some flow of called events. 1) if you override an item, removed is not called for the
30
- * removed current item. 2) added can be called more the once for the same unique id. 3) replaced is called for items
31
- * which where replaced. replaced is called after added has been called for the item.
30
+ * removed current item. 2) replaced is called for items which where replaced. 3) added can be called more the once for the same unique id.
31
+ * Replaced is called before added has been called for the item.
32
32
  */
33
33
  export type OverrideCollectionInterface<T> = {
34
34
  /**
35
- * replaced is called after added
35
+ * replaced is called before added
36
36
  */
37
37
  replaced: VcsEvent<ReplacedEvent<T>>;
38
+ /**
39
+ * Replacement is only supported for items of the dynamic module. For other items you may use override instead.
40
+ * Returns the replaced item or null if the item could not be inserted
41
+ */
42
+ replace: (item: T) => T | null;
38
43
  shadowMap: Map<string, (object & { [moduleIdSymbol]?: string })[]>;
39
44
  /**
40
45
  * returns the overriden item or null if the item could not be inserted (this would be the result of a race condition)
@@ -104,6 +109,24 @@ function makeOverrideCollection<
104
109
 
105
110
  overrideCollection.shadowMap = new Map();
106
111
 
112
+ overrideCollection.replace = function replace(item: T): T | null {
113
+ const itemId = item[overrideCollection.uniqueKey] as string;
114
+ const old = overrideCollection.getByKey(itemId);
115
+ if (old?.[moduleIdSymbol] === getDynamicModuleId()) {
116
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
117
+ // @ts-ignore
118
+ // eslint-disable-next-line no-underscore-dangle
119
+ const index = overrideCollection._remove(old);
120
+ overrideCollection.replaced.raiseEvent({ old, new: item });
121
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
122
+ // @ts-ignore
123
+ if ((overrideCollection.add(item, index) as number) >= 0) {
124
+ return item;
125
+ }
126
+ }
127
+ return null;
128
+ };
129
+
107
130
  overrideCollection.override = function override(item: T): T | null {
108
131
  let shadow;
109
132
  let index;
@@ -7,7 +7,7 @@ import {
7
7
  import { register } from 'ol/proj/proj4.js';
8
8
  import type { Coordinate } from 'ol/coordinate.js';
9
9
  import proj4 from 'proj4';
10
- import { check } from '@vcsuite/check';
10
+ import { check, maybe, oneOf } from '@vcsuite/check';
11
11
 
12
12
  export type ProjectionOptions = {
13
13
  type?: string;
@@ -102,7 +102,10 @@ function registerProjection(options: ProjectionOptions): ProjectionOptions {
102
102
  * projection created prior to this functions call.
103
103
  */
104
104
  export function setDefaultProjectionOptions(options: ProjectionOptions): void {
105
- check(options, { epsg: [String, Number], proj4: [String, undefined, null] });
105
+ check(options, {
106
+ epsg: oneOf(String, Number),
107
+ proj4: maybe(String),
108
+ });
106
109
  if (!validateProjectionOptions(options)) {
107
110
  throw new Error('Cannot set invalid projection options as default options');
108
111
  }
@@ -1,4 +1,5 @@
1
1
  import type { Coordinate } from 'ol/coordinate.js';
2
+ import { containsCoordinate } from 'ol/extent.js';
2
3
  import { EasingFunction } from '@vcmap-cesium/engine';
3
4
  import { parseBoolean, parseNumber } from '@vcsuite/parsers';
4
5
  import Projection, { wgs84Projection } from './projection.js';
@@ -159,12 +160,27 @@ class Viewpoint extends VcsObject {
159
160
  */
160
161
  easingFunctionName: string | undefined;
161
162
 
163
+ static getDefaultOptions(): ViewpointOptions {
164
+ return {
165
+ cameraPosition: undefined,
166
+ groundPosition: undefined,
167
+ distance: 1000,
168
+ heading: 0,
169
+ pitch: -90,
170
+ roll: 0,
171
+ animate: false,
172
+ duration: undefined,
173
+ easingFunctionName: undefined,
174
+ };
175
+ }
176
+
162
177
  /**
163
178
  * @param options
164
179
  */
165
180
  constructor(options: ViewpointOptions) {
166
181
  super(options);
167
182
 
183
+ const defaultOptions = Viewpoint.getDefaultOptions();
168
184
  this.cameraPosition = null;
169
185
  if (
170
186
  Array.isArray(options.cameraPosition) &&
@@ -179,12 +195,12 @@ class Viewpoint extends VcsObject {
179
195
  }
180
196
  this.distance = parseNumber(
181
197
  options.distance,
182
- this.cameraPosition ? this.cameraPosition[2] : 1000,
198
+ this.cameraPosition ? this.cameraPosition[2] : defaultOptions.distance,
183
199
  );
184
- this.heading = parseNumber(options.heading, 0);
185
- this.pitch = parseNumber(options.pitch, -90);
186
- this.roll = parseNumber(options.roll, 0);
187
- this.animate = parseBoolean(options.animate, false);
200
+ this.heading = parseNumber(options.heading, defaultOptions.heading);
201
+ this.pitch = parseNumber(options.pitch, defaultOptions.pitch);
202
+ this.roll = parseNumber(options.roll, defaultOptions.roll);
203
+ this.animate = parseBoolean(options.animate, defaultOptions.animate);
188
204
  this.duration = parseNumber(options.duration);
189
205
  this.easingFunctionName = options.easingFunctionName;
190
206
  }
@@ -341,13 +357,17 @@ class Viewpoint extends VcsObject {
341
357
  this.cameraPosition &&
342
358
  Array.isArray(this.cameraPosition) &&
343
359
  this.cameraPosition.length === 3 &&
344
- this.cameraPosition.every((position) => Number.isFinite(position));
360
+ this.cameraPosition.every((position) => Number.isFinite(position)) &&
361
+ containsCoordinate(Extent.WGS_84_EXTENT, this.cameraPosition);
362
+
345
363
  const hasGround =
346
364
  this.groundPosition &&
347
365
  Array.isArray(this.groundPosition) &&
348
366
  this.groundPosition.length > 1 &&
349
367
  this.groundPosition.length < 4 &&
350
- this.groundPosition.every((position) => Number.isFinite(position));
368
+ this.groundPosition.every((position) => Number.isFinite(position)) &&
369
+ containsCoordinate(Extent.WGS_84_EXTENT, this.groundPosition);
370
+
351
371
  if (!hasGround && !hasCamera) {
352
372
  return false;
353
373
  }
package/src/vcsApp.ts CHANGED
@@ -42,6 +42,14 @@ import type LayerCollection from './util/layerCollection.js';
42
42
  import type Category from './category/category.js';
43
43
  import type TileProvider from './layer/tileProvider/tileProvider.js';
44
44
  import type AbstractFeatureProvider from './featureProvider/abstractFeatureProvider.js';
45
+ import {
46
+ createHiddenObjectsCollection,
47
+ HiddenObject,
48
+ } from './util/hiddenObjects.js';
49
+ import FlightInstance, {
50
+ FlightInstanceOptions,
51
+ } from './util/flight/flightInstance.js';
52
+ import FlightCollection from './util/flight/flightCollection.js';
45
53
 
46
54
  function getLogger(): Logger {
47
55
  return getLoggerByName('init');
@@ -104,7 +112,11 @@ class VcsApp {
104
112
 
105
113
  private _modules: IndexedCollection<VcsModule>;
106
114
 
107
- private _categoryClassRegisty: OverrideClassRegistry<typeof Category>;
115
+ private _hiddenObjects: OverrideCollection<HiddenObject>;
116
+
117
+ private _flights: OverrideCollection<FlightInstance, FlightCollection>;
118
+
119
+ private _categoryClassRegistry: OverrideClassRegistry<typeof Category>;
108
120
 
109
121
  private _categories: CategoryCollection;
110
122
 
@@ -114,11 +126,11 @@ class VcsApp {
114
126
 
115
127
  private _categoryItemClassRegistry: OverrideClassRegistry<Ctor<any>>;
116
128
 
117
- private _tileProviderClassRegsitry: OverrideClassRegistry<
129
+ private _tileProviderClassRegistry: OverrideClassRegistry<
118
130
  typeof TileProvider
119
131
  >;
120
132
 
121
- private _featureProviderClassRegsitry: OverrideClassRegistry<
133
+ private _featureProviderClassRegistry: OverrideClassRegistry<
122
134
  typeof AbstractFeatureProvider
123
135
  >;
124
136
 
@@ -186,7 +198,20 @@ class VcsApp {
186
198
  this._modules = new IndexedCollection('_id');
187
199
  this._modules.add(this._dynamicModule);
188
200
 
189
- this._categoryClassRegisty = new OverrideClassRegistry(
201
+ this._hiddenObjects = createHiddenObjectsCollection(
202
+ getDynamicModuleId,
203
+ this._layers.globalHider,
204
+ );
205
+
206
+ this._flights = makeOverrideCollection(
207
+ new FlightCollection(this),
208
+ getDynamicModuleId,
209
+ undefined,
210
+ (flightOptions: FlightInstanceOptions) =>
211
+ new FlightInstance(flightOptions),
212
+ );
213
+
214
+ this._categoryClassRegistry = new OverrideClassRegistry(
190
215
  categoryClassRegistry,
191
216
  );
192
217
  this._categories = new CategoryCollection(this);
@@ -195,10 +220,10 @@ class VcsApp {
195
220
  this._categoryItemClassRegistry = new OverrideClassRegistry(
196
221
  new ClassRegistry(),
197
222
  );
198
- this._tileProviderClassRegsitry = new OverrideClassRegistry(
223
+ this._tileProviderClassRegistry = new OverrideClassRegistry(
199
224
  tileProviderClassRegistry,
200
225
  );
201
- this._featureProviderClassRegsitry = new OverrideClassRegistry(
226
+ this._featureProviderClassRegistry = new OverrideClassRegistry(
202
227
  featureProviderClassRegistry,
203
228
  );
204
229
 
@@ -262,6 +287,14 @@ class VcsApp {
262
287
  return this._categories;
263
288
  }
264
289
 
290
+ get hiddenObject(): OverrideCollection<HiddenObject> {
291
+ return this._hiddenObjects;
292
+ }
293
+
294
+ get flights(): OverrideCollection<FlightInstance, FlightCollection> {
295
+ return this._flights;
296
+ }
297
+
265
298
  get destroyed(): VcsEvent<void> {
266
299
  return this._destroyed;
267
300
  }
@@ -299,7 +332,7 @@ class VcsApp {
299
332
  }
300
333
 
301
334
  get categoryClassRegistry(): OverrideClassRegistry<typeof Category> {
302
- return this._categoryClassRegisty;
335
+ return this._categoryClassRegistry;
303
336
  }
304
337
 
305
338
  get categoryItemClassRegistry(): OverrideClassRegistry<Ctor<any>> {
@@ -307,13 +340,13 @@ class VcsApp {
307
340
  }
308
341
 
309
342
  get tileProviderClassRegistry(): OverrideClassRegistry<typeof TileProvider> {
310
- return this._tileProviderClassRegsitry;
343
+ return this._tileProviderClassRegistry;
311
344
  }
312
345
 
313
346
  get featureProviderClassRegistry(): OverrideClassRegistry<
314
347
  typeof AbstractFeatureProvider
315
348
  > {
316
- return this._featureProviderClassRegsitry;
349
+ return this._featureProviderClassRegistry;
317
350
  }
318
351
 
319
352
  getModuleById(id: string): VcsModule | undefined {
@@ -329,7 +362,7 @@ class VcsApp {
329
362
 
330
363
  await this._styles.parseItems(config.styles, module._id);
331
364
  await this._layers.parseItems(config.layers, module._id);
332
- // TODO add flights & ade here
365
+ // TODO add ade here
333
366
 
334
367
  await this._obliqueCollections.parseItems(
335
368
  config.obliqueCollections,
@@ -337,6 +370,8 @@ class VcsApp {
337
370
  );
338
371
  await this._viewpoints.parseItems(config.viewpoints, module._id);
339
372
  await this._maps.parseItems(config.maps, module._id);
373
+ await this._hiddenObjects.parseItems(config.hiddenObjects, module._id);
374
+ await this._flights.parseItems(config.flights, module._id);
340
375
 
341
376
  if (Array.isArray(config.categories)) {
342
377
  await Promise.all(
@@ -358,8 +393,6 @@ class VcsApp {
358
393
  `Failed to activate active on startup layer ${l.name}`,
359
394
  );
360
395
  getLogger().error(String(err));
361
- this._layers.remove(l);
362
- l.destroy();
363
396
  });
364
397
  }
365
398
  });
@@ -424,6 +457,10 @@ class VcsApp {
424
457
  this._obliqueCollections.serializeModule(moduleId);
425
458
  config.viewpoints = this._viewpoints.serializeModule(moduleId);
426
459
  config.styles = this._styles.serializeModule(moduleId);
460
+ config.hiddenObjects = this._hiddenObjects.serializeModule(
461
+ moduleId,
462
+ ) as HiddenObject[];
463
+ config.flights = this._flights.serializeModule(moduleId);
427
464
  config.categories = [...this._categories]
428
465
  .map((c) => c.serializeModule(moduleId))
429
466
  .filter((c) => !!c) as { name: string; items: object[] }[];
@@ -461,6 +498,8 @@ class VcsApp {
461
498
  this._viewpoints.removeModule(moduleId),
462
499
  this._styles.removeModule(moduleId),
463
500
  this._obliqueCollections.removeModule(moduleId),
501
+ this._hiddenObjects.removeModule(moduleId),
502
+ this._flights.removeModule(moduleId),
464
503
  ]);
465
504
  }
466
505
 
@@ -494,13 +533,15 @@ class VcsApp {
494
533
  destroyCollection(this._viewpoints);
495
534
  destroyCollection(this._styles);
496
535
  destroyCollection(this._categories);
536
+ this._modules.destroy();
537
+ this._hiddenObjects.destroy();
497
538
  this._mapClassRegistry.destroy();
498
539
  this._layerClassRegistry.destroy();
499
540
  this._styleClassRegistry.destroy();
500
- this._categoryClassRegisty.destroy();
541
+ this._categoryClassRegistry.destroy();
501
542
  this._categoryItemClassRegistry.destroy();
502
- this._tileProviderClassRegsitry.destroy();
503
- this._featureProviderClassRegsitry.destroy();
543
+ this._tileProviderClassRegistry.destroy();
544
+ this._featureProviderClassRegistry.destroy();
504
545
  this.destroyed.raiseEvent();
505
546
  this.destroyed.destroy();
506
547
  this.localeChanged.destroy();
package/src/vcsModule.ts CHANGED
@@ -7,6 +7,8 @@ import type { ViewpointOptions } from './util/viewpoint.js';
7
7
  import type { ObliqueCollectionOptions } from './oblique/obliqueCollection.js';
8
8
  import type VcsApp from './vcsApp.js';
9
9
  import { moduleIdSymbol } from './moduleIdSymbol.js';
10
+ import { HiddenObject } from './util/hiddenObjects.js';
11
+ import { FlightInstanceOptions } from './util/flight/flightInstance.js';
10
12
 
11
13
  export type VcsModuleConfig = {
12
14
  _id?: string | undefined;
@@ -23,6 +25,8 @@ export type VcsModuleConfig = {
23
25
  projection?: ProjectionOptions;
24
26
  obliqueCollections?: ObliqueCollectionOptions[];
25
27
  categories?: { name: string; items: object[] }[];
28
+ hiddenObjects?: HiddenObject[];
29
+ flights?: FlightInstanceOptions[];
26
30
  };
27
31
 
28
32
  /**