@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
@@ -11,7 +11,7 @@ import { getLogger as getLoggerByName } from '@vcsuite/logger';
11
11
  * @returns {import("@vcsuite/logger").Logger}
12
12
  */
13
13
  function getLogger() {
14
- return getLoggerByName('vcs.vcm.util.style.StyleHelpers');
14
+ return getLoggerByName('StyleHelpers');
15
15
  }
16
16
 
17
17
  /**
@@ -27,7 +27,6 @@ function getLogger() {
27
27
  /**
28
28
  * @enum {number}
29
29
  * @const
30
- * @export
31
30
  * @property {number} NWSE
32
31
  * @property {number} SWNE
33
32
  * @property {number} DIAGONALCROSS
@@ -50,7 +49,6 @@ export const PatternType = {
50
49
  * @param {string} h
51
50
  * @param {number=} opacity
52
51
  * @returns {import("ol/color").Color}
53
- * @export
54
52
  */
55
53
  export function hexToOlColor(h, opacity) {
56
54
  let hex = h.substring(1);
@@ -81,7 +79,6 @@ export function cesiumColorToColor(cesiumColor) {
81
79
  * @param {import("ol/color").Color} olColor
82
80
  * @returns {import("@vcmap/cesium").Color}
83
81
  * @api
84
- * @export
85
82
  */
86
83
  export function olColorToCesiumColor(olColor) {
87
84
  return Color.fromBytes(olColor[0], olColor[1], olColor[2], olColor[3] * 255);
@@ -93,7 +90,6 @@ export function olColorToCesiumColor(olColor) {
93
90
  * @param {import("ol/color").Color=} defaultColor
94
91
  * @returns {import("ol/color").Color}
95
92
  * @api
96
- * @export
97
93
  */
98
94
  export function parseColor(color, defaultColor) {
99
95
  if (Array.isArray(color)) {
@@ -135,7 +131,6 @@ export function parseColor(color, defaultColor) {
135
131
  * @param {import("ol/color").Color|import("ol/colorlike").ColorLike} color
136
132
  * @param {import("ol/color").Color} defaultColor
137
133
  * @returns {import("@vcmap/cesium").Color}
138
- * @export
139
134
  */
140
135
  export function getCesiumColor(color, defaultColor) {
141
136
  const olColor = parseColor(color, defaultColor);
@@ -145,7 +140,6 @@ export function getCesiumColor(color, defaultColor) {
145
140
  /**
146
141
  * @param {import("ol/color").Color|Array<number>|import("ol/colorlike").ColorLike} color
147
142
  * @returns {string}
148
- * @export
149
143
  */
150
144
  export function getStringColor(color) {
151
145
  return `rgba(${parseColor(color).join(',')})`;
@@ -155,7 +149,6 @@ export function getStringColor(color) {
155
149
  * @param {VectorStyleItemFill} options
156
150
  * @param {HTMLCanvasElement=} optCanvas
157
151
  * @returns {CanvasPattern}
158
- * @export
159
152
  */
160
153
  export function createPattern(options, optCanvas) {
161
154
  const pixelRatio = DEVICE_PIXEL_RATIO;
@@ -215,7 +208,6 @@ export function createPattern(options, optCanvas) {
215
208
  /**
216
209
  * @param {import("ol/color").Color} color
217
210
  * @returns {string}
218
- * @export
219
211
  */
220
212
  export function olColorToHex(color) {
221
213
  function componentHex(c) {
@@ -230,7 +222,6 @@ export function olColorToHex(color) {
230
222
  /**
231
223
  * @param {string} colorValue
232
224
  * @returns {boolean}
233
- * @export
234
225
  */
235
226
  export function validateHexColor(colorValue) {
236
227
  return /^#[0-9a-f]{6}$/.test(colorValue);
@@ -239,7 +230,6 @@ export function validateHexColor(colorValue) {
239
230
  /**
240
231
  * @param {string|FontObject} font
241
232
  * @returns {FontObject}
242
- * @export
243
233
  */
244
234
  export function parseFont(font) {
245
235
  if (typeof font !== 'string') {
@@ -310,7 +300,6 @@ export function parseFont(font) {
310
300
  /**
311
301
  * @param {FontObject} fontObject
312
302
  * @returns {string}
313
- * @export
314
303
  */
315
304
  export function combineFont(fontObject) {
316
305
  const order = [
@@ -521,12 +510,12 @@ const default3DTileStyleValues = {
521
510
  olcs_outlineWidth: '0.0',
522
511
  olcs_outlineColor: getStringColor(blackColor),
523
512
  olcs_pointSize: '8.0',
524
- olcs_image: undefined,
513
+ olcs_image: null,
525
514
  olcs_font: `'${getDefaultVectorStyleItemOptions().text.font}'`,
526
515
  olcs_fontColor: getStringColor(blackColor),
527
516
  olcs_fontOutlineWidth: '1.0',
528
517
  olcs_fontOutlineColor: getStringColor(whiteColor),
529
- olcs_labelText: undefined,
518
+ olcs_labelText: null,
530
519
  olcs_anchorLineColor: getStringColor(whiteColor),
531
520
  };
532
521
 
@@ -2,14 +2,9 @@ import { Cesium3DTileStyle, Cesium3DTileColorBlendMode } from '@vcmap/cesium';
2
2
  import deepEqual from 'fast-deep-equal';
3
3
 
4
4
  import { parseEnumValue } from '@vcsuite/parsers';
5
- import VcsObject from '../../object.js';
6
- import VcsEvent from '../../event/vcsEvent.js';
7
-
8
- /**
9
- * @namespace style
10
- * @export
11
- * @api
12
- */
5
+ import VcsObject from '../vcsObject.js';
6
+ import VcsEvent from '../vcsEvent.js';
7
+ import { styleClassRegistry } from '../classRegistry.js';
13
8
 
14
9
  /**
15
10
  * @typedef {Object} StyleItemLegendEntry
@@ -20,61 +15,25 @@ import VcsEvent from '../../event/vcsEvent.js';
20
15
 
21
16
  /**
22
17
  * @typedef {VcsObjectOptions} StyleItemOptions
23
- * @property {string|undefined} [type] - used in configuration to differentiate vector from declarative styles
24
- * @property {string|Object<string, string>|undefined} title - name is used when none is specifies
25
- * @property {Array<StyleItemLegendEntry>|undefined} [legend]
26
18
  * @property {number} [colorBlendMode=import("@vcmap/cesium").Cesium3DTileColorBlendMode.HIGHLIGHT] - colorBlendMode for 3D Tiledataset @see https://cesiumjs.org/import("@vcmap/cesium").Build/Documentation/Cesium3DTileColorBlendMode.html
27
19
  * @api
28
20
  */
29
21
 
30
- /**
31
- * @typedef {Object} Reference
32
- * @property {string} [type=StyleType.REFERENCE]
33
- * @property {string} name
34
- * @property {string|undefined} [url] - vcs:undocumented this is not yet implemented
35
- * @api
36
- */
37
-
38
22
  /**
39
23
  * @typedef {Object} StyleItemSections
40
24
  * @property {boolean|undefined} [meta]
41
25
  * @api
42
26
  */
43
27
 
44
- /**
45
- * Enumeration of possible style types.
46
- * @enum {string}
47
- * @property {string} VECTOR
48
- * @property {string} DECLARATIVE
49
- * @property {string} REFERENCE
50
- * @export
51
- * @api
52
- */
53
- export const StyleType = {
54
- VECTOR: 'vector',
55
- DECLARATIVE: 'declarative',
56
- REFERENCE: 'reference',
57
- CLUSTER: 'cluster',
58
- };
59
-
60
- /**
61
- * indicates, that this style is part of the config and can be referenced by name
62
- * @type {symbol}
63
- * @export
64
- * @api
65
- */
66
- export const referenceableStyleSymbol = Symbol('referencableStyleSymbol');
67
-
68
28
  /**
69
29
  * An abstract style definition which can be applied to a layer
70
30
  * @class
71
- * @export
72
31
  * @api
73
32
  * @abstract
74
33
  * @extends {VcsObject}
75
34
  */
76
35
  class StyleItem extends VcsObject {
77
- static get className() { return 'vcs.vcm.util.style.StyleItem'; }
36
+ static get className() { return 'StyleItem'; }
78
37
 
79
38
  /**
80
39
  * @param {StyleItemOptions} options
@@ -82,18 +41,6 @@ class StyleItem extends VcsObject {
82
41
  constructor(options) {
83
42
  super(options);
84
43
 
85
- /**
86
- * @type {string|Object<string, string>}
87
- */
88
- this.title = options.title || this.name.toString();
89
-
90
- /**
91
- * Legend entries
92
- * @type {Array<StyleItemLegendEntry>}
93
- * @api
94
- */
95
- this.legend = options.legend || [];
96
-
97
44
  /** @type {Array<string>} */
98
45
  this.supportedLayers = [];
99
46
 
@@ -146,24 +93,20 @@ class StyleItem extends VcsObject {
146
93
  }
147
94
 
148
95
  /**
149
- * Gets the options for this style item to be used in a config or vcsMeta
150
- * @param {(VectorStyleItemSections|DeclarativeStyleItemSections)=} sections
151
- * @returns {VectorStyleItemOptions|DeclarativeStyleItemOptions}
152
- * @api
96
+ * @inheritDoc
97
+ * @returns {StyleItemOptions}
153
98
  */
154
- getOptions(sections) {
155
- if (sections && sections.meta) {
156
- return {
157
- name: this.name.toString(),
158
- title: this.title,
159
- legend: this.legend.length ? this.legend : undefined,
160
- };
99
+ toJSON() {
100
+ const config = /** @type {StyleItemOptions} */ (super.toJSON());
101
+ if (this.colorBlendMode !== Cesium3DTileColorBlendMode.HIGHLIGHT) {
102
+ config.colorBlendMode = this.colorBlendMode;
161
103
  }
162
- return {};
104
+
105
+ return config;
163
106
  }
164
107
 
165
108
  /**
166
- * Clones this style
109
+ * Clones this style. Does not pass the name property.
167
110
  * @param {StyleItem=} result
168
111
  * @returns {StyleItem}
169
112
  * @api
@@ -176,36 +119,29 @@ class StyleItem extends VcsObject {
176
119
  * @returns {StyleItem}
177
120
  * @api
178
121
  */
179
- // eslint-disable-next-line class-methods-use-this
180
- assign(styleItem) { return styleItem; }
122
+ assign(styleItem) {
123
+ this.properties = JSON.parse(JSON.stringify(styleItem.properties));
124
+ return this;
125
+ }
181
126
 
182
127
  /**
128
+ * Tests if two styleItems are equivalent. Does not match the name property (e.g. identifier)
183
129
  * @param {StyleItem} styleItem
184
130
  * @returns {boolean}
185
131
  * @api
186
132
  */
187
133
  equals(styleItem) {
188
134
  if (this !== styleItem) {
189
- const options = this.getOptions();
190
- const candidateOptions = styleItem.getOptions();
135
+ const options = this.toJSON();
136
+ delete options.name;
137
+ const candidateOptions = styleItem.toJSON();
138
+ delete candidateOptions.name;
191
139
  return deepEqual(options, candidateOptions);
192
140
  }
193
141
 
194
142
  return true;
195
143
  }
196
144
 
197
- /**
198
- * gets a reference to this style by its name. should only be used for static styles, aka styles already part of the config
199
- * @returns {Reference}
200
- * @api
201
- */
202
- getReference() {
203
- return {
204
- type: StyleType.REFERENCE,
205
- name: this.name.toString(),
206
- };
207
- }
208
-
209
145
  /**
210
146
  * @protected
211
147
  */
@@ -224,3 +160,4 @@ class StyleItem extends VcsObject {
224
160
  }
225
161
 
226
162
  export default StyleItem;
163
+ styleClassRegistry.registerClass(StyleItem.className, StyleItem);
@@ -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) {