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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +12 -5
  3. package/build/postinstall.js +14 -3
  4. package/index.d.ts +3477 -2007
  5. package/index.js +169 -131
  6. package/package.json +25 -27
  7. package/src/category/category.js +483 -0
  8. package/src/category/categoryCollection.js +153 -0
  9. package/src/cesium/cesium3DTileFeature.js +2 -2
  10. package/src/cesium/cesium3DTilePointFeature.js +1 -1
  11. package/src/cesium/cesiumVcsCameraPrimitive.js +16 -8
  12. package/src/cesium/entity.js +29 -0
  13. package/src/cesium/wallpaperMaterial.js +5 -3
  14. package/src/classRegistry.js +169 -0
  15. package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +49 -46
  16. package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +13 -5
  17. package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +56 -26
  18. package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +33 -21
  19. package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +40 -21
  20. package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +131 -26
  21. package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +108 -53
  22. package/src/interaction/featureProviderInteraction.js +58 -0
  23. package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +40 -41
  24. package/src/{vcs/vcm/interaction → interaction}/interactionType.js +24 -31
  25. package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +67 -55
  26. package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +33 -8
  27. package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +24 -13
  28. package/src/layer/cesium/openStreetMapCesiumImpl.js +32 -0
  29. package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +12 -9
  30. package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +19 -9
  31. package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +6 -6
  32. package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +21 -10
  33. package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +93 -35
  34. package/src/layer/cesium/vectorContext.js +363 -0
  35. package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +21 -13
  36. package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +58 -21
  37. package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +20 -9
  38. package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +24 -13
  39. package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +6 -3
  40. package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +71 -108
  41. package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +23 -20
  42. package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +55 -90
  43. package/src/{vcs/vcm/layer → layer}/featureLayer.js +89 -74
  44. package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +197 -150
  45. package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +150 -92
  46. package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
  47. package/src/{vcs/vcm/layer → layer}/featureVisibility.js +114 -82
  48. package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +84 -69
  49. package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +30 -27
  50. package/src/{vcs/vcm/layer → layer}/globalHider.js +25 -39
  51. package/src/{vcs/vcm/layer → layer}/layer.js +171 -96
  52. package/src/{vcs/vcm/layer → layer}/layerImplementation.js +13 -6
  53. package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
  54. package/src/{vcs/vcm/layer → layer}/layerSymbols.js +2 -1
  55. package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +7 -5
  56. package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +76 -31
  57. package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +198 -80
  58. package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +59 -40
  59. package/src/layer/openlayers/layerOpenlayersImpl.js +165 -0
  60. package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +28 -0
  61. package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +44 -0
  62. package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +8 -7
  63. package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +7 -6
  64. package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +12 -10
  65. package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +21 -12
  66. package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +18 -12
  67. package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +9 -8
  68. package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +19 -12
  69. package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +42 -39
  70. package/src/{vcs/vcm/layer → layer}/rasterLayer.js +86 -37
  71. package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +25 -22
  72. package/src/layer/terrainHelpers.js +98 -0
  73. package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +26 -18
  74. package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +13 -8
  75. package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +51 -8
  76. package/src/layer/tileProvider/staticGeojsonTileProvider.js +87 -0
  77. package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +200 -89
  78. package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +54 -13
  79. package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +22 -22
  80. package/src/layer/vectorHelpers.js +129 -0
  81. package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +124 -94
  82. package/src/{vcs/vcm/layer → layer}/vectorProperties.js +419 -107
  83. package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +11 -1
  84. package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +181 -116
  85. package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +33 -23
  86. package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +14 -7
  87. package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +53 -32
  88. package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +56 -42
  89. package/src/{vcs/vcm/maps → map}/baseOLMap.js +83 -35
  90. package/src/{vcs/vcm/maps → map}/cameraLimiter.js +75 -32
  91. package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +429 -276
  92. package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
  93. package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +132 -97
  94. package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +69 -45
  95. package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +118 -46
  96. package/src/oblique/defaultObliqueCollection.js +62 -0
  97. package/src/{vcs/vcm/oblique → oblique}/helpers.js +221 -78
  98. package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +145 -54
  99. package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +62 -32
  100. package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +58 -26
  101. package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +9 -9
  102. package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +85 -35
  103. package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +45 -5
  104. package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +3 -5
  105. package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +62 -28
  106. package/src/ol/feature.js +34 -1
  107. package/src/ol/geom/circle.js +14 -5
  108. package/src/ol/geom/geometryCollection.js +14 -8
  109. package/src/ol/render/canvas/canvasTileRenderer.js +11 -10
  110. package/src/overrideClassRegistry.js +214 -0
  111. package/src/style/arcStyle.js +453 -0
  112. package/src/style/arrowStyle.js +304 -0
  113. package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +147 -82
  114. package/src/{vcs/vcm/util/style → style}/shapesCategory.js +8 -8
  115. package/src/style/styleFactory.js +32 -0
  116. package/src/{vcs/vcm/util/style → style}/styleHelpers.js +24 -26
  117. package/src/style/styleItem.js +174 -0
  118. package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +230 -156
  119. package/src/{vcs/vcm/util/style → style}/writeStyle.js +7 -12
  120. package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +84 -52
  121. package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +56 -23
  122. package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +149 -88
  123. package/src/{vcs/vcm/util → util}/collection.js +28 -10
  124. package/src/util/editor/createFeatureSession.js +195 -0
  125. package/src/util/editor/editFeaturesSession.js +325 -0
  126. package/src/util/editor/editGeometrySession.js +452 -0
  127. package/src/util/editor/editorHelpers.js +300 -0
  128. package/src/util/editor/editorSessionHelpers.js +132 -0
  129. package/src/util/editor/editorSymbols.js +21 -0
  130. package/src/util/editor/interactions/createBBoxInteraction.js +154 -0
  131. package/src/util/editor/interactions/createCircleInteraction.js +119 -0
  132. package/src/util/editor/interactions/createLineStringInteraction.js +119 -0
  133. package/src/util/editor/interactions/createPointInteraction.js +73 -0
  134. package/src/util/editor/interactions/createPolygonInteraction.js +136 -0
  135. package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +88 -0
  136. package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +119 -0
  137. package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +50 -0
  138. package/src/util/editor/interactions/insertVertexInteraction.js +103 -0
  139. package/src/util/editor/interactions/mapInteractionController.js +119 -0
  140. package/src/util/editor/interactions/removeVertexInteraction.js +42 -0
  141. package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +152 -0
  142. package/src/util/editor/interactions/selectMultiFeatureInteraction.js +165 -0
  143. package/src/util/editor/interactions/selectSingleFeatureInteraction.js +120 -0
  144. package/src/util/editor/interactions/translateVertexInteraction.js +60 -0
  145. package/src/util/editor/selectFeaturesSession.js +303 -0
  146. package/src/util/editor/transformation/create2DHandlers.js +339 -0
  147. package/src/util/editor/transformation/create3DHandlers.js +678 -0
  148. package/src/util/editor/transformation/extrudeInteraction.js +106 -0
  149. package/src/util/editor/transformation/rotateInteraction.js +201 -0
  150. package/src/util/editor/transformation/scaleInteraction.js +201 -0
  151. package/src/util/editor/transformation/transformationHandler.js +178 -0
  152. package/src/util/editor/transformation/transformationTypes.js +88 -0
  153. package/src/util/editor/transformation/translateInteraction.js +263 -0
  154. package/src/util/editor/validateGeoemetry.js +24 -0
  155. package/src/{vcs/vcm/util → util}/exclusiveManager.js +6 -3
  156. package/src/{vcs/vcm/util → util}/extent.js +26 -20
  157. package/src/util/featureconverter/arcToCesium.js +121 -0
  158. package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +70 -37
  159. package/src/{vcs/vcm/util → util}/featureconverter/convert.js +94 -16
  160. package/src/util/featureconverter/extent3D.js +284 -0
  161. package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +253 -94
  162. package/src/util/featureconverter/lineStringToCesium.js +343 -0
  163. package/src/util/featureconverter/pointHelpers.js +413 -0
  164. package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +157 -107
  165. package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +57 -24
  166. package/src/util/fetch.js +34 -0
  167. package/src/{vcs/vcm/util → util}/geometryHelpers.js +25 -17
  168. package/src/{vcs/vcm/util → util}/indexedCollection.js +27 -8
  169. package/src/{vcs/vcm/util → util}/isMobile.js +8 -2
  170. package/src/{vcs/vcm/util → util}/layerCollection.js +109 -19
  171. package/src/util/locale.js +12 -0
  172. package/src/{vcs/vcm/util → util}/mapCollection.js +170 -63
  173. package/src/util/math.js +193 -0
  174. package/src/util/overrideCollection.js +261 -0
  175. package/src/{vcs/vcm/util → util}/projection.js +23 -31
  176. package/src/{vcs/vcm/util → util}/urlHelpers.js +5 -3
  177. package/src/{vcs/vcm/util → util}/viewpoint.js +83 -57
  178. package/src/vcsApp.js +657 -0
  179. package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -3
  180. package/src/vcsModule.js +130 -0
  181. package/src/vcsModuleHelpers.js +136 -0
  182. package/src/{vcs/vcm/object.js → vcsObject.js} +3 -10
  183. package/tests/data/dynamicPointCzml.json +53 -0
  184. package/tests/data/oblique/imageData/imagev34.json +136 -0
  185. package/tests/data/oblique/imageData/imagev35.json +307 -0
  186. package/tests/data/oblique/imageData/imagev35PerImageSize.json +333 -0
  187. package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -0
  188. package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -0
  189. package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -0
  190. package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -0
  191. package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -0
  192. package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -0
  193. package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -0
  194. package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -0
  195. package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -0
  196. package/tests/data/oblique/tiledImageData/image.json +70 -0
  197. package/tests/data/terrain/13/8800/6485.terrain +0 -0
  198. package/tests/data/terrain/13/8800/6486.terrain +0 -0
  199. package/tests/data/terrain/13/8801/6485.terrain +0 -0
  200. package/tests/data/terrain/13/8801/6486.terrain +0 -0
  201. package/tests/data/terrain/layer.json +127 -0
  202. package/tests/data/testGeoJSON.json +149 -0
  203. package/tests/data/tile.pbf +0 -0
  204. package/tests/unit/helpers/cesiumHelpers.js +326 -0
  205. package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
  206. package/tests/unit/helpers/helpers.js +32 -0
  207. package/tests/unit/helpers/imageHelpers.js +24 -0
  208. package/tests/unit/helpers/importJSON.js +15 -0
  209. package/tests/unit/helpers/obliqueData.js +102 -0
  210. package/tests/unit/helpers/obliqueHelpers.js +115 -0
  211. package/tests/unit/helpers/openlayersHelpers.js +25 -0
  212. package/tests/unit/helpers/terrain/terrainData.js +47 -0
  213. package/src/vcs/vcm/classRegistry.js +0 -106
  214. package/src/vcs/vcm/globalCollections.js +0 -11
  215. package/src/vcs/vcm/interaction/featureProviderInteraction.js +0 -54
  216. package/src/vcs/vcm/layer/buildings.js +0 -17
  217. package/src/vcs/vcm/layer/cesium/openStreetMapCesium.js +0 -29
  218. package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
  219. package/src/vcs/vcm/layer/cesium/vectorContext.js +0 -167
  220. package/src/vcs/vcm/layer/openlayers/layerOpenlayers.js +0 -79
  221. package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
  222. package/src/vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js +0 -121
  223. package/src/vcs/vcm/layer/terrainHelpers.js +0 -119
  224. package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
  225. package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
  226. package/src/vcs/vcm/layer/vectorHelpers.js +0 -206
  227. package/src/vcs/vcm/util/dateTime.js +0 -60
  228. package/src/vcs/vcm/util/featureProvider/featureProviderHelpers.js +0 -51
  229. package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
  230. package/src/vcs/vcm/util/featureconverter/lineStringToCesium.js +0 -171
  231. package/src/vcs/vcm/util/locale.js +0 -53
  232. package/src/vcs/vcm/util/math.js +0 -71
  233. package/src/vcs/vcm/util/splitScreen.js +0 -233
  234. package/src/vcs/vcm/util/style/styleFactory.js +0 -48
  235. package/src/vcs/vcm/util/style/styleItem.js +0 -243
  236. /package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
@@ -1,13 +1,13 @@
1
- import { ImagerySplitDirection } from '@vcmap/cesium';
1
+ import { SplitDirection } from '@vcmap-cesium/engine';
2
2
 
3
3
  import { parseNumberRange, parseInteger } from '@vcsuite/parsers';
4
4
  import Layer from './layer.js';
5
- import Openlayers from '../maps/openlayers.js';
6
- import CesiumMap from '../maps/cesium.js';
7
- import OpenStreetMapOpenlayers from './openlayers/openStreetMapOpenlayers.js';
8
- import OpenStreetMapCesium from './cesium/openStreetMapCesium.js';
9
- import VcsEvent from '../event/vcsEvent.js';
10
- import { VcsClassRegistry } from '../classRegistry.js';
5
+ import OpenlayersMap from '../map/openlayersMap.js';
6
+ import CesiumMap from '../map/cesiumMap.js';
7
+ import OpenStreetMapOpenlayersImpl from './openlayers/openStreetMapOpenlayersImpl.js';
8
+ import OpenStreetMapCesiumImpl from './cesium/openStreetMapCesiumImpl.js';
9
+ import VcsEvent from '../vcsEvent.js';
10
+ import { layerClassRegistry } from '../classRegistry.js';
11
11
 
12
12
  /**
13
13
  * @typedef {LayerOptions} OpenStreetMapOptions
@@ -18,15 +18,16 @@ import { VcsClassRegistry } from '../classRegistry.js';
18
18
  */
19
19
 
20
20
  /**
21
- * OpenStreetMap Layer
21
+ * OpenStreetMapLayer Layer
22
22
  * @class
23
- * @export
24
23
  * @extends {Layer}
25
24
  * @api stable
26
25
  * @implements {SplitLayer}
27
26
  */
28
- class OpenStreetMap extends Layer {
29
- static get className() { return 'vcs.vcm.layer.OpenStreetMap'; }
27
+ class OpenStreetMapLayer extends Layer {
28
+ static get className() {
29
+ return 'OpenStreetMapLayer';
30
+ }
30
31
 
31
32
  /**
32
33
  * @returns {OpenStreetMapOptions}
@@ -45,33 +46,36 @@ class OpenStreetMap extends Layer {
45
46
  */
46
47
  constructor(options) {
47
48
  super(options);
48
- const defaultOptions = OpenStreetMap.getDefaultOptions();
49
+ const defaultOptions = OpenStreetMapLayer.getDefaultOptions();
49
50
  /**
50
- * @type {import("@vcmap/cesium").ImagerySplitDirection}
51
+ * @type {import("@vcmap-cesium/engine").SplitDirection}
51
52
  * @private
52
53
  */
53
- this._splitDirection = ImagerySplitDirection.NONE;
54
+ this._splitDirection = SplitDirection.NONE;
54
55
 
55
56
  if (options.splitDirection) {
56
- this._splitDirection = options.splitDirection === 'left' ?
57
- ImagerySplitDirection.LEFT :
58
- ImagerySplitDirection.RIGHT;
57
+ this._splitDirection =
58
+ options.splitDirection === 'left'
59
+ ? SplitDirection.LEFT
60
+ : SplitDirection.RIGHT;
59
61
  }
60
62
 
61
- this._supportedMaps = [
62
- CesiumMap.className,
63
- Openlayers.className,
64
- ];
63
+ this._supportedMaps = [CesiumMap.className, OpenlayersMap.className];
65
64
 
66
65
  /**
67
66
  * @type {number}
68
67
  * @private
69
68
  */
70
- this._opacity = parseNumberRange(options.opacity, defaultOptions.opacity, 0.0, 1.0);
69
+ this._opacity = parseNumberRange(
70
+ options.opacity,
71
+ defaultOptions.opacity,
72
+ 0.0,
73
+ 1.0,
74
+ );
71
75
 
72
76
  /**
73
77
  * raised if the split direction changes, is passed the split direction as its only argument
74
- * @type {VcsEvent<import("@vcmap/cesium").ImagerySplitDirection>}
78
+ * @type {VcsEvent<import("@vcmap-cesium/engine").SplitDirection>}
75
79
  * @api
76
80
  */
77
81
  this.splitDirectionChanged = new VcsEvent();
@@ -86,18 +90,20 @@ class OpenStreetMap extends Layer {
86
90
 
87
91
  /**
88
92
  * @api
89
- * @type {import("@vcmap/cesium").ImagerySplitDirection}
93
+ * @type {import("@vcmap-cesium/engine").SplitDirection}
90
94
  */
91
- get splitDirection() { return this._splitDirection; }
95
+ get splitDirection() {
96
+ return this._splitDirection;
97
+ }
92
98
 
93
99
  /**
94
- * @param {import("@vcmap/cesium").ImagerySplitDirection} direction
100
+ * @param {import("@vcmap-cesium/engine").SplitDirection} direction
95
101
  */
96
102
  set splitDirection(direction) {
97
103
  if (direction !== this._splitDirection) {
98
104
  this._splitDirection = direction;
99
105
  this.getImplementations().forEach((impl) => {
100
- /** @type {OpenStreetMapCesium|OpenStreetMapOpenlayers} */
106
+ /** @type {OpenStreetMapCesiumImpl|OpenStreetMapOpenlayersImpl} */
101
107
  (impl).updateSplitDirection(this._splitDirection);
102
108
  });
103
109
  this.splitDirectionChanged.raiseEvent(this._splitDirection);
@@ -109,7 +115,9 @@ class OpenStreetMap extends Layer {
109
115
  * @api
110
116
  * @type {number}
111
117
  */
112
- get opacity() { return this._opacity; }
118
+ get opacity() {
119
+ return this._opacity;
120
+ }
113
121
 
114
122
  /**
115
123
  * @param {number} opacity
@@ -119,7 +127,7 @@ class OpenStreetMap extends Layer {
119
127
  if (this._opacity !== parsedValue) {
120
128
  this._opacity = parsedValue;
121
129
  this.getImplementations().forEach((impl) => {
122
- /** @type {OpenStreetMapCesium|OpenStreetMapOpenlayers} */
130
+ /** @type {OpenStreetMapCesiumImpl|OpenStreetMapOpenlayersImpl} */
123
131
  (impl).updateOpacity(parsedValue);
124
132
  });
125
133
  }
@@ -143,15 +151,19 @@ class OpenStreetMap extends Layer {
143
151
  /**
144
152
  * @inheritDoc
145
153
  * @param {import("@vcmap/core").VcsMap} map
146
- * @returns {Array<OpenStreetMapOpenlayers|OpenStreetMapCesium>}
154
+ * @returns {Array<OpenStreetMapOpenlayersImpl|OpenStreetMapCesiumImpl>}
147
155
  */
148
156
  createImplementationsForMap(map) {
149
- if (map instanceof Openlayers) {
150
- return [new OpenStreetMapOpenlayers(map, this.getImplementationOptions())];
157
+ if (map instanceof OpenlayersMap) {
158
+ return [
159
+ new OpenStreetMapOpenlayersImpl(map, this.getImplementationOptions()),
160
+ ];
151
161
  }
152
162
 
153
163
  if (map instanceof CesiumMap) {
154
- return [new OpenStreetMapCesium(map, this.getImplementationOptions())];
164
+ return [
165
+ new OpenStreetMapCesiumImpl(map, this.getImplementationOptions()),
166
+ ];
155
167
  }
156
168
  return [];
157
169
  }
@@ -162,12 +174,11 @@ class OpenStreetMap extends Layer {
162
174
  */
163
175
  toJSON() {
164
176
  const config = /** @type {OpenStreetMapOptions} */ (super.toJSON());
165
- const defaultOptions = OpenStreetMap.getDefaultOptions();
177
+ const defaultOptions = OpenStreetMapLayer.getDefaultOptions();
166
178
 
167
- if (this._splitDirection !== ImagerySplitDirection.NONE) {
168
- config.splitDirection = this._splitDirection === ImagerySplitDirection.RIGHT ?
169
- 'right' :
170
- 'left';
179
+ if (this._splitDirection !== SplitDirection.NONE) {
180
+ config.splitDirection =
181
+ this._splitDirection === SplitDirection.RIGHT ? 'right' : 'left';
171
182
  }
172
183
 
173
184
  if (this.opacity !== defaultOptions.opacity) {
@@ -178,6 +189,11 @@ class OpenStreetMap extends Layer {
178
189
  config.maxLevel = this.maxLevel;
179
190
  }
180
191
 
192
+ if (this._splitDirection !== SplitDirection.NONE) {
193
+ config.splitDirection =
194
+ this._splitDirection === SplitDirection.RIGHT ? 'right' : 'left';
195
+ }
196
+
181
197
  return config;
182
198
  }
183
199
 
@@ -190,5 +206,8 @@ class OpenStreetMap extends Layer {
190
206
  }
191
207
  }
192
208
 
193
- VcsClassRegistry.registerClass(OpenStreetMap.className, OpenStreetMap);
194
- export default OpenStreetMap;
209
+ layerClassRegistry.registerClass(
210
+ OpenStreetMapLayer.className,
211
+ OpenStreetMapLayer,
212
+ );
213
+ export default OpenStreetMapLayer;
@@ -0,0 +1,165 @@
1
+ import { SplitDirection } from '@vcmap-cesium/engine';
2
+ import { unByKey } from 'ol/Observable.js';
3
+ import { vcsLayerName } from '../layerSymbols.js';
4
+ import LayerImplementation from '../layerImplementation.js';
5
+
6
+ /**
7
+ * @typedef {LayerImplementationOptions} LayerOpenlayersImplementationOptions
8
+ * @property {import("@vcmap-cesium/engine").SplitDirection} splitDirection
9
+ */
10
+
11
+ /**
12
+ * Layer implementation for {@link OpenlayersMap}.
13
+ * @class
14
+ * @extends {LayerImplementation<import("@vcmap/core").OpenlayersMap>}}
15
+ */
16
+ class LayerOpenlayersImpl extends LayerImplementation {
17
+ static get className() {
18
+ return 'LayerOpenlayersImpl';
19
+ }
20
+
21
+ /**
22
+ * @param {import("@vcmap/core").OpenlayersMap} map
23
+ * @param {LayerOpenlayersImplementationOptions} options
24
+ */
25
+ constructor(map, options) {
26
+ super(map, options);
27
+ /**
28
+ * @type {import("ol/layer").Layer<import("ol/source/Source").default>|null}
29
+ */
30
+ this.olLayer = null;
31
+ /** @type {import("@vcmap-cesium/engine").SplitDirection} */
32
+ this.splitDirection = options.splitDirection;
33
+ /**
34
+ * @type {Array<import("ol/events").EventsKey>|null}
35
+ * @private
36
+ */
37
+ this._splitDirectionRenderListeners = null;
38
+ }
39
+
40
+ /**
41
+ * @inheritDoc
42
+ * @returns {Promise<void>}
43
+ */
44
+ async initialize() {
45
+ if (!this.initialized) {
46
+ this.olLayer = this.getOLLayer();
47
+ this.olLayer[vcsLayerName] = this.name;
48
+ this.map.addOLLayer(this.olLayer);
49
+ }
50
+ await super.initialize();
51
+ this.updateSplitDirection(this.splitDirection);
52
+ }
53
+
54
+ /**
55
+ * @inheritDoc
56
+ * @returns {Promise<void>}
57
+ */
58
+ async activate() {
59
+ await super.activate();
60
+ if (this.active) {
61
+ this.olLayer.setVisible(true);
62
+ }
63
+ }
64
+
65
+ /**
66
+ * @inheritDoc
67
+ */
68
+ deactivate() {
69
+ super.deactivate();
70
+ if (this.olLayer) {
71
+ this.olLayer.setVisible(false);
72
+ }
73
+ }
74
+
75
+ // eslint-disable-next-line jsdoc/require-returns-check
76
+ /**
77
+ * returns the ol Layer
78
+ * @returns {import("ol/layer").Layer<import("ol/source/Source").default>}
79
+ */
80
+ // eslint-disable-next-line class-methods-use-this
81
+ getOLLayer() {
82
+ throw new Error();
83
+ }
84
+
85
+ /**
86
+ * @param {import("@vcmap-cesium/engine").SplitDirection} splitDirection
87
+ */
88
+ updateSplitDirection(splitDirection) {
89
+ this.splitDirection = splitDirection;
90
+ if (this.initialized) {
91
+ if (
92
+ this.splitDirection === SplitDirection.NONE &&
93
+ this._splitDirectionRenderListeners
94
+ ) {
95
+ unByKey(this._splitDirectionRenderListeners);
96
+ this._splitDirectionRenderListeners = null;
97
+ this.olLayer.changed();
98
+ } else if (
99
+ splitDirection !== SplitDirection.NONE &&
100
+ !this._splitDirectionRenderListeners
101
+ ) {
102
+ this._splitDirectionRenderListeners = [];
103
+ this._splitDirectionRenderListeners.push(
104
+ /** @type {import("ol/events").EventsKey} */
105
+ (this.olLayer.on('prerender', this._splitPreRender.bind(this))),
106
+ );
107
+ this._splitDirectionRenderListeners.push(
108
+ /** @type {import("ol/events").EventsKey} */
109
+ (
110
+ this.olLayer.on(
111
+ 'postrender',
112
+ (/** @type {import("ol/render/Event").default} */ event) => {
113
+ /** @type {CanvasRenderingContext2D} */ (
114
+ event.context
115
+ ).restore();
116
+ },
117
+ )
118
+ ),
119
+ );
120
+ this.olLayer.changed();
121
+ }
122
+ }
123
+ }
124
+
125
+ /**
126
+ * @param {import("ol/render/Event").default} event
127
+ * @private
128
+ */
129
+ _splitPreRender(event) {
130
+ // eslint-disable-next-line prefer-destructuring
131
+ const context = /** @type {CanvasRenderingContext2D} */ (event.context);
132
+ const width = context.canvas.width * this.map.splitPosition;
133
+ context.save();
134
+ context.beginPath();
135
+
136
+ if (this.splitDirection === SplitDirection.LEFT) {
137
+ context.rect(0, 0, width, context.canvas.height);
138
+ } else {
139
+ context.rect(
140
+ width,
141
+ 0,
142
+ context.canvas.width - width,
143
+ context.canvas.height,
144
+ );
145
+ }
146
+ context.clip();
147
+ }
148
+
149
+ /**
150
+ * @inheritDoc
151
+ */
152
+ destroy() {
153
+ if (this.olLayer) {
154
+ this.map.removeOLLayer(this.olLayer);
155
+ }
156
+ this.olLayer = null;
157
+ if (this._splitDirectionRenderListeners) {
158
+ unByKey(this._splitDirectionRenderListeners);
159
+ this._splitDirectionRenderListeners = null;
160
+ }
161
+ super.destroy();
162
+ }
163
+ }
164
+
165
+ export default LayerOpenlayersImpl;
@@ -0,0 +1,28 @@
1
+ import Tile from 'ol/layer/Tile.js';
2
+ import OSM from 'ol/source/OSM.js';
3
+ import RasterLayerOpenlayersImpl from './rasterLayerOpenlayersImpl.js';
4
+
5
+ /**
6
+ * represents a specific OpenStreetMapLayer layer for openlayers.
7
+ * @class
8
+ * @extends {RasterLayerOpenlayersImpl}
9
+ */
10
+ class OpenStreetMapOpenlayersImpl extends RasterLayerOpenlayersImpl {
11
+ static get className() {
12
+ return 'OpenStreetMapOpenlayersImpl';
13
+ }
14
+
15
+ /**
16
+ * @returns {import("ol/layer/Tile").default}
17
+ */
18
+ getOLLayer() {
19
+ return new Tile({
20
+ opacity: this.opacity,
21
+ source: new OSM({
22
+ maxZoom: this.maxLevel,
23
+ }),
24
+ });
25
+ }
26
+ }
27
+
28
+ export default OpenStreetMapOpenlayersImpl;
@@ -0,0 +1,44 @@
1
+ import LayerOpenlayersImpl from './layerOpenlayersImpl.js';
2
+
3
+ /**
4
+ * RasterLayer implementation for {@link Openlayers}
5
+ * @class
6
+ * @extends {LayerOpenlayersImpl}
7
+ * @implements {RasterLayerImplementation}
8
+ * @abstract
9
+ */
10
+ class RasterLayerOpenlayersImpl extends LayerOpenlayersImpl {
11
+ static get className() {
12
+ return 'RasterLayerOpenlayersImpl';
13
+ }
14
+
15
+ /**
16
+ * @param {import("@vcmap/core").OpenlayersMap} map
17
+ * @param {RasterLayerImplementationOptions} options
18
+ */
19
+ constructor(map, options) {
20
+ super(map, options);
21
+ /** @type {number} */
22
+ this.minLevel = options.minLevel;
23
+ /** @type {number} */
24
+ this.maxLevel = options.maxLevel;
25
+ /** @type {string} */
26
+ this.tilingSchema = options.tilingSchema;
27
+ /** @type {import("@vcmap/core").Extent} */
28
+ this.extent = options.extent;
29
+ /** @type {number} */
30
+ this.opacity = options.opacity;
31
+ }
32
+
33
+ /**
34
+ * @param {number} opacity
35
+ */
36
+ updateOpacity(opacity) {
37
+ this.opacity = opacity;
38
+ if (this.initialized) {
39
+ this.olLayer.setOpacity(this.opacity);
40
+ }
41
+ }
42
+ }
43
+
44
+ export default RasterLayerOpenlayersImpl;
@@ -1,20 +1,21 @@
1
1
  import ImageLayer from 'ol/layer/Image.js';
2
2
  import ImageStatic from 'ol/source/ImageStatic.js';
3
- import RasterLayerOpenlayers from './rasterLayerOpenlayers.js';
3
+ import RasterLayerOpenlayersImpl from './rasterLayerOpenlayersImpl.js';
4
4
  import { wgs84Projection } from '../../util/projection.js';
5
5
  import { isSameOrigin } from '../../util/urlHelpers.js';
6
6
 
7
7
  /**
8
8
  * represents a specific OpenLayers SingleImageLayer Layer class.
9
9
  * @class
10
- * @export
11
- * @extends {RasterLayerOpenlayers}
10
+ * @extends {RasterLayerOpenlayersImpl}
12
11
  */
13
- class SingleImageOpenlayers extends RasterLayerOpenlayers {
14
- static get className() { return 'vcs.vcm.layer.openlayers.SingleImageOpenlayers'; }
12
+ class SingleImageOpenlayersImpl extends RasterLayerOpenlayersImpl {
13
+ static get className() {
14
+ return 'SingleImageOpenlayersImpl';
15
+ }
15
16
 
16
17
  /**
17
- * @param {import("@vcmap/core").Openlayers} map
18
+ * @param {import("@vcmap/core").OpenlayersMap} map
18
19
  * @param {SingleImageImplementationOptions} options
19
20
  */
20
21
  constructor(map, options) {
@@ -46,4 +47,4 @@ class SingleImageOpenlayers extends RasterLayerOpenlayers {
46
47
  }
47
48
  }
48
49
 
49
- export default SingleImageOpenlayers;
50
+ export default SingleImageOpenlayersImpl;
@@ -1,16 +1,17 @@
1
1
  import Tile from 'ol/layer/Tile.js';
2
2
  import TileDebug from 'ol/source/TileDebug.js';
3
- import LayerOpenlayers from './layerOpenlayers.js';
3
+ import LayerOpenlayersImpl from './layerOpenlayersImpl.js';
4
4
 
5
5
  /**
6
6
  * layer Implementation to render tile boundaries.
7
7
  * @class
8
- * @export
9
- * @extends {LayerOpenlayers}
8
+ * @extends {LayerOpenlayersImpl}
10
9
  * @implements {VectorTileImplementation}
11
10
  */
12
- class TileDebugOpenlayers extends LayerOpenlayers {
13
- static get className() { return 'vcs.vcm.layer.openlayers.TileDebugOpenlayers'; }
11
+ class TileDebugOpenlayersImpl extends LayerOpenlayersImpl {
12
+ static get className() {
13
+ return 'TileDebugOpenlayersImpl';
14
+ }
14
15
 
15
16
  /**
16
17
  * @returns {import("ol/layer/Tile").default}
@@ -36,4 +37,4 @@ class TileDebugOpenlayers extends LayerOpenlayers {
36
37
  updateTiles(args) {}
37
38
  }
38
39
 
39
- export default TileDebugOpenlayers;
40
+ export default TileDebugOpenlayersImpl;
@@ -1,21 +1,22 @@
1
1
  import XYZ from 'ol/source/XYZ.js';
2
2
  import Tile from 'ol/layer/Tile.js';
3
3
  import { mercatorProjection } from '../../util/projection.js';
4
- import RasterLayerOpenlayers from './rasterLayerOpenlayers.js';
4
+ import RasterLayerOpenlayersImpl from './rasterLayerOpenlayersImpl.js';
5
5
  import { TilingScheme } from '../rasterLayer.js';
6
6
  import { isSameOrigin } from '../../util/urlHelpers.js';
7
7
 
8
8
  /**
9
- * TMS implementation for {@link Openlayers}.
9
+ * TmsLayer implementation for {@link Openlayers}.
10
10
  * @class
11
- * @export
12
- * @extends {RasterLayerOpenlayers}
11
+ * @extends {RasterLayerOpenlayersImpl}
13
12
  */
14
- class TMSOpenlayers extends RasterLayerOpenlayers {
15
- static get className() { return 'vcs.vcm.layer.openlayers.TMSOpenlayers'; }
13
+ class TmsOpenlayersImpl extends RasterLayerOpenlayersImpl {
14
+ static get className() {
15
+ return 'TmsOpenlayersImpl';
16
+ }
16
17
 
17
18
  /**
18
- * @param {import("@vcmap/core").Openlayers} map
19
+ * @param {import("@vcmap/core").OpenlayersMap} map
19
20
  * @param {TMSImplementationOptions} options
20
21
  */
21
22
  constructor(map, options) {
@@ -33,7 +34,7 @@ class TMSOpenlayers extends RasterLayerOpenlayers {
33
34
  const sourceOptions = {
34
35
  tileUrlFunction: (tileCoord) => {
35
36
  const baseUrl = this.url.replace(/\/$/, '');
36
- const y = (1 << tileCoord[0]) - (tileCoord[2]) - 1;
37
+ const y = (1 << tileCoord[0]) - tileCoord[2] - 1;
37
38
  return `${baseUrl}/${tileCoord[0]}/${tileCoord[1]}/${y}.${this.format}`;
38
39
  },
39
40
  tileSize: this.tileSize,
@@ -53,10 +54,11 @@ class TMSOpenlayers extends RasterLayerOpenlayers {
53
54
  opacity: this.opacity,
54
55
  };
55
56
  if (this.extent && this.extent.isValid()) {
56
- tileOptions.extent = this.extent.getCoordinatesInProjection(mercatorProjection);
57
+ tileOptions.extent =
58
+ this.extent.getCoordinatesInProjection(mercatorProjection);
57
59
  }
58
60
  return new Tile(tileOptions);
59
61
  }
60
62
  }
61
63
 
62
- export default TMSOpenlayers;
64
+ export default TmsOpenlayersImpl;
@@ -1,20 +1,20 @@
1
1
  import OLVectorLayer from 'ol/layer/Vector.js';
2
- import LayerOpenlayers from './layerOpenlayers.js';
2
+ import LayerOpenlayersImpl from './layerOpenlayersImpl.js';
3
3
  import { synchronizeFeatureVisibilityWithSource } from '../vectorHelpers.js';
4
- import { getGlobalHider } from '../globalHider.js';
5
4
 
6
5
  /**
7
6
  * represents a specific vectorlayer for openlayers.
8
7
  * @class
9
- * @export
10
8
  * @implements {FeatureLayerImplementation}
11
- * @extends {LayerOpenlayers}
9
+ * @extends {LayerOpenlayersImpl}
12
10
  */
13
- class VectorOpenlayers extends LayerOpenlayers {
14
- static get className() { return 'vcs.vcm.layer.openlayers.VectorOpenlayers'; }
11
+ class VectorOpenlayersImpl extends LayerOpenlayersImpl {
12
+ static get className() {
13
+ return 'VectorOpenlayersImpl';
14
+ }
15
15
 
16
16
  /**
17
- * @param {import("@vcmap/core").Openlayers} map
17
+ * @param {import("@vcmap/core").OpenlayersMap} map
18
18
  * @param {VectorImplementationOptions} options
19
19
  */
20
20
  constructor(map, options) {
@@ -36,7 +36,8 @@ class VectorOpenlayers extends LayerOpenlayers {
36
36
  this._featureVisibilityListeners = [];
37
37
  /** @type {import("ol/layer/Vector").default<import("ol/source").Vector<import("ol/geom/Geometry").default>>|null} */
38
38
  this.olLayer = null;
39
- this.globalHider = getGlobalHider();
39
+ /** @type {import("@vcmap/core").GlobalHider} */
40
+ this.globalHider = options.globalHider;
40
41
  }
41
42
 
42
43
  /**
@@ -81,7 +82,11 @@ class VectorOpenlayers extends LayerOpenlayers {
81
82
  if (this.active) {
82
83
  if (this._featureVisibilityListeners.length === 0) {
83
84
  this._featureVisibilityListeners =
84
- synchronizeFeatureVisibilityWithSource(this.featureVisibility, this.source, this.globalHider);
85
+ synchronizeFeatureVisibilityWithSource(
86
+ this.featureVisibility,
87
+ this.source,
88
+ this.globalHider,
89
+ );
85
90
  }
86
91
  }
87
92
  }
@@ -92,7 +97,9 @@ class VectorOpenlayers extends LayerOpenlayers {
92
97
  */
93
98
  deactivate() {
94
99
  super.deactivate();
95
- this._featureVisibilityListeners.forEach((cb) => { cb(); });
100
+ this._featureVisibilityListeners.forEach((cb) => {
101
+ cb();
102
+ });
96
103
  this._featureVisibilityListeners = [];
97
104
  }
98
105
 
@@ -109,10 +116,12 @@ class VectorOpenlayers extends LayerOpenlayers {
109
116
  * @inheritDoc
110
117
  */
111
118
  destroy() {
112
- this._featureVisibilityListeners.forEach((cb) => { cb(); });
119
+ this._featureVisibilityListeners.forEach((cb) => {
120
+ cb();
121
+ });
113
122
  this._featureVisibilityListeners = [];
114
123
  super.destroy();
115
124
  }
116
125
  }
117
126
 
118
- export default VectorOpenlayers;
127
+ export default VectorOpenlayersImpl;