@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,29 +1,17 @@
1
- import { check } from '@vcsuite/check';
1
+ import { check, checkMaybe } from '@vcsuite/check';
2
2
  import { parseBoolean, parseInteger } from '@vcsuite/parsers';
3
- import VcsObject from '../object.js';
3
+ import VcsObject from '../vcsObject.js';
4
4
  import Extent from '../util/extent.js';
5
- import { getGlobalHider } from './globalHider.js';
6
5
  import { vcsLayerName } from './layerSymbols.js';
7
6
  import LayerState from './layerState.js';
8
- import VcsEvent from '../event/vcsEvent.js';
9
- import { getCurrentLocale, getLocaleChangedEvent } from '../util/locale.js';
10
- import { VcsClassRegistry } from '../classRegistry.js';
11
-
12
- /**
13
- * @typedef {Object} GenericFeature
14
- * @property {number} longitude
15
- * @property {number} latitude
16
- * @property {number} height
17
- * @property {string} layerName
18
- * @property {string} layerClass
19
- * @property {any} attributes
20
- * @property {boolean} relativeToGround
21
- */
7
+ import VcsEvent from '../vcsEvent.js';
8
+ import { layerClassRegistry } from '../classRegistry.js';
9
+ import GlobalHider from './globalHider.js';
22
10
 
23
11
  /**
24
12
  * @typedef {import("@vcmap/core").Layer} SplitLayer
25
- * @property {import("@vcmap/cesium").ImagerySplitDirection} splitDirection
26
- * @property {VcsEvent<import("@vcmap/cesium").ImagerySplitDirection>} splitDirectionChanged
13
+ * @property {import("@vcmap-cesium/engine").SplitDirection} splitDirection
14
+ * @property {VcsEvent<import("@vcmap-cesium/engine").SplitDirection>} splitDirectionChanged
27
15
  */
28
16
 
29
17
  /**
@@ -38,11 +26,12 @@ import { VcsClassRegistry } from '../classRegistry.js';
38
26
  /**
39
27
  * @typedef {VectorPropertiesOptions} VcsMeta
40
28
  * @property {string|undefined} version - the version of the vcsMeta schema
41
- * @property {VectorStyleItemOptions|DeclarativeStyleItemOptions|Reference|undefined} style
29
+ * @property {VectorStyleItemOptions|DeclarativeStyleItemOptions|undefined} style
42
30
  * @property {Array<string>|undefined} embeddedIcons
43
31
  * @property {number|undefined} screenSpaceError
44
32
  * @property {*|undefined} flightOptions
45
33
  * @property {string|undefined} baseUrl
34
+ * @property {Object|undefined} [layerProperties] - the layers properties bag
46
35
  * @api
47
36
  */
48
37
 
@@ -69,6 +58,12 @@ import { VcsClassRegistry } from '../classRegistry.js';
69
58
  * @api
70
59
  */
71
60
 
61
+ /**
62
+ * @typedef {LayerImplementationOptions} SplitLayerImplementationOptions
63
+ * @property {import("@vcmap-cesium/engine").SplitDirection} splitDirection
64
+ * @api
65
+ */
66
+
72
67
  /**
73
68
  * Layer implementations for the {@link CesiumMap} map
74
69
  * @namespace cesium
@@ -92,7 +87,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
92
87
  * @type {string}
93
88
  * @const
94
89
  */
95
- export const vcsMetaVersion = '2.0';
90
+ export const vcsMetaVersion = '2.1';
96
91
 
97
92
  /**
98
93
  * Abstract base class for Layers.
@@ -100,20 +95,23 @@ export const vcsMetaVersion = '2.0';
100
95
  * To receive implementation options, implement `geImplementationOptions`
101
96
  * @abstract
102
97
  * @class
103
- * @export
104
98
  * @extends {VcsObject}
105
99
  * @api stable
106
100
  */
107
101
  class Layer extends VcsObject {
108
102
  /** @type {string} */
109
- static get className() { return 'vcs.vcm.layer.Layer'; }
103
+ static get className() {
104
+ return 'Layer';
105
+ }
110
106
 
111
107
  /**
112
108
  * Symbol to declare a layers name on its visualizations, e.g. ol.layer.Layer, Cesium.Cesium3DTileset
113
109
  * @type {symbol}
114
110
  * @api
115
111
  */
116
- static get vcsLayerNameSymbol() { return vcsLayerName; }
112
+ static get vcsLayerNameSymbol() {
113
+ return vcsLayerName;
114
+ }
117
115
 
118
116
  /** @returns {LayerOptions} */
119
117
  static getDefaultOptions() {
@@ -149,12 +147,18 @@ class Layer extends VcsObject {
149
147
  * @type {boolean}
150
148
  * @api
151
149
  */
152
- this.activeOnStartup = parseBoolean(options.activeOnStartup, defaultOptions.activeOnStartup);
150
+ this.activeOnStartup = parseBoolean(
151
+ options.activeOnStartup,
152
+ defaultOptions.activeOnStartup,
153
+ );
153
154
  /**
154
155
  * @type {boolean}
155
156
  * @private
156
157
  */
157
- this._allowPicking = parseBoolean(options.allowPicking, defaultOptions.allowPicking);
158
+ this._allowPicking = parseBoolean(
159
+ options.allowPicking,
160
+ defaultOptions.allowPicking,
161
+ );
158
162
  /**
159
163
  * @type {LayerState}
160
164
  * @private
@@ -188,16 +192,10 @@ class Layer extends VcsObject {
188
192
 
189
193
  /**
190
194
  * @type {string|Object}
191
- * @private
195
+ * @protected
192
196
  */
193
197
  this._url = options.url;
194
198
 
195
- /**
196
- * @type {Function}
197
- * @private
198
- */
199
- this._localeChangedListener = null;
200
-
201
199
  /**
202
200
  * @type {number}
203
201
  * @private
@@ -214,19 +212,26 @@ class Layer extends VcsObject {
214
212
  /**
215
213
  * array of object Ids which should be hidden within the context of the layers layerCollection, if this layer is active
216
214
  * @type {Array.<string>}
215
+ * @private
217
216
  * @api
218
217
  */
219
- this.hiddenObjectIds = Array.isArray(options.hiddenObjectIds) ?
220
- options.hiddenObjectIds :
221
- defaultOptions.hiddenObjectIds;
218
+ this._hiddenObjectIds = Array.isArray(options.hiddenObjectIds)
219
+ ? options.hiddenObjectIds
220
+ : defaultOptions.hiddenObjectIds;
221
+
222
+ /**
223
+ * @type {import("@vcmap/core").GlobalHider|null}
224
+ * @private
225
+ */
226
+ this._globalHider = null;
222
227
 
223
228
  /**
224
229
  * @type {Array<string|symbol>}
225
230
  * @private
226
231
  */
227
- this._exclusiveGroups = Array.isArray(options.exclusiveGroups) ?
228
- options.exclusiveGroups.slice() :
229
- defaultOptions.exclusiveGroups;
232
+ this._exclusiveGroups = Array.isArray(options.exclusiveGroups)
233
+ ? options.exclusiveGroups.slice()
234
+ : defaultOptions.exclusiveGroups;
230
235
 
231
236
  /**
232
237
  * event raised if the exclusives group of the layer changes. is passed the array of exclusive groups as its only argument
@@ -235,9 +240,6 @@ class Layer extends VcsObject {
235
240
  */
236
241
  this.exclusiveGroupsChanged = new VcsEvent();
237
242
 
238
- /** @type {import("@vcmap/core").GlobalHider} */
239
- this.globalHider = getGlobalHider();
240
-
241
243
  /**
242
244
  * @type {CopyrightOptions|undefined}
243
245
  */
@@ -268,6 +270,12 @@ class Layer extends VcsObject {
268
270
  * @api
269
271
  */
270
272
  this.featureProvider = undefined;
273
+
274
+ /**
275
+ * @type {string}
276
+ * @private
277
+ */
278
+ this._locale = 'en';
271
279
  }
272
280
 
273
281
  /**
@@ -332,9 +340,8 @@ class Layer extends VcsObject {
332
340
  if (typeof this._url === 'string') {
333
341
  return this._url;
334
342
  }
335
- const locale = getCurrentLocale();
336
- if (this._url[locale]) {
337
- return this._url[locale];
343
+ if (this._url[this._locale]) {
344
+ return this._url[this._locale];
338
345
  }
339
346
  return Object.values(this._url)[0];
340
347
  }
@@ -353,6 +360,45 @@ class Layer extends VcsObject {
353
360
  }
354
361
  }
355
362
 
363
+ /**
364
+ * @type {Array<string>}
365
+ */
366
+ get hiddenObjectIds() {
367
+ return this._hiddenObjectIds;
368
+ }
369
+
370
+ /**
371
+ * @param {Array<string>} hiddenObjectIds
372
+ */
373
+ set hiddenObjectIds(hiddenObjectIds) {
374
+ check(hiddenObjectIds, [String]);
375
+
376
+ if (this._globalHider && this.active) {
377
+ this._globalHider.hideObjects(hiddenObjectIds);
378
+ }
379
+ this._hiddenObjectIds = hiddenObjectIds;
380
+ }
381
+
382
+ /**
383
+ * @type {import("@vcmap/core").GlobalHider|null}
384
+ * @readonly
385
+ */
386
+ get globalHider() {
387
+ return this._globalHider;
388
+ }
389
+
390
+ /**
391
+ * @param {import("@vcmap/core").GlobalHider} globalHider
392
+ */
393
+ setGlobalHider(globalHider) {
394
+ checkMaybe(globalHider, GlobalHider);
395
+
396
+ if (globalHider && this.active) {
397
+ globalHider.hideObjects(this.hiddenObjectIds);
398
+ }
399
+ this._globalHider = globalHider;
400
+ }
401
+
356
402
  /**
357
403
  * Indicates, that this layer is part of an exclusiveGroup
358
404
  * @api
@@ -381,7 +427,7 @@ class Layer extends VcsObject {
381
427
 
382
428
  if (
383
429
  groups.length !== this._exclusiveGroups.length ||
384
- !groups.every(g => this._exclusiveGroups.includes(g))
430
+ !groups.every((g) => this._exclusiveGroups.includes(g))
385
431
  ) {
386
432
  this._exclusiveGroups = groups.slice();
387
433
  this.exclusiveGroupsChanged.raiseEvent(groups);
@@ -392,7 +438,9 @@ class Layer extends VcsObject {
392
438
  * @type {number}
393
439
  * @api
394
440
  */
395
- get zIndex() { return this._zIndex; }
441
+ get zIndex() {
442
+ return this._zIndex;
443
+ }
396
444
 
397
445
  /**
398
446
  * @param {number} index
@@ -406,6 +454,33 @@ class Layer extends VcsObject {
406
454
  }
407
455
  }
408
456
 
457
+ /**
458
+ * returns the currently set locale. Can be used to provide locale specific URLs.
459
+ * @type {string}
460
+ */
461
+ get locale() {
462
+ return this._locale;
463
+ }
464
+
465
+ /**
466
+ * sets the locale and reloads the layer the if the URL is a locale aware Object.
467
+ * @param {string} value
468
+ */
469
+ set locale(value) {
470
+ check(value, String);
471
+
472
+ if (this._locale !== value) {
473
+ this._locale = value;
474
+ if (
475
+ this._url &&
476
+ typeof this._url === 'object' &&
477
+ this._url[this._locale]
478
+ ) {
479
+ this.reload();
480
+ }
481
+ }
482
+ }
483
+
409
484
  /**
410
485
  * creates an array of layer implementations for the given map.
411
486
  * @param {import("@vcmap/core").VcsMap} map Map
@@ -501,25 +576,11 @@ class Layer extends VcsObject {
501
576
  return null;
502
577
  }
503
578
 
504
- /**
505
- * recreates the implementations on locale change, if the url of this layer is an Object
506
- * @param {string} locale
507
- * @private
508
- */
509
- _handleLocaleChange(locale) {
510
- if (this._url && typeof this._url === 'object' && this._url[locale]) {
511
- this.reload();
512
- }
513
- }
514
-
515
579
  /**
516
580
  * initializes the layer, can be used to defer loading
517
581
  * @returns {Promise<void>}
518
582
  */
519
583
  initialize() {
520
- if (!this.initialized) {
521
- this._localeChangedListener = getLocaleChangedEvent().addEventListener(this._handleLocaleChange.bind(this));
522
- }
523
584
  this._initialized = true;
524
585
  return Promise.resolve();
525
586
  }
@@ -531,7 +592,9 @@ class Layer extends VcsObject {
531
592
  * @returns {Promise<void>}
532
593
  */
533
594
  async mapActivated(map) {
534
- this.getLogger().debug(`Layer: ${this.name} mapActivated is called from Map: ${map.name}`);
595
+ this.getLogger().debug(
596
+ `Layer: ${this.name} mapActivated is called from Map: ${map.name}`,
597
+ );
535
598
  this._activeMaps.add(map);
536
599
  if (this.active || (this.loading && this.initialized)) {
537
600
  await this._activateImplsForMap(map);
@@ -544,13 +607,14 @@ class Layer extends VcsObject {
544
607
  * @param {import("@vcmap/core").VcsMap} map
545
608
  */
546
609
  mapDeactivated(map) {
547
- this.getLogger().debug(`Layer: ${this.name} mapDeactivated is called from Map: ${map.name}`);
610
+ this.getLogger().debug(
611
+ `Layer: ${this.name} mapDeactivated is called from Map: ${map.name}`,
612
+ );
548
613
  this._activeMaps.delete(map);
549
614
  if (this.active || this.loading) {
550
- this.getImplementationsForMap(map)
551
- .forEach((impl) => {
552
- impl.deactivate();
553
- });
615
+ this.getImplementationsForMap(map).forEach((impl) => {
616
+ impl.deactivate();
617
+ });
554
618
  }
555
619
  }
556
620
 
@@ -561,10 +625,9 @@ class Layer extends VcsObject {
561
625
  */
562
626
  removedFromMap(map) {
563
627
  this._activeMaps.delete(map);
564
- this.getImplementationsForMap(map)
565
- .forEach((impl) => {
566
- impl.destroy();
567
- });
628
+ this.getImplementationsForMap(map).forEach((impl) => {
629
+ impl.destroy();
630
+ });
568
631
  this._implementations.delete(map);
569
632
  }
570
633
 
@@ -575,9 +638,11 @@ class Layer extends VcsObject {
575
638
  * @api stable
576
639
  */
577
640
  isSupported(map) {
578
- return map &&
641
+ return (
642
+ map &&
579
643
  this._supportedMaps.includes(map.className) &&
580
- (this.mapNames.length === 0 || this.mapNames.indexOf(map.name) >= 0);
644
+ (this.mapNames.length === 0 || this.mapNames.indexOf(map.name) >= 0)
645
+ );
581
646
  }
582
647
 
583
648
  /**
@@ -588,12 +653,16 @@ class Layer extends VcsObject {
588
653
  async _activateImplsForMap(map) {
589
654
  const impls = this.getImplementationsForMap(map);
590
655
  try {
591
- await Promise.all(impls.map(i => i.activate()));
656
+ await Promise.all(impls.map((i) => i.activate()));
592
657
  } catch (err) {
593
- this.getLogger().error(`Layer ${this.name} could not activate impl for map ${map.name}`);
658
+ this.getLogger().error(
659
+ `Layer ${this.name} could not activate impl for map ${map.name}`,
660
+ );
594
661
  this.getLogger().error(err);
595
662
  this._implementations.set(map, []);
596
- impls.forEach((i) => { i.destroy(); });
663
+ impls.forEach((i) => {
664
+ i.destroy();
665
+ });
597
666
  }
598
667
  }
599
668
 
@@ -606,23 +675,31 @@ class Layer extends VcsObject {
606
675
  try {
607
676
  this.stateChanged.raiseEvent(LayerState.LOADING);
608
677
  } catch (e) {
609
- this.getLogger().debug(`Error on raising LayerState.LOADING event for layer ${this.name} : ${e.message}`);
678
+ this.getLogger().debug(
679
+ `Error on raising LayerState.LOADING event for layer ${this.name} : ${e.message}`,
680
+ );
610
681
  }
611
682
  await this.initialize();
612
683
  if (this._state !== LayerState.LOADING) {
613
684
  return;
614
685
  }
615
686
 
616
- await Promise.all([...this._activeMaps].map(m => this._activateImplsForMap(m)));
687
+ await Promise.all(
688
+ [...this._activeMaps].map((m) => this._activateImplsForMap(m)),
689
+ );
617
690
  if (this._state !== LayerState.LOADING) {
618
691
  return;
619
692
  }
620
- this.globalHider.hideObjects(this.hiddenObjectIds);
693
+ if (this._globalHider) {
694
+ this._globalHider.hideObjects(this.hiddenObjectIds);
695
+ }
621
696
  this._state = LayerState.ACTIVE;
622
697
  try {
623
698
  this.stateChanged.raiseEvent(LayerState.ACTIVE);
624
699
  } catch (e) {
625
- this.getLogger().debug(`Error on raising LayerState.ACTIVE event for layer ${this.name} : ${e.message}`);
700
+ this.getLogger().debug(
701
+ `Error on raising LayerState.ACTIVE event for layer ${this.name} : ${e.message}`,
702
+ );
626
703
  }
627
704
  this._loadingPromise = null;
628
705
  }
@@ -641,11 +718,10 @@ class Layer extends VcsObject {
641
718
  }
642
719
 
643
720
  if (this._state === LayerState.INACTIVE) {
644
- this._loadingPromise = this._activate()
645
- .catch((err) => {
646
- this._state = LayerState.INACTIVE;
647
- return Promise.reject(err);
648
- });
721
+ this._loadingPromise = this._activate().catch((err) => {
722
+ this._state = LayerState.INACTIVE;
723
+ return Promise.reject(err);
724
+ });
649
725
  return this._loadingPromise;
650
726
  }
651
727
 
@@ -667,12 +743,16 @@ class Layer extends VcsObject {
667
743
  impl.deactivate();
668
744
  }
669
745
  });
670
- this.globalHider.showObjects(this.hiddenObjectIds);
746
+ if (this._globalHider) {
747
+ this._globalHider.showObjects(this.hiddenObjectIds);
748
+ }
671
749
  this._state = LayerState.INACTIVE;
672
750
  try {
673
751
  this.stateChanged.raiseEvent(LayerState.INACTIVE);
674
752
  } catch (e) {
675
- this.getLogger().debug(`Error on raising LayerState.INACTIVE event for layer ${this.name} : ${e.message}`);
753
+ this.getLogger().debug(
754
+ `Error on raising LayerState.INACTIVE event for layer ${this.name} : ${e.message}`,
755
+ );
676
756
  }
677
757
  }
678
758
  }
@@ -731,15 +811,10 @@ class Layer extends VcsObject {
731
811
  }
732
812
 
733
813
  this._activeMaps.clear();
734
- this.getImplementations()
735
- .forEach((impl) => {
736
- impl.destroy();
737
- });
814
+ this.getImplementations().forEach((impl) => {
815
+ impl.destroy();
816
+ });
738
817
 
739
- if (this._localeChangedListener) {
740
- this._localeChangedListener();
741
- this._localeChangedListener = null;
742
- }
743
818
  this._initialized = false;
744
819
  this._implementations.clear();
745
820
  this.stateChanged.destroy();
@@ -748,5 +823,5 @@ class Layer extends VcsObject {
748
823
  }
749
824
  }
750
825
 
751
- VcsClassRegistry.registerClass(Layer.className, Layer);
826
+ layerClassRegistry.registerClass(Layer.className, Layer);
752
827
  export default Layer;
@@ -1,17 +1,18 @@
1
- import VcsObject from '../object.js';
1
+ import VcsObject from '../vcsObject.js';
2
2
  import LayerState from './layerState.js';
3
3
 
4
4
  /**
5
5
  * represents an implementation for a Layer for a specific Map
6
6
  * @class
7
- * @export
8
7
  * @extends {VcsObject}
9
8
  * @abstract
10
9
  * @api
11
10
  * @template {import("@vcmap/core").VcsMap} T
12
11
  */
13
12
  class LayerImplementation extends VcsObject {
14
- static get className() { return 'vcs.vcm.layer.LayerImplementation'; }
13
+ static get className() {
14
+ return 'LayerImplementation';
15
+ }
15
16
 
16
17
  /**
17
18
  * @param {T} map
@@ -43,19 +44,25 @@ class LayerImplementation extends VcsObject {
43
44
  * @type {boolean}
44
45
  * @readonly
45
46
  */
46
- get initialized() { return this._initialized; }
47
+ get initialized() {
48
+ return this._initialized;
49
+ }
47
50
 
48
51
  /**
49
52
  * @type {boolean}
50
53
  * @api
51
54
  */
52
- get active() { return this._state === LayerState.ACTIVE; }
55
+ get active() {
56
+ return this._state === LayerState.ACTIVE;
57
+ }
53
58
 
54
59
  /**
55
60
  * @type {boolean}
56
61
  * @api
57
62
  */
58
- get loading() { return this._state === LayerState.LOADING; }
63
+ get loading() {
64
+ return this._state === LayerState.LOADING;
65
+ }
59
66
 
60
67
  /**
61
68
  * interface to initialize this implementation, is used to setup elements which have to be created only once.
@@ -2,7 +2,6 @@
2
2
  * Enumeration of possible layer states.
3
3
  * State machine: inactive <-> loading -> active -> inactive
4
4
  * @enum {number}
5
- * @export
6
5
  * @api
7
6
  * @property {number} INACTIVE
8
7
  * @property {number} ACTIVE
@@ -1,6 +1,7 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+
1
3
  /**
2
4
  * @type {symbol}
3
5
  * @const
4
6
  */
5
- // eslint-disable-next-line import/prefer-default-export
6
7
  export const vcsLayerName = Symbol('vcsLayerName');
@@ -3,12 +3,12 @@ import { vcsLayerName } from '../layerSymbols.js';
3
3
 
4
4
  /**
5
5
  * @class
6
- * @extends {LayerImplementation<import("@vcmap/core").Oblique>}}
6
+ * @extends {LayerImplementation<import("@vcmap/core").ObliqueMap>}}
7
7
  * @abstract
8
8
  */
9
- class LayerOblique extends LayerImplementation {
9
+ class LayerObliqueImpl extends LayerImplementation {
10
10
  /**
11
- * @param {import("@vcmap/core").Oblique} map
11
+ * @param {import("@vcmap/core").ObliqueMap} map
12
12
  * @param {LayerImplementationOptions} options
13
13
  */
14
14
  constructor(map, options) {
@@ -59,7 +59,9 @@ class LayerOblique extends LayerImplementation {
59
59
  * @returns {import("ol/layer").Layer<import("ol/source/Source").default>}
60
60
  */
61
61
  // eslint-disable-next-line class-methods-use-this
62
- getOLLayer() { throw new Error(); }
62
+ getOLLayer() {
63
+ throw new Error();
64
+ }
63
65
 
64
66
  /**
65
67
  * @inheritDoc
@@ -73,4 +75,4 @@ class LayerOblique extends LayerImplementation {
73
75
  }
74
76
  }
75
77
 
76
- export default LayerOblique;
78
+ export default LayerObliqueImpl;