@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,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Cartesian3,
|
|
3
2
|
WallGeometry,
|
|
4
3
|
WallOutlineGeometry,
|
|
5
4
|
GroundPolylineGeometry,
|
|
@@ -7,7 +6,7 @@ import {
|
|
|
7
6
|
Math as CesiumMath,
|
|
8
7
|
HeightReference,
|
|
9
8
|
type Scene,
|
|
10
|
-
|
|
9
|
+
Cartesian3,
|
|
11
10
|
} from '@vcmap-cesium/engine';
|
|
12
11
|
import { Feature } from 'ol';
|
|
13
12
|
import { type LineString, Point } from 'ol/geom.js';
|
|
@@ -15,15 +14,23 @@ import type { Coordinate } from 'ol/coordinate.js';
|
|
|
15
14
|
import type { Style } from 'ol/style.js';
|
|
16
15
|
|
|
17
16
|
import { parseNumber } from '@vcsuite/parsers';
|
|
18
|
-
import Projection from '../projection.js';
|
|
19
|
-
import { addPrimitivesToContext } from './featureconverterHelper.js';
|
|
20
|
-
import { getFlatCoordinatesFromSimpleGeometry } from '../geometryHelpers.js';
|
|
21
17
|
import ArrowStyle, { ArrowEnd } from '../../style/arrowStyle.js';
|
|
22
18
|
import { getCartesianBearing, getCartesianPitch } from '../math.js';
|
|
23
19
|
import { getPrimitiveOptions } from './pointHelpers.js';
|
|
24
20
|
import type VectorProperties from '../../layer/vectorProperties.js';
|
|
25
|
-
import
|
|
26
|
-
import
|
|
21
|
+
import { getWgs84CoordinatesForPoint } from './pointToCesium.js';
|
|
22
|
+
import { ConvertedItem } from './convert.js';
|
|
23
|
+
import {
|
|
24
|
+
getHeightInfo,
|
|
25
|
+
VectorHeightInfo,
|
|
26
|
+
mercatorToCartesianTransformerForHeightInfo,
|
|
27
|
+
isAbsoluteHeightReference,
|
|
28
|
+
} from './vectorHeightInfo.js';
|
|
29
|
+
import {
|
|
30
|
+
CesiumGeometryOption,
|
|
31
|
+
PolylineGeometryOptions,
|
|
32
|
+
VectorGeometryFactory,
|
|
33
|
+
} from './vectorGeometryFactory.js';
|
|
27
34
|
|
|
28
35
|
type ArrowOptions = {
|
|
29
36
|
location: Coordinate;
|
|
@@ -36,8 +43,9 @@ function getArrowOptions(
|
|
|
36
43
|
to: Coordinate,
|
|
37
44
|
heightReference: HeightReference,
|
|
38
45
|
): ArrowOptions {
|
|
39
|
-
let pitch =
|
|
40
|
-
|
|
46
|
+
let pitch = isAbsoluteHeightReference(heightReference)
|
|
47
|
+
? getCartesianPitch(to, from)
|
|
48
|
+
: 0;
|
|
41
49
|
pitch += 90;
|
|
42
50
|
return {
|
|
43
51
|
location: to,
|
|
@@ -48,208 +56,179 @@ function getArrowOptions(
|
|
|
48
56
|
};
|
|
49
57
|
}
|
|
50
58
|
|
|
51
|
-
export
|
|
59
|
+
export function getArrowHeadPrimitives(
|
|
52
60
|
feature: Feature,
|
|
53
61
|
style: ArrowStyle,
|
|
54
|
-
|
|
62
|
+
geometry: LineString,
|
|
55
63
|
vectorProperties: VectorProperties,
|
|
56
64
|
scene: Scene,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
): Promise<void> {
|
|
65
|
+
inputCoordinates?: Coordinate[],
|
|
66
|
+
): ConvertedItem<'primitive'>[] {
|
|
60
67
|
if (style.end === ArrowEnd.NONE || !style.primitiveOptions?.geometryOptions) {
|
|
61
|
-
return;
|
|
68
|
+
return [];
|
|
62
69
|
}
|
|
63
70
|
const arrowOptions: ArrowOptions[] = [];
|
|
64
71
|
const heightReference = vectorProperties.getAltitudeMode(feature);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
+
const coordinates = inputCoordinates ?? geometry.getCoordinates();
|
|
73
|
+
if (style.end === ArrowEnd.START || style.end === ArrowEnd.BOTH) {
|
|
74
|
+
arrowOptions.push(
|
|
75
|
+
getArrowOptions(coordinates[1], coordinates[0], heightReference),
|
|
76
|
+
);
|
|
77
|
+
}
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
});
|
|
79
|
+
if (style.end === ArrowEnd.END || style.end === ArrowEnd.BOTH) {
|
|
80
|
+
arrowOptions.push(
|
|
81
|
+
getArrowOptions(
|
|
82
|
+
coordinates.at(-2)!,
|
|
83
|
+
coordinates.at(-1)!,
|
|
84
|
+
heightReference,
|
|
85
|
+
),
|
|
86
|
+
);
|
|
87
|
+
}
|
|
83
88
|
|
|
84
89
|
if (arrowOptions.length === 0) {
|
|
85
|
-
return;
|
|
90
|
+
return [];
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
const usedStyle = style.getOlcsStyle();
|
|
89
|
-
const allowPicking = vectorProperties.getAllowPicking(feature);
|
|
90
94
|
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
return arrowOptions
|
|
96
|
+
.map((arrowOption): ConvertedItem<'primitive'>[] => {
|
|
97
|
+
const arrowHeadGeometry = new Point(arrowOption.location);
|
|
93
98
|
const arrowFeature = new Feature({
|
|
94
99
|
...feature.getProperties(),
|
|
95
100
|
olcs_primitiveOptions: style.primitiveOptions,
|
|
96
101
|
olcs_modelHeading: arrowOption.heading,
|
|
97
102
|
olcs_modelPitch: arrowOption.pitch,
|
|
98
|
-
geometry:
|
|
103
|
+
geometry: arrowHeadGeometry,
|
|
99
104
|
olcs_modelAutoScale: true,
|
|
100
105
|
});
|
|
101
106
|
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
const heightInfo = getHeightInfo(
|
|
108
|
+
arrowFeature,
|
|
109
|
+
arrowHeadGeometry,
|
|
110
|
+
vectorProperties,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const wgs84Coords = getWgs84CoordinatesForPoint(
|
|
114
|
+
arrowHeadGeometry,
|
|
115
|
+
heightInfo,
|
|
116
|
+
);
|
|
117
|
+
const position = Cartesian3.fromDegrees(
|
|
118
|
+
wgs84Coords[0],
|
|
119
|
+
wgs84Coords[1],
|
|
120
|
+
wgs84Coords[2],
|
|
107
121
|
);
|
|
108
|
-
|
|
122
|
+
|
|
123
|
+
return getPrimitiveOptions(
|
|
109
124
|
arrowFeature,
|
|
110
125
|
usedStyle,
|
|
111
|
-
|
|
112
|
-
|
|
126
|
+
position,
|
|
127
|
+
wgs84Coords,
|
|
113
128
|
vectorProperties,
|
|
114
129
|
scene,
|
|
130
|
+
heightInfo,
|
|
115
131
|
);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
context.addScaledPrimitives(
|
|
119
|
-
primitiveOptions.primitives,
|
|
120
|
-
feature,
|
|
121
|
-
allowPicking,
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
}),
|
|
125
|
-
);
|
|
132
|
+
})
|
|
133
|
+
.flat();
|
|
126
134
|
}
|
|
127
135
|
|
|
128
|
-
export type LineGeometryOptions = { positions: Cartesian3[] };
|
|
129
|
-
|
|
130
136
|
export function createSolidGeometries(
|
|
131
|
-
options:
|
|
137
|
+
options: PolylineGeometryOptions,
|
|
138
|
+
heightInfo: VectorHeightInfo,
|
|
132
139
|
height: number,
|
|
133
140
|
perPositionHeight: boolean,
|
|
134
141
|
extrudedHeight?: number,
|
|
135
|
-
):
|
|
142
|
+
): CesiumGeometryOption<'solid'>[] {
|
|
136
143
|
return [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
{
|
|
145
|
+
type: 'solid',
|
|
146
|
+
geometry: WallGeometry.fromConstantHeights({
|
|
147
|
+
...options,
|
|
148
|
+
maximumHeight: !perPositionHeight ? height : undefined,
|
|
149
|
+
minimumHeight: extrudedHeight,
|
|
150
|
+
}),
|
|
151
|
+
heightInfo,
|
|
152
|
+
},
|
|
142
153
|
];
|
|
143
154
|
}
|
|
144
155
|
|
|
145
156
|
export function createOutlineGeometries(
|
|
146
|
-
options:
|
|
157
|
+
options: PolylineGeometryOptions,
|
|
158
|
+
heightInfo: VectorHeightInfo,
|
|
147
159
|
height: number,
|
|
148
160
|
perPositionHeight: boolean,
|
|
149
161
|
extrudedHeight?: number,
|
|
150
|
-
):
|
|
162
|
+
): CesiumGeometryOption<'outline'>[] {
|
|
151
163
|
// maxium and minimum are flipped, to create the same perPositionHeight behaviour as in polygons
|
|
152
164
|
// WallGeometries extrudes down instead of up, so we switch the behaviour and extrude in the other direction
|
|
153
165
|
return [
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
166
|
+
{
|
|
167
|
+
type: 'outline',
|
|
168
|
+
geometry: WallOutlineGeometry.fromConstantHeights({
|
|
169
|
+
...options,
|
|
170
|
+
maximumHeight: !perPositionHeight ? height : undefined,
|
|
171
|
+
minimumHeight: extrudedHeight,
|
|
172
|
+
}),
|
|
173
|
+
heightInfo,
|
|
174
|
+
},
|
|
159
175
|
];
|
|
160
176
|
}
|
|
161
177
|
|
|
162
|
-
export function createFillGeometries(
|
|
163
|
-
_options: LineGeometryOptions,
|
|
164
|
-
_height: number,
|
|
165
|
-
_perPositionHeight: boolean,
|
|
166
|
-
): PolygonGeometry[] {
|
|
167
|
-
return [];
|
|
168
|
-
}
|
|
169
|
-
|
|
170
178
|
export function createGroundLineGeometries(
|
|
171
|
-
options:
|
|
179
|
+
options: PolylineGeometryOptions,
|
|
180
|
+
heightInfo: VectorHeightInfo,
|
|
172
181
|
style: Style,
|
|
173
|
-
):
|
|
182
|
+
): CesiumGeometryOption<'groundLine'>[] {
|
|
174
183
|
const width = parseNumber(style.getStroke()!.getWidth(), 1.0);
|
|
175
184
|
return [
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
185
|
+
{
|
|
186
|
+
type: 'groundLine',
|
|
187
|
+
geometry: new GroundPolylineGeometry({
|
|
188
|
+
...options,
|
|
189
|
+
width,
|
|
190
|
+
}),
|
|
191
|
+
heightInfo,
|
|
192
|
+
},
|
|
180
193
|
];
|
|
181
194
|
}
|
|
182
195
|
|
|
183
196
|
export function createLineGeometries(
|
|
184
|
-
options:
|
|
197
|
+
options: PolylineGeometryOptions,
|
|
198
|
+
heightInfo: VectorHeightInfo,
|
|
185
199
|
style: Style,
|
|
186
|
-
):
|
|
200
|
+
): CesiumGeometryOption<'line'>[] {
|
|
187
201
|
const width = parseNumber(style.getStroke()!.getWidth(), 1.0);
|
|
188
202
|
|
|
189
203
|
return [
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
204
|
+
{
|
|
205
|
+
type: 'line',
|
|
206
|
+
geometry: new PolylineGeometry({
|
|
207
|
+
...options,
|
|
208
|
+
width,
|
|
209
|
+
}),
|
|
210
|
+
heightInfo,
|
|
211
|
+
},
|
|
194
212
|
];
|
|
195
213
|
}
|
|
196
214
|
|
|
197
215
|
/**
|
|
198
216
|
* Creates the positions array for PolylineGeometry
|
|
199
217
|
* @param geometry
|
|
200
|
-
* @param
|
|
201
|
-
* @param perPositionHeight
|
|
202
|
-
* @param groundLevelOrMinHeight
|
|
218
|
+
* @param heightInfo
|
|
203
219
|
* @private
|
|
204
220
|
*/
|
|
205
221
|
export function getGeometryOptions(
|
|
206
222
|
geometry: LineString,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
groundLevelOrMinHeight: number,
|
|
210
|
-
): LineGeometryOptions {
|
|
223
|
+
heightInfo: VectorHeightInfo,
|
|
224
|
+
): PolylineGeometryOptions {
|
|
211
225
|
const coords = geometry.getCoordinates();
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
wgs84Coords[2] = groundLevelOrMinHeight;
|
|
216
|
-
} else if (wgs84Coords[2] != null) {
|
|
217
|
-
wgs84Coords[2] += positionHeightAdjustment;
|
|
218
|
-
}
|
|
219
|
-
return Cartesian3.fromDegrees(
|
|
220
|
-
wgs84Coords[0],
|
|
221
|
-
wgs84Coords[1],
|
|
222
|
-
wgs84Coords[2],
|
|
223
|
-
);
|
|
224
|
-
});
|
|
226
|
+
const coordinateTransformer =
|
|
227
|
+
mercatorToCartesianTransformerForHeightInfo(heightInfo);
|
|
228
|
+
const positions = coords.map(coordinateTransformer);
|
|
225
229
|
return { positions };
|
|
226
230
|
}
|
|
227
231
|
|
|
228
|
-
export function getCoordinates(geometries: LineString[]): Coordinate[] {
|
|
229
|
-
const coordinates: Coordinate[] = [];
|
|
230
|
-
geometries.forEach((lineString) => {
|
|
231
|
-
coordinates.push(...getFlatCoordinatesFromSimpleGeometry(lineString));
|
|
232
|
-
});
|
|
233
|
-
return coordinates;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
let geometryFactory: VectorGeometryFactoryType | null = null;
|
|
237
|
-
|
|
238
|
-
function getGeometryFactory(): VectorGeometryFactoryType {
|
|
239
|
-
if (!geometryFactory) {
|
|
240
|
-
geometryFactory = {
|
|
241
|
-
getCoordinates,
|
|
242
|
-
getGeometryOptions,
|
|
243
|
-
createSolidGeometries,
|
|
244
|
-
createOutlineGeometries,
|
|
245
|
-
createFillGeometries,
|
|
246
|
-
createGroundLineGeometries,
|
|
247
|
-
createLineGeometries,
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
return geometryFactory;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
232
|
/**
|
|
254
233
|
* validates if a lineString is renderable
|
|
255
234
|
* @param lineString
|
|
@@ -266,48 +245,22 @@ export function validateLineString(lineString: LineString): boolean {
|
|
|
266
245
|
return false;
|
|
267
246
|
}
|
|
268
247
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
): Promise<void> {
|
|
286
|
-
if (!style.getFill() && !style.getStroke()) {
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
const lineGeometryFactory = getGeometryFactory();
|
|
290
|
-
const validGeometries = geometries.filter((lineString) =>
|
|
291
|
-
validateLineString(lineString),
|
|
292
|
-
);
|
|
293
|
-
addPrimitivesToContext(
|
|
294
|
-
feature,
|
|
295
|
-
style,
|
|
296
|
-
validGeometries,
|
|
297
|
-
vectorProperties,
|
|
298
|
-
scene,
|
|
299
|
-
lineGeometryFactory,
|
|
300
|
-
context,
|
|
301
|
-
);
|
|
302
|
-
if (style instanceof ArrowStyle) {
|
|
303
|
-
await addArrowsToContext(
|
|
304
|
-
feature,
|
|
305
|
-
style,
|
|
306
|
-
validGeometries,
|
|
307
|
-
vectorProperties,
|
|
308
|
-
scene,
|
|
309
|
-
lineGeometryFactory,
|
|
310
|
-
context,
|
|
311
|
-
);
|
|
248
|
+
let geometryFactory: VectorGeometryFactory<'lineString'> | undefined;
|
|
249
|
+
|
|
250
|
+
export function getLineStringGeometryFactory(): VectorGeometryFactory<'lineString'> {
|
|
251
|
+
if (!geometryFactory) {
|
|
252
|
+
geometryFactory = {
|
|
253
|
+
type: 'lineString',
|
|
254
|
+
getGeometryOptions,
|
|
255
|
+
createSolidGeometries,
|
|
256
|
+
createOutlineGeometries,
|
|
257
|
+
createFillGeometries(): never[] {
|
|
258
|
+
return [];
|
|
259
|
+
},
|
|
260
|
+
createGroundLineGeometries,
|
|
261
|
+
createLineGeometries,
|
|
262
|
+
validateGeometry: validateLineString,
|
|
263
|
+
};
|
|
312
264
|
}
|
|
265
|
+
return geometryFactory;
|
|
313
266
|
}
|