@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,206 +0,0 @@
|
|
|
1
|
-
import { unByKey } from 'ol/Observable.js';
|
|
2
|
-
import Feature from 'ol/Feature.js';
|
|
3
|
-
import GeometryType from 'ol/geom/GeometryType.js';
|
|
4
|
-
import { HeightReference } from '@vcmap/cesium';
|
|
5
|
-
import { FeatureVisibilityAction } from './featureVisibility.js';
|
|
6
|
-
import Projection from '../util/projection.js';
|
|
7
|
-
import { getHeightInfo } from '../util/featureconverter/featureconverterHelper.js';
|
|
8
|
-
import { getFlatCoordinatesFromGeometry } from '../util/geometryHelpers.js';
|
|
9
|
-
import { createOrUpdateFromGeometry, createOrUpdateFromHeightInfo } from '../util/featureconverter/extent3d.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Added to ol.source.Vector to determine, when the source has last had an update to its features visibility.
|
|
13
|
-
* @type {symbol}
|
|
14
|
-
*/
|
|
15
|
-
export const fvLastUpdated = Symbol('FVlastUpdated');
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Added to ol.source.Vector to determine, when the source has last had an update to its features global visibility.
|
|
19
|
-
* @type {symbol}
|
|
20
|
-
*/
|
|
21
|
-
export const globalHiderLastUpdated = Symbol('GlobalHiderLastUpdated');
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {import("@vcmap/core").FeatureVisibility} featureVisibility
|
|
25
|
-
* @param {import("ol/source").Vector<import("ol/geom/Geometry").default>} source
|
|
26
|
-
*/
|
|
27
|
-
export function updateFeatureVisibility(featureVisibility, source) {
|
|
28
|
-
Object.keys(featureVisibility.highlightedObjects)
|
|
29
|
-
.forEach((id) => {
|
|
30
|
-
const feat = source.getFeatureById(id);
|
|
31
|
-
if (feat && !featureVisibility.hasHighlightFeature(id, feat)) {
|
|
32
|
-
featureVisibility.addHighlightFeature(id, feat);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
Object.keys(featureVisibility.hiddenObjects)
|
|
37
|
-
.forEach((id) => {
|
|
38
|
-
const feat = source.getFeatureById(id);
|
|
39
|
-
if (feat && !featureVisibility.hasHiddenFeature(id, feat)) {
|
|
40
|
-
featureVisibility.addHiddenFeature(id, feat);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
source[fvLastUpdated] = Date.now();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @param {import("@vcmap/core").GlobalHider} globalHider
|
|
48
|
-
* @param {import("ol/source").Vector<import("ol/geom/Geometry").default>} source
|
|
49
|
-
*/
|
|
50
|
-
export function updateGlobalHider(globalHider, source) {
|
|
51
|
-
Object.keys(globalHider.hiddenObjects)
|
|
52
|
-
.forEach((id) => {
|
|
53
|
-
const feat = source.getFeatureById(id);
|
|
54
|
-
if (feat && !globalHider.hasFeature(id, feat)) {
|
|
55
|
-
globalHider.addFeature(id, feat);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
source[globalHiderLastUpdated] = Date.now();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @param {import("@vcmap/core").FeatureVisibility} featureVisibility
|
|
63
|
-
* @param {import("ol/source").Vector<import("ol/geom/Geometry").default>} source
|
|
64
|
-
* @param {import("@vcmap/core").GlobalHider} globalHider
|
|
65
|
-
* @returns {Array<Function>}
|
|
66
|
-
*/
|
|
67
|
-
export function synchronizeFeatureVisibilityWithSource(featureVisibility, source, globalHider) {
|
|
68
|
-
const sourceListener = source.on('addfeature', ({ feature }) => {
|
|
69
|
-
const id = feature.getId();
|
|
70
|
-
if (featureVisibility.highlightedObjects[id]) {
|
|
71
|
-
featureVisibility.addHighlightFeature(id, feature);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (featureVisibility.hiddenObjects[id]) {
|
|
75
|
-
featureVisibility.addHiddenFeature(id, feature);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (globalHider.hiddenObjects[id]) {
|
|
79
|
-
globalHider.addFeature(id, feature);
|
|
80
|
-
}
|
|
81
|
-
const now = Date.now();
|
|
82
|
-
source[fvLastUpdated] = now;
|
|
83
|
-
source[globalHiderLastUpdated] = now;
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
if (!source[fvLastUpdated] || source[fvLastUpdated] < featureVisibility.lastUpdated) {
|
|
87
|
-
updateFeatureVisibility(featureVisibility, source);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (!source[globalHiderLastUpdated] || source[globalHiderLastUpdated] < featureVisibility.lastUpdated) {
|
|
91
|
-
updateGlobalHider(globalHider, source);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return [
|
|
95
|
-
featureVisibility.changed.addEventListener(({ action, ids }) => {
|
|
96
|
-
if (action === FeatureVisibilityAction.HIGHLIGHT) {
|
|
97
|
-
ids.forEach((id) => {
|
|
98
|
-
const feat = source.getFeatureById(id);
|
|
99
|
-
if (feat) {
|
|
100
|
-
featureVisibility.addHighlightFeature(id, feat);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
source[fvLastUpdated] = Date.now();
|
|
104
|
-
} else if (action === FeatureVisibilityAction.HIDE) {
|
|
105
|
-
ids.forEach((id) => {
|
|
106
|
-
const feat = source.getFeatureById(id);
|
|
107
|
-
if (feat) {
|
|
108
|
-
featureVisibility.addHiddenFeature(id, feat);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
source[fvLastUpdated] = Date.now();
|
|
112
|
-
}
|
|
113
|
-
}),
|
|
114
|
-
globalHider.changed.addEventListener(({ action, ids }) => {
|
|
115
|
-
if (action === FeatureVisibilityAction.HIDE) {
|
|
116
|
-
ids.forEach((id) => {
|
|
117
|
-
const feat = source.getFeatureById(id);
|
|
118
|
-
if (feat) {
|
|
119
|
-
globalHider.addFeature(id, feat);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
source[globalHiderLastUpdated] = Date.now();
|
|
123
|
-
}
|
|
124
|
-
}),
|
|
125
|
-
() => { unByKey(sourceListener); },
|
|
126
|
-
];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* @param {VectorClickedObject} object
|
|
131
|
-
* @param {import("@vcmap/core").Vector|import("@vcmap/core").VectorTile} layer
|
|
132
|
-
* @returns {?GenericFeature}
|
|
133
|
-
*/
|
|
134
|
-
export function getGenericFeatureFromClickedObject(object, layer) {
|
|
135
|
-
if (!(object instanceof Feature)) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
const attributes = object.getProperties();
|
|
139
|
-
delete attributes[object.getGeometryName()];
|
|
140
|
-
|
|
141
|
-
const { clickedPosition } = object;
|
|
142
|
-
if (!clickedPosition) {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
let { latitude, longitude } = clickedPosition;
|
|
146
|
-
const geometry = object.getGeometry();
|
|
147
|
-
let heightOffset = clickedPosition.height;
|
|
148
|
-
let calculateHeight = !heightOffset;
|
|
149
|
-
if (!geometry) {
|
|
150
|
-
calculateHeight = false; // we cannot calculate the height without geometry;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
let relativeToGround = !heightOffset;
|
|
154
|
-
// Edge Case ClickedPosition is next to the feature and Feature got detected in clickToleranz.
|
|
155
|
-
// if the clicked Position does not intersect the feature the closestPoint will be used.
|
|
156
|
-
// also if the clickedPosition is not on the Feature we do not trust the Height Value;
|
|
157
|
-
const mercatorPoint =
|
|
158
|
-
Projection.wgs84ToMercator([clickedPosition.longitude, clickedPosition.latitude, clickedPosition.height]);
|
|
159
|
-
if (geometry && !geometry.intersectsCoordinate(mercatorPoint)) {
|
|
160
|
-
const closestPoint = geometry.getClosestPoint(mercatorPoint);
|
|
161
|
-
[longitude, latitude] = Projection.mercatorToWgs84(closestPoint);
|
|
162
|
-
calculateHeight = true;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// edge case oblique in this case we do get a height value but not of the feature but the underlying terrain.
|
|
166
|
-
// this is necessary to calculate the correct position of the balloon
|
|
167
|
-
|
|
168
|
-
// if we do not have a height value from the clickedPosition we calculate the height based in the feature;
|
|
169
|
-
if (calculateHeight) {
|
|
170
|
-
const coordinates = getFlatCoordinatesFromGeometry(geometry);
|
|
171
|
-
const heightInfo = getHeightInfo(object, layer.vectorProperties, coordinates);
|
|
172
|
-
if (heightInfo.perPositionHeight || heightInfo.extruded) {
|
|
173
|
-
const extent = createOrUpdateFromGeometry(geometry);
|
|
174
|
-
createOrUpdateFromHeightInfo(heightInfo, extent);
|
|
175
|
-
heightOffset = extent[5];
|
|
176
|
-
}
|
|
177
|
-
// edge case points are rendered depending on the terrain, so we set relativeToGround to true.
|
|
178
|
-
// In this case the heightAboveGroundAdjustment is also just an Offset.
|
|
179
|
-
if (
|
|
180
|
-
!heightInfo.extruded &&
|
|
181
|
-
(geometry.getType() === GeometryType.POINT || geometry.getType() === GeometryType.MULTI_POINT) &&
|
|
182
|
-
(
|
|
183
|
-
heightInfo.heightReference === HeightReference.RELATIVE_TO_GROUND ||
|
|
184
|
-
heightInfo.heightReference === HeightReference.CLAMP_TO_GROUND)
|
|
185
|
-
) {
|
|
186
|
-
heightOffset = heightInfo.heightAboveGroundAdjustment;
|
|
187
|
-
relativeToGround = true;
|
|
188
|
-
} else {
|
|
189
|
-
heightOffset += heightInfo.heightAboveGroundAdjustment;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// if we have to calculate the height we have to take heightAboveGround into account
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
delete attributes.clickedPosition;
|
|
196
|
-
heightOffset = Number.isFinite(heightOffset) ? heightOffset : 0;
|
|
197
|
-
return {
|
|
198
|
-
layerName: layer.name,
|
|
199
|
-
layerClass: layer.className,
|
|
200
|
-
attributes: { ...layer.genericFeatureProperties, ...attributes },
|
|
201
|
-
longitude,
|
|
202
|
-
latitude,
|
|
203
|
-
height: heightOffset + layer.balloonHeightOffset,
|
|
204
|
-
relativeToGround,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param {Date} date
|
|
3
|
-
* @param {string=} locale
|
|
4
|
-
* @returns {string}
|
|
5
|
-
*/
|
|
6
|
-
export function getShortLocaleDate(date, locale) {
|
|
7
|
-
// dateStyle is not within the standard yet
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
return new Intl.DateTimeFormat(locale, { dateStyle: 'short' }).format(date);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param {Date} date
|
|
14
|
-
* @param {string=} locale
|
|
15
|
-
* @returns {string}
|
|
16
|
-
*/
|
|
17
|
-
export function getShortLocaleTime(date, locale) {
|
|
18
|
-
// timeStyle is not within the standard yet
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
return new Intl.DateTimeFormat(locale, { timeStyle: 'short' }).format(date);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {Date} date
|
|
25
|
-
* @returns {string}
|
|
26
|
-
*/
|
|
27
|
-
export function getISODateString(date) {
|
|
28
|
-
const month = date.getMonth() + 1;
|
|
29
|
-
const day = date.getDate();
|
|
30
|
-
return `${date.getFullYear()}-${month > 9 ? '' : 0}${month}-${day > 9 ? '' : 0}${day}`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @param {Date} date
|
|
35
|
-
* @returns {number}
|
|
36
|
-
*/
|
|
37
|
-
export function getDayOfYear(date) {
|
|
38
|
-
const start = new Date(date.getFullYear(), 0, 0);
|
|
39
|
-
// TS cant handle date manipulation
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
const diff = (date - start) + ((start.getTimezoneOffset() - date.getTimezoneOffset()) * 60 * 1000);
|
|
42
|
-
const oneDay = 1000 * 60 * 60 * 24;
|
|
43
|
-
return Math.floor(diff / oneDay);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @param {Date} date
|
|
48
|
-
* @returns {boolean}
|
|
49
|
-
*/
|
|
50
|
-
export function isLeapYear(date) {
|
|
51
|
-
const currentYear = date.getFullYear();
|
|
52
|
-
if (currentYear % 4 !== 0) {
|
|
53
|
-
return false;
|
|
54
|
-
} else if (currentYear % 100 !== 0) {
|
|
55
|
-
return true;
|
|
56
|
-
} else if (currentYear % 400 !== 0) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { getCenter } from 'ol/extent.js';
|
|
2
|
-
import Projection from '../projection.js';
|
|
3
|
-
import { createOrUpdateFromGeometry } from '../featureconverter/extent3d.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @param {VectorClickedObject} feature
|
|
7
|
-
* @param {import("@vcmap/core").Layer} layer
|
|
8
|
-
* @returns {?GenericFeature}
|
|
9
|
-
*/
|
|
10
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
11
|
-
export function getGenericFeatureFromProvidedFeature(feature, layer) {
|
|
12
|
-
const attributes = feature.getProperties();
|
|
13
|
-
delete attributes[feature.getGeometryName()];
|
|
14
|
-
|
|
15
|
-
let { clickedPosition } = feature;
|
|
16
|
-
const geometry = feature.getGeometry();
|
|
17
|
-
const isModel = feature.get('olcs_modelUrl');
|
|
18
|
-
if (
|
|
19
|
-
geometry &&
|
|
20
|
-
(
|
|
21
|
-
(geometry.getType() === 'Point' && !isModel) ||
|
|
22
|
-
(clickedPosition && !clickedPosition.exactPosition) ||
|
|
23
|
-
(!clickedPosition && geometry)
|
|
24
|
-
)
|
|
25
|
-
) {
|
|
26
|
-
const center = getCenter(geometry.getExtent());
|
|
27
|
-
if (center) {
|
|
28
|
-
Projection.mercatorToWgs84(center, true);
|
|
29
|
-
clickedPosition = { longitude: center[0], latitude: center[1] };
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let heightOffset = clickedPosition.height;
|
|
34
|
-
if (!isModel) {
|
|
35
|
-
const extent = createOrUpdateFromGeometry(geometry);
|
|
36
|
-
const max = Number.isFinite(extent[5]) ? extent[5] : 0;
|
|
37
|
-
heightOffset = max;
|
|
38
|
-
}
|
|
39
|
-
const relativeToGround = !isModel && feature.get('olcs_altitudeMode') === 'relativeToGround';
|
|
40
|
-
|
|
41
|
-
delete attributes.clickedPosition;
|
|
42
|
-
return {
|
|
43
|
-
layerName: layer.name,
|
|
44
|
-
layerClass: layer.className,
|
|
45
|
-
attributes,
|
|
46
|
-
longitude: clickedPosition.longitude,
|
|
47
|
-
latitude: clickedPosition.latitude,
|
|
48
|
-
height: heightOffset,
|
|
49
|
-
relativeToGround,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import GeometryType from 'ol/geom/GeometryType.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Create an empty extent.
|
|
5
|
-
* @returns {Array<number>} Empty extent.
|
|
6
|
-
*/
|
|
7
|
-
export function createEmpty3D() {
|
|
8
|
-
return [Infinity, Infinity, Infinity, -Infinity, -Infinity, -Infinity];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Create a new extent or update the provided extent.
|
|
13
|
-
* @param {number} minX Minimum X.
|
|
14
|
-
* @param {number} minY Minimum Y.
|
|
15
|
-
* @param {number} minZ Minimum Z.
|
|
16
|
-
* @param {number} maxX Maximum X.
|
|
17
|
-
* @param {number} maxY Maximum Y.
|
|
18
|
-
* @param {number} maxZ Maximum Z.
|
|
19
|
-
* @param {Array<number>=} optExtent Destination extent.
|
|
20
|
-
* @returns {Array<number>} Extent.
|
|
21
|
-
*/
|
|
22
|
-
export function createOrUpdate3D(minX, minY, minZ, maxX, maxY, maxZ, optExtent) {
|
|
23
|
-
if (optExtent) {
|
|
24
|
-
optExtent[0] = minX;
|
|
25
|
-
optExtent[1] = minY;
|
|
26
|
-
optExtent[2] = minZ;
|
|
27
|
-
optExtent[3] = maxX;
|
|
28
|
-
optExtent[4] = maxY;
|
|
29
|
-
optExtent[5] = maxZ;
|
|
30
|
-
return optExtent;
|
|
31
|
-
} else {
|
|
32
|
-
return [minX, minY, minZ, maxX, maxY, maxZ];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @param {Array<number>} extent Extent.
|
|
38
|
-
* @param {number} x X.
|
|
39
|
-
* @param {number} y Y.
|
|
40
|
-
* @param {number} z Z.
|
|
41
|
-
*/
|
|
42
|
-
export function extendXYZ(extent, x, y, z) {
|
|
43
|
-
extent[0] = Math.min(extent[0], x);
|
|
44
|
-
extent[1] = Math.min(extent[1], y);
|
|
45
|
-
extent[2] = Math.min(extent[2], z);
|
|
46
|
-
extent[3] = Math.max(extent[3], x);
|
|
47
|
-
extent[4] = Math.max(extent[4], y);
|
|
48
|
-
extent[5] = Math.max(extent[5], z);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* @param {Array<number>} extent Extent.
|
|
52
|
-
* @param {number} x X.
|
|
53
|
-
* @param {number} y Y.
|
|
54
|
-
*/
|
|
55
|
-
export function extendXY(extent, x, y) {
|
|
56
|
-
extent[0] = Math.min(extent[0], x);
|
|
57
|
-
extent[1] = Math.min(extent[1], y);
|
|
58
|
-
extent[3] = Math.max(extent[3], x);
|
|
59
|
-
extent[4] = Math.max(extent[4], y);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @param {Array<number>} extent Extent.
|
|
64
|
-
* @param {number} z Z.
|
|
65
|
-
*/
|
|
66
|
-
export function extendZ(extent, z) {
|
|
67
|
-
extent[2] = Math.min(extent[2], z);
|
|
68
|
-
extent[5] = Math.max(extent[5], z);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @param {Array<number>} extent Extent.
|
|
73
|
-
* @param {Array<number>} flatCoordinates Flat coordinates.
|
|
74
|
-
* @param {number} stride Stride.
|
|
75
|
-
* @returns {Array<number>} Extent.
|
|
76
|
-
*/
|
|
77
|
-
export function extendFlatCoordinates(
|
|
78
|
-
extent,
|
|
79
|
-
flatCoordinates,
|
|
80
|
-
stride,
|
|
81
|
-
) {
|
|
82
|
-
const { length } = flatCoordinates;
|
|
83
|
-
for (let offset = 0; offset < length; offset += stride) {
|
|
84
|
-
if (stride > 2) {
|
|
85
|
-
extendXYZ(extent, flatCoordinates[offset], flatCoordinates[offset + 1], flatCoordinates[offset + 2]);
|
|
86
|
-
} else {
|
|
87
|
-
extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return extent;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @param {import("ol/geom/Geometry").default} geometry Geometry.
|
|
95
|
-
* @param {Array<number>=} optExtent Extent.
|
|
96
|
-
* @returns {Array<number>} Extent.
|
|
97
|
-
*/
|
|
98
|
-
export function createOrUpdateFromGeometry(geometry, optExtent) {
|
|
99
|
-
const extent = optExtent || createEmpty3D();
|
|
100
|
-
if (geometry.getType() === GeometryType.GEOMETRY_COLLECTION) {
|
|
101
|
-
/** @type {import("ol/geom/GeometryCollection").default} */ (geometry)
|
|
102
|
-
.getGeometriesArray().forEach((geom) => { createOrUpdateFromGeometry(geom, extent); });
|
|
103
|
-
} else if (geometry.getType() === GeometryType.CIRCLE) {
|
|
104
|
-
const flatCoordinates = /** @type {import("ol/geom/Circle").default} */ (geometry).getFlatCoordinates();
|
|
105
|
-
const stride = /** @type {import("ol/geom/Circle").default} */ (geometry).getStride();
|
|
106
|
-
const radius = flatCoordinates[stride] - flatCoordinates[0];
|
|
107
|
-
extendXY(
|
|
108
|
-
extent,
|
|
109
|
-
flatCoordinates[0] - radius,
|
|
110
|
-
flatCoordinates[1] - radius,
|
|
111
|
-
);
|
|
112
|
-
extendXY(
|
|
113
|
-
extent,
|
|
114
|
-
flatCoordinates[0] + radius,
|
|
115
|
-
flatCoordinates[1] + radius,
|
|
116
|
-
);
|
|
117
|
-
if (stride > 2) {
|
|
118
|
-
extendZ(extent, flatCoordinates[2]);
|
|
119
|
-
}
|
|
120
|
-
} else {
|
|
121
|
-
const flatCoordinates = /** @type {import("ol/geom/SimpleGeometry").default} */ (geometry).getFlatCoordinates();
|
|
122
|
-
const stride = /** @type {import("ol/geom/SimpleGeometry").default} */ (geometry).getStride();
|
|
123
|
-
extendFlatCoordinates(extent, flatCoordinates, stride);
|
|
124
|
-
}
|
|
125
|
-
return extent;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @param {VectorHeightInfo} heightInfo
|
|
130
|
-
* @param {Array<number>} optExtent
|
|
131
|
-
*/
|
|
132
|
-
export function createOrUpdateFromHeightInfo(heightInfo, optExtent) {
|
|
133
|
-
const extent = optExtent || createEmpty3D();
|
|
134
|
-
if (heightInfo.extruded) {
|
|
135
|
-
const calculatedFeatureMaxHeight =
|
|
136
|
-
heightInfo.groundLevel + heightInfo.storeyHeightsAboveGround.reduce((accumulator, currentValue) => {
|
|
137
|
-
return accumulator + currentValue;
|
|
138
|
-
}, 0);
|
|
139
|
-
extendZ(extent, calculatedFeatureMaxHeight);
|
|
140
|
-
const calculatedFeatureMinHeight =
|
|
141
|
-
heightInfo.groundLevel - heightInfo.storeyHeightsBelowGround.reduce((accumulator, currentValue) => {
|
|
142
|
-
return accumulator + currentValue;
|
|
143
|
-
}, 0);
|
|
144
|
-
extendZ(extent, calculatedFeatureMinHeight);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* @param {Array<number>} extent Extent.
|
|
150
|
-
* @returns {import("ol/extent").Extent} Extent.
|
|
151
|
-
*/
|
|
152
|
-
export function make2D(extent) {
|
|
153
|
-
return [extent[0], extent[1], extent[3], extent[4]];
|
|
154
|
-
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { Cartesian3, WallGeometry, WallOutlineGeometry, GroundPolylineGeometry, PolylineGeometry } from '@vcmap/cesium';
|
|
2
|
-
import GeometryType from 'ol/geom/GeometryType.js';
|
|
3
|
-
import { parseNumber } from '@vcsuite/parsers';
|
|
4
|
-
import Projection from '../projection.js';
|
|
5
|
-
import { addPrimitivesToContext } from './featureconverterHelper.js';
|
|
6
|
-
import { getFlatCoordinatesFromSimpleGeometry } from '../geometryHelpers.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @param {Object} options
|
|
10
|
-
* @param {number} height
|
|
11
|
-
* @param {boolean} perPositionHeight
|
|
12
|
-
* @param {number=} extrudedHeight
|
|
13
|
-
* @returns {Array<import("@vcmap/cesium").WallGeometry>}
|
|
14
|
-
* @private
|
|
15
|
-
*/
|
|
16
|
-
export function createSolidGeometries(options, height, perPositionHeight, extrudedHeight) {
|
|
17
|
-
return [WallGeometry.fromConstantHeights({
|
|
18
|
-
...options,
|
|
19
|
-
maximumHeight: !perPositionHeight ? height : undefined,
|
|
20
|
-
minimumHeight: extrudedHeight,
|
|
21
|
-
})];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @param {Object} options
|
|
26
|
-
* @param {number} height
|
|
27
|
-
* @param {boolean} perPositionHeight
|
|
28
|
-
* @param {number=} extrudedHeight
|
|
29
|
-
* @returns {Array<import("@vcmap/cesium").WallOutlineGeometry>}
|
|
30
|
-
* @private
|
|
31
|
-
*/
|
|
32
|
-
export function createOutlineGeometries(options, height, perPositionHeight, extrudedHeight) {
|
|
33
|
-
// maxium and minimum are flipped, to create the same perPositionHeight behaviour as in polygons
|
|
34
|
-
// WallGeometries extrudes down instead of up, so we switch the behaviour and extrude in the other direction
|
|
35
|
-
return [WallOutlineGeometry.fromConstantHeights({
|
|
36
|
-
...options,
|
|
37
|
-
maximumHeight: !perPositionHeight ? height : undefined,
|
|
38
|
-
minimumHeight: extrudedHeight,
|
|
39
|
-
})];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @param {Object} options
|
|
44
|
-
* @param {number} height
|
|
45
|
-
* @param {boolean} perPositionHeight
|
|
46
|
-
* @returns {Array}
|
|
47
|
-
* @private
|
|
48
|
-
*/
|
|
49
|
-
// eslint-disable-next-line no-unused-vars
|
|
50
|
-
export function createFillGeometries(options, height, perPositionHeight) {
|
|
51
|
-
return [];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @param {Object} options
|
|
57
|
-
* @param {import("ol/style/Style").default} style
|
|
58
|
-
* @returns {Array<import("@vcmap/cesium").GroundPolylineGeometry>}
|
|
59
|
-
* @private
|
|
60
|
-
*/
|
|
61
|
-
export function createGroundLineGeometries(options, style) {
|
|
62
|
-
const width = parseNumber(style.getStroke().getWidth(), 1.0);
|
|
63
|
-
return [new GroundPolylineGeometry({
|
|
64
|
-
...options,
|
|
65
|
-
width,
|
|
66
|
-
})];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @param {Object} options
|
|
71
|
-
* @param {import("ol/style/Style").default} style
|
|
72
|
-
* @returns {Array<import("@vcmap/cesium").PolylineGeometry>}
|
|
73
|
-
* @private
|
|
74
|
-
*/
|
|
75
|
-
export function createLineGeometries(options, style) {
|
|
76
|
-
const width = parseNumber(style.getStroke().getWidth(), 1.0);
|
|
77
|
-
return [new PolylineGeometry({
|
|
78
|
-
...options,
|
|
79
|
-
width,
|
|
80
|
-
})];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* extracts the center and radius from the CircleGeometry and converts it to Cartesian3/radius in m
|
|
85
|
-
* @param {import("ol/geom/LineString").default} geometry
|
|
86
|
-
* @param {number} positionHeightAdjustment
|
|
87
|
-
* @returns {Object}
|
|
88
|
-
* @private
|
|
89
|
-
*/
|
|
90
|
-
export function getGeometryOptions(geometry, positionHeightAdjustment) {
|
|
91
|
-
const coords = geometry.getCoordinates();
|
|
92
|
-
const positions = coords.map((coord) => {
|
|
93
|
-
const wgs84Coords = Projection.mercatorToWgs84(coord);
|
|
94
|
-
if (wgs84Coords[2] != null) {
|
|
95
|
-
wgs84Coords[2] += positionHeightAdjustment;
|
|
96
|
-
}
|
|
97
|
-
return Cartesian3.fromDegrees(wgs84Coords[0], wgs84Coords[1], wgs84Coords[2]);
|
|
98
|
-
});
|
|
99
|
-
return { positions };
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* @param {Array<import("ol/geom/LineString").default>} geometries
|
|
104
|
-
* @returns {Array<import("ol/coordinate").Coordinate>}
|
|
105
|
-
* @private
|
|
106
|
-
*/
|
|
107
|
-
export function getCoordinates(geometries) {
|
|
108
|
-
const coordinates = [];
|
|
109
|
-
geometries.forEach((lineString) => {
|
|
110
|
-
coordinates.push(...getFlatCoordinatesFromSimpleGeometry(lineString));
|
|
111
|
-
});
|
|
112
|
-
return coordinates;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @type {VectorGeometryFactoryType|null}
|
|
117
|
-
*/
|
|
118
|
-
let geometryFactory = null;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* @returns {VectorGeometryFactoryType}
|
|
122
|
-
*/
|
|
123
|
-
function getGeometryFactory() {
|
|
124
|
-
if (!geometryFactory) {
|
|
125
|
-
geometryFactory = {
|
|
126
|
-
getCoordinates,
|
|
127
|
-
getGeometryOptions,
|
|
128
|
-
createSolidGeometries,
|
|
129
|
-
createOutlineGeometries,
|
|
130
|
-
createFillGeometries,
|
|
131
|
-
createGroundLineGeometries,
|
|
132
|
-
createLineGeometries,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
return geometryFactory;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* validates if a lineString is renderable
|
|
140
|
-
* @param {import("ol/geom/LineString").default} lineString
|
|
141
|
-
* @returns {boolean}
|
|
142
|
-
*/
|
|
143
|
-
export function validateLineString(lineString) {
|
|
144
|
-
if (lineString.getType() !== GeometryType.LINE_STRING) {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
const flatCoordinates = lineString.getFlatCoordinates();
|
|
148
|
-
const minimumValues = lineString.getStride() * 2;
|
|
149
|
-
if (flatCoordinates && flatCoordinates.length >= minimumValues) {
|
|
150
|
-
return flatCoordinates.every(value => Number.isFinite(value));
|
|
151
|
-
}
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* converts a linestring to a a cesium primitive, with optional labels
|
|
157
|
-
* @param {import("ol").Feature<import("ol/geom/Geometry").default>} feature
|
|
158
|
-
* @param {import("ol/style/Style").default} style
|
|
159
|
-
* @param {Array<import("ol/geom/LineString").default>} geometries
|
|
160
|
-
* @param {import("@vcmap/core").VectorProperties} vectorProperties
|
|
161
|
-
* @param {import("@vcmap/cesium").Scene} scene
|
|
162
|
-
* @param {import("@vcmap/core").VectorContext|import("@vcmap/core").ClusterContext} context
|
|
163
|
-
*/
|
|
164
|
-
export default function lineStringToCesium(feature, style, geometries, vectorProperties, scene, context) {
|
|
165
|
-
if (!style.getFill() && !style.getStroke()) {
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const lineGeometryFactory = getGeometryFactory();
|
|
169
|
-
const validGeometries = geometries.filter(lineString => validateLineString(lineString));
|
|
170
|
-
addPrimitivesToContext(feature, style, validGeometries, vectorProperties, scene, lineGeometryFactory, context);
|
|
171
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import VcsEvent from '../event/vcsEvent.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @type {VcsEvent<string>}
|
|
5
|
-
*/
|
|
6
|
-
let localeChangedEvent;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @returns {VcsEvent<string>}
|
|
10
|
-
*/
|
|
11
|
-
export function getLocaleChangedEvent() {
|
|
12
|
-
if (!localeChangedEvent) {
|
|
13
|
-
localeChangedEvent = new VcsEvent();
|
|
14
|
-
}
|
|
15
|
-
return localeChangedEvent;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* returns the default browserLocale, if not possible 'en'
|
|
20
|
-
* @returns {string}
|
|
21
|
-
*/
|
|
22
|
-
export function detectBrowserLocale() {
|
|
23
|
-
if (navigator.language) {
|
|
24
|
-
const lang = navigator.language;
|
|
25
|
-
return lang.substring(0, 2);
|
|
26
|
-
}
|
|
27
|
-
return 'en';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @type {string}
|
|
32
|
-
*/
|
|
33
|
-
let currentLocale;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @returns {string}
|
|
37
|
-
*/
|
|
38
|
-
export function getCurrentLocale() {
|
|
39
|
-
if (!currentLocale) {
|
|
40
|
-
currentLocale = detectBrowserLocale();
|
|
41
|
-
}
|
|
42
|
-
return currentLocale;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @param {string} value
|
|
47
|
-
*/
|
|
48
|
-
export function setCurrentLocale(value) {
|
|
49
|
-
if (typeof value === 'string') {
|
|
50
|
-
currentLocale = value;
|
|
51
|
-
getLocaleChangedEvent().raiseEvent(value);
|
|
52
|
-
}
|
|
53
|
-
}
|