@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,7 +1,7 @@
1
- import { Matrix3, Cartesian3, Matrix4 } from '@vcmap/cesium';
2
- import ObliqueImage from './ObliqueImage.js';
3
- import { obliqueViewDirectionNames } from './ObliqueViewDirection.js';
4
- import ImageMeta from './ObliqueImageMeta.js';
1
+ import { Matrix3, Cartesian3, Matrix4 } from '@vcmap-cesium/engine';
2
+ import ObliqueImage from './obliqueImage.js';
3
+ import { obliqueViewDirectionNames } from './obliqueViewDirection.js';
4
+ import ImageMeta from './obliqueImageMeta.js';
5
5
  import Projection from '../util/projection.js';
6
6
 
7
7
  let customObliqueProjectionId = 0;
@@ -41,16 +41,22 @@ export function getVersionFromImageJson(json) {
41
41
  * @param {ObliqueImageJson} json
42
42
  * @param {string} url
43
43
  * @param {import("@vcmap/core").Projection=} projection
44
- * @param {import("@vcmap/cesium").CesiumTerrainProvider=} terrainProvider
44
+ * @param {import("@vcmap-cesium/engine").CesiumTerrainProvider=} terrainProvider
45
45
  * @returns {Array<import("@vcmap/core").ObliqueImageMeta>}
46
46
  */
47
47
  export function parseImageMeta(json, url, projection, terrainProvider) {
48
48
  let size;
49
49
  if (json.generalImageInfo.width && json.generalImageInfo.height) {
50
- size = /** @type {import("ol/size").Size} */ ([json.generalImageInfo.width, json.generalImageInfo.height]);
50
+ size = /** @type {import("ol/size").Size} */ ([
51
+ json.generalImageInfo.width,
52
+ json.generalImageInfo.height,
53
+ ]);
51
54
  }
52
55
  const tileResolution = json.generalImageInfo['tile-resolution'];
53
- const tileSize = /** @type {import("ol/size").Size} */ ([json.generalImageInfo['tile-width'], json.generalImageInfo['tile-height']]);
56
+ const tileSize = /** @type {import("ol/size").Size} */ ([
57
+ json.generalImageInfo['tile-width'],
58
+ json.generalImageInfo['tile-height'],
59
+ ]);
54
60
  let imageProjection = projection;
55
61
  const imageMetas = [];
56
62
  if (!imageProjection && json.generalImageInfo.crs) {
@@ -76,9 +82,13 @@ export function parseImageMeta(json, url, projection, terrainProvider) {
76
82
  imageMetas.push(new ImageMeta({ ...defaultOptions, ...cameraOption }));
77
83
  });
78
84
  } else if (typeof json.generalImageInfo.cameraParameter === 'object') {
79
- Object.entries(json.generalImageInfo.cameraParameter).forEach(([name, cameraOption]) => {
80
- imageMetas.push(new ImageMeta({ name, ...defaultOptions, ...cameraOption }));
81
- });
85
+ Object.entries(json.generalImageInfo.cameraParameter).forEach(
86
+ ([name, cameraOption]) => {
87
+ imageMetas.push(
88
+ new ImageMeta({ name, ...defaultOptions, ...cameraOption }),
89
+ );
90
+ },
91
+ );
82
92
  }
83
93
  }
84
94
 
@@ -112,7 +122,8 @@ export function parseImageData(json, imageMetas) {
112
122
 
113
123
  const images = new Array(json.images.length - 1);
114
124
  json.images.forEach((img, index) => {
115
- if (index === 0) { // skip header image
125
+ if (index === 0) {
126
+ // skip header image
116
127
  return;
117
128
  }
118
129
  const coordsArrayPToRealworld = [];
@@ -121,7 +132,9 @@ export function parseImageData(json, imageMetas) {
121
132
  coordsArrayPToRealworld.push(...value);
122
133
  });
123
134
  }
124
- const pToRealworld = img[indices.pToRealworld] ? new Matrix3(...coordsArrayPToRealworld) : null;
135
+ const pToRealworld = img[indices.pToRealworld]
136
+ ? new Matrix3(...coordsArrayPToRealworld)
137
+ : null;
125
138
 
126
139
  const coordsArrayPToImage = [];
127
140
  if (img[indices.pToImage]) {
@@ -130,10 +143,12 @@ export function parseImageData(json, imageMetas) {
130
143
  });
131
144
  coordsArrayPToImage.push(0, 0, 0, 1);
132
145
  }
133
- const projectionCenter = img[indices.projectionCenter] ?
134
- Cartesian3.fromArray(img[indices.projectionCenter]) :
135
- null;
136
- const pToImage = img[indices.pToImage] ? new Matrix4(...coordsArrayPToImage) : null;
146
+ const projectionCenter = img[indices.projectionCenter]
147
+ ? Cartesian3.fromArray(img[indices.projectionCenter])
148
+ : null;
149
+ const pToImage = img[indices.pToImage]
150
+ ? new Matrix4(...coordsArrayPToImage)
151
+ : null;
137
152
 
138
153
  const meta = imageMetas[img[indices.cameraIndex] || 0];
139
154
  if (!meta.size) {
@@ -180,14 +195,15 @@ export function parseLegacyImageData(json, imageMetas) {
180
195
  const { version, buildNumber } = getVersionFromImageJson(json);
181
196
  return /** @type {Array<*>} */ (json.images).map((img) => {
182
197
  const viewDirection = obliqueViewDirectionNames[img['view-direction']];
183
- const viewDirectionAngle = version >= 3.4 && buildNumber >= 18 ?
184
- img['view-directionAngle'] :
185
- undefined;
198
+ const viewDirectionAngle =
199
+ version >= 3.4 && buildNumber >= 18
200
+ ? img['view-directionAngle']
201
+ : undefined;
186
202
  const projectionCenter = img['projection-center'];
187
203
  const { name, groundCoordinates, centerPointOnGround } = img;
188
204
 
189
205
  const cameraName = img['camera-name'];
190
- const imageMeta = imageMetas.find(value => value.name === cameraName);
206
+ const imageMeta = imageMetas.find((value) => value.name === cameraName);
191
207
  const meta = imageMeta || imageMetas[0];
192
208
  if (!meta.size) {
193
209
  if (img.height && img.width) {
@@ -218,13 +234,28 @@ export function parseLegacyImageData(json, imageMetas) {
218
234
 
219
235
  if (imageMeta && cameraName) {
220
236
  const cameraOptions = cameraParameter[cameraName];
221
- const cameraMatrix = Matrix3.fromRowMajorArray([].concat(...cameraOptions['camera-matrix']));
237
+ const cameraMatrix = Matrix3.fromRowMajorArray(
238
+ [].concat(...cameraOptions['camera-matrix']),
239
+ );
222
240
  const cameraMatrixInverse = Matrix3.inverse(cameraMatrix, new Matrix3());
223
- const rotationMatrix = Matrix3.fromRowMajorArray([].concat(...img['rotation-matrix']));
224
- const rotationMatrixTransposed = Matrix3.transpose(rotationMatrix, new Matrix3());
225
- const focalLength = cameraOptions['focal-length'] * (-1);
226
- Matrix3.multiplyByScalar(cameraMatrixInverse, focalLength, cameraMatrixInverse);
227
- const pToRealworld = Matrix3.multiply(rotationMatrixTransposed, cameraMatrixInverse, new Matrix3());
241
+ const rotationMatrix = Matrix3.fromRowMajorArray(
242
+ [].concat(...img['rotation-matrix']),
243
+ );
244
+ const rotationMatrixTransposed = Matrix3.transpose(
245
+ rotationMatrix,
246
+ new Matrix3(),
247
+ );
248
+ const focalLength = cameraOptions['focal-length'] * -1;
249
+ Matrix3.multiplyByScalar(
250
+ cameraMatrixInverse,
251
+ focalLength,
252
+ cameraMatrixInverse,
253
+ );
254
+ const pToRealworld = Matrix3.multiply(
255
+ rotationMatrixTransposed,
256
+ cameraMatrixInverse,
257
+ new Matrix3(),
258
+ );
228
259
 
229
260
  const cameraMatrix4 = Matrix4.fromRotationTranslation(
230
261
  cameraMatrix,
@@ -233,7 +264,11 @@ export function parseLegacyImageData(json, imageMetas) {
233
264
  );
234
265
  const projectionCenterCartesian = Cartesian3.fromArray(projectionCenter);
235
266
  const e = Matrix4.fromTranslation(
236
- Cartesian3.multiplyByScalar(projectionCenterCartesian, -1, new Cartesian3()),
267
+ Cartesian3.multiplyByScalar(
268
+ projectionCenterCartesian,
269
+ -1,
270
+ new Cartesian3(),
271
+ ),
237
272
  new Matrix4(),
238
273
  );
239
274
  const rotationMatrix4 = Matrix4.fromRotationTranslation(
@@ -253,4 +288,3 @@ export function parseLegacyImageData(json, imageMetas) {
253
288
  return new ObliqueImage(imageOptions);
254
289
  });
255
290
  }
256
-
package/src/ol/feature.js CHANGED
@@ -1,4 +1,10 @@
1
1
  import Feature from 'ol/Feature.js';
2
+ import { Style } from 'ol/style.js';
3
+ import {
4
+ globalHidden,
5
+ hidden,
6
+ highlighted,
7
+ } from '../layer/featureVisibility.js';
2
8
 
3
9
  /**
4
10
  * To be used for cesium 3D style functions
@@ -39,9 +45,36 @@ Feature.prototype.getProperty = function getProperty(property) {
39
45
  * @param {string} property
40
46
  * @returns {*}
41
47
  */
42
- Feature.prototype.getPropertyInherited = function getPropertyInherited(property) {
48
+ Feature.prototype.getPropertyInherited = function getPropertyInherited(
49
+ property,
50
+ ) {
43
51
  return this.getProperty(property);
44
52
  };
45
53
 
54
+ const originalStyleFunction = Feature.prototype.getStyleFunction;
55
+ Feature.prototype.getStyleFunction = function getStyleFunction() {
56
+ if (this[hidden] || this[globalHidden]) {
57
+ return () => [];
58
+ }
59
+
60
+ if (this[highlighted]) {
61
+ return () => [this[highlighted].style];
62
+ }
63
+ return originalStyleFunction.bind(this)();
64
+ };
65
+
66
+ const originalGetStyle = Feature.prototype.getStyle;
67
+ Feature.prototype.getStyle = function getStyle() {
68
+ if (this[hidden] || this[globalHidden]) {
69
+ return new Style({});
70
+ }
71
+
72
+ if (this[highlighted]) {
73
+ return this[highlighted].style;
74
+ }
75
+
76
+ return originalGetStyle.bind(this)();
77
+ };
78
+
46
79
  // TODO implement getExactClassName, isClass & isExactClass
47
80
  // TODO implement feature.content.tileset.timeSinceLoad
@@ -1,6 +1,6 @@
1
1
  import Circle from 'ol/geom/Circle.js';
2
2
  import { check } from '@vcsuite/check';
3
- import { cartesian2DDistance, cartesian3DDistance } from '../../vcs/vcm/util/math.js';
3
+ import { cartesian2DDistance, cartesian3DDistance } from '../../util/math.js';
4
4
 
5
5
  /**
6
6
  * @returns {Array<import("ol/coordinate").Coordinate>} returns an Array where the first coordinate is the center, and the second the center with an x offset of radius
@@ -12,13 +12,22 @@ Circle.prototype.getCoordinates = function getCoordinates() {
12
12
 
13
13
  /**
14
14
  * @param {Array<import("ol/coordinate").Coordinate>} coordinates - array of length two. The first coordinate is treated as the center, the second as the center with an x offset of radius
15
- * @param {import("ol/geom/GeometryLayout").default=} optLayout
15
+ * @param {import("ol/geom/Geometry").GeometryLayout=} optLayout
16
16
  */
17
- Circle.prototype.setCoordinates = function setCoordinates(coordinates, optLayout) {
17
+ Circle.prototype.setCoordinates = function setCoordinates(
18
+ coordinates,
19
+ optLayout,
20
+ ) {
18
21
  check(coordinates, [[Number]]);
19
22
  check(coordinates.length, 2);
20
23
 
21
24
  const layout = optLayout || this.getLayout();
22
- const getRadius = /XYM?/.test(layout) ? cartesian2DDistance : cartesian3DDistance;
23
- this.setCenterAndRadius(coordinates[0], getRadius(coordinates[0], coordinates[1]), optLayout);
25
+ const getRadius = /XYM?/.test(layout)
26
+ ? cartesian2DDistance
27
+ : cartesian3DDistance;
28
+ this.setCenterAndRadius(
29
+ coordinates[0],
30
+ getRadius(coordinates[0], coordinates[1]),
31
+ optLayout,
32
+ );
24
33
  };
@@ -1,33 +1,39 @@
1
1
  import GeometryCollection from 'ol/geom/GeometryCollection.js';
2
- import GeometryLayout from 'ol/geom/GeometryLayout.js';
3
2
  import { check } from '@vcsuite/check';
4
3
 
5
4
  /**
6
5
  * @returns {Array<import("ol/coordinate").Coordinate|Array<import("ol/coordinate").Coordinate>|Array<Array<import("ol/coordinate").Coordinate>>|Array<Array<Array<import("ol/coordinate").Coordinate>>>>}
7
6
  */
8
7
  GeometryCollection.prototype.getCoordinates = function getCoordinates() {
9
- return this.getGeometries().map(g => g.getCoordinates());
8
+ return this.getGeometries().map((g) => g.getCoordinates());
10
9
  };
11
10
 
12
11
  /**
13
12
  * @param {Array<import("ol/coordinate").Coordinate|Array<import("ol/coordinate").Coordinate>|Array<Array<import("ol/coordinate").Coordinate>>|Array<Array<Array<import("ol/coordinate").Coordinate>>>>} coordinates
14
- * @param {import("ol/geom/GeometryLayout").default=} optLayout
13
+ * @param {import("ol/geom/Geometry").GeometryLayout=} optLayout
15
14
  */
16
- GeometryCollection.prototype.setCoordinates = function setCoordinates(coordinates, optLayout) {
15
+ GeometryCollection.prototype.setCoordinates = function setCoordinates(
16
+ coordinates,
17
+ optLayout,
18
+ ) {
17
19
  check(coordinates, Array);
18
20
  check(coordinates.length, this.getGeometries().length);
19
21
 
20
- this.setGeometries(this.getGeometries()
21
- .map((g, i) => { g.setCoordinates(coordinates[i], optLayout); return g; }));
22
+ this.setGeometries(
23
+ this.getGeometries().map((g, i) => {
24
+ g.setCoordinates(coordinates[i], optLayout);
25
+ return g;
26
+ }),
27
+ );
22
28
  };
23
29
 
24
30
  /**
25
- * @returns {import("ol/geom/GeometryLayout").default}
31
+ * @returns {import("ol/geom/Geometry").GeometryLayout}
26
32
  */
27
33
  GeometryCollection.prototype.getLayout = function getLayout() {
28
34
  const firstGeom = this.getGeometries()[0];
29
35
  if (firstGeom) {
30
36
  return firstGeom.getLayout();
31
37
  }
32
- return /** @type {undefined} */ (GeometryLayout.XYZ);
38
+ return 'XYZ';
33
39
  };
@@ -8,7 +8,6 @@ import { transform2D } from 'ol/geom/flat/transform.js';
8
8
  * @class
9
9
  * @extends {CanvasImmediateRenderer}
10
10
  * @memberOf ol
11
- * @exports
12
11
  * Tile Renderer Implementation of openlayers CanvasImmediateRenderer
13
12
  * can be used to allow for a correction Factor to take into account Mercator Tile distortion
14
13
  */
@@ -33,7 +32,15 @@ class CanvasTileRenderer extends CanvasImmediateRenderer {
33
32
  userTransform,
34
33
  scaleY = 1,
35
34
  ) {
36
- super(context, pixelRatio, extent, transform, viewRotation, squaredTolerance, userTransform);
35
+ super(
36
+ context,
37
+ pixelRatio,
38
+ extent,
39
+ transform,
40
+ viewRotation,
41
+ squaredTolerance,
42
+ userTransform,
43
+ );
37
44
 
38
45
  /**
39
46
  * @private
@@ -68,10 +75,7 @@ class CanvasTileRenderer extends CanvasImmediateRenderer {
68
75
  */
69
76
  set imageScale_(value) {
70
77
  const imageScale = value || [1, 1];
71
- this.scaledImageScale_ = [
72
- imageScale[0],
73
- imageScale[1] * this.scaleY,
74
- ];
78
+ this.scaledImageScale_ = [imageScale[0], imageScale[1] * this.scaleY];
75
79
  }
76
80
 
77
81
  /**
@@ -88,10 +92,7 @@ class CanvasTileRenderer extends CanvasImmediateRenderer {
88
92
  */
89
93
  set textScale_(value) {
90
94
  const textScale = value || [1, 1];
91
- this.scaledTextScale_ = [
92
- textScale[0],
93
- textScale[1] * this.scaleY,
94
- ];
95
+ this.scaledTextScale_ = [textScale[0], textScale[1] * this.scaleY];
95
96
  }
96
97
 
97
98
  /**
@@ -0,0 +1,214 @@
1
+ import { check } from '@vcsuite/check';
2
+ import { getLogger } from '@vcsuite/logger';
3
+ import VcsEvent from './vcsEvent.js';
4
+
5
+ /**
6
+ * @returns {import("@vcsuite/logger").Logger}
7
+ */
8
+ function logger() {
9
+ return getLogger('OverrideClassRegistry');
10
+ }
11
+
12
+ /**
13
+ * @class
14
+ * @template {Object|import("@vcmap/core").VcsObject} T
15
+ */
16
+ class OverrideClassRegistry {
17
+ /**
18
+ * @param {import("@vcmap/core").ClassRegistry<T>} coreClassRegistry
19
+ */
20
+ constructor(coreClassRegistry) {
21
+ this._coreClassRegistry = coreClassRegistry;
22
+ /**
23
+ * @type {Map<string, { moduleId: string, ctor: function(new: T, ...*) }>}
24
+ * @private
25
+ */
26
+ this._classMap = new Map();
27
+ /**
28
+ * @type {Map<string, Array<{ moduleId: string, ctor: function(new: T, ...*) }>>}
29
+ * @private
30
+ */
31
+ this._classShadows = new Map();
32
+ /**
33
+ * Called if a class was replaced. Is passed the className
34
+ * @type {VcsEvent<string>}
35
+ */
36
+ this.replaced = new VcsEvent();
37
+ /**
38
+ * Called if a class was removed. Is passed the className
39
+ * @type {VcsEvent<string>}
40
+ */
41
+ this.removed = new VcsEvent();
42
+ }
43
+
44
+ /**
45
+ * @returns {Array<string>}
46
+ */
47
+ getClassNames() {
48
+ return [
49
+ ...new Set([
50
+ ...this._classMap.keys(),
51
+ ...this._coreClassRegistry.getClassNames(),
52
+ ]),
53
+ ];
54
+ }
55
+
56
+ /**
57
+ * Register a class for a given module by name. If the class already exists, it will be replaced and replaced called with the classeName.
58
+ * @param {string} moduleId
59
+ * @param {string} className
60
+ * @param {function(new: T, ...*)} ctor
61
+ */
62
+ registerClass(moduleId, className, ctor) {
63
+ check(moduleId, String);
64
+ check(className, String);
65
+ check(ctor, Function);
66
+
67
+ const entry = {
68
+ moduleId,
69
+ ctor,
70
+ };
71
+
72
+ const replaced = this.hasClass(className);
73
+
74
+ if (this._classMap.has(className)) {
75
+ if (!this._classShadows.has(className)) {
76
+ this._classShadows.set(className, []);
77
+ }
78
+ this._classShadows.get(className).push(this._classMap.get(className));
79
+ }
80
+ this._classMap.set(className, entry);
81
+
82
+ if (replaced) {
83
+ this.replaced.raiseEvent(className);
84
+ }
85
+ }
86
+
87
+ /**
88
+ * Unregister a previously registered class. You can only unregister classes added to this registry, not the underlying core registry.
89
+ * If when registering this class you have replaced class, it will be re-instated and replaced called.
90
+ * If there is no previously registered class, it will be removed and removed will be called.
91
+ * @param {string} moduleId
92
+ * @param {string} className
93
+ */
94
+ unregisterClass(moduleId, className) {
95
+ check(moduleId, String);
96
+ check(className, String);
97
+
98
+ if (this._classShadows.has(className)) {
99
+ const shadowsArray = this._classShadows.get(className);
100
+ const newShadowsArray = shadowsArray.filter(
101
+ (e) => e.moduleId !== moduleId,
102
+ );
103
+ if (newShadowsArray.length === 0) {
104
+ this._classShadows.delete(className);
105
+ } else if (newShadowsArray.length !== shadowsArray.length) {
106
+ this._classShadows.set(className, newShadowsArray);
107
+ }
108
+ }
109
+
110
+ if (
111
+ this._classMap.has(className) &&
112
+ this._classMap.get(className).moduleId === moduleId
113
+ ) {
114
+ this._classMap.delete(className);
115
+ if (this._classShadows.has(className)) {
116
+ this._classMap.set(className, this._classShadows.get(className).pop());
117
+ if (this._classShadows.get(className).length === 0) {
118
+ this._classShadows.delete(className);
119
+ }
120
+ this.replaced.raiseEvent(className);
121
+ } else if (this._coreClassRegistry.hasClass(className)) {
122
+ this.replaced.raiseEvent(className);
123
+ } else {
124
+ this.removed.raiseEvent(className);
125
+ }
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Gets the constructor for a registered class or undefined, if no such class was registerd
131
+ * @param {string} className
132
+ * @returns {function(new: T, ...*)|undefined}
133
+ * @api
134
+ */
135
+ getClass(className) {
136
+ check(className, String);
137
+
138
+ if (this._classMap.has(className)) {
139
+ return this._classMap.get(className).ctor;
140
+ }
141
+ return this._coreClassRegistry.getClass(className);
142
+ }
143
+
144
+ /**
145
+ * @param {string} className
146
+ * @returns {boolean}
147
+ */
148
+ hasClass(className) {
149
+ check(className, String);
150
+
151
+ return (
152
+ this._classMap.has(className) ||
153
+ this._coreClassRegistry.hasClass(className)
154
+ );
155
+ }
156
+
157
+ /**
158
+ * Create an object of the given className. The constructor is passed args.
159
+ * @param {string} className
160
+ * @param {...*} args
161
+ * @returns {T}
162
+ * @api
163
+ */
164
+ create(className, ...args) {
165
+ check(className, String);
166
+
167
+ const Ctor = this.getClass(className);
168
+ if (!Ctor) {
169
+ logger().error(`could not find constructor ${className}`);
170
+ return undefined;
171
+ }
172
+ return new Ctor(...args);
173
+ }
174
+
175
+ /**
176
+ * A convenience API to pass in a serialized VcsObject directly. It calls create using options.type as the className.
177
+ * Will throw an error if options.type is not a string or options is not an Object.
178
+ * Passes options and args to the constructor in that order.
179
+ * @param {Object} options
180
+ * @param {...*} args
181
+ * @returns {T}
182
+ */
183
+ createFromTypeOptions(options, ...args) {
184
+ check(options, { type: String });
185
+
186
+ return this.create(options.type, options, ...args);
187
+ }
188
+
189
+ /**
190
+ * Removes all classes registered from within a certain module. Will re-instate classes overwritten by the module
191
+ * and call the appropriate events, outlined in unregisterClass.
192
+ * @param {string} moduleId
193
+ */
194
+ removeModule(moduleId) {
195
+ check(moduleId, String);
196
+
197
+ this._classMap.forEach((cb, className) => {
198
+ this.unregisterClass(moduleId, className);
199
+ });
200
+ }
201
+
202
+ /**
203
+ * Destroys the override class registry
204
+ */
205
+ destroy() {
206
+ this._coreClassRegistry = null;
207
+ this._classMap.clear();
208
+ this._classShadows.clear();
209
+ this.replaced.destroy();
210
+ this.removed.destroy();
211
+ }
212
+ }
213
+
214
+ export default OverrideClassRegistry;