@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,74 +1,53 @@
1
- import { EntityCollection } from '@vcmap/cesium';
1
+ import { EntityCollection } from '@vcmap-cesium/engine';
2
2
  import Layer from './layer.js';
3
- import CesiumMap from '../maps/cesium.js';
4
- import DataSourceCesium from './cesium/dataSourceCesium.js';
3
+ import CesiumMap from '../map/cesiumMap.js';
4
+ import DataSourceCesiumImpl from './cesium/dataSourceCesiumImpl.js';
5
5
  import { vcsLayerName } from './layerSymbols.js';
6
- import FeatureVisibility, { FeatureVisibilityAction } from './featureVisibility.js';
7
- import { getGlobalHider } from './globalHider.js';
8
- import { VcsClassRegistry } from '../classRegistry.js';
9
-
10
- /**
11
- * @typedef {LayerOptions} DataSourceOptions
12
- * @property {Object|undefined} genericFeatureProperties
13
- * @api
14
- */
6
+ import FeatureVisibility, {
7
+ FeatureVisibilityAction,
8
+ } from './featureVisibility.js';
9
+ import { layerClassRegistry } from '../classRegistry.js';
15
10
 
16
11
  /**
17
12
  * @typedef {Object} DataSourcePickedObject
18
- * @property {import("@vcmap/cesium").Entity} id
13
+ * @property {import("@vcmap-cesium/engine").Entity} id
19
14
  * @property {ClickPosition} clickedPosition
20
15
  * @property {Object} attributes
21
16
  */
22
17
 
23
18
  /**
24
19
  * @typedef {LayerImplementationOptions} DataSourceImplementationOptions
25
- * @property {import("@vcmap/cesium").EntityCollection} entities
26
- * @property {import("@vcmap/cesium").DataSourceClock|undefined} clock
20
+ * @property {import("@vcmap-cesium/engine").EntityCollection} entities
21
+ * @property {import("@vcmap-cesium/engine").DataSourceClock|undefined} clock
27
22
  * @api
28
23
  */
29
24
 
30
25
  /**
31
26
  * Represents a layer of Cesium.Entity
32
27
  * @class
33
- * @export
34
28
  * @extends {Layer}
35
29
  * @api stable
36
30
  */
37
- class DataSource extends Layer {
38
- static get className() { return 'vcs.vcm.layer.DataSource'; }
39
-
40
- /**
41
- * @returns {DataSourceOptions}
42
- */
43
- static getDefaultOptions() {
44
- return {
45
- ...Layer.getDefaultOptions(),
46
- genericFeatureProperties: {},
47
- };
31
+ class DataSourceLayer extends Layer {
32
+ static get className() {
33
+ return 'DataSourceLayer';
48
34
  }
49
35
 
50
36
  /**
51
- * @param {DataSourceOptions} options
37
+ * @param {LayerOptions} options
52
38
  */
53
39
  constructor(options) {
54
40
  super(options);
55
- const defaultOptions = DataSource.getDefaultOptions();
56
41
  /**
57
42
  * The entities of this layer. Use the `addEntity` API to add Enitities to ensure interoperability with vcm interfaces
58
- * @type {import("@vcmap/cesium").EntityCollection}
43
+ * @type {import("@vcmap-cesium/engine").EntityCollection}
59
44
  * @api
60
45
  */
61
46
  this.entities = new EntityCollection();
62
47
  /**
63
- * @type {import("@vcmap/cesium").DataSourceClock|undefined}
48
+ * @type {import("@vcmap-cesium/engine").DataSourceClock|undefined}
64
49
  */
65
50
  this.clock = undefined;
66
- /**
67
- * @type {Object}
68
- * @private
69
- */
70
- this._genericFeatureProperties = options.genericFeatureProperties || defaultOptions.genericFeatureProperties;
71
-
72
51
  /**
73
52
  * The feature visibility of this layer. NOTE: Entities cannot be highlighted at this moment.
74
53
  * @type {FeatureVisibility}
@@ -81,9 +60,15 @@ class DataSource extends Layer {
81
60
  */
82
61
  this._featureVisibilityListeners = [];
83
62
 
84
- this._supportedMaps = [
85
- CesiumMap.className,
86
- ];
63
+ this._supportedMaps = [CesiumMap.className];
64
+ }
65
+
66
+ /**
67
+ * @param {import("@vcmap/core").GlobalHider} globalHider
68
+ */
69
+ setGlobalHider(globalHider) {
70
+ super.setGlobalHider(globalHider);
71
+ this._setUpFeatureVisibility();
87
72
  }
88
73
 
89
74
  /**
@@ -91,7 +76,10 @@ class DataSource extends Layer {
91
76
  * @private
92
77
  */
93
78
  _setUpFeatureVisibility() {
94
- const globalHider = getGlobalHider();
79
+ this._featureVisibilityListeners.forEach((cb) => {
80
+ cb();
81
+ });
82
+
95
83
  this._featureVisibilityListeners = [
96
84
  this.featureVisibility.changed.addEventListener(({ action, ids }) => {
97
85
  if (action === FeatureVisibilityAction.HIDE) {
@@ -103,28 +91,32 @@ class DataSource extends Layer {
103
91
  });
104
92
  } // highlight is _possible_ but very tricky with all the possible entity values with potential materials
105
93
  }),
106
- globalHider.changed.addEventListener(({ action, ids }) => {
107
- if (action === FeatureVisibilityAction.HIDE) {
108
- ids.forEach((id) => {
109
- const entity = this.entities.getById(id);
110
- if (entity) {
111
- globalHider.addFeature(id, entity);
112
- }
113
- });
114
- }
115
- }),
116
94
  this.entities.collectionChanged.addEventListener((c, added) => {
117
95
  added.forEach((entity) => {
118
96
  if (this.featureVisibility.hiddenObjects[entity.id]) {
119
97
  this.featureVisibility.addHiddenFeature(entity.id, entity);
120
98
  }
121
-
122
- if (globalHider.hiddenObjects[entity.id]) {
123
- globalHider.addFeature(entity.id, entity);
99
+ if (this.globalHider && this.globalHider.hiddenObjects[entity.id]) {
100
+ this.globalHider.addFeature(entity.id, entity);
124
101
  }
125
102
  });
126
103
  }),
127
104
  ];
105
+
106
+ if (this.globalHider) {
107
+ this._featureVisibilityListeners.push(
108
+ this.globalHider.changed.addEventListener(({ action, ids }) => {
109
+ if (action === FeatureVisibilityAction.HIDE) {
110
+ ids.forEach((id) => {
111
+ const entity = this.entities.getById(id);
112
+ if (entity) {
113
+ this.globalHider.addFeature(id, entity);
114
+ }
115
+ });
116
+ }
117
+ }),
118
+ );
119
+ }
128
120
  }
129
121
 
130
122
  /**
@@ -151,18 +143,18 @@ class DataSource extends Layer {
151
143
 
152
144
  /**
153
145
  * @param {CesiumMap} map
154
- * @returns {Array<DataSourceCesium>}
146
+ * @returns {Array<DataSourceCesiumImpl>}
155
147
  */
156
148
  createImplementationsForMap(map) {
157
149
  if (map instanceof CesiumMap) {
158
- return [new DataSourceCesium(map, this.getImplementationOptions())];
150
+ return [new DataSourceCesiumImpl(map, this.getImplementationOptions())];
159
151
  }
160
152
  return [];
161
153
  }
162
154
 
163
155
  /**
164
156
  * adds an entity
165
- * @param {import("@vcmap/cesium").Entity.ConstructorOptions|import("@vcmap/cesium").Entity} options - Cesium Entity options or the entity
157
+ * @param {import("@vcmap-cesium/engine").Entity.ConstructorOptions|import("@vcmap-cesium/engine").Entity} options - Cesium Entity options or the entity
166
158
  * @param {?Object=} attributes - a set of properties, typically used for rendering a balloon
167
159
  * @param {boolean=} allowPicking - whether to override the layers allowPicking setting for this entity
168
160
  * @returns {null|string} the entities id
@@ -183,7 +175,7 @@ class DataSource extends Layer {
183
175
  */
184
176
  flyToEntity(id) {
185
177
  this.getImplementations().forEach((impl) => {
186
- /** @type {DataSourceCesium} */ (impl).flyToEntity(id);
178
+ /** @type {DataSourceCesiumImpl} */ (impl).flyToEntity(id);
187
179
  });
188
180
  }
189
181
 
@@ -214,46 +206,19 @@ class DataSource extends Layer {
214
206
  return null;
215
207
  }
216
208
 
217
- /**
218
- * @param {DataSourcePickedObject} object
219
- * @returns {GenericFeature}
220
- */
221
- getGenericFeatureFromClickedObject(object) {
222
- const attributes = { ...this._genericFeatureProperties, ...object.attributes || {} };
223
- return {
224
- layerName: this.name,
225
- layerClass: this.className,
226
- attributes,
227
- longitude: object.clickedPosition.longitude,
228
- latitude: object.clickedPosition.latitude,
229
- height: object.clickedPosition.height,
230
- relativeToGround: false,
231
- };
232
- }
233
-
234
- /**
235
- * @inheritDoc
236
- * @returns {DataSourceOptions}
237
- */
238
- toJSON() {
239
- const config = /** @type {DataSourceOptions} */ (super.toJSON());
240
- if (Object.keys(this._genericFeatureProperties).length > 0) {
241
- config.genericFeatureProperties = { ...this._genericFeatureProperties };
242
- }
243
- return config;
244
- }
245
-
246
209
  /**
247
210
  * @inheritDoc
248
211
  */
249
212
  destroy() {
250
213
  this.entities.removeAll();
251
- this._featureVisibilityListeners.forEach((cb) => { cb(); });
214
+ this._featureVisibilityListeners.forEach((cb) => {
215
+ cb();
216
+ });
252
217
  this._featureVisibilityListeners = [];
253
218
  this.featureVisibility.destroy();
254
219
  super.destroy();
255
220
  }
256
221
  }
257
222
 
258
- VcsClassRegistry.registerClass(DataSource.className, DataSource);
259
- export default DataSource;
223
+ layerClassRegistry.registerClass(DataSourceLayer.className, DataSourceLayer);
224
+ export default DataSourceLayer;
@@ -2,27 +2,28 @@ import Style from 'ol/style/Style.js';
2
2
 
3
3
  import { check } from '@vcsuite/check';
4
4
  import { parseInteger } from '@vcsuite/parsers';
5
+ import { SplitDirection } from '@vcmap-cesium/engine';
5
6
  import Layer from './layer.js';
6
- import StyleItem, { referenceableStyleSymbol } from '../util/style/styleItem.js';
7
- import VectorStyleItem from '../util/style/vectorStyleItem.js';
7
+ import StyleItem from '../style/styleItem.js';
8
+ import VectorStyleItem from '../style/vectorStyleItem.js';
8
9
  import FeatureVisibility from './featureVisibility.js';
9
- import { getStyleOrDefaultStyle } from '../util/style/styleFactory.js';
10
- import VcsEvent from '../event/vcsEvent.js';
11
- import { styleCollection } from '../globalCollections.js';
12
- import { VcsClassRegistry } from '../classRegistry.js';
10
+ import { getStyleOrDefaultStyle } from '../style/styleFactory.js';
11
+ import VcsEvent from '../vcsEvent.js';
12
+ import { layerClassRegistry } from '../classRegistry.js';
13
13
 
14
14
  /**
15
15
  * @typedef {LayerOptions} FeatureLayerOptions
16
- * @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|string|undefined} style
17
- * @property {string|undefined} activeStyleName - vcs:undocumented
18
- * @property {Object|undefined} genericFeatureProperties - properties to add to generic features, eg for display in the balloon
16
+ * @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|undefined} style
19
17
  * @property {number} [balloonHeightOffset=10]
18
+ * @property {string|undefined} splitDirection - either 'left' or 'right', if omitted none is applied (for 3D Vector currently only Models are split-able)
20
19
  * @property {FeatureVisibility|undefined} featureVisibility - vcs:undocumented
21
20
  * @api
22
21
  */
23
22
 
24
23
  /**
25
24
  * @typedef {LayerImplementationOptions} FeatureLayerImplementationOptions
25
+ * @property {import("@vcmap/core").GlobalHider} globalHider
26
+ * @property {import("@vcmap-cesium/engine").SplitDirection} splitDirection
26
27
  * @property {FeatureVisibility} featureVisibility
27
28
  * @property {import("@vcmap/core").StyleItem} style
28
29
  * @api
@@ -39,19 +40,22 @@ import { VcsClassRegistry } from '../classRegistry.js';
39
40
  /**
40
41
  * @typedef {import("@vcmap/core").LayerImplementation<import("@vcmap/core").VcsMap>} FeatureLayerImplementation
41
42
  * @property {function(import("@vcmap/core").StyleItem, boolean=):void} updateStyle
43
+ * @property {function(import("@vcmap-cesium/engine").SplitDirection):void} updateSplitDirection
42
44
  */
43
45
 
44
46
  /**
45
- * Base class for all layers representing features, e.g. Vector, Buildings, POIs
47
+ * Base class for all layers representing features, e.g. VectorLayer, Buildings, POIs
46
48
  * @class
47
49
  * @abstract
48
50
  * @extends {Layer}
49
- * @export
51
+ * @implements {SplitLayer}
50
52
  * @api
51
53
  */
52
54
  class FeatureLayer extends Layer {
53
55
  /** @type {string} */
54
- static get className() { return 'vcs.vcm.layer.FeatureLayer'; }
56
+ static get className() {
57
+ return 'FeatureLayer';
58
+ }
55
59
 
56
60
  /**
57
61
  * @returns {FeatureLayerOptions}
@@ -61,7 +65,7 @@ class FeatureLayer extends Layer {
61
65
  ...Layer.getDefaultOptions(),
62
66
  style: undefined,
63
67
  balloonHeightOffset: 10,
64
- genericFeatureProperties: {},
68
+ splitDirection: undefined,
65
69
  };
66
70
  }
67
71
 
@@ -76,7 +80,7 @@ class FeatureLayer extends Layer {
76
80
  * @type {import("@vcmap/core").StyleItem}
77
81
  * @private
78
82
  */
79
- this._style = this.getStyleOrDefaultStyle(options.activeStyleName || options.style);
83
+ this._style = this.getStyleOrDefaultStyle(options.style);
80
84
  /**
81
85
  * @type {import("@vcmap/core").StyleItem}
82
86
  * @private
@@ -88,24 +92,37 @@ class FeatureLayer extends Layer {
88
92
  * @api
89
93
  */
90
94
  this.styleChanged = new VcsEvent();
91
- /**
92
- * @type {Object}
93
- * @private
94
- */
95
- this._genericFeatureProperties = options.genericFeatureProperties || defaultOptions.genericFeatureProperties;
96
-
97
95
  /**
98
96
  * a height offset for rendering of a balloon for a feature of this layer.
99
97
  * @type {number}
100
98
  * @api
101
99
  */
102
- this.balloonHeightOffset = parseInteger(options.balloonHeightOffset, defaultOptions.balloonHeightOffset);
100
+ this.balloonHeightOffset = parseInteger(
101
+ options.balloonHeightOffset,
102
+ defaultOptions.balloonHeightOffset,
103
+ );
104
+ /** @type {import("@vcmap-cesium/engine").SplitDirection} */
105
+ this._splitDirection = SplitDirection.NONE;
106
+
107
+ if (options.splitDirection) {
108
+ this._splitDirection =
109
+ options.splitDirection === 'left'
110
+ ? SplitDirection.LEFT
111
+ : SplitDirection.RIGHT;
112
+ }
103
113
 
114
+ /**
115
+ * raised if the split direction changes, is passed the split direction as its only argument
116
+ * @type {VcsEvent<import("@vcmap-cesium/engine").SplitDirection>}
117
+ * @api
118
+ */
119
+ this.splitDirectionChanged = new VcsEvent();
104
120
  /**
105
121
  * FeatureVisibility tracks the highlighting and hiding of features on this layer
106
122
  * @type {FeatureVisibility}
107
123
  */
108
- this.featureVisibility = options.featureVisibility || new FeatureVisibility();
124
+ this.featureVisibility =
125
+ options.featureVisibility || new FeatureVisibility();
109
126
  }
110
127
 
111
128
  /**
@@ -129,12 +146,27 @@ class FeatureLayer extends Layer {
129
146
  }
130
147
 
131
148
  /**
132
- * Generic properties to be added to each feature. Use assignGenericFeatureProperties to change them.
133
- * @type {Object}
134
- * @readonly
149
+ * @api
150
+ * The splitDirection to be applied - for 3D vector features currently only working on points with a Model
151
+ * @type {import("@vcmap-cesium/engine").SplitDirection}
152
+ */
153
+ get splitDirection() {
154
+ return this._splitDirection;
155
+ }
156
+
157
+ /**
158
+ * @param {import("@vcmap-cesium/engine").SplitDirection} direction
135
159
  */
136
- get genericFeatureProperties() {
137
- return this._genericFeatureProperties;
160
+ set splitDirection(direction) {
161
+ if (direction !== this._splitDirection) {
162
+ this.getImplementations().forEach((impl) => {
163
+ /** @type {FeatureLayerImplementation} */ (impl).updateSplitDirection(
164
+ direction,
165
+ );
166
+ });
167
+ this._splitDirection = direction;
168
+ this.splitDirectionChanged.raiseEvent(this._splitDirection);
169
+ }
138
170
  }
139
171
 
140
172
  /**
@@ -143,44 +175,33 @@ class FeatureLayer extends Layer {
143
175
  getImplementationOptions() {
144
176
  return {
145
177
  ...super.getImplementationOptions(),
178
+ globalHider: this.globalHider,
146
179
  featureVisibility: this.featureVisibility,
147
180
  style: this.style,
181
+ splitDirection: this.splitDirection,
148
182
  };
149
183
  }
150
184
 
151
185
  /**
152
- * @param {Object|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap/cesium").Cesium3DTilePointFeature|import("@vcmap/cesium").Cesium3DTileFeature|DataSourcePickedObject} object
153
- * @returns {?Object}
186
+ * @param {import("@vcmap/core").GlobalHider} globalHider
154
187
  */
155
- // eslint-disable-next-line no-unused-vars,class-methods-use-this
156
- objectClickedHandler(object) { // XXX remove after event implementation
157
- return null;
188
+ setGlobalHider(globalHider) {
189
+ super.setGlobalHider(globalHider);
190
+ this.forceRedraw();
158
191
  }
159
192
 
160
193
  /**
161
- * This is called by the selectBehavior to create generic features from clicked objects
162
- * needs to be implemented by each layer which has clickable objects
163
- * @param {Object|VectorClickedObject|import("ol").Feature<import("ol/geom/Geometry").default>} object
164
- * @returns {GenericFeature}
194
+ * @param {Object|import("ol").Feature<import("ol/geom/Geometry").default>|import("@vcmap-cesium/engine").Cesium3DTilePointFeature|import("@vcmap-cesium/engine").Cesium3DTileFeature|DataSourcePickedObject} object
195
+ * @returns {?Object}
165
196
  */
166
- // eslint-disable-next-line no-unused-vars
167
- getGenericFeatureFromClickedObject(object) { // XXX remove after event implementation
168
- this.getLogger().warning('This method should be implemented by any specific layers');
197
+ // eslint-disable-next-line no-unused-vars,class-methods-use-this
198
+ objectClickedHandler(object) {
199
+ // XXX remove after event implementation
169
200
  return null;
170
201
  }
171
202
 
172
203
  /**
173
- * Set properties, which are always added to the generic object, eg. for use in balloons
174
- * @param {Object} properties
175
- * @api
176
- */
177
- assignGenericFeatureProperties(properties) {
178
- check(properties, Object);
179
- Object.assign(this._genericFeatureProperties, properties);
180
- }
181
-
182
- /**
183
- * @param {(Reference|DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|string)=} styleOptions
204
+ * @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
184
205
  * @param {(import("@vcmap/core").VectorStyleItem|import("@vcmap/core").DeclarativeStyleItem)=} defaultStyle
185
206
  * @returns {import("@vcmap/core").StyleItem}
186
207
  */
@@ -191,30 +212,27 @@ class FeatureLayer extends Layer {
191
212
 
192
213
  /**
193
214
  * Sets the style based on a styleName on a layer
194
- * @param {string|import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
215
+ * @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
195
216
  * @param {boolean=} silent
196
217
  * @api
197
218
  */
198
219
  setStyle(style, silent) {
199
- check(style, [Style, StyleItem, Function, String]);
220
+ check(style, [Style, StyleItem, Function]);
200
221
 
201
- if (typeof style === 'string') {
202
- const styleItem = styleCollection.getByKey(style);
203
- if (!styleItem) {
204
- this.getLogger().warning(`could not find style with name ${style}`);
205
- return;
206
- }
207
- this._style = styleItem;
208
- } else if (style instanceof StyleItem) {
222
+ if (style instanceof StyleItem) {
209
223
  this._style = style;
210
224
  } else {
211
225
  this._style = new VectorStyleItem({});
212
- this._style.style = /** @type {import("ol/style/Style").default} */ (style);
226
+ this._style.style = /** @type {import("ol/style/Style").default} */ (
227
+ style
228
+ );
213
229
  }
214
- this.getImplementations()
215
- .forEach((impl) => {
216
- /** @type {FeatureLayerImplementation} */ (impl).updateStyle(this._style, silent);
217
- });
230
+ this.getImplementations().forEach((impl) => {
231
+ /** @type {FeatureLayerImplementation} */ (impl).updateStyle(
232
+ this._style,
233
+ silent,
234
+ );
235
+ });
218
236
  this.styleChanged.raiseEvent(this._style);
219
237
  }
220
238
 
@@ -232,15 +250,11 @@ class FeatureLayer extends Layer {
232
250
  toJSON() {
233
251
  const config = /** @type {FeatureLayerOptions} */ (super.toJSON());
234
252
  if (!this.getStyleOrDefaultStyle().equals(this._style)) {
235
- if (this._style[referenceableStyleSymbol]) {
236
- config.style = this.style.getReference();
237
- } else {
238
- config.style = this.style.getOptions();
239
- }
253
+ config.style = this.style.toJSON();
240
254
  }
241
-
242
- if (Object.keys(this._genericFeatureProperties).length > 0) {
243
- config.genericFeatureProperties = { ...this._genericFeatureProperties };
255
+ if (this._splitDirection !== SplitDirection.NONE) {
256
+ config.splitDirection =
257
+ this._splitDirection === SplitDirection.RIGHT ? 'right' : 'left';
244
258
  }
245
259
  return config;
246
260
  }
@@ -253,9 +267,10 @@ class FeatureLayer extends Layer {
253
267
  this.featureVisibility.destroy();
254
268
  }
255
269
  this.styleChanged.destroy();
270
+ this.splitDirectionChanged.destroy();
256
271
  super.destroy();
257
272
  }
258
273
  }
259
274
 
260
- VcsClassRegistry.registerClass(FeatureLayer.className, FeatureLayer);
275
+ layerClassRegistry.registerClass(FeatureLayer.className, FeatureLayer);
261
276
  export default FeatureLayer;