@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
package/src/layer/vectorLayer.ts
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import VectorSource from 'ol/source/Vector.js';
|
|
2
2
|
import Style, { type StyleFunction } from 'ol/style/Style.js';
|
|
3
3
|
import Feature from 'ol/Feature.js';
|
|
4
|
-
import type { SimpleGeometry } from 'ol/geom.js';
|
|
5
|
-
import type { Coordinate } from 'ol/coordinate.js';
|
|
6
|
-
import type {
|
|
7
|
-
CircleGeometry,
|
|
8
|
-
CircleOutlineGeometry,
|
|
9
|
-
GroundPolylineGeometry,
|
|
10
|
-
HeightReference,
|
|
11
|
-
PolygonGeometry,
|
|
12
|
-
PolygonOutlineGeometry,
|
|
13
|
-
PolylineGeometry,
|
|
14
|
-
WallGeometry,
|
|
15
|
-
WallOutlineGeometry,
|
|
16
|
-
} from '@vcmap-cesium/engine';
|
|
17
4
|
|
|
18
5
|
import { v4 as uuidv4 } from 'uuid';
|
|
19
6
|
import { check, oneOf } from '@vcsuite/check';
|
|
@@ -76,64 +63,6 @@ export type VectorOptions = FeatureLayerOptions & {
|
|
|
76
63
|
vectorProperties?: VectorPropertiesOptions;
|
|
77
64
|
};
|
|
78
65
|
|
|
79
|
-
export type VectorGeometryFactoryType = {
|
|
80
|
-
getCoordinates(geom: SimpleGeometry[]): Coordinate[];
|
|
81
|
-
getGeometryOptions(
|
|
82
|
-
geom: SimpleGeometry,
|
|
83
|
-
num: number,
|
|
84
|
-
perPositionHeight: boolean,
|
|
85
|
-
groundLevelOrMinHeight: number,
|
|
86
|
-
): unknown;
|
|
87
|
-
createSolidGeometries(
|
|
88
|
-
obj: unknown,
|
|
89
|
-
num: number,
|
|
90
|
-
bool: boolean,
|
|
91
|
-
num2?: number,
|
|
92
|
-
): (PolygonGeometry | CircleGeometry | WallGeometry)[];
|
|
93
|
-
createOutlineGeometries(
|
|
94
|
-
obj: unknown,
|
|
95
|
-
num: number,
|
|
96
|
-
bool: boolean,
|
|
97
|
-
num2?: number,
|
|
98
|
-
): (CircleOutlineGeometry | WallOutlineGeometry | PolygonOutlineGeometry)[];
|
|
99
|
-
createFillGeometries(
|
|
100
|
-
obj: unknown,
|
|
101
|
-
num: number,
|
|
102
|
-
bool: boolean,
|
|
103
|
-
): (CircleGeometry | PolygonGeometry)[];
|
|
104
|
-
createGroundLineGeometries(
|
|
105
|
-
obj: unknown,
|
|
106
|
-
style: Style,
|
|
107
|
-
): GroundPolylineGeometry[];
|
|
108
|
-
createLineGeometries(obj: unknown, style: Style): PolylineGeometry[];
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export type VectorHeightInfo = {
|
|
112
|
-
/**
|
|
113
|
-
* if the object is extruded
|
|
114
|
-
*/
|
|
115
|
-
extruded: boolean;
|
|
116
|
-
/**
|
|
117
|
-
* storey heights above ground, list has the same length as storeysAboveGround
|
|
118
|
-
*/
|
|
119
|
-
storeyHeightsAboveGround: number[];
|
|
120
|
-
/**
|
|
121
|
-
* storey heights below ground, list has the same length as storeysBelowGround
|
|
122
|
-
*/
|
|
123
|
-
storeyHeightsBelowGround: number[];
|
|
124
|
-
/**
|
|
125
|
-
* the level above or below mean sea level (minZ value or ground_level or 0)
|
|
126
|
-
*/
|
|
127
|
-
groundLevel: number;
|
|
128
|
-
/**
|
|
129
|
-
* a negative height to <i>push</i> the geometry visually into the ground
|
|
130
|
-
*/
|
|
131
|
-
skirt: number;
|
|
132
|
-
perPositionHeight: boolean;
|
|
133
|
-
heightReference: HeightReference;
|
|
134
|
-
heightAboveGroundAdjustment: number;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
66
|
export type VectorImplementationOptions = FeatureLayerImplementationOptions & {
|
|
138
67
|
source: VectorSource;
|
|
139
68
|
maxResolution?: number;
|
|
@@ -77,7 +77,11 @@ export function vectorPropertiesOfType<T extends PrimitiveOptionsType>(
|
|
|
77
77
|
export type AltitudeModeType =
|
|
78
78
|
| 'absolute'
|
|
79
79
|
| 'relativeToGround'
|
|
80
|
-
| '
|
|
80
|
+
| 'relativeToTerrain'
|
|
81
|
+
| 'relativeTo3DTiles'
|
|
82
|
+
| 'clampToGround'
|
|
83
|
+
| 'clampToTerrain'
|
|
84
|
+
| 'clampTo3DTiles';
|
|
81
85
|
|
|
82
86
|
export type ClassificationTypeType = 'both' | 'terrain' | 'cesium3DTile';
|
|
83
87
|
|
|
@@ -197,8 +201,12 @@ export const vcsMetaVersion = '2.1';
|
|
|
197
201
|
|
|
198
202
|
export const AltitudeModeCesium: Record<AltitudeModeType, HeightReference> = {
|
|
199
203
|
clampToGround: HeightReference.CLAMP_TO_GROUND,
|
|
204
|
+
clampTo3DTiles: HeightReference.CLAMP_TO_3D_TILE,
|
|
205
|
+
clampToTerrain: HeightReference.CLAMP_TO_TERRAIN,
|
|
200
206
|
absolute: HeightReference.NONE,
|
|
201
207
|
relativeToGround: HeightReference.RELATIVE_TO_GROUND,
|
|
208
|
+
relativeTo3DTiles: HeightReference.RELATIVE_TO_3D_TILE,
|
|
209
|
+
relativeToTerrain: HeightReference.RELATIVE_TO_TERRAIN,
|
|
202
210
|
};
|
|
203
211
|
|
|
204
212
|
export const ClassificationTypeCesium: Record<
|
|
@@ -318,7 +326,7 @@ class VectorProperties {
|
|
|
318
326
|
classificationType: undefined,
|
|
319
327
|
scaleByDistance: undefined,
|
|
320
328
|
eyeOffset: undefined,
|
|
321
|
-
heightAboveGround:
|
|
329
|
+
heightAboveGround: undefined,
|
|
322
330
|
skirt: 0,
|
|
323
331
|
groundLevel: undefined,
|
|
324
332
|
extrudedHeight: 0,
|
|
@@ -350,7 +358,7 @@ class VectorProperties {
|
|
|
350
358
|
|
|
351
359
|
private _eyeOffset: Cartesian3 | undefined;
|
|
352
360
|
|
|
353
|
-
private _heightAboveGround: number;
|
|
361
|
+
private _heightAboveGround: number | undefined;
|
|
354
362
|
|
|
355
363
|
private _skirt: number;
|
|
356
364
|
|
|
@@ -608,13 +616,13 @@ class VectorProperties {
|
|
|
608
616
|
return parseCartesian3(featureValue, this.eyeOffset);
|
|
609
617
|
}
|
|
610
618
|
|
|
611
|
-
get heightAboveGround(): number {
|
|
619
|
+
get heightAboveGround(): number | undefined {
|
|
612
620
|
return this._heightAboveGround;
|
|
613
621
|
}
|
|
614
622
|
|
|
615
|
-
set heightAboveGround(value: number) {
|
|
623
|
+
set heightAboveGround(value: number | undefined) {
|
|
616
624
|
if (value !== this._heightAboveGround) {
|
|
617
|
-
check(value, Number);
|
|
625
|
+
check(value, maybe(Number));
|
|
618
626
|
this._heightAboveGround = value;
|
|
619
627
|
this.propertyChanged.raiseEvent(['heightAboveGround']);
|
|
620
628
|
}
|
|
@@ -968,10 +976,11 @@ class VectorProperties {
|
|
|
968
976
|
|
|
969
977
|
private _getBaseOptions(feature: Feature): VectorPropertiesBaseOptions {
|
|
970
978
|
return {
|
|
979
|
+
// 0 is not a valid scale value and will crash cesium
|
|
971
980
|
scale: [
|
|
972
|
-
this.getModelScaleX(feature),
|
|
973
|
-
this.getModelScaleY(feature),
|
|
974
|
-
this.getModelScaleZ(feature),
|
|
981
|
+
this.getModelScaleX(feature) || 1,
|
|
982
|
+
this.getModelScaleY(feature) || 1,
|
|
983
|
+
this.getModelScaleZ(feature) || 1,
|
|
975
984
|
],
|
|
976
985
|
heading: this.getModelHeading(feature),
|
|
977
986
|
pitch: this.getModelPitch(feature),
|
|
@@ -1013,6 +1022,34 @@ class VectorProperties {
|
|
|
1013
1022
|
};
|
|
1014
1023
|
}
|
|
1015
1024
|
|
|
1025
|
+
/**
|
|
1026
|
+
* Determines if a feature (in general with a point geometry) should be rendered as a geometry (billboard & label etc) or a model or a primitive
|
|
1027
|
+
* @param feature
|
|
1028
|
+
*/
|
|
1029
|
+
renderAs(feature: Feature): 'geometry' | 'model' | 'primitive' {
|
|
1030
|
+
if (feature.get('olcs_modelUrl')) {
|
|
1031
|
+
return 'model';
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
const primitiveOptions = feature.get('olcs_primitiveOptions') as
|
|
1035
|
+
| VectorPropertiesPrimitiveOptions
|
|
1036
|
+
| undefined;
|
|
1037
|
+
|
|
1038
|
+
if (primitiveOptions?.geometryOptions) {
|
|
1039
|
+
return 'primitive';
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
if (this.modelUrl) {
|
|
1043
|
+
return 'model';
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
if (this.primitiveOptions?.geometryOptions) {
|
|
1047
|
+
return 'primitive';
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
return 'geometry';
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1016
1053
|
/**
|
|
1017
1054
|
* resets values, either given, or default Value raises propertyChanged event once;
|
|
1018
1055
|
* @param vcsMeta
|
package/src/map/baseOLMap.ts
CHANGED
|
@@ -87,7 +87,7 @@ class BaseOLMap extends VcsMap<OLLayer> {
|
|
|
87
87
|
olEvent.preventDefault();
|
|
88
88
|
}
|
|
89
89
|
olEvent.originalEvent.preventDefault();
|
|
90
|
-
const position = [olEvent.coordinate[0], olEvent.coordinate[1]
|
|
90
|
+
const position = [olEvent.coordinate[0], olEvent.coordinate[1]];
|
|
91
91
|
this.pointerInteractionEvent.raiseEvent({
|
|
92
92
|
map: this,
|
|
93
93
|
position,
|
package/src/map/obliqueMap.ts
CHANGED
|
@@ -32,6 +32,7 @@ export type ObliqueOptions = VcsMapOptions & {
|
|
|
32
32
|
changeOnMoveEnd?: boolean;
|
|
33
33
|
switchThreshold?: number;
|
|
34
34
|
switchOnEdge?: boolean;
|
|
35
|
+
maintainViewpointOnCollectionChange?: boolean;
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
const defaultHeadings: Record<ViewDirection, number> = {
|
|
@@ -90,6 +91,10 @@ class ObliqueMap extends BaseOLMap {
|
|
|
90
91
|
*/
|
|
91
92
|
collectionChanged: VcsEvent<ObliqueCollection>;
|
|
92
93
|
|
|
94
|
+
failedToSetCollection = new VcsEvent<ObliqueCollection>();
|
|
95
|
+
|
|
96
|
+
maintainViewpointOnCollectionChange: boolean;
|
|
97
|
+
|
|
93
98
|
private _activeCollectionDestroyedListener: () => void;
|
|
94
99
|
|
|
95
100
|
private _obliqueProvider: ObliqueProvider | null = null;
|
|
@@ -102,6 +107,7 @@ class ObliqueMap extends BaseOLMap {
|
|
|
102
107
|
changeOnMoveEnd: false,
|
|
103
108
|
switchThreshold: 0,
|
|
104
109
|
switchOnEdge: true,
|
|
110
|
+
maintainViewpointOnCollectionChange: false,
|
|
105
111
|
};
|
|
106
112
|
}
|
|
107
113
|
|
|
@@ -129,6 +135,11 @@ class ObliqueMap extends BaseOLMap {
|
|
|
129
135
|
|
|
130
136
|
this.collectionChanged = new VcsEvent();
|
|
131
137
|
|
|
138
|
+
this.maintainViewpointOnCollectionChange = parseBoolean(
|
|
139
|
+
options.maintainViewpointOnCollectionChange,
|
|
140
|
+
defaultOptions.maintainViewpointOnCollectionChange,
|
|
141
|
+
);
|
|
142
|
+
|
|
132
143
|
this._activeCollectionDestroyedListener = (): void => {};
|
|
133
144
|
}
|
|
134
145
|
|
|
@@ -293,6 +304,7 @@ class ObliqueMap extends BaseOLMap {
|
|
|
293
304
|
if (this._loadingCollection !== obliqueCollection) {
|
|
294
305
|
return;
|
|
295
306
|
}
|
|
307
|
+
|
|
296
308
|
await this._setCollection(obliqueCollection, viewpoint);
|
|
297
309
|
}
|
|
298
310
|
|
|
@@ -304,18 +316,37 @@ class ObliqueMap extends BaseOLMap {
|
|
|
304
316
|
viewpoint?: Viewpoint,
|
|
305
317
|
): Promise<void> {
|
|
306
318
|
this._loadingCollection = obliqueCollection;
|
|
307
|
-
this._activeCollectionDestroyedListener();
|
|
308
|
-
this._activeCollectionDestroyedListener =
|
|
309
|
-
obliqueCollection.destroyed.addEventListener(() => {
|
|
310
|
-
// eslint-disable-next-line no-void
|
|
311
|
-
void this._setCollection(defaultCollection);
|
|
312
|
-
});
|
|
313
319
|
await obliqueCollection.load();
|
|
314
320
|
const vp = viewpoint || (await this.getViewpoint());
|
|
315
321
|
if (this._loadingCollection !== obliqueCollection) {
|
|
316
322
|
return;
|
|
317
323
|
}
|
|
324
|
+
|
|
325
|
+
if (
|
|
326
|
+
viewpoint &&
|
|
327
|
+
this.maintainViewpointOnCollectionChange &&
|
|
328
|
+
this.collection
|
|
329
|
+
) {
|
|
330
|
+
const viewDirection = getViewDirectionFromViewpoint(viewpoint);
|
|
331
|
+
const mercatorCoordinates = getMercatorViewpointCenter(viewpoint);
|
|
332
|
+
const canShow = await obliqueCollection.hasImageAtCoordinate(
|
|
333
|
+
mercatorCoordinates,
|
|
334
|
+
viewDirection,
|
|
335
|
+
);
|
|
336
|
+
if (!canShow) {
|
|
337
|
+
this.failedToSetCollection.raiseEvent(obliqueCollection);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
318
342
|
this._obliqueProvider?.setCollection(obliqueCollection);
|
|
343
|
+
this._activeCollectionDestroyedListener();
|
|
344
|
+
this._activeCollectionDestroyedListener =
|
|
345
|
+
obliqueCollection.destroyed.addEventListener(() => {
|
|
346
|
+
// eslint-disable-next-line no-void
|
|
347
|
+
void this._setCollection(defaultCollection);
|
|
348
|
+
});
|
|
349
|
+
|
|
319
350
|
this.collectionChanged.raiseEvent(obliqueCollection);
|
|
320
351
|
if (vp) {
|
|
321
352
|
await this.gotoViewpoint(vp);
|
|
@@ -470,6 +501,14 @@ class ObliqueMap extends BaseOLMap {
|
|
|
470
501
|
config.switchOnEdge = this.switchEnabled;
|
|
471
502
|
}
|
|
472
503
|
|
|
504
|
+
if (
|
|
505
|
+
this.maintainViewpointOnCollectionChange !==
|
|
506
|
+
defaultOptions.maintainViewpointOnCollectionChange
|
|
507
|
+
) {
|
|
508
|
+
config.maintainViewpointOnCollectionChange =
|
|
509
|
+
this.maintainViewpointOnCollectionChange;
|
|
510
|
+
}
|
|
511
|
+
|
|
473
512
|
return config;
|
|
474
513
|
}
|
|
475
514
|
|
|
@@ -478,6 +517,7 @@ class ObliqueMap extends BaseOLMap {
|
|
|
478
517
|
this._obliqueProvider.destroy();
|
|
479
518
|
}
|
|
480
519
|
this.collectionChanged.destroy();
|
|
520
|
+
this.failedToSetCollection.destroy();
|
|
481
521
|
this._activeCollectionDestroyedListener();
|
|
482
522
|
super.destroy();
|
|
483
523
|
}
|
package/src/map/vcsMap.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getLogger as getLoggerByName, Logger } from '@vcsuite/logger';
|
|
2
|
+
import { parseBoolean } from '@vcsuite/parsers';
|
|
2
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
4
|
import type { MapEvent as OLMapEvent } from 'ol';
|
|
4
5
|
import type { Layer as OLLayer } from 'ol/layer.js';
|
|
@@ -23,6 +24,10 @@ function getLogger(): Logger {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export type VcsMapOptions = VcsObjectOptions & {
|
|
27
|
+
/**
|
|
28
|
+
* instead of using a fallback map, this map will fail to activate if another map is active and the current viewpoint cannot be shown
|
|
29
|
+
*/
|
|
30
|
+
fallbackToCurrentMap?: boolean;
|
|
26
31
|
/**
|
|
27
32
|
* the name of the fallback map to use, e.g. in case there is no oblique image at the activation viewpoint
|
|
28
33
|
*/
|
|
@@ -58,6 +63,7 @@ class VcsMap<
|
|
|
58
63
|
static getDefaultOptions(): VcsMapOptions {
|
|
59
64
|
return {
|
|
60
65
|
fallbackMap: undefined,
|
|
66
|
+
fallbackToCurrentMap: false,
|
|
61
67
|
};
|
|
62
68
|
}
|
|
63
69
|
|
|
@@ -93,9 +99,13 @@ class VcsMap<
|
|
|
93
99
|
/**
|
|
94
100
|
* The name of a map to fall back on, if this map cant show a viewpoint
|
|
95
101
|
*/
|
|
96
|
-
|
|
97
102
|
fallbackMap: string | null;
|
|
98
103
|
|
|
104
|
+
/**
|
|
105
|
+
* instead of using a fallback map, this map will fail to activate if another map is active and the current viewpoint cannot be shown
|
|
106
|
+
*/
|
|
107
|
+
fallbackToCurrentMap: boolean;
|
|
108
|
+
|
|
99
109
|
private _visualizations: Map<string, Set<V>>;
|
|
100
110
|
|
|
101
111
|
private _state: MapState;
|
|
@@ -122,7 +132,7 @@ class VcsMap<
|
|
|
122
132
|
*/
|
|
123
133
|
constructor(options: VcsMapOptions) {
|
|
124
134
|
super(options);
|
|
125
|
-
|
|
135
|
+
const defaultOptions = VcsMap.getDefaultOptions();
|
|
126
136
|
this.mapElement = document.createElement('div');
|
|
127
137
|
this.mapElement.setAttribute('id', uuidv4());
|
|
128
138
|
this.mapElement.classList.add('mapElement');
|
|
@@ -147,6 +157,11 @@ class VcsMap<
|
|
|
147
157
|
|
|
148
158
|
this.fallbackMap = options.fallbackMap || null;
|
|
149
159
|
|
|
160
|
+
this.fallbackToCurrentMap = parseBoolean(
|
|
161
|
+
options.fallbackToCurrentMap,
|
|
162
|
+
defaultOptions.fallbackToCurrentMap,
|
|
163
|
+
);
|
|
164
|
+
|
|
150
165
|
this._visualizations = new Map();
|
|
151
166
|
|
|
152
167
|
this._state = MapState.INACTIVE;
|
|
@@ -516,6 +531,9 @@ class VcsMap<
|
|
|
516
531
|
if (this.fallbackMap) {
|
|
517
532
|
config.fallbackMap = this.fallbackMap;
|
|
518
533
|
}
|
|
534
|
+
if (this.fallbackToCurrentMap) {
|
|
535
|
+
config.fallbackToCurrentMap = this.fallbackToCurrentMap;
|
|
536
|
+
}
|
|
519
537
|
return config;
|
|
520
538
|
}
|
|
521
539
|
|
package/src/oblique/helpers.ts
CHANGED
|
@@ -13,7 +13,10 @@ import { transform } from 'ol/proj.js';
|
|
|
13
13
|
import { Cartesian2, type CesiumTerrainProvider } from '@vcmap-cesium/engine';
|
|
14
14
|
import { ObliqueViewDirection } from './obliqueViewDirection.js';
|
|
15
15
|
import { getHeightFromTerrainProvider } from '../layer/terrainHelpers.js';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
cartesian2DDistance,
|
|
18
|
+
cartesian2DDistanceSquared,
|
|
19
|
+
} from '../util/math.js';
|
|
17
20
|
import Projection, {
|
|
18
21
|
mercatorProjection,
|
|
19
22
|
wgs84Projection,
|
|
@@ -52,11 +55,14 @@ export function sortRealWordEdgeCoordinates(
|
|
|
52
55
|
|
|
53
56
|
let sorted = extentPoints.map((extentPoint) => {
|
|
54
57
|
let closest = 0;
|
|
55
|
-
let
|
|
58
|
+
let distanceSquared = Infinity;
|
|
56
59
|
cornerPoints.forEach((cornerPoint, cornerIndex) => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
const currentDistanceSquared = cartesian2DDistanceSquared(
|
|
61
|
+
extentPoint,
|
|
62
|
+
cornerPoint,
|
|
63
|
+
);
|
|
64
|
+
if (currentDistanceSquared < distanceSquared) {
|
|
65
|
+
distanceSquared = currentDistanceSquared;
|
|
60
66
|
closest = cornerIndex;
|
|
61
67
|
}
|
|
62
68
|
});
|
|
@@ -3,7 +3,7 @@ import { createXYZ } from 'ol/tilegrid.js';
|
|
|
3
3
|
import type { Coordinate } from 'ol/coordinate.js';
|
|
4
4
|
import type { TileCoord } from 'ol/tilecoord.js';
|
|
5
5
|
import type { Extent } from 'ol/extent.js';
|
|
6
|
-
import {
|
|
6
|
+
import { cartesian2DDistanceSquared } from '../util/math.js';
|
|
7
7
|
import {
|
|
8
8
|
parseImageData,
|
|
9
9
|
parseImageMeta,
|
|
@@ -235,12 +235,12 @@ class ObliqueDataSet {
|
|
|
235
235
|
let minTile = null;
|
|
236
236
|
[...this._tiles.keys()].forEach((tile) => {
|
|
237
237
|
const tileCoord = tile.split('/').map(Number);
|
|
238
|
-
const
|
|
238
|
+
const squaredDist = cartesian2DDistanceSquared(
|
|
239
239
|
[actualTile[1], actualTile[2]],
|
|
240
240
|
[tileCoord[1], tileCoord[2]],
|
|
241
241
|
);
|
|
242
|
-
if (
|
|
243
|
-
minDistance =
|
|
242
|
+
if (squaredDist < minDistance) {
|
|
243
|
+
minDistance = squaredDist;
|
|
244
244
|
minTile = tileCoord;
|
|
245
245
|
}
|
|
246
246
|
});
|
|
@@ -5,7 +5,7 @@ import { check } from '@vcsuite/check';
|
|
|
5
5
|
* @returns {Array<import("ol/coordinate").Coordinate|Array<import("ol/coordinate").Coordinate>|Array<Array<import("ol/coordinate").Coordinate>>|Array<Array<Array<import("ol/coordinate").Coordinate>>>>}
|
|
6
6
|
*/
|
|
7
7
|
GeometryCollection.prototype.getCoordinates = function getCoordinates() {
|
|
8
|
-
return this.
|
|
8
|
+
return this.getGeometriesArray().map((g) => g.getCoordinates());
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -31,9 +31,28 @@ GeometryCollection.prototype.setCoordinates = function setCoordinates(
|
|
|
31
31
|
* @returns {import("ol/geom/Geometry").GeometryLayout}
|
|
32
32
|
*/
|
|
33
33
|
GeometryCollection.prototype.getLayout = function getLayout() {
|
|
34
|
-
const firstGeom = this.
|
|
34
|
+
const firstGeom = this.getGeometriesArray()[0];
|
|
35
35
|
if (firstGeom) {
|
|
36
36
|
return firstGeom.getLayout();
|
|
37
37
|
}
|
|
38
38
|
return 'XYZ';
|
|
39
39
|
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @returns {number}
|
|
43
|
+
*/
|
|
44
|
+
GeometryCollection.prototype.getStride = function getStride() {
|
|
45
|
+
const firstGeom = this.getGeometriesArray()[0];
|
|
46
|
+
if (firstGeom) {
|
|
47
|
+
return firstGeom.getStride();
|
|
48
|
+
}
|
|
49
|
+
return 2;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @returns {number[]}
|
|
54
|
+
*/
|
|
55
|
+
GeometryCollection.prototype.getFlatCoordinates =
|
|
56
|
+
function getFlatCoordinates() {
|
|
57
|
+
return this.getGeometriesArray().flatMap((g) => g.getFlatCoordinates());
|
|
58
|
+
};
|
package/src/ol/ol.d.ts
CHANGED
|
@@ -41,12 +41,17 @@ import {
|
|
|
41
41
|
fvLastUpdated,
|
|
42
42
|
globalHiderLastUpdated,
|
|
43
43
|
} from '../layer/vectorHelpers.js';
|
|
44
|
+
import { validityPlaceholder } from '../util/editor/interactions/createPolygonInteraction.js';
|
|
44
45
|
|
|
45
46
|
declare module 'ol/geom.js' {
|
|
46
47
|
interface Geometry {
|
|
47
48
|
getCoordinates(): any;
|
|
48
|
-
setCoordinates(
|
|
49
|
+
setCoordinates(
|
|
50
|
+
coordinates: any,
|
|
51
|
+
layout?: import('ol/geom/Geometry.js').GeometryLayout,
|
|
52
|
+
): void;
|
|
49
53
|
getFlatCoordinates(): number[];
|
|
54
|
+
getStride(): number;
|
|
50
55
|
getLayout(): import('ol/geom/Geometry.js').GeometryLayout;
|
|
51
56
|
[alreadyTransformedToMercator]?: boolean;
|
|
52
57
|
[actuallyIsCircle]?: boolean;
|
|
@@ -67,15 +72,23 @@ declare module 'ol/geom.js' {
|
|
|
67
72
|
| Array<Array<import('ol/coordinate.js').Coordinate>>
|
|
68
73
|
| Array<Array<Array<import('ol/coordinate.js').Coordinate>>>
|
|
69
74
|
>,
|
|
75
|
+
layout?: import('ol/geom/Geometry.js').GeometryLayout,
|
|
70
76
|
): void;
|
|
71
77
|
getLayout(): import('ol/geom/Geometry.js').GeometryLayout;
|
|
72
78
|
}
|
|
73
79
|
|
|
74
80
|
interface Circle {
|
|
75
81
|
getCoordinates(): import('ol/coordinate.js').Coordinate[];
|
|
76
|
-
setCoordinates(
|
|
82
|
+
setCoordinates(
|
|
83
|
+
coordinates: import('ol/coordinate.js').Coordinate[],
|
|
84
|
+
layout?: import('ol/geom/Geometry.js').GeometryLayout,
|
|
85
|
+
): void;
|
|
77
86
|
rotate(angle: number, anchor: import('ol/coordinate.js').Coordinate): void;
|
|
78
87
|
}
|
|
88
|
+
|
|
89
|
+
interface Polygon {
|
|
90
|
+
[validityPlaceholder]?: boolean;
|
|
91
|
+
}
|
|
79
92
|
}
|
|
80
93
|
|
|
81
94
|
declare module 'ol/index.js' {
|
package/src/style/arcStyle.ts
CHANGED