@vcmap/core 5.0.0-rc.28 → 5.0.0-rc.29
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/README.md +9 -3
- package/build/postinstall.js +13 -2
- package/index.d.ts +155 -106
- package/package.json +9 -4
- package/src/category/category.js +71 -32
- package/src/category/categoryCollection.js +27 -18
- package/src/cesium/cesiumVcsCameraPrimitive.js +13 -5
- package/src/cesium/entity.js +3 -1
- package/src/cesium/wallpaperMaterial.js +4 -2
- package/src/classRegistry.js +11 -4
- package/src/featureProvider/abstractFeatureProvider.js +43 -22
- package/src/featureProvider/tileProviderFeatureProvider.js +11 -5
- package/src/featureProvider/wmsFeatureProvider.js +37 -15
- package/src/interaction/abstractInteraction.js +5 -1
- package/src/interaction/coordinateAtPixel.js +34 -12
- package/src/interaction/eventHandler.js +63 -23
- package/src/interaction/featureAtPixelInteraction.js +96 -32
- package/src/interaction/featureProviderInteraction.js +23 -8
- package/src/interaction/interactionChain.js +19 -9
- package/src/interaction/interactionType.js +23 -26
- package/src/layer/cesium/cesiumTilesetCesiumImpl.js +45 -15
- package/src/layer/cesium/clusterContext.js +10 -3
- package/src/layer/cesium/dataSourceCesiumImpl.js +13 -4
- package/src/layer/cesium/openStreetMapCesiumImpl.js +7 -3
- package/src/layer/cesium/rasterLayerCesiumImpl.js +6 -2
- package/src/layer/cesium/singleImageCesiumImpl.js +14 -3
- package/src/layer/cesium/terrainCesiumImpl.js +3 -2
- package/src/layer/cesium/tmsCesiumImpl.js +15 -3
- package/src/layer/cesium/vectorCesiumImpl.js +69 -25
- package/src/layer/cesium/vectorContext.js +25 -5
- package/src/layer/cesium/vectorRasterTileCesiumImpl.js +15 -5
- package/src/layer/cesium/vectorTileImageryProvider.js +51 -13
- package/src/layer/cesium/wmsCesiumImpl.js +15 -3
- package/src/layer/cesium/wmtsCesiumImpl.js +18 -6
- package/src/layer/cesium/x3dmHelper.js +4 -1
- package/src/layer/cesiumTilesetLayer.js +55 -26
- package/src/layer/czmlLayer.js +11 -5
- package/src/layer/dataSourceLayer.js +25 -17
- package/src/layer/featureLayer.js +33 -18
- package/src/layer/featureStoreLayer.js +161 -99
- package/src/layer/featureStoreLayerChanges.js +57 -17
- package/src/layer/featureVisibility.js +89 -59
- package/src/layer/geojsonHelpers.js +70 -29
- package/src/layer/geojsonLayer.js +17 -11
- package/src/layer/globalHider.js +14 -4
- package/src/layer/layer.js +77 -44
- package/src/layer/layerImplementation.js +12 -4
- package/src/layer/oblique/layerObliqueImpl.js +3 -1
- package/src/layer/oblique/obliqueHelpers.js +75 -30
- package/src/layer/oblique/vectorObliqueImpl.js +175 -69
- package/src/layer/openStreetMapLayer.js +34 -20
- package/src/layer/openlayers/layerOpenlayersImpl.js +37 -15
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/singleImageOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/tileDebugOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/tmsOpenlayersImpl.js +6 -3
- package/src/layer/openlayers/vectorOpenlayersImpl.js +14 -4
- package/src/layer/openlayers/vectorTileOpenlayersImpl.js +12 -5
- package/src/layer/openlayers/wmsOpenlayersImpl.js +3 -1
- package/src/layer/openlayers/wmtsOpenlayersImpl.js +12 -5
- package/src/layer/pointCloudLayer.js +21 -10
- package/src/layer/rasterLayer.js +73 -22
- package/src/layer/singleImageLayer.js +10 -7
- package/src/layer/terrainHelpers.js +30 -19
- package/src/layer/terrainLayer.js +16 -7
- package/src/layer/tileLoadedHelper.js +9 -4
- package/src/layer/tileProvider/mvtTileProvider.js +10 -4
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +10 -4
- package/src/layer/tileProvider/tileProvider.js +163 -87
- package/src/layer/tileProvider/urlTemplateTileProvider.js +10 -4
- package/src/layer/tmsLayer.js +7 -6
- package/src/layer/vectorHelpers.js +34 -25
- package/src/layer/vectorLayer.js +77 -36
- package/src/layer/vectorProperties.js +245 -74
- package/src/layer/vectorSymbols.js +3 -1
- package/src/layer/vectorTileLayer.js +121 -70
- package/src/layer/wfsLayer.js +19 -8
- package/src/layer/wmsHelpers.js +11 -6
- package/src/layer/wmsLayer.js +36 -14
- package/src/layer/wmtsLayer.js +35 -20
- package/src/map/baseOLMap.js +57 -31
- package/src/map/cameraLimiter.js +67 -18
- package/src/map/cesiumMap.js +307 -95
- package/src/map/obliqueMap.js +84 -34
- package/src/map/openlayersMap.js +40 -19
- package/src/map/vcsMap.js +21 -8
- package/src/oblique/helpers.js +212 -64
- package/src/oblique/obliqueCollection.js +111 -48
- package/src/oblique/obliqueDataSet.js +53 -21
- package/src/oblique/obliqueImage.js +50 -17
- package/src/oblique/obliqueImageMeta.js +7 -6
- package/src/oblique/obliqueProvider.js +75 -27
- package/src/oblique/obliqueView.js +18 -7
- package/src/oblique/obliqueViewDirection.js +3 -2
- package/src/oblique/parseImageJson.js +57 -23
- package/src/ol/feature.js +8 -3
- package/src/ol/geom/circle.js +12 -3
- package/src/ol/geom/geometryCollection.js +11 -4
- package/src/ol/render/canvas/canvasTileRenderer.js +11 -9
- package/src/overrideClassRegistry.js +13 -3
- package/src/style/arcStyle.js +129 -36
- package/src/style/arrowStyle.js +57 -22
- package/src/style/declarativeStyleItem.js +107 -62
- package/src/style/shapesCategory.js +8 -6
- package/src/style/styleFactory.js +4 -1
- package/src/style/styleHelpers.js +17 -8
- package/src/style/styleItem.js +28 -10
- package/src/style/vectorStyleItem.js +160 -74
- package/src/style/writeStyle.js +5 -7
- package/src/util/clipping/clippingObject.js +72 -38
- package/src/util/clipping/clippingObjectManager.js +53 -19
- package/src/util/clipping/clippingPlaneHelper.js +120 -53
- package/src/util/collection.js +12 -6
- package/src/util/editor/createFeatureSession.js +21 -6
- package/src/util/editor/editFeaturesSession.js +41 -15
- package/src/util/editor/editGeometrySession.js +55 -30
- package/src/util/editor/editorHelpers.js +114 -29
- package/src/util/editor/editorSessionHelpers.js +8 -3
- package/src/util/editor/interactions/createBBoxInteraction.js +11 -3
- package/src/util/editor/interactions/createCircleInteraction.js +7 -2
- package/src/util/editor/interactions/createLineStringInteraction.js +7 -2
- package/src/util/editor/interactions/createPolygonInteraction.js +7 -2
- package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +7 -5
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +8 -3
- package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +4 -2
- package/src/util/editor/interactions/insertVertexInteraction.js +17 -6
- package/src/util/editor/interactions/mapInteractionController.js +31 -14
- package/src/util/editor/interactions/removeVertexInteraction.js +4 -1
- package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +19 -10
- package/src/util/editor/interactions/selectMultiFeatureInteraction.js +33 -20
- package/src/util/editor/interactions/selectSingleFeatureInteraction.js +14 -8
- package/src/util/editor/selectFeaturesSession.js +37 -21
- package/src/util/editor/transformation/create2DHandlers.js +82 -37
- package/src/util/editor/transformation/create3DHandlers.js +187 -84
- package/src/util/editor/transformation/extrudeInteraction.js +20 -5
- package/src/util/editor/transformation/rotateInteraction.js +29 -16
- package/src/util/editor/transformation/scaleInteraction.js +31 -15
- package/src/util/editor/transformation/transformationHandler.js +23 -8
- package/src/util/editor/transformation/transformationTypes.js +8 -4
- package/src/util/editor/transformation/translateInteraction.js +86 -32
- package/src/util/editor/validateGeoemetry.js +3 -1
- package/src/util/exclusiveManager.js +6 -3
- package/src/util/extent.js +20 -10
- package/src/util/featureconverter/arcToCesium.js +46 -12
- package/src/util/featureconverter/circleToCesium.js +61 -27
- package/src/util/featureconverter/convert.js +85 -13
- package/src/util/featureconverter/extent3D.js +69 -28
- package/src/util/featureconverter/featureconverterHelper.js +232 -79
- package/src/util/featureconverter/lineStringToCesium.js +107 -35
- package/src/util/featureconverter/pointHelpers.js +117 -45
- package/src/util/featureconverter/pointToCesium.js +128 -31
- package/src/util/featureconverter/polygonToCesium.js +50 -16
- package/src/util/fetch.js +3 -1
- package/src/util/geometryHelpers.js +15 -10
- package/src/util/indexedCollection.js +7 -3
- package/src/util/isMobile.js +8 -2
- package/src/util/layerCollection.js +28 -12
- package/src/util/mapCollection.js +37 -18
- package/src/util/math.js +35 -19
- package/src/util/overrideCollection.js +57 -32
- package/src/util/projection.js +21 -5
- package/src/util/urlHelpers.js +5 -3
- package/src/util/viewpoint.js +66 -33
- package/src/vcsApp.js +133 -69
- package/src/vcsModule.js +3 -2
- package/src/vcsModuleHelpers.js +24 -9
- package/src/vcsObject.js +3 -2
- package/tests/data/dynamicPointCzml.json +24 -35
- package/tests/data/oblique/imageData/imagev34.json +56 -272
- package/tests/data/oblique/imageData/imagev35.json +272 -19
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +299 -19
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -1
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -1
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -1
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -1
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -1
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -1
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -1
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -1
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -1
- package/tests/data/oblique/tiledImageData/image.json +70 -1
- package/tests/data/terrain/layer.json +121 -130
- package/tests/data/testGeoJSON.json +4 -16
- package/tests/unit/helpers/cesiumHelpers.js +58 -33
- package/tests/unit/helpers/helpers.js +10 -2
- package/tests/unit/helpers/imageHelpers.js +8 -4
- package/tests/unit/helpers/obliqueData.js +39 -13
- package/tests/unit/helpers/obliqueHelpers.js +12 -9
- package/tests/unit/helpers/openlayersHelpers.js +4 -1
- package/tests/unit/helpers/terrain/terrainData.js +8 -7
|
@@ -20,13 +20,20 @@ import Projection from '../projection.js';
|
|
|
20
20
|
* @returns {Array<import("@vcmap-cesium/engine").CircleGeometry>}
|
|
21
21
|
* @private
|
|
22
22
|
*/
|
|
23
|
-
export function createSolidGeometries(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
export function createSolidGeometries(
|
|
24
|
+
options,
|
|
25
|
+
height,
|
|
26
|
+
perPositionHeight,
|
|
27
|
+
extrudedHeight,
|
|
28
|
+
) {
|
|
29
|
+
return [
|
|
30
|
+
new CircleGeometry({
|
|
31
|
+
...options,
|
|
32
|
+
height,
|
|
33
|
+
granularity: 0.02,
|
|
34
|
+
extrudedHeight,
|
|
35
|
+
}),
|
|
36
|
+
];
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
/**
|
|
@@ -37,13 +44,20 @@ export function createSolidGeometries(options, height, perPositionHeight, extrud
|
|
|
37
44
|
* @returns {Array<import("@vcmap-cesium/engine").CircleOutlineGeometry>}
|
|
38
45
|
* @private
|
|
39
46
|
*/
|
|
40
|
-
export function createOutlineGeometries(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
export function createOutlineGeometries(
|
|
48
|
+
options,
|
|
49
|
+
height,
|
|
50
|
+
perPositionHeight,
|
|
51
|
+
extrudedHeight,
|
|
52
|
+
) {
|
|
53
|
+
return [
|
|
54
|
+
new CircleOutlineGeometry({
|
|
55
|
+
...options,
|
|
56
|
+
height,
|
|
57
|
+
extrudedHeight,
|
|
58
|
+
granularity: 0.02,
|
|
59
|
+
}),
|
|
60
|
+
];
|
|
47
61
|
}
|
|
48
62
|
|
|
49
63
|
/**
|
|
@@ -73,11 +87,7 @@ export function getLineGeometryOptions(options, style) {
|
|
|
73
87
|
];
|
|
74
88
|
|
|
75
89
|
// circular returns polygon with GeometryLayout.XY
|
|
76
|
-
const circlePolygon = circular(
|
|
77
|
-
wgs84Center,
|
|
78
|
-
radius,
|
|
79
|
-
40,
|
|
80
|
-
);
|
|
90
|
+
const circlePolygon = circular(wgs84Center, radius, 40);
|
|
81
91
|
const pos = circlePolygon.getLinearRing(0).getCoordinates();
|
|
82
92
|
const positions = pos.map((coord) => {
|
|
83
93
|
return Cartesian3.fromDegrees(coord[0], coord[1], cartographic.height);
|
|
@@ -130,8 +140,16 @@ export function getGeometryOptions(geometry, positionHeightAdjustment) {
|
|
|
130
140
|
const wgs84Point = Projection.mercatorToWgs84(olPoint, true);
|
|
131
141
|
|
|
132
142
|
// Cesium coordinates of center and radius
|
|
133
|
-
const center = Cartesian3.fromDegrees(
|
|
134
|
-
|
|
143
|
+
const center = Cartesian3.fromDegrees(
|
|
144
|
+
wgs84Center[0],
|
|
145
|
+
wgs84Center[1],
|
|
146
|
+
wgs84Center[2],
|
|
147
|
+
);
|
|
148
|
+
const point = Cartesian3.fromDegrees(
|
|
149
|
+
wgs84Point[0],
|
|
150
|
+
wgs84Point[1],
|
|
151
|
+
wgs84Center[2],
|
|
152
|
+
);
|
|
135
153
|
|
|
136
154
|
// Computation of radius in Cesium 3D
|
|
137
155
|
const radius = Cartesian3.distance(center, point);
|
|
@@ -187,13 +205,16 @@ export function validateCircle(circle) {
|
|
|
187
205
|
const flatCoordinates = circle.getFlatCoordinates();
|
|
188
206
|
const stride = circle.getStride();
|
|
189
207
|
// needs at least one full coordinate + a radius value and a non 0 radius
|
|
190
|
-
if (
|
|
191
|
-
|
|
208
|
+
if (
|
|
209
|
+
flatCoordinates &&
|
|
210
|
+
flatCoordinates.length >= stride + 1 &&
|
|
211
|
+
flatCoordinates[stride] !== flatCoordinates[0]
|
|
212
|
+
) {
|
|
213
|
+
return flatCoordinates.every((value) => Number.isFinite(value));
|
|
192
214
|
}
|
|
193
215
|
return false;
|
|
194
216
|
}
|
|
195
217
|
|
|
196
|
-
|
|
197
218
|
/**
|
|
198
219
|
* @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
199
220
|
* @param {import("ol/style/Style").default} style
|
|
@@ -202,13 +223,26 @@ export function validateCircle(circle) {
|
|
|
202
223
|
* @param {import("@vcmap-cesium/engine").Scene} scene
|
|
203
224
|
* @param {import("@vcmap/core").VectorContext|import("@vcmap/core").ClusterContext} context
|
|
204
225
|
*/
|
|
205
|
-
export default function circleToCesium(
|
|
226
|
+
export default function circleToCesium(
|
|
227
|
+
feature,
|
|
228
|
+
style,
|
|
229
|
+
geometries,
|
|
230
|
+
vectorProperties,
|
|
231
|
+
scene,
|
|
232
|
+
context,
|
|
233
|
+
) {
|
|
206
234
|
if (!style.getFill() && !style.getStroke()) {
|
|
207
235
|
return;
|
|
208
236
|
}
|
|
209
237
|
const circleGeometryFactory = getGeometryFactory();
|
|
210
|
-
const validGeometries = geometries.filter(circle => validateCircle(circle));
|
|
238
|
+
const validGeometries = geometries.filter((circle) => validateCircle(circle));
|
|
211
239
|
addPrimitivesToContext(
|
|
212
|
-
feature,
|
|
240
|
+
feature,
|
|
241
|
+
style,
|
|
242
|
+
validGeometries,
|
|
243
|
+
vectorProperties,
|
|
244
|
+
scene,
|
|
245
|
+
circleGeometryFactory,
|
|
246
|
+
context,
|
|
213
247
|
);
|
|
214
248
|
}
|
|
@@ -22,28 +22,84 @@ import ArcStyle, { featureArcStruct } from '../../style/arcStyle.js';
|
|
|
22
22
|
* @param {import("@vcmap-cesium/engine").Scene} scene
|
|
23
23
|
* @param {import("@vcmap/core").VectorContext|import("@vcmap/core").ClusterContext} context
|
|
24
24
|
*/
|
|
25
|
-
function convertGeometry(
|
|
25
|
+
function convertGeometry(
|
|
26
|
+
feature,
|
|
27
|
+
geometry,
|
|
28
|
+
style,
|
|
29
|
+
vectorProperties,
|
|
30
|
+
scene,
|
|
31
|
+
context,
|
|
32
|
+
) {
|
|
26
33
|
if (geometry instanceof Point) {
|
|
27
34
|
pointToCesium(feature, style, [geometry], vectorProperties, scene, context);
|
|
28
35
|
} else if (geometry instanceof Polygon) {
|
|
29
|
-
polygonToCesium(
|
|
36
|
+
polygonToCesium(
|
|
37
|
+
feature,
|
|
38
|
+
style,
|
|
39
|
+
[geometry],
|
|
40
|
+
vectorProperties,
|
|
41
|
+
scene,
|
|
42
|
+
context,
|
|
43
|
+
);
|
|
30
44
|
} else if (geometry instanceof LineString) {
|
|
31
45
|
if (style instanceof ArcStyle && feature[featureArcStruct].coordinates) {
|
|
32
46
|
arcToCesium(feature, style, [geometry], vectorProperties, scene, context);
|
|
33
47
|
} else {
|
|
34
|
-
lineStringToCesium(
|
|
48
|
+
lineStringToCesium(
|
|
49
|
+
feature,
|
|
50
|
+
style,
|
|
51
|
+
[geometry],
|
|
52
|
+
vectorProperties,
|
|
53
|
+
scene,
|
|
54
|
+
context,
|
|
55
|
+
);
|
|
35
56
|
}
|
|
36
57
|
} else if (geometry instanceof Circle) {
|
|
37
|
-
circleToCesium(
|
|
58
|
+
circleToCesium(
|
|
59
|
+
feature,
|
|
60
|
+
style,
|
|
61
|
+
[geometry],
|
|
62
|
+
vectorProperties,
|
|
63
|
+
scene,
|
|
64
|
+
context,
|
|
65
|
+
);
|
|
38
66
|
} else if (geometry instanceof MultiPoint) {
|
|
39
|
-
pointToCesium(
|
|
67
|
+
pointToCesium(
|
|
68
|
+
feature,
|
|
69
|
+
style,
|
|
70
|
+
geometry.getPoints(),
|
|
71
|
+
vectorProperties,
|
|
72
|
+
scene,
|
|
73
|
+
context,
|
|
74
|
+
);
|
|
40
75
|
} else if (geometry instanceof MultiPolygon) {
|
|
41
|
-
polygonToCesium(
|
|
76
|
+
polygonToCesium(
|
|
77
|
+
feature,
|
|
78
|
+
style,
|
|
79
|
+
geometry.getPolygons(),
|
|
80
|
+
vectorProperties,
|
|
81
|
+
scene,
|
|
82
|
+
context,
|
|
83
|
+
);
|
|
42
84
|
} else if (geometry instanceof MultiLineString) {
|
|
43
|
-
lineStringToCesium(
|
|
85
|
+
lineStringToCesium(
|
|
86
|
+
feature,
|
|
87
|
+
style,
|
|
88
|
+
geometry.getLineStrings(),
|
|
89
|
+
vectorProperties,
|
|
90
|
+
scene,
|
|
91
|
+
context,
|
|
92
|
+
);
|
|
44
93
|
} else if (geometry instanceof GeometryCollection) {
|
|
45
94
|
geometry.getGeometries().forEach((currentGeometry) => {
|
|
46
|
-
convertGeometry(
|
|
95
|
+
convertGeometry(
|
|
96
|
+
feature,
|
|
97
|
+
currentGeometry,
|
|
98
|
+
style,
|
|
99
|
+
vectorProperties,
|
|
100
|
+
scene,
|
|
101
|
+
context,
|
|
102
|
+
);
|
|
47
103
|
});
|
|
48
104
|
}
|
|
49
105
|
}
|
|
@@ -57,7 +113,9 @@ function convertGeometry(feature, geometry, style, vectorProperties, scene, cont
|
|
|
57
113
|
export function getStylesArray(style, feature, resolution = 1) {
|
|
58
114
|
const styles = [];
|
|
59
115
|
if (typeof style === 'function') {
|
|
60
|
-
styles.push(
|
|
116
|
+
styles.push(
|
|
117
|
+
...getStylesArray(style(feature, resolution), feature, resolution),
|
|
118
|
+
);
|
|
61
119
|
} else if (Array.isArray(style)) {
|
|
62
120
|
style.forEach((currentStyle) => {
|
|
63
121
|
styles.push(...getStylesArray(currentStyle, feature, resolution));
|
|
@@ -68,7 +126,6 @@ export function getStylesArray(style, feature, resolution = 1) {
|
|
|
68
126
|
return styles;
|
|
69
127
|
}
|
|
70
128
|
|
|
71
|
-
|
|
72
129
|
/**
|
|
73
130
|
* function to convert a feature to an array of Cesium.Primitives given a style and default properties. the resulting primitives
|
|
74
131
|
* must be added to the modules collections here
|
|
@@ -78,12 +135,27 @@ export function getStylesArray(style, feature, resolution = 1) {
|
|
|
78
135
|
* @param {import("@vcmap/core").VectorContext|import("@vcmap/core").ClusterContext} context
|
|
79
136
|
* @param {import("@vcmap-cesium/engine").Scene} scene
|
|
80
137
|
*/
|
|
81
|
-
export default function convert(
|
|
138
|
+
export default function convert(
|
|
139
|
+
feature,
|
|
140
|
+
style,
|
|
141
|
+
vectorProperties,
|
|
142
|
+
context,
|
|
143
|
+
scene,
|
|
144
|
+
) {
|
|
82
145
|
const styles = getStylesArray(feature.getStyle() || style, feature, 0);
|
|
83
146
|
styles.forEach((currentStyle) => {
|
|
84
|
-
const geometry = /** @type {import("ol/geom/Geometry").default} */(
|
|
147
|
+
const geometry = /** @type {import("ol/geom/Geometry").default} */ (
|
|
148
|
+
currentStyle.getGeometryFunction()(feature)
|
|
149
|
+
);
|
|
85
150
|
if (geometry) {
|
|
86
|
-
convertGeometry(
|
|
151
|
+
convertGeometry(
|
|
152
|
+
feature,
|
|
153
|
+
geometry,
|
|
154
|
+
currentStyle,
|
|
155
|
+
vectorProperties,
|
|
156
|
+
scene,
|
|
157
|
+
context,
|
|
158
|
+
);
|
|
87
159
|
}
|
|
88
160
|
});
|
|
89
161
|
}
|
|
@@ -11,7 +11,14 @@ class Extent3D {
|
|
|
11
11
|
static fromArray(array) {
|
|
12
12
|
check(array, [Number]);
|
|
13
13
|
check(array.length, 6);
|
|
14
|
-
return new Extent3D(
|
|
14
|
+
return new Extent3D(
|
|
15
|
+
array[0],
|
|
16
|
+
array[1],
|
|
17
|
+
array[2],
|
|
18
|
+
array[3],
|
|
19
|
+
array[4],
|
|
20
|
+
array[5],
|
|
21
|
+
);
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
/**
|
|
@@ -56,7 +63,14 @@ class Extent3D {
|
|
|
56
63
|
* @param {number} maxY
|
|
57
64
|
* @param {number} maxZ
|
|
58
65
|
*/
|
|
59
|
-
constructor(
|
|
66
|
+
constructor(
|
|
67
|
+
minX = Infinity,
|
|
68
|
+
minY = Infinity,
|
|
69
|
+
minZ = Infinity,
|
|
70
|
+
maxX = -Infinity,
|
|
71
|
+
maxY = -Infinity,
|
|
72
|
+
maxZ = -Infinity,
|
|
73
|
+
) {
|
|
60
74
|
/**
|
|
61
75
|
* @type {number}
|
|
62
76
|
*/
|
|
@@ -89,25 +103,31 @@ class Extent3D {
|
|
|
89
103
|
extendWithGeometry(geometry) {
|
|
90
104
|
if (geometry.getType() === 'GeometryCollection') {
|
|
91
105
|
/** @type {import("ol/geom/GeometryCollection").default} */ (geometry)
|
|
92
|
-
.getGeometriesArray()
|
|
106
|
+
.getGeometriesArray()
|
|
107
|
+
.forEach((geom) => {
|
|
108
|
+
this.extendWithGeometry(geom);
|
|
109
|
+
});
|
|
93
110
|
} else if (geometry.getType() === 'Circle') {
|
|
94
|
-
const flatCoordinates = /** @type {import("ol/geom/Circle").default} */ (
|
|
95
|
-
|
|
111
|
+
const flatCoordinates = /** @type {import("ol/geom/Circle").default} */ (
|
|
112
|
+
geometry
|
|
113
|
+
).getFlatCoordinates();
|
|
114
|
+
const stride = /** @type {import("ol/geom/Circle").default} */ (
|
|
115
|
+
geometry
|
|
116
|
+
).getStride();
|
|
96
117
|
const radius = flatCoordinates[stride] - flatCoordinates[0];
|
|
97
|
-
this.extendXY(
|
|
98
|
-
|
|
99
|
-
flatCoordinates[1] - radius,
|
|
100
|
-
);
|
|
101
|
-
this.extendXY(
|
|
102
|
-
flatCoordinates[0] + radius,
|
|
103
|
-
flatCoordinates[1] + radius,
|
|
104
|
-
);
|
|
118
|
+
this.extendXY(flatCoordinates[0] - radius, flatCoordinates[1] - radius);
|
|
119
|
+
this.extendXY(flatCoordinates[0] + radius, flatCoordinates[1] + radius);
|
|
105
120
|
if (stride > 2) {
|
|
106
121
|
this.extendZ(flatCoordinates[2]);
|
|
107
122
|
}
|
|
108
123
|
} else {
|
|
109
|
-
const flatCoordinates =
|
|
110
|
-
|
|
124
|
+
const flatCoordinates =
|
|
125
|
+
/** @type {import("ol/geom/SimpleGeometry").default} */ (
|
|
126
|
+
geometry
|
|
127
|
+
).getFlatCoordinates();
|
|
128
|
+
const stride = /** @type {import("ol/geom/SimpleGeometry").default} */ (
|
|
129
|
+
geometry
|
|
130
|
+
).getStride();
|
|
111
131
|
this.extendFlatCoordinates(flatCoordinates, stride);
|
|
112
132
|
}
|
|
113
133
|
}
|
|
@@ -118,14 +138,22 @@ class Extent3D {
|
|
|
118
138
|
extendWithHeightInfo(heightInfo) {
|
|
119
139
|
if (heightInfo.extruded) {
|
|
120
140
|
const calculatedFeatureMaxHeight =
|
|
121
|
-
heightInfo.groundLevel +
|
|
122
|
-
|
|
123
|
-
|
|
141
|
+
heightInfo.groundLevel +
|
|
142
|
+
heightInfo.storeyHeightsAboveGround.reduce(
|
|
143
|
+
(accumulator, currentValue) => {
|
|
144
|
+
return accumulator + currentValue;
|
|
145
|
+
},
|
|
146
|
+
0,
|
|
147
|
+
);
|
|
124
148
|
this.extendZ(calculatedFeatureMaxHeight);
|
|
125
149
|
const calculatedFeatureMinHeight =
|
|
126
|
-
heightInfo.groundLevel -
|
|
127
|
-
|
|
128
|
-
|
|
150
|
+
heightInfo.groundLevel -
|
|
151
|
+
heightInfo.storeyHeightsBelowGround.reduce(
|
|
152
|
+
(accumulator, currentValue) => {
|
|
153
|
+
return accumulator + currentValue;
|
|
154
|
+
},
|
|
155
|
+
0,
|
|
156
|
+
);
|
|
129
157
|
this.extendZ(calculatedFeatureMinHeight);
|
|
130
158
|
}
|
|
131
159
|
}
|
|
@@ -171,7 +199,11 @@ class Extent3D {
|
|
|
171
199
|
const { length } = flatCoordinates;
|
|
172
200
|
for (let offset = 0; offset < length; offset += stride) {
|
|
173
201
|
if (stride > 2) {
|
|
174
|
-
this.extendXYZ(
|
|
202
|
+
this.extendXYZ(
|
|
203
|
+
flatCoordinates[offset],
|
|
204
|
+
flatCoordinates[offset + 1],
|
|
205
|
+
flatCoordinates[offset + 2],
|
|
206
|
+
);
|
|
175
207
|
} else {
|
|
176
208
|
this.extendXY(flatCoordinates[offset], flatCoordinates[offset + 1]);
|
|
177
209
|
}
|
|
@@ -196,12 +228,14 @@ class Extent3D {
|
|
|
196
228
|
* @returns {boolean}
|
|
197
229
|
*/
|
|
198
230
|
isEmpty() {
|
|
199
|
-
return
|
|
231
|
+
return (
|
|
232
|
+
this.minX === Infinity &&
|
|
200
233
|
this.minY === Infinity &&
|
|
201
234
|
this.minZ === Infinity &&
|
|
202
235
|
this.maxX === -Infinity &&
|
|
203
236
|
this.maxY === -Infinity &&
|
|
204
|
-
this.maxZ === -Infinity
|
|
237
|
+
this.maxZ === -Infinity
|
|
238
|
+
);
|
|
205
239
|
}
|
|
206
240
|
|
|
207
241
|
/**
|
|
@@ -212,9 +246,9 @@ class Extent3D {
|
|
|
212
246
|
return [0, 0, 0];
|
|
213
247
|
}
|
|
214
248
|
return [
|
|
215
|
-
this.minX + (
|
|
216
|
-
this.minY + (
|
|
217
|
-
this.minZ + (
|
|
249
|
+
this.minX + (this.maxX - this.minX) / 2,
|
|
250
|
+
this.minY + (this.maxY - this.minY) / 2,
|
|
251
|
+
this.minZ + (this.maxZ - this.minZ) / 2,
|
|
218
252
|
];
|
|
219
253
|
}
|
|
220
254
|
|
|
@@ -236,7 +270,14 @@ class Extent3D {
|
|
|
236
270
|
* @returns {Extent3D}
|
|
237
271
|
*/
|
|
238
272
|
clone() {
|
|
239
|
-
return new Extent3D(
|
|
273
|
+
return new Extent3D(
|
|
274
|
+
this.minX,
|
|
275
|
+
this.minY,
|
|
276
|
+
this.minZ,
|
|
277
|
+
this.maxX,
|
|
278
|
+
this.maxY,
|
|
279
|
+
this.maxZ,
|
|
280
|
+
);
|
|
240
281
|
}
|
|
241
282
|
}
|
|
242
283
|
|