@vcmap/core 5.0.0-rc.23 → 5.0.0-rc.25

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 (65) hide show
  1. package/index.d.ts +824 -200
  2. package/index.js +24 -10
  3. package/package.json +2 -2
  4. package/src/category/category.js +1 -1
  5. package/src/featureProvider/abstractFeatureProvider.js +1 -18
  6. package/src/interaction/eventHandler.js +14 -0
  7. package/src/layer/cesium/cesiumTilesetCesiumImpl.js +4 -19
  8. package/src/layer/cesium/clusterContext.js +18 -0
  9. package/src/layer/cesium/vectorCesiumImpl.js +17 -2
  10. package/src/layer/cesium/vectorContext.js +187 -11
  11. package/src/layer/cesium/vectorRasterTileCesiumImpl.js +0 -1
  12. package/src/layer/cesiumTilesetLayer.js +1 -63
  13. package/src/layer/czmlLayer.js +1 -1
  14. package/src/layer/dataSourceLayer.js +1 -53
  15. package/src/layer/featureLayer.js +42 -38
  16. package/src/layer/featureStoreLayer.js +0 -15
  17. package/src/layer/layer.js +6 -11
  18. package/src/layer/layerSymbols.js +2 -1
  19. package/src/layer/oblique/vectorObliqueImpl.js +6 -0
  20. package/src/layer/openStreetMapLayer.js +6 -0
  21. package/src/layer/openlayers/layerOpenlayersImpl.js +69 -4
  22. package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +0 -80
  23. package/src/layer/rasterLayer.js +1 -1
  24. package/src/layer/vectorHelpers.js +0 -85
  25. package/src/layer/vectorLayer.js +1 -9
  26. package/src/layer/vectorProperties.js +150 -8
  27. package/src/layer/vectorTileLayer.js +0 -9
  28. package/src/map/baseOLMap.js +17 -0
  29. package/src/map/cesiumMap.js +46 -8
  30. package/src/map/vcsMap.js +23 -5
  31. package/src/style/arcStyle.js +316 -0
  32. package/src/style/arrowStyle.js +269 -0
  33. package/src/util/editor/createFeatureSession.js +3 -1
  34. package/src/util/editor/editFeaturesSession.js +315 -0
  35. package/src/util/editor/editGeometrySession.js +5 -1
  36. package/src/util/editor/editorHelpers.js +118 -14
  37. package/src/util/editor/editorSessionHelpers.js +12 -0
  38. package/src/util/editor/editorSymbols.js +6 -0
  39. package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +120 -0
  40. package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +1 -3
  41. package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +48 -0
  42. package/src/util/editor/interactions/mapInteractionController.js +5 -2
  43. package/src/util/editor/interactions/selectMultiFeatureInteraction.js +146 -0
  44. package/src/util/editor/interactions/translateVertexInteraction.js +2 -2
  45. package/src/util/editor/transformation/create2DHandlers.js +294 -0
  46. package/src/util/editor/transformation/create3DHandlers.js +575 -0
  47. package/src/util/editor/transformation/extrudeInteraction.js +91 -0
  48. package/src/util/editor/transformation/rotateInteraction.js +188 -0
  49. package/src/util/editor/transformation/scaleInteraction.js +185 -0
  50. package/src/util/editor/transformation/transformationHandler.js +168 -0
  51. package/src/util/editor/transformation/transformationTypes.js +83 -0
  52. package/src/util/editor/transformation/translateInteraction.js +209 -0
  53. package/src/util/featureconverter/arcToCesium.js +87 -0
  54. package/src/util/featureconverter/convert.js +7 -1
  55. package/src/util/featureconverter/extent3D.js +64 -1
  56. package/src/util/featureconverter/lineStringToCesium.js +103 -2
  57. package/src/util/featureconverter/pointHelpers.js +341 -0
  58. package/src/util/featureconverter/pointToCesium.js +27 -76
  59. package/src/util/geometryHelpers.js +11 -8
  60. package/src/util/mapCollection.js +30 -24
  61. package/src/util/math.js +99 -2
  62. package/tests/unit/helpers/cesiumHelpers.js +14 -4
  63. package/tests/unit/helpers/helpers.js +13 -0
  64. package/src/featureProvider/featureProviderHelpers.js +0 -50
  65. package/src/util/splitScreen.js +0 -233
package/index.js CHANGED
@@ -13,7 +13,6 @@ export { default as CategoryCollection } from './src/category/categoryCollection
13
13
  export { layerClassRegistry, tileProviderClassRegistry, featureProviderClassRegistry, mapClassRegistry, styleClassRegistry, categoryClassRegistry, getObjectFromClassRegistry, default as ClassRegistry } from './src/classRegistry.js';
14
14
  export { volatileContextId, markVolatile, default as Context } from './src/context.js';
15
15
  export { default as AbstractFeatureProvider } from './src/featureProvider/abstractFeatureProvider.js';
16
- export { getGenericFeatureFromProvidedFeature } from './src/featureProvider/featureProviderHelpers.js';
17
16
  export { isProvidedFeature, showProvidedFeature } from './src/featureProvider/featureProviderSymbols.js';
18
17
  export { default as TileProviderFeatureProvider } from './src/featureProvider/tileProviderFeatureProvider.js';
19
18
  export { getFormat, default as WMSFeatureProvider } from './src/featureProvider/wmsFeatureProvider.js';
@@ -33,7 +32,7 @@ export { default as SingleImageCesiumImpl } from './src/layer/cesium/singleImage
33
32
  export { default as TerrainCesiumImpl } from './src/layer/cesium/terrainCesiumImpl.js';
34
33
  export { default as TmsCesiumImpl } from './src/layer/cesium/tmsCesiumImpl.js';
35
34
  export { default as VectorCesiumImpl } from './src/layer/cesium/vectorCesiumImpl.js';
36
- export { setReferenceForPicking, removeArrayFromCollection, removeFeatureFromMap, addPrimitiveToContext, default as VectorContext } from './src/layer/cesium/vectorContext.js';
35
+ export { setReferenceForPicking, removeArrayFromCollection, removeFeatureFromMap, addPrimitiveToContext, setSplitDirectionOnPrimitives, setupScalingPrimitiveCollection, default as VectorContext } from './src/layer/cesium/vectorContext.js';
37
36
  export { default as VectorRasterTileCesiumImpl } from './src/layer/cesium/vectorRasterTileCesiumImpl.js';
38
37
  export { toContext, getCanvasFromFeatures, default as VectorTileImageryProvider } from './src/layer/cesium/vectorTileImageryProvider.js';
39
38
  export { default as WmsCesiumImpl } from './src/layer/cesium/wmsCesiumImpl.js';
@@ -79,9 +78,9 @@ export { default as StaticGeoJSONTileProvider } from './src/layer/tileProvider/s
79
78
  export { mercatorResolutionsToLevel, rectangleToExtent, default as TileProvider } from './src/layer/tileProvider/tileProvider.js';
80
79
  export { getURL, default as URLTemplateTileProvider } from './src/layer/tileProvider/urlTemplateTileProvider.js';
81
80
  export { default as TMSLayer } from './src/layer/tmsLayer.js';
82
- export { fvLastUpdated, globalHiderLastUpdated, updateFeatureVisibility, updateGlobalHider, synchronizeFeatureVisibilityWithSource, getGenericFeatureFromClickedObject } from './src/layer/vectorHelpers.js';
81
+ export { fvLastUpdated, globalHiderLastUpdated, updateFeatureVisibility, updateGlobalHider, synchronizeFeatureVisibilityWithSource } from './src/layer/vectorHelpers.js';
83
82
  export { default as VectorLayer } from './src/layer/vectorLayer.js';
84
- export { AltitudeModeCesium, ClassificationTypeCesium, parseNearFarScalar, parseCartesian3, parseStoreyHeights, getAltitudeModeOptions, getClassificationTypeOptions, getNearFarValueOptions, getCartesian3Options, default as VectorProperties } from './src/layer/vectorProperties.js';
83
+ export { PrimitiveOptionsType, AltitudeModeCesium, ClassificationTypeCesium, parseNearFarScalar, parseCartesian3, parseStoreyHeights, getAltitudeModeOptions, getClassificationTypeOptions, getNearFarValueOptions, getCartesian3Options, default as VectorProperties } from './src/layer/vectorProperties.js';
85
84
  export { alreadyTransformedToMercator, alreadyTransformedToImage, obliqueGeometry, doNotTransform, originalFeatureSymbol, actuallyIsCircle, createSync } from './src/layer/vectorSymbols.js';
86
85
  export { default as VectorTileLayer } from './src/layer/vectorTileLayer.js';
87
86
  export { default as WFSLayer } from './src/layer/wfsLayer.js';
@@ -106,6 +105,8 @@ export { default as ObliqueView } from './src/oblique/obliqueView.js';
106
105
  export { ObliqueViewDirection, obliqueViewDirectionNames, getDirectionName } from './src/oblique/obliqueViewDirection.js';
107
106
  export { getVersionFromImageJson, parseImageMeta, parseImageData, parseLegacyImageData } from './src/oblique/parseImageJson.js';
108
107
  export { default as OverrideClassRegistry } from './src/overrideClassRegistry.js';
108
+ export { featureArcStruct, default as ArcStyle } from './src/style/arcStyle.js';
109
+ export { ArrowEnd, default as ArrowStyle } from './src/style/arrowStyle.js';
109
110
  export { defaultDeclarativeStyle, default as DeclarativeStyleItem } from './src/style/declarativeStyleItem.js';
110
111
  export { getShapeFromOptions, shapeCategory } from './src/style/shapesCategory.js';
111
112
  export { getStyleOrDefaultStyle } from './src/style/styleFactory.js';
@@ -118,30 +119,44 @@ export { default as ClippingObjectManager } from './src/util/clipping/clippingOb
118
119
  export { createClippingPlaneCollection, copyClippingPlanesToCollection, clearClippingPlanes, setClippingPlanes, createClippingFeature, getClippingOptions } from './src/util/clipping/clippingPlaneHelper.js';
119
120
  export { default as Collection } from './src/util/collection.js';
120
121
  export { default as startCreateFeatureSession } from './src/util/editor/createFeatureSession.js';
122
+ export { default as startEditFeaturesSession } from './src/util/editor/editFeaturesSession.js';
121
123
  export { default as startEditGeometrySession } from './src/util/editor/editGeometrySession.js';
122
- export { createVertex, pointOnLine3D, pointOnLine2D, createVerticalPlane, createHorizontalPlane } from './src/util/editor/editorHelpers.js';
124
+ export { createVertex, getClosestPointOn2DLine, pointOnLine3D, pointOnLine2D, createCameraVerticalPlane, createHorizontalPlane, getCartographicFromPlane, drapeGeometryOnTerrain, placeGeometryOnTerrain, ensureFeatureAbsolute, clampFeature } from './src/util/editor/editorHelpers.js';
123
125
  export { SessionType, setupScratchLayer, GeometryType } from './src/util/editor/editorSessionHelpers.js';
124
- export { vertexSymbol, vertexIndex } from './src/util/editor/editorSymbols.js';
126
+ export { vertexSymbol, vertexIndex, handlerSymbol } from './src/util/editor/editorSymbols.js';
125
127
  export { default as CreateBBoxInteraction } from './src/util/editor/interactions/createBBoxInteraction.js';
126
128
  export { default as CreateCircleInteraction } from './src/util/editor/interactions/createCircleInteraction.js';
127
129
  export { default as CreateLineStringInteraction } from './src/util/editor/interactions/createLineStringInteraction.js';
128
130
  export { default as CreatePointInteraction } from './src/util/editor/interactions/createPointInteraction.js';
129
131
  export { default as CreatePolygonInteraction } from './src/util/editor/interactions/createPolygonInteraction.js';
132
+ export { default as EditFeaturesMouseOverInteraction } from './src/util/editor/interactions/editFeaturesMouseOverInteraction.js';
130
133
  export { cursorMap, default as EditGeometryMouseOverInteraction } from './src/util/editor/interactions/editGeometryMouseOverInteraction.js';
134
+ export { default as EnsureHandlerSelectionInteraction } from './src/util/editor/interactions/ensureHandlerSelectionInteraction.js';
131
135
  export { default as InsertVertexInteraction } from './src/util/editor/interactions/insertVertexInteraction.js';
132
136
  export { default as MapInteractionController } from './src/util/editor/interactions/mapInteractionController.js';
133
137
  export { default as RemoveVertexInteraction } from './src/util/editor/interactions/removeVertexInteraction.js';
138
+ export { default as SelectMultiFeatureInteraction } from './src/util/editor/interactions/selectMultiFeatureInteraction.js';
134
139
  export { default as SelectSingleFeatureInteraction } from './src/util/editor/interactions/selectSingleFeatureInteraction.js';
135
140
  export { default as TranslateVertexInteraction } from './src/util/editor/interactions/translateVertexInteraction.js';
141
+ export { default as create2DHandlers } from './src/util/editor/transformation/create2DHandlers.js';
142
+ export { default as create3DHandlers } from './src/util/editor/transformation/create3DHandlers.js';
143
+ export { default as ExtrudeInteraction } from './src/util/editor/transformation/extrudeInteraction.js';
144
+ export { default as RotateInteraction } from './src/util/editor/transformation/rotateInteraction.js';
145
+ export { default as ScaleInteraction } from './src/util/editor/transformation/scaleInteraction.js';
146
+ export { default as createTransformationHandler } from './src/util/editor/transformation/transformationHandler.js';
147
+ export { AXIS_AND_PLANES, TransformationMode, greyedOutColor, is1DAxis, is2DAxis } from './src/util/editor/transformation/transformationTypes.js';
148
+ export { default as TranslateInteraction } from './src/util/editor/transformation/translateInteraction.js';
136
149
  export { default as geometryIsValid } from './src/util/editor/validateGeoemetry.js';
137
150
  export { default as ExclusiveManager } from './src/util/exclusiveManager.js';
138
151
  export { default as Extent } from './src/util/extent.js';
152
+ export { default as arcToCesium } from './src/util/featureconverter/arcToCesium.js';
139
153
  export { validateCircle, default as circleToCesium } from './src/util/featureconverter/circleToCesium.js';
140
154
  export { getStylesArray, default as convert } from './src/util/featureconverter/convert.js';
141
155
  export { default as Extent3D } from './src/util/featureconverter/extent3D.js';
142
156
  export { getMaterialAppearance, createClassificationPrimitive, createPrimitive, createOutlinePrimitive, createLinePrimitive, getMinHeightOrGroundLevel, getStoreyHeights, validateStoreys, getHeightAboveGround, getHeightInfo, getStoreyOptions, addPrimitivesToContext } from './src/util/featureconverter/featureconverterHelper.js';
143
- export { validateLineString, default as lineStringToCesium } from './src/util/featureconverter/lineStringToCesium.js';
144
- export { getBillboardOptions, getLabelOptions, getModelOptions, validatePoint, getCartesian3AndWGS84FromCoordinates, default as pointToCesium } from './src/util/featureconverter/pointToCesium.js';
157
+ export { addArrowsToContext, validateLineString, default as lineStringToCesium } from './src/util/featureconverter/lineStringToCesium.js';
158
+ export { getModelOptions, getPrimitiveOptions } from './src/util/featureconverter/pointHelpers.js';
159
+ export { getBillboardOptions, getLabelOptions, validatePoint, getCartesian3AndWGS84FromCoordinates, default as pointToCesium } from './src/util/featureconverter/pointToCesium.js';
145
160
  export { validatePolygon, default as polygonToCesium } from './src/util/featureconverter/polygonToCesium.js';
146
161
  export { requestUrl, requestJson, requestArrayBuffer } from './src/util/fetch.js';
147
162
  export { getFlatCoordinatesFromSimpleGeometry, getFlatCoordinatesFromGeometry, circleFromCenterRadius, convertGeometryToPolygon, enforceEndingVertex, removeEndingVertex, removeEndingVertexFromGeometry, enforceRightHand } from './src/util/geometryHelpers.js';
@@ -150,10 +165,9 @@ export { isMobile } from './src/util/isMobile.js';
150
165
  export { maxZIndex, default as LayerCollection } from './src/util/layerCollection.js';
151
166
  export { detectBrowserLocale } from './src/util/locale.js';
152
167
  export { default as MapCollection } from './src/util/mapCollection.js';
153
- export { coordinateAtDistance, initialBearingBetweenCoords, cartesian2DDistance, cartesian3DDistance, modulo } from './src/util/math.js';
168
+ export { coordinateAtDistance, initialBearingBetweenCoords, getCartesianBearing, cartesian2DDistance, cartesian3DDistance, modulo, cartographicToWgs84, mercatorToCartesian, cartesianToMercator, getMidPoint, getCartesianPitch } from './src/util/math.js';
154
169
  export { isOverrideCollection, default as makeOverrideCollection } from './src/util/overrideCollection.js';
155
170
  export { wgs84ToMercatorTransformer, mercatorToWgs84Transformer, setDefaultProjectionOptions, getDefaultProjection, wgs84Projection, mercatorProjection, default as Projection } from './src/util/projection.js';
156
- export { default as SplitScreen } from './src/util/splitScreen.js';
157
171
  export { isSameOrigin } from './src/util/urlHelpers.js';
158
172
  export { propertyEqualsEpsilon, angleEqualsEpsilon, coordinateEqualsEpsilon, default as Viewpoint } from './src/util/viewpoint.js';
159
173
  export { defaultDynamicContextId, getVcsAppById, default as VcsApp } from './src/vcsApp.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/core",
3
- "version": "5.0.0-rc.23",
3
+ "version": "5.0.0-rc.25",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -53,7 +53,7 @@
53
53
  "sinon": "^9.2.4",
54
54
  "sinon-chai": "^3.6.0",
55
55
  "tui-jsdoc-template": "^1.2.2",
56
- "typescript": "^4.6.2"
56
+ "typescript": "^4.9.3"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "@vcmap/cesium": "~1.97.1",
@@ -364,7 +364,7 @@ class Category extends VcsObject {
364
364
  /**
365
365
  * @protected
366
366
  * @param {T} item
367
- * @returns {Array<Object>}
367
+ * @returns {Object}
368
368
  */
369
369
  _serializeItem(item) {
370
370
  const config = JSON.parse(JSON.stringify(item));
@@ -14,7 +14,6 @@ import { isProvidedFeature, showProvidedFeature } from './featureProviderSymbols
14
14
  /**
15
15
  * @typedef {VcsObjectOptions} AbstractFeatureProviderOptions
16
16
  * @property {import("@vcmap/core").StyleItemOptions|import("@vcmap/core").StyleItem|undefined} style - the style to apply to features created by this feature provider
17
- * @property {Object|undefined} genericFeatureProperties - generic properties to add to features created by this feature provider
18
17
  * @property {import("@vcmap/core").VectorProperties|import("@vcmap/core").VectorPropertiesOptions|undefined} vectorProperties - the vector properties of the features. Allow picking is false by default.
19
18
  * @property {boolean} [showGeometry=false] - show the resulting geometry in the map
20
19
  * @property {Array<string>} [mapTypes=[]] - can be used to constrict the featureProvider to specific mapTypes empty array means no restriction
@@ -38,7 +37,6 @@ class AbstractFeatureProvider extends VcsObject {
38
37
  vectorProperties: {
39
38
  allowPicking: false,
40
39
  },
41
- genericFeatureProperties: undefined,
42
40
  showGeometry: false,
43
41
  mapTypes: [],
44
42
  };
@@ -79,13 +77,6 @@ class AbstractFeatureProvider extends VcsObject {
79
77
  this.vectorProperties = options.vectorProperties instanceof VectorProperties ?
80
78
  options.vectorProperties :
81
79
  new VectorProperties({ ...defaultOptions.vectorProperties, ...options.vectorProperties });
82
- /**
83
- * An object of potential generic feature properties to add to all feature created by this provider
84
- * @type {Object<string, *>|undefined}
85
- * @api
86
- */
87
- this.genericFeatureProperties = options.genericFeatureProperties || defaultOptions.genericFeatureProperties;
88
-
89
80
  /**
90
81
  * Map ClassNames Can be used to only apply this featureProvider to the specified maps
91
82
  * @type {Array<string>}
@@ -106,7 +97,7 @@ class AbstractFeatureProvider extends VcsObject {
106
97
  }
107
98
 
108
99
  /**
109
- * Ensures the feature has an ID, applies all vectorProperties and adds the generic properties, style and the vcsLayerName
100
+ * Ensures the feature has an ID, applies all vectorProperties and adds style and the vcsLayerName
110
101
  * and isProvidedFeature symbols to the feature
111
102
  * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
112
103
  * @returns {import("ol").Feature<import("ol/geom/Geometry").default>}
@@ -119,9 +110,6 @@ class AbstractFeatureProvider extends VcsObject {
119
110
  if (this.style) {
120
111
  feature.setStyle(this.style.style);
121
112
  }
122
- if (this.genericFeatureProperties) {
123
- feature.setProperties(this.genericFeatureProperties);
124
- }
125
113
  feature[vcsLayerName] = this.layerName;
126
114
  feature[isProvidedFeature] = true;
127
115
  feature[showProvidedFeature] = this.showGeometry;
@@ -164,10 +152,6 @@ class AbstractFeatureProvider extends VcsObject {
164
152
  config.showGeometry = this.showGeometry;
165
153
  }
166
154
 
167
- if (this.genericFeatureProperties) {
168
- config.genericFeatureProperties = { ...this.genericFeatureProperties };
169
- }
170
-
171
155
  if (this.style) {
172
156
  config.style = this.style.toJSON();
173
157
  }
@@ -187,7 +171,6 @@ class AbstractFeatureProvider extends VcsObject {
187
171
  destroy() {
188
172
  this.style = null;
189
173
  this.vectorProperties.destroy();
190
- this.genericFeatureProperties = undefined;
191
174
  super.destroy();
192
175
  }
193
176
  }
@@ -167,6 +167,12 @@ class EventHandler {
167
167
  this._boundKeyListener = this._keyListener.bind(this);
168
168
  window.addEventListener('keydown', this._boundKeyListener);
169
169
  window.addEventListener('keyup', this._boundKeyListener);
170
+
171
+ /**
172
+ * @type {VcsEvent<ModificationKeyType>}
173
+ * @private
174
+ */
175
+ this._modifierChanged = new VcsEvent();
170
176
  }
171
177
 
172
178
  /**
@@ -198,6 +204,13 @@ class EventHandler {
198
204
  */
199
205
  get interactions() { return this._interactionChain.chain.slice(); }
200
206
 
207
+ /**
208
+ * An event called, when the modifier changes. Order of precedence, if more then one key is pressed: SHIFT, ALT, CTRL
209
+ * @type {VcsEvent<ModificationKeyType>}
210
+ * @readonly
211
+ */
212
+ get modifierChanged() { return this._modifierChanged; }
213
+
201
214
  /**
202
215
  * Add a dynamic interaction to the interaction chain. This is the default methodology for
203
216
  * user map interactions, such as drawing or measuring. If another exclusive interaction is added,
@@ -417,6 +430,7 @@ class EventHandler {
417
430
  if (modifier !== this._lastDispatchedModifier) {
418
431
  this._interactionChain.modifierChanged(modifier);
419
432
  this._lastDispatchedModifier = modifier;
433
+ this._modifierChanged.raiseEvent(modifier);
420
434
  }
421
435
  }
422
436
  }
@@ -140,7 +140,7 @@ class CesiumTilesetCesiumImpl extends LayerImplementation {
140
140
  this.map.addPrimitiveCollection(this.cesium3DTileset);
141
141
  await super.initialize();
142
142
  if (this.splitDirection) {
143
- this.updateSplitDirection(this.splitDirection);
143
+ this.cesium3DTileset.splitDirection = this.splitDirection;
144
144
  }
145
145
  this.updateStyle(this.style);
146
146
  }
@@ -250,17 +250,9 @@ class CesiumTilesetCesiumImpl extends LayerImplementation {
250
250
  * @param {import("@vcmap/cesium").SplitDirection} splitDirection
251
251
  */
252
252
  updateSplitDirection(splitDirection) {
253
- const { splitScreen } = this.map;
254
- if (splitScreen) { // XXX edge case: what if the map get splitScreen added later?
255
- const previousClippingObject = splitScreen.getClippingObjectForDirection(this.splitDirection);
256
- if (previousClippingObject) {
257
- previousClippingObject.removeLayer(this.name);
258
- }
259
- this.splitDirection = splitDirection;
260
- const currentClippingObject = splitScreen.getClippingObjectForDirection(this.splitDirection);
261
- if (currentClippingObject) {
262
- currentClippingObject.addLayer(this.name);
263
- }
253
+ this.splitDirection = splitDirection;
254
+ if (this.cesium3DTileset) {
255
+ this.cesium3DTileset.splitDirection = splitDirection;
264
256
  }
265
257
  }
266
258
 
@@ -342,13 +334,6 @@ class CesiumTilesetCesiumImpl extends LayerImplementation {
342
334
  this._onStyleChangeRemover();
343
335
  }
344
336
 
345
- if (this.splitDirection && this.map.splitScreen) {
346
- const previousClippingObject = this.map.splitScreen.getClippingObjectForDirection(this.splitDirection);
347
- if (previousClippingObject) {
348
- previousClippingObject.removeLayer(this.name);
349
- }
350
- }
351
-
352
337
  super.destroy();
353
338
  }
354
339
  }
@@ -24,6 +24,14 @@ class ClusterContext {
24
24
  // eslint-disable-next-line class-methods-use-this,no-unused-vars
25
25
  addPrimitives(primitives, feature, allowPicking) {}
26
26
 
27
+ /**
28
+ * @param {Array<import("@vcmap/cesium").Primitive|import("@vcmap/cesium").GroundPrimitive|import("@vcmap/cesium").GroundPolylinePrimitive|import("@vcmap/cesium").ClassificationPrimitive|import("@vcmap/cesium").Model>} primitives
29
+ * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
30
+ * @param {boolean=} allowPicking
31
+ */
32
+ // eslint-disable-next-line class-methods-use-this,no-unused-vars
33
+ addScaledPrimitives(primitives, feature, allowPicking) {}
34
+
27
35
  /**
28
36
  * @param {Array<Object>} billboardOptions
29
37
  * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
@@ -85,11 +93,21 @@ class ClusterContext {
85
93
  removeArrayFromCollection(this.entities, cache.labels);
86
94
  }
87
95
 
96
+ /**
97
+ * @param {import("@vcmap/cesium").SplitDirection} splitDirection
98
+ */
99
+ // eslint-disable-next-line class-methods-use-this,no-unused-vars
100
+ updateSplitDirection(splitDirection) {}
101
+
88
102
  clear() {
89
103
  this.entities.removeAll();
90
104
  this.featureToBillboardMap.clear();
91
105
  this.featureToLabelMap.clear();
92
106
  }
107
+
108
+ destroy() {
109
+ this.clear();
110
+ }
93
111
  }
94
112
 
95
113
  export default ClusterContext;
@@ -27,6 +27,8 @@ class VectorCesiumImpl extends LayerImplementation {
27
27
  this.vectorProperties = options.vectorProperties;
28
28
  /** @type {import("ol/source").Vector<import("ol/geom/Geometry").default>} */
29
29
  this.source = options.source;
30
+ /** @type {import("@vcmap/cesium").SplitDirection} */
31
+ this.splitDirection = options.splitDirection;
30
32
  /** @type {import("@vcmap/core").StyleItem} */
31
33
  this.style = options.style;
32
34
  /** @type {import("@vcmap/core").FeatureVisibility} */
@@ -104,7 +106,7 @@ class VectorCesiumImpl extends LayerImplementation {
104
106
  */
105
107
  async _setupContext(cesiumMap) {
106
108
  const rootCollection = /** @type {import("@vcmap/cesium").PrimitiveCollection} */ (this._rootCollection);
107
- this._context = new VectorContext(this._scene, rootCollection);
109
+ this._context = new VectorContext(cesiumMap, rootCollection, this.splitDirection);
108
110
  cesiumMap.addPrimitiveCollection(rootCollection);
109
111
  }
110
112
 
@@ -120,6 +122,9 @@ class VectorCesiumImpl extends LayerImplementation {
120
122
  await this._setupContext(this.map);
121
123
  }
122
124
  await super.initialize();
125
+ if (this.splitDirection) {
126
+ this.updateSplitDirection(this.splitDirection);
127
+ }
123
128
  }
124
129
 
125
130
  /**
@@ -218,6 +223,16 @@ class VectorCesiumImpl extends LayerImplementation {
218
223
  }
219
224
  }
220
225
 
226
+ /**
227
+ * @param {import("@vcmap/cesium").SplitDirection} splitDirection
228
+ */
229
+ updateSplitDirection(splitDirection) {
230
+ this.splitDirection = splitDirection;
231
+ if (this.initialized) {
232
+ this._context.updateSplitDirection(splitDirection);
233
+ }
234
+ }
235
+
221
236
  /**
222
237
  * @protected
223
238
  */
@@ -230,7 +245,7 @@ class VectorCesiumImpl extends LayerImplementation {
230
245
  */
231
246
  destroy() {
232
247
  if (this.initialized) {
233
- this._context.clear();
248
+ this._context.destroy();
234
249
  this._destroyCollection();
235
250
  }
236
251
  this._context = null;