@vcmap/core 5.0.0-rc.0 → 5.0.0-rc.11

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 (185) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +3 -2
  3. package/index.d.ts +7578 -0
  4. package/index.js +137 -131
  5. package/package.json +16 -23
  6. package/src/category/appBackedCategory.js +76 -0
  7. package/src/category/category.js +401 -0
  8. package/src/category/categoryCollection.js +145 -0
  9. package/src/cesium/cesium3DTileFeature.js +1 -1
  10. package/src/classRegistry.js +162 -0
  11. package/src/context.js +72 -0
  12. package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +8 -9
  13. package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderHelpers.js +4 -5
  14. package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
  15. package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +4 -2
  16. package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +25 -18
  17. package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +19 -18
  18. package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +6 -9
  19. package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +3 -3
  20. package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +6 -19
  21. package/src/{vcs/vcm/interaction → interaction}/featureProviderInteraction.js +2 -13
  22. package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +11 -32
  23. package/src/{vcs/vcm/interaction → interaction}/interactionType.js +1 -5
  24. package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +8 -11
  25. package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +0 -0
  26. package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +5 -3
  27. package/src/{vcs/vcm/layer/cesium/openStreetMapCesium.js → layer/cesium/openStreetMapCesiumImpl.js} +6 -7
  28. package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +5 -6
  29. package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +5 -6
  30. package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +4 -5
  31. package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +6 -7
  32. package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +3 -4
  33. package/src/{vcs/vcm/layer → layer}/cesium/vectorContext.js +0 -0
  34. package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +5 -6
  35. package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +1 -2
  36. package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +6 -7
  37. package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +6 -7
  38. package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +0 -0
  39. package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +38 -37
  40. package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +14 -17
  41. package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +13 -14
  42. package/src/{vcs/vcm/layer → layer}/featureLayer.js +17 -31
  43. package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +53 -54
  44. package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +98 -82
  45. package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
  46. package/src/{vcs/vcm/layer → layer}/featureVisibility.js +6 -6
  47. package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +15 -41
  48. package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +19 -22
  49. package/src/{vcs/vcm/layer → layer}/globalHider.js +1 -12
  50. package/src/{vcs/vcm/layer → layer}/layer.js +11 -12
  51. package/src/{vcs/vcm/layer → layer}/layerImplementation.js +2 -3
  52. package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
  53. package/src/{vcs/vcm/layer → layer}/layerSymbols.js +0 -0
  54. package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +4 -4
  55. package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +2 -2
  56. package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +6 -7
  57. package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +32 -33
  58. package/src/{vcs/vcm/layer/openlayers/layerOpenlayers.js → layer/openlayers/layerOpenlayersImpl.js} +5 -6
  59. package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +26 -0
  60. package/src/{vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js → layer/openlayers/rasterLayerOpenlayersImpl.js} +15 -14
  61. package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +6 -7
  62. package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +5 -6
  63. package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +7 -8
  64. package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +6 -7
  65. package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +6 -7
  66. package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +7 -8
  67. package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +7 -8
  68. package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +26 -34
  69. package/src/{vcs/vcm/layer → layer}/rasterLayer.js +18 -20
  70. package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +20 -20
  71. package/src/{vcs/vcm/layer → layer}/terrainHelpers.js +13 -49
  72. package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +13 -14
  73. package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +5 -5
  74. package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +22 -5
  75. package/src/layer/tileProvider/staticGeojsonTileProvider.js +81 -0
  76. package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +16 -8
  77. package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +20 -6
  78. package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +19 -20
  79. package/src/{vcs/vcm/layer → layer}/vectorHelpers.js +5 -5
  80. package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +38 -48
  81. package/src/{vcs/vcm/layer → layer}/vectorProperties.js +3 -4
  82. package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +0 -0
  83. package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +32 -42
  84. package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +19 -20
  85. package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +1 -1
  86. package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +22 -23
  87. package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +20 -21
  88. package/src/{vcs/vcm/maps → map}/baseOLMap.js +5 -6
  89. package/src/{vcs/vcm/maps → map}/cameraLimiter.js +11 -17
  90. package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +21 -34
  91. package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
  92. package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +42 -57
  93. package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +17 -15
  94. package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +41 -22
  95. package/src/oblique/defaultObliqueCollection.js +62 -0
  96. package/src/{vcs/vcm/oblique → oblique}/helpers.js +13 -44
  97. package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +117 -37
  98. package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +67 -26
  99. package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +1 -2
  100. package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +4 -5
  101. package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +17 -12
  102. package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +31 -2
  103. package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +0 -3
  104. package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +20 -12
  105. package/src/ol/geom/circle.js +1 -1
  106. package/src/ol/render/canvas/canvasTileRenderer.js +0 -1
  107. package/src/overrideClassRegistry.js +204 -0
  108. package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +43 -20
  109. package/src/{vcs/vcm/util/style → style}/shapesCategory.js +0 -2
  110. package/src/style/styleFactory.js +29 -0
  111. package/src/{vcs/vcm/util/style → style}/styleHelpers.js +3 -14
  112. package/src/{vcs/vcm/util/style → style}/styleItem.js +23 -86
  113. package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +73 -85
  114. package/src/{vcs/vcm/util/style → style}/writeStyle.js +4 -7
  115. package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +10 -12
  116. package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +2 -3
  117. package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +4 -8
  118. package/src/{vcs/vcm/util → util}/collection.js +16 -4
  119. package/src/{vcs/vcm/util → util}/dateTime.js +0 -0
  120. package/src/{vcs/vcm/util → util}/exclusiveManager.js +0 -0
  121. package/src/{vcs/vcm/util → util}/extent.js +18 -12
  122. package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +0 -0
  123. package/src/{vcs/vcm/util → util}/featureconverter/convert.js +0 -0
  124. package/src/util/featureconverter/extent3D.js +181 -0
  125. package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +1 -1
  126. package/src/{vcs/vcm/util → util}/featureconverter/lineStringToCesium.js +0 -0
  127. package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +3 -3
  128. package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +1 -1
  129. package/src/util/fetch.js +32 -0
  130. package/src/{vcs/vcm/util → util}/geometryHelpers.js +0 -0
  131. package/src/{vcs/vcm/util → util}/indexedCollection.js +24 -2
  132. package/src/{vcs/vcm/util → util}/isMobile.js +0 -0
  133. package/src/{vcs/vcm/util → util}/layerCollection.js +16 -12
  134. package/src/{vcs/vcm/util → util}/locale.js +1 -1
  135. package/src/{vcs/vcm/util → util}/mapCollection.js +91 -34
  136. package/src/{vcs/vcm/util → util}/math.js +0 -0
  137. package/src/util/overrideCollection.js +223 -0
  138. package/src/{vcs/vcm/util → util}/projection.js +39 -29
  139. package/src/{vcs/vcm/util → util}/splitScreen.js +10 -10
  140. package/src/{vcs/vcm/util → util}/urlHelpers.js +0 -0
  141. package/src/{vcs/vcm/util → util}/viewpoint.js +5 -9
  142. package/src/vcsApp.js +471 -0
  143. package/src/vcsAppContextHelpers.js +121 -0
  144. package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -3
  145. package/src/{vcs/vcm/object.js → vcsObject.js} +2 -10
  146. package/tests/data/buildings/tileset.json +428 -0
  147. package/tests/data/dynamicPointCzml.json +64 -0
  148. package/tests/data/oblique/imageData/imagev34.json +352 -0
  149. package/tests/data/oblique/imageData/imagev35.json +54 -0
  150. package/tests/data/oblique/imageData/imagev35PerImageSize.json +53 -0
  151. package/tests/data/oblique/tiledImageData/12/2199/1342.json +1 -0
  152. package/tests/data/oblique/tiledImageData/12/2199/1343.json +1 -0
  153. package/tests/data/oblique/tiledImageData/12/2199/1344.json +1 -0
  154. package/tests/data/oblique/tiledImageData/12/2200/1342.json +1 -0
  155. package/tests/data/oblique/tiledImageData/12/2200/1343.json +1 -0
  156. package/tests/data/oblique/tiledImageData/12/2200/1344.json +1 -0
  157. package/tests/data/oblique/tiledImageData/12/2201/1342.json +1 -0
  158. package/tests/data/oblique/tiledImageData/12/2201/1343.json +1 -0
  159. package/tests/data/oblique/tiledImageData/12/2201/1344.json +1 -0
  160. package/tests/data/oblique/tiledImageData/image.json +1 -0
  161. package/tests/data/terrain/13/8800/6485.terrain +0 -0
  162. package/tests/data/terrain/13/8800/6486.terrain +0 -0
  163. package/tests/data/terrain/13/8801/6485.terrain +0 -0
  164. package/tests/data/terrain/13/8801/6486.terrain +0 -0
  165. package/tests/data/terrain/layer.json +136 -0
  166. package/tests/data/testGeoJSON.json +161 -0
  167. package/tests/data/tile.pbf +0 -0
  168. package/tests/unit/helpers/cesiumHelpers.js +272 -0
  169. package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
  170. package/tests/unit/helpers/helpers.js +11 -0
  171. package/tests/unit/helpers/imageHelpers.js +20 -0
  172. package/tests/unit/helpers/importJSON.js +15 -0
  173. package/tests/unit/helpers/obliqueData.js +76 -0
  174. package/tests/unit/helpers/obliqueHelpers.js +112 -0
  175. package/tests/unit/helpers/openlayersHelpers.js +22 -0
  176. package/tests/unit/helpers/terrain/terrainData.js +46 -0
  177. package/src/vcs/vcm/classRegistry.js +0 -106
  178. package/src/vcs/vcm/globalCollections.js +0 -11
  179. package/src/vcs/vcm/layer/buildings.js +0 -17
  180. package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
  181. package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
  182. package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
  183. package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
  184. package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
  185. package/src/vcs/vcm/util/style/styleFactory.js +0 -48
@@ -1,11 +1,11 @@
1
1
  import { EntityCollection } from '@vcmap/cesium';
2
2
  import Layer from './layer.js';
3
- import CesiumMap from '../maps/cesium.js';
4
- import DataSourceCesium from './cesium/dataSourceCesium.js';
3
+ import CesiumMap from '../map/cesiumMap.js';
4
+ import DataSourceCesiumImpl from './cesium/dataSourceCesiumImpl.js';
5
5
  import { vcsLayerName } from './layerSymbols.js';
6
6
  import FeatureVisibility, { FeatureVisibilityAction } from './featureVisibility.js';
7
7
  import { getGlobalHider } from './globalHider.js';
8
- import { VcsClassRegistry } from '../classRegistry.js';
8
+ import { layerClassRegistry } from '../classRegistry.js';
9
9
 
10
10
  /**
11
11
  * @typedef {LayerOptions} DataSourceOptions
@@ -30,12 +30,11 @@ import { VcsClassRegistry } from '../classRegistry.js';
30
30
  /**
31
31
  * Represents a layer of Cesium.Entity
32
32
  * @class
33
- * @export
34
33
  * @extends {Layer}
35
34
  * @api stable
36
35
  */
37
- class DataSource extends Layer {
38
- static get className() { return 'vcs.vcm.layer.DataSource'; }
36
+ class DataSourceLayer extends Layer {
37
+ static get className() { return 'DataSourceLayer'; }
39
38
 
40
39
  /**
41
40
  * @returns {DataSourceOptions}
@@ -52,7 +51,7 @@ class DataSource extends Layer {
52
51
  */
53
52
  constructor(options) {
54
53
  super(options);
55
- const defaultOptions = DataSource.getDefaultOptions();
54
+ const defaultOptions = DataSourceLayer.getDefaultOptions();
56
55
  /**
57
56
  * The entities of this layer. Use the `addEntity` API to add Enitities to ensure interoperability with vcm interfaces
58
57
  * @type {import("@vcmap/cesium").EntityCollection}
@@ -151,11 +150,11 @@ class DataSource extends Layer {
151
150
 
152
151
  /**
153
152
  * @param {CesiumMap} map
154
- * @returns {Array<DataSourceCesium>}
153
+ * @returns {Array<DataSourceCesiumImpl>}
155
154
  */
156
155
  createImplementationsForMap(map) {
157
156
  if (map instanceof CesiumMap) {
158
- return [new DataSourceCesium(map, this.getImplementationOptions())];
157
+ return [new DataSourceCesiumImpl(map, this.getImplementationOptions())];
159
158
  }
160
159
  return [];
161
160
  }
@@ -183,7 +182,7 @@ class DataSource extends Layer {
183
182
  */
184
183
  flyToEntity(id) {
185
184
  this.getImplementations().forEach((impl) => {
186
- /** @type {DataSourceCesium} */ (impl).flyToEntity(id);
185
+ /** @type {DataSourceCesiumImpl} */ (impl).flyToEntity(id);
187
186
  });
188
187
  }
189
188
 
@@ -235,8 +234,8 @@ class DataSource extends Layer {
235
234
  * @inheritDoc
236
235
  * @returns {DataSourceOptions}
237
236
  */
238
- getConfigObject() {
239
- const config = /** @type {DataSourceOptions} */ (super.getConfigObject());
237
+ toJSON() {
238
+ const config = /** @type {DataSourceOptions} */ (super.toJSON());
240
239
  if (Object.keys(this._genericFeatureProperties).length > 0) {
241
240
  config.genericFeatureProperties = { ...this._genericFeatureProperties };
242
241
  }
@@ -255,5 +254,5 @@ class DataSource extends Layer {
255
254
  }
256
255
  }
257
256
 
258
- VcsClassRegistry.registerClass(DataSource.className, DataSource);
259
- export default DataSource;
257
+ layerClassRegistry.registerClass(DataSourceLayer.className, DataSourceLayer);
258
+ export default DataSourceLayer;
@@ -3,18 +3,16 @@ import Style from 'ol/style/Style.js';
3
3
  import { check } from '@vcsuite/check';
4
4
  import { parseInteger } from '@vcsuite/parsers';
5
5
  import Layer from './layer.js';
6
- import StyleItem, { referenceableStyleSymbol } from '../util/style/styleItem.js';
7
- import VectorStyleItem from '../util/style/vectorStyleItem.js';
6
+ import StyleItem from '../style/styleItem.js';
7
+ import VectorStyleItem from '../style/vectorStyleItem.js';
8
8
  import FeatureVisibility from './featureVisibility.js';
9
- import { getStyleOrDefaultStyle } from '../util/style/styleFactory.js';
10
- import VcsEvent from '../event/vcsEvent.js';
11
- import { styleCollection } from '../globalCollections.js';
12
- import { VcsClassRegistry } from '../classRegistry.js';
9
+ import { getStyleOrDefaultStyle } from '../style/styleFactory.js';
10
+ import VcsEvent from '../vcsEvent.js';
11
+ import { layerClassRegistry } from '../classRegistry.js';
13
12
 
14
13
  /**
15
14
  * @typedef {LayerOptions} FeatureLayerOptions
16
- * @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|string|undefined} style
17
- * @property {string|undefined} activeStyleName - vcs:undocumented
15
+ * @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|undefined} style
18
16
  * @property {Object|undefined} genericFeatureProperties - properties to add to generic features, eg for display in the balloon
19
17
  * @property {number} [balloonHeightOffset=10]
20
18
  * @property {FeatureVisibility|undefined} featureVisibility - vcs:undocumented
@@ -42,16 +40,15 @@ import { VcsClassRegistry } from '../classRegistry.js';
42
40
  */
43
41
 
44
42
  /**
45
- * Base class for all layers representing features, e.g. Vector, Buildings, POIs
43
+ * Base class for all layers representing features, e.g. VectorLayer, Buildings, POIs
46
44
  * @class
47
45
  * @abstract
48
46
  * @extends {Layer}
49
- * @export
50
47
  * @api
51
48
  */
52
49
  class FeatureLayer extends Layer {
53
50
  /** @type {string} */
54
- static get className() { return 'vcs.vcm.layer.FeatureLayer'; }
51
+ static get className() { return 'FeatureLayer'; }
55
52
 
56
53
  /**
57
54
  * @returns {FeatureLayerOptions}
@@ -76,7 +73,7 @@ class FeatureLayer extends Layer {
76
73
  * @type {import("@vcmap/core").StyleItem}
77
74
  * @private
78
75
  */
79
- this._style = this.getStyleOrDefaultStyle(options.activeStyleName || options.style);
76
+ this._style = this.getStyleOrDefaultStyle(options.style);
80
77
  /**
81
78
  * @type {import("@vcmap/core").StyleItem}
82
79
  * @private
@@ -180,7 +177,7 @@ class FeatureLayer extends Layer {
180
177
  }
181
178
 
182
179
  /**
183
- * @param {(Reference|DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|string)=} styleOptions
180
+ * @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
184
181
  * @param {(import("@vcmap/core").VectorStyleItem|import("@vcmap/core").DeclarativeStyleItem)=} defaultStyle
185
182
  * @returns {import("@vcmap/core").StyleItem}
186
183
  */
@@ -191,21 +188,14 @@ class FeatureLayer extends Layer {
191
188
 
192
189
  /**
193
190
  * Sets the style based on a styleName on a layer
194
- * @param {string|import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
191
+ * @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
195
192
  * @param {boolean=} silent
196
193
  * @api
197
194
  */
198
195
  setStyle(style, silent) {
199
- check(style, [Style, StyleItem, Function, String]);
196
+ check(style, [Style, StyleItem, Function]);
200
197
 
201
- if (typeof style === 'string') {
202
- const styleItem = styleCollection.getByKey(style);
203
- if (!styleItem) {
204
- this.getLogger().warning(`could not find style with name ${style}`);
205
- return;
206
- }
207
- this._style = styleItem;
208
- } else if (style instanceof StyleItem) {
198
+ if (style instanceof StyleItem) {
209
199
  this._style = style;
210
200
  } else {
211
201
  this._style = new VectorStyleItem({});
@@ -229,14 +219,10 @@ class FeatureLayer extends Layer {
229
219
  /**
230
220
  * @returns {FeatureLayerOptions}
231
221
  */
232
- getConfigObject() {
233
- const config = /** @type {FeatureLayerOptions} */ (super.getConfigObject());
222
+ toJSON() {
223
+ const config = /** @type {FeatureLayerOptions} */ (super.toJSON());
234
224
  if (!this.getStyleOrDefaultStyle().equals(this._style)) {
235
- if (this._style[referenceableStyleSymbol]) {
236
- config.style = this.style.getReference();
237
- } else {
238
- config.style = this.style.getOptions();
239
- }
225
+ config.style = this.style.toJSON();
240
226
  }
241
227
 
242
228
  if (Object.keys(this._genericFeatureProperties).length > 0) {
@@ -257,5 +243,5 @@ class FeatureLayer extends Layer {
257
243
  }
258
244
  }
259
245
 
260
- VcsClassRegistry.registerClass(FeatureLayer.className, FeatureLayer);
246
+ layerClassRegistry.registerClass(FeatureLayer.className, FeatureLayer);
261
247
  export default FeatureLayer;
@@ -1,34 +1,34 @@
1
- import axios from 'axios';
2
1
  import Feature from 'ol/Feature.js';
3
- import { Cesium3DTileFeature, Cesium3DTilePointFeature, ImagerySplitDirection } from '@vcmap/cesium';
2
+ import { Cesium3DTileFeature, Cesium3DTilePointFeature, SplitDirection } from '@vcmap/cesium';
4
3
  import VectorSource from 'ol/source/Vector.js';
5
4
  import { createEmpty, extend as extendExtent } from 'ol/extent.js';
6
5
 
7
- import Vector from './vector.js';
8
- import { featureStoreStateSymbol, featureStoreState } from './featureStoreState.js';
6
+ import VectorLayer from './vectorLayer.js';
7
+ import { featureStoreStateSymbol, FeatureStoreLayerState } from './featureStoreLayerState.js';
9
8
  import { parseGeoJSON } from './geojsonHelpers.js';
10
9
  import { mercatorProjection } from '../util/projection.js';
11
- import FeatureStoreChanges from './featureStoreChanges.js';
12
- import VectorStyleItem, { defaultVectorStyle, vectorStyleSymbol } from '../util/style/vectorStyleItem.js';
10
+ import FeatureStoreLayerChanges from './featureStoreLayerChanges.js';
11
+ import VectorStyleItem, { defaultVectorStyle, vectorStyleSymbol } from '../style/vectorStyleItem.js';
13
12
  import FeatureVisibility, {
14
13
  FeatureVisibilityAction,
15
14
  originalStyle,
16
15
  synchronizeFeatureVisibility,
17
16
  updateOriginalStyle,
18
17
  } from './featureVisibility.js';
19
- import CesiumTilesetCesium, { getExtentFromTileset } from './cesium/cesiumTilesetCesium.js';
20
- import CesiumMap from '../maps/cesium.js';
21
- import Openlayers from '../maps/openlayers.js';
22
- import Oblique from '../maps/oblique.js';
23
- import CesiumTileset from './cesiumTileset.js';
18
+ import CesiumTilesetCesiumImpl, { getExtentFromTileset } from './cesium/cesiumTilesetCesiumImpl.js';
19
+ import CesiumMap from '../map/cesiumMap.js';
20
+ import OpenlayersMap from '../map/openlayersMap.js';
21
+ import ObliqueMap from '../map/obliqueMap.js';
22
+ import CesiumTilesetLayer from './cesiumTilesetLayer.js';
24
23
  import VectorProperties from './vectorProperties.js';
25
- import VectorOpenlayers from './openlayers/vectorOpenlayers.js';
24
+ import VectorOpenlayersImpl from './openlayers/vectorOpenlayersImpl.js';
26
25
  import Layer from './layer.js';
27
- import DeclarativeStyleItem from '../util/style/declarativeStyleItem.js';
28
- import VectorOblique from './oblique/vectorOblique.js';
26
+ import DeclarativeStyleItem from '../style/declarativeStyleItem.js';
27
+ import VectorObliqueImpl from './oblique/vectorObliqueImpl.js';
29
28
  import Extent from '../util/extent.js';
30
29
  import { isMobile } from '../util/isMobile.js';
31
- import { VcsClassRegistry } from '../classRegistry.js';
30
+ import { layerClassRegistry } from '../classRegistry.js';
31
+ import { requestJson } from '../util/fetch.js';
32
32
 
33
33
  /**
34
34
  * @typedef {Object} FeatureStoreStaticRepresentation
@@ -43,7 +43,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
43
43
  * @property {Object} properties - the properties bag
44
44
  * @property {Object} geometry
45
45
  * @property {Object|undefined} vcsMeta
46
- * @property {featureStoreState} state
46
+ * @property {FeatureStoreLayerState} state
47
47
  * @property {string} type - the featureType
48
48
  * @todo write vcsMeta for features
49
49
  * @todo set type to be one of an enum
@@ -66,7 +66,7 @@ import { VcsClassRegistry } from '../classRegistry.js';
66
66
 
67
67
  /**
68
68
  * @typedef {FeatureStoreLayerSchema} FeatureStoreOptions
69
- * @property {Function|undefined} injectedFetchDynamicFeatureFunc - injected function for fetching dynamic features from a remote FeatureStore server
69
+ * @property {Function|undefined} injectedFetchDynamicFeatureFunc - injected function for fetching dynamic features from a remote FeatureStoreLayer server
70
70
  * @api
71
71
  */
72
72
 
@@ -74,14 +74,13 @@ import { VcsClassRegistry } from '../classRegistry.js';
74
74
  export const isTiledFeature = Symbol('isTiledFeature');
75
75
 
76
76
  /**
77
- * FeatureStore Layer
77
+ * FeatureStoreLayer Layer
78
78
  * @class
79
- * @export
80
- * @extends {Vector}
79
+ * @extends {VectorLayer}
81
80
  * @api
82
81
  */
83
- class FeatureStore extends Vector {
84
- static get className() { return 'vcs.vcm.layer.FeatureStore'; }
82
+ class FeatureStoreLayer extends VectorLayer {
83
+ static get className() { return 'FeatureStoreLayer'; }
85
84
 
86
85
  /**
87
86
  * @returns {FeatureStoreOptions}
@@ -89,11 +88,11 @@ class FeatureStore extends Vector {
89
88
  static getDefaultOptions() {
90
89
  return {
91
90
  id: '',
92
- type: 'vcs.vcm.layer.FeatureStore',
91
+ type: 'FeatureStoreLayer',
93
92
  featureType: 'simple',
94
93
  features: [],
95
- ...Vector.getDefaultOptions(),
96
- projection: mercatorProjection.getConfigObject(),
94
+ ...VectorLayer.getDefaultOptions(),
95
+ projection: mercatorProjection.toJSON(),
97
96
  staticRepresentation: {},
98
97
  hiddenStaticFeatureIds: [],
99
98
  vcsMeta: {
@@ -108,7 +107,7 @@ class FeatureStore extends Vector {
108
107
  * @param {FeatureStoreOptions} options
109
108
  */
110
109
  constructor(options) {
111
- const defaultOptions = FeatureStore.getDefaultOptions();
110
+ const defaultOptions = FeatureStoreLayer.getDefaultOptions();
112
111
  const vectorOptions = {
113
112
  projection: defaultOptions.projection,
114
113
  ...options,
@@ -116,8 +115,8 @@ class FeatureStore extends Vector {
116
115
  super(vectorOptions);
117
116
  this._supportedMaps = [
118
117
  CesiumMap.className,
119
- Openlayers.className,
120
- Oblique.className,
118
+ OpenlayersMap.className,
119
+ ObliqueMap.className,
121
120
  ];
122
121
 
123
122
  /**
@@ -136,10 +135,10 @@ class FeatureStore extends Vector {
136
135
  this.hiddenStaticFeatureIds = new Set(options.hiddenStaticFeatureIds || defaultOptions.hiddenStaticFeatureIds);
137
136
 
138
137
  /**
139
- * @type {FeatureStoreChanges}
138
+ * @type {FeatureStoreLayerChanges}
140
139
  * @api
141
140
  */
142
- this.changeTracker = new FeatureStoreChanges(this);
141
+ this.changeTracker = new FeatureStoreLayerChanges(this);
143
142
 
144
143
  const { vcsMeta } = defaultOptions;
145
144
  if (options.vcsMeta) {
@@ -249,7 +248,7 @@ class FeatureStore extends Vector {
249
248
  _loadTwoDim() {
250
249
  if (!this._twoDimLoaded) {
251
250
  this._twoDimLoaded = (async () => {
252
- const { data } = await axios.get(this.staticRepresentation.twoDim);
251
+ const data = await requestJson(this.staticRepresentation.twoDim);
253
252
  const { features } = parseGeoJSON(data, {
254
253
  targetProjection: mercatorProjection,
255
254
  dynamicStyle: true,
@@ -288,14 +287,14 @@ class FeatureStore extends Vector {
288
287
 
289
288
  /**
290
289
  * @param {import("@vcmap/core").VcsMap} map
291
- * @returns {Array<VectorOblique|import("@vcmap/core").VectorCesium|VectorOpenlayers|CesiumTilesetCesium>}
290
+ * @returns {Array<VectorObliqueImpl|import("@vcmap/core").VectorCesiumImpl|VectorOpenlayersImpl|CesiumTilesetCesiumImpl>}
292
291
  */
293
292
  // @ts-ignore
294
293
  createImplementationsForMap(map) {
295
294
  const impls = /** @type {Array<import("@vcmap/core").LayerImplementation>} */
296
295
  (super.createImplementationsForMap(map));
297
296
  if (map instanceof CesiumMap && this.staticRepresentation && this.staticRepresentation.threeDim) {
298
- impls.push(new CesiumTilesetCesium(map, /** @type {CesiumTilesetImplementationOptions} */ ({
297
+ impls.push(new CesiumTilesetCesiumImpl(map, /** @type {CesiumTilesetImplementationOptions} */ ({
299
298
  url: this.staticRepresentation.threeDim,
300
299
  tilesetOptions: {
301
300
  maximumScreenSpaceError: isMobile() ? this.screenSpaceErrorMobile : this.screenSpaceError,
@@ -310,19 +309,19 @@ class FeatureStore extends Vector {
310
309
  name: this.name,
311
310
  style: this.style,
312
311
  featureVisibility: this._staticFeatureVisibility,
313
- splitDirection: ImagerySplitDirection.NONE,
312
+ splitDirection: SplitDirection.NONE,
314
313
  jumpToLocation: false,
315
314
  })));
316
315
  } else if (this.staticRepresentation && this.staticRepresentation.twoDim) {
317
316
  this._loadTwoDim();
318
- if (map instanceof Openlayers) {
319
- impls.push(new VectorOpenlayers(map, this._getTwoDimStaticImplOptions()));
320
- } else if (map instanceof Oblique) {
321
- impls.push(new VectorOblique(map, this._getTwoDimStaticImplOptions()));
317
+ if (map instanceof OpenlayersMap) {
318
+ impls.push(new VectorOpenlayersImpl(map, this._getTwoDimStaticImplOptions()));
319
+ } else if (map instanceof ObliqueMap) {
320
+ impls.push(new VectorObliqueImpl(map, this._getTwoDimStaticImplOptions()));
322
321
  }
323
322
  }
324
323
  // eslint-disable-next-line max-len
325
- return /** @type {Array<VectorOblique|import("@vcmap/core").VectorCesium|VectorOpenlayers|CesiumTilesetCesium>} */ (impls);
324
+ return /** @type {Array<VectorObliqueImpl|import("@vcmap/core").VectorCesiumImpl|VectorOpenlayersImpl|CesiumTilesetCesiumImpl>} */ (impls);
326
325
  }
327
326
 
328
327
  /**
@@ -371,7 +370,7 @@ class FeatureStore extends Vector {
371
370
 
372
371
  /**
373
372
  * @inheritDoc
374
- * @param {string|import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
373
+ * @param {import("ol/style/Style").default|import("ol/style/Style").StyleFunction|import("@vcmap/core").StyleItem} style
375
374
  * @param {boolean=} silent
376
375
  * @api
377
376
  */
@@ -409,7 +408,7 @@ class FeatureStore extends Vector {
409
408
  */
410
409
  setEditing(symbol, featureType) {
411
410
  this.getImplementations().forEach((impl) => {
412
- if (impl instanceof CesiumTilesetCesium) {
411
+ if (impl instanceof CesiumTilesetCesiumImpl) {
413
412
  if (impl.initialized) {
414
413
  if (featureType != null) {
415
414
  impl.cesium3DTileset[symbol] = featureType;
@@ -447,7 +446,7 @@ class FeatureStore extends Vector {
447
446
  */
448
447
  objectClickedHandler(feature) {
449
448
  if ((feature instanceof Cesium3DTileFeature || feature instanceof Cesium3DTilePointFeature)) {
450
- return CesiumTileset.prototype.objectClickedHandler.call(this, feature);
449
+ return CesiumTilesetLayer.prototype.objectClickedHandler.call(this, feature);
451
450
  } else if (feature instanceof Feature) {
452
451
  return super.objectClickedHandler(feature);
453
452
  }
@@ -463,7 +462,7 @@ class FeatureStore extends Vector {
463
462
  // @ts-ignore
464
463
  return super.getGenericFeatureFromClickedObject(/** @type {VectorClickedObject} */ (object));
465
464
  }
466
- const generic = CesiumTileset.prototype.getGenericFeatureFromClickedObject.call(this, object);
465
+ const generic = CesiumTilesetLayer.prototype.getGenericFeatureFromClickedObject.call(this, object);
467
466
  generic.layerName = this.name;
468
467
  generic.layerClass = this.className;
469
468
  return generic;
@@ -481,9 +480,9 @@ class FeatureStore extends Vector {
481
480
  const extent = super.getZoomToExtent();
482
481
  const mercatorExtent = extent ? extent.getCoordinatesInProjection(mercatorProjection) : createEmpty();
483
482
  if (this.staticRepresentation.threeDim) {
484
- const threeDImpl = /** @type {CesiumTilesetCesium} */ (this.getImplementations()
483
+ const threeDImpl = /** @type {CesiumTilesetCesiumImpl} */ (this.getImplementations()
485
484
  .find((impl) => {
486
- return impl instanceof CesiumTilesetCesium && impl.cesium3DTileset;
485
+ return impl instanceof CesiumTilesetCesiumImpl && impl.cesium3DTileset;
487
486
  }));
488
487
 
489
488
  if (threeDImpl) {
@@ -497,7 +496,7 @@ class FeatureStore extends Vector {
497
496
  }
498
497
 
499
498
  const actualExtent = new Extent({
500
- ...mercatorProjection.getConfigObject(),
499
+ projection: mercatorProjection.toJSON(),
501
500
  coordinates: mercatorExtent,
502
501
  });
503
502
 
@@ -522,7 +521,7 @@ class FeatureStore extends Vector {
522
521
 
523
522
  this.getImplementations()
524
523
  .forEach((impl) => {
525
- if (impl instanceof CesiumTilesetCesium && impl.cesium3DTileset) {
524
+ if (impl instanceof CesiumTilesetCesiumImpl && impl.cesium3DTileset) {
526
525
  impl.cesium3DTileset.maximumScreenSpaceError = value;
527
526
  }
528
527
  });
@@ -530,7 +529,7 @@ class FeatureStore extends Vector {
530
529
 
531
530
  /**
532
531
  * switch an array of static features to dynamic features
533
- * This is done by hiding the static features and adding their dynamic counterparts to the FeatureStore layer
532
+ * This is done by hiding the static features and adding their dynamic counterparts to the FeatureStoreLayer layer
534
533
  * @param {string|number} [featureId] input static feature ID
535
534
  * @returns {Promise<import("ol").Feature<import("ol/geom/Geometry").default>>}
536
535
  * @api
@@ -573,7 +572,7 @@ class FeatureStore extends Vector {
573
572
  this.hiddenStaticFeatureIds.add(featureId);
574
573
  const feature = new Feature();
575
574
  feature.setId(featureId);
576
- feature[featureStoreStateSymbol] = featureStoreState.STATIC;
575
+ feature[featureStoreStateSymbol] = FeatureStoreLayerState.STATIC;
577
576
  this.changeTracker.removeFeature(feature);
578
577
  }
579
578
 
@@ -596,9 +595,9 @@ class FeatureStore extends Vector {
596
595
  * @inheritDoc
597
596
  * @returns {FeatureStoreOptions}
598
597
  */
599
- getConfigObject() {
600
- const config = /** @type {FeatureStoreOptions} */ (super.getConfigObject());
601
- const defaultOptions = FeatureStore.getDefaultOptions();
598
+ toJSON() {
599
+ const config = /** @type {FeatureStoreOptions} */ (super.toJSON());
600
+ const defaultOptions = FeatureStoreLayer.getDefaultOptions();
602
601
 
603
602
  delete config.projection;
604
603
  config.vcsMeta = this.vectorProperties
@@ -643,5 +642,5 @@ class FeatureStore extends Vector {
643
642
  }
644
643
  }
645
644
 
646
- VcsClassRegistry.registerClass(FeatureStore.className, FeatureStore);
647
- export default FeatureStore;
645
+ layerClassRegistry.registerClass(FeatureStoreLayer.className, FeatureStoreLayer);
646
+ export default FeatureStoreLayer;