@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
@@ -105,19 +105,25 @@ export function createLineGeometries(
105
105
  * extracts the center and radius from the CircleGeometry and converts it to Cartesian3/radius in m
106
106
  * @param geometry
107
107
  * @param positionHeightAdjustment
108
- * @returns }
108
+ * @param perPositionHeight
109
+ * @param groundLevelOrMinHeight
110
+ * @returns
109
111
  * @private
110
112
  */
111
113
  export function getGeometryOptions(
112
114
  geometry: Circle,
113
115
  positionHeightAdjustment: number,
116
+ perPositionHeight: boolean,
117
+ groundLevelOrMinHeight: number,
114
118
  ): ConstructorParameters<typeof CircleGeometry>[0] {
115
119
  // olCoordinates of center and radius in WGS84
116
120
  const olCenter = geometry.getCenter();
117
121
  const olPoint = olCenter.slice();
118
122
  olPoint[0] += geometry.getRadius();
119
123
  const wgs84Center = Projection.mercatorToWgs84(olCenter, true);
120
- if (wgs84Center[2] != null) {
124
+ if (!perPositionHeight && groundLevelOrMinHeight) {
125
+ wgs84Center[2] = groundLevelOrMinHeight;
126
+ } else if (wgs84Center[2] != null) {
121
127
  wgs84Center[2] += positionHeightAdjustment;
122
128
  }
123
129
 
@@ -13,7 +13,7 @@ class Extent3D {
13
13
  static fromArray(
14
14
  array: [number, number, number, number, number, number],
15
15
  ): Extent3D {
16
- check(array, [Number]);
16
+ check(array as [number, number, number, number, number, number], [Number]);
17
17
  check(array.length, 6);
18
18
  return new Extent3D(
19
19
  array[0],
@@ -520,6 +520,8 @@ export function addPrimitivesToContext(
520
520
  const geometryOptions = geometryFactory.getGeometryOptions(
521
521
  geometry,
522
522
  heightInfo.heightAboveGroundAdjustment,
523
+ heightInfo.perPositionHeight,
524
+ heightInfo.groundLevel,
523
525
  );
524
526
  const storeyOptions = getStoreyOptions(
525
527
  heightInfo.storeyHeightsAboveGround,
@@ -609,11 +611,7 @@ export function addPrimitivesToContext(
609
611
  );
610
612
  } else {
611
613
  lineGeometries.push(
612
- ...geometryFactory.createLineGeometries(
613
- geometryOptions,
614
- style,
615
- heightInfo.groundLevel,
616
- ),
614
+ ...geometryFactory.createLineGeometries(geometryOptions, style),
617
615
  );
618
616
  }
619
617
  }
@@ -185,6 +185,7 @@ export function createLineGeometries(
185
185
  style: Style,
186
186
  ): PolylineGeometry[] {
187
187
  const width = parseNumber(style.getStroke().getWidth(), 1.0);
188
+
188
189
  return [
189
190
  new PolylineGeometry({
190
191
  ...options,
@@ -197,16 +198,22 @@ export function createLineGeometries(
197
198
  * Creates the positions array for PolylineGeometry
198
199
  * @param geometry
199
200
  * @param positionHeightAdjustment
201
+ * @param perPositionHeight
202
+ * @param groundLevelOrMinHeight
200
203
  * @private
201
204
  */
202
205
  export function getGeometryOptions(
203
206
  geometry: LineString,
204
207
  positionHeightAdjustment: number,
208
+ perPositionHeight: boolean,
209
+ groundLevelOrMinHeight: number,
205
210
  ): LineGeometryOptions {
206
211
  const coords = geometry.getCoordinates();
207
212
  const positions = coords.map((coord) => {
208
213
  const wgs84Coords = Projection.mercatorToWgs84(coord);
209
- if (wgs84Coords[2] != null) {
214
+ if (!perPositionHeight && groundLevelOrMinHeight) {
215
+ wgs84Coords[2] = groundLevelOrMinHeight;
216
+ } else if (wgs84Coords[2] != null) {
210
217
  wgs84Coords[2] += positionHeightAdjustment;
211
218
  }
212
219
  return Cartesian3.fromDegrees(
@@ -228,7 +228,7 @@ export function getCartesian3AndWGS84FromCoordinates(
228
228
  wgs84Positions[index] = Projection.mercatorToWgs84(coord, true);
229
229
  let height = null;
230
230
  if (heightInfo.heightReference === HeightReference.RELATIVE_TO_GROUND) {
231
- height = heightInfo.heightAboveGroundAdjustment;
231
+ height = heightValue + heightInfo.heightAboveGroundAdjustment;
232
232
  } else {
233
233
  height = heightValue;
234
234
  }
@@ -7,7 +7,6 @@ import {
7
7
  PolygonHierarchy,
8
8
  PolylineGeometry,
9
9
  type Scene,
10
- Cartographic,
11
10
  } from '@vcmap-cesium/engine';
12
11
  import type { Style } from 'ol/style.js';
13
12
  import type { Polygon } from 'ol/geom.js';
@@ -74,7 +73,6 @@ export function createFillGeometries(
74
73
  export function getLineGeometryOptions(
75
74
  options: PolygonGeometryOptions,
76
75
  style: Style,
77
- groundLevel?: number,
78
76
  ): PolylineGeometryOptions[] {
79
77
  const width = parseNumber(style.getStroke().getWidth(), 1.0);
80
78
  const geometryOptions: PolylineGeometryOptions[] = [];
@@ -90,16 +88,6 @@ export function getLineGeometryOptions(
90
88
  width,
91
89
  });
92
90
  });
93
-
94
- if (groundLevel) {
95
- geometryOptions.forEach((polylineOptions) => {
96
- polylineOptions.positions = polylineOptions.positions.map((c) => {
97
- const geographic = Cartographic.fromCartesian(c);
98
- geographic.height = groundLevel;
99
- return Cartographic.toCartesian(geographic);
100
- });
101
- });
102
- }
103
91
  return geometryOptions;
104
92
  }
105
93
 
@@ -114,9 +102,8 @@ export function createGroundLineGeometries(
114
102
  export function createLineGeometries(
115
103
  options: PolygonGeometryOptions,
116
104
  style: Style,
117
- groundLevel?: number,
118
105
  ): PolylineGeometry[] {
119
- return getLineGeometryOptions(options, style, groundLevel).map((option) => {
106
+ return getLineGeometryOptions(options, style).map((option) => {
120
107
  return new PolylineGeometry(option);
121
108
  });
122
109
  }
@@ -124,6 +111,8 @@ export function createLineGeometries(
124
111
  export function getGeometryOptions(
125
112
  geometry: Polygon,
126
113
  positionHeightAdjustment: number,
114
+ perPositionHeight: boolean,
115
+ groundLevelOrMinHeight: number,
127
116
  ): PolygonGeometryOptions {
128
117
  let hieraryPositions;
129
118
  const holes = [];
@@ -132,7 +121,9 @@ export function getGeometryOptions(
132
121
  const coords = rings[i].getCoordinates();
133
122
  const positions = coords.map((coord) => {
134
123
  const wgs84Coords = Projection.mercatorToWgs84(coord);
135
- if (wgs84Coords[2] != null) {
124
+ if (!perPositionHeight && groundLevelOrMinHeight) {
125
+ wgs84Coords[2] = groundLevelOrMinHeight;
126
+ } else if (wgs84Coords[2] != null) {
136
127
  wgs84Coords[2] += positionHeightAdjustment;
137
128
  }
138
129
  return Cartesian3.fromDegrees(
package/src/util/fetch.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { TrustedServers } from '@vcmap-cesium/engine';
2
+
1
3
  export async function requestUrl(
2
4
  url: string,
3
5
  init?: RequestInit,
@@ -26,3 +28,26 @@ export async function requestArrayBuffer(
26
28
  const response = await requestUrl(url, init);
27
29
  return response.arrayBuffer();
28
30
  }
31
+
32
+ export async function requestObjectUrl(
33
+ url: string,
34
+ init?: RequestInit,
35
+ ): Promise<string> {
36
+ const response = await requestUrl(url, init);
37
+ const blob = await response.blob();
38
+ return URL.createObjectURL(blob);
39
+ }
40
+
41
+ export function getInitForUrl(
42
+ url: string,
43
+ headers?: Record<string, string>,
44
+ ): RequestInit {
45
+ const init: RequestInit = {};
46
+ if (headers) {
47
+ init.headers = headers;
48
+ }
49
+ if (TrustedServers.contains(url)) {
50
+ init.credentials = 'include';
51
+ }
52
+ return init;
53
+ }
@@ -0,0 +1,195 @@
1
+ import { check, is, maybe, PatternFor } from '@vcsuite/check';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import type { Feature as GeojsonFeature, Point as GeojsonPoint } from 'geojson';
4
+ import { type Coordinate, equals as coordinateEquals } from 'ol/coordinate.js';
5
+ import VcsEvent from '../../vcsEvent.js';
6
+ import Viewpoint from '../viewpoint.js';
7
+
8
+ type FlightAnchorFeatureProperties = {
9
+ heading: number;
10
+ pitch: number;
11
+ roll: number;
12
+ duration: number;
13
+ title?: string;
14
+ };
15
+
16
+ export type FlightAnchorGeojsonFeature = GeojsonFeature<
17
+ GeojsonPoint,
18
+ FlightAnchorFeatureProperties
19
+ >;
20
+
21
+ export type FlightAnchor = FlightAnchorFeatureProperties & {
22
+ readonly changed: VcsEvent<void>;
23
+ readonly name: string;
24
+ coordinate: Coordinate;
25
+ destroy(): void;
26
+ };
27
+
28
+ type FlightAnchorOptions = Omit<FlightAnchor, 'changed' | 'destroy'>;
29
+
30
+ const flightAnchorOptionsPattern: PatternFor<FlightAnchorOptions> = {
31
+ name: String,
32
+ coordinate: [Number],
33
+ heading: Number,
34
+ pitch: Number,
35
+ roll: Number,
36
+ duration: Number,
37
+ title: maybe(String),
38
+ };
39
+
40
+ function isOptions(options: unknown): options is FlightAnchorOptions {
41
+ return (
42
+ is(options, flightAnchorOptionsPattern) && options.coordinate.length === 3
43
+ );
44
+ }
45
+
46
+ function fromOptions(options: FlightAnchorOptions): FlightAnchor {
47
+ check(options, flightAnchorOptionsPattern);
48
+
49
+ const changed = new VcsEvent<void>();
50
+ const { name } = options;
51
+ let { title, heading, pitch, roll, coordinate, duration } = options;
52
+ coordinate = coordinate.slice();
53
+
54
+ return {
55
+ get changed(): VcsEvent<void> {
56
+ return changed;
57
+ },
58
+ get name(): string {
59
+ return name;
60
+ },
61
+ get coordinate(): Coordinate {
62
+ return coordinate;
63
+ },
64
+ set coordinate(value: Coordinate) {
65
+ check(value, [Number]);
66
+ check(value.length, 3);
67
+
68
+ if (!coordinateEquals(coordinate, value)) {
69
+ coordinate = value.slice();
70
+ changed.raiseEvent();
71
+ }
72
+ },
73
+ get heading(): number {
74
+ return heading;
75
+ },
76
+ set heading(value: number) {
77
+ check(value, Number);
78
+ if (heading !== value) {
79
+ heading = value;
80
+ changed.raiseEvent();
81
+ }
82
+ },
83
+ get pitch(): number {
84
+ return pitch;
85
+ },
86
+ set pitch(value: number) {
87
+ check(value, Number);
88
+ if (pitch !== value) {
89
+ pitch = value;
90
+ changed.raiseEvent();
91
+ }
92
+ },
93
+ get roll(): number {
94
+ return roll;
95
+ },
96
+ set roll(value: number) {
97
+ check(value, Number);
98
+ if (roll !== value) {
99
+ roll = value;
100
+ changed.raiseEvent();
101
+ }
102
+ },
103
+ get duration(): number {
104
+ return duration;
105
+ },
106
+ set duration(value: number) {
107
+ check(value, Number);
108
+ if (duration !== value) {
109
+ duration = value;
110
+ changed.raiseEvent();
111
+ }
112
+ },
113
+ get title(): string | undefined {
114
+ return title;
115
+ },
116
+ set title(value: string | undefined) {
117
+ check(value, maybe(String));
118
+
119
+ if (title !== value) {
120
+ title = value;
121
+ changed.raiseEvent();
122
+ }
123
+ },
124
+ destroy(): void {
125
+ changed.destroy();
126
+ },
127
+ };
128
+ }
129
+
130
+ export function anchorFromViewpoint(
131
+ viewpoint: Viewpoint,
132
+ ): FlightAnchor | undefined {
133
+ if (!viewpoint.cameraPosition) {
134
+ return undefined;
135
+ }
136
+
137
+ return fromOptions({
138
+ ...viewpoint,
139
+ coordinate: viewpoint.cameraPosition,
140
+ duration: viewpoint.duration ?? 1,
141
+ title: viewpoint.properties.title as string | undefined,
142
+ });
143
+ }
144
+
145
+ export function anchorFromGeojsonFeature(
146
+ feature: FlightAnchorGeojsonFeature,
147
+ ): FlightAnchor | undefined {
148
+ const options = {
149
+ ...feature.properties,
150
+ name: String(feature.id) || uuidv4(),
151
+ coordinate: feature.geometry.coordinates,
152
+ };
153
+ if (isOptions(options)) {
154
+ return fromOptions(options);
155
+ }
156
+ return undefined;
157
+ }
158
+
159
+ export function anchorToViewpoint(anchor: FlightAnchor): Viewpoint {
160
+ return new Viewpoint({
161
+ name: anchor.name,
162
+ cameraPosition: anchor.coordinate.slice(),
163
+ heading: anchor.heading,
164
+ pitch: anchor.pitch,
165
+ roll: anchor.roll,
166
+ duration: anchor.duration,
167
+ properties: {
168
+ title: anchor.title,
169
+ },
170
+ });
171
+ }
172
+
173
+ export function anchorToGeojsonFeature(
174
+ anchor: FlightAnchor,
175
+ ): FlightAnchorGeojsonFeature {
176
+ const properties: FlightAnchorFeatureProperties = {
177
+ heading: anchor.heading,
178
+ pitch: anchor.pitch,
179
+ roll: anchor.roll,
180
+ duration: anchor.duration,
181
+ };
182
+ if (anchor.title) {
183
+ properties.title = anchor.title;
184
+ }
185
+
186
+ return {
187
+ type: 'Feature',
188
+ id: anchor.name,
189
+ geometry: {
190
+ type: 'Point',
191
+ coordinates: anchor.coordinate.slice(),
192
+ },
193
+ properties,
194
+ };
195
+ }
@@ -0,0 +1,78 @@
1
+ import Collection from '../collection.js';
2
+ import { createFlightPlayer, FlightPlayer } from './flightPlayer.js';
3
+ import VcsEvent from '../../vcsEvent.js';
4
+ import FlightInstance from './flightInstance.js';
5
+ import type VcsApp from '../../vcsApp.js';
6
+
7
+ /**
8
+ * A collection of flights. Provides playFlight API, which returns a FlightPlayer.
9
+ * Emits playerChanged event, whenever another flight is played.
10
+ */
11
+ class FlightCollection extends Collection<FlightInstance> {
12
+ private readonly _app: VcsApp;
13
+
14
+ private _player: FlightPlayer | undefined;
15
+
16
+ playerChanged: VcsEvent<FlightPlayer | undefined>;
17
+
18
+ private _playerDestroyedListener: () => void;
19
+
20
+ constructor(app: VcsApp) {
21
+ super();
22
+
23
+ this._app = app;
24
+ this._player = undefined;
25
+ this.playerChanged = new VcsEvent<FlightPlayer | undefined>();
26
+ this._playerDestroyedListener = (): void => {};
27
+ }
28
+
29
+ get player(): FlightPlayer | undefined {
30
+ return this._player;
31
+ }
32
+
33
+ remove(item: FlightInstance): void {
34
+ if (this._player?.flightInstanceName === item.name) {
35
+ this._player.stop();
36
+ this._player.destroy();
37
+ }
38
+ super.remove(item);
39
+ }
40
+
41
+ /**
42
+ * Creates a FlightPlayer for a flight instance, if not already existing for provided instance
43
+ * @param flight
44
+ */
45
+ async setPlayerForFlight(
46
+ flight: FlightInstance,
47
+ ): Promise<FlightPlayer | undefined> {
48
+ if (this._player?.flightInstanceName === flight.name) {
49
+ return this._player;
50
+ } else if (this._player) {
51
+ this._playerDestroyedListener();
52
+ this._player.stop();
53
+ this._player.destroy();
54
+ }
55
+ this._player = await createFlightPlayer(flight, this._app);
56
+ this.playerChanged.raiseEvent(this._player);
57
+ this._playerDestroyedListener = this._player.destroyed.addEventListener(
58
+ () => {
59
+ this._player = undefined;
60
+ this.playerChanged.raiseEvent(undefined);
61
+ },
62
+ );
63
+ return this._player;
64
+ }
65
+
66
+ destroy(): void {
67
+ if (this._player) {
68
+ this._player.stop();
69
+ this._player.destroy();
70
+ this._player = undefined;
71
+ }
72
+ this.playerChanged.destroy();
73
+ this._playerDestroyedListener();
74
+ super.destroy();
75
+ }
76
+ }
77
+
78
+ export default FlightCollection;
@@ -0,0 +1,208 @@
1
+ import {
2
+ HeadingPitchRoll,
3
+ Cartesian3,
4
+ Quaternion,
5
+ CatmullRomSpline,
6
+ LinearSpline,
7
+ QuaternionSpline,
8
+ Cartographic,
9
+ Math as CesiumMath,
10
+ } from '@vcmap-cesium/engine';
11
+ import type {
12
+ FeatureCollection,
13
+ Point as GeojsonPoint,
14
+ LineString as GeojsonLineString,
15
+ } from 'geojson';
16
+ import type { Coordinate } from 'ol/coordinate.js';
17
+ import type {
18
+ // eslint-disable-next-line import/no-named-default
19
+ default as FlightInstance,
20
+ FlightInstanceMeta,
21
+ FlightInstanceOptions,
22
+ } from './flightInstance.js';
23
+ import { vcsMetaVersion } from '../../layer/vectorProperties.js';
24
+ import { FlightAnchorGeojsonFeature } from './flightAnchor.js';
25
+
26
+ /**
27
+ * exports a flight as GeoJson FeatureCollection
28
+ * {Object} vcsMeta.flightOptions: flight settings
29
+ * {Array} feature: viewpoints
30
+ *
31
+ * @param flightInstance
32
+ */
33
+ export function exportFlightAsGeoJson(
34
+ flightInstance: FlightInstance,
35
+ ): FeatureCollection<GeojsonPoint> {
36
+ const options = flightInstance.toJSON();
37
+ const flightOptions: FlightInstanceMeta = {};
38
+ if (options.loop != null) {
39
+ flightOptions.loop = options.loop;
40
+ }
41
+ if (options.interpolation != null) {
42
+ flightOptions.interpolation = options.interpolation;
43
+ }
44
+ if (options.multiplier != null) {
45
+ flightOptions.multiplier = options.multiplier;
46
+ }
47
+
48
+ return {
49
+ type: 'FeatureCollection',
50
+ features: options.anchors ?? [],
51
+ vcsMeta: {
52
+ version: vcsMetaVersion,
53
+ flightOptions: options,
54
+ },
55
+ };
56
+ }
57
+
58
+ export function getSplineAndTimesForInstance(flightInstance: FlightInstance): {
59
+ destinationSpline: CatmullRomSpline | LinearSpline;
60
+ quaternionSpline: QuaternionSpline;
61
+ times: number[];
62
+ } {
63
+ const { loop, anchors } = flightInstance;
64
+ const anchorsArray = [...anchors];
65
+ const length = loop ? anchors.size + 1 : anchors.size;
66
+ const points = new Array(length) as Cartesian3[];
67
+ const quaternions = new Array(length) as Quaternion[];
68
+ const times = new Array(length) as number[];
69
+
70
+ anchorsArray.forEach((anchor, index) => {
71
+ points[index] = Cartesian3.fromDegrees(
72
+ anchor.coordinate[0],
73
+ anchor.coordinate[1],
74
+ anchor.coordinate[2],
75
+ );
76
+ quaternions[index] = Quaternion.fromHeadingPitchRoll(
77
+ HeadingPitchRoll.fromDegrees(anchor.heading, anchor.pitch, anchor.roll),
78
+ );
79
+
80
+ if (index > 0) {
81
+ let previousDuration = anchorsArray[index - 1].duration;
82
+ if (!previousDuration) {
83
+ previousDuration =
84
+ Cartesian3.distance(points[index - 1], points[index]) / 300 || 1;
85
+ }
86
+ times[index] = times[index - 1] + previousDuration;
87
+ } else {
88
+ times[index] = 0;
89
+ }
90
+ });
91
+
92
+ if (loop) {
93
+ points[length - 1] = Cartesian3.fromDegrees(
94
+ anchorsArray[0].coordinate[0],
95
+ anchorsArray[0].coordinate[1],
96
+ anchorsArray[0].coordinate[2],
97
+ );
98
+ quaternions[length - 1] = Quaternion.fromHeadingPitchRoll(
99
+ HeadingPitchRoll.fromDegrees(
100
+ anchorsArray[0].heading,
101
+ anchorsArray[0].pitch,
102
+ anchorsArray[0].roll,
103
+ ),
104
+ );
105
+
106
+ let loopDuration = anchorsArray[length - 2].duration;
107
+ if (!loopDuration) {
108
+ loopDuration =
109
+ Cartesian3.distance(points[length - 2], points[length - 1]) / 300 || 1;
110
+ }
111
+ times[length - 1] = times[length - 2] + loopDuration;
112
+ }
113
+
114
+ const destinationSpline =
115
+ flightInstance.interpolation === 'spline'
116
+ ? new CatmullRomSpline({ times, points })
117
+ : new LinearSpline({ times, points });
118
+ const quaternionSpline = new QuaternionSpline({ times, points: quaternions });
119
+
120
+ return {
121
+ destinationSpline,
122
+ quaternionSpline,
123
+ times,
124
+ };
125
+ }
126
+
127
+ export function getFlightPathCoordinatesFromInstance(
128
+ flightInstance: FlightInstance,
129
+ ): Coordinate[] {
130
+ const pathCoordinates: Coordinate[] = [];
131
+
132
+ if (flightInstance.interpolation === 'spline') {
133
+ const { destinationSpline, times } =
134
+ getSplineAndTimesForInstance(flightInstance);
135
+ const scratchCartographic = new Cartographic();
136
+ const addCoordinateFromTime = (time: number): void => {
137
+ Cartographic.fromCartesian(
138
+ destinationSpline.evaluate(time) as Cartesian3,
139
+ undefined,
140
+ scratchCartographic,
141
+ );
142
+ pathCoordinates.push([
143
+ CesiumMath.toDegrees(scratchCartographic.longitude),
144
+ CesiumMath.toDegrees(scratchCartographic.latitude),
145
+ scratchCartographic.height,
146
+ ]);
147
+ };
148
+ const endTime = times[times.length - 1];
149
+ const step = endTime / 0.2 > 500 ? endTime / 500 : 0.2;
150
+ for (let i = 0; i < endTime; i += step) {
151
+ addCoordinateFromTime(i);
152
+ }
153
+ addCoordinateFromTime(endTime);
154
+ } else {
155
+ for (const anchor of flightInstance.anchors) {
156
+ pathCoordinates.push(anchor.coordinate);
157
+ }
158
+
159
+ if (flightInstance.loop) {
160
+ pathCoordinates.push(pathCoordinates[0]);
161
+ }
162
+ }
163
+
164
+ return pathCoordinates;
165
+ }
166
+
167
+ export function exportFlightPathAsGeoJson(
168
+ flightInstance: FlightInstance,
169
+ ): FeatureCollection<GeojsonLineString> {
170
+ const coordinates = getFlightPathCoordinatesFromInstance(flightInstance);
171
+
172
+ return {
173
+ type: 'FeatureCollection',
174
+ features: [
175
+ {
176
+ type: 'Feature',
177
+ geometry: {
178
+ type: 'LineString',
179
+ coordinates,
180
+ },
181
+ properties: {},
182
+ },
183
+ ],
184
+ };
185
+ }
186
+
187
+ /**
188
+ * parses source and creates a flight Object
189
+ * @param {Object} collection GeoJSON
190
+ * containing:
191
+ * {Object} vcsMeta containing flightOptions
192
+ * {Array} features anchors of flightInstance
193
+ * @returns
194
+ */
195
+ export function parseFlightOptionsFromGeoJson(
196
+ collection: FeatureCollection<
197
+ GeojsonPoint,
198
+ FlightAnchorGeojsonFeature['properties']
199
+ >,
200
+ ): FlightInstanceOptions {
201
+ const flightOptions: Partial<FlightInstanceOptions> =
202
+ collection.vcsMeta && collection.vcsMeta.flightOptions
203
+ ? collection.vcsMeta.flightOptions
204
+ : {};
205
+
206
+ flightOptions.anchors = collection.features;
207
+ return flightOptions;
208
+ }