@vcmap/core 5.1.0-rc.3 → 5.1.0

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 (30) hide show
  1. package/README.md +1 -1
  2. package/dist/src/layer/vectorProperties.d.ts +2 -1
  3. package/dist/src/layer/vectorProperties.js.map +1 -1
  4. package/dist/src/util/editor/createFeatureSession.d.ts +4 -1
  5. package/dist/src/util/editor/createFeatureSession.js +54 -2
  6. package/dist/src/util/editor/createFeatureSession.js.map +1 -1
  7. package/dist/src/util/editor/editGeometrySession.d.ts +1 -1
  8. package/dist/src/util/editor/editGeometrySession.js +50 -7
  9. package/dist/src/util/editor/editGeometrySession.js.map +1 -1
  10. package/dist/src/util/editor/editorHelpers.d.ts +4 -4
  11. package/dist/src/util/editor/editorHelpers.js +17 -4
  12. package/dist/src/util/editor/editorHelpers.js.map +1 -1
  13. package/dist/src/util/editor/editorSessionHelpers.d.ts +7 -0
  14. package/dist/src/util/editor/editorSessionHelpers.js +20 -1
  15. package/dist/src/util/editor/editorSessionHelpers.js.map +1 -1
  16. package/dist/src/util/editor/interactions/insertVertexInteraction.js +2 -2
  17. package/dist/src/util/editor/interactions/insertVertexInteraction.js.map +1 -1
  18. package/dist/src/util/editor/interactions/translateVertexInteraction.js +3 -0
  19. package/dist/src/util/editor/interactions/translateVertexInteraction.js.map +1 -1
  20. package/dist/src/util/featureconverter/pointToCesium.js +1 -8
  21. package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
  22. package/package.json +1 -1
  23. package/src/layer/vectorProperties.ts +7 -2
  24. package/src/util/editor/createFeatureSession.ts +66 -1
  25. package/src/util/editor/editGeometrySession.ts +81 -8
  26. package/src/util/editor/editorHelpers.ts +26 -4
  27. package/src/util/editor/editorSessionHelpers.ts +28 -1
  28. package/src/util/editor/interactions/insertVertexInteraction.ts +5 -1
  29. package/src/util/editor/interactions/translateVertexInteraction.ts +3 -0
  30. package/src/util/featureconverter/pointToCesium.ts +1 -7
@@ -1,4 +1,5 @@
1
1
  import type { Point, Polygon, Circle, LineString } from 'ol/geom.js';
2
+ import { HeightReference } from '@vcmap-cesium/engine';
2
3
  import VectorLayer from '../../layer/vectorLayer.js';
3
4
  import { mercatorProjection } from '../projection.js';
4
5
  import InteractionChain from '../../interaction/interactionChain.js';
@@ -8,6 +9,7 @@ import LayerCollection, { maxZIndex } from '../layerCollection.js';
8
9
  import { markVolatile } from '../../vcsModule.js';
9
10
  import { PrimitiveOptionsType } from '../../layer/vectorProperties.js';
10
11
  import EventHandler from '../../interaction/eventHandler.js';
12
+ import type VcsApp from '../../vcsApp.js';
11
13
 
12
14
  export enum SessionType {
13
15
  CREATE = 'create',
@@ -100,7 +102,7 @@ export function setupInteractionChain(
100
102
  );
101
103
  const currentFeatureInteractionEvent = eventHandler.featureInteraction.active;
102
104
  eventHandler.featureInteraction.setActive(
103
- EventType.CLICKMOVE | EventType.DRAGSTART,
105
+ EventType.CLICKMOVE | EventType.DRAGEVENTS,
104
106
  );
105
107
 
106
108
  return {
@@ -135,3 +137,28 @@ export type GeometryToType<T extends GeometryType> =
135
137
  : T extends GeometryType.Circle
136
138
  ? Circle
137
139
  : never;
140
+
141
+ export type PickingBehavior = {
142
+ setForAltitudeMode(altitudeMode: HeightReference): void;
143
+ reset(): void;
144
+ };
145
+
146
+ export function createPickingBehavior(app: VcsApp): PickingBehavior {
147
+ const initialPickPosition =
148
+ app.maps.eventHandler.featureInteraction.pickPosition;
149
+
150
+ return {
151
+ setForAltitudeMode(altitudeMode: HeightReference): void {
152
+ if (altitudeMode === HeightReference.NONE) {
153
+ app.maps.eventHandler.featureInteraction.pickPosition =
154
+ EventType.CLICKMOVE | EventType.DRAGEVENTS;
155
+ } else {
156
+ app.maps.eventHandler.featureInteraction.pickPosition = EventType.NONE;
157
+ }
158
+ },
159
+ reset(): void {
160
+ app.maps.eventHandler.featureInteraction.pickPosition =
161
+ initialPickPosition;
162
+ },
163
+ };
164
+ }
@@ -10,6 +10,7 @@ import {
10
10
  import { cartesian2DDistance } from '../../math.js';
11
11
  import {
12
12
  createVertex,
13
+ getOlcsPropsFromFeature,
13
14
  pointOnLine2D,
14
15
  pointOnLine3D,
15
16
  type Vertex,
@@ -74,7 +75,10 @@ class InsertVertexInteraction extends AbstractInteraction {
74
75
  index = 0;
75
76
  }
76
77
  this.vertexInserted.raiseEvent({
77
- vertex: createVertex(closestCoord),
78
+ vertex: createVertex(
79
+ closestCoord,
80
+ getOlcsPropsFromFeature(this._feature),
81
+ ),
78
82
  index,
79
83
  });
80
84
  }
@@ -5,6 +5,7 @@ import { EventType } from '../../../interaction/interactionType.js';
5
5
  import { vertexSymbol } from '../editorSymbols.js';
6
6
  import VcsEvent from '../../../vcsEvent.js';
7
7
  import { Vertex } from '../editorHelpers.js';
8
+ import { emptyStyle } from '../../../style/styleHelpers.js';
8
9
 
9
10
  /**
10
11
  * Class to translate a vertex. Will call the passed in vertex changed event with the changed vertex.
@@ -27,6 +28,7 @@ class TranslateVertexInteraction extends AbstractInteraction {
27
28
 
28
29
  if (event.type & EventType.DRAGEND) {
29
30
  this._vertex.unset('olcs_allowPicking');
31
+ this._vertex.setStyle(undefined);
30
32
  this._vertex = null;
31
33
  }
32
34
  event.stopPropagation = true;
@@ -37,6 +39,7 @@ class TranslateVertexInteraction extends AbstractInteraction {
37
39
  ) {
38
40
  this._vertex = event.feature as Vertex;
39
41
  this._vertex.set('olcs_allowPicking', false);
42
+ this._vertex.setStyle(emptyStyle);
40
43
  event.stopPropagation = true;
41
44
  }
42
45
  return Promise.resolve(event);
@@ -226,13 +226,7 @@ export function getCartesian3AndWGS84FromCoordinates(
226
226
  );
227
227
  coordinates.forEach((coord, index) => {
228
228
  wgs84Positions[index] = Projection.mercatorToWgs84(coord, true);
229
- let height = null;
230
- if (heightInfo.heightReference === HeightReference.RELATIVE_TO_GROUND) {
231
- height = heightValue + heightInfo.heightAboveGroundAdjustment;
232
- } else {
233
- height = heightValue;
234
- }
235
- positions[index] = Cartesian3.fromDegrees(coord[0], coord[1], height);
229
+ positions[index] = Cartesian3.fromDegrees(coord[0], coord[1], heightValue);
236
230
  });
237
231
  return {
238
232
  positions,