@vcmap/core 5.0.0-rc.3 → 5.0.0-rc.31
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 +3480 -2008
- 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} +83 -70
- 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} +8 -9
- 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 -112
- 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 +95 -0
- package/src/{vcs/vcm/layer/terrain.js → layer/terrainLayer.js} +28 -21
- 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 +64 -37
- package/src/{vcs/vcm/maps/cesium.js → map/cesiumMap.js} +431 -277
- 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} +151 -55
- package/src/{vcs/vcm/oblique/ObliqueDataSet.js → oblique/obliqueDataSet.js} +77 -46
- 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 +79 -49
- 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 +45 -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,4 +1,4 @@
|
|
|
1
|
-
import { offset } from 'ol/sphere.js';
|
|
1
|
+
import { offset as offsetSphere } from 'ol/sphere.js';
|
|
2
2
|
import Circle from 'ol/geom/Circle.js';
|
|
3
3
|
import Point from 'ol/geom/Point.js';
|
|
4
4
|
import LineString from 'ol/geom/LineString.js';
|
|
@@ -7,6 +7,7 @@ import MultiPoint from 'ol/geom/MultiPoint.js';
|
|
|
7
7
|
import MultiLineString from 'ol/geom/MultiLineString.js';
|
|
8
8
|
import MultiPolygon from 'ol/geom/MultiPolygon.js';
|
|
9
9
|
import GeometryCollection from 'ol/geom/GeometryCollection.js';
|
|
10
|
+
import { SimpleGeometry } from 'ol/geom.js';
|
|
10
11
|
import Projection from './projection.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -16,16 +17,15 @@ import Projection from './projection.js';
|
|
|
16
17
|
export function getFlatCoordinatesFromSimpleGeometry(geometry) {
|
|
17
18
|
const stride = geometry.getStride();
|
|
18
19
|
const flatCoordinates = geometry.getFlatCoordinates();
|
|
19
|
-
if (flatCoordinates.length) {
|
|
20
|
+
if (flatCoordinates.length > 0) {
|
|
20
21
|
const numberOfCoordinates = Math.floor(flatCoordinates.length / stride);
|
|
21
22
|
const coordinates = new Array(numberOfCoordinates);
|
|
22
23
|
for (let i = 0; i < numberOfCoordinates; i++) {
|
|
23
24
|
const flatIndex = i * stride;
|
|
24
|
-
|
|
25
|
+
coordinates[i] = new Array(stride);
|
|
25
26
|
for (let j = 0; j < stride; j++) {
|
|
26
|
-
|
|
27
|
+
coordinates[i][j] = flatCoordinates[flatIndex + j];
|
|
27
28
|
}
|
|
28
|
-
coordinates[i] = coord;
|
|
29
29
|
}
|
|
30
30
|
return coordinates;
|
|
31
31
|
}
|
|
@@ -38,18 +38,25 @@ export function getFlatCoordinatesFromSimpleGeometry(geometry) {
|
|
|
38
38
|
* @returns {Array.<import("ol/coordinate").Coordinate>}
|
|
39
39
|
*/
|
|
40
40
|
export function getFlatCoordinatesFromGeometry(geometry, inputCoordinates) {
|
|
41
|
-
|
|
41
|
+
if (!inputCoordinates && geometry instanceof SimpleGeometry) {
|
|
42
|
+
return getFlatCoordinatesFromSimpleGeometry(geometry);
|
|
43
|
+
}
|
|
44
|
+
const coordinates = inputCoordinates;
|
|
42
45
|
let flattenCoordinates = null;
|
|
43
46
|
if (geometry instanceof Point) {
|
|
44
47
|
flattenCoordinates = [coordinates];
|
|
45
48
|
} else if (geometry instanceof LineString) {
|
|
46
49
|
flattenCoordinates = coordinates;
|
|
47
50
|
} else if (geometry instanceof Polygon) {
|
|
48
|
-
flattenCoordinates = coordinates.reduce((current, next) =>
|
|
51
|
+
flattenCoordinates = coordinates.reduce((current, next) =>
|
|
52
|
+
current.concat(next),
|
|
53
|
+
);
|
|
49
54
|
} else if (geometry instanceof MultiPoint) {
|
|
50
55
|
flattenCoordinates = coordinates;
|
|
51
56
|
} else if (geometry instanceof MultiLineString) {
|
|
52
|
-
flattenCoordinates = coordinates.reduce((current, next) =>
|
|
57
|
+
flattenCoordinates = coordinates.reduce((current, next) =>
|
|
58
|
+
current.concat(next),
|
|
59
|
+
);
|
|
53
60
|
} else if (geometry instanceof MultiPolygon) {
|
|
54
61
|
flattenCoordinates = coordinates
|
|
55
62
|
.reduce((current, next) => current.concat(next))
|
|
@@ -57,8 +64,9 @@ export function getFlatCoordinatesFromGeometry(geometry, inputCoordinates) {
|
|
|
57
64
|
} else if (geometry instanceof Circle) {
|
|
58
65
|
flattenCoordinates = coordinates;
|
|
59
66
|
} else if (geometry instanceof GeometryCollection) {
|
|
60
|
-
flattenCoordinates = geometry
|
|
61
|
-
.
|
|
67
|
+
flattenCoordinates = geometry
|
|
68
|
+
.getGeometries()
|
|
69
|
+
.map((g, i) => getFlatCoordinatesFromGeometry(g, coordinates?.[i]))
|
|
62
70
|
.reduce((current, next) => current.concat(next));
|
|
63
71
|
}
|
|
64
72
|
return flattenCoordinates;
|
|
@@ -70,18 +78,18 @@ export function getFlatCoordinatesFromGeometry(geometry, inputCoordinates) {
|
|
|
70
78
|
* @returns {import("ol/geom/Circle").default}
|
|
71
79
|
*/
|
|
72
80
|
export function circleFromCenterRadius(center, radius) {
|
|
73
|
-
const offsetWGS84 =
|
|
81
|
+
const offsetWGS84 = offsetSphere(
|
|
82
|
+
Projection.mercatorToWgs84(center),
|
|
83
|
+
radius,
|
|
84
|
+
Math.PI / 2,
|
|
85
|
+
);
|
|
74
86
|
const of = Projection.wgs84ToMercator(offsetWGS84);
|
|
75
87
|
const dx = center[0] - of[0];
|
|
76
88
|
const dy = center[1] - of[1];
|
|
77
89
|
const dx2 = dx * dx;
|
|
78
90
|
const dy2 = dy * dy;
|
|
79
91
|
const radiusProjected = Math.sqrt(dx2 + dy2);
|
|
80
|
-
return new Circle(
|
|
81
|
-
center,
|
|
82
|
-
radiusProjected,
|
|
83
|
-
'XYZ',
|
|
84
|
-
);
|
|
92
|
+
return new Circle(center, radiusProjected, 'XYZ');
|
|
85
93
|
}
|
|
86
94
|
|
|
87
95
|
/**
|
|
@@ -150,7 +158,7 @@ function ringArea(ring) {
|
|
|
150
158
|
for (let i = 0; i <= positions - 2; i++) {
|
|
151
159
|
const p1 = ring[i];
|
|
152
160
|
const p2 = ring[i + 1];
|
|
153
|
-
area +=
|
|
161
|
+
area += p1[0] * p2[1] - p1[1] * p2[0];
|
|
154
162
|
}
|
|
155
163
|
|
|
156
164
|
area /= 2;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import VcsEvent from '../
|
|
1
|
+
import VcsEvent from '../vcsEvent.js';
|
|
2
2
|
import Collection from './collection.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A generic array based collection. Implements the Symbol.iterator (e.g. [...collection])
|
|
6
6
|
* @class
|
|
7
|
-
* @export
|
|
8
7
|
* @template {*} T
|
|
9
8
|
* @extends {Collection<T>}
|
|
10
9
|
* @api
|
|
@@ -20,7 +19,9 @@ class IndexedCollection extends Collection {
|
|
|
20
19
|
* @api
|
|
21
20
|
*/
|
|
22
21
|
static from(iterable, uniqueKey) {
|
|
23
|
-
const collection = /** @type {IndexedCollection<T>} */ (
|
|
22
|
+
const collection = /** @type {IndexedCollection<T>} */ (
|
|
23
|
+
new IndexedCollection(uniqueKey)
|
|
24
|
+
);
|
|
24
25
|
if (iterable) {
|
|
25
26
|
// eslint-disable-next-line no-restricted-syntax
|
|
26
27
|
for (const i of iterable) {
|
|
@@ -56,7 +57,9 @@ class IndexedCollection extends Collection {
|
|
|
56
57
|
* @type {symbol}
|
|
57
58
|
* @readonly
|
|
58
59
|
*/
|
|
59
|
-
get previousIndexSymbol() {
|
|
60
|
+
get previousIndexSymbol() {
|
|
61
|
+
return this._previousIndexSymbol;
|
|
62
|
+
}
|
|
60
63
|
|
|
61
64
|
/**
|
|
62
65
|
* Returns an item at index.
|
|
@@ -110,12 +113,28 @@ class IndexedCollection extends Collection {
|
|
|
110
113
|
let target = targetIndex;
|
|
111
114
|
target = target >= 0 ? target : 0;
|
|
112
115
|
target = target < this._array.length ? target : this._array.length - 1;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
if (itemIndex !== target) {
|
|
117
|
+
this._array.splice(itemIndex, 1);
|
|
118
|
+
this._array.splice(target, 0, item);
|
|
119
|
+
this.moved.raiseEvent(item);
|
|
120
|
+
}
|
|
116
121
|
return target;
|
|
117
122
|
}
|
|
118
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Moves an item to a provided index
|
|
126
|
+
* @param {T} item
|
|
127
|
+
* @param {number} targetIndex
|
|
128
|
+
* @returns {number|null} the new index of the item
|
|
129
|
+
*/
|
|
130
|
+
moveTo(item, targetIndex) {
|
|
131
|
+
const index = this._array.indexOf(item);
|
|
132
|
+
if (index > -1) {
|
|
133
|
+
return this._move(item, index, targetIndex);
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
|
|
119
138
|
/**
|
|
120
139
|
* Lowers an item within the array
|
|
121
140
|
* @param {T} item
|
|
@@ -166,7 +185,7 @@ class IndexedCollection extends Collection {
|
|
|
166
185
|
if (!this.uniqueKey) {
|
|
167
186
|
return undefined;
|
|
168
187
|
}
|
|
169
|
-
return this._array.findIndex(e => e[this.uniqueKey] === value);
|
|
188
|
+
return this._array.findIndex((e) => e[this.uniqueKey] === value);
|
|
170
189
|
}
|
|
171
190
|
|
|
172
191
|
/**
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
export function isMobile() {
|
|
8
8
|
// @ts-ignore
|
|
9
9
|
const agent = navigator.userAgent || navigator.vendor || window.opera;
|
|
10
|
-
return
|
|
11
|
-
/
|
|
10
|
+
return (
|
|
11
|
+
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(
|
|
12
|
+
agent,
|
|
13
|
+
) ||
|
|
14
|
+
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(
|
|
15
|
+
agent.substr(0, 4),
|
|
16
|
+
)
|
|
17
|
+
);
|
|
12
18
|
}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
import { check } from '@vcsuite/check';
|
|
1
2
|
import IndexedCollection from './indexedCollection.js';
|
|
2
3
|
import ExclusiveManager from './exclusiveManager.js';
|
|
3
4
|
import LayerState from '../layer/layerState.js';
|
|
4
|
-
import VcsEvent from '../
|
|
5
|
+
import VcsEvent from '../vcsEvent.js';
|
|
6
|
+
import GlobalHider from '../layer/globalHider.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The largest integer zindex which can be safely assigned to a layer (equal to Number.MAX_SAFE_INTEGER)
|
|
10
|
+
* You should use this to ensure layers are always rendered on top.
|
|
11
|
+
* @type {number}
|
|
12
|
+
*/
|
|
13
|
+
export const maxZIndex = Number.MAX_SAFE_INTEGER;
|
|
5
14
|
|
|
6
15
|
/**
|
|
7
16
|
* A collection of layers. Manages rendering order and layer exclusivity. Emits state changes for convenience. Passed to
|
|
8
17
|
* {@link Map} for layers available to said map. Layers must have unique names.
|
|
9
18
|
* @class
|
|
10
|
-
* @export
|
|
11
19
|
* @api
|
|
12
20
|
* @extends {IndexedCollection<import("@vcmap/core").Layer>}}
|
|
13
21
|
*/
|
|
@@ -62,6 +70,22 @@ class LayerCollection extends IndexedCollection {
|
|
|
62
70
|
* @api
|
|
63
71
|
*/
|
|
64
72
|
this.exclusiveManager = new ExclusiveManager();
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The global hider for this collection.
|
|
76
|
+
* @type {GlobalHider}
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
this._globalHider = new GlobalHider();
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Locale for this layerCollection, will be synchronized by the vcsApp, if part of an vcsApp.
|
|
83
|
+
* This Locale will be set on all Member Layers. On setting the Locale this will trigger a reload of all locale
|
|
84
|
+
* aware layers.
|
|
85
|
+
* @type {string}
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
this._locale = 'en';
|
|
65
89
|
}
|
|
66
90
|
|
|
67
91
|
/**
|
|
@@ -71,7 +95,53 @@ class LayerCollection extends IndexedCollection {
|
|
|
71
95
|
* @type {symbol}
|
|
72
96
|
* @readonly
|
|
73
97
|
*/
|
|
74
|
-
get zIndexSymbol() {
|
|
98
|
+
get zIndexSymbol() {
|
|
99
|
+
return this._zIndexSymbol;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The current global hider of these layers
|
|
104
|
+
* @type {GlobalHider}
|
|
105
|
+
*/
|
|
106
|
+
get globalHider() {
|
|
107
|
+
return this._globalHider;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The current global hider of these layers
|
|
112
|
+
* @type {GlobalHider}
|
|
113
|
+
* @param {GlobalHider} globalHider
|
|
114
|
+
* @returns {void}
|
|
115
|
+
*/
|
|
116
|
+
set globalHider(globalHider) {
|
|
117
|
+
check(globalHider, GlobalHider);
|
|
118
|
+
|
|
119
|
+
this._globalHider = globalHider;
|
|
120
|
+
this._array.forEach((layer) => {
|
|
121
|
+
layer.setGlobalHider(this._globalHider);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @type {string}
|
|
127
|
+
*/
|
|
128
|
+
get locale() {
|
|
129
|
+
return this._locale;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @param {string} value
|
|
134
|
+
*/
|
|
135
|
+
set locale(value) {
|
|
136
|
+
check(value, String);
|
|
137
|
+
|
|
138
|
+
if (this._locale !== value) {
|
|
139
|
+
this._locale = value;
|
|
140
|
+
[...this].forEach((layer) => {
|
|
141
|
+
layer.locale = this._locale;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
75
145
|
|
|
76
146
|
/**
|
|
77
147
|
* @param {import("@vcmap/core").Layer} layer
|
|
@@ -89,15 +159,20 @@ class LayerCollection extends IndexedCollection {
|
|
|
89
159
|
this._zIndexChanged(layer);
|
|
90
160
|
});
|
|
91
161
|
|
|
92
|
-
const exclusiveGroupsListener =
|
|
93
|
-
|
|
94
|
-
|
|
162
|
+
const exclusiveGroupsListener =
|
|
163
|
+
layer.exclusiveGroupsChanged.addEventListener(() => {
|
|
164
|
+
this.exclusiveManager.handleExclusiveGroupsChanged(layer);
|
|
165
|
+
});
|
|
95
166
|
|
|
96
167
|
const listeners = [stateListener, zIndexListener, exclusiveGroupsListener];
|
|
97
168
|
if (/** @type {SplitLayer} */ (layer).splitDirectionChanged) {
|
|
98
|
-
listeners.push(
|
|
99
|
-
|
|
100
|
-
|
|
169
|
+
listeners.push(
|
|
170
|
+
/** @type {SplitLayer} */ (
|
|
171
|
+
layer
|
|
172
|
+
).splitDirectionChanged.addEventListener(() => {
|
|
173
|
+
this.exclusiveManager.handleSplitDirectionChanged(layer);
|
|
174
|
+
}),
|
|
175
|
+
);
|
|
101
176
|
}
|
|
102
177
|
this._layerEventListeners[layer.name] = listeners;
|
|
103
178
|
}
|
|
@@ -109,7 +184,9 @@ class LayerCollection extends IndexedCollection {
|
|
|
109
184
|
* @private
|
|
110
185
|
*/
|
|
111
186
|
_findZIndexPosition(zIndex) {
|
|
112
|
-
const usedIndex = this._array.findIndex(
|
|
187
|
+
const usedIndex = this._array.findIndex(
|
|
188
|
+
(l) => l[this._zIndexSymbol] > zIndex,
|
|
189
|
+
);
|
|
113
190
|
return usedIndex > -1 ? usedIndex : null;
|
|
114
191
|
}
|
|
115
192
|
|
|
@@ -127,14 +204,15 @@ class LayerCollection extends IndexedCollection {
|
|
|
127
204
|
if (zIndexPosition > 0 && zIndexPosition > currentIndex) {
|
|
128
205
|
zIndexPosition -= 1; // remove self from count
|
|
129
206
|
}
|
|
130
|
-
zIndexPosition =
|
|
207
|
+
zIndexPosition =
|
|
208
|
+
zIndexPosition != null ? zIndexPosition : this._array.length - 1;
|
|
131
209
|
this._move(layer, currentIndex, zIndexPosition);
|
|
132
210
|
this._ensureLocalZIndex(layer);
|
|
133
211
|
}
|
|
134
212
|
}
|
|
135
213
|
|
|
136
214
|
/**
|
|
137
|
-
* Ensures the local z index is
|
|
215
|
+
* Ensures the local z index is consistent with the neighbours of a given layer.
|
|
138
216
|
* e.g. the layer on elower must have a lower or equal zIndex
|
|
139
217
|
* and the one higher a higher or equal zIndex.
|
|
140
218
|
* @param {import("@vcmap/core").Layer} layer
|
|
@@ -159,6 +237,8 @@ class LayerCollection extends IndexedCollection {
|
|
|
159
237
|
|
|
160
238
|
/**
|
|
161
239
|
* Adds a layer to the collection. Can optionally be passed an index at which to insert the layer.
|
|
240
|
+
* The layer locale will be set to the same locale of the layerCollection. This will trigger a forceRedraw
|
|
241
|
+
* of the layer if the layer locale is different and the layer is locale aware.
|
|
162
242
|
* @param {import("@vcmap/core").Layer} layer
|
|
163
243
|
* @param {number=} index
|
|
164
244
|
* @returns {number|null} returns the layer index or null, if the layers name is not unique
|
|
@@ -172,6 +252,8 @@ class LayerCollection extends IndexedCollection {
|
|
|
172
252
|
const insertedAt = super.add(layer, usedIndex);
|
|
173
253
|
if (insertedAt != null) {
|
|
174
254
|
layer[this._zIndexSymbol] = layer.zIndex;
|
|
255
|
+
layer.setGlobalHider(this._globalHider);
|
|
256
|
+
layer.locale = this.locale;
|
|
175
257
|
this._ensureLocalZIndex(layer);
|
|
176
258
|
this._listenToLayerEvents(layer);
|
|
177
259
|
this.exclusiveManager.registerLayer(layer);
|
|
@@ -180,24 +262,29 @@ class LayerCollection extends IndexedCollection {
|
|
|
180
262
|
}
|
|
181
263
|
|
|
182
264
|
/**
|
|
183
|
-
* Removes a layer from the collection.
|
|
184
265
|
* @param {import("@vcmap/core").Layer} layer
|
|
185
|
-
* @
|
|
266
|
+
* @returns {number}
|
|
267
|
+
* @protected
|
|
186
268
|
*/
|
|
187
|
-
|
|
269
|
+
_remove(layer) {
|
|
188
270
|
if (this._layerEventListeners[layer.name]) {
|
|
189
|
-
this._layerEventListeners[layer.name].forEach((cb) => {
|
|
271
|
+
this._layerEventListeners[layer.name].forEach((cb) => {
|
|
272
|
+
cb();
|
|
273
|
+
});
|
|
190
274
|
delete this._layerEventListeners[layer.name];
|
|
191
275
|
}
|
|
192
276
|
delete layer[this._zIndexSymbol];
|
|
277
|
+
layer.setGlobalHider(null);
|
|
193
278
|
this.exclusiveManager.unregisterLayer(layer);
|
|
194
|
-
super.
|
|
279
|
+
return super._remove(layer);
|
|
195
280
|
}
|
|
196
281
|
|
|
197
282
|
clear() {
|
|
198
283
|
Object.values(this._layerEventListeners)
|
|
199
284
|
.flat()
|
|
200
|
-
.forEach((r) => {
|
|
285
|
+
.forEach((r) => {
|
|
286
|
+
r();
|
|
287
|
+
});
|
|
201
288
|
this._array.forEach((l) => {
|
|
202
289
|
delete l[this._zIndexSymbol];
|
|
203
290
|
});
|
|
@@ -210,10 +297,13 @@ class LayerCollection extends IndexedCollection {
|
|
|
210
297
|
destroy() {
|
|
211
298
|
Object.values(this._layerEventListeners)
|
|
212
299
|
.flat()
|
|
213
|
-
.forEach((r) => {
|
|
300
|
+
.forEach((r) => {
|
|
301
|
+
r();
|
|
302
|
+
});
|
|
214
303
|
|
|
215
304
|
this._layerEventListeners = {};
|
|
216
305
|
this.exclusiveManager.destroy();
|
|
306
|
+
this._globalHider.destroy();
|
|
217
307
|
super.destroy();
|
|
218
308
|
}
|
|
219
309
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* eslint-disable import/prefer-default-export */
|
|
2
|
+
/**
|
|
3
|
+
* returns the default browserLocale, if not possible 'en'
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export function detectBrowserLocale() {
|
|
7
|
+
if (navigator.language) {
|
|
8
|
+
const lang = navigator.language;
|
|
9
|
+
return lang.substring(0, 2);
|
|
10
|
+
}
|
|
11
|
+
return 'en';
|
|
12
|
+
}
|