@vcmap/core 5.0.0-rc.3 → 5.0.0-rc.30

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 (236) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +12 -5
  3. package/build/postinstall.js +14 -3
  4. package/index.d.ts +3477 -2007
  5. package/index.js +169 -131
  6. package/package.json +25 -27
  7. package/src/category/category.js +483 -0
  8. package/src/category/categoryCollection.js +153 -0
  9. package/src/cesium/cesium3DTileFeature.js +2 -2
  10. package/src/cesium/cesium3DTilePointFeature.js +1 -1
  11. package/src/cesium/cesiumVcsCameraPrimitive.js +16 -8
  12. package/src/cesium/entity.js +29 -0
  13. package/src/cesium/wallpaperMaterial.js +5 -3
  14. package/src/classRegistry.js +169 -0
  15. package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +49 -46
  16. package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +13 -5
  17. package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +56 -26
  18. package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +33 -21
  19. package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +40 -21
  20. package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +131 -26
  21. package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +108 -53
  22. package/src/interaction/featureProviderInteraction.js +58 -0
  23. package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +40 -41
  24. package/src/{vcs/vcm/interaction → interaction}/interactionType.js +24 -31
  25. package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +67 -55
  26. package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +33 -8
  27. package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +24 -13
  28. package/src/layer/cesium/openStreetMapCesiumImpl.js +32 -0
  29. package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +12 -9
  30. package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +19 -9
  31. package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +6 -6
  32. package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +21 -10
  33. package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +93 -35
  34. package/src/layer/cesium/vectorContext.js +363 -0
  35. package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +21 -13
  36. package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +58 -21
  37. package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +20 -9
  38. package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +24 -13
  39. package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +6 -3
  40. package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +71 -108
  41. package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +23 -20
  42. package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +55 -90
  43. package/src/{vcs/vcm/layer → layer}/featureLayer.js +89 -74
  44. package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +197 -150
  45. package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +150 -92
  46. package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
  47. package/src/{vcs/vcm/layer → layer}/featureVisibility.js +114 -82
  48. package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +84 -69
  49. package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +30 -27
  50. package/src/{vcs/vcm/layer → layer}/globalHider.js +25 -39
  51. package/src/{vcs/vcm/layer → layer}/layer.js +171 -96
  52. package/src/{vcs/vcm/layer → layer}/layerImplementation.js +13 -6
  53. package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
  54. package/src/{vcs/vcm/layer → layer}/layerSymbols.js +2 -1
  55. package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +7 -5
  56. package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +76 -31
  57. package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +198 -80
  58. package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +59 -40
  59. package/src/layer/openlayers/layerOpenlayersImpl.js +165 -0
  60. package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +28 -0
  61. package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +44 -0
  62. package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +8 -7
  63. package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +7 -6
  64. package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +12 -10
  65. package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +21 -12
  66. package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +18 -12
  67. package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +9 -8
  68. package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +19 -12
  69. package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +42 -39
  70. package/src/{vcs/vcm/layer → layer}/rasterLayer.js +86 -37
  71. package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +25 -22
  72. package/src/layer/terrainHelpers.js +98 -0
  73. package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +26 -18
  74. package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +13 -8
  75. package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +51 -8
  76. package/src/layer/tileProvider/staticGeojsonTileProvider.js +87 -0
  77. package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +200 -89
  78. package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +54 -13
  79. package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +22 -22
  80. package/src/layer/vectorHelpers.js +129 -0
  81. package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +124 -94
  82. package/src/{vcs/vcm/layer → layer}/vectorProperties.js +419 -107
  83. package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +11 -1
  84. package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +181 -116
  85. package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +33 -23
  86. package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +14 -7
  87. package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +53 -32
  88. package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +56 -42
  89. package/src/{vcs/vcm/maps → map}/baseOLMap.js +83 -35
  90. package/src/{vcs/vcm/maps → map}/cameraLimiter.js +75 -32
  91. package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +429 -276
  92. package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
  93. package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +132 -97
  94. package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +69 -45
  95. package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +118 -46
  96. package/src/oblique/defaultObliqueCollection.js +62 -0
  97. package/src/{vcs/vcm/oblique → oblique}/helpers.js +221 -78
  98. package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +145 -54
  99. package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +62 -32
  100. package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +58 -26
  101. package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +9 -9
  102. package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +85 -35
  103. package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +45 -5
  104. package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +3 -5
  105. package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +62 -28
  106. package/src/ol/feature.js +34 -1
  107. package/src/ol/geom/circle.js +14 -5
  108. package/src/ol/geom/geometryCollection.js +14 -8
  109. package/src/ol/render/canvas/canvasTileRenderer.js +11 -10
  110. package/src/overrideClassRegistry.js +214 -0
  111. package/src/style/arcStyle.js +453 -0
  112. package/src/style/arrowStyle.js +304 -0
  113. package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +147 -82
  114. package/src/{vcs/vcm/util/style → style}/shapesCategory.js +8 -8
  115. package/src/style/styleFactory.js +32 -0
  116. package/src/{vcs/vcm/util/style → style}/styleHelpers.js +24 -26
  117. package/src/style/styleItem.js +174 -0
  118. package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +230 -156
  119. package/src/{vcs/vcm/util/style → style}/writeStyle.js +7 -12
  120. package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +84 -52
  121. package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +56 -23
  122. package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +149 -88
  123. package/src/{vcs/vcm/util → util}/collection.js +28 -10
  124. package/src/util/editor/createFeatureSession.js +195 -0
  125. package/src/util/editor/editFeaturesSession.js +325 -0
  126. package/src/util/editor/editGeometrySession.js +452 -0
  127. package/src/util/editor/editorHelpers.js +300 -0
  128. package/src/util/editor/editorSessionHelpers.js +132 -0
  129. package/src/util/editor/editorSymbols.js +21 -0
  130. package/src/util/editor/interactions/createBBoxInteraction.js +154 -0
  131. package/src/util/editor/interactions/createCircleInteraction.js +119 -0
  132. package/src/util/editor/interactions/createLineStringInteraction.js +119 -0
  133. package/src/util/editor/interactions/createPointInteraction.js +73 -0
  134. package/src/util/editor/interactions/createPolygonInteraction.js +136 -0
  135. package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +88 -0
  136. package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +119 -0
  137. package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +50 -0
  138. package/src/util/editor/interactions/insertVertexInteraction.js +103 -0
  139. package/src/util/editor/interactions/mapInteractionController.js +119 -0
  140. package/src/util/editor/interactions/removeVertexInteraction.js +42 -0
  141. package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +152 -0
  142. package/src/util/editor/interactions/selectMultiFeatureInteraction.js +165 -0
  143. package/src/util/editor/interactions/selectSingleFeatureInteraction.js +120 -0
  144. package/src/util/editor/interactions/translateVertexInteraction.js +60 -0
  145. package/src/util/editor/selectFeaturesSession.js +303 -0
  146. package/src/util/editor/transformation/create2DHandlers.js +339 -0
  147. package/src/util/editor/transformation/create3DHandlers.js +678 -0
  148. package/src/util/editor/transformation/extrudeInteraction.js +106 -0
  149. package/src/util/editor/transformation/rotateInteraction.js +201 -0
  150. package/src/util/editor/transformation/scaleInteraction.js +201 -0
  151. package/src/util/editor/transformation/transformationHandler.js +178 -0
  152. package/src/util/editor/transformation/transformationTypes.js +88 -0
  153. package/src/util/editor/transformation/translateInteraction.js +263 -0
  154. package/src/util/editor/validateGeoemetry.js +24 -0
  155. package/src/{vcs/vcm/util → util}/exclusiveManager.js +6 -3
  156. package/src/{vcs/vcm/util → util}/extent.js +26 -20
  157. package/src/util/featureconverter/arcToCesium.js +121 -0
  158. package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +70 -37
  159. package/src/{vcs/vcm/util → util}/featureconverter/convert.js +94 -16
  160. package/src/util/featureconverter/extent3D.js +284 -0
  161. package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +253 -94
  162. package/src/util/featureconverter/lineStringToCesium.js +343 -0
  163. package/src/util/featureconverter/pointHelpers.js +413 -0
  164. package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +157 -107
  165. package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +57 -24
  166. package/src/util/fetch.js +34 -0
  167. package/src/{vcs/vcm/util → util}/geometryHelpers.js +25 -17
  168. package/src/{vcs/vcm/util → util}/indexedCollection.js +27 -8
  169. package/src/{vcs/vcm/util → util}/isMobile.js +8 -2
  170. package/src/{vcs/vcm/util → util}/layerCollection.js +109 -19
  171. package/src/util/locale.js +12 -0
  172. package/src/{vcs/vcm/util → util}/mapCollection.js +170 -63
  173. package/src/util/math.js +193 -0
  174. package/src/util/overrideCollection.js +261 -0
  175. package/src/{vcs/vcm/util → util}/projection.js +23 -31
  176. package/src/{vcs/vcm/util → util}/urlHelpers.js +5 -3
  177. package/src/{vcs/vcm/util → util}/viewpoint.js +83 -57
  178. package/src/vcsApp.js +657 -0
  179. package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -3
  180. package/src/vcsModule.js +130 -0
  181. package/src/vcsModuleHelpers.js +136 -0
  182. package/src/{vcs/vcm/object.js → vcsObject.js} +3 -10
  183. package/tests/data/dynamicPointCzml.json +53 -0
  184. package/tests/data/oblique/imageData/imagev34.json +136 -0
  185. package/tests/data/oblique/imageData/imagev35.json +307 -0
  186. package/tests/data/oblique/imageData/imagev35PerImageSize.json +333 -0
  187. package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -0
  188. package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -0
  189. package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -0
  190. package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -0
  191. package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -0
  192. package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -0
  193. package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -0
  194. package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -0
  195. package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -0
  196. package/tests/data/oblique/tiledImageData/image.json +70 -0
  197. package/tests/data/terrain/13/8800/6485.terrain +0 -0
  198. package/tests/data/terrain/13/8800/6486.terrain +0 -0
  199. package/tests/data/terrain/13/8801/6485.terrain +0 -0
  200. package/tests/data/terrain/13/8801/6486.terrain +0 -0
  201. package/tests/data/terrain/layer.json +127 -0
  202. package/tests/data/testGeoJSON.json +149 -0
  203. package/tests/data/tile.pbf +0 -0
  204. package/tests/unit/helpers/cesiumHelpers.js +326 -0
  205. package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
  206. package/tests/unit/helpers/helpers.js +32 -0
  207. package/tests/unit/helpers/imageHelpers.js +24 -0
  208. package/tests/unit/helpers/importJSON.js +15 -0
  209. package/tests/unit/helpers/obliqueData.js +102 -0
  210. package/tests/unit/helpers/obliqueHelpers.js +115 -0
  211. package/tests/unit/helpers/openlayersHelpers.js +25 -0
  212. package/tests/unit/helpers/terrain/terrainData.js +47 -0
  213. package/src/vcs/vcm/classRegistry.js +0 -106
  214. package/src/vcs/vcm/globalCollections.js +0 -11
  215. package/src/vcs/vcm/interaction/featureProviderInteraction.js +0 -54
  216. package/src/vcs/vcm/layer/buildings.js +0 -17
  217. package/src/vcs/vcm/layer/cesium/openStreetMapCesium.js +0 -29
  218. package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
  219. package/src/vcs/vcm/layer/cesium/vectorContext.js +0 -167
  220. package/src/vcs/vcm/layer/openlayers/layerOpenlayers.js +0 -79
  221. package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
  222. package/src/vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js +0 -121
  223. package/src/vcs/vcm/layer/terrainHelpers.js +0 -119
  224. package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
  225. package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
  226. package/src/vcs/vcm/layer/vectorHelpers.js +0 -206
  227. package/src/vcs/vcm/util/dateTime.js +0 -60
  228. package/src/vcs/vcm/util/featureProvider/featureProviderHelpers.js +0 -51
  229. package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
  230. package/src/vcs/vcm/util/featureconverter/lineStringToCesium.js +0 -171
  231. package/src/vcs/vcm/util/locale.js +0 -53
  232. package/src/vcs/vcm/util/math.js +0 -71
  233. package/src/vcs/vcm/util/splitScreen.js +0 -233
  234. package/src/vcs/vcm/util/style/styleFactory.js +0 -48
  235. package/src/vcs/vcm/util/style/styleItem.js +0 -243
  236. /package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
@@ -1,4 +1,4 @@
1
- import { Cartesian3, Cartesian4, Matrix3, Matrix4 } from '@vcmap/cesium';
1
+ import { Cartesian3, Cartesian4, Matrix3, Matrix4 } from '@vcmap-cesium/engine';
2
2
  import { transformCWIFC } from './helpers.js';
3
3
  import { getHeightFromTerrainProvider } from '../layer/terrainHelpers.js';
4
4
 
@@ -10,17 +10,16 @@ import { getHeightFromTerrainProvider } from '../layer/terrainHelpers.js';
10
10
  * @property {!Array<import("ol/coordinate").Coordinate>} groundCoordinates
11
11
  * @property {!import("ol/coordinate").Coordinate} centerPointOnGround
12
12
  * @property {!import("@vcmap/core").ObliqueImageMeta} meta
13
- * @property {import("@vcmap/cesium").Cartesian3|undefined} projectionCenter
14
- * @property {import("@vcmap/cesium").Matrix3|undefined} pToRealworld
15
- * @property {import("@vcmap/cesium").Matrix4|undefined} pToImage
13
+ * @property {import("@vcmap-cesium/engine").Cartesian3|undefined} projectionCenter
14
+ * @property {import("@vcmap-cesium/engine").Matrix3|undefined} pToRealworld
15
+ * @property {import("@vcmap-cesium/engine").Matrix4|undefined} pToImage
16
16
  * @property {import("@vcmap/core").Projection|undefined} [projection]
17
- * @property {import("@vcmap/cesium").CesiumTerrainProvider|undefined} terrainProvider
17
+ * @property {import("@vcmap-cesium/engine").CesiumTerrainProvider|undefined} terrainProvider
18
18
  * @api
19
19
  */
20
20
 
21
21
  /**
22
22
  * @class
23
- * @export
24
23
  */
25
24
  class ObliqueImage {
26
25
  /**
@@ -71,20 +70,20 @@ class ObliqueImage {
71
70
 
72
71
  /**
73
72
  * The transformation matrix image to real world (in image world projection).
74
- * @type {import("@vcmap/cesium").Matrix3}
73
+ * @type {import("@vcmap-cesium/engine").Matrix3}
75
74
  * @api
76
75
  */
77
76
  this.pToRealworld = options.pToRealworld || null;
78
77
 
79
78
  /**
80
79
  * The transformation matrix real to image (in image world projection).
81
- * @type {import("@vcmap/cesium").Matrix4}
80
+ * @type {import("@vcmap-cesium/engine").Matrix4}
82
81
  */
83
82
  this.pToImage = options.pToImage || null;
84
83
 
85
84
  /**
86
85
  * The projection center in image world projection
87
- * @type {import("@vcmap/cesium").Cartesian3}
86
+ * @type {import("@vcmap-cesium/engine").Cartesian3}
88
87
  * @api
89
88
  */
90
89
  this.projectionCenter = options.projectionCenter || null;
@@ -128,16 +127,34 @@ class ObliqueImage {
128
127
  if (!this.meta.principalPoint) {
129
128
  return this._transformNoCamera(distortedCoordinate, true, optAvgHeight);
130
129
  } else if (this.meta.hasRadial) {
131
- distortedCoordinate = this.meta.radialDistortionCoordinate(distortedCoordinate, true);
130
+ distortedCoordinate = this.meta.radialDistortionCoordinate(
131
+ distortedCoordinate,
132
+ true,
133
+ );
132
134
  }
133
135
 
134
- const x = new Cartesian3(distortedCoordinate[0], this.meta.size[1] - distortedCoordinate[1], 1);
135
- const rayWorld = Matrix3.multiplyByVector(this.pToRealworld, x, new Cartesian3());
136
+ const x = new Cartesian3(
137
+ distortedCoordinate[0],
138
+ this.meta.size[1] - distortedCoordinate[1],
139
+ 1,
140
+ );
141
+ const rayWorld = Matrix3.multiplyByVector(
142
+ this.pToRealworld,
143
+ x,
144
+ new Cartesian3(),
145
+ );
136
146
  const avgHeight = optAvgHeight || this.averageHeight;
137
- const centerPointOnGround =
138
- new Cartesian3(this.centerPointOnGround[0], this.centerPointOnGround[1], avgHeight);
139
- const w0 = Cartesian3.subtract(this.projectionCenter, centerPointOnGround, new Cartesian3());
140
- const a = Cartesian3.dot(Cartesian3.UNIT_Z, w0) * (-1);
147
+ const centerPointOnGround = new Cartesian3(
148
+ this.centerPointOnGround[0],
149
+ this.centerPointOnGround[1],
150
+ avgHeight,
151
+ );
152
+ const w0 = Cartesian3.subtract(
153
+ this.projectionCenter,
154
+ centerPointOnGround,
155
+ new Cartesian3(),
156
+ );
157
+ const a = Cartesian3.dot(Cartesian3.UNIT_Z, w0) * -1;
141
158
  const b = Cartesian3.dot(Cartesian3.UNIT_Z, rayWorld);
142
159
 
143
160
  const r = a / b;
@@ -166,17 +183,24 @@ class ObliqueImage {
166
183
  // the averaged height is used for projection so far
167
184
  const avgHeight = optAvgHeight || this.averageHeight;
168
185
 
169
- const P = new Cartesian4(worldCoordinate[0], worldCoordinate[1], avgHeight, 1);
186
+ const P = new Cartesian4(
187
+ worldCoordinate[0],
188
+ worldCoordinate[1],
189
+ avgHeight,
190
+ 1,
191
+ );
170
192
 
171
193
  const camSys = Matrix4.multiplyByVector(this.pToImage, P, new Cartesian4());
172
194
  const respectiveImageCoords = [camSys.x / camSys.z, camSys.y / camSys.z];
173
195
  // adjust to ol image coordinates
174
- const imCoords = [respectiveImageCoords[0], this.meta.size[1] - respectiveImageCoords[1]];
196
+ const imCoords = [
197
+ respectiveImageCoords[0],
198
+ this.meta.size[1] - respectiveImageCoords[1],
199
+ ];
175
200
 
176
201
  return this.meta.radialDistortionCoordinate(imCoords, false);
177
202
  }
178
203
 
179
-
180
204
  /**
181
205
  * @param {import("ol/coordinate").Coordinate} coord
182
206
  * @param {boolean} isImage
@@ -185,7 +209,12 @@ class ObliqueImage {
185
209
  * @returns {import("ol/coordinate").Coordinate}
186
210
  */
187
211
  _transformNoCamera(coord, isImage, optAvgHeight) {
188
- const imageCoords = [[0, 0], [this.meta.size[0], 0], this.meta.size, [0, this.meta.size[1]]];
212
+ const imageCoords = [
213
+ [0, 0],
214
+ [this.meta.size[0], 0],
215
+ this.meta.size,
216
+ [0, this.meta.size[1]],
217
+ ];
189
218
  const intrCross = transformCWIFC(
190
219
  isImage ? imageCoords : this.groundCoordinates,
191
220
  isImage ? this.groundCoordinates : imageCoords,
@@ -197,7 +226,9 @@ class ObliqueImage {
197
226
  // if intersection could not be determined write error and return center
198
227
  if (intrCross === null || intrCross.x == null || intrCross.y == null) {
199
228
  // eslint-disable-next-line no-console
200
- console.error('Real world coordinate could not be determined from footprint data, center will be returned');
229
+ console.error(
230
+ 'Real world coordinate could not be determined from footprint data, center will be returned',
231
+ );
201
232
  const coords = [this.centerPointOnGround[0], this.centerPointOnGround[1]];
202
233
  if (isImage) {
203
234
  coords.push(height);
@@ -218,11 +249,12 @@ class ObliqueImage {
218
249
  */
219
250
  calculateImageAverageHeight() {
220
251
  if (this._averageHeight === null) {
221
- const averageHeight = (
222
- this.groundCoordinates[0][2] +
223
- this.groundCoordinates[1][2] +
224
- this.groundCoordinates[2][2] +
225
- this.groundCoordinates[3][2]) / 4;
252
+ const averageHeight =
253
+ (this.groundCoordinates[0][2] +
254
+ this.groundCoordinates[1][2] +
255
+ this.groundCoordinates[2][2] +
256
+ this.groundCoordinates[3][2]) /
257
+ 4;
226
258
  if (averageHeight === 0 && this.meta.terrainProvider) {
227
259
  return getHeightFromTerrainProvider(
228
260
  this.meta.terrainProvider,
@@ -11,16 +11,14 @@ import { cartesian2DDistance } from '../util/math.js';
11
11
  * @property {Array<number>} tileResolution
12
12
  * @property {import("@vcmap/core").Projection} projection
13
13
  * @property {string} url
14
- * @property {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
14
+ * @property {import("@vcmap-cesium/engine").CesiumTerrainProvider} [terrainProvider]
15
15
  * @property {string} name
16
16
  * @property {string|undefined} [format='jpg']
17
17
  * @api
18
18
  */
19
19
 
20
-
21
20
  /**
22
21
  * @class
23
- * @export
24
22
  */
25
23
  class ObliqueImageMeta {
26
24
  /**
@@ -43,7 +41,7 @@ class ObliqueImageMeta {
43
41
  /** @type {Array<number>|undefined} */
44
42
  this.radialF2E = options['radial-distorsion-found-2-expected'];
45
43
  /** @type {boolean} */
46
- this.hasRadial = !!(this.pixelSize && (this.radialE2F && this.radialF2E));
44
+ this.hasRadial = !!(this.pixelSize && this.radialE2F && this.radialF2E);
47
45
  /**
48
46
  * The size of the images associated with this meta data
49
47
  * @type {import("ol/size").Size}
@@ -75,7 +73,7 @@ class ObliqueImageMeta {
75
73
  this.url = options.url;
76
74
  /**
77
75
  * An optional terrain provider
78
- * @type {import("@vcmap/cesium").CesiumTerrainProvider}
76
+ * @type {import("@vcmap-cesium/engine").CesiumTerrainProvider|undefined}
79
77
  * @api
80
78
  */
81
79
  this.terrainProvider = options.terrainProvider;
@@ -97,7 +95,9 @@ class ObliqueImageMeta {
97
95
  if (this.hasRadial && this.principalPoint) {
98
96
  const coefficientsArray = useF2E ? this.radialF2E : this.radialE2F;
99
97
 
100
- const distC2PPInMM = cartesian2DDistance(this.principalPoint, coordinate) * this.pixelSize[0];
98
+ const distC2PPInMM =
99
+ cartesian2DDistance(this.principalPoint, coordinate) *
100
+ this.pixelSize[0];
101
101
  if (distC2PPInMM === 0) {
102
102
  return coordinate.slice();
103
103
  }
@@ -107,15 +107,15 @@ class ObliqueImageMeta {
107
107
  // get shift value
108
108
  let shift = 0;
109
109
  for (let i = 0; i < coefficientsArray.length; ++i) {
110
- shift += coefficientsArray[i] * (distC2PPInMM ** i);
110
+ shift += coefficientsArray[i] * distC2PPInMM ** i;
111
111
  }
112
112
 
113
113
  // get new position through spherical coordinates system - http://mathworld.wolfram.com/SphericalCoordinates.html
114
114
  const newDistInPixel = (distC2PPInMM + shift) / this.pixelSize[0];
115
115
  const angleTheta = Math.atan2(diffY, diffX);
116
116
  return [
117
- this.principalPoint[0] + (newDistInPixel * Math.cos(angleTheta)),
118
- this.principalPoint[1] + (newDistInPixel * Math.sin(angleTheta)),
117
+ this.principalPoint[0] + newDistInPixel * Math.cos(angleTheta),
118
+ this.principalPoint[1] + newDistInPixel * Math.sin(angleTheta),
119
119
  ];
120
120
  }
121
121
 
@@ -1,15 +1,16 @@
1
1
  import { getTransform } from 'ol/proj.js';
2
2
  import View from 'ol/View.js';
3
3
  import { unByKey } from 'ol/Observable.js';
4
- import { DataState } from './ObliqueDataSet.js';
5
- import OLView from './ObliqueView.js';
4
+ import { DataState } from './obliqueDataSet.js';
5
+ import OLView from './obliqueView.js';
6
6
  import { transformFromImage } from './helpers.js';
7
7
  import { getHeightFromTerrainProvider } from '../layer/terrainHelpers.js';
8
8
  import { mercatorProjection } from '../util/projection.js';
9
- import VcsEvent from '../event/vcsEvent.js';
9
+ import VcsEvent from '../vcsEvent.js';
10
+ import { isDefaultImageSymbol } from './defaultObliqueCollection.js';
10
11
 
11
12
  /**
12
- * @typedef {Object} ObliqueViewPoint
13
+ * @typedef {Object} ObliqueViewpoint
13
14
  * @property {import("ol/coordinate").Coordinate} center - in mercator
14
15
  * @property {number} zoom
15
16
  * @property {import("@vcmap/core").ObliqueViewDirection} direction
@@ -34,7 +35,6 @@ function withinBounds(number, max) {
34
35
 
35
36
  /**
36
37
  * @class
37
- * @export
38
38
  */
39
39
  class ObliqueProvider {
40
40
  /**
@@ -102,8 +102,11 @@ class ObliqueProvider {
102
102
  if (this._postRenderListener) {
103
103
  unByKey(this._postRenderListener);
104
104
  }
105
- // @ts-ignore
106
- this._postRenderListener = this._olMap.on(this._mapChangeEvent, this._postRenderHandler.bind(this));
105
+ this._postRenderListener = this._olMap.on(
106
+ // @ts-ignore
107
+ this._mapChangeEvent,
108
+ this._postRenderHandler.bind(this),
109
+ );
107
110
  }
108
111
  }
109
112
 
@@ -128,14 +131,18 @@ class ObliqueProvider {
128
131
  * @type {import("@vcmap/core").ObliqueImage|null}
129
132
  * @api
130
133
  */
131
- get currentImage() { return this._currentImage; }
134
+ get currentImage() {
135
+ return this._currentImage;
136
+ }
132
137
 
133
138
  /**
134
139
  * @readonly
135
140
  * @type {import("@vcmap/core").ObliqueCollection|null}
136
141
  * @api
137
142
  */
138
- get collection() { return this._collection; }
143
+ get collection() {
144
+ return this._collection;
145
+ }
139
146
 
140
147
  /**
141
148
  * Set a new collection. The collection must be loaded.
@@ -162,14 +169,19 @@ class ObliqueProvider {
162
169
  */
163
170
  activate() {
164
171
  if (!this._collection) {
165
- throw new Error('cannot activate provider without an oblique collection.');
172
+ throw new Error(
173
+ 'cannot activate provider without an oblique collection.',
174
+ );
166
175
  }
167
176
  if (!this._active) {
168
177
  this._active = true;
169
178
  this._setCurrentView();
170
179
  if (!this._postRenderListener) {
171
- // @ts-ignore
172
- this._postRenderListener = this._olMap.on(this._mapChangeEvent, this._postRenderHandler.bind(this));
180
+ this._postRenderListener = this._olMap.on(
181
+ // @ts-ignore
182
+ this._mapChangeEvent,
183
+ this._postRenderHandler.bind(this),
184
+ );
173
185
  }
174
186
  }
175
187
  }
@@ -198,7 +210,10 @@ class ObliqueProvider {
198
210
  */
199
211
  _pullCoordinateToImageCenter(coord) {
200
212
  if (this.currentImage) {
201
- const center = [this.currentImage.meta.size[0] / 2, this.currentImage.meta.size[1] / 2];
213
+ const center = [
214
+ this.currentImage.meta.size[0] / 2,
215
+ this.currentImage.meta.size[1] / 2,
216
+ ];
202
217
  if (coord[0] < center[0]) {
203
218
  coord[0] += 50;
204
219
  } else {
@@ -216,32 +231,46 @@ class ObliqueProvider {
216
231
 
217
232
  _postRenderHandler() {
218
233
  if (this._active && !this.loading && this.switchEnabled) {
219
- const currentSize = this._currentImage ? this._currentImage.meta.size : null;
234
+ const currentSize = this._currentImage
235
+ ? this._currentImage.meta.size
236
+ : null;
220
237
  const imageCoordinates = this._olMap.getView().getCenter();
221
238
  const ratioLower = this.switchThreshold; // XXX this.switchThreshold;
222
239
  const ratioUpper = 1 - ratioLower;
223
240
  if (
224
- !this._currentImage || (
225
- imageCoordinates[0] / currentSize[0] > ratioLower &&
241
+ !this._currentImage ||
242
+ (imageCoordinates[0] / currentSize[0] > ratioLower &&
226
243
  imageCoordinates[0] / currentSize[0] < ratioUpper &&
227
244
  imageCoordinates[1] / currentSize[1] > ratioLower &&
228
- imageCoordinates[1] / currentSize[1] < ratioUpper
229
- )
245
+ imageCoordinates[1] / currentSize[1] < ratioUpper)
230
246
  ) {
231
247
  return;
232
248
  }
233
- const pulledCenter = this._pullCoordinateToImageCenter(imageCoordinates.slice());
234
- const worldCoords = this._currentImage.transformImage2RealWorld(pulledCenter).slice(0, 2);
235
- const transform = getTransform(this._currentImage.meta.projection.proj, mercatorProjection.proj);
236
- const mercatorCoords = transform(worldCoords);
249
+ const pulledCenter = this._pullCoordinateToImageCenter(
250
+ imageCoordinates.slice(),
251
+ );
252
+ const worldCoords = this._currentImage
253
+ .transformImage2RealWorld(pulledCenter)
254
+ .slice(0, 2);
255
+ const transform = getTransform(
256
+ this._currentImage.meta.projection.proj,
257
+ mercatorProjection.proj,
258
+ );
259
+ // error in TransformFunction type definition, remove undefined after openlayer fixed the type
260
+ const mercatorCoords = transform(worldCoords, undefined, undefined);
237
261
  const buffer = 200; // XXX make configurable?
238
262
  const extent = [
239
- mercatorCoords[0] - buffer, mercatorCoords[1] - buffer,
240
- mercatorCoords[0] + buffer, mercatorCoords[1] + buffer,
263
+ mercatorCoords[0] - buffer,
264
+ mercatorCoords[1] - buffer,
265
+ mercatorCoords[0] + buffer,
266
+ mercatorCoords[1] + buffer,
241
267
  ];
242
268
  const dataState = this._collection.getDataStateForExtent(extent);
243
269
  if (dataState === DataState.READY) {
244
- const image = this._collection.getImageForCoordinate(mercatorCoords, this._currentImage.viewDirection);
270
+ const image = this._collection.getImageForCoordinate(
271
+ mercatorCoords,
272
+ this._currentImage.viewDirection,
273
+ );
245
274
  if (image && image.name !== this._currentImage.name) {
246
275
  this._changeImage(image, imageCoordinates);
247
276
  }
@@ -253,7 +282,10 @@ class ObliqueProvider {
253
282
 
254
283
  async _changeImage(image, imageCoordinates) {
255
284
  this._loadingImage = image;
256
- const { coords } = await transformFromImage(this._currentImage, imageCoordinates);
285
+ const { coords } = await transformFromImage(
286
+ this._currentImage,
287
+ imageCoordinates,
288
+ );
257
289
  if (this._loadingImage !== image) {
258
290
  return;
259
291
  }
@@ -272,7 +304,8 @@ class ObliqueProvider {
272
304
  throw new Error('cannot set an image without an oblique collection.');
273
305
  }
274
306
  this._loadingImage = image;
275
- const isNewImage = !this._currentImage || this._currentImage.name !== image.name;
307
+ const isNewImage =
308
+ !this._currentImage || this._currentImage.name !== image.name;
276
309
  this._currentImage = image;
277
310
  if (isNewImage) {
278
311
  await image.calculateImageAverageHeight();
@@ -293,17 +326,24 @@ class ObliqueProvider {
293
326
  const previousView = this._currentView;
294
327
  this._currentView = olView;
295
328
  if (isNewImage) {
296
- this._currentView.setImageName(this._currentImage.name);
329
+ this._currentView.setImageName(
330
+ this._currentImage.name,
331
+ this._currentImage[isDefaultImageSymbol],
332
+ );
297
333
  }
298
334
 
299
335
  const [width, height] = this._currentImage.meta.size;
300
336
  let center = [width / 2, height / 2];
301
337
  if (optCenter) {
338
+ // error in TransformFunction type definition, remove undefined after openlayer fixed the type
302
339
  const worldCenter = getTransform(
303
340
  mercatorProjection.proj,
304
341
  this._currentImage.meta.projection.proj,
305
- )(optCenter.slice(0, 2));
306
- const imageCenter = this._currentImage.transformRealWorld2Image(worldCenter, optCenter[2]);
342
+ )(optCenter.slice(0, 2), undefined, undefined);
343
+ const imageCenter = this._currentImage.transformRealWorld2Image(
344
+ worldCenter,
345
+ optCenter[2],
346
+ );
307
347
  imageCenter[0] = withinBounds(imageCenter[0], width);
308
348
  imageCenter[1] = withinBounds(imageCenter[1], height);
309
349
  center = imageCenter;
@@ -334,7 +374,9 @@ class ObliqueProvider {
334
374
  }
335
375
 
336
376
  if (this._olMap.getView() && this._olMap.getView().getResolution()) {
337
- this._currentView.view.setResolution(this._olMap.getView().getResolution());
377
+ this._currentView.view.setResolution(
378
+ this._olMap.getView().getResolution(),
379
+ );
338
380
  }
339
381
 
340
382
  this._olMap.setView(this._currentView.view);
@@ -368,7 +410,10 @@ class ObliqueProvider {
368
410
  const usedCoordinate = coordinate.slice();
369
411
  const coordinateHash = `${coordinate.join('')}${direction}${zoom}`;
370
412
  this._loadingImage = coordinateHash;
371
- const image = await this._collection.loadImageForCoordinate(coordinate, direction);
413
+ const image = await this._collection.loadImageForCoordinate(
414
+ coordinate,
415
+ direction,
416
+ );
372
417
  if (image) {
373
418
  if (this._loadingImage !== coordinateHash) {
374
419
  return;
@@ -397,13 +442,16 @@ class ObliqueProvider {
397
442
 
398
443
  /**
399
444
  * Returns a viewpoint for the currently set view.
400
- * @returns {Promise<ObliqueViewPoint>}
445
+ * @returns {Promise<ObliqueViewpoint>}
401
446
  * @api
402
447
  */
403
448
  async getView() {
404
449
  if (this._currentView && this._currentImage) {
405
450
  const imageCoord = this._currentView.view.getCenter();
406
- const { coords: center } = await transformFromImage(this._currentImage, imageCoord);
451
+ const { coords: center } = await transformFromImage(
452
+ this._currentImage,
453
+ imageCoord,
454
+ );
407
455
  return {
408
456
  center,
409
457
  direction: this._currentImage.viewDirection,
@@ -419,7 +467,9 @@ class ObliqueProvider {
419
467
  */
420
468
  destroy() {
421
469
  this._removeCurrentView();
422
- [...this._viewCache.values()].forEach((ov) => { ov.destroy(); });
470
+ [...this._viewCache.values()].forEach((ov) => {
471
+ ov.destroy();
472
+ });
423
473
  this._viewCache.clear();
424
474
  this._loadingImage = null;
425
475
  if (this._postRenderListener) {
@@ -6,6 +6,29 @@ import TileImage from 'ol/source/TileImage.js';
6
6
  import Tile from 'ol/layer/Tile.js';
7
7
  import { hasSameOrigin } from './helpers.js';
8
8
 
9
+ /** @type {string} */
10
+ let defaultImage = '';
11
+
12
+ /**
13
+ * @returns {string}
14
+ */
15
+ function getDefaultImage() {
16
+ if (!defaultImage) {
17
+ const canvas = document.createElement('canvas');
18
+ canvas.height = 512;
19
+ canvas.width = 512;
20
+ const context = canvas.getContext('2d');
21
+ context.fillStyle = '#409D76';
22
+ context.fillRect(0, 0, 512, 512);
23
+ context.font = 'bold 46px Monospace, Courier New';
24
+ context.fillStyle = '#424242';
25
+ context.textAlign = 'center';
26
+ context.fillText('No Image', 256, 256);
27
+ defaultImage = canvas.toDataURL('png');
28
+ }
29
+ return defaultImage;
30
+ }
31
+
9
32
  /**
10
33
  * @typedef {Object} ObliqueViewOptions
11
34
  * @property {number} minZoom
@@ -17,7 +40,6 @@ import { hasSameOrigin } from './helpers.js';
17
40
 
18
41
  /**
19
42
  * @class
20
- * @export
21
43
  */
22
44
  class ObliqueView {
23
45
  /**
@@ -43,19 +65,27 @@ class ObliqueView {
43
65
  this.scaleFactor = options.scaleFactor;
44
66
  const { tileResolution } = imageMeta;
45
67
  /** @type {Array<number>} */
46
- this.tileResolution = tileResolution.slice(0, tileResolution.length - options.hideLevels);
68
+ this.tileResolution = tileResolution.slice(
69
+ 0,
70
+ tileResolution.length - options.hideLevels,
71
+ );
47
72
  this._createViewAndLayer();
48
73
  }
49
74
 
50
75
  _createViewAndLayer() {
51
- const extent = /** @type {import("ol/extent").Extent} */ ([0, 0, ...this.size]);
76
+ const extent = /** @type {import("ol/extent").Extent} */ ([
77
+ 0,
78
+ 0,
79
+ ...this.size,
80
+ ]);
52
81
  const zoomifyProjection = new OLProjection({
53
82
  code: 'ZOOMIFY',
54
83
  units: 'pixels',
55
84
  extent,
56
85
  });
57
86
 
58
- const maxZoom = this.maxZoom > 0 ? this.maxZoom : this.tileResolution.length + 4;
87
+ const maxZoom =
88
+ this.maxZoom > 0 ? this.maxZoom : this.tileResolution.length + 4;
59
89
  const zoomMultiplier = Math.log(2) / Math.log(this.scaleFactor);
60
90
 
61
91
  /**
@@ -108,9 +138,19 @@ class ObliqueView {
108
138
  /**
109
139
  * Sets the layers source to request data for this image
110
140
  * @param {string} name
141
+ * @param {boolean} [isDefaultImage=false]
111
142
  * @api
112
143
  */
113
- setImageName(name) {
144
+ setImageName(name, isDefaultImage = false) {
145
+ if (isDefaultImage) {
146
+ this.tileImageSource.setTileLoadFunction(
147
+ /** @param {import("ol").ImageTile} tile */ (tile) => {
148
+ /** @type {HTMLImageElement} */ (tile.getImage()).src =
149
+ getDefaultImage();
150
+ tile.load();
151
+ },
152
+ );
153
+ }
114
154
  this.tileImageSource.setTileUrlFunction((coords) => {
115
155
  const [z, x, yInverted] = coords;
116
156
  const y = -yInverted - 1;
@@ -6,7 +6,6 @@
6
6
  * @property {number} SOUTH
7
7
  * @property {number} WEST
8
8
  * @property {number} NADIR
9
- * @export
10
9
  * @api
11
10
  */
12
11
  export const ObliqueViewDirection = {
@@ -19,7 +18,6 @@ export const ObliqueViewDirection = {
19
18
 
20
19
  /**
21
20
  * @type {Object<string, ObliqueViewDirection>}
22
- * @export
23
21
  */
24
22
  export const obliqueViewDirectionNames = {
25
23
  north: ObliqueViewDirection.NORTH,
@@ -32,9 +30,9 @@ export const obliqueViewDirectionNames = {
32
30
  /**
33
31
  * @param {number} direction
34
32
  * @returns {string|undefined}
35
- * @export
36
33
  */
37
34
  export function getDirectionName(direction) {
38
- return Object.keys(obliqueViewDirectionNames)
39
- .find((name => obliqueViewDirectionNames[name] === direction));
35
+ return Object.keys(obliqueViewDirectionNames).find(
36
+ (name) => obliqueViewDirectionNames[name] === direction,
37
+ );
40
38
  }