@vcmap/core 5.0.0-rc.3 → 5.0.0-rc.30
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/LICENSE.md +1 -1
- package/README.md +12 -5
- package/build/postinstall.js +14 -3
- package/index.d.ts +3477 -2007
- package/index.js +169 -131
- package/package.json +25 -27
- package/src/category/category.js +483 -0
- package/src/category/categoryCollection.js +153 -0
- package/src/cesium/cesium3DTileFeature.js +2 -2
- package/src/cesium/cesium3DTilePointFeature.js +1 -1
- package/src/cesium/cesiumVcsCameraPrimitive.js +16 -8
- package/src/cesium/entity.js +29 -0
- package/src/cesium/wallpaperMaterial.js +5 -3
- package/src/classRegistry.js +169 -0
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/abstractFeatureProvider.js +49 -46
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/tileProviderFeatureProvider.js +13 -5
- package/src/{vcs/vcm/util/featureProvider → featureProvider}/wmsFeatureProvider.js +56 -26
- package/src/{vcs/vcm/interaction → interaction}/abstractInteraction.js +33 -21
- package/src/{vcs/vcm/interaction → interaction}/coordinateAtPixel.js +40 -21
- package/src/{vcs/vcm/interaction → interaction}/eventHandler.js +131 -26
- package/src/{vcs/vcm/interaction → interaction}/featureAtPixelInteraction.js +108 -53
- package/src/interaction/featureProviderInteraction.js +58 -0
- package/src/{vcs/vcm/interaction → interaction}/interactionChain.js +40 -41
- package/src/{vcs/vcm/interaction → interaction}/interactionType.js +24 -31
- package/src/{vcs/vcm/layer/cesium/cesiumTilesetCesium.js → layer/cesium/cesiumTilesetCesiumImpl.js} +67 -55
- package/src/{vcs/vcm/layer → layer}/cesium/clusterContext.js +33 -8
- package/src/{vcs/vcm/layer/cesium/dataSourceCesium.js → layer/cesium/dataSourceCesiumImpl.js} +24 -13
- package/src/layer/cesium/openStreetMapCesiumImpl.js +32 -0
- package/src/{vcs/vcm/layer/cesium/rasterLayerCesium.js → layer/cesium/rasterLayerCesiumImpl.js} +12 -9
- package/src/{vcs/vcm/layer/cesium/singleImageCesium.js → layer/cesium/singleImageCesiumImpl.js} +19 -9
- package/src/{vcs/vcm/layer/cesium/terrainCesium.js → layer/cesium/terrainCesiumImpl.js} +6 -6
- package/src/{vcs/vcm/layer/cesium/tmsCesium.js → layer/cesium/tmsCesiumImpl.js} +21 -10
- package/src/{vcs/vcm/layer/cesium/vectorCesium.js → layer/cesium/vectorCesiumImpl.js} +93 -35
- package/src/layer/cesium/vectorContext.js +363 -0
- package/src/{vcs/vcm/layer/cesium/vectorRasterTileCesium.js → layer/cesium/vectorRasterTileCesiumImpl.js} +21 -13
- package/src/{vcs/vcm/layer → layer}/cesium/vectorTileImageryProvider.js +58 -21
- package/src/{vcs/vcm/layer/cesium/wmsCesium.js → layer/cesium/wmsCesiumImpl.js} +20 -9
- package/src/{vcs/vcm/layer/cesium/wmtsCesium.js → layer/cesium/wmtsCesiumImpl.js} +24 -13
- package/src/{vcs/vcm/layer → layer}/cesium/x3dmHelper.js +6 -3
- package/src/{vcs/vcm/layer/cesiumTileset.js → layer/cesiumTilesetLayer.js} +71 -108
- package/src/{vcs/vcm/layer/czml.js → layer/czmlLayer.js} +23 -20
- package/src/{vcs/vcm/layer/dataSource.js → layer/dataSourceLayer.js} +55 -90
- package/src/{vcs/vcm/layer → layer}/featureLayer.js +89 -74
- package/src/{vcs/vcm/layer/featureStore.js → layer/featureStoreLayer.js} +197 -150
- package/src/{vcs/vcm/layer/featureStoreChanges.js → layer/featureStoreLayerChanges.js} +150 -92
- package/src/{vcs/vcm/layer/featureStoreState.js → layer/featureStoreLayerState.js} +1 -2
- package/src/{vcs/vcm/layer → layer}/featureVisibility.js +114 -82
- package/src/{vcs/vcm/layer → layer}/geojsonHelpers.js +84 -69
- package/src/{vcs/vcm/layer/geojson.js → layer/geojsonLayer.js} +30 -27
- package/src/{vcs/vcm/layer → layer}/globalHider.js +25 -39
- package/src/{vcs/vcm/layer → layer}/layer.js +171 -96
- package/src/{vcs/vcm/layer → layer}/layerImplementation.js +13 -6
- package/src/{vcs/vcm/layer → layer}/layerState.js +0 -1
- package/src/{vcs/vcm/layer → layer}/layerSymbols.js +2 -1
- package/src/{vcs/vcm/layer/oblique/layerOblique.js → layer/oblique/layerObliqueImpl.js} +7 -5
- package/src/{vcs/vcm/layer → layer}/oblique/obliqueHelpers.js +76 -31
- package/src/{vcs/vcm/layer/oblique/vectorOblique.js → layer/oblique/vectorObliqueImpl.js} +198 -80
- package/src/{vcs/vcm/layer/openStreetMap.js → layer/openStreetMapLayer.js} +59 -40
- package/src/layer/openlayers/layerOpenlayersImpl.js +165 -0
- package/src/layer/openlayers/openStreetMapOpenlayersImpl.js +28 -0
- package/src/layer/openlayers/rasterLayerOpenlayersImpl.js +44 -0
- package/src/{vcs/vcm/layer/openlayers/singleImageOpenlayers.js → layer/openlayers/singleImageOpenlayersImpl.js} +8 -7
- package/src/{vcs/vcm/layer/openlayers/tileDebugOpenlayers.js → layer/openlayers/tileDebugOpenlayersImpl.js} +7 -6
- package/src/{vcs/vcm/layer/openlayers/tmsOpenlayers.js → layer/openlayers/tmsOpenlayersImpl.js} +12 -10
- package/src/{vcs/vcm/layer/openlayers/vectorOpenlayers.js → layer/openlayers/vectorOpenlayersImpl.js} +21 -12
- package/src/{vcs/vcm/layer/openlayers/vectorTileOpenlayers.js → layer/openlayers/vectorTileOpenlayersImpl.js} +18 -12
- package/src/{vcs/vcm/layer/openlayers/wmsOpenlayers.js → layer/openlayers/wmsOpenlayersImpl.js} +9 -8
- package/src/{vcs/vcm/layer/openlayers/wmtsOpenlayers.js → layer/openlayers/wmtsOpenlayersImpl.js} +19 -12
- package/src/{vcs/vcm/layer/pointCloud.js → layer/pointCloudLayer.js} +42 -39
- package/src/{vcs/vcm/layer → layer}/rasterLayer.js +86 -37
- package/src/{vcs/vcm/layer/singleImage.js → layer/singleImageLayer.js} +25 -22
- package/src/layer/terrainHelpers.js +98 -0
- package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +26 -18
- package/src/{vcs/vcm/layer → layer}/tileLoadedHelper.js +13 -8
- package/src/{vcs/vcm/layer → layer}/tileProvider/mvtTileProvider.js +51 -8
- package/src/layer/tileProvider/staticGeojsonTileProvider.js +87 -0
- package/src/{vcs/vcm/layer → layer}/tileProvider/tileProvider.js +200 -89
- package/src/{vcs/vcm/layer → layer}/tileProvider/urlTemplateTileProvider.js +54 -13
- package/src/{vcs/vcm/layer/tms.js → layer/tmsLayer.js} +22 -22
- package/src/layer/vectorHelpers.js +129 -0
- package/src/{vcs/vcm/layer/vector.js → layer/vectorLayer.js} +124 -94
- package/src/{vcs/vcm/layer → layer}/vectorProperties.js +419 -107
- package/src/{vcs/vcm/layer → layer}/vectorSymbols.js +11 -1
- package/src/{vcs/vcm/layer/vectorTile.js → layer/vectorTileLayer.js} +181 -116
- package/src/{vcs/vcm/layer/wfs.js → layer/wfsLayer.js} +33 -23
- package/src/{vcs/vcm/layer → layer}/wmsHelpers.js +14 -7
- package/src/{vcs/vcm/layer/wms.js → layer/wmsLayer.js} +53 -32
- package/src/{vcs/vcm/layer/wmts.js → layer/wmtsLayer.js} +56 -42
- package/src/{vcs/vcm/maps → map}/baseOLMap.js +83 -35
- package/src/{vcs/vcm/maps → map}/cameraLimiter.js +75 -32
- package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +429 -276
- package/src/{vcs/vcm/maps → map}/mapState.js +0 -1
- package/src/{vcs/vcm/maps/oblique.js → map/obliqueMap.js} +132 -97
- package/src/{vcs/vcm/maps/openlayers.js → map/openlayersMap.js} +69 -45
- package/src/{vcs/vcm/maps/map.js → map/vcsMap.js} +118 -46
- package/src/oblique/defaultObliqueCollection.js +62 -0
- package/src/{vcs/vcm/oblique → oblique}/helpers.js +221 -78
- package/src/{vcs/vcm/oblique/ObliqueCollection.js → oblique/obliqueCollection.js} +145 -54
- package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +62 -32
- package/src/{vcs/vcm/oblique/ObliqueImage.js → oblique/obliqueImage.js} +58 -26
- package/src/{vcs/vcm/oblique/ObliqueImageMeta.js → oblique/obliqueImageMeta.js} +9 -9
- package/src/{vcs/vcm/oblique/ObliqueProvider.js → oblique/obliqueProvider.js} +85 -35
- package/src/{vcs/vcm/oblique/ObliqueView.js → oblique/obliqueView.js} +45 -5
- package/src/{vcs/vcm/oblique/ObliqueViewDirection.js → oblique/obliqueViewDirection.js} +3 -5
- package/src/{vcs/vcm/oblique → oblique}/parseImageJson.js +62 -28
- package/src/ol/feature.js +34 -1
- package/src/ol/geom/circle.js +14 -5
- package/src/ol/geom/geometryCollection.js +14 -8
- package/src/ol/render/canvas/canvasTileRenderer.js +11 -10
- package/src/overrideClassRegistry.js +214 -0
- package/src/style/arcStyle.js +453 -0
- package/src/style/arrowStyle.js +304 -0
- package/src/{vcs/vcm/util/style → style}/declarativeStyleItem.js +147 -82
- package/src/{vcs/vcm/util/style → style}/shapesCategory.js +8 -8
- package/src/style/styleFactory.js +32 -0
- package/src/{vcs/vcm/util/style → style}/styleHelpers.js +24 -26
- package/src/style/styleItem.js +174 -0
- package/src/{vcs/vcm/util/style → style}/vectorStyleItem.js +230 -156
- package/src/{vcs/vcm/util/style → style}/writeStyle.js +7 -12
- package/src/{vcs/vcm/util → util}/clipping/clippingObject.js +84 -52
- package/src/{vcs/vcm/util → util}/clipping/clippingObjectManager.js +56 -23
- package/src/{vcs/vcm/util → util}/clipping/clippingPlaneHelper.js +149 -88
- package/src/{vcs/vcm/util → util}/collection.js +28 -10
- package/src/util/editor/createFeatureSession.js +195 -0
- package/src/util/editor/editFeaturesSession.js +325 -0
- package/src/util/editor/editGeometrySession.js +452 -0
- package/src/util/editor/editorHelpers.js +300 -0
- package/src/util/editor/editorSessionHelpers.js +132 -0
- package/src/util/editor/editorSymbols.js +21 -0
- package/src/util/editor/interactions/createBBoxInteraction.js +154 -0
- package/src/util/editor/interactions/createCircleInteraction.js +119 -0
- package/src/util/editor/interactions/createLineStringInteraction.js +119 -0
- package/src/util/editor/interactions/createPointInteraction.js +73 -0
- package/src/util/editor/interactions/createPolygonInteraction.js +136 -0
- package/src/util/editor/interactions/editFeaturesMouseOverInteraction.js +88 -0
- package/src/util/editor/interactions/editGeometryMouseOverInteraction.js +119 -0
- package/src/util/editor/interactions/ensureHandlerSelectionInteraction.js +50 -0
- package/src/util/editor/interactions/insertVertexInteraction.js +103 -0
- package/src/util/editor/interactions/mapInteractionController.js +119 -0
- package/src/util/editor/interactions/removeVertexInteraction.js +42 -0
- package/src/util/editor/interactions/selectFeatureMouseOverInteraction.js +152 -0
- package/src/util/editor/interactions/selectMultiFeatureInteraction.js +165 -0
- package/src/util/editor/interactions/selectSingleFeatureInteraction.js +120 -0
- package/src/util/editor/interactions/translateVertexInteraction.js +60 -0
- package/src/util/editor/selectFeaturesSession.js +303 -0
- package/src/util/editor/transformation/create2DHandlers.js +339 -0
- package/src/util/editor/transformation/create3DHandlers.js +678 -0
- package/src/util/editor/transformation/extrudeInteraction.js +106 -0
- package/src/util/editor/transformation/rotateInteraction.js +201 -0
- package/src/util/editor/transformation/scaleInteraction.js +201 -0
- package/src/util/editor/transformation/transformationHandler.js +178 -0
- package/src/util/editor/transformation/transformationTypes.js +88 -0
- package/src/util/editor/transformation/translateInteraction.js +263 -0
- package/src/util/editor/validateGeoemetry.js +24 -0
- package/src/{vcs/vcm/util → util}/exclusiveManager.js +6 -3
- package/src/{vcs/vcm/util → util}/extent.js +26 -20
- package/src/util/featureconverter/arcToCesium.js +121 -0
- package/src/{vcs/vcm/util → util}/featureconverter/circleToCesium.js +70 -37
- package/src/{vcs/vcm/util → util}/featureconverter/convert.js +94 -16
- package/src/util/featureconverter/extent3D.js +284 -0
- package/src/{vcs/vcm/util → util}/featureconverter/featureconverterHelper.js +253 -94
- package/src/util/featureconverter/lineStringToCesium.js +343 -0
- package/src/util/featureconverter/pointHelpers.js +413 -0
- package/src/{vcs/vcm/util → util}/featureconverter/pointToCesium.js +157 -107
- package/src/{vcs/vcm/util → util}/featureconverter/polygonToCesium.js +57 -24
- package/src/util/fetch.js +34 -0
- package/src/{vcs/vcm/util → util}/geometryHelpers.js +25 -17
- package/src/{vcs/vcm/util → util}/indexedCollection.js +27 -8
- package/src/{vcs/vcm/util → util}/isMobile.js +8 -2
- package/src/{vcs/vcm/util → util}/layerCollection.js +109 -19
- package/src/util/locale.js +12 -0
- package/src/{vcs/vcm/util → util}/mapCollection.js +170 -63
- package/src/util/math.js +193 -0
- package/src/util/overrideCollection.js +261 -0
- package/src/{vcs/vcm/util → util}/projection.js +23 -31
- package/src/{vcs/vcm/util → util}/urlHelpers.js +5 -3
- package/src/{vcs/vcm/util → util}/viewpoint.js +83 -57
- package/src/vcsApp.js +657 -0
- package/src/{vcs/vcm/event/vcsEvent.js → vcsEvent.js} +2 -3
- package/src/vcsModule.js +130 -0
- package/src/vcsModuleHelpers.js +136 -0
- package/src/{vcs/vcm/object.js → vcsObject.js} +3 -10
- package/tests/data/dynamicPointCzml.json +53 -0
- package/tests/data/oblique/imageData/imagev34.json +136 -0
- package/tests/data/oblique/imageData/imagev35.json +307 -0
- package/tests/data/oblique/imageData/imagev35PerImageSize.json +333 -0
- package/tests/data/oblique/tiledImageData/12/2199/1342.json +11056 -0
- package/tests/data/oblique/tiledImageData/12/2199/1343.json +11236 -0
- package/tests/data/oblique/tiledImageData/12/2199/1344.json +11077 -0
- package/tests/data/oblique/tiledImageData/12/2200/1342.json +11036 -0
- package/tests/data/oblique/tiledImageData/12/2200/1343.json +11277 -0
- package/tests/data/oblique/tiledImageData/12/2200/1344.json +11131 -0
- package/tests/data/oblique/tiledImageData/12/2201/1342.json +10870 -0
- package/tests/data/oblique/tiledImageData/12/2201/1343.json +11492 -0
- package/tests/data/oblique/tiledImageData/12/2201/1344.json +10909 -0
- package/tests/data/oblique/tiledImageData/image.json +70 -0
- package/tests/data/terrain/13/8800/6485.terrain +0 -0
- package/tests/data/terrain/13/8800/6486.terrain +0 -0
- package/tests/data/terrain/13/8801/6485.terrain +0 -0
- package/tests/data/terrain/13/8801/6486.terrain +0 -0
- package/tests/data/terrain/layer.json +127 -0
- package/tests/data/testGeoJSON.json +149 -0
- package/tests/data/tile.pbf +0 -0
- package/tests/unit/helpers/cesiumHelpers.js +326 -0
- package/tests/unit/helpers/getFileNameFromUrl.js +12 -0
- package/tests/unit/helpers/helpers.js +32 -0
- package/tests/unit/helpers/imageHelpers.js +24 -0
- package/tests/unit/helpers/importJSON.js +15 -0
- package/tests/unit/helpers/obliqueData.js +102 -0
- package/tests/unit/helpers/obliqueHelpers.js +115 -0
- package/tests/unit/helpers/openlayersHelpers.js +25 -0
- package/tests/unit/helpers/terrain/terrainData.js +47 -0
- package/src/vcs/vcm/classRegistry.js +0 -106
- package/src/vcs/vcm/globalCollections.js +0 -11
- package/src/vcs/vcm/interaction/featureProviderInteraction.js +0 -54
- package/src/vcs/vcm/layer/buildings.js +0 -17
- package/src/vcs/vcm/layer/cesium/openStreetMapCesium.js +0 -29
- package/src/vcs/vcm/layer/cesium/pointCloudCesium.js +0 -58
- package/src/vcs/vcm/layer/cesium/vectorContext.js +0 -167
- package/src/vcs/vcm/layer/openlayers/layerOpenlayers.js +0 -79
- package/src/vcs/vcm/layer/openlayers/openStreetMapOpenlayers.js +0 -27
- package/src/vcs/vcm/layer/openlayers/rasterLayerOpenlayers.js +0 -121
- package/src/vcs/vcm/layer/terrainHelpers.js +0 -119
- package/src/vcs/vcm/layer/tileProvider/staticGeojsonTileProvider.js +0 -67
- package/src/vcs/vcm/layer/tileProvider/tileProviderFactory.js +0 -28
- package/src/vcs/vcm/layer/vectorHelpers.js +0 -206
- package/src/vcs/vcm/util/dateTime.js +0 -60
- package/src/vcs/vcm/util/featureProvider/featureProviderHelpers.js +0 -51
- package/src/vcs/vcm/util/featureconverter/extent3d.js +0 -154
- package/src/vcs/vcm/util/featureconverter/lineStringToCesium.js +0 -171
- package/src/vcs/vcm/util/locale.js +0 -53
- package/src/vcs/vcm/util/math.js +0 -71
- package/src/vcs/vcm/util/splitScreen.js +0 -233
- package/src/vcs/vcm/util/style/styleFactory.js +0 -48
- package/src/vcs/vcm/util/style/styleItem.js +0 -243
- /package/src/{vcs/vcm/util/featureProvider → featureProvider}/featureProviderSymbols.js +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { circular } from 'ol/geom/Polygon.js';
|
|
2
|
-
import GeometryType from 'ol/geom/GeometryType.js';
|
|
3
2
|
import {
|
|
4
3
|
Cartesian3,
|
|
5
4
|
CircleGeometry,
|
|
@@ -8,7 +7,7 @@ import {
|
|
|
8
7
|
Math as CesiumMath,
|
|
9
8
|
Cartographic,
|
|
10
9
|
PolylineGeometry,
|
|
11
|
-
} from '@vcmap/
|
|
10
|
+
} from '@vcmap-cesium/engine';
|
|
12
11
|
import { parseNumber } from '@vcsuite/parsers';
|
|
13
12
|
import { addPrimitivesToContext } from './featureconverterHelper.js';
|
|
14
13
|
import Projection from '../projection.js';
|
|
@@ -18,16 +17,23 @@ import Projection from '../projection.js';
|
|
|
18
17
|
* @param {number} height
|
|
19
18
|
* @param {boolean} perPositionHeight
|
|
20
19
|
* @param {number=} extrudedHeight
|
|
21
|
-
* @returns {Array<import("@vcmap/
|
|
20
|
+
* @returns {Array<import("@vcmap-cesium/engine").CircleGeometry>}
|
|
22
21
|
* @private
|
|
23
22
|
*/
|
|
24
|
-
export function createSolidGeometries(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
];
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
/**
|
|
@@ -35,23 +41,30 @@ export function createSolidGeometries(options, height, perPositionHeight, extrud
|
|
|
35
41
|
* @param {number} height
|
|
36
42
|
* @param {boolean} perPositionHeight
|
|
37
43
|
* @param {number=} extrudedHeight
|
|
38
|
-
* @returns {Array<import("@vcmap/
|
|
44
|
+
* @returns {Array<import("@vcmap-cesium/engine").CircleOutlineGeometry>}
|
|
39
45
|
* @private
|
|
40
46
|
*/
|
|
41
|
-
export function createOutlineGeometries(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
+
];
|
|
48
61
|
}
|
|
49
62
|
|
|
50
63
|
/**
|
|
51
64
|
* @param {Object} options
|
|
52
65
|
* @param {number} height
|
|
53
66
|
* @param {boolean} perPositionHeight
|
|
54
|
-
* @returns {Array<import("@vcmap/
|
|
67
|
+
* @returns {Array<import("@vcmap-cesium/engine").CircleGeometry>}
|
|
55
68
|
* @private
|
|
56
69
|
*/
|
|
57
70
|
export function createFillGeometries(options, height, perPositionHeight) {
|
|
@@ -74,11 +87,7 @@ export function getLineGeometryOptions(options, style) {
|
|
|
74
87
|
];
|
|
75
88
|
|
|
76
89
|
// circular returns polygon with GeometryLayout.XY
|
|
77
|
-
const circlePolygon = circular(
|
|
78
|
-
wgs84Center,
|
|
79
|
-
radius,
|
|
80
|
-
40,
|
|
81
|
-
);
|
|
90
|
+
const circlePolygon = circular(wgs84Center, radius, 40);
|
|
82
91
|
const pos = circlePolygon.getLinearRing(0).getCoordinates();
|
|
83
92
|
const positions = pos.map((coord) => {
|
|
84
93
|
return Cartesian3.fromDegrees(coord[0], coord[1], cartographic.height);
|
|
@@ -92,7 +101,7 @@ export function getLineGeometryOptions(options, style) {
|
|
|
92
101
|
/**
|
|
93
102
|
* @param {Object} options
|
|
94
103
|
* @param {import("ol/style/Style").default} style
|
|
95
|
-
* @returns {Array<import("@vcmap/
|
|
104
|
+
* @returns {Array<import("@vcmap-cesium/engine").GroundPolylineGeometry>}
|
|
96
105
|
* @private
|
|
97
106
|
*/
|
|
98
107
|
export function createGroundLineGeometries(options, style) {
|
|
@@ -103,7 +112,7 @@ export function createGroundLineGeometries(options, style) {
|
|
|
103
112
|
/**
|
|
104
113
|
* @param {Object} options
|
|
105
114
|
* @param {import("ol/style/Style").default} style
|
|
106
|
-
* @returns {Array<import("@vcmap/
|
|
115
|
+
* @returns {Array<import("@vcmap-cesium/engine").PolylineGeometry>}
|
|
107
116
|
* @private
|
|
108
117
|
*/
|
|
109
118
|
export function createLineGeometries(options, style) {
|
|
@@ -115,7 +124,7 @@ export function createLineGeometries(options, style) {
|
|
|
115
124
|
* extracts the center and radius from the CircleGeometry and converts it to Cartesian3/radius in m
|
|
116
125
|
* @param {import("ol/geom/Circle").default} geometry
|
|
117
126
|
* @param {number} positionHeightAdjustment
|
|
118
|
-
* @returns {{center: import("@vcmap/
|
|
127
|
+
* @returns {{center: import("@vcmap-cesium/engine").Cartesian3, radius: Number}}
|
|
119
128
|
* @private
|
|
120
129
|
*/
|
|
121
130
|
export function getGeometryOptions(geometry, positionHeightAdjustment) {
|
|
@@ -131,8 +140,16 @@ export function getGeometryOptions(geometry, positionHeightAdjustment) {
|
|
|
131
140
|
const wgs84Point = Projection.mercatorToWgs84(olPoint, true);
|
|
132
141
|
|
|
133
142
|
// Cesium coordinates of center and radius
|
|
134
|
-
const center = Cartesian3.fromDegrees(
|
|
135
|
-
|
|
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
|
+
);
|
|
136
153
|
|
|
137
154
|
// Computation of radius in Cesium 3D
|
|
138
155
|
const radius = Cartesian3.distance(center, point);
|
|
@@ -182,34 +199,50 @@ function getGeometryFactory() {
|
|
|
182
199
|
* @returns {boolean}
|
|
183
200
|
*/
|
|
184
201
|
export function validateCircle(circle) {
|
|
185
|
-
if (circle.getType() !==
|
|
202
|
+
if (circle.getType() !== 'Circle') {
|
|
186
203
|
return false;
|
|
187
204
|
}
|
|
188
205
|
const flatCoordinates = circle.getFlatCoordinates();
|
|
189
206
|
const stride = circle.getStride();
|
|
190
207
|
// needs at least one full coordinate + a radius value and a non 0 radius
|
|
191
|
-
if (
|
|
192
|
-
|
|
208
|
+
if (
|
|
209
|
+
flatCoordinates &&
|
|
210
|
+
flatCoordinates.length >= stride + 1 &&
|
|
211
|
+
flatCoordinates[stride] !== flatCoordinates[0]
|
|
212
|
+
) {
|
|
213
|
+
return flatCoordinates.every((value) => Number.isFinite(value));
|
|
193
214
|
}
|
|
194
215
|
return false;
|
|
195
216
|
}
|
|
196
217
|
|
|
197
|
-
|
|
198
218
|
/**
|
|
199
219
|
* @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
200
220
|
* @param {import("ol/style/Style").default} style
|
|
201
221
|
* @param {Array<import("ol/geom/Circle").default>} geometries
|
|
202
222
|
* @param {import("@vcmap/core").VectorProperties} vectorProperties
|
|
203
|
-
* @param {import("@vcmap/
|
|
223
|
+
* @param {import("@vcmap-cesium/engine").Scene} scene
|
|
204
224
|
* @param {import("@vcmap/core").VectorContext|import("@vcmap/core").ClusterContext} context
|
|
205
225
|
*/
|
|
206
|
-
export default function circleToCesium(
|
|
226
|
+
export default function circleToCesium(
|
|
227
|
+
feature,
|
|
228
|
+
style,
|
|
229
|
+
geometries,
|
|
230
|
+
vectorProperties,
|
|
231
|
+
scene,
|
|
232
|
+
context,
|
|
233
|
+
) {
|
|
207
234
|
if (!style.getFill() && !style.getStroke()) {
|
|
208
235
|
return;
|
|
209
236
|
}
|
|
210
237
|
const circleGeometryFactory = getGeometryFactory();
|
|
211
|
-
const validGeometries = geometries.filter(circle => validateCircle(circle));
|
|
238
|
+
const validGeometries = geometries.filter((circle) => validateCircle(circle));
|
|
212
239
|
addPrimitivesToContext(
|
|
213
|
-
feature,
|
|
240
|
+
feature,
|
|
241
|
+
style,
|
|
242
|
+
validGeometries,
|
|
243
|
+
vectorProperties,
|
|
244
|
+
scene,
|
|
245
|
+
circleGeometryFactory,
|
|
246
|
+
context,
|
|
214
247
|
);
|
|
215
248
|
}
|
|
@@ -11,33 +11,95 @@ import polygonToCesium from './polygonToCesium.js';
|
|
|
11
11
|
import circleToCesium from './circleToCesium.js';
|
|
12
12
|
import lineStringToCesium from './lineStringToCesium.js';
|
|
13
13
|
import pointToCesium from './pointToCesium.js';
|
|
14
|
+
import arcToCesium from './arcToCesium.js';
|
|
15
|
+
import ArcStyle, { featureArcStruct } from '../../style/arcStyle.js';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
17
19
|
* @param {import("ol/geom/Geometry").default} geometry
|
|
18
20
|
* @param {import("ol/style/Style").default} style
|
|
19
21
|
* @param {import("@vcmap/core").VectorProperties} vectorProperties
|
|
20
|
-
* @param {import("@vcmap/
|
|
22
|
+
* @param {import("@vcmap-cesium/engine").Scene} scene
|
|
21
23
|
* @param {import("@vcmap/core").VectorContext|import("@vcmap/core").ClusterContext} context
|
|
22
24
|
*/
|
|
23
|
-
function convertGeometry(
|
|
25
|
+
function convertGeometry(
|
|
26
|
+
feature,
|
|
27
|
+
geometry,
|
|
28
|
+
style,
|
|
29
|
+
vectorProperties,
|
|
30
|
+
scene,
|
|
31
|
+
context,
|
|
32
|
+
) {
|
|
24
33
|
if (geometry instanceof Point) {
|
|
25
34
|
pointToCesium(feature, style, [geometry], vectorProperties, scene, context);
|
|
26
35
|
} else if (geometry instanceof Polygon) {
|
|
27
|
-
polygonToCesium(
|
|
36
|
+
polygonToCesium(
|
|
37
|
+
feature,
|
|
38
|
+
style,
|
|
39
|
+
[geometry],
|
|
40
|
+
vectorProperties,
|
|
41
|
+
scene,
|
|
42
|
+
context,
|
|
43
|
+
);
|
|
28
44
|
} else if (geometry instanceof LineString) {
|
|
29
|
-
|
|
45
|
+
if (style instanceof ArcStyle && feature[featureArcStruct].coordinates) {
|
|
46
|
+
arcToCesium(feature, style, [geometry], vectorProperties, scene, context);
|
|
47
|
+
} else {
|
|
48
|
+
lineStringToCesium(
|
|
49
|
+
feature,
|
|
50
|
+
style,
|
|
51
|
+
[geometry],
|
|
52
|
+
vectorProperties,
|
|
53
|
+
scene,
|
|
54
|
+
context,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
30
57
|
} else if (geometry instanceof Circle) {
|
|
31
|
-
circleToCesium(
|
|
58
|
+
circleToCesium(
|
|
59
|
+
feature,
|
|
60
|
+
style,
|
|
61
|
+
[geometry],
|
|
62
|
+
vectorProperties,
|
|
63
|
+
scene,
|
|
64
|
+
context,
|
|
65
|
+
);
|
|
32
66
|
} else if (geometry instanceof MultiPoint) {
|
|
33
|
-
pointToCesium(
|
|
67
|
+
pointToCesium(
|
|
68
|
+
feature,
|
|
69
|
+
style,
|
|
70
|
+
geometry.getPoints(),
|
|
71
|
+
vectorProperties,
|
|
72
|
+
scene,
|
|
73
|
+
context,
|
|
74
|
+
);
|
|
34
75
|
} else if (geometry instanceof MultiPolygon) {
|
|
35
|
-
polygonToCesium(
|
|
76
|
+
polygonToCesium(
|
|
77
|
+
feature,
|
|
78
|
+
style,
|
|
79
|
+
geometry.getPolygons(),
|
|
80
|
+
vectorProperties,
|
|
81
|
+
scene,
|
|
82
|
+
context,
|
|
83
|
+
);
|
|
36
84
|
} else if (geometry instanceof MultiLineString) {
|
|
37
|
-
lineStringToCesium(
|
|
85
|
+
lineStringToCesium(
|
|
86
|
+
feature,
|
|
87
|
+
style,
|
|
88
|
+
geometry.getLineStrings(),
|
|
89
|
+
vectorProperties,
|
|
90
|
+
scene,
|
|
91
|
+
context,
|
|
92
|
+
);
|
|
38
93
|
} else if (geometry instanceof GeometryCollection) {
|
|
39
94
|
geometry.getGeometries().forEach((currentGeometry) => {
|
|
40
|
-
convertGeometry(
|
|
95
|
+
convertGeometry(
|
|
96
|
+
feature,
|
|
97
|
+
currentGeometry,
|
|
98
|
+
style,
|
|
99
|
+
vectorProperties,
|
|
100
|
+
scene,
|
|
101
|
+
context,
|
|
102
|
+
);
|
|
41
103
|
});
|
|
42
104
|
}
|
|
43
105
|
}
|
|
@@ -51,7 +113,9 @@ function convertGeometry(feature, geometry, style, vectorProperties, scene, cont
|
|
|
51
113
|
export function getStylesArray(style, feature, resolution = 1) {
|
|
52
114
|
const styles = [];
|
|
53
115
|
if (typeof style === 'function') {
|
|
54
|
-
styles.push(
|
|
116
|
+
styles.push(
|
|
117
|
+
...getStylesArray(style(feature, resolution), feature, resolution),
|
|
118
|
+
);
|
|
55
119
|
} else if (Array.isArray(style)) {
|
|
56
120
|
style.forEach((currentStyle) => {
|
|
57
121
|
styles.push(...getStylesArray(currentStyle, feature, resolution));
|
|
@@ -62,22 +126,36 @@ export function getStylesArray(style, feature, resolution = 1) {
|
|
|
62
126
|
return styles;
|
|
63
127
|
}
|
|
64
128
|
|
|
65
|
-
|
|
66
129
|
/**
|
|
67
130
|
* function to convert a feature to an array of Cesium.Primitives given a style and default properties. the resulting primitives
|
|
68
|
-
* must be added to the
|
|
131
|
+
* must be added to the modules collections here
|
|
69
132
|
* @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
70
133
|
* @param {import("ol/style/Style").StyleLike} style
|
|
71
134
|
* @param {import("@vcmap/core").VectorProperties} vectorProperties
|
|
72
135
|
* @param {import("@vcmap/core").VectorContext|import("@vcmap/core").ClusterContext} context
|
|
73
|
-
* @param {import("@vcmap/
|
|
136
|
+
* @param {import("@vcmap-cesium/engine").Scene} scene
|
|
74
137
|
*/
|
|
75
|
-
export default function convert(
|
|
138
|
+
export default function convert(
|
|
139
|
+
feature,
|
|
140
|
+
style,
|
|
141
|
+
vectorProperties,
|
|
142
|
+
context,
|
|
143
|
+
scene,
|
|
144
|
+
) {
|
|
76
145
|
const styles = getStylesArray(feature.getStyle() || style, feature, 0);
|
|
77
146
|
styles.forEach((currentStyle) => {
|
|
78
|
-
const geometry = /** @type {import("ol/geom/Geometry").default} */(
|
|
147
|
+
const geometry = /** @type {import("ol/geom/Geometry").default} */ (
|
|
148
|
+
currentStyle.getGeometryFunction()(feature)
|
|
149
|
+
);
|
|
79
150
|
if (geometry) {
|
|
80
|
-
convertGeometry(
|
|
151
|
+
convertGeometry(
|
|
152
|
+
feature,
|
|
153
|
+
geometry,
|
|
154
|
+
currentStyle,
|
|
155
|
+
vectorProperties,
|
|
156
|
+
scene,
|
|
157
|
+
context,
|
|
158
|
+
);
|
|
81
159
|
}
|
|
82
160
|
});
|
|
83
161
|
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { check } from '@vcsuite/check';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @class
|
|
5
|
+
*/
|
|
6
|
+
class Extent3D {
|
|
7
|
+
/**
|
|
8
|
+
* @param {Array<number>} array
|
|
9
|
+
* @returns {Extent3D}
|
|
10
|
+
*/
|
|
11
|
+
static fromArray(array) {
|
|
12
|
+
check(array, [Number]);
|
|
13
|
+
check(array.length, 6);
|
|
14
|
+
return new Extent3D(
|
|
15
|
+
array[0],
|
|
16
|
+
array[1],
|
|
17
|
+
array[2],
|
|
18
|
+
array[3],
|
|
19
|
+
array[4],
|
|
20
|
+
array[5],
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {import("ol/geom").Geometry} geometry
|
|
26
|
+
* @returns {Extent3D}
|
|
27
|
+
*/
|
|
28
|
+
static fromGeometry(geometry) {
|
|
29
|
+
const extent = new Extent3D();
|
|
30
|
+
extent.extendWithGeometry(geometry);
|
|
31
|
+
return extent;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {VectorHeightInfo} heightInfo
|
|
36
|
+
* @returns {Extent3D}
|
|
37
|
+
*/
|
|
38
|
+
static fromHeightInfo(heightInfo) {
|
|
39
|
+
const extent = new Extent3D();
|
|
40
|
+
extent.extendWithHeightInfo(heightInfo);
|
|
41
|
+
return extent;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {Array<import("ol/coordinate").Coordinate>} coordinates
|
|
46
|
+
* @returns {Extent3D}
|
|
47
|
+
*/
|
|
48
|
+
static fromCoordinates(coordinates) {
|
|
49
|
+
check(coordinates, [[Number]]);
|
|
50
|
+
|
|
51
|
+
const extent = new Extent3D();
|
|
52
|
+
coordinates.forEach((c) => {
|
|
53
|
+
extent.extendXYZ(c[0], c[1], c[2] ?? 0);
|
|
54
|
+
});
|
|
55
|
+
return extent;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @param {number} minX
|
|
60
|
+
* @param {number} minY
|
|
61
|
+
* @param {number} minZ
|
|
62
|
+
* @param {number} maxX
|
|
63
|
+
* @param {number} maxY
|
|
64
|
+
* @param {number} maxZ
|
|
65
|
+
*/
|
|
66
|
+
constructor(
|
|
67
|
+
minX = Infinity,
|
|
68
|
+
minY = Infinity,
|
|
69
|
+
minZ = Infinity,
|
|
70
|
+
maxX = -Infinity,
|
|
71
|
+
maxY = -Infinity,
|
|
72
|
+
maxZ = -Infinity,
|
|
73
|
+
) {
|
|
74
|
+
/**
|
|
75
|
+
* @type {number}
|
|
76
|
+
*/
|
|
77
|
+
this.minX = minX;
|
|
78
|
+
/**
|
|
79
|
+
* @type {number}
|
|
80
|
+
*/
|
|
81
|
+
this.minY = minY;
|
|
82
|
+
/**
|
|
83
|
+
* @type {number}
|
|
84
|
+
*/
|
|
85
|
+
this.minZ = minZ;
|
|
86
|
+
/**
|
|
87
|
+
* @type {number}
|
|
88
|
+
*/
|
|
89
|
+
this.maxX = maxX;
|
|
90
|
+
/**
|
|
91
|
+
* @type {number}
|
|
92
|
+
*/
|
|
93
|
+
this.maxY = maxY;
|
|
94
|
+
/**
|
|
95
|
+
* @type {number}
|
|
96
|
+
*/
|
|
97
|
+
this.maxZ = maxZ;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @param {import("ol/geom").Geometry} geometry
|
|
102
|
+
*/
|
|
103
|
+
extendWithGeometry(geometry) {
|
|
104
|
+
if (geometry.getType() === 'GeometryCollection') {
|
|
105
|
+
/** @type {import("ol/geom/GeometryCollection").default} */ (geometry)
|
|
106
|
+
.getGeometriesArray()
|
|
107
|
+
.forEach((geom) => {
|
|
108
|
+
this.extendWithGeometry(geom);
|
|
109
|
+
});
|
|
110
|
+
} else if (geometry.getType() === 'Circle') {
|
|
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();
|
|
117
|
+
const radius = flatCoordinates[stride] - flatCoordinates[0];
|
|
118
|
+
this.extendXY(flatCoordinates[0] - radius, flatCoordinates[1] - radius);
|
|
119
|
+
this.extendXY(flatCoordinates[0] + radius, flatCoordinates[1] + radius);
|
|
120
|
+
if (stride > 2) {
|
|
121
|
+
this.extendZ(flatCoordinates[2]);
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
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();
|
|
131
|
+
this.extendFlatCoordinates(flatCoordinates, stride);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @param {VectorHeightInfo} heightInfo
|
|
137
|
+
*/
|
|
138
|
+
extendWithHeightInfo(heightInfo) {
|
|
139
|
+
if (heightInfo.extruded) {
|
|
140
|
+
const calculatedFeatureMaxHeight =
|
|
141
|
+
heightInfo.groundLevel +
|
|
142
|
+
heightInfo.storeyHeightsAboveGround.reduce(
|
|
143
|
+
(accumulator, currentValue) => {
|
|
144
|
+
return accumulator + currentValue;
|
|
145
|
+
},
|
|
146
|
+
0,
|
|
147
|
+
);
|
|
148
|
+
this.extendZ(calculatedFeatureMaxHeight);
|
|
149
|
+
const calculatedFeatureMinHeight =
|
|
150
|
+
heightInfo.groundLevel -
|
|
151
|
+
heightInfo.storeyHeightsBelowGround.reduce(
|
|
152
|
+
(accumulator, currentValue) => {
|
|
153
|
+
return accumulator + currentValue;
|
|
154
|
+
},
|
|
155
|
+
0,
|
|
156
|
+
);
|
|
157
|
+
this.extendZ(calculatedFeatureMinHeight);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @param {number} x
|
|
163
|
+
* @param {number} y
|
|
164
|
+
* @param {number} z
|
|
165
|
+
*/
|
|
166
|
+
extendXYZ(x, y, z) {
|
|
167
|
+
this.minX = Math.min(this.minX, x);
|
|
168
|
+
this.minY = Math.min(this.minY, y);
|
|
169
|
+
this.minZ = Math.min(this.minZ, z);
|
|
170
|
+
this.maxX = Math.max(this.maxX, x);
|
|
171
|
+
this.maxY = Math.max(this.maxY, y);
|
|
172
|
+
this.maxZ = Math.max(this.maxZ, z);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @param {number} x
|
|
177
|
+
* @param {number} y
|
|
178
|
+
*/
|
|
179
|
+
extendXY(x, y) {
|
|
180
|
+
this.minX = Math.min(this.minX, x);
|
|
181
|
+
this.minY = Math.min(this.minY, y);
|
|
182
|
+
this.maxX = Math.max(this.maxX, x);
|
|
183
|
+
this.maxY = Math.max(this.maxY, y);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @param {number} z
|
|
188
|
+
*/
|
|
189
|
+
extendZ(z) {
|
|
190
|
+
this.minZ = Math.min(this.minZ, z);
|
|
191
|
+
this.maxZ = Math.max(this.maxZ, z);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @param {Array<number>} flatCoordinates
|
|
196
|
+
* @param {number} stride
|
|
197
|
+
*/
|
|
198
|
+
extendFlatCoordinates(flatCoordinates, stride) {
|
|
199
|
+
const { length } = flatCoordinates;
|
|
200
|
+
for (let offset = 0; offset < length; offset += stride) {
|
|
201
|
+
if (stride > 2) {
|
|
202
|
+
this.extendXYZ(
|
|
203
|
+
flatCoordinates[offset],
|
|
204
|
+
flatCoordinates[offset + 1],
|
|
205
|
+
flatCoordinates[offset + 2],
|
|
206
|
+
);
|
|
207
|
+
} else {
|
|
208
|
+
this.extendXY(flatCoordinates[offset], flatCoordinates[offset + 1]);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @returns {import("ol/extent").Extent}
|
|
215
|
+
*/
|
|
216
|
+
to2D() {
|
|
217
|
+
return [this.minX, this.minY, this.maxX, this.maxY];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @returns {Array<number>}
|
|
222
|
+
*/
|
|
223
|
+
toArray() {
|
|
224
|
+
return [this.minX, this.minY, this.minZ, this.maxX, this.maxY, this.maxZ];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @returns {boolean}
|
|
229
|
+
*/
|
|
230
|
+
isEmpty() {
|
|
231
|
+
return (
|
|
232
|
+
this.minX === Infinity &&
|
|
233
|
+
this.minY === Infinity &&
|
|
234
|
+
this.minZ === Infinity &&
|
|
235
|
+
this.maxX === -Infinity &&
|
|
236
|
+
this.maxY === -Infinity &&
|
|
237
|
+
this.maxZ === -Infinity
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* @returns {import("ol/coordinate").Coordinate}
|
|
243
|
+
*/
|
|
244
|
+
getCenter() {
|
|
245
|
+
if (this.isEmpty()) {
|
|
246
|
+
return [0, 0, 0];
|
|
247
|
+
}
|
|
248
|
+
return [
|
|
249
|
+
this.minX + (this.maxX - this.minX) / 2,
|
|
250
|
+
this.minY + (this.maxY - this.minY) / 2,
|
|
251
|
+
this.minZ + (this.maxZ - this.minZ) / 2,
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* @returns {Array<number>}
|
|
257
|
+
*/
|
|
258
|
+
getSize() {
|
|
259
|
+
if (this.isEmpty()) {
|
|
260
|
+
return [0, 0, 0];
|
|
261
|
+
}
|
|
262
|
+
return [
|
|
263
|
+
this.maxX - this.minX,
|
|
264
|
+
this.maxY - this.minY,
|
|
265
|
+
this.maxZ - this.minZ,
|
|
266
|
+
];
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* @returns {Extent3D}
|
|
271
|
+
*/
|
|
272
|
+
clone() {
|
|
273
|
+
return new Extent3D(
|
|
274
|
+
this.minX,
|
|
275
|
+
this.minY,
|
|
276
|
+
this.minZ,
|
|
277
|
+
this.maxX,
|
|
278
|
+
this.maxY,
|
|
279
|
+
this.maxZ,
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export default Extent3D;
|