@vcmap/core 5.0.0-rc.1 → 5.0.0-rc.12

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 +2085 -1969
  4. package/index.js +137 -131
  5. package/package.json +14 -22
  6. package/src/category/appBackedCategory.js +76 -0
  7. package/src/category/category.js +417 -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} +10 -13
  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} +6 -7
  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} +38 -29
  42. package/src/{vcs/vcm/layer → layer}/featureLayer.js +27 -31
  43. package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +54 -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 +9 -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 +8 -32
  50. package/src/{vcs/vcm/layer → layer}/layer.js +63 -20
  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} +7 -9
  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} +8 -9
  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} +55 -54
  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 +49 -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
@@ -10,7 +10,7 @@ import Circle from 'ol/style/Circle.js';
10
10
  import RegularShape from 'ol/style/RegularShape.js';
11
11
 
12
12
  import { check, checkMaybe } from '@vcsuite/check';
13
- import StyleItem, { StyleType } from './styleItem.js';
13
+ import StyleItem from './styleItem.js';
14
14
  import {
15
15
  parseColor,
16
16
  PatternType,
@@ -24,6 +24,7 @@ import {
24
24
  getDefaultVectorStyleItemOptions,
25
25
  } from './styleHelpers.js';
26
26
  import { getShapeFromOptions } from './shapesCategory.js';
27
+ import { styleClassRegistry } from '../classRegistry.js';
27
28
 
28
29
  /**
29
30
  * @typedef {Object} VectorStyleItemPattern
@@ -96,7 +97,7 @@ import { getShapeFromOptions } from './shapesCategory.js';
96
97
  * @property {number} POLYLINE
97
98
  * @property {number} POINT
98
99
  */
99
- export const olcsGeometryType = {
100
+ export const OlcsGeometryType = {
100
101
  POLYGON: 1,
101
102
  POLYLINE: 2,
102
103
  POINT: 3,
@@ -114,21 +115,19 @@ export const olcsGeometryType = {
114
115
 
115
116
  /**
116
117
  * Is set on a feature and is used to signal that the feature has a specific vectorStyleItem.
117
- * Is set by the Editor if the layerStyle is overwritten. The Vector layer assures this style is set, if
118
+ * Is set by the Editor if the layerStyle is overwritten. The VectorLayer layer assures this style is set, if
118
119
  * the style on the layer is not a DeclarativeStyle
119
120
  * @type {symbol}
120
- * @export
121
121
  */
122
122
  export const vectorStyleSymbol = Symbol('VcsVectorStyleItem');
123
123
 
124
124
  /**
125
125
  * @class
126
126
  * @extends {StyleItem}
127
- * @export
128
127
  * @api
129
128
  */
130
129
  class VectorStyleItem extends StyleItem {
131
- static get className() { return 'vcs.vcm.util.style.VectorStyleItem'; }
130
+ static get className() { return 'VectorStyleItem'; }
132
131
 
133
132
  /**
134
133
  * @param {VectorStyleItemOptions} options
@@ -521,12 +520,12 @@ class VectorStyleItem extends StyleItem {
521
520
  updateCesiumStyleColor(silent) {
522
521
  const colorConditions = getDefaultCondition('olcs_color', true);
523
522
  if (this.stroke && this.stroke.getColor()) {
524
- colorConditions.splice(1, 0, [`\${olcs_geometryType}===${olcsGeometryType.POLYLINE}`, getStringColor(this.stroke.getColor())]);
523
+ colorConditions.splice(1, 0, [`\${olcs_geometryType}===${OlcsGeometryType.POLYLINE}`, getStringColor(this.stroke.getColor())]);
525
524
  }
526
525
  if (this._image instanceof Circle && this._image.getFill()) {
527
526
  colorConditions.splice(
528
527
  1, 0,
529
- [`\${olcs_geometryType}===${olcsGeometryType.POINT}`, getStringColor(this._image.getFill().getColor())],
528
+ [`\${olcs_geometryType}===${OlcsGeometryType.POINT}`, getStringColor(this._image.getFill().getColor())],
530
529
  );
531
530
  }
532
531
  if (this.fillColor) {
@@ -710,7 +709,9 @@ class VectorStyleItem extends StyleItem {
710
709
  });
711
710
  return result;
712
711
  }
713
- return new VectorStyleItem(this.getOptions());
712
+ const config = this.toJSON();
713
+ delete config.name;
714
+ return new VectorStyleItem(config);
714
715
  }
715
716
 
716
717
  /**
@@ -719,6 +720,7 @@ class VectorStyleItem extends StyleItem {
719
720
  * @api
720
721
  */
721
722
  assign(result) {
723
+ super.assign(result);
722
724
  if (result.fillColor) {
723
725
  this.fillColor = result.fillColor.slice();
724
726
  }
@@ -755,79 +757,61 @@ class VectorStyleItem extends StyleItem {
755
757
  }
756
758
 
757
759
  /**
758
- * @param {VectorStyleItemSections=} sections
759
760
  * @returns {VectorStyleItemOptions}
760
761
  * @api
761
762
  */
762
- getOptions(sections) {
763
+ toJSON() {
763
764
  // TODO clean default, only copy relevant keys
764
- const options = /** @type {VectorStyleItemOptions} */ (super.getOptions(sections));
765
- options.type = StyleType.VECTOR;
766
- /** @type {VectorStyleItemSections} */
767
- const usedSections = sections || {
768
- fill: true,
769
- stroke: true,
770
- text: true,
771
- image: true,
772
- };
773
-
774
- if (usedSections.fill) {
775
- if (this._fillOptions) {
776
- options.fill = {
777
- color: /** @type {import("ol/color").Color} */ (parseColor(this._fillOptions.color).slice()),
778
- };
779
- if (this._fillOptions.pattern) {
780
- options.fill.pattern = { ...this._fillOptions.pattern };
781
- }
782
- } else if (this.exclude.fill) {
783
- options.fill = false;
765
+ const options = /** @type {VectorStyleItemOptions} */ (super.toJSON());
766
+ if (this._fillOptions) {
767
+ options.fill = {
768
+ color: /** @type {import("ol/color").Color} */ (parseColor(this._fillOptions.color).slice()),
769
+ };
770
+ if (this._fillOptions.pattern) {
771
+ options.fill.pattern = { ...this._fillOptions.pattern };
784
772
  }
773
+ } else if (this.exclude.fill) {
774
+ options.fill = false;
785
775
  }
786
776
 
787
- if (usedSections.stroke) {
788
- if (this._stroke) {
789
- options.stroke = getStrokeOptions(this._stroke);
790
- } else if (this.exclude.stroke) {
791
- options.stroke = false;
792
- }
777
+ if (this._stroke) {
778
+ options.stroke = getStrokeOptions(this._stroke);
779
+ } else if (this.exclude.stroke) {
780
+ options.stroke = false;
793
781
  }
794
782
 
795
- if (usedSections.text) {
796
- if (this._text) {
797
- options.text = getTextOptions(this._text);
798
- }
783
+ if (this._text) {
784
+ options.text = getTextOptions(this._text);
799
785
  }
800
786
 
801
- if (usedSections.label) {
787
+ if (this._label) {
802
788
  options.label = this._label;
803
789
  }
804
790
 
805
- if (usedSections.image) { // TODO this should be nicer...
806
- if (this._image instanceof Icon) {
807
- options.image = {
808
- src: this._image.getSrc(), // XXX this is an issue... we dont want a data URI in the geoJSON
809
- scale: this._image.getScale(),
810
- opacity: this._image.getOpacity(),
811
- };
812
- } else if (this._image instanceof Circle) {
813
- options.image = {
814
- scale: this._image.getScale(),
815
- fill: getFillOptions(this._image),
816
- radius: this._image.getRadius(),
817
- stroke: this._image.getStroke() ? getStrokeOptions(this._image.getStroke()) : undefined,
818
- };
819
- } else if (this._image instanceof RegularShape) {
820
- options.image = {
821
- scale: this._image.getScale(),
822
- fill: getFillOptions(this._image),
823
- points: this._image.getPoints(),
824
- angle: this._image.getAngle(),
825
- radius: this._image.getRadius(),
826
- stroke: this._image.getStroke() ? getStrokeOptions(this._image.getStroke()) : undefined,
827
- };
828
- } else if (this.exclude.image) {
829
- options.image = false;
830
- }
791
+ if (this._image instanceof Icon) {
792
+ options.image = {
793
+ src: this._image.getSrc(), // XXX this is an issue... we dont want a data URI in the geoJSON
794
+ scale: this._image.getScale(),
795
+ opacity: this._image.getOpacity(),
796
+ };
797
+ } else if (this._image instanceof Circle) {
798
+ options.image = {
799
+ scale: this._image.getScale(),
800
+ fill: getFillOptions(this._image),
801
+ radius: this._image.getRadius(),
802
+ stroke: this._image.getStroke() ? getStrokeOptions(this._image.getStroke()) : undefined,
803
+ };
804
+ } else if (this._image instanceof RegularShape) {
805
+ options.image = {
806
+ scale: this._image.getScale(),
807
+ fill: getFillOptions(this._image),
808
+ points: this._image.getPoints(),
809
+ angle: this._image.getAngle(),
810
+ radius: this._image.getRadius(),
811
+ stroke: this._image.getStroke() ? getStrokeOptions(this._image.getStroke()) : undefined,
812
+ };
813
+ } else if (this.exclude.image) {
814
+ options.image = false;
831
815
  }
832
816
 
833
817
  return options;
@@ -841,33 +825,38 @@ class VectorStyleItem extends StyleItem {
841
825
  const type = feature.getGeometry().getType();
842
826
  const extrusion = feature.get('olcs_extrudedHeight') ||
843
827
  (feature.get('olcs_storeyHeight') && feature.get('olcs_storeyNumber'));
844
- const sections = {};
828
+ const sections = new Set();
845
829
 
846
830
  if (type === 'Point' || type === 'MultiPoint') {
847
831
  if (feature[vectorStyleSymbol].label != null) {
848
- sections.text = true;
849
- sections.label = true;
832
+ sections.add('text');
833
+ sections.add('label');
850
834
  }
851
- sections.image = true;
835
+ sections.add('image');
852
836
 
853
837
  if (extrusion) {
854
- sections.stroke = true;
838
+ sections.add('stroke');
855
839
  }
856
840
  } else if (type === 'LineString' || type === 'MultiLineString') {
857
- sections.stroke = true;
841
+ sections.add('stroke');
858
842
  if (extrusion) {
859
- sections.fill = true;
843
+ sections.add('fill');
860
844
  }
861
845
  } else if (type === 'Polygon' || type === 'MultiPolygon' || type === 'Circle') {
862
- sections.stroke = true;
863
- sections.fill = true;
846
+ sections.add('stroke');
847
+ sections.add('fill');
864
848
  } else if (type === 'GeometryCollection') {
865
- sections.stroke = true;
866
- sections.fill = true;
867
- sections.image = true;
868
- sections.text = true;
869
- }
870
- return this.getOptions(sections);
849
+ sections.add('stroke');
850
+ sections.add('fill');
851
+ sections.add('image');
852
+ sections.add('text');
853
+ }
854
+ const config = this.toJSON();
855
+ const options = {};
856
+ sections.forEach((key) => {
857
+ options[key] = config[key];
858
+ });
859
+ return options;
871
860
  }
872
861
 
873
862
  /**
@@ -904,14 +893,13 @@ export default VectorStyleItem;
904
893
 
905
894
  /**
906
895
  * @type {VectorStyleItem}
907
- * @export
908
896
  */
909
897
  export const defaultVectorStyle = new VectorStyleItem(getDefaultVectorStyleItemOptions());
898
+ styleClassRegistry.registerClass(VectorStyleItem.className, VectorStyleItem);
910
899
 
911
900
  /**
912
901
  * @param {import("@vcmap/cesium").Color} cesiumColor
913
902
  * @returns {VectorStyleItem}
914
- * @export
915
903
  */
916
904
  export function fromCesiumColor(cesiumColor) {
917
905
  const color = /** @type {import("ol/color").Color} */ (cesiumColor.toBytes());
@@ -1,6 +1,5 @@
1
1
  import VectorStyleItem from './vectorStyleItem.js';
2
2
  import DeclarativeStyleItem from './declarativeStyleItem.js';
3
- import { referenceableStyleSymbol } from './styleItem.js';
4
3
 
5
4
  /**
6
5
  * @param {VectorStyleItemOptions} obj
@@ -34,13 +33,11 @@ export function embedIconsInStyle(obj, embeddedIcons) {
34
33
  * @param {VcsMeta=} vcsMeta
35
34
  * @returns {VcsMeta}
36
35
  */
37
- function writeStyle(style, vcsMeta = {}) {
38
- if (style[referenceableStyleSymbol]) { // XXX this should be configurable. In some cases, writting out the actual style would be desirable
39
- vcsMeta.style = style.getReference();
40
- } else if (style instanceof VectorStyleItem) {
41
- vcsMeta.style = embedIconsInStyle(style.getOptions(), vcsMeta.embeddedIcons);
36
+ function writeStyle(style, vcsMeta = {}) { // XXX this entire function is not what is to be expected. feature store expects styles as refs to be possible
37
+ if (style instanceof VectorStyleItem) {
38
+ vcsMeta.style = embedIconsInStyle(style.toJSON(), vcsMeta.embeddedIcons);
42
39
  } else if (style instanceof DeclarativeStyleItem) {
43
- vcsMeta.style = style.getOptions();
40
+ vcsMeta.style = style.toJSON();
44
41
  }
45
42
  return vcsMeta;
46
43
  }
@@ -4,13 +4,12 @@ import { Cesium3DTileset } from '@vcmap/cesium';
4
4
  import { check } from '@vcsuite/check';
5
5
  import { parseBoolean } from '@vcsuite/parsers';
6
6
  import { getLogger as getLoggerByName } from '@vcsuite/logger';
7
- import CesiumMap from '../../maps/cesium.js';
8
- import VcsEvent from '../../event/vcsEvent.js';
7
+ import CesiumMap from '../../map/cesiumMap.js';
8
+ import VcsEvent from '../../vcsEvent.js';
9
9
  import LayerCollection from '../layerCollection.js';
10
10
 
11
11
  /**
12
12
  * @namespace clipping
13
- * @export
14
13
  * @api
15
14
  */
16
15
 
@@ -36,21 +35,20 @@ import LayerCollection from '../layerCollection.js';
36
35
  * @returns {import("@vcsuite/logger").Logger}
37
36
  */
38
37
  function getLogger() {
39
- return getLoggerByName('vcs.vcm.util.clipping.ClippingObject');
38
+ return getLoggerByName('ClippingObject');
40
39
  }
41
40
 
42
41
  const globeSymbol = Symbol('ClippingObjectGlobe');
43
42
 
44
43
  /**
45
44
  * The ClippingObject is a container for a Cesium.ClippingPlaneCollection. The container holds information on the
46
- * targeted Cesium objects, based on layerNames (for [CesiumTileset]{@link CesiumTileset}) or
47
- * layerName and entity id for Cesium.DataSource which are part of an [DataSource]{@link DataSource} layer.
45
+ * targeted Cesium objects, based on layerNames (for [CesiumTilesetLayer]{@link CesiumTilesetLayer}) or
46
+ * layerName and entity id for Cesium.DataSourceLayer which are part of an [DataSourceLayer]{@link DataSource} layer.
48
47
  * Adding a ClippingObject to the [ClippingObjectManager]{@link ClippingObjectManager} applies the
49
48
  * objects Cesium.ClippingPlaneCollection where applicable. Once added, changes to the targets of the object are tracked.
50
49
  * To update the Cesium.ClippingPlaneCollection or its definitions, you must trigger an update by setting the clippingPlaneCollection
51
50
  * property to the new definition.
52
51
  * @class
53
- * @export
54
52
  * @api stable
55
53
  */
56
54
  class ClippingObject {
@@ -115,7 +113,7 @@ class ClippingObject {
115
113
  this.clippingPlaneUpdated = new VcsEvent();
116
114
 
117
115
  /**
118
- * @type {Set<import("@vcmap/core").FeatureStore>}
116
+ * @type {Set<import("@vcmap/core").FeatureStoreLayer>}
119
117
  * @private
120
118
  */
121
119
  this._cachedFeatureStoreLayers = new Set();
@@ -264,11 +262,11 @@ class ClippingObject {
264
262
  this.targetsUpdated.raiseEvent();
265
263
  }
266
264
  }
267
- } else if (this.layerNames.includes(layer.name) && layer.className === 'vcs.vcm.layer.FeatureStore') {
265
+ } else if (this.layerNames.includes(layer.name) && layer.className === 'FeatureStoreLayer') {
268
266
  if (layer.active) {
269
- this._cachedFeatureStoreLayers.add(/** @type {import("@vcmap/core").FeatureStore} */ (layer));
270
- } else if (this._cachedFeatureStoreLayers.has(/** @type {import("@vcmap/core").FeatureStore} */ (layer))) {
271
- this._cachedFeatureStoreLayers.delete(/** @type {import("@vcmap/core").FeatureStore} */ (layer));
267
+ this._cachedFeatureStoreLayers.add(/** @type {import("@vcmap/core").FeatureStoreLayer} */ (layer));
268
+ } else if (this._cachedFeatureStoreLayers.has(/** @type {import("@vcmap/core").FeatureStoreLayer} */ (layer))) {
269
+ this._cachedFeatureStoreLayers.delete(/** @type {import("@vcmap/core").FeatureStoreLayer} */ (layer));
272
270
  }
273
271
  }
274
272
  }
@@ -1,7 +1,7 @@
1
1
  import { check } from '@vcsuite/check';
2
2
  import { clearClippingPlanes, setClippingPlanes } from './clippingPlaneHelper.js';
3
3
  import ClippingObject from './clippingObject.js';
4
- import CesiumMap from '../../maps/cesium.js';
4
+ import CesiumMap from '../../map/cesiumMap.js';
5
5
 
6
6
  /**
7
7
  * ClippingObjectManager, a singleton Class for managing [ClippingObjects]{@link ClippingObject}. The manager takes care to only apply a
@@ -12,12 +12,11 @@ import CesiumMap from '../../maps/cesium.js';
12
12
  * overwritten in the order they where added to the manager. Exclusive [ClippingObjects]{@link ClippingObject} are always applied last, even
13
13
  * if a default [ClippingObject]{@link ClippingObject} is added after.
14
14
  * @class
15
- * @export
16
15
  * @api stable
17
16
  */
18
17
  class ClippingObjectManager {
19
18
  static get className() {
20
- return 'vcs.vcm.util.clipping.ClippingObjectManager';
19
+ return 'ClippingObjectManager';
21
20
  }
22
21
 
23
22
  constructor(layerCollection) {
@@ -19,7 +19,7 @@ import Polygon from 'ol/geom/Polygon.js';
19
19
 
20
20
  import { check, checkMaybe } from '@vcsuite/check';
21
21
  import Projection, { mercatorProjection, wgs84Projection } from '../projection.js';
22
- import { createOrUpdateFromGeometry } from '../featureconverter/extent3d.js';
22
+ import Extent3D from '../featureconverter/extent3D.js';
23
23
  import { enforceEndingVertex, enforceRightHand, getFlatCoordinatesFromGeometry } from '../geometryHelpers.js';
24
24
 
25
25
  /**
@@ -75,9 +75,9 @@ function createVerticalPlanes(coords) {
75
75
  */
76
76
  function createHorizontalPlanes(feature, coords, options) {
77
77
  const clippingPlanes = [];
78
- const extent = createOrUpdateFromGeometry(feature.getGeometry());
79
- let min = Number.isFinite(extent[2]) ? extent[2] : 0;
80
- let max = Number.isFinite(extent[5]) ? extent[5] : 0;
78
+ const extent = Extent3D.fromGeometry(feature.getGeometry());
79
+ let min = Number.isFinite(extent.minZ) ? extent.minZ : 0;
80
+ let max = Number.isFinite(extent.maxZ) ? extent.maxZ : 0;
81
81
  const extruded = feature.get('olcs_extrudedHeight');
82
82
  if (extruded) {
83
83
  max += extruded;
@@ -139,7 +139,6 @@ function createEndingPlanes(coords) {
139
139
  * @param {import("@vcmap/cesium").Matrix4=} transformMatrix - 4x4 matrix specifying the transform of clipping planes from Earth's fixed frame to another one
140
140
  * @returns {import("@vcmap/cesium").ClippingPlaneCollection|null}
141
141
  * @api stable
142
- * @export
143
142
  */
144
143
  export function createClippingPlaneCollection(feature, options = {}, transformMatrix) {
145
144
  check(feature, Feature);
@@ -203,7 +202,6 @@ export function createClippingPlaneCollection(feature, options = {}, transformMa
203
202
  * @param {import("@vcmap/cesium").Cartesian3=} originPoint - the origin point of the transformation target, so the plane distance can be set correctly
204
203
  * @returns {import("@vcmap/cesium").ClippingPlaneCollection}
205
204
  * @api stable
206
- * @export
207
205
  */
208
206
  export function copyClippingPlanesToCollection(source, result, transformMatrix, originPoint) {
209
207
  check(source, ClippingPlaneCollection);
@@ -346,7 +344,6 @@ export function setClippingPlanes(target, clippingPlaneCollection, local) {
346
344
  * @param {number} [offsetDistance=25] - the offset from the coordinate to use for the size of the geometry
347
345
  * @returns {import("ol").Feature<import("ol/geom/Geometry").default>} - the features geometry is in web mercator
348
346
  * @api
349
- * @export
350
347
  */
351
348
  export function createClippingFeature(coordinate, camera, vertical = false, offsetDistance = 25) {
352
349
  check(coordinate, [Number]);
@@ -389,7 +386,6 @@ export function createClippingFeature(coordinate, camera, vertical = false, offs
389
386
  * @param {boolean=} [infinite=false]
390
387
  * @returns {CreationOptions}
391
388
  * @api
392
- * @export
393
389
  */
394
390
  export function getClippingOptions(feature, infinite = false) {
395
391
  checkMaybe(feature, Feature);
@@ -1,9 +1,8 @@
1
- import VcsEvent from '../event/vcsEvent.js';
1
+ import VcsEvent from '../vcsEvent.js';
2
2
 
3
3
  /**
4
4
  * A generic array based collection. Implements the Symbol.iterator (e.g. [...collection])
5
5
  * @class
6
- * @export
7
6
  * @template {*} T
8
7
  * @api
9
8
  */
@@ -135,15 +134,28 @@ class Collection {
135
134
  return null;
136
135
  }
137
136
 
137
+ /**
138
+ * internal remove function, to remove an item from the collection, does not raise an event.
139
+ * @param {T} item
140
+ * @returns {number} returns the index of the removed item or -1 if the item has not been found.
141
+ * @protected
142
+ */
143
+ _remove(item) {
144
+ const index = this._array.indexOf(item);
145
+ if (index > -1) {
146
+ this._array.splice(index, 1);
147
+ }
148
+ return index;
149
+ }
150
+
138
151
  /**
139
152
  * Removes an item from the collection
140
153
  * @param {T} item
141
154
  * @api
142
155
  */
143
156
  remove(item) {
144
- const index = this._array.indexOf(item);
157
+ const index = this._remove(item);
145
158
  if (index > -1) {
146
- this._array.splice(index, 1);
147
159
  this.removed.raiseEvent(item);
148
160
  }
149
161
  }
File without changes
File without changes
@@ -1,8 +1,10 @@
1
1
  import Projection from './projection.js';
2
2
 
3
3
  /**
4
- * @typedef {ProjectionOptions} ExtentOptions
5
- * @property {import("ol/extent").Extent|undefined} coordinates - if not specified, the extent of the projection is used
4
+ * @typedef {Object} ExtentOptions
5
+ * @property {string} [type]
6
+ * @property {import("ol/extent").Extent|undefined} [coordinates] - if not specified, the extent of the projection is used
7
+ * @property {ProjectionOptions} [projection] - if not specified the default projection is assumed
6
8
  * @api
7
9
  */
8
10
 
@@ -31,20 +33,20 @@ function checkExtentValidity(extent) {
31
33
  /**
32
34
  * Extent Class
33
35
  * @class
34
- * @export
35
36
  * @api
36
37
  */
37
38
  class Extent {
39
+ /**
40
+ * @type {string}
41
+ */
42
+ static get className() { return 'Extent'; }
43
+
38
44
  /**
39
45
  * @param {ExtentOptions=} options object
40
46
  */
41
47
  constructor(options = {}) {
42
48
  /** @type {Projection} */
43
- this.projection = new Projection({
44
- epsg: options.epsg,
45
- proj4: options.proj4,
46
- alias: options.alias,
47
- });
49
+ this.projection = new Projection(options.projection);
48
50
 
49
51
  /** @type {import("ol/extent").Extent|null} */
50
52
  this.extent = options.coordinates || this.projection.proj.getExtent();
@@ -78,15 +80,19 @@ class Extent {
78
80
  /**
79
81
  * @returns {ExtentOptions}
80
82
  */
81
- getConfigObject() {
82
- return { coordinates: this.extent.slice(), ...this.projection.getConfigObject() };
83
+ toJSON() {
84
+ return {
85
+ coordinates: this.extent.slice(),
86
+ projection: this.projection.toJSON(),
87
+ type: Extent.className,
88
+ };
83
89
  }
84
90
 
85
91
  /**
86
92
  * @returns {Extent}
87
93
  */
88
94
  clone() {
89
- return new Extent(this.getConfigObject());
95
+ return new Extent(this.toJSON());
90
96
  }
91
97
 
92
98
  /**
@@ -112,7 +118,7 @@ class Extent {
112
118
  * @api
113
119
  */
114
120
  static validateOptions(options) {
115
- return Projection.validateOptions(options) && checkExtentValidity(options.coordinates);
121
+ return Projection.validateOptions(options.projection || {}) && checkExtentValidity(options.coordinates);
116
122
  }
117
123
 
118
124
  /**