@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,60 +1,33 @@
|
|
|
1
|
-
import { ArcType,
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { createFillGeometries, createGroundLineGeometries, createLineGeometries, createOutlineGeometries, createSolidGeometries, validateLineString, getCoordinates as getLineStringCoordinates, getGeometryOptions as getLineStringGeometryOptions, addArrowsToContext, } from './lineStringToCesium.js';
|
|
5
|
-
import { featureArcStruct } from '../../style/arcStyle.js';
|
|
1
|
+
import { ArcType, HeightReference } from '@vcmap-cesium/engine';
|
|
2
|
+
import { createGroundLineGeometries, createLineGeometries, createOutlineGeometries, createSolidGeometries, validateLineString, getGeometryOptions as getLineStringGeometryOptions, } from './lineStringToCesium.js';
|
|
3
|
+
import { mercatorToCartesianTransformerForHeightInfo, } from './vectorHeightInfo.js';
|
|
6
4
|
/**
|
|
7
5
|
* Creates the positions & arcType option for the PolylineGeometry
|
|
8
6
|
*/
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
if (!perPositionHeight && groundLevelOrMinHeight) {
|
|
13
|
-
wgs84Coords[2] = groundLevelOrMinHeight;
|
|
14
|
-
}
|
|
15
|
-
else if (wgs84Coords[2] != null) {
|
|
16
|
-
wgs84Coords[2] += positionHeightAdjustment;
|
|
17
|
-
}
|
|
18
|
-
return Cartesian3.fromDegrees(wgs84Coords[0], wgs84Coords[1], wgs84Coords[2]);
|
|
19
|
-
});
|
|
7
|
+
function getGeometryOptions(coords, _geometry, heightInfo) {
|
|
8
|
+
const coordinateTransformer = mercatorToCartesianTransformerForHeightInfo(heightInfo);
|
|
9
|
+
const positions = coords.map(coordinateTransformer);
|
|
20
10
|
return { positions, arcType: ArcType.NONE };
|
|
21
11
|
}
|
|
22
12
|
/**
|
|
23
|
-
*
|
|
13
|
+
* @param arcCoords - the coordinates of the arc to use instead of the geometries coordinates if height mode is absolute
|
|
14
|
+
* @param altitudeMode
|
|
24
15
|
*/
|
|
25
|
-
// eslint-disable-next-line
|
|
26
|
-
export function
|
|
27
|
-
return coords;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @param arcCoords - the coordinates of the arc to use instead of the geometries coordinates if height mode is absolute
|
|
31
|
-
*/
|
|
32
|
-
function getGeometryFactory(arcCoords, altitudeMode) {
|
|
16
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
17
|
+
export function getArcGeometryFactory(arcCoords, altitudeMode) {
|
|
33
18
|
return {
|
|
34
|
-
|
|
35
|
-
? getCoordinates.bind(null, arcCoords)
|
|
36
|
-
: getLineStringCoordinates,
|
|
19
|
+
type: 'arc',
|
|
37
20
|
getGeometryOptions: altitudeMode === HeightReference.NONE
|
|
38
21
|
? getGeometryOptions.bind(null, arcCoords)
|
|
39
22
|
: getLineStringGeometryOptions,
|
|
40
23
|
createSolidGeometries,
|
|
41
24
|
createOutlineGeometries,
|
|
42
|
-
createFillGeometries
|
|
25
|
+
createFillGeometries() {
|
|
26
|
+
return [];
|
|
27
|
+
},
|
|
43
28
|
createGroundLineGeometries,
|
|
44
29
|
createLineGeometries,
|
|
30
|
+
validateGeometry: validateLineString,
|
|
45
31
|
};
|
|
46
32
|
}
|
|
47
|
-
/**
|
|
48
|
-
* converts a linestring with an ArcStyle to a a cesium primitive
|
|
49
|
-
*/
|
|
50
|
-
export default async function arcToCesium(feature, style, geometries, vectorProperties, scene, context) {
|
|
51
|
-
if (!style.getFill() && !style.getStroke()) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const altitudeMode = vectorProperties.getAltitudeMode(feature);
|
|
55
|
-
const arcGeometryFactory = getGeometryFactory(feature[featureArcStruct].coordinates, altitudeMode);
|
|
56
|
-
const validGeometries = geometries.filter((lineString) => validateLineString(lineString));
|
|
57
|
-
addPrimitivesToContext(feature, style, validGeometries, vectorProperties, scene, arcGeometryFactory, context);
|
|
58
|
-
await addArrowsToContext(feature, style, validGeometries, vectorProperties, scene, arcGeometryFactory, context); // IDEA what about labels?
|
|
59
|
-
}
|
|
60
33
|
//# sourceMappingURL=arcToCesium.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcToCesium.js","sourceRoot":"","sources":["../../../../src/util/featureconverter/arcToCesium.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"arcToCesium.js","sourceRoot":"","sources":["../../../../src/util/featureconverter/arcToCesium.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIhE,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,IAAI,4BAA4B,GACnD,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,2CAA2C,GAE5C,MAAM,uBAAuB,CAAC;AAM/B;;GAEG;AACH,SAAS,kBAAkB,CACzB,MAAoB,EACpB,SAAqB,EACrB,UAA4B;IAE5B,MAAM,qBAAqB,GACzB,2CAA2C,CAAC,UAAU,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACpD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,wDAAwD;AACxD,MAAM,UAAU,qBAAqB,CACnC,SAAuB,EACvB,YAA6B;IAE7B,OAAO;QACL,IAAI,EAAE,KAAK;QACX,kBAAkB,EAChB,YAAY,KAAK,eAAe,CAAC,IAAI;YACnC,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC;YAC1C,CAAC,CAAC,4BAA4B;QAClC,qBAAqB;QACrB,uBAAuB;QACvB,oBAAoB;YAClB,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,0BAA0B;QAC1B,oBAAoB;QACpB,gBAAgB,EAAE,kBAAkB;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
import type { Style } from 'ol/style.js';
|
|
2
1
|
import type { Circle } from 'ol/geom.js';
|
|
3
|
-
import
|
|
4
|
-
import type { Feature } from 'ol/index.js';
|
|
5
|
-
import { Cartesian3, CircleGeometry, GroundPolylineGeometry, CircleOutlineGeometry, PolylineGeometry, type Scene } from '@vcmap-cesium/engine';
|
|
6
|
-
import type VectorProperties from '../../layer/vectorProperties.js';
|
|
7
|
-
import type { AsyncCesiumVectorContext } from '../../layer/cesium/vectorContext.js';
|
|
8
|
-
export declare function createSolidGeometries(options: ConstructorParameters<typeof CircleGeometry>[0], height: number, _perPositionHeight: boolean, extrudedHeight?: number): CircleGeometry[];
|
|
9
|
-
export declare function createOutlineGeometries(options: ConstructorParameters<typeof CircleGeometry>[0], height: number, _perPositionHeight: boolean, extrudedHeight?: number): CircleOutlineGeometry[];
|
|
10
|
-
export declare function createFillGeometries(options: ConstructorParameters<typeof CircleGeometry>[0], height: number, perPositionHeight: boolean): CircleGeometry[];
|
|
11
|
-
export declare function getLineGeometryOptions(options: ConstructorParameters<typeof CircleGeometry>[0], style: Style): {
|
|
12
|
-
width: number;
|
|
13
|
-
positions: Cartesian3[];
|
|
14
|
-
};
|
|
15
|
-
export declare function createGroundLineGeometries(options: ConstructorParameters<typeof CircleGeometry>[0], style: Style): GroundPolylineGeometry[];
|
|
16
|
-
export declare function createLineGeometries(options: ConstructorParameters<typeof CircleGeometry>[0], style: Style): PolylineGeometry[];
|
|
17
|
-
/**
|
|
18
|
-
* extracts the center and radius from the CircleGeometry and converts it to Cartesian3/radius in m
|
|
19
|
-
* @param geometry
|
|
20
|
-
* @param positionHeightAdjustment
|
|
21
|
-
* @param perPositionHeight
|
|
22
|
-
* @param groundLevelOrMinHeight
|
|
23
|
-
* @returns
|
|
24
|
-
* @private
|
|
25
|
-
*/
|
|
26
|
-
export declare function getGeometryOptions(geometry: Circle, positionHeightAdjustment: number, perPositionHeight: boolean, groundLevelOrMinHeight: number): ConstructorParameters<typeof CircleGeometry>[0];
|
|
27
|
-
export declare function getCoordinates(geometries: Circle[]): Coordinate[];
|
|
2
|
+
import { VectorGeometryFactory } from './vectorGeometryFactory.js';
|
|
28
3
|
/**
|
|
29
4
|
* validates if a point is renderable
|
|
30
5
|
*/
|
|
31
6
|
export declare function validateCircle(circle: Circle): boolean;
|
|
32
|
-
export
|
|
7
|
+
export declare function getCircleGeometryFactory(): VectorGeometryFactory<'circle'>;
|
|
@@ -1,32 +1,62 @@
|
|
|
1
1
|
import { circular } from 'ol/geom/Polygon.js';
|
|
2
2
|
import { Cartesian3, CircleGeometry, GroundPolylineGeometry, CircleOutlineGeometry, Math as CesiumMath, Cartographic, PolylineGeometry, } from '@vcmap-cesium/engine';
|
|
3
3
|
import { parseNumber } from '@vcsuite/parsers';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { mercatorToCartesianTransformerForHeightInfo, } from './vectorHeightInfo.js';
|
|
5
|
+
function createCircleGeometry(options, height, perPositionHeight, extrudedHeight) {
|
|
6
|
+
const geometryOptions = {
|
|
7
|
+
...options,
|
|
8
|
+
granularity: 0.02,
|
|
9
|
+
extrudedHeight,
|
|
10
|
+
};
|
|
11
|
+
if (!perPositionHeight) {
|
|
12
|
+
geometryOptions.height = height;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
const cartographic = Cartographic.fromCartesian(options.center);
|
|
16
|
+
geometryOptions.height = cartographic.height;
|
|
17
|
+
}
|
|
18
|
+
return new CircleGeometry(geometryOptions);
|
|
19
|
+
}
|
|
20
|
+
function createSolidGeometries(options, heightInfo, height, perPositionHeight, extrudedHeight) {
|
|
7
21
|
return [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
height,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}),
|
|
22
|
+
{
|
|
23
|
+
type: 'solid',
|
|
24
|
+
geometry: createCircleGeometry(options, height, perPositionHeight, extrudedHeight),
|
|
25
|
+
heightInfo,
|
|
26
|
+
},
|
|
14
27
|
];
|
|
15
28
|
}
|
|
16
|
-
|
|
29
|
+
function createOutlineGeometries(options, heightInfo, height, perPositionHeight, extrudedHeight) {
|
|
30
|
+
const geometryOptions = {
|
|
31
|
+
...options,
|
|
32
|
+
granularity: 0.02,
|
|
33
|
+
extrudedHeight,
|
|
34
|
+
};
|
|
35
|
+
if (!perPositionHeight) {
|
|
36
|
+
geometryOptions.height = height;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const cartographic = Cartographic.fromCartesian(options.center);
|
|
40
|
+
geometryOptions.height = cartographic.height;
|
|
41
|
+
}
|
|
17
42
|
return [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}),
|
|
43
|
+
{
|
|
44
|
+
type: 'outline',
|
|
45
|
+
geometry: new CircleOutlineGeometry(geometryOptions),
|
|
46
|
+
heightInfo,
|
|
47
|
+
},
|
|
24
48
|
];
|
|
25
49
|
}
|
|
26
|
-
|
|
27
|
-
return
|
|
50
|
+
function createFillGeometries(options, heightInfo, height, perPositionHeight) {
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
type: 'fill',
|
|
54
|
+
geometry: createCircleGeometry(options, height, perPositionHeight),
|
|
55
|
+
heightInfo,
|
|
56
|
+
},
|
|
57
|
+
];
|
|
28
58
|
}
|
|
29
|
-
|
|
59
|
+
function getLineGeometryOptions(options, style) {
|
|
30
60
|
const width = parseNumber(style.getStroke()?.getWidth(), 1.0);
|
|
31
61
|
const { center, radius } = options;
|
|
32
62
|
const cartographic = Cartographic.fromCartesian(center);
|
|
@@ -45,39 +75,42 @@ export function getLineGeometryOptions(options, style) {
|
|
|
45
75
|
width,
|
|
46
76
|
};
|
|
47
77
|
}
|
|
48
|
-
|
|
78
|
+
function createGroundLineGeometries(options, heightInfo, style) {
|
|
49
79
|
const lineOptions = getLineGeometryOptions(options, style);
|
|
50
|
-
return [
|
|
80
|
+
return [
|
|
81
|
+
{
|
|
82
|
+
type: 'groundLine',
|
|
83
|
+
geometry: new GroundPolylineGeometry(lineOptions),
|
|
84
|
+
heightInfo,
|
|
85
|
+
},
|
|
86
|
+
];
|
|
51
87
|
}
|
|
52
|
-
|
|
88
|
+
function createLineGeometries(options, heightInfo, style) {
|
|
53
89
|
const lineOptions = getLineGeometryOptions(options, style);
|
|
54
|
-
return [
|
|
90
|
+
return [
|
|
91
|
+
{
|
|
92
|
+
type: 'line',
|
|
93
|
+
geometry: new PolylineGeometry(lineOptions),
|
|
94
|
+
heightInfo,
|
|
95
|
+
},
|
|
96
|
+
];
|
|
55
97
|
}
|
|
56
98
|
/**
|
|
57
99
|
* extracts the center and radius from the CircleGeometry and converts it to Cartesian3/radius in m
|
|
58
100
|
* @param geometry
|
|
59
|
-
* @param
|
|
60
|
-
* @param perPositionHeight
|
|
61
|
-
* @param groundLevelOrMinHeight
|
|
101
|
+
* @param heightInfo
|
|
62
102
|
* @returns
|
|
63
103
|
* @private
|
|
64
104
|
*/
|
|
65
|
-
|
|
105
|
+
function getGeometryOptions(geometry, heightInfo) {
|
|
66
106
|
// olCoordinates of center and radius in WGS84
|
|
67
107
|
const olCenter = geometry.getCenter();
|
|
68
108
|
const olPoint = olCenter.slice();
|
|
69
109
|
olPoint[0] += geometry.getRadius();
|
|
70
|
-
const
|
|
71
|
-
if (!perPositionHeight && groundLevelOrMinHeight) {
|
|
72
|
-
wgs84Center[2] = groundLevelOrMinHeight;
|
|
73
|
-
}
|
|
74
|
-
else if (wgs84Center[2] != null) {
|
|
75
|
-
wgs84Center[2] += positionHeightAdjustment;
|
|
76
|
-
}
|
|
77
|
-
const wgs84Point = Projection.mercatorToWgs84(olPoint, true);
|
|
110
|
+
const coordinateTransformer = mercatorToCartesianTransformerForHeightInfo(heightInfo);
|
|
78
111
|
// Cesium coordinates of center and radius
|
|
79
|
-
const center =
|
|
80
|
-
const point =
|
|
112
|
+
const center = coordinateTransformer(olCenter);
|
|
113
|
+
const point = coordinateTransformer(olPoint);
|
|
81
114
|
// Computation of radius in Cesium 3D
|
|
82
115
|
const radius = Cartesian3.distance(center, point);
|
|
83
116
|
return {
|
|
@@ -85,26 +118,6 @@ export function getGeometryOptions(geometry, positionHeightAdjustment, perPositi
|
|
|
85
118
|
center,
|
|
86
119
|
};
|
|
87
120
|
}
|
|
88
|
-
export function getCoordinates(geometries) {
|
|
89
|
-
return geometries.map((circle) => {
|
|
90
|
-
return circle.getCenter();
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
let geometryFactory = null;
|
|
94
|
-
function getGeometryFactory() {
|
|
95
|
-
if (!geometryFactory) {
|
|
96
|
-
geometryFactory = {
|
|
97
|
-
getCoordinates,
|
|
98
|
-
getGeometryOptions,
|
|
99
|
-
createSolidGeometries,
|
|
100
|
-
createOutlineGeometries,
|
|
101
|
-
createFillGeometries,
|
|
102
|
-
createGroundLineGeometries,
|
|
103
|
-
createLineGeometries,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return geometryFactory;
|
|
107
|
-
}
|
|
108
121
|
/**
|
|
109
122
|
* validates if a point is renderable
|
|
110
123
|
*/
|
|
@@ -122,12 +135,20 @@ export function validateCircle(circle) {
|
|
|
122
135
|
}
|
|
123
136
|
return false;
|
|
124
137
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
138
|
+
let geometryFactory;
|
|
139
|
+
export function getCircleGeometryFactory() {
|
|
140
|
+
if (!geometryFactory) {
|
|
141
|
+
geometryFactory = {
|
|
142
|
+
type: 'circle',
|
|
143
|
+
getGeometryOptions,
|
|
144
|
+
createSolidGeometries,
|
|
145
|
+
createOutlineGeometries,
|
|
146
|
+
createFillGeometries,
|
|
147
|
+
createGroundLineGeometries,
|
|
148
|
+
createLineGeometries,
|
|
149
|
+
validateGeometry: validateCircle,
|
|
150
|
+
};
|
|
128
151
|
}
|
|
129
|
-
|
|
130
|
-
const validGeometries = geometries.filter((circle) => validateCircle(circle));
|
|
131
|
-
addPrimitivesToContext(feature, style, validGeometries, vectorProperties, scene, circleGeometryFactory, context);
|
|
152
|
+
return geometryFactory;
|
|
132
153
|
}
|
|
133
154
|
//# sourceMappingURL=circleToCesium.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circleToCesium.js","sourceRoot":"","sources":["../../../../src/util/featureconverter/circleToCesium.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"circleToCesium.js","sourceRoot":"","sources":["../../../../src/util/featureconverter/circleToCesium.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EACL,UAAU,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,IAAI,IAAI,UAAU,EAClB,YAAY,EACZ,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,2CAA2C,GAE5C,MAAM,uBAAuB,CAAC;AAO/B,SAAS,oBAAoB,CAC3B,OAA8B,EAC9B,MAAc,EACd,iBAA0B,EAC1B,cAAuB;IAEvB,MAAM,eAAe,GAAG;QACtB,GAAG,OAAO;QACV,WAAW,EAAE,IAAI;QACjB,cAAc;KACf,CAAC;IAEF,IAAI,CAAC,iBAAiB,EAAE;QACtB,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;KACjC;SAAM;QACL,MAAM,YAAY,GAAG,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChE,eAAe,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;KAC9C;IAED,OAAO,IAAI,cAAc,CAAC,eAAe,CAA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,EAAE,QAAQ;YACd,kBAAkB;YAClB,qBAAqB;YACrB,uBAAuB;YACvB,oBAAoB;YACpB,0BAA0B;YAC1B,oBAAoB;YACpB,gBAAgB,EAAE,cAAc;SACjC,CAAC;KACH;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Cartesian3, Cartographic, Matrix4, } from '@vcmap-cesium/engine';
|
|
2
|
+
import { mercatorToCartographic } from '../math.js';
|
|
3
|
+
const scratchUpdateHeightCartesian = new Cartesian3();
|
|
4
|
+
function getUpdateHeightCallback(primitive, originalPosition) {
|
|
5
|
+
return function updatePrimitiveHeight(clampedPosition) {
|
|
6
|
+
Cartographic.toCartesian(clampedPosition, undefined, scratchUpdateHeightCartesian);
|
|
7
|
+
Cartesian3.subtract(scratchUpdateHeightCartesian, originalPosition, scratchUpdateHeightCartesian);
|
|
8
|
+
const { modelMatrix } = primitive;
|
|
9
|
+
primitive.modelMatrix = Matrix4.setTranslation(modelMatrix, scratchUpdateHeightCartesian, new Matrix4());
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
13
|
+
export function setupClampedPrimitive(scene, primitive, origin, heightReference) {
|
|
14
|
+
const destroy = primitive.destroy.bind(primitive);
|
|
15
|
+
const originCartographic = mercatorToCartographic(origin);
|
|
16
|
+
const callback = getUpdateHeightCallback(primitive, Cartographic.toCartesian(originCartographic));
|
|
17
|
+
const callbackHandler = scene.updateHeight(originCartographic, callback, heightReference);
|
|
18
|
+
const height = scene.getHeight(originCartographic, heightReference);
|
|
19
|
+
if (height) {
|
|
20
|
+
const updatedHeightCarto = originCartographic.clone();
|
|
21
|
+
updatedHeightCarto.height = height;
|
|
22
|
+
callback(updatedHeightCarto);
|
|
23
|
+
}
|
|
24
|
+
primitive.destroy = () => {
|
|
25
|
+
callbackHandler();
|
|
26
|
+
destroy();
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=clampedPrimitive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clampedPrimitive.js","sourceRoot":"","sources":["../../../../src/util/featureconverter/clampedPrimitive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,EAEZ,OAAO,GAIR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,4BAA4B,GAAG,IAAI,UAAU,EAAE,CAAC;AAEtD,SAAS,uBAAuB,CAC9B,SAA4B,EAC5B,gBAA4B;IAE5B,OAAO,SAAS,qBAAqB,CAAC,eAA6B;QACjE,YAAY,CAAC,WAAW,CACtB,eAAe,EACf,SAAS,EACT,4BAA4B,CAC7B,CAAC;QAEF,UAAU,CAAC,QAAQ,CACjB,4BAA4B,EAC5B,gBAAgB,EAChB,4BAA4B,CAC7B,CAAC;QAEF,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;QAClC,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,cAAc,CAC5C,WAAW,EACX,4BAA4B,EAC5B,IAAI,OAAO,EAAE,CACd,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,qBAAqB,CACnC,KAAY,EACZ,SAA4B,EAC5B,MAAwB,EACxB,eAAgC;IAEhC,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,uBAAuB,CACtC,SAAS,EACT,YAAY,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAC7C,CAAC;IACF,MAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CACxC,kBAAkB,EAClB,QAAQ,EACR,eAAe,CAChB,CAAC;IAEF,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;IACpE,IAAI,MAAM,EAAE;QACV,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,KAAK,EAAE,CAAC;QACtD,kBAAkB,CAAC,MAAM,GAAG,MAAM,CAAC;QACnC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;KAC9B;IAED,SAAS,CAAC,OAAO,GAAG,GAAS,EAAE;QAC7B,eAAe,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ClassificationPrimitive, GroundPolylinePrimitive, GroundPrimitive, Model, Primitive, Scene } from '@vcmap-cesium/engine';
|
|
2
2
|
import Style, { type StyleLike } from 'ol/style/Style.js';
|
|
3
3
|
import type { Feature } from 'ol/index.js';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { BillboardOptions, LabelOptions } from './pointToCesium.js';
|
|
5
|
+
import VectorProperties from '../../layer/vectorProperties.js';
|
|
6
|
+
export type PrimitiveType = Primitive | GroundPrimitive | GroundPolylinePrimitive | ClassificationPrimitive | Model;
|
|
7
|
+
export type ConvertedItemType = 'primitive' | 'billboard' | 'label';
|
|
8
|
+
export type ConvertedItem<T extends ConvertedItemType = ConvertedItemType> = T extends 'primitive' ? {
|
|
9
|
+
type: T;
|
|
10
|
+
item: PrimitiveType;
|
|
11
|
+
autoScale?: boolean;
|
|
12
|
+
} : T extends 'billboard' ? {
|
|
13
|
+
type: T;
|
|
14
|
+
item: BillboardOptions;
|
|
15
|
+
} : T extends 'label' ? {
|
|
16
|
+
type: T;
|
|
17
|
+
item: LabelOptions;
|
|
18
|
+
} : never;
|
|
6
19
|
export declare function getStylesArray(style: StyleLike, feature: Feature, resolution?: number): Style[];
|
|
7
20
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
21
|
+
* Converts a feature and all its associated geometries to items which can be added to
|
|
22
|
+
* cesium collections directly: Primitives, BillboardOptions or LabelOptions. This is
|
|
23
|
+
* an internal API, typically it is enough to simple use a `VectorLayer` to handle conversions for you.
|
|
24
|
+
* 1. All styles provided by the style like are flattened.
|
|
25
|
+
* 2. All single OL geometries which should be rendered with each style are extracted
|
|
26
|
+
* 3. Cesium geometry options are extracted from each OL geometry based on the geometry, feature & vector properties
|
|
27
|
+
* 4. Cesium geometries which can be batched into a single primitive (for instance, an extruded volume would have all its solids batched and all its outlines batched
|
|
28
|
+
* In case of relativeTo* altitude modes, primitives are batched based _on the clamp origin_
|
|
29
|
+
* 5. The converted items are returned, typically to the vector context which called convert in the first place.
|
|
10
30
|
* @param feature
|
|
11
31
|
* @param style
|
|
12
32
|
* @param vectorProperties
|
|
13
|
-
* @param context
|
|
14
33
|
* @param scene
|
|
15
34
|
*/
|
|
16
|
-
export default function convert(feature: Feature, style: StyleLike, vectorProperties: VectorProperties,
|
|
35
|
+
export default function convert(feature: Feature, style: StyleLike, vectorProperties: VectorProperties, scene: Scene): Promise<ConvertedItem[]>;
|