@vcmap/core 6.0.0-rc.4 → 6.0.0-rc.6
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.
- package/dist/cesium.d.ts +11 -0
- package/dist/index.d.ts +23 -16
- package/dist/index.js +21 -14
- package/dist/index.js.map +1 -1
- package/dist/ol.d.ts +15 -2
- package/dist/src/layer/cesium/clusterContext.d.ts +8 -14
- package/dist/src/layer/cesium/clusterContext.js +62 -41
- package/dist/src/layer/cesium/clusterContext.js.map +1 -1
- package/dist/src/layer/cesium/vectorCesiumImpl.d.ts +2 -3
- package/dist/src/layer/cesium/vectorCesiumImpl.js +16 -10
- package/dist/src/layer/cesium/vectorCesiumImpl.js.map +1 -1
- package/dist/src/layer/cesium/vectorContext.d.ts +10 -53
- package/dist/src/layer/cesium/vectorContext.js +88 -172
- package/dist/src/layer/cesium/vectorContext.js.map +1 -1
- package/dist/src/layer/geojsonHelpers.d.ts +1 -1
- package/dist/src/layer/geojsonHelpers.js +5 -10
- package/dist/src/layer/geojsonHelpers.js.map +1 -1
- package/dist/src/layer/oblique/obliqueHelpers.js +6 -6
- package/dist/src/layer/oblique/obliqueHelpers.js.map +1 -1
- package/dist/src/layer/vectorLayer.d.ts +0 -37
- package/dist/src/layer/vectorLayer.js.map +1 -1
- package/dist/src/layer/vectorProperties.d.ts +8 -3
- package/dist/src/layer/vectorProperties.js +30 -5
- package/dist/src/layer/vectorProperties.js.map +1 -1
- package/dist/src/map/baseOLMap.js +1 -1
- package/dist/src/map/baseOLMap.js.map +1 -1
- package/dist/src/map/obliqueMap.d.ts +3 -0
- package/dist/src/map/obliqueMap.js +27 -6
- package/dist/src/map/obliqueMap.js.map +1 -1
- package/dist/src/map/vcsMap.d.ts +8 -0
- package/dist/src/map/vcsMap.js +11 -0
- package/dist/src/map/vcsMap.js.map +1 -1
- package/dist/src/oblique/helpers.js +5 -5
- package/dist/src/oblique/helpers.js.map +1 -1
- package/dist/src/oblique/obliqueDataSet.js +4 -4
- package/dist/src/oblique/obliqueDataSet.js.map +1 -1
- package/dist/src/ol/geom/geometryCollection.js +19 -2
- package/dist/src/ol/geom/geometryCollection.js.map +1 -1
- package/dist/src/style/arcStyle.js +1 -0
- package/dist/src/style/arcStyle.js.map +1 -1
- package/dist/src/util/editor/createFeatureSession.d.ts +5 -1
- package/dist/src/util/editor/createFeatureSession.js +48 -4
- package/dist/src/util/editor/createFeatureSession.js.map +1 -1
- package/dist/src/util/editor/editFeaturesSession.d.ts +10 -4
- package/dist/src/util/editor/editFeaturesSession.js +74 -37
- package/dist/src/util/editor/editFeaturesSession.js.map +1 -1
- package/dist/src/util/editor/editGeometrySession.d.ts +5 -1
- package/dist/src/util/editor/editGeometrySession.js +77 -55
- package/dist/src/util/editor/editGeometrySession.js.map +1 -1
- package/dist/src/util/editor/editorHelpers.d.ts +12 -6
- package/dist/src/util/editor/editorHelpers.js +47 -20
- package/dist/src/util/editor/editorHelpers.js.map +1 -1
- package/dist/src/util/editor/editorSessionHelpers.d.ts +5 -0
- package/dist/src/util/editor/editorSessionHelpers.js +1 -0
- package/dist/src/util/editor/editorSessionHelpers.js.map +1 -1
- package/dist/src/util/editor/editorSymbols.d.ts +1 -1
- package/dist/src/util/editor/editorSymbols.js +1 -1
- package/dist/src/util/editor/editorSymbols.js.map +1 -1
- package/dist/src/util/editor/interactions/createBBoxInteraction.d.ts +1 -0
- package/dist/src/util/editor/interactions/createBBoxInteraction.js +20 -16
- package/dist/src/util/editor/interactions/createBBoxInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/createCircleInteraction.js +1 -1
- package/dist/src/util/editor/interactions/createCircleInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/createLineStringInteraction.js +3 -3
- package/dist/src/util/editor/interactions/createLineStringInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/createPointInteraction.js +1 -1
- package/dist/src/util/editor/interactions/createPointInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/createPolygonInteraction.d.ts +4 -0
- package/dist/src/util/editor/interactions/createPolygonInteraction.js +9 -3
- package/dist/src/util/editor/interactions/createPolygonInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/creationSnapping.d.ts +26 -0
- package/dist/src/util/editor/interactions/creationSnapping.js +139 -0
- package/dist/src/util/editor/interactions/creationSnapping.js.map +1 -0
- package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js +3 -2
- package/dist/src/util/editor/interactions/editGeometryMouseOverInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/insertVertexInteraction.d.ts +3 -1
- package/dist/src/util/editor/interactions/insertVertexInteraction.js +14 -6
- package/dist/src/util/editor/interactions/insertVertexInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/layerSnapping.d.ts +19 -0
- package/dist/src/util/editor/interactions/layerSnapping.js +87 -0
- package/dist/src/util/editor/interactions/layerSnapping.js.map +1 -0
- package/dist/src/util/editor/interactions/translateVertexInteraction.js +2 -2
- package/dist/src/util/editor/interactions/translateVertexInteraction.js.map +1 -1
- package/dist/src/util/editor/interactions/translationSnapping.d.ts +25 -0
- package/dist/src/util/editor/interactions/translationSnapping.js +179 -0
- package/dist/src/util/editor/interactions/translationSnapping.js.map +1 -0
- package/dist/src/util/editor/snappingHelpers.d.ts +44 -0
- package/dist/src/util/editor/snappingHelpers.js +329 -0
- package/dist/src/util/editor/snappingHelpers.js.map +1 -0
- package/dist/src/util/editor/transformation/create2DHandlers.js +26 -26
- package/dist/src/util/editor/transformation/create2DHandlers.js.map +1 -1
- package/dist/src/util/editor/transformation/create3DHandlers.js +65 -14
- package/dist/src/util/editor/transformation/create3DHandlers.js.map +1 -1
- package/dist/src/util/editor/transformation/scaleInteraction.js +27 -5
- package/dist/src/util/editor/transformation/scaleInteraction.js.map +1 -1
- package/dist/src/util/editor/transformation/transformationHandler.js +56 -38
- package/dist/src/util/editor/transformation/transformationHandler.js.map +1 -1
- package/dist/src/util/editor/transformation/transformationTypes.d.ts +2 -0
- package/dist/src/util/editor/transformation/transformationTypes.js +4 -0
- package/dist/src/util/editor/transformation/transformationTypes.js.map +1 -1
- package/dist/src/util/featureconverter/arcToCesium.d.ts +5 -19
- package/dist/src/util/featureconverter/arcToCesium.js +15 -42
- package/dist/src/util/featureconverter/arcToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/circleToCesium.d.ts +2 -27
- package/dist/src/util/featureconverter/circleToCesium.js +84 -63
- package/dist/src/util/featureconverter/circleToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/clampedPrimitive.d.ts +2 -0
- package/dist/src/util/featureconverter/clampedPrimitive.js +29 -0
- package/dist/src/util/featureconverter/clampedPrimitive.js.map +1 -0
- package/dist/src/util/featureconverter/convert.d.ts +26 -7
- package/dist/src/util/featureconverter/convert.js +221 -44
- package/dist/src/util/featureconverter/convert.js.map +1 -1
- package/dist/src/util/featureconverter/extent3D.d.ts +4 -3
- package/dist/src/util/featureconverter/extent3D.js +4 -3
- package/dist/src/util/featureconverter/extent3D.js.map +1 -1
- package/dist/src/util/featureconverter/lineStringToCesium.d.ts +12 -27
- package/dist/src/util/featureconverter/lineStringToCesium.js +85 -107
- package/dist/src/util/featureconverter/lineStringToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/pointHelpers.d.ts +8 -11
- package/dist/src/util/featureconverter/pointHelpers.js +134 -120
- package/dist/src/util/featureconverter/pointHelpers.js.map +1 -1
- package/dist/src/util/featureconverter/pointToCesium.d.ts +14 -17
- package/dist/src/util/featureconverter/pointToCesium.js +47 -96
- package/dist/src/util/featureconverter/pointToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/polygonToCesium.d.ts +2 -26
- package/dist/src/util/featureconverter/polygonToCesium.js +62 -72
- package/dist/src/util/featureconverter/polygonToCesium.js.map +1 -1
- package/dist/src/util/featureconverter/storeyHelpers.d.ts +17 -0
- package/dist/src/util/featureconverter/storeyHelpers.js +78 -0
- package/dist/src/util/featureconverter/storeyHelpers.js.map +1 -0
- package/dist/src/util/featureconverter/vectorGeometryFactory.d.ts +54 -0
- package/dist/src/util/featureconverter/vectorGeometryFactory.js +278 -0
- package/dist/src/util/featureconverter/vectorGeometryFactory.js.map +1 -0
- package/dist/src/util/featureconverter/vectorHeightInfo.d.ts +86 -0
- package/dist/src/util/featureconverter/vectorHeightInfo.js +242 -0
- package/dist/src/util/featureconverter/vectorHeightInfo.js.map +1 -0
- package/dist/src/util/geometryHelpers.d.ts +22 -1
- package/dist/src/util/geometryHelpers.js +65 -2
- package/dist/src/util/geometryHelpers.js.map +1 -1
- package/dist/src/util/mapCollection.js +8 -0
- package/dist/src/util/mapCollection.js.map +1 -1
- package/dist/src/util/math.d.ts +6 -2
- package/dist/src/util/math.js +34 -12
- package/dist/src/util/math.js.map +1 -1
- package/dist/tests/unit/helpers/cesiumHelpers.js +3 -1
- package/dist/tests/unit/helpers/cesiumHelpers.js.map +1 -1
- package/dist/tests/unit/helpers/helpers.d.ts +2 -9
- package/dist/tests/unit/helpers/helpers.js +2 -8
- package/dist/tests/unit/helpers/helpers.js.map +1 -1
- package/index.ts +74 -35
- package/package.json +3 -3
- package/src/cesium/cesium.d.ts +11 -0
- package/src/layer/cesium/clusterContext.ts +82 -91
- package/src/layer/cesium/vectorCesiumImpl.ts +17 -11
- package/src/layer/cesium/vectorContext.ts +120 -348
- package/src/layer/geojsonHelpers.ts +9 -12
- package/src/layer/oblique/obliqueHelpers.ts +6 -6
- package/src/layer/vectorLayer.ts +0 -71
- package/src/layer/vectorProperties.ts +46 -9
- package/src/map/baseOLMap.ts +1 -1
- package/src/map/obliqueMap.ts +46 -6
- package/src/map/vcsMap.ts +20 -2
- package/src/oblique/helpers.ts +11 -5
- package/src/oblique/obliqueDataSet.ts +4 -4
- package/src/ol/geom/geometryCollection.js +21 -2
- package/src/ol/ol.d.ts +15 -2
- package/src/style/arcStyle.ts +1 -0
- package/src/util/editor/createFeatureSession.ts +64 -6
- package/src/util/editor/editFeaturesSession.ts +105 -39
- package/src/util/editor/editGeometrySession.ts +118 -75
- package/src/util/editor/editorHelpers.ts +78 -30
- package/src/util/editor/editorSessionHelpers.ts +7 -0
- package/src/util/editor/editorSymbols.ts +1 -1
- package/src/util/editor/interactions/createBBoxInteraction.ts +25 -16
- package/src/util/editor/interactions/createCircleInteraction.ts +1 -1
- package/src/util/editor/interactions/createLineStringInteraction.ts +9 -3
- package/src/util/editor/interactions/createPointInteraction.ts +1 -1
- package/src/util/editor/interactions/createPolygonInteraction.ts +16 -3
- package/src/util/editor/interactions/creationSnapping.ts +226 -0
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.ts +3 -2
- package/src/util/editor/interactions/insertVertexInteraction.ts +27 -7
- package/src/util/editor/interactions/layerSnapping.ts +136 -0
- package/src/util/editor/interactions/translateVertexInteraction.ts +8 -2
- package/src/util/editor/interactions/translationSnapping.ts +302 -0
- package/src/util/editor/snappingHelpers.ts +490 -0
- package/src/util/editor/transformation/create2DHandlers.ts +38 -26
- package/src/util/editor/transformation/create3DHandlers.ts +84 -22
- package/src/util/editor/transformation/scaleInteraction.ts +28 -5
- package/src/util/editor/transformation/transformationHandler.ts +72 -41
- package/src/util/editor/transformation/transformationTypes.ts +5 -0
- package/src/util/featureconverter/arcToCesium.ts +25 -95
- package/src/util/featureconverter/circleToCesium.ts +127 -113
- package/src/util/featureconverter/clampedPrimitive.ts +70 -0
- package/src/util/featureconverter/convert.ts +446 -114
- package/src/util/featureconverter/extent3D.ts +13 -6
- package/src/util/featureconverter/lineStringToCesium.ts +132 -179
- package/src/util/featureconverter/pointHelpers.ts +271 -214
- package/src/util/featureconverter/pointToCesium.ts +111 -175
- package/src/util/featureconverter/polygonToCesium.ts +98 -117
- package/src/util/featureconverter/storeyHelpers.ts +104 -0
- package/src/util/featureconverter/vectorGeometryFactory.ts +601 -0
- package/src/util/featureconverter/vectorHeightInfo.ts +393 -0
- package/src/util/geometryHelpers.ts +79 -5
- package/src/util/mapCollection.ts +8 -0
- package/src/util/math.ts +59 -12
- package/dist/src/util/featureconverter/featureconverterHelper.d.ts +0 -35
- package/dist/src/util/featureconverter/featureconverterHelper.js +0 -404
- package/dist/src/util/featureconverter/featureconverterHelper.js.map +0 -1
- package/src/util/featureconverter/featureconverterHelper.ts +0 -672
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { circular } from 'ol/geom/Polygon.js';
|
|
2
2
|
import type { Style } from 'ol/style.js';
|
|
3
3
|
import type { Circle } from 'ol/geom.js';
|
|
4
|
-
import type { Coordinate } from 'ol/coordinate.js';
|
|
5
|
-
import type { Feature } from 'ol/index.js';
|
|
6
|
-
|
|
7
4
|
import {
|
|
8
5
|
Cartesian3,
|
|
9
6
|
CircleGeometry,
|
|
@@ -12,57 +9,106 @@ import {
|
|
|
12
9
|
Math as CesiumMath,
|
|
13
10
|
Cartographic,
|
|
14
11
|
PolylineGeometry,
|
|
15
|
-
type Scene,
|
|
16
12
|
} from '@vcmap-cesium/engine';
|
|
17
13
|
import { parseNumber } from '@vcsuite/parsers';
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
import {
|
|
15
|
+
mercatorToCartesianTransformerForHeightInfo,
|
|
16
|
+
VectorHeightInfo,
|
|
17
|
+
} from './vectorHeightInfo.js';
|
|
18
|
+
import {
|
|
19
|
+
CesiumGeometryOption,
|
|
20
|
+
CircleGeometryOptions,
|
|
21
|
+
VectorGeometryFactory,
|
|
22
|
+
} from './vectorGeometryFactory.js';
|
|
23
|
+
|
|
24
|
+
function createCircleGeometry(
|
|
25
|
+
options: CircleGeometryOptions,
|
|
26
|
+
height: number,
|
|
27
|
+
perPositionHeight: boolean,
|
|
28
|
+
extrudedHeight?: number,
|
|
29
|
+
): CircleGeometry {
|
|
30
|
+
const geometryOptions = {
|
|
31
|
+
...options,
|
|
32
|
+
granularity: 0.02,
|
|
33
|
+
extrudedHeight,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
if (!perPositionHeight) {
|
|
37
|
+
geometryOptions.height = height;
|
|
38
|
+
} else {
|
|
39
|
+
const cartographic = Cartographic.fromCartesian(options.center);
|
|
40
|
+
geometryOptions.height = cartographic.height;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return new CircleGeometry(geometryOptions);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function createSolidGeometries(
|
|
47
|
+
options: CircleGeometryOptions,
|
|
48
|
+
heightInfo: VectorHeightInfo,
|
|
26
49
|
height: number,
|
|
27
|
-
|
|
50
|
+
perPositionHeight: boolean,
|
|
28
51
|
extrudedHeight?: number,
|
|
29
|
-
):
|
|
52
|
+
): CesiumGeometryOption<'solid'>[] {
|
|
30
53
|
return [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
{
|
|
55
|
+
type: 'solid',
|
|
56
|
+
geometry: createCircleGeometry(
|
|
57
|
+
options,
|
|
58
|
+
height,
|
|
59
|
+
perPositionHeight,
|
|
60
|
+
extrudedHeight,
|
|
61
|
+
),
|
|
62
|
+
heightInfo,
|
|
63
|
+
},
|
|
37
64
|
];
|
|
38
65
|
}
|
|
39
66
|
|
|
40
|
-
|
|
41
|
-
options:
|
|
67
|
+
function createOutlineGeometries(
|
|
68
|
+
options: CircleGeometryOptions,
|
|
69
|
+
heightInfo: VectorHeightInfo,
|
|
42
70
|
height: number,
|
|
43
|
-
|
|
71
|
+
perPositionHeight: boolean,
|
|
44
72
|
extrudedHeight?: number,
|
|
45
|
-
):
|
|
73
|
+
): CesiumGeometryOption<'outline'>[] {
|
|
74
|
+
const geometryOptions = {
|
|
75
|
+
...options,
|
|
76
|
+
granularity: 0.02,
|
|
77
|
+
extrudedHeight,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
if (!perPositionHeight) {
|
|
81
|
+
geometryOptions.height = height;
|
|
82
|
+
} else {
|
|
83
|
+
const cartographic = Cartographic.fromCartesian(options.center);
|
|
84
|
+
geometryOptions.height = cartographic.height;
|
|
85
|
+
}
|
|
46
86
|
return [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}),
|
|
87
|
+
{
|
|
88
|
+
type: 'outline',
|
|
89
|
+
geometry: new CircleOutlineGeometry(geometryOptions),
|
|
90
|
+
heightInfo,
|
|
91
|
+
},
|
|
53
92
|
];
|
|
54
93
|
}
|
|
55
94
|
|
|
56
|
-
|
|
57
|
-
options:
|
|
95
|
+
function createFillGeometries(
|
|
96
|
+
options: CircleGeometryOptions,
|
|
97
|
+
heightInfo: VectorHeightInfo,
|
|
58
98
|
height: number,
|
|
59
99
|
perPositionHeight: boolean,
|
|
60
|
-
):
|
|
61
|
-
return
|
|
100
|
+
): CesiumGeometryOption<'fill'>[] {
|
|
101
|
+
return [
|
|
102
|
+
{
|
|
103
|
+
type: 'fill',
|
|
104
|
+
geometry: createCircleGeometry(options, height, perPositionHeight),
|
|
105
|
+
heightInfo,
|
|
106
|
+
},
|
|
107
|
+
];
|
|
62
108
|
}
|
|
63
109
|
|
|
64
|
-
|
|
65
|
-
options:
|
|
110
|
+
function getLineGeometryOptions(
|
|
111
|
+
options: CircleGeometryOptions,
|
|
66
112
|
style: Style,
|
|
67
113
|
): { width: number; positions: Cartesian3[] } {
|
|
68
114
|
const width = parseNumber(style.getStroke()?.getWidth(), 1.0);
|
|
@@ -85,61 +131,58 @@ export function getLineGeometryOptions(
|
|
|
85
131
|
};
|
|
86
132
|
}
|
|
87
133
|
|
|
88
|
-
|
|
89
|
-
options:
|
|
134
|
+
function createGroundLineGeometries(
|
|
135
|
+
options: CircleGeometryOptions,
|
|
136
|
+
heightInfo: VectorHeightInfo,
|
|
90
137
|
style: Style,
|
|
91
|
-
):
|
|
138
|
+
): CesiumGeometryOption<'groundLine'>[] {
|
|
92
139
|
const lineOptions = getLineGeometryOptions(options, style);
|
|
93
|
-
return [
|
|
140
|
+
return [
|
|
141
|
+
{
|
|
142
|
+
type: 'groundLine',
|
|
143
|
+
geometry: new GroundPolylineGeometry(lineOptions),
|
|
144
|
+
heightInfo,
|
|
145
|
+
},
|
|
146
|
+
];
|
|
94
147
|
}
|
|
95
148
|
|
|
96
|
-
|
|
97
|
-
options:
|
|
149
|
+
function createLineGeometries(
|
|
150
|
+
options: CircleGeometryOptions,
|
|
151
|
+
heightInfo: VectorHeightInfo,
|
|
98
152
|
style: Style,
|
|
99
|
-
):
|
|
153
|
+
): CesiumGeometryOption<'line'>[] {
|
|
100
154
|
const lineOptions = getLineGeometryOptions(options, style);
|
|
101
|
-
return [
|
|
155
|
+
return [
|
|
156
|
+
{
|
|
157
|
+
type: 'line',
|
|
158
|
+
geometry: new PolylineGeometry(lineOptions),
|
|
159
|
+
heightInfo,
|
|
160
|
+
},
|
|
161
|
+
];
|
|
102
162
|
}
|
|
103
163
|
|
|
104
164
|
/**
|
|
105
165
|
* extracts the center and radius from the CircleGeometry and converts it to Cartesian3/radius in m
|
|
106
166
|
* @param geometry
|
|
107
|
-
* @param
|
|
108
|
-
* @param perPositionHeight
|
|
109
|
-
* @param groundLevelOrMinHeight
|
|
167
|
+
* @param heightInfo
|
|
110
168
|
* @returns
|
|
111
169
|
* @private
|
|
112
170
|
*/
|
|
113
|
-
|
|
171
|
+
function getGeometryOptions(
|
|
114
172
|
geometry: Circle,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
groundLevelOrMinHeight: number,
|
|
118
|
-
): ConstructorParameters<typeof CircleGeometry>[0] {
|
|
173
|
+
heightInfo: VectorHeightInfo,
|
|
174
|
+
): CircleGeometryOptions {
|
|
119
175
|
// olCoordinates of center and radius in WGS84
|
|
120
176
|
const olCenter = geometry.getCenter();
|
|
121
177
|
const olPoint = olCenter.slice();
|
|
122
178
|
olPoint[0] += geometry.getRadius();
|
|
123
|
-
const wgs84Center = Projection.mercatorToWgs84(olCenter, true);
|
|
124
|
-
if (!perPositionHeight && groundLevelOrMinHeight) {
|
|
125
|
-
wgs84Center[2] = groundLevelOrMinHeight;
|
|
126
|
-
} else if (wgs84Center[2] != null) {
|
|
127
|
-
wgs84Center[2] += positionHeightAdjustment;
|
|
128
|
-
}
|
|
129
179
|
|
|
130
|
-
const
|
|
180
|
+
const coordinateTransformer =
|
|
181
|
+
mercatorToCartesianTransformerForHeightInfo(heightInfo);
|
|
131
182
|
|
|
132
183
|
// Cesium coordinates of center and radius
|
|
133
|
-
const center =
|
|
134
|
-
|
|
135
|
-
wgs84Center[1],
|
|
136
|
-
wgs84Center[2],
|
|
137
|
-
);
|
|
138
|
-
const point = Cartesian3.fromDegrees(
|
|
139
|
-
wgs84Point[0],
|
|
140
|
-
wgs84Point[1],
|
|
141
|
-
wgs84Center[2],
|
|
142
|
-
);
|
|
184
|
+
const center = coordinateTransformer(olCenter);
|
|
185
|
+
const point = coordinateTransformer(olPoint);
|
|
143
186
|
|
|
144
187
|
// Computation of radius in Cesium 3D
|
|
145
188
|
const radius = Cartesian3.distance(center, point);
|
|
@@ -149,29 +192,6 @@ export function getGeometryOptions(
|
|
|
149
192
|
};
|
|
150
193
|
}
|
|
151
194
|
|
|
152
|
-
export function getCoordinates(geometries: Circle[]): Coordinate[] {
|
|
153
|
-
return geometries.map((circle) => {
|
|
154
|
-
return circle.getCenter();
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
let geometryFactory: VectorGeometryFactoryType | null = null;
|
|
159
|
-
|
|
160
|
-
function getGeometryFactory(): VectorGeometryFactoryType {
|
|
161
|
-
if (!geometryFactory) {
|
|
162
|
-
geometryFactory = {
|
|
163
|
-
getCoordinates,
|
|
164
|
-
getGeometryOptions,
|
|
165
|
-
createSolidGeometries,
|
|
166
|
-
createOutlineGeometries,
|
|
167
|
-
createFillGeometries,
|
|
168
|
-
createGroundLineGeometries,
|
|
169
|
-
createLineGeometries,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
return geometryFactory;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
195
|
/**
|
|
176
196
|
* validates if a point is renderable
|
|
177
197
|
*/
|
|
@@ -192,26 +212,20 @@ export function validateCircle(circle: Circle): boolean {
|
|
|
192
212
|
return false;
|
|
193
213
|
}
|
|
194
214
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
215
|
+
let geometryFactory: VectorGeometryFactory<'circle'> | undefined;
|
|
216
|
+
|
|
217
|
+
export function getCircleGeometryFactory(): VectorGeometryFactory<'circle'> {
|
|
218
|
+
if (!geometryFactory) {
|
|
219
|
+
geometryFactory = {
|
|
220
|
+
type: 'circle',
|
|
221
|
+
getGeometryOptions,
|
|
222
|
+
createSolidGeometries,
|
|
223
|
+
createOutlineGeometries,
|
|
224
|
+
createFillGeometries,
|
|
225
|
+
createGroundLineGeometries,
|
|
226
|
+
createLineGeometries,
|
|
227
|
+
validateGeometry: validateCircle,
|
|
228
|
+
};
|
|
205
229
|
}
|
|
206
|
-
|
|
207
|
-
const validGeometries = geometries.filter((circle) => validateCircle(circle));
|
|
208
|
-
addPrimitivesToContext(
|
|
209
|
-
feature,
|
|
210
|
-
style,
|
|
211
|
-
validGeometries,
|
|
212
|
-
vectorProperties,
|
|
213
|
-
scene,
|
|
214
|
-
circleGeometryFactory,
|
|
215
|
-
context,
|
|
216
|
-
);
|
|
230
|
+
return geometryFactory;
|
|
217
231
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Cartesian3,
|
|
3
|
+
Cartographic,
|
|
4
|
+
HeightReference,
|
|
5
|
+
Matrix4,
|
|
6
|
+
Model,
|
|
7
|
+
Primitive,
|
|
8
|
+
Scene,
|
|
9
|
+
} from '@vcmap-cesium/engine';
|
|
10
|
+
import { mercatorToCartographic } from '../math.js';
|
|
11
|
+
|
|
12
|
+
const scratchUpdateHeightCartesian = new Cartesian3();
|
|
13
|
+
|
|
14
|
+
function getUpdateHeightCallback(
|
|
15
|
+
primitive: Primitive | Model,
|
|
16
|
+
originalPosition: Cartesian3,
|
|
17
|
+
): (cartographic: Cartographic) => void {
|
|
18
|
+
return function updatePrimitiveHeight(clampedPosition: Cartographic) {
|
|
19
|
+
Cartographic.toCartesian(
|
|
20
|
+
clampedPosition,
|
|
21
|
+
undefined,
|
|
22
|
+
scratchUpdateHeightCartesian,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
Cartesian3.subtract(
|
|
26
|
+
scratchUpdateHeightCartesian,
|
|
27
|
+
originalPosition,
|
|
28
|
+
scratchUpdateHeightCartesian,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const { modelMatrix } = primitive;
|
|
32
|
+
primitive.modelMatrix = Matrix4.setTranslation(
|
|
33
|
+
modelMatrix,
|
|
34
|
+
scratchUpdateHeightCartesian,
|
|
35
|
+
new Matrix4(),
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
41
|
+
export function setupClampedPrimitive(
|
|
42
|
+
scene: Scene,
|
|
43
|
+
primitive: Primitive | Model,
|
|
44
|
+
origin: [number, number],
|
|
45
|
+
heightReference: HeightReference,
|
|
46
|
+
): void {
|
|
47
|
+
const destroy = primitive.destroy.bind(primitive);
|
|
48
|
+
const originCartographic = mercatorToCartographic(origin);
|
|
49
|
+
const callback = getUpdateHeightCallback(
|
|
50
|
+
primitive,
|
|
51
|
+
Cartographic.toCartesian(originCartographic),
|
|
52
|
+
);
|
|
53
|
+
const callbackHandler = scene.updateHeight(
|
|
54
|
+
originCartographic,
|
|
55
|
+
callback,
|
|
56
|
+
heightReference,
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const height = scene.getHeight(originCartographic, heightReference);
|
|
60
|
+
if (height) {
|
|
61
|
+
const updatedHeightCarto = originCartographic.clone();
|
|
62
|
+
updatedHeightCarto.height = height;
|
|
63
|
+
callback(updatedHeightCarto);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
primitive.destroy = (): void => {
|
|
67
|
+
callbackHandler();
|
|
68
|
+
destroy();
|
|
69
|
+
};
|
|
70
|
+
}
|