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

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 (53) hide show
  1. package/index.d.ts +597 -98
  2. package/index.js +24 -9
  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/clusterContext.js +12 -0
  8. package/src/layer/cesium/vectorCesiumImpl.js +2 -2
  9. package/src/layer/cesium/vectorContext.js +115 -7
  10. package/src/layer/cesiumTilesetLayer.js +0 -14
  11. package/src/layer/czmlLayer.js +1 -1
  12. package/src/layer/dataSourceLayer.js +1 -53
  13. package/src/layer/featureLayer.js +0 -44
  14. package/src/layer/featureStoreLayer.js +0 -15
  15. package/src/layer/layer.js +0 -11
  16. package/src/layer/vectorHelpers.js +0 -85
  17. package/src/layer/vectorLayer.js +0 -9
  18. package/src/layer/vectorProperties.js +150 -8
  19. package/src/layer/vectorTileLayer.js +0 -9
  20. package/src/map/cesiumMap.js +26 -7
  21. package/src/style/arcStyle.js +316 -0
  22. package/src/style/arrowStyle.js +269 -0
  23. package/src/util/editor/createFeatureSession.js +3 -1
  24. package/src/util/editor/editFeaturesSession.js +315 -0
  25. package/src/util/editor/editGeometrySession.js +5 -1
  26. package/src/util/editor/editorHelpers.js +118 -14
  27. package/src/util/editor/editorSessionHelpers.js +12 -0
  28. package/src/util/editor/editorSymbols.js +6 -0
  29. package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +120 -0
  30. package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +1 -3
  31. package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +48 -0
  32. package/src/util/editor/interactions/mapInteractionController.js +5 -2
  33. package/src/util/editor/interactions/selectMultiFeatureInteraction.js +146 -0
  34. package/src/util/editor/interactions/translateVertexInteraction.js +2 -2
  35. package/src/util/editor/transformation/create2DHandlers.js +294 -0
  36. package/src/util/editor/transformation/create3DHandlers.js +575 -0
  37. package/src/util/editor/transformation/extrudeInteraction.js +91 -0
  38. package/src/util/editor/transformation/rotateInteraction.js +188 -0
  39. package/src/util/editor/transformation/scaleInteraction.js +185 -0
  40. package/src/util/editor/transformation/transformationHandler.js +168 -0
  41. package/src/util/editor/transformation/transformationTypes.js +83 -0
  42. package/src/util/editor/transformation/translateInteraction.js +209 -0
  43. package/src/util/featureconverter/arcToCesium.js +87 -0
  44. package/src/util/featureconverter/convert.js +7 -1
  45. package/src/util/featureconverter/extent3D.js +64 -1
  46. package/src/util/featureconverter/lineStringToCesium.js +103 -2
  47. package/src/util/featureconverter/pointHelpers.js +341 -0
  48. package/src/util/featureconverter/pointToCesium.js +27 -76
  49. package/src/util/geometryHelpers.js +11 -8
  50. package/src/util/math.js +99 -2
  51. package/tests/unit/helpers/cesiumHelpers.js +14 -4
  52. package/tests/unit/helpers/helpers.js +13 -0
  53. package/src/featureProvider/featureProviderHelpers.js +0 -50
@@ -13,7 +13,6 @@ import { layerClassRegistry } from '../classRegistry.js';
13
13
  /**
14
14
  * @typedef {LayerOptions} FeatureLayerOptions
15
15
  * @property {DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem|undefined} style
16
- * @property {Object|undefined} genericFeatureProperties - properties to add to generic features, eg for display in the balloon
17
16
  * @property {number} [balloonHeightOffset=10]
18
17
  * @property {FeatureVisibility|undefined} featureVisibility - vcs:undocumented
19
18
  * @api
@@ -59,7 +58,6 @@ class FeatureLayer extends Layer {
59
58
  ...Layer.getDefaultOptions(),
60
59
  style: undefined,
61
60
  balloonHeightOffset: 10,
62
- genericFeatureProperties: {},
63
61
  };
64
62
  }
65
63
 
@@ -86,19 +84,12 @@ class FeatureLayer extends Layer {
86
84
  * @api
87
85
  */
88
86
  this.styleChanged = new VcsEvent();
89
- /**
90
- * @type {Object}
91
- * @private
92
- */
93
- this._genericFeatureProperties = options.genericFeatureProperties || defaultOptions.genericFeatureProperties;
94
-
95
87
  /**
96
88
  * a height offset for rendering of a balloon for a feature of this layer.
97
89
  * @type {number}
98
90
  * @api
99
91
  */
100
92
  this.balloonHeightOffset = parseInteger(options.balloonHeightOffset, defaultOptions.balloonHeightOffset);
101
-
102
93
  /**
103
94
  * FeatureVisibility tracks the highlighting and hiding of features on this layer
104
95
  * @type {FeatureVisibility}
@@ -126,15 +117,6 @@ class FeatureLayer extends Layer {
126
117
  return this._style;
127
118
  }
128
119
 
129
- /**
130
- * Generic properties to be added to each feature. Use assignGenericFeatureProperties to change them.
131
- * @type {Object}
132
- * @readonly
133
- */
134
- get genericFeatureProperties() {
135
- return this._genericFeatureProperties;
136
- }
137
-
138
120
  /**
139
121
  * @returns {FeatureLayerImplementationOptions}
140
122
  */
@@ -164,28 +146,6 @@ class FeatureLayer extends Layer {
164
146
  return null;
165
147
  }
166
148
 
167
- /**
168
- * This is called by the selectBehavior to create generic features from clicked objects
169
- * needs to be implemented by each layer which has clickable objects
170
- * @param {Object|VectorClickedObject|import("ol").Feature<import("ol/geom/Geometry").default>} object
171
- * @returns {GenericFeature}
172
- */
173
- // eslint-disable-next-line no-unused-vars
174
- getGenericFeatureFromClickedObject(object) { // XXX remove after event implementation
175
- this.getLogger().warning('This method should be implemented by any specific layers');
176
- return null;
177
- }
178
-
179
- /**
180
- * Set properties, which are always added to the generic object, eg. for use in balloons
181
- * @param {Object} properties
182
- * @api
183
- */
184
- assignGenericFeatureProperties(properties) {
185
- check(properties, Object);
186
- Object.assign(this._genericFeatureProperties, properties);
187
- }
188
-
189
149
  /**
190
150
  * @param {(DeclarativeStyleItemOptions|VectorStyleItemOptions|import("@vcmap/core").StyleItem)=} styleOptions
191
151
  * @param {(import("@vcmap/core").VectorStyleItem|import("@vcmap/core").DeclarativeStyleItem)=} defaultStyle
@@ -234,10 +194,6 @@ class FeatureLayer extends Layer {
234
194
  if (!this.getStyleOrDefaultStyle().equals(this._style)) {
235
195
  config.style = this.style.toJSON();
236
196
  }
237
-
238
- if (Object.keys(this._genericFeatureProperties).length > 0) {
239
- config.genericFeatureProperties = { ...this._genericFeatureProperties };
240
- }
241
197
  return config;
242
198
  }
243
199
 
@@ -454,21 +454,6 @@ class FeatureStoreLayer extends VectorLayer {
454
454
  return null;
455
455
  }
456
456
 
457
- /**
458
- * @param {Object|VectorClickedObject} object
459
- * @returns {GenericFeature}
460
- */
461
- getGenericFeatureFromClickedObject(object) {
462
- if (object instanceof Feature) {
463
- // @ts-ignore
464
- return super.getGenericFeatureFromClickedObject(/** @type {VectorClickedObject} */ (object));
465
- }
466
- const generic = CesiumTilesetLayer.prototype.getGenericFeatureFromClickedObject.call(this, object);
467
- generic.layerName = this.name;
468
- generic.layerClass = this.className;
469
- return generic;
470
- }
471
-
472
457
  /**
473
458
  * @inheritDoc
474
459
  * @returns {Extent|null}
@@ -8,17 +8,6 @@ import VcsEvent from '../vcsEvent.js';
8
8
  import { layerClassRegistry } from '../classRegistry.js';
9
9
  import GlobalHider from './globalHider.js';
10
10
 
11
- /**
12
- * @typedef {Object} GenericFeature
13
- * @property {number} longitude
14
- * @property {number} latitude
15
- * @property {number} height
16
- * @property {string} layerName
17
- * @property {string} layerClass
18
- * @property {any} attributes
19
- * @property {boolean} relativeToGround
20
- */
21
-
22
11
  /**
23
12
  * @typedef {import("@vcmap/core").Layer} SplitLayer
24
13
  * @property {import("@vcmap/cesium").SplitDirection} splitDirection
@@ -1,11 +1,5 @@
1
1
  import { unByKey } from 'ol/Observable.js';
2
- import Feature from 'ol/Feature.js';
3
- import { HeightReference } from '@vcmap/cesium';
4
2
  import { FeatureVisibilityAction } from './featureVisibility.js';
5
- import Projection from '../util/projection.js';
6
- import { getHeightInfo } from '../util/featureconverter/featureconverterHelper.js';
7
- import { getFlatCoordinatesFromGeometry } from '../util/geometryHelpers.js';
8
- import Extent3D from '../util/featureconverter/extent3D.js';
9
3
 
10
4
  /**
11
5
  * Added to ol.source.Vector to determine, when the source has last had an update to its features visibility.
@@ -124,82 +118,3 @@ export function synchronizeFeatureVisibilityWithSource(featureVisibility, source
124
118
  () => { unByKey(sourceListener); },
125
119
  ];
126
120
  }
127
-
128
- /**
129
- * @param {VectorClickedObject} object
130
- * @param {import("@vcmap/core").VectorLayer|import("@vcmap/core").VectorTileLayer} layer
131
- * @returns {?GenericFeature}
132
- */
133
- export function getGenericFeatureFromClickedObject(object, layer) {
134
- if (!(object instanceof Feature)) {
135
- return null;
136
- }
137
- const attributes = object.getProperties();
138
- delete attributes[object.getGeometryName()];
139
-
140
- const { clickedPosition } = object;
141
- if (!clickedPosition) {
142
- return null;
143
- }
144
- let { latitude, longitude } = clickedPosition;
145
- const geometry = object.getGeometry();
146
- let heightOffset = clickedPosition.height;
147
- let calculateHeight = !heightOffset;
148
- if (!geometry) {
149
- calculateHeight = false; // we cannot calculate the height without geometry;
150
- }
151
-
152
- let relativeToGround = !heightOffset;
153
- // Edge Case ClickedPosition is next to the feature and Feature got detected in clickToleranz.
154
- // if the clicked Position does not intersect the feature the closestPoint will be used.
155
- // also if the clickedPosition is not on the Feature we do not trust the Height Value;
156
- const mercatorPoint =
157
- Projection.wgs84ToMercator([clickedPosition.longitude, clickedPosition.latitude, clickedPosition.height]);
158
- if (geometry && !geometry.intersectsCoordinate(mercatorPoint)) {
159
- const closestPoint = geometry.getClosestPoint(mercatorPoint);
160
- [longitude, latitude] = Projection.mercatorToWgs84(closestPoint);
161
- calculateHeight = true;
162
- }
163
-
164
- // edge case oblique in this case we do get a height value but not of the feature but the underlying terrain.
165
- // this is necessary to calculate the correct position of the balloon
166
-
167
- // if we do not have a height value from the clickedPosition we calculate the height based in the feature;
168
- if (calculateHeight) {
169
- const coordinates = getFlatCoordinatesFromGeometry(geometry);
170
- const heightInfo = getHeightInfo(object, layer.vectorProperties, coordinates);
171
- if (heightInfo.perPositionHeight || heightInfo.extruded) {
172
- const extent = Extent3D.fromGeometry(geometry);
173
- extent.extendWithHeightInfo(heightInfo);
174
- heightOffset = extent.maxZ;
175
- }
176
- // edge case points are rendered depending on the terrain, so we set relativeToGround to true.
177
- // In this case the heightAboveGroundAdjustment is also just an Offset.
178
- if (
179
- !heightInfo.extruded &&
180
- (geometry.getType() === 'Point' || geometry.getType() === 'MultiPoint') &&
181
- (
182
- heightInfo.heightReference === HeightReference.RELATIVE_TO_GROUND ||
183
- heightInfo.heightReference === HeightReference.CLAMP_TO_GROUND)
184
- ) {
185
- heightOffset = heightInfo.heightAboveGroundAdjustment;
186
- relativeToGround = true;
187
- } else {
188
- heightOffset += heightInfo.heightAboveGroundAdjustment;
189
- }
190
-
191
- // if we have to calculate the height we have to take heightAboveGround into account
192
- }
193
-
194
- delete attributes.clickedPosition;
195
- heightOffset = Number.isFinite(heightOffset) ? heightOffset : 0;
196
- return {
197
- layerName: layer.name,
198
- layerClass: layer.className,
199
- attributes: { ...layer.genericFeatureProperties, ...attributes },
200
- longitude,
201
- latitude,
202
- height: heightOffset + layer.balloonHeightOffset,
203
- relativeToGround,
204
- };
205
- }
@@ -27,7 +27,6 @@ import ObliqueMap from '../map/obliqueMap.js';
27
27
  import CesiumMap from '../map/cesiumMap.js';
28
28
  import { originalStyle, updateOriginalStyle } from './featureVisibility.js';
29
29
  import StyleItem from '../style/styleItem.js';
30
- import { getGenericFeatureFromClickedObject } from './vectorHelpers.js';
31
30
  import { layerClassRegistry } from '../classRegistry.js';
32
31
 
33
32
  /**
@@ -556,14 +555,6 @@ class VectorLayer extends FeatureLayer {
556
555
  return null;
557
556
  }
558
557
 
559
- /**
560
- * @param {VectorClickedObject} object
561
- * @returns {?GenericFeature}
562
- */
563
- getGenericFeatureFromClickedObject(object) {
564
- return getGenericFeatureFromClickedObject(object, this);
565
- }
566
-
567
558
  /**
568
559
  * @returns {VectorOptions}
569
560
  */
@@ -1,7 +1,7 @@
1
1
  import deepEqual from 'fast-deep-equal';
2
- import { HeightReference, ClassificationType, NearFarScalar, Cartesian3 } from '@vcmap/cesium';
2
+ import { Cartesian3, ClassificationType, HeightReference, NearFarScalar } from '@vcmap/cesium';
3
3
  import { check, checkMaybe } from '@vcsuite/check';
4
- import { parseBoolean, parseEnumKey, parseNumber, parseInteger } from '@vcsuite/parsers';
4
+ import { parseBoolean, parseEnumKey, parseInteger, parseNumber } from '@vcsuite/parsers';
5
5
  import { getLogger as getLoggerByName } from '@vcsuite/logger';
6
6
  import VcsEvent from '../vcsEvent.js';
7
7
 
@@ -35,23 +35,63 @@ function getLogger() {
35
35
  * @property {number} [modelHeading=0] - in degrees
36
36
  * @property {number} [modelPitch=0] - in degrees
37
37
  * @property {number} [modelRoll=0] - in degrees
38
+ * @property {boolean} [modelAutoScale]
38
39
  * @property {Object|undefined} modelOptions - Model options are merged with the model definition from model url, scale and orientation and accepts any option passed to a Cesium.Model.
40
+ * @property {VectorPropertiesPrimitiveOptions} [primitiveOptions] - primitive options to render in 3D instead of a billboard
39
41
  * @property {string|undefined} baseUrl - a base URL to resolve relative model URLs against.
40
42
  * @api
41
43
  */
42
44
 
43
45
  /**
44
- * @typedef {Object} VectorPropertiesModelOptions
45
- * @property {string} url
46
+ * @typedef {Object} VectorPropertiesBaseOptions
46
47
  * @property {Array<number>} scale
47
48
  * @property {number} heading
48
49
  * @property {number} pitch
49
50
  * @property {number} roll
51
+ * @property {boolean} autoScale
52
+ */
53
+
54
+ /**
55
+ * @typedef {VectorPropertiesBaseOptions} VectorPropertiesModelOptions
56
+ * @property {string} url
50
57
  * @api
51
58
  */
52
59
 
60
+ /**
61
+ * @typedef {Object} VectorPropertiesPrimitiveOptions
62
+ * @property {PrimitiveOptionsType} type
63
+ * @property {*} geometryOptions - the options for the specified geometry
64
+ * @property {import("ol/color").Color|import("ol/colorlike").ColorLike} [depthFailColor]
65
+ * @property {import("ol/coordinate").Coordinate} [offset] an offset to apply to the geometry
66
+ * @property {Object} [additionalOptions] - additional options passed to the Primitive constructor
67
+ */
68
+
69
+ /**
70
+ * @typedef {VectorPropertiesBaseOptions} VectorPropertiesPrimitive
71
+ * @property {VectorPropertiesPrimitiveOptions} primitiveOptions
72
+ */
73
+
74
+ /**
75
+ * @enum {string}
76
+ * @property {string} CYLINDER
77
+ * @property {string} SPHERE
78
+ * @property {string} ELLIPSE
79
+ * @property {string} ELLIPSOID
80
+ * @property {string} BOC
81
+ * @const
82
+ */
83
+ export const PrimitiveOptionsType = {
84
+ CYLINDER: 'cylinder',
85
+ SPHERE: 'sphere',
86
+ ELLIPSOID: 'ellipsoid',
87
+ BOX: 'box',
88
+ };
89
+
53
90
  /**
54
91
  * @enum {import("@vcmap/cesium").HeightReference}
92
+ * @property {import("@vcmap/cesium").HeightReference} clampToGround
93
+ * @property {import("@vcmap/cesium").HeightReference} absolute
94
+ * @property {import("@vcmap/cesium").HeightReference} relativeToGround
55
95
  * @const
56
96
  */
57
97
  export const AltitudeModeCesium = {
@@ -62,6 +102,9 @@ export const AltitudeModeCesium = {
62
102
 
63
103
  /**
64
104
  * @enum {import("@vcmap/cesium").ClassificationType}
105
+ * @property {import("@vcmap/cesium").ClassificationType} both
106
+ * @property {import("@vcmap/cesium").ClassificationType} cesium3DTile
107
+ * @property {import("@vcmap/cesium").ClassificationType} terrain
65
108
  * @const
66
109
  */
67
110
  export const ClassificationTypeCesium = {
@@ -197,7 +240,9 @@ class VectorProperties {
197
240
  modelPitch: 0,
198
241
  modelRoll: 0,
199
242
  modelOptions: undefined,
243
+ modelAutoScale: false,
200
244
  baseUrl: undefined,
245
+ primitiveOptions: undefined,
201
246
  };
202
247
  }
203
248
 
@@ -345,6 +390,16 @@ class VectorProperties {
345
390
  * @private
346
391
  */
347
392
  this._modelOptions = options.modelOptions || defaultValues.modelOptions;
393
+ /**
394
+ * @type {boolean}
395
+ * @private
396
+ */
397
+ this._modelAutoScale = parseBoolean(options.modelAutoScale, defaultValues.modelAutoScale);
398
+ /**
399
+ * @type {VectorPropertiesPrimitiveOptions}
400
+ * @private
401
+ */
402
+ this._primitiveOptions = options.primitiveOptions || defaultValues.primitiveOptions;
348
403
 
349
404
  /**
350
405
  * Event raised when properties change. is passed an array of keys for the changed properties.
@@ -1010,6 +1065,35 @@ class VectorProperties {
1010
1065
  return {};
1011
1066
  }
1012
1067
 
1068
+ /**
1069
+ * @type {boolean}
1070
+ */
1071
+ get modelAutoScale() {
1072
+ return this._modelAutoScale;
1073
+ }
1074
+
1075
+ /**
1076
+ * @param {boolean} value
1077
+ */
1078
+ set modelAutoScale(value) {
1079
+ checkMaybe(value, Boolean);
1080
+
1081
+ const booleanValue = !!value;
1082
+ if (this._modelAutoScale !== booleanValue) {
1083
+ this._modelAutoScale = booleanValue;
1084
+ this.propertyChanged.raiseEvent(['modelAutoScale']);
1085
+ }
1086
+ }
1087
+
1088
+ /**
1089
+ * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
1090
+ * @returns {*|boolean}
1091
+ */
1092
+ getModelAutoScale(feature) {
1093
+ const featureValue = feature.get('olcs_modelAutoScale');
1094
+ return featureValue !== undefined ? featureValue : this.modelAutoScale;
1095
+ }
1096
+
1013
1097
  /**
1014
1098
  * @api
1015
1099
  * @type {string}
@@ -1040,6 +1124,67 @@ class VectorProperties {
1040
1124
  return featureValue !== undefined ? featureValue : this.baseUrl;
1041
1125
  }
1042
1126
 
1127
+ /**
1128
+ * @type {VectorPropertiesPrimitiveOptions}
1129
+ */
1130
+ get primitiveOptions() {
1131
+ return this._primitiveOptions;
1132
+ }
1133
+
1134
+ /**
1135
+ * @param {VectorPropertiesPrimitiveOptions|undefined} value
1136
+ */
1137
+ set primitiveOptions(value) {
1138
+ checkMaybe(value, Object);
1139
+
1140
+ if (this._primitiveOptions !== value) {
1141
+ this._primitiveOptions = value;
1142
+ this.propertyChanged.raiseEvent(['primitiveOptions']);
1143
+ }
1144
+ }
1145
+
1146
+ /**
1147
+ * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
1148
+ * @returns {VectorPropertiesPrimitiveOptions|null}
1149
+ * @api
1150
+ */
1151
+ getPrimitiveOptions(feature) {
1152
+ const featureValue = feature.get('olcs_primitiveOptions');
1153
+ return featureValue !== undefined ? featureValue : this.primitiveOptions;
1154
+ }
1155
+
1156
+ /**
1157
+ * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
1158
+ * @returns {VectorPropertiesBaseOptions}
1159
+ * @private
1160
+ */
1161
+ _getBaseOptions(feature) {
1162
+ return {
1163
+ scale: [this.getModelScaleX(feature), this.getModelScaleY(feature), this.getModelScaleZ(feature)],
1164
+ heading: this.getModelHeading(feature),
1165
+ pitch: this.getModelPitch(feature),
1166
+ roll: this.getModelRoll(feature),
1167
+ autoScale: this.getModelAutoScale(feature),
1168
+ };
1169
+ }
1170
+
1171
+ /**
1172
+ * Returns the primive definition of this feature
1173
+ * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
1174
+ * @returns {VectorPropertiesPrimitive|null}
1175
+ */
1176
+ getPrimitive(feature) {
1177
+ const primitiveOptions = this.getPrimitiveOptions(feature);
1178
+ if (!primitiveOptions?.geometryOptions) {
1179
+ return null;
1180
+ }
1181
+
1182
+ return {
1183
+ ...this._getBaseOptions(feature),
1184
+ primitiveOptions,
1185
+ };
1186
+ }
1187
+
1043
1188
  /**
1044
1189
  * @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
1045
1190
  * @returns {VectorPropertiesModelOptions|null}
@@ -1057,11 +1202,8 @@ class VectorProperties {
1057
1202
  }
1058
1203
 
1059
1204
  return {
1205
+ ...this._getBaseOptions(feature),
1060
1206
  url,
1061
- scale: [this.getModelScaleX(feature), this.getModelScaleY(feature), this.getModelScaleZ(feature)],
1062
- heading: this.getModelHeading(feature),
1063
- pitch: this.getModelPitch(feature),
1064
- roll: this.getModelRoll(feature),
1065
1207
  };
1066
1208
  }
1067
1209
 
@@ -12,7 +12,6 @@ import { FeatureVisibilityAction, globalHidden, hidden, highlighted } from './fe
12
12
  import { getStylesArray } from '../util/featureconverter/convert.js';
13
13
  import { vcsLayerName } from './layerSymbols.js';
14
14
  import TileProviderFeatureProvider from '../featureProvider/tileProviderFeatureProvider.js';
15
- import { getGenericFeatureFromClickedObject } from './vectorHelpers.js';
16
15
  import { originalFeatureSymbol } from './vectorSymbols.js';
17
16
  import { getObjectFromClassRegistry, layerClassRegistry, tileProviderClassRegistry } from '../classRegistry.js';
18
17
  import TileProvider from './tileProvider/tileProvider.js';
@@ -238,14 +237,6 @@ class VectorTileLayer extends FeatureLayer {
238
237
  return null;
239
238
  }
240
239
 
241
- /**
242
- * @param {VectorClickedObject} object
243
- * @returns {?GenericFeature}
244
- */
245
- getGenericFeatureFromClickedObject(object) {
246
- return getGenericFeatureFromClickedObject(object, this);
247
- }
248
-
249
240
  /**
250
241
  * @returns {number}
251
242
  * @private
@@ -27,6 +27,7 @@ import {
27
27
  KeyboardEventModifier,
28
28
  ScreenSpaceEventType,
29
29
  Cesium3DTileset,
30
+ Cartographic,
30
31
  } from '@vcmap/cesium';
31
32
 
32
33
  import { check, checkMaybe } from '@vcsuite/check';
@@ -739,15 +740,14 @@ class CesiumMap extends VcsMap {
739
740
  }
740
741
 
741
742
  /**
742
- * @inheritDoc
743
- * @param {import("ol/coordinate").Coordinate} coordinate - in mercator
743
+ * @param {import("@vcmap/cesium").Cartesian3} cartesian
744
+ * @param {number} latitude - in radians
744
745
  * @returns {number}
746
+ * @private
745
747
  */
746
- getCurrentResolution(coordinate) {
748
+ _getCurrentResolutionFromCartesianLatitude(cartesian, latitude) {
747
749
  const cam = this._cesiumWidget.scene.camera;
748
- const wgs84Coordinate = Projection.mercatorToWgs84(coordinate);
749
- const distance = Cartesian3
750
- .distance(Cartesian3.fromDegrees(wgs84Coordinate[0], wgs84Coordinate[1], wgs84Coordinate[2]), cam.position);
750
+ const distance = Cartesian3.distance(cartesian, cam.position);
751
751
 
752
752
  const fov = Math.PI / 3.0;
753
753
  const width = this.mapElement.offsetWidth;
@@ -755,12 +755,31 @@ class CesiumMap extends VcsMap {
755
755
  const aspectRatio = width / height;
756
756
  const fovy = Math.atan(Math.tan(fov * 0.5) / aspectRatio) * 2.0;
757
757
  const visibleMeters = 2 * distance * Math.tan(fovy / 2);
758
- const relativeCircumference = Math.cos(Math.abs(CesiumMath.toRadians(wgs84Coordinate[1])));
758
+ const relativeCircumference = Math.cos(Math.abs(latitude));
759
759
  const visibleMapUnits = visibleMeters / relativeCircumference;
760
760
 
761
761
  return visibleMapUnits / height;
762
762
  }
763
763
 
764
+ /**
765
+ * @inheritDoc
766
+ * @param {import("ol/coordinate").Coordinate} coordinate - in mercator
767
+ * @returns {number}
768
+ */
769
+ getCurrentResolution(coordinate) {
770
+ const wgs84Coordinate = Projection.mercatorToWgs84(coordinate);
771
+ const cartesian = Cartesian3.fromDegrees(wgs84Coordinate[0], wgs84Coordinate[1], wgs84Coordinate[2]);
772
+ return this._getCurrentResolutionFromCartesianLatitude(cartesian, CesiumMath.toRadians(wgs84Coordinate[1]));
773
+ }
774
+
775
+ /**
776
+ * @param {import("@vcmap/cesium").Cartesian3} cartesian
777
+ * @returns {number}
778
+ */
779
+ getCurrentResolutionFromCartesian(cartesian) {
780
+ return this._getCurrentResolutionFromCartesianLatitude(cartesian, Cartographic.fromCartesian(cartesian).latitude);
781
+ }
782
+
764
783
  /**
765
784
  * @param {boolean} bool
766
785
  * @inheritDoc