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

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 +3480 -2008
  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} +83 -70
  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} +8 -9
  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 -112
  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 +95 -0
  73. package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +28 -21
  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 +64 -37
  91. package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +431 -277
  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} +151 -55
  99. package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +77 -46
  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 +79 -49
  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 +45 -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,6 +1,5 @@
1
1
  import VectorStyleItem from './vectorStyleItem.js';
2
2
  import DeclarativeStyleItem from './declarativeStyleItem.js';
3
- import { referenceableStyleSymbol } from './styleItem.js';
4
3
 
5
4
  /**
6
5
  * @param {VectorStyleItemOptions} obj
@@ -8,11 +7,7 @@ import { referenceableStyleSymbol } from './styleItem.js';
8
7
  * @returns {VectorStyleItemOptions}
9
8
  */
10
9
  export function embedIconsInStyle(obj, embeddedIcons) {
11
- if (
12
- obj.image &&
13
- obj.image.src &&
14
- /^data:/.test(obj.image.src)
15
- ) {
10
+ if (obj.image && obj.image.src && /^data:/.test(obj.image.src)) {
16
11
  if (embeddedIcons) {
17
12
  let index = embeddedIcons.indexOf(obj.image.src);
18
13
  if (index === -1) {
@@ -21,7 +16,8 @@ export function embedIconsInStyle(obj, embeddedIcons) {
21
16
  }
22
17
  obj.image.src = `:${index}`;
23
18
  } else {
24
- obj.image = { // XXX is this the correct fallback?
19
+ obj.image = {
20
+ // XXX is this the correct fallback?
25
21
  radius: 5,
26
22
  };
27
23
  }
@@ -35,12 +31,11 @@ export function embedIconsInStyle(obj, embeddedIcons) {
35
31
  * @returns {VcsMeta}
36
32
  */
37
33
  function writeStyle(style, vcsMeta = {}) {
38
- if (style[referenceableStyleSymbol]) { // XXX this should be configurable. In some cases, writting out the actual style would be desirable
39
- vcsMeta.style = style.getReference();
40
- } else if (style instanceof VectorStyleItem) {
41
- vcsMeta.style = embedIconsInStyle(style.getOptions(), vcsMeta.embeddedIcons);
34
+ // XXX this entire function is not what is to be expected. feature store expects styles as refs to be possible
35
+ if (style instanceof VectorStyleItem) {
36
+ vcsMeta.style = embedIconsInStyle(style.toJSON(), vcsMeta.embeddedIcons);
42
37
  } else if (style instanceof DeclarativeStyleItem) {
43
- vcsMeta.style = style.getOptions();
38
+ vcsMeta.style = style.toJSON();
44
39
  }
45
40
  return vcsMeta;
46
41
  }
@@ -1,16 +1,15 @@
1
1
  import { v4 as uuidv4 } from 'uuid';
2
- import { Cesium3DTileset } from '@vcmap/cesium';
2
+ import { Cesium3DTileset } from '@vcmap-cesium/engine';
3
3
 
4
4
  import { check } from '@vcsuite/check';
5
5
  import { parseBoolean } from '@vcsuite/parsers';
6
6
  import { getLogger as getLoggerByName } from '@vcsuite/logger';
7
- import CesiumMap from '../../maps/cesium.js';
8
- import VcsEvent from '../../event/vcsEvent.js';
7
+ import CesiumMap from '../../map/cesiumMap.js';
8
+ import VcsEvent from '../../vcsEvent.js';
9
9
  import LayerCollection from '../layerCollection.js';
10
10
 
11
11
  /**
12
12
  * @namespace clipping
13
- * @export
14
13
  * @api
15
14
  */
16
15
 
@@ -26,7 +25,7 @@ import LayerCollection from '../layerCollection.js';
26
25
  * @typedef {Object} ClippingObjectOptions
27
26
  * @property {Array<string>|undefined} layerNames
28
27
  * @property {Array<ClippingObjectEntityOption>|undefined} entities
29
- * @property {import("@vcmap/cesium").ClippingPlaneCollection|undefined} clippingPlaneCollection
28
+ * @property {import("@vcmap-cesium/engine").ClippingPlaneCollection|undefined} clippingPlaneCollection
30
29
  * @property {boolean} [terrain=false]
31
30
  * @property {boolean} [local=false] - if not local, coordinates are expected in ECEF
32
31
  * @api
@@ -36,21 +35,20 @@ import LayerCollection from '../layerCollection.js';
36
35
  * @returns {import("@vcsuite/logger").Logger}
37
36
  */
38
37
  function getLogger() {
39
- return getLoggerByName('vcs.vcm.util.clipping.ClippingObject');
38
+ return getLoggerByName('ClippingObject');
40
39
  }
41
40
 
42
41
  const globeSymbol = Symbol('ClippingObjectGlobe');
43
42
 
44
43
  /**
45
44
  * The ClippingObject is a container for a Cesium.ClippingPlaneCollection. The container holds information on the
46
- * targeted Cesium objects, based on layerNames (for [CesiumTileset]{@link CesiumTileset}) or
47
- * layerName and entity id for Cesium.DataSource which are part of an [DataSource]{@link DataSource} layer.
45
+ * targeted Cesium objects, based on layerNames (for [CesiumTilesetLayer]{@link CesiumTilesetLayer}) or
46
+ * layerName and entity id for Cesium.DataSourceLayer which are part of an [DataSourceLayer]{@link DataSource} layer.
48
47
  * Adding a ClippingObject to the [ClippingObjectManager]{@link ClippingObjectManager} applies the
49
48
  * objects Cesium.ClippingPlaneCollection where applicable. Once added, changes to the targets of the object are tracked.
50
49
  * To update the Cesium.ClippingPlaneCollection or its definitions, you must trigger an update by setting the clippingPlaneCollection
51
50
  * property to the new definition.
52
51
  * @class
53
- * @export
54
52
  * @api stable
55
53
  */
56
54
  class ClippingObject {
@@ -80,12 +78,12 @@ class ClippingObject {
80
78
  /**
81
79
  * Key is a semantic identifier, eg. layerName or layerName-entitiyId, depending on the target. Targets
82
80
  * represent Cesium Object which support the clippingPlanes API
83
- * @type {Map<(string|symbol), import("@vcmap/cesium").Entity|import("@vcmap/cesium").Cesium3DTileset|import("@vcmap/cesium").Globe>}
81
+ * @type {Map<(string|symbol), import("@vcmap-cesium/engine").Entity|import("@vcmap-cesium/engine").Cesium3DTileset|import("@vcmap-cesium/engine").Globe>}
84
82
  */
85
83
  this.targets = new Map();
86
84
 
87
85
  /**
88
- * @type {import("@vcmap/cesium").ClippingPlaneCollection|null}
86
+ * @type {import("@vcmap-cesium/engine").ClippingPlaneCollection|null}
89
87
  * @private
90
88
  */
91
89
  this._clippingPlaneCollection = options.clippingPlaneCollection || null;
@@ -115,7 +113,7 @@ class ClippingObject {
115
113
  this.clippingPlaneUpdated = new VcsEvent();
116
114
 
117
115
  /**
118
- * @type {Set<import("@vcmap/core").FeatureStore>}
116
+ * @type {Set<import("@vcmap/core").FeatureStoreLayer>}
119
117
  * @private
120
118
  */
121
119
  this._cachedFeatureStoreLayers = new Set();
@@ -126,12 +124,14 @@ class ClippingObject {
126
124
  /**
127
125
  * The current Cesium.ClippingPlaneCollection. To update the collection, set this property to the new definition.
128
126
  * @api
129
- * @type {import("@vcmap/cesium").ClippingPlaneCollection|null}
127
+ * @type {import("@vcmap-cesium/engine").ClippingPlaneCollection|null}
130
128
  */
131
- get clippingPlaneCollection() { return this._clippingPlaneCollection; }
129
+ get clippingPlaneCollection() {
130
+ return this._clippingPlaneCollection;
131
+ }
132
132
 
133
133
  /**
134
- * @param {import("@vcmap/cesium").ClippingPlaneCollection} clippingPlaneCollection
134
+ * @param {import("@vcmap-cesium/engine").ClippingPlaneCollection} clippingPlaneCollection
135
135
  */
136
136
  set clippingPlaneCollection(clippingPlaneCollection) {
137
137
  this._clippingPlaneCollection = clippingPlaneCollection;
@@ -143,7 +143,9 @@ class ClippingObject {
143
143
  * @api
144
144
  * @type {boolean}
145
145
  */
146
- get terrain() { return this._terrain; }
146
+ get terrain() {
147
+ return this._terrain;
148
+ }
147
149
 
148
150
  /**
149
151
  * @param {boolean} terrain
@@ -164,7 +166,9 @@ class ClippingObject {
164
166
  * @api
165
167
  * @type {boolean}
166
168
  */
167
- get local() { return this._local; }
169
+ get local() {
170
+ return this._local;
171
+ }
168
172
 
169
173
  /**
170
174
  * @param {boolean} local
@@ -202,56 +206,63 @@ class ClippingObject {
202
206
  if (this.layerNames.includes(layer.name)) {
203
207
  if (layer.active) {
204
208
  const visualisations = map.getVisualizationsForLayer(layer);
205
- const tilesets = visualisations ?
206
- [...visualisations]
207
- .filter(v => v instanceof Cesium3DTileset) :
208
- [];
209
+ const tilesets = visualisations
210
+ ? [...visualisations].filter((v) => v instanceof Cesium3DTileset)
211
+ : [];
209
212
 
210
213
  if (tilesets.length > 0) {
211
- tilesets.forEach(/** @param {import("@vcmap/cesium").Cesium3DTileset} tileset */ (tileset) => {
212
- tileset.readyPromise.then((cesium3DTileset) => {
214
+ tilesets.forEach(
215
+ /** @param {import("@vcmap-cesium/engine").Cesium3DTileset} tileset */ (
216
+ tileset,
217
+ ) => {
213
218
  if (this.layerNames.includes(layer.name) && layer.active) {
214
- this.targets.set(layer.name, cesium3DTileset);
219
+ this.targets.set(layer.name, tileset);
215
220
  this.targetsUpdated.raiseEvent();
216
221
  }
217
- });
218
- });
222
+ },
223
+ );
219
224
  } else {
220
225
  const index = this.layerNames.indexOf(layer.name);
221
- getLogger().warning(`layer ${layer.name} cannot have a ClippingObject applied`);
226
+ getLogger().warning(
227
+ `layer ${layer.name} cannot have a ClippingObject applied`,
228
+ );
222
229
  this.layerNames.splice(index, 1);
223
230
  }
224
231
  } else if (this.targets.has(layer.name)) {
225
232
  this.targets.delete(layer.name);
226
233
  this.targetsUpdated.raiseEvent();
227
234
  }
228
- } else if (this.entities.find(eo => eo.layerName === layer.name)) {
235
+ } else if (this.entities.find((eo) => eo.layerName === layer.name)) {
229
236
  let raise = false;
230
237
  const visualisations = map.getVisualizationsForLayer(layer);
231
- const dataSource = visualisations ?
232
- [...visualisations][0] :
233
- null;
238
+ const dataSource = visualisations ? [...visualisations][0] : null;
234
239
 
235
240
  if (!dataSource) {
236
241
  const index = this.layerNames.indexOf(layer.name);
237
- getLogger().warning(`layer ${layer.name} cannot have a ClippingObject applied`);
242
+ getLogger().warning(
243
+ `layer ${layer.name} cannot have a ClippingObject applied`,
244
+ );
238
245
  this.layerNames.splice(index, 1);
239
246
  return;
240
247
  }
241
248
 
242
249
  this.entities
243
- .filter(eo => eo.layerName === layer.name)
250
+ .filter((eo) => eo.layerName === layer.name)
244
251
  .forEach((eo) => {
245
252
  const key = `${eo.layerName}-${eo.entityId}`;
246
253
  if (layer.active) {
247
- const entity = /** @type {import("@vcmap/cesium").CustomDataSource} */ (dataSource)
248
- .entities.getById(eo.entityId);
254
+ const entity =
255
+ /** @type {import("@vcmap-cesium/engine").CustomDataSource} */ (
256
+ dataSource
257
+ ).entities.getById(eo.entityId);
249
258
  if (entity) {
250
259
  this.targets.set(key, entity);
251
260
  raise = true;
252
261
  } else {
253
262
  const index = this.entities.indexOf(eo);
254
- getLogger().warning(`could not find entity with id ${eo.entityId} in layer ${eo.layerName}`);
263
+ getLogger().warning(
264
+ `could not find entity with id ${eo.entityId} in layer ${eo.layerName}`,
265
+ );
255
266
  this.entities.splice(index, 1);
256
267
  }
257
268
  } else if (this.targets.has(key)) {
@@ -264,11 +275,22 @@ class ClippingObject {
264
275
  this.targetsUpdated.raiseEvent();
265
276
  }
266
277
  }
267
- } else if (this.layerNames.includes(layer.name) && layer.className === 'vcs.vcm.layer.FeatureStore') {
278
+ } else if (
279
+ this.layerNames.includes(layer.name) &&
280
+ layer.className === 'FeatureStoreLayer'
281
+ ) {
268
282
  if (layer.active) {
269
- this._cachedFeatureStoreLayers.add(/** @type {import("@vcmap/core").FeatureStore} */ (layer));
270
- } else if (this._cachedFeatureStoreLayers.has(/** @type {import("@vcmap/core").FeatureStore} */ (layer))) {
271
- this._cachedFeatureStoreLayers.delete(/** @type {import("@vcmap/core").FeatureStore} */ (layer));
283
+ this._cachedFeatureStoreLayers.add(
284
+ /** @type {import("@vcmap/core").FeatureStoreLayer} */ (layer),
285
+ );
286
+ } else if (
287
+ this._cachedFeatureStoreLayers.has(
288
+ /** @type {import("@vcmap/core").FeatureStoreLayer} */ (layer),
289
+ )
290
+ ) {
291
+ this._cachedFeatureStoreLayers.delete(
292
+ /** @type {import("@vcmap/core").FeatureStoreLayer} */ (layer),
293
+ );
272
294
  }
273
295
  }
274
296
  }
@@ -293,7 +315,9 @@ class ClippingObject {
293
315
  }
294
316
 
295
317
  if (this._cachedFeatureStoreLayers.size > 0) {
296
- this._cachedFeatureStoreLayers.forEach((layer) => { this.handleLayerChanged(layer); });
318
+ this._cachedFeatureStoreLayers.forEach((layer) => {
319
+ this.handleLayerChanged(layer);
320
+ });
297
321
  this._cachedFeatureStoreLayers.clear();
298
322
  }
299
323
  }
@@ -310,9 +334,9 @@ class ClippingObject {
310
334
 
311
335
  if (!this.layerNames.includes(layerName)) {
312
336
  this.layerNames.push(layerName);
313
- const layer = this._layerCollection ?
314
- this._layerCollection.getByKey(layerName) :
315
- null;
337
+ const layer = this._layerCollection
338
+ ? this._layerCollection.getByKey(layerName)
339
+ : null;
316
340
  // XXX active state is not part of this yet
317
341
  if (layer && layer.active) {
318
342
  this.handleLayerChanged(layer);
@@ -349,11 +373,15 @@ class ClippingObject {
349
373
  check(layerName, String);
350
374
  check(entityId, String);
351
375
 
352
- if (!this.entities.find(eo => eo.layerName === layerName && eo.entityId === entityId)) {
376
+ if (
377
+ !this.entities.find(
378
+ (eo) => eo.layerName === layerName && eo.entityId === entityId,
379
+ )
380
+ ) {
353
381
  this.entities.push({ layerName, entityId });
354
- const layer = this._layerCollection ?
355
- this._layerCollection.getByKey(layerName) :
356
- null;
382
+ const layer = this._layerCollection
383
+ ? this._layerCollection.getByKey(layerName)
384
+ : null;
357
385
  if (layer && layer.active) {
358
386
  this.handleLayerChanged(layer);
359
387
  }
@@ -370,7 +398,9 @@ class ClippingObject {
370
398
  check(layerName, String);
371
399
  check(entityId, String);
372
400
 
373
- const index = this.entities.findIndex(c => c.layerName === layerName && c.entityId === entityId);
401
+ const index = this.entities.findIndex(
402
+ (c) => c.layerName === layerName && c.entityId === entityId,
403
+ );
374
404
  if (index > -1) {
375
405
  this.entities.splice(index, 1);
376
406
  }
@@ -1,7 +1,10 @@
1
1
  import { check } from '@vcsuite/check';
2
- import { clearClippingPlanes, setClippingPlanes } from './clippingPlaneHelper.js';
2
+ import {
3
+ clearClippingPlanes,
4
+ setClippingPlanes,
5
+ } from './clippingPlaneHelper.js';
3
6
  import ClippingObject from './clippingObject.js';
4
- import CesiumMap from '../../maps/cesium.js';
7
+ import CesiumMap from '../../map/cesiumMap.js';
5
8
 
6
9
  /**
7
10
  * ClippingObjectManager, a singleton Class for managing [ClippingObjects]{@link ClippingObject}. The manager takes care to only apply a
@@ -12,12 +15,11 @@ import CesiumMap from '../../maps/cesium.js';
12
15
  * overwritten in the order they where added to the manager. Exclusive [ClippingObjects]{@link ClippingObject} are always applied last, even
13
16
  * if a default [ClippingObject]{@link ClippingObject} is added after.
14
17
  * @class
15
- * @export
16
18
  * @api stable
17
19
  */
18
20
  class ClippingObjectManager {
19
21
  static get className() {
20
- return 'vcs.vcm.util.clipping.ClippingObjectManager';
22
+ return 'ClippingObjectManager';
21
23
  }
22
24
 
23
25
  constructor(layerCollection) {
@@ -32,7 +34,7 @@ class ClippingObjectManager {
32
34
  */
33
35
  this._exclusiveClippingObjects = null;
34
36
  /**
35
- * @type {Map<(import("@vcmap/cesium").Globe|import("@vcmap/cesium").Entity|import("@vcmap/cesium").Cesium3DTileset), ClippingObject>}
37
+ * @type {Map<(import("@vcmap-cesium/engine").Globe|import("@vcmap-cesium/engine").Entity|import("@vcmap-cesium/engine").Cesium3DTileset), ClippingObject>}
36
38
  * @private
37
39
  */
38
40
  this._targetsMap = new Map();
@@ -68,9 +70,10 @@ class ClippingObjectManager {
68
70
  * @type {Function}
69
71
  * @private
70
72
  */
71
- this._layerChangedListener = this._layerCollection.stateChanged.addEventListener((layer) => {
72
- this._layerChanged(layer);
73
- });
73
+ this._layerChangedListener =
74
+ this._layerCollection.stateChanged.addEventListener((layer) => {
75
+ this._layerChanged(layer);
76
+ });
74
77
  }
75
78
 
76
79
  /**
@@ -101,9 +104,13 @@ class ClippingObjectManager {
101
104
  */
102
105
  _layerChanged(layer) {
103
106
  this.suspendUpdate = true;
104
- this._defaultClippingObjects.forEach((co) => { co.handleLayerChanged(layer); });
107
+ this._defaultClippingObjects.forEach((co) => {
108
+ co.handleLayerChanged(layer);
109
+ });
105
110
  if (this._exclusiveClippingObjects) {
106
- this._exclusiveClippingObjects.forEach((co) => { co.handleLayerChanged(layer); });
111
+ this._exclusiveClippingObjects.forEach((co) => {
112
+ co.handleLayerChanged(layer);
113
+ });
107
114
  }
108
115
  this.suspendUpdate = false;
109
116
  }
@@ -113,9 +120,13 @@ class ClippingObjectManager {
113
120
  */
114
121
  mapActivated(map) {
115
122
  this.suspendUpdate = true;
116
- this._defaultClippingObjects.forEach((co) => { co.handleMapChanged(map); });
123
+ this._defaultClippingObjects.forEach((co) => {
124
+ co.handleMapChanged(map);
125
+ });
117
126
  if (this._exclusiveClippingObjects) {
118
- this._exclusiveClippingObjects.forEach((co) => { co.handleMapChanged(map); });
127
+ this._exclusiveClippingObjects.forEach((co) => {
128
+ co.handleMapChanged(map);
129
+ });
119
130
  }
120
131
  this.suspendUpdate = false;
121
132
  this._activeMap = map;
@@ -145,7 +156,9 @@ class ClippingObjectManager {
145
156
 
146
157
  this._listenersMap.set(clippingObject, [
147
158
  clippingObject.targetsUpdated.addEventListener(this._update.bind(this)),
148
- clippingObject.clippingPlaneUpdated.addEventListener(this._clippingPlaneUpdated.bind(this, clippingObject)),
159
+ clippingObject.clippingPlaneUpdated.addEventListener(
160
+ this._clippingPlaneUpdated.bind(this, clippingObject),
161
+ ),
149
162
  ]);
150
163
  this._update();
151
164
  }
@@ -160,7 +173,9 @@ class ClippingObjectManager {
160
173
 
161
174
  if (this._defaultClippingObjects.has(clippingObject)) {
162
175
  this._defaultClippingObjects.delete(clippingObject);
163
- this._listenersMap.get(clippingObject).forEach((cb) => { cb(); });
176
+ this._listenersMap.get(clippingObject).forEach((cb) => {
177
+ cb();
178
+ });
164
179
  this._listenersMap.delete(clippingObject);
165
180
  this._update();
166
181
  }
@@ -175,8 +190,13 @@ class ClippingObjectManager {
175
190
  hasClippingObject(clippingObject) {
176
191
  check(clippingObject, ClippingObject);
177
192
 
178
- return this._defaultClippingObjects.has(clippingObject) ||
179
- !!(this._exclusiveClippingObjects && this._exclusiveClippingObjects.includes(clippingObject));
193
+ return (
194
+ this._defaultClippingObjects.has(clippingObject) ||
195
+ !!(
196
+ this._exclusiveClippingObjects &&
197
+ this._exclusiveClippingObjects.includes(clippingObject)
198
+ )
199
+ );
180
200
  }
181
201
 
182
202
  /**
@@ -194,8 +214,10 @@ class ClippingObjectManager {
194
214
  check(clippingObjects, [ClippingObject]);
195
215
  check(removedCb, Function);
196
216
 
197
- if (clippingObjects.find(co => this._defaultClippingObjects.has(co))) {
198
- throw new Error('Some ClippingObjects are already managed, remove them first');
217
+ if (clippingObjects.find((co) => this._defaultClippingObjects.has(co))) {
218
+ throw new Error(
219
+ 'Some ClippingObjects are already managed, remove them first',
220
+ );
199
221
  }
200
222
 
201
223
  this._clearExclusiveClippingObjects();
@@ -209,7 +231,9 @@ class ClippingObjectManager {
209
231
  }
210
232
  this._listenersMap.set(clippingObject, [
211
233
  clippingObject.targetsUpdated.addEventListener(this._update.bind(this)),
212
- clippingObject.clippingPlaneUpdated.addEventListener(this._clippingPlaneUpdated.bind(this, clippingObject)),
234
+ clippingObject.clippingPlaneUpdated.addEventListener(
235
+ this._clippingPlaneUpdated.bind(this, clippingObject),
236
+ ),
213
237
  ]);
214
238
  });
215
239
  this._update();
@@ -222,7 +246,9 @@ class ClippingObjectManager {
222
246
  _clearExclusiveClippingObjects(silent) {
223
247
  if (this._exclusiveClippingObjects) {
224
248
  this._exclusiveClippingObjects.forEach((cp) => {
225
- this._listenersMap.get(cp).forEach((cb) => { cb(); });
249
+ this._listenersMap.get(cp).forEach((cb) => {
250
+ cb();
251
+ });
226
252
  this._listenersMap.delete(cp);
227
253
  });
228
254
  this._exclusiveClippingObjects = null;
@@ -270,7 +296,9 @@ class ClippingObjectManager {
270
296
  this._exclusiveClippingObjects.forEach(setTargets);
271
297
  }
272
298
 
273
- currentTargets.forEach((t) => { clearClippingPlanes(t); });
299
+ currentTargets.forEach((t) => {
300
+ clearClippingPlanes(t);
301
+ });
274
302
  this._targetsMap.forEach((clippingObject, target) => {
275
303
  if (clippingObject.clippingPlaneCollection) {
276
304
  setClippingPlanes(
@@ -288,7 +316,10 @@ class ClippingObjectManager {
288
316
  */
289
317
  _clippingPlaneUpdated(clippingObject) {
290
318
  this._targetsMap.forEach((setClippingObject, target) => {
291
- if (setClippingObject === clippingObject && clippingObject.clippingPlaneCollection) {
319
+ if (
320
+ setClippingObject === clippingObject &&
321
+ clippingObject.clippingPlaneCollection
322
+ ) {
292
323
  setClippingPlanes(target, clippingObject.clippingPlaneCollection);
293
324
  }
294
325
  });
@@ -299,7 +330,9 @@ class ClippingObjectManager {
299
330
  */
300
331
  destroy() {
301
332
  this._listenersMap.forEach((listeners) => {
302
- listeners.forEach((cb) => { cb(); });
333
+ listeners.forEach((cb) => {
334
+ cb();
335
+ });
303
336
  });
304
337
  this._layerChangedListener();
305
338
  this._listenersMap.clear();