@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,167 +0,0 @@
1
- import { PrimitiveCollection, BillboardCollection, LabelCollection } from '@vcmap/cesium';
2
-
3
- /**
4
- * @typedef {Object} VectorContextFeatureCache
5
- * @property {Array<import("@vcmap/cesium").Primitive|import("@vcmap/cesium").GroundPrimitive|import("@vcmap/cesium").GroundPolylinePrimitive|import("@vcmap/cesium").ClassificationPrimitive|import("@vcmap/cesium").Model>|undefined} primitives
6
- * @property {Array<import("@vcmap/cesium").Billboard|import("@vcmap/cesium").Entity>|undefined} billboards
7
- * @property {Array<import("@vcmap/cesium").Label|import("@vcmap/cesium").Entity>|undefined} labels
8
- */
9
-
10
- /**
11
- * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
12
- * @param {import("@vcmap/cesium").Primitive|import("@vcmap/cesium").GroundPrimitive|import("@vcmap/cesium").GroundPolylinePrimitive|import("@vcmap/cesium").ClassificationPrimitive|import("@vcmap/cesium").Label|import("@vcmap/cesium").Billboard|import("@vcmap/cesium").Entity|import("@vcmap/cesium").Model} primitive
13
- */
14
- export function setReferenceForPicking(feature, primitive) {
15
- primitive.olFeature = feature;
16
- }
17
-
18
- /**
19
- * @param {import("@vcmap/cesium").PrimitiveCollection|import("@vcmap/cesium").BillboardCollection|import("@vcmap/cesium").LabelCollection|import("@vcmap/cesium").EntityCollection=} collection
20
- * @param {Array<import("@vcmap/cesium").Primitive|import("@vcmap/cesium").GroundPrimitive|import("@vcmap/cesium").GroundPolylinePrimitive|import("@vcmap/cesium").ClassificationPrimitive|import("@vcmap/cesium").Billboard|import("@vcmap/cesium").Label|import("@vcmap/cesium").Entity|import("@vcmap/cesium").Model>=} array
21
- */
22
- export function removeArrayFromCollection(collection, array) {
23
- if (array) {
24
- array.forEach((primitive) => {
25
- collection.remove(primitive);
26
- });
27
- }
28
- }
29
-
30
- /**
31
- * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
32
- * @param {Map<import("ol").Feature<import("ol/geom/Geometry").default>, Array<import("@vcmap/cesium").Primitive|import("@vcmap/cesium").GroundPrimitive|import("@vcmap/cesium").GroundPolylinePrimitive|import("@vcmap/cesium").ClassificationPrimitive|import("@vcmap/cesium").Billboard|import("@vcmap/cesium").Label|import("@vcmap/cesium").Entity|import("@vcmap/cesium").Model>>} featuresMap
33
- * @param {import("@vcmap/cesium").PrimitiveCollection|import("@vcmap/cesium").BillboardCollection|import("@vcmap/cesium").LabelCollection|import("@vcmap/cesium").EntityCollection} primitiveCollection
34
- */
35
- export function removeFeatureFromMap(feature, featuresMap, primitiveCollection) {
36
- removeArrayFromCollection(primitiveCollection, featuresMap.get(feature));
37
- featuresMap.delete(feature);
38
- }
39
-
40
- /**
41
- * @param {Array<import("@vcmap/cesium").Primitive|import("@vcmap/cesium").GroundPrimitive|import("@vcmap/cesium").GroundPolylinePrimitive|import("@vcmap/cesium").ClassificationPrimitive|import("@vcmap/cesium").Entity.ConstructorOptions|import("@vcmap/cesium").Model|Object>} primitives
42
- * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
43
- * @param {boolean} allowPicking
44
- * @param {import("@vcmap/cesium").BillboardCollection|import("@vcmap/cesium").LabelCollection|import("@vcmap/cesium").PrimitiveCollection|import("@vcmap/cesium").EntityCollection} primitiveCollection
45
- * @param {Map<import("ol").Feature<import("ol/geom/Geometry").default>, Array<import("@vcmap/cesium").Billboard|import("@vcmap/cesium").Label|import("@vcmap/cesium").Primitive|import("@vcmap/cesium").GroundPrimitive|import("@vcmap/cesium").GroundPolylinePrimitive|import("@vcmap/cesium").ClassificationPrimitive|import("@vcmap/cesium").Entity|import("@vcmap/cesium").Model>>} featureMap
46
- */
47
- export function addPrimitiveToContext(primitives, feature, allowPicking, primitiveCollection, featureMap) {
48
- if (primitives.length) {
49
- const cesiumPrimitives = primitives.map((primitiveOptions) => {
50
- const primitive = primitiveCollection.add(primitiveOptions);
51
- if (allowPicking) {
52
- setReferenceForPicking(feature, primitive);
53
- }
54
- return primitive;
55
- });
56
- if (!featureMap.has(feature)) {
57
- featureMap.set(feature, cesiumPrimitives);
58
- } else {
59
- featureMap.get(feature).push(...cesiumPrimitives);
60
- }
61
- }
62
- }
63
-
64
- /**
65
- * @class
66
- */
67
- class VectorContext {
68
- /**
69
- * @param {import("@vcmap/cesium").Scene} scene
70
- * @param {import("@vcmap/cesium").PrimitiveCollection} rootCollection
71
- */
72
- constructor(scene, rootCollection) {
73
- /** @type {import("@vcmap/cesium").PrimitiveCollection} */
74
- this.primitives = new PrimitiveCollection();
75
- /** @type {import("@vcmap/cesium").BillboardCollection} */
76
- this.billboards = new BillboardCollection({ scene });
77
- /** @type {import("@vcmap/cesium").LabelCollection} */
78
- this.labels = new LabelCollection({ scene });
79
- /** @type {Map<import("ol").Feature<import("ol/geom/Geometry").default>, Array<import("@vcmap/cesium").Primitive|import("@vcmap/cesium").GroundPrimitive|import("@vcmap/cesium").GroundPolylinePrimitive|import("@vcmap/cesium").ClassificationPrimitive|import("@vcmap/cesium").Model>>} */
80
- this.featureToPrimitiveMap = new Map();
81
- /** @type {Map<import("ol").Feature<import("ol/geom/Geometry").default>, Array<import("@vcmap/cesium").Billboard>>} */
82
- this.featureToBillboardMap = new Map();
83
- /** @type {Map<import("ol").Feature<import("ol/geom/Geometry").default>, Array<import("@vcmap/cesium").Label>>} */
84
- this.featureToLabelMap = new Map();
85
-
86
- rootCollection.add(this.primitives);
87
- rootCollection.add(this.billboards);
88
- rootCollection.add(this.labels);
89
- }
90
-
91
- /**
92
- * @param {Array<import("@vcmap/cesium").Primitive|import("@vcmap/cesium").GroundPrimitive|import("@vcmap/cesium").GroundPolylinePrimitive|import("@vcmap/cesium").ClassificationPrimitive|import("@vcmap/cesium").Model>} primitives
93
- * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
94
- * @param {boolean=} allowPicking
95
- */
96
- addPrimitives(primitives, feature, allowPicking) {
97
- addPrimitiveToContext(primitives, feature, allowPicking, this.primitives, this.featureToPrimitiveMap);
98
- }
99
-
100
- /**
101
- * @param {Array<Object>} billboardOptions
102
- * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
103
- * @param {boolean=} allowPicking
104
- */
105
- addBillboards(billboardOptions, feature, allowPicking) {
106
- addPrimitiveToContext(billboardOptions, feature, allowPicking, this.billboards, this.featureToBillboardMap);
107
- }
108
-
109
- /**
110
- * @param {Array<Object>} labelOptions
111
- * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
112
- * @param {boolean=} allowPicking
113
- */
114
- addLabels(labelOptions, feature, allowPicking) {
115
- addPrimitiveToContext(labelOptions, feature, allowPicking, this.labels, this.featureToLabelMap);
116
- }
117
-
118
- /**
119
- * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
120
- */
121
- removeFeature(feature) {
122
- removeFeatureFromMap(feature, this.featureToPrimitiveMap, this.primitives);
123
- removeFeatureFromMap(feature, this.featureToBillboardMap, this.billboards);
124
- removeFeatureFromMap(feature, this.featureToLabelMap, this.labels);
125
- }
126
-
127
- /**
128
- * Caches the current cesium resources for a feature, removing them from the feature map
129
- * @param {import("ol").Feature<import("ol/geom/Geometry").default>}feature
130
- * @returns {VectorContextFeatureCache}
131
- */
132
- createFeatureCache(feature) {
133
- /** @type {VectorContextFeatureCache} */
134
- const cache = {};
135
- cache.primitives = this.featureToPrimitiveMap.get(feature);
136
- this.featureToPrimitiveMap.delete(feature);
137
- cache.billboards = this.featureToBillboardMap.get(feature);
138
- this.featureToBillboardMap.delete(feature);
139
- cache.labels = this.featureToLabelMap.get(feature);
140
- this.featureToLabelMap.delete(feature);
141
- return cache;
142
- }
143
-
144
- /**
145
- * @param {VectorContextFeatureCache} cache
146
- */
147
- clearFeatureCache(cache) {
148
- removeArrayFromCollection(this.primitives, cache.primitives);
149
- removeArrayFromCollection(this.billboards, cache.billboards);
150
- removeArrayFromCollection(this.labels, cache.labels);
151
- }
152
-
153
- /**
154
- * Clears all collections and maps
155
- * @api
156
- */
157
- clear() {
158
- this.primitives.removeAll();
159
- this.billboards.removeAll();
160
- this.labels.removeAll();
161
- this.featureToBillboardMap.clear();
162
- this.featureToLabelMap.clear();
163
- this.featureToPrimitiveMap.clear();
164
- }
165
- }
166
-
167
- export default VectorContext;
@@ -1,79 +0,0 @@
1
- import { vcsLayerName } from '../layerSymbols.js';
2
- import LayerImplementation from '../layerImplementation.js';
3
-
4
- /**
5
- * Layer implementation for {@link CesiumMap}.
6
- * @class
7
- * @export
8
- * @extends {LayerImplementation<import("@vcmap/core").Openlayers>}}
9
- */
10
- class LayerOpenlayers extends LayerImplementation {
11
- static get className() { return 'vcs.vcm.layer.openlayers.LayerOpenlayers'; }
12
-
13
- /**
14
- * @param {import("@vcmap/core").Openlayers} map
15
- * @param {LayerImplementationOptions} options
16
- */
17
- constructor(map, options) {
18
- super(map, options);
19
- /**
20
- * @type {import("ol/layer").Layer<import("ol/source/Source").default>|null}
21
- */
22
- this.olLayer = null;
23
- }
24
-
25
- /**
26
- * @inheritDoc
27
- * @returns {Promise<void>}
28
- */
29
- initialize() {
30
- if (!this.initialized) {
31
- this.olLayer = this.getOLLayer();
32
- this.olLayer[vcsLayerName] = this.name;
33
- this.map.addOLLayer(this.olLayer);
34
- }
35
- return super.initialize();
36
- }
37
-
38
- /**
39
- * @inheritDoc
40
- * @returns {Promise<void>}
41
- */
42
- async activate() {
43
- await super.activate();
44
- if (this.active) {
45
- this.olLayer.setVisible(true);
46
- }
47
- }
48
-
49
- /**
50
- * @inheritDoc
51
- */
52
- deactivate() {
53
- super.deactivate();
54
- if (this.olLayer) {
55
- this.olLayer.setVisible(false);
56
- }
57
- }
58
-
59
- // eslint-disable-next-line jsdoc/require-returns-check
60
- /**
61
- * returns the ol Layer
62
- * @returns {import("ol/layer").Layer<import("ol/source/Source").default>}
63
- */
64
- // eslint-disable-next-line class-methods-use-this
65
- getOLLayer() { throw new Error(); }
66
-
67
- /**
68
- * @inheritDoc
69
- */
70
- destroy() {
71
- if (this.olLayer) {
72
- this.map.removeOLLayer(this.olLayer);
73
- }
74
- this.olLayer = null;
75
- super.destroy();
76
- }
77
- }
78
-
79
- export default LayerOpenlayers;
@@ -1,27 +0,0 @@
1
- import Tile from 'ol/layer/Tile.js';
2
- import OSM from 'ol/source/OSM.js';
3
- import RasterLayerOpenlayers from './rasterLayerOpenlayers.js';
4
-
5
- /**
6
- * represents a specific OpenStreetMap layer for openlayers.
7
- * @class
8
- * @export
9
- * @extends {RasterLayerOpenlayers}
10
- */
11
- class OpenStreetMapOpenlayers extends RasterLayerOpenlayers {
12
- static get className() { return 'vcs.vcm.layer.openlayers.OpenStreetMapOpenlayers'; }
13
-
14
- /**
15
- * @returns {import("ol/layer/Tile").default}
16
- */
17
- getOLLayer() {
18
- return new Tile({
19
- opacity: this.opacity,
20
- source: new OSM({
21
- maxZoom: this.maxLevel,
22
- }),
23
- });
24
- }
25
- }
26
-
27
- export default OpenStreetMapOpenlayers;
@@ -1,121 +0,0 @@
1
- import { ImagerySplitDirection } from '@vcmap/cesium';
2
- import { unByKey } from 'ol/Observable.js';
3
- import LayerOpenlayers from './layerOpenlayers.js';
4
-
5
- /**
6
- * RasterLayer implementation for {@link Openlayers}
7
- * @class
8
- * @extends {LayerOpenlayers}
9
- * @implements {RasterLayerImplementation}
10
- * @abstract
11
- */
12
- class RasterLayerOpenlayers extends LayerOpenlayers {
13
- static get className() { return 'vcs.vcm.layer.openlayers.RasterLayerOpenlayers'; }
14
-
15
- /**
16
- * @param {import("@vcmap/core").Openlayers} map
17
- * @param {RasterLayerImplementationOptions} options
18
- */
19
- constructor(map, options) {
20
- super(map, options);
21
- /** @type {import("@vcmap/cesium").ImagerySplitDirection} */
22
- this.splitDirection = options.splitDirection;
23
- /** @type {number} */
24
- this.minLevel = options.minLevel;
25
- /** @type {number} */
26
- this.maxLevel = options.maxLevel;
27
- /** @type {string} */
28
- this.tilingSchema = options.tilingSchema;
29
- /** @type {import("@vcmap/core").Extent} */
30
- this.extent = options.extent;
31
- /** @type {number} */
32
- this.opacity = options.opacity;
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
- initialize() {
45
- return super.initialize()
46
- .then(() => {
47
- this.updateSplitDirection(this.splitDirection);
48
- });
49
- }
50
-
51
- /**
52
- * @param {number} opacity
53
- */
54
- updateOpacity(opacity) {
55
- this.opacity = opacity;
56
- if (this.initialized) {
57
- this.olLayer.setOpacity(this.opacity);
58
- }
59
- }
60
-
61
- /**
62
- * @param {import("@vcmap/cesium").ImagerySplitDirection} splitDirection
63
- */
64
- updateSplitDirection(splitDirection) {
65
- this.splitDirection = splitDirection;
66
- if (this.initialized) {
67
- if (this.splitDirection === ImagerySplitDirection.NONE && this._splitDirectionRenderListeners) {
68
- unByKey(this._splitDirectionRenderListeners);
69
- this._splitDirectionRenderListeners = null;
70
- this.olLayer.changed();
71
- } else if (splitDirection !== ImagerySplitDirection.NONE && !this._splitDirectionRenderListeners) {
72
- this._splitDirectionRenderListeners = [];
73
- this._splitDirectionRenderListeners
74
- .push(/** @type {import("ol/events").EventsKey} */
75
- (this.olLayer.on('prerender', this._splitPreCompose.bind(this))),
76
- );
77
- this._splitDirectionRenderListeners
78
- .push(/** @type {import("ol/events").EventsKey} */
79
- (this.olLayer.on('postrender', (/** @type {import("ol/render/Event").default} */ event) => {
80
- event.context.restore();
81
- })),
82
- );
83
- this.olLayer.changed();
84
- }
85
- }
86
- }
87
-
88
- /**
89
- * @param {import("ol/render/Event").default} event
90
- * @private
91
- */
92
- _splitPreCompose(event) {
93
- if (!this.map.splitScreen) {
94
- return;
95
- }
96
- const { context } = event;
97
- const width = context.canvas.width * this.map.splitScreen.position;
98
- context.save();
99
- context.beginPath();
100
-
101
- if (this.splitDirection === ImagerySplitDirection.LEFT) {
102
- context.rect(0, 0, width, context.canvas.height);
103
- } else {
104
- context.rect(width, 0, context.canvas.width - width, context.canvas.height);
105
- }
106
- context.clip();
107
- }
108
-
109
- /**
110
- * @inheritDoc
111
- */
112
- destroy() {
113
- if (this._splitDirectionRenderListeners) {
114
- unByKey(this._splitDirectionRenderListeners);
115
- this._splitDirectionRenderListeners = null;
116
- }
117
- super.destroy();
118
- }
119
- }
120
-
121
- export default RasterLayerOpenlayers;
@@ -1,119 +0,0 @@
1
- import { CesiumTerrainProvider, Cartographic, Cartesian2, sampleTerrainMostDetailed, sampleTerrain } from '@vcmap/cesium';
2
- import { getTransform } from 'ol/proj.js';
3
- import { wgs84Projection } from '../util/projection.js';
4
-
5
- /**
6
- * @typedef {Object} TerrainProviderOptions
7
- * @property {!string} url
8
- * @property {boolean|undefined} requestVertexNormals
9
- * @property {boolean|undefined} requestWaterMask
10
- * @api
11
- */
12
-
13
- /**
14
- * @type {Object<string, import("@vcmap/cesium").CesiumTerrainProvider>}
15
- */
16
- const terrainProviders = {};
17
-
18
- /**
19
- * @param {TerrainProviderOptions} options
20
- * @returns {import("@vcmap/cesium").CesiumTerrainProvider}
21
- */
22
- export function getTerrainProviderForUrl(options) {
23
- if (!terrainProviders[options.url]) {
24
- terrainProviders[options.url] = new CesiumTerrainProvider(options);
25
- return terrainProviders[options.url];
26
- }
27
- let terrainProvider = terrainProviders[options.url];
28
- if ((options.requestVertexNormals !== undefined &&
29
- terrainProvider.requestVertexNormals !== options.requestVertexNormals) ||
30
- (options.requestWaterMask !== undefined &&
31
- terrainProvider.requestWaterMask !== options.requestWaterMask)) {
32
- terrainProviders[options.url] = new CesiumTerrainProvider(options);
33
- terrainProvider = terrainProviders[options.url];
34
- }
35
- return terrainProvider;
36
- }
37
-
38
- /**
39
- * @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
40
- * @param {Array<import("@vcmap/cesium").Cartographic>} positions
41
- * @returns {Promise<Array<import("@vcmap/cesium").Cartographic>>}
42
- */
43
- export function sampleCesiumTerrainMostDetailed(terrainProvider, positions) {
44
- return new Promise((resolve, reject) => {
45
- sampleTerrainMostDetailed(terrainProvider, positions)
46
- .then((updatedPositions) => {
47
- resolve(updatedPositions);
48
- }, reject);
49
- });
50
- }
51
-
52
- /**
53
- * updates the height of the positions in place.
54
- * @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
55
- * @param {number} level
56
- * @param {Array<import("@vcmap/cesium").Cartographic>} positions
57
- * @returns {Promise<Array<import("@vcmap/cesium").Cartographic>>}
58
- */
59
- export function sampleCesiumTerrain(terrainProvider, level, positions) {
60
- return new Promise((resolve, reject) => {
61
- sampleTerrain(terrainProvider, level, positions)
62
- .then((updatedPositions) => {
63
- resolve(updatedPositions);
64
- }, reject);
65
- });
66
- }
67
-
68
- /**
69
- * changes input coordinate Array in place, new height can also be accessed by coordinates[x][2]
70
- * @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
71
- * @param {Array<import("ol/coordinate").Coordinate>} coordinates
72
- * @param {import("@vcmap/core").Projection=} optSourceProjection - if input is not WGS84
73
- * @param {Array<import("ol/coordinate").Coordinate>=} result
74
- * @returns {Promise<Array<import("ol/coordinate").Coordinate>>}
75
- */
76
- export function getHeightFromTerrainProvider(terrainProvider, coordinates, optSourceProjection, result) {
77
- const sourceTransformer = optSourceProjection ?
78
- getTransform(
79
- optSourceProjection.proj,
80
- wgs84Projection.proj,
81
- ) :
82
- null;
83
-
84
- const positions = coordinates.map((coord) => {
85
- const wgs84 = sourceTransformer ?
86
- sourceTransformer(coord, coord.slice(), coord.length) :
87
- coord;
88
- return Cartographic.fromDegrees(wgs84[0], wgs84[1]);
89
- });
90
-
91
- const outArray = result || coordinates.map(c => c.slice());
92
- return new Promise((resolve, reject) => {
93
- sampleTerrainMostDetailed(terrainProvider, positions)
94
- .then((updatedPositions) => {
95
- updatedPositions.forEach((position, index) => {
96
- outArray[index][2] = position.height || 0;
97
- });
98
- resolve(outArray);
99
- }, reject);
100
- });
101
- }
102
-
103
- /**
104
- * checks, whether a terrain tile is available at given position or not
105
- * @param {import("@vcmap/cesium").CesiumTerrainProvider} terrainProvider
106
- * @param {number} level
107
- * @param {import("@vcmap/cesium").Cartographic} position
108
- * @returns {boolean}
109
- */
110
- export function isTerrainTileAvailable(terrainProvider, level, position) {
111
- if (!terrainProvider.ready) {
112
- return false;
113
- }
114
- const tileXY = terrainProvider.tilingScheme.positionToTileXY(
115
- position, level, new Cartesian2(),
116
- );
117
- return terrainProvider.getTileDataAvailable(tileXY.x, tileXY.y, level);
118
- }
119
-
@@ -1,67 +0,0 @@
1
- import axios from 'axios';
2
- import { parseGeoJSON } from '../geojsonHelpers.js';
3
- import TileProvider from './tileProvider.js';
4
-
5
- /**
6
- * @typedef {TileProviderOptions} StaticGeojsonTileProviderOptions
7
- * @property {string} url geojson
8
- * @api
9
- */
10
-
11
- /**
12
- * Loads the provided geojson url and tiles the content in memory, data is only requested once
13
- *
14
- * @class
15
- * @extends {TileProvider}
16
- * @export
17
- * @api
18
- */
19
- class StaticGeojsonTileProvider extends TileProvider {
20
- /**
21
- * @readonly
22
- * @returns {string}
23
- */
24
- static get className() { return 'vcs.vcm.layer.tileProvider.StaticGeojsonTileProvider'; }
25
-
26
- /**
27
- * @returns {StaticGeojsonTileProviderOptions}
28
- */
29
- static getDefaultOptions() {
30
- return {
31
- ...TileProvider.getDefaultOptions(),
32
- url: undefined,
33
- baseLevels: [0],
34
- };
35
- }
36
-
37
- /**
38
- * @param {StaticGeojsonTileProviderOptions} options
39
- */
40
- constructor(options) {
41
- const defaultOptions = StaticGeojsonTileProvider.getDefaultOptions();
42
- options.baseLevels = defaultOptions.baseLevels;
43
- super(options);
44
-
45
- /**
46
- * @type {string}
47
- */
48
- this.url = options.url || defaultOptions.url;
49
- }
50
-
51
-
52
- /**
53
- * @inheritDoc
54
- * @param {number} x
55
- * @param {number} y
56
- * @param {number} z
57
- * @returns {Promise<Array<import("ol").Feature<import("ol/geom/Geometry").default>>>}
58
- */
59
- // eslint-disable-next-line no-unused-vars
60
- async loader(x, y, z) {
61
- const response = await axios.get(this.url);
62
- const { features } = parseGeoJSON(response.data, { dynamicStyle: true });
63
- return features;
64
- }
65
- }
66
-
67
- export default StaticGeojsonTileProvider;
@@ -1,28 +0,0 @@
1
- import { VcsClassRegistry } from '../../classRegistry.js';
2
- import TileProvider from './tileProvider.js';
3
- import URLTemplateTileProvider from './urlTemplateTileProvider.js';
4
- import StaticGeojsonTileProvider from './staticGeojsonTileProvider.js';
5
- import MVTTileProvider from './mvtTileProvider.js';
6
-
7
- VcsClassRegistry.registerClass(TileProvider.className, TileProvider);
8
- VcsClassRegistry.registerClass(URLTemplateTileProvider.className, URLTemplateTileProvider);
9
- VcsClassRegistry.registerClass(StaticGeojsonTileProvider.className, StaticGeojsonTileProvider);
10
- VcsClassRegistry.registerClass(MVTTileProvider.className, MVTTileProvider);
11
-
12
- /**
13
- * TileProvider
14
- * @namespace tileProvider
15
- * @api stable
16
- */
17
-
18
- /**
19
- * @param {Object} options
20
- * @returns {Promise<TileProvider>}
21
- * @api
22
- * @export
23
- */
24
- function factory(options) {
25
- return VcsClassRegistry.create(options.type, options);
26
- }
27
-
28
- export default factory;