@mapcomponents/react-maplibre 0.1.58 → 0.1.59
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/CHANGELOG.md +5 -0
- package/coverage/clover.xml +11 -11
- package/coverage/coverage-final.json +2 -2
- package/coverage/lcov-report/index.html +18 -18
- package/coverage/lcov-report/src/components/MapLibreMap/MapLibreMap.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MapLibreMap/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/MlCenterPosition.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCenterPosition/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/MlCreatePdfButton.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfButton/index.html +1 -1
- package/coverage/lcov-report/src/components/MlCreatePdfForm/MlCreatePdfForm.tsx.html +10 -10
- package/coverage/lcov-report/src/components/MlCreatePdfForm/index.html +13 -13
- package/coverage/lcov-report/src/components/MlFeatureEditor/MlFeatureEditor.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFeatureEditor/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/MlFillExtrusionLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFillExtrusionLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/MlFollowGps.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlFollowGps/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/MlGPXViewer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/gpxConverter.js.html +1 -1
- package/coverage/lcov-report/src/components/MlGPXViewer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/MlGeoJsonLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/MlGeojsonLayerWithSource.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlGeojsonLayerWithSource/index.html +1 -1
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/MlLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/MlLayerMagnify.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerMagnify/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/MlLayerSwipe.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwipe/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +1 -1
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/MlMarker.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMarker/index.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/MlMeasureTool.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlMeasureTool/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/MlNavigationCompass.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationCompass/index.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/MlNavigationTools.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlNavigationTools/index.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/MlOsmLayer.stories_.js.html +1 -1
- package/coverage/lcov-report/src/components/MlOsmLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/MlScaleReference.js.html +1 -1
- package/coverage/lcov-report/src/components/MlScaleReference/index.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/MlShareMapState.js.html +1 -1
- package/coverage/lcov-report/src/components/MlShareMapState/index.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +1 -1
- package/coverage/lcov-report/src/components/MlSpatialElevationProfile/index.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/MlThreeJsLayer.js.html +1 -1
- package/coverage/lcov-report/src/components/MlThreeJsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/MlTransitionGeoJsonLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlTransitionGeoJsonLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/MlUseMapDebugger.js.html +1 -1
- package/coverage/lcov-report/src/components/MlUseMapDebugger/index.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/MlVectorTileLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlVectorTileLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsFeatureInfoPopup/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/MlWmsLayer.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLayer/index.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/MlWmsLoader.tsx.html +1 -1
- package/coverage/lcov-report/src/components/MlWmsLoader/index.html +1 -1
- package/coverage/lcov-report/src/contexts/MapContext.tsx.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataContext.js.html +1 -1
- package/coverage/lcov-report/src/contexts/SimpleDataProvider.js.html +1 -1
- package/coverage/lcov-report/src/contexts/index.html +1 -1
- package/coverage/lcov-report/src/hooks/exportMap/index.html +1 -1
- package/coverage/lcov-report/src/hooks/exportMap/index.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/exportMap/lib.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/index.html +11 -11
- package/coverage/lcov-report/src/hooks/useLayer.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useLayerEvent.js.html +9 -9
- package/coverage/lcov-report/src/hooks/useMap.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useMapState.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useSource.ts.html +1 -1
- package/coverage/lcov-report/src/hooks/useWms.js.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +2 -2
- package/coverage/lcov.info +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +971 -417
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -7,10 +7,10 @@ import { Map as Map$2, Popup } from 'maplibre-gl';
|
|
|
7
7
|
import jsPDF from 'jspdf';
|
|
8
8
|
import styled$3 from '@emotion/styled';
|
|
9
9
|
import { keyframes } from '@emotion/react';
|
|
10
|
-
import MapboxDraw from '@mapbox/mapbox-gl-draw';
|
|
11
|
-
import { Button as Button$2 } from '@mui/material';
|
|
12
10
|
import * as turf from '@turf/turf';
|
|
13
11
|
import { point, circle, lineArc, bbox, lineOffset, distance } from '@turf/turf';
|
|
12
|
+
import { FormControl, InputLabel, Select, MenuItem, FormLabel, RadioGroup, FormControlLabel, Radio, Button as Button$2 } from '@mui/material';
|
|
13
|
+
import MapboxDraw from '@mapbox/mapbox-gl-draw';
|
|
14
14
|
import { css } from '@emotion/css';
|
|
15
15
|
import syncMove from '@mapbox/mapbox-gl-sync-move';
|
|
16
16
|
import * as ReactDOM from 'react-dom';
|
|
@@ -9923,50 +9923,940 @@ MlCreatePdfButton.defaultProps = {
|
|
|
9923
9923
|
mapId: undefined,
|
|
9924
9924
|
};
|
|
9925
9925
|
|
|
9926
|
-
|
|
9927
|
-
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9926
|
+
var legalLayerTypes = [
|
|
9927
|
+
'fill',
|
|
9928
|
+
'line',
|
|
9929
|
+
'symbol',
|
|
9930
|
+
'circle',
|
|
9931
|
+
'heatmap',
|
|
9932
|
+
'fill-extrusion',
|
|
9933
|
+
'raster',
|
|
9934
|
+
'hillshade',
|
|
9935
|
+
'background',
|
|
9936
|
+
];
|
|
9937
|
+
function useLayer(props) {
|
|
9938
|
+
var mapHook = useMap({
|
|
9939
|
+
mapId: props.mapId,
|
|
9940
|
+
waitForLayer: props.insertBeforeLayer,
|
|
9941
|
+
});
|
|
9942
|
+
var layerTypeRef = useRef('');
|
|
9943
|
+
var layerPaintConfRef = useRef('');
|
|
9944
|
+
var layerLayoutConfRef = useRef('');
|
|
9945
|
+
var _a = useState(), layer = _a[0], setLayer = _a[1];
|
|
9946
|
+
var initializedRef = useRef(false);
|
|
9947
|
+
var layerId = useRef(props.layerId || (props.idPrefix ? props.idPrefix : 'Layer-') + mapHook.componentId);
|
|
9948
|
+
var createLayer = useCallback(function () {
|
|
9949
|
+
var _a, _b;
|
|
9950
|
+
if (!mapHook.map)
|
|
9951
|
+
return;
|
|
9952
|
+
if (mapHook.map.map.getLayer(layerId.current)) {
|
|
9953
|
+
mapHook.cleanup();
|
|
9954
|
+
}
|
|
9955
|
+
if (mapHook.map.map.getSource(layerId.current)) {
|
|
9956
|
+
mapHook.map.map.removeSource(layerId.current);
|
|
9957
|
+
}
|
|
9958
|
+
if (typeof props.source === 'string') {
|
|
9959
|
+
if (props.source === '' || !mapHook.map.map.getSource(props.source)) {
|
|
9960
|
+
return;
|
|
9961
|
+
}
|
|
9962
|
+
}
|
|
9963
|
+
initializedRef.current = true;
|
|
9964
|
+
mapHook.map.addLayer(__assign(__assign(__assign(__assign({}, props.options), (props.geojson && !props.source
|
|
9965
|
+
? {
|
|
9966
|
+
source: {
|
|
9967
|
+
type: 'geojson',
|
|
9968
|
+
data: props.geojson,
|
|
9969
|
+
},
|
|
9970
|
+
}
|
|
9971
|
+
: {})), (props.source
|
|
9972
|
+
? {
|
|
9973
|
+
source: props.source,
|
|
9974
|
+
}
|
|
9975
|
+
: {})), { id: layerId.current }), props.insertBeforeLayer
|
|
9976
|
+
? props.insertBeforeLayer
|
|
9977
|
+
: props.insertBeforeFirstSymbolLayer
|
|
9978
|
+
? mapHook.map.firstSymbolLayer
|
|
9979
|
+
: undefined, mapHook.componentId);
|
|
9980
|
+
setLayer(mapHook.map.map.getLayer(layerId.current));
|
|
9981
|
+
if (typeof props.onHover !== 'undefined') {
|
|
9982
|
+
mapHook.map.on('mousemove', layerId.current, props.onHover, mapHook.componentId);
|
|
9983
|
+
}
|
|
9984
|
+
if (typeof props.onClick !== 'undefined') {
|
|
9985
|
+
mapHook.map.on('click', layerId.current, props.onClick, mapHook.componentId);
|
|
9986
|
+
}
|
|
9987
|
+
if (typeof props.onLeave !== 'undefined') {
|
|
9988
|
+
mapHook.map.on('mouseleave', layerId.current, props.onLeave, mapHook.componentId);
|
|
9989
|
+
}
|
|
9990
|
+
// recreate layer if style has changed
|
|
9991
|
+
mapHook.map.on('styledata', function () {
|
|
9992
|
+
var _a;
|
|
9993
|
+
if (initializedRef.current && !((_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map.getLayer(layerId.current))) {
|
|
9994
|
+
console.log('Recreate Layer');
|
|
9995
|
+
createLayer();
|
|
9996
|
+
}
|
|
9997
|
+
}, mapHook.componentId);
|
|
9998
|
+
layerPaintConfRef.current = JSON.stringify((_a = props.options) === null || _a === void 0 ? void 0 : _a.paint);
|
|
9999
|
+
layerLayoutConfRef.current = JSON.stringify((_b = props.options) === null || _b === void 0 ? void 0 : _b.layout);
|
|
10000
|
+
layerTypeRef.current = props.options.type;
|
|
10001
|
+
}, [props, mapHook.map]);
|
|
10002
|
+
useEffect(function () {
|
|
10003
|
+
if (!mapHook.map)
|
|
10004
|
+
return;
|
|
10005
|
+
if (initializedRef.current &&
|
|
10006
|
+
(legalLayerTypes.indexOf(props.options.type) === -1 ||
|
|
10007
|
+
(legalLayerTypes.indexOf(props.options.type) !== -1 &&
|
|
10008
|
+
props.options.type === layerTypeRef.current))) {
|
|
10009
|
+
return;
|
|
10010
|
+
}
|
|
10011
|
+
createLayer();
|
|
10012
|
+
}, [mapHook.map, props.options, createLayer]);
|
|
10013
|
+
useEffect(function () {
|
|
10014
|
+
var _a, _b, _c, _d;
|
|
10015
|
+
if (!initializedRef.current || !((_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.getSource(layerId.current)))
|
|
10016
|
+
return;
|
|
10017
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10018
|
+
//@ts-ignore setData only exists on GeoJsonSource
|
|
10019
|
+
(_d = (_c = mapHook.map.map.getSource(layerId.current)) === null || _c === void 0 ? void 0 : _c.setData) === null || _d === void 0 ? void 0 : _d.call(_c, props.geojson);
|
|
10020
|
+
}, [props.geojson, mapHook.map, props.options.type]);
|
|
10021
|
+
useEffect(function () {
|
|
10022
|
+
var _a, _b, _c, _d, _e;
|
|
10023
|
+
if (!mapHook.map ||
|
|
10024
|
+
!((_c = (_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.getLayer) === null || _c === void 0 ? void 0 : _c.call(_b, layerId.current)) ||
|
|
10025
|
+
!initializedRef.current ||
|
|
10026
|
+
props.options.type !== layerTypeRef.current)
|
|
10027
|
+
return;
|
|
10028
|
+
var key;
|
|
10029
|
+
var layoutString = JSON.stringify(props.options.layout);
|
|
10030
|
+
if (props.options.layout && layoutString !== layerLayoutConfRef.current) {
|
|
10031
|
+
var oldLayout = JSON.parse(layerLayoutConfRef.current);
|
|
10032
|
+
for (key in props.options.layout) {
|
|
10033
|
+
if (((_d = props.options.layout) === null || _d === void 0 ? void 0 : _d[key]) && props.options.layout[key] !== oldLayout[key]) {
|
|
10034
|
+
mapHook.map.map.setLayoutProperty(layerId.current, key, props.options.layout[key]);
|
|
10035
|
+
}
|
|
10036
|
+
}
|
|
10037
|
+
layerLayoutConfRef.current = layoutString;
|
|
10038
|
+
}
|
|
10039
|
+
var paintString = JSON.stringify(props.options.paint);
|
|
10040
|
+
if (paintString !== layerPaintConfRef.current) {
|
|
10041
|
+
var oldPaint = JSON.parse(layerPaintConfRef.current);
|
|
10042
|
+
for (key in props.options.paint) {
|
|
10043
|
+
if (((_e = props.options.paint) === null || _e === void 0 ? void 0 : _e[key]) && props.options.paint[key] !== oldPaint[key]) {
|
|
10044
|
+
mapHook.map.map.setPaintProperty(layerId.current, key, props.options.paint[key]);
|
|
10045
|
+
}
|
|
10046
|
+
}
|
|
10047
|
+
layerPaintConfRef.current = paintString;
|
|
10048
|
+
}
|
|
10049
|
+
}, [props.options, mapHook.map]);
|
|
10050
|
+
useEffect(function () {
|
|
10051
|
+
return function () {
|
|
10052
|
+
initializedRef.current = false;
|
|
10053
|
+
mapHook.cleanup();
|
|
10054
|
+
};
|
|
10055
|
+
}, []);
|
|
10056
|
+
return {
|
|
10057
|
+
map: mapHook.map,
|
|
10058
|
+
layer: layer,
|
|
10059
|
+
layerId: layerId.current,
|
|
10060
|
+
componentId: mapHook.componentId,
|
|
10061
|
+
mapHook: mapHook,
|
|
10062
|
+
};
|
|
10063
|
+
}
|
|
10064
|
+
|
|
10065
|
+
var getDefaultPaintPropsByType = function (type, defaultPaintOverrides) {
|
|
10066
|
+
switch (type) {
|
|
10067
|
+
case "fill":
|
|
10068
|
+
if (defaultPaintOverrides === null || defaultPaintOverrides === void 0 ? void 0 : defaultPaintOverrides.fill) {
|
|
10069
|
+
return defaultPaintOverrides.fill;
|
|
10070
|
+
}
|
|
10071
|
+
return {
|
|
10072
|
+
"fill-color": "rgba(10,240,256,0.6)",
|
|
10073
|
+
};
|
|
10074
|
+
case "line":
|
|
10075
|
+
if (defaultPaintOverrides === null || defaultPaintOverrides === void 0 ? void 0 : defaultPaintOverrides.line) {
|
|
10076
|
+
return defaultPaintOverrides.line;
|
|
10077
|
+
}
|
|
10078
|
+
return {
|
|
10079
|
+
"line-color": "rgb(203,211,2)",
|
|
10080
|
+
"line-width": 5,
|
|
10081
|
+
};
|
|
10082
|
+
case "circle":
|
|
10083
|
+
default:
|
|
10084
|
+
if (defaultPaintOverrides === null || defaultPaintOverrides === void 0 ? void 0 : defaultPaintOverrides.circle) {
|
|
10085
|
+
return defaultPaintOverrides.circle;
|
|
10086
|
+
}
|
|
10087
|
+
return {
|
|
10088
|
+
"circle-color": "rgba(10,240,256,0.8)",
|
|
10089
|
+
"circle-stroke-color": "#fff",
|
|
10090
|
+
"circle-stroke-width": 2,
|
|
10091
|
+
};
|
|
10092
|
+
}
|
|
9944
10093
|
};
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
10094
|
+
|
|
10095
|
+
var mapGeometryTypesToLayerTypes = {
|
|
10096
|
+
Position: "circle",
|
|
10097
|
+
Point: "circle",
|
|
10098
|
+
MultiPoint: "circle",
|
|
10099
|
+
LineString: "line",
|
|
10100
|
+
MultiLineString: "line",
|
|
10101
|
+
Polygon: "fill",
|
|
10102
|
+
MultiPolygon: "fill",
|
|
10103
|
+
GeometryCollection: "circle",
|
|
10104
|
+
};
|
|
10105
|
+
var getDefaulLayerTypeByGeometry = function (geojson) {
|
|
10106
|
+
var _a;
|
|
10107
|
+
if ((geojson === null || geojson === void 0 ? void 0 : geojson.type) === "Feature") {
|
|
10108
|
+
return (mapGeometryTypesToLayerTypes === null || mapGeometryTypesToLayerTypes === void 0 ? void 0 : mapGeometryTypesToLayerTypes[(_a = geojson === null || geojson === void 0 ? void 0 : geojson.geometry) === null || _a === void 0 ? void 0 : _a.type])
|
|
10109
|
+
? mapGeometryTypesToLayerTypes[geojson.geometry.type]
|
|
10110
|
+
: "circle";
|
|
10111
|
+
}
|
|
10112
|
+
if ((geojson === null || geojson === void 0 ? void 0 : geojson.type) === "FeatureCollection") {
|
|
10113
|
+
if (geojson.features.length) {
|
|
10114
|
+
return getDefaulLayerTypeByGeometry(geojson.features[0]);
|
|
10115
|
+
}
|
|
10116
|
+
return "circle";
|
|
10117
|
+
}
|
|
10118
|
+
return "fill";
|
|
9951
10119
|
};
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
10120
|
+
|
|
10121
|
+
/**
|
|
10122
|
+
* Adds source and layer of types "line", "fill" or "circle" to display GeoJSON data on the map.
|
|
10123
|
+
*
|
|
10124
|
+
* @component
|
|
10125
|
+
*/
|
|
10126
|
+
var MlGeoJsonLayer = function (props) {
|
|
10127
|
+
var layerType = props.type || getDefaulLayerTypeByGeometry(props.geojson);
|
|
10128
|
+
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
10129
|
+
useLayer({
|
|
10130
|
+
mapId: props.mapId,
|
|
10131
|
+
layerId: props.layerId || "MlGeoJsonLayer-" + v4(),
|
|
10132
|
+
geojson: props.geojson,
|
|
10133
|
+
options: __assign(__assign({ paint: props.paint ||
|
|
10134
|
+
getDefaultPaintPropsByType(layerType, props.defaultPaintOverrides), layout: props.layout || {} }, props.options), { type: layerType }),
|
|
10135
|
+
insertBeforeLayer: props.insertBeforeLayer,
|
|
10136
|
+
onHover: props.onHover,
|
|
10137
|
+
onClick: props.onClick,
|
|
10138
|
+
onLeave: props.onLeave,
|
|
10139
|
+
});
|
|
10140
|
+
return (React__default.createElement(React__default.Fragment, null));
|
|
9956
10141
|
};
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
FEATURE_COLLECTION: 'FeatureCollection',
|
|
9963
|
-
MULTI_PREFIX: 'Multi',
|
|
9964
|
-
MULTI_POINT: 'MultiPoint',
|
|
9965
|
-
MULTI_LINE_STRING: 'MultiLineString',
|
|
9966
|
-
MULTI_POLYGON: 'MultiPolygon'
|
|
10142
|
+
|
|
10143
|
+
var touchEquivalents = {
|
|
10144
|
+
mousedown: 'touchstart',
|
|
10145
|
+
mouseup: 'touchend',
|
|
10146
|
+
mousemove: 'touchmove'
|
|
9967
10147
|
};
|
|
9968
|
-
var
|
|
9969
|
-
|
|
10148
|
+
var touchEquivalentsKeys = Object.keys(touchEquivalents);
|
|
10149
|
+
|
|
10150
|
+
function useLayerEvent(props) {
|
|
10151
|
+
var mapState = useMapState({
|
|
10152
|
+
mapId: props.mapId,
|
|
10153
|
+
watch: {
|
|
10154
|
+
layers: true
|
|
10155
|
+
}
|
|
10156
|
+
});
|
|
10157
|
+
var mapHook = useMap({
|
|
10158
|
+
mapId: props.mapId
|
|
10159
|
+
});
|
|
10160
|
+
useEffect(function () {
|
|
10161
|
+
if (!mapHook.map) return true;
|
|
10162
|
+
if (typeof props.condition !== 'undefined' && props.condition === false) return; //console.log('useLayerEvent');
|
|
10163
|
+
//console.log(mapState);
|
|
10164
|
+
|
|
10165
|
+
if (mapHook.map.map.getLayer(props.layerId)) {
|
|
10166
|
+
//console.log("layer avail");
|
|
10167
|
+
var _event = props.event;
|
|
10168
|
+
var _layerId = props.layerId;
|
|
10169
|
+
var _eventHandler = props.eventHandler; //console.log(_event);
|
|
10170
|
+
|
|
10171
|
+
mapHook.map.on(_event, _layerId, _eventHandler, mapHook.componentId);
|
|
10172
|
+
|
|
10173
|
+
if ((props === null || props === void 0 ? void 0 : props.addTouchEvents) === true) {
|
|
10174
|
+
if (touchEquivalentsKeys.indexOf(_event) !== -1) {
|
|
10175
|
+
mapHook.map.on(touchEquivalents[_event], _layerId, _eventHandler, mapHook.componentId);
|
|
10176
|
+
}
|
|
10177
|
+
}
|
|
10178
|
+
|
|
10179
|
+
return function () {
|
|
10180
|
+
mapHook.map.off(_event, _layerId, _eventHandler);
|
|
10181
|
+
|
|
10182
|
+
if ((props === null || props === void 0 ? void 0 : props.addTouchEvents) === true) {
|
|
10183
|
+
if (touchEquivalentsKeys.indexOf(_event) !== -1) {
|
|
10184
|
+
mapHook.map.off(touchEquivalents[_event], _layerId, _eventHandler, mapHook.componentId);
|
|
10185
|
+
}
|
|
10186
|
+
}
|
|
10187
|
+
};
|
|
10188
|
+
}
|
|
10189
|
+
}, [props, mapState, mapHook.map]);
|
|
10190
|
+
return {};
|
|
10191
|
+
}
|
|
10192
|
+
|
|
10193
|
+
var PdfTemplates = {
|
|
10194
|
+
A4: {
|
|
10195
|
+
'300dpi': {
|
|
10196
|
+
width: 2480,
|
|
10197
|
+
height: 3508,
|
|
10198
|
+
},
|
|
10199
|
+
'150dpi': {
|
|
10200
|
+
width: 1240,
|
|
10201
|
+
height: 1754,
|
|
10202
|
+
},
|
|
10203
|
+
'72dpi': {
|
|
10204
|
+
width: 595,
|
|
10205
|
+
height: 842,
|
|
10206
|
+
},
|
|
10207
|
+
},
|
|
10208
|
+
A3: {
|
|
10209
|
+
'300dpi': {
|
|
10210
|
+
width: 3505,
|
|
10211
|
+
height: 4961,
|
|
10212
|
+
},
|
|
10213
|
+
'150dpi': {
|
|
10214
|
+
width: 1754,
|
|
10215
|
+
height: 2480,
|
|
10216
|
+
},
|
|
10217
|
+
'72dpi': {
|
|
10218
|
+
width: 842,
|
|
10219
|
+
height: 1191,
|
|
10220
|
+
},
|
|
10221
|
+
},
|
|
10222
|
+
A2: {
|
|
10223
|
+
'300dpi': {
|
|
10224
|
+
width: 4961,
|
|
10225
|
+
height: 7016,
|
|
10226
|
+
},
|
|
10227
|
+
'150dpi': {
|
|
10228
|
+
width: 2480,
|
|
10229
|
+
height: 3508,
|
|
10230
|
+
},
|
|
10231
|
+
'72dpi': {
|
|
10232
|
+
width: 1191,
|
|
10233
|
+
height: 1684,
|
|
10234
|
+
},
|
|
10235
|
+
},
|
|
10236
|
+
A1: {
|
|
10237
|
+
'300dpi': {
|
|
10238
|
+
width: 7016,
|
|
10239
|
+
height: 9933,
|
|
10240
|
+
},
|
|
10241
|
+
'150dpi': {
|
|
10242
|
+
width: 3508,
|
|
10243
|
+
height: 4967,
|
|
10244
|
+
},
|
|
10245
|
+
'72dpi': {
|
|
10246
|
+
width: 1684,
|
|
10247
|
+
height: 2384,
|
|
10248
|
+
},
|
|
10249
|
+
},
|
|
10250
|
+
A0: {
|
|
10251
|
+
'300dpi': {
|
|
10252
|
+
width: 9933,
|
|
10253
|
+
height: 14043,
|
|
10254
|
+
},
|
|
10255
|
+
'150dpi': {
|
|
10256
|
+
width: 4967,
|
|
10257
|
+
height: 7022,
|
|
10258
|
+
},
|
|
10259
|
+
'72dpi': {
|
|
10260
|
+
width: 2384,
|
|
10261
|
+
height: 3370,
|
|
10262
|
+
},
|
|
10263
|
+
},
|
|
10264
|
+
};
|
|
10265
|
+
|
|
10266
|
+
var PdfContext = React__default.createContext({});
|
|
10267
|
+
var defaultTemplate = PdfTemplates['A4']['72dpi'];
|
|
10268
|
+
var PdfContextProvider = function (_a) {
|
|
10269
|
+
var children = _a.children;
|
|
10270
|
+
var _b = useState('A4'), format = _b[0], setFormat = _b[1];
|
|
10271
|
+
var _c = useState('72dpi'), quality = _c[0], setQuality = _c[1];
|
|
10272
|
+
var _d = useState('portrait'), orientation = _d[0], setOrientation = _d[1];
|
|
10273
|
+
var geojsonRef = useRef();
|
|
10274
|
+
var template = useMemo(function () {
|
|
10275
|
+
if (typeof PdfTemplates[format][quality] !== 'undefined') {
|
|
10276
|
+
return orientation === 'portrait'
|
|
10277
|
+
? PdfTemplates[format][quality]
|
|
10278
|
+
: {
|
|
10279
|
+
width: PdfTemplates[format][quality].height,
|
|
10280
|
+
height: PdfTemplates[format][quality].width,
|
|
10281
|
+
};
|
|
10282
|
+
}
|
|
10283
|
+
return defaultTemplate;
|
|
10284
|
+
}, [format, quality, orientation]);
|
|
10285
|
+
var value = {
|
|
10286
|
+
format: format,
|
|
10287
|
+
setFormat: setFormat,
|
|
10288
|
+
quality: quality,
|
|
10289
|
+
setQuality: setQuality,
|
|
10290
|
+
orientation: orientation,
|
|
10291
|
+
setOrientation: setOrientation,
|
|
10292
|
+
geojsonRef: geojsonRef,
|
|
10293
|
+
template: template,
|
|
10294
|
+
};
|
|
10295
|
+
return React__default.createElement(PdfContext.Provider, { value: value }, children);
|
|
10296
|
+
};
|
|
10297
|
+
|
|
10298
|
+
var createPreviewGeojson = function (geojsonProps, orientation) {
|
|
10299
|
+
var topLeftAngle = orientation === 'portrait' ? -35.3 : -54.7;
|
|
10300
|
+
var bottomRightAngle = orientation === 'portrait' ? 144.7 : 125.3;
|
|
10301
|
+
var topLeft = turf.destination([geojsonProps.center.lng, geojsonProps.center.lat], geojsonProps.distance, topLeftAngle);
|
|
10302
|
+
var bottomRight = turf.destination([geojsonProps.center.lng, geojsonProps.center.lat], geojsonProps.distance, bottomRightAngle);
|
|
10303
|
+
var bbox = [
|
|
10304
|
+
topLeft.geometry.coordinates[0],
|
|
10305
|
+
topLeft.geometry.coordinates[1],
|
|
10306
|
+
bottomRight.geometry.coordinates[0],
|
|
10307
|
+
bottomRight.geometry.coordinates[1],
|
|
10308
|
+
];
|
|
10309
|
+
var _previewGeojson = turf.bboxPolygon(bbox);
|
|
10310
|
+
_previewGeojson = turf.transformRotate(_previewGeojson, geojsonProps.bearing);
|
|
10311
|
+
if (!(_previewGeojson === null || _previewGeojson === void 0 ? void 0 : _previewGeojson.properties)) {
|
|
10312
|
+
_previewGeojson.properties = {};
|
|
10313
|
+
}
|
|
10314
|
+
_previewGeojson.properties.bearing = geojsonProps.bearing;
|
|
10315
|
+
return _previewGeojson;
|
|
10316
|
+
};
|
|
10317
|
+
function PdfPreview(props) {
|
|
10318
|
+
var _a;
|
|
10319
|
+
var pdfContext = useContext(PdfContext);
|
|
10320
|
+
var initializedRef = useRef(false);
|
|
10321
|
+
var activeFeature = useRef();
|
|
10322
|
+
var dragging = useRef(false);
|
|
10323
|
+
var draggingResizeHandle = useRef(false);
|
|
10324
|
+
var draggingRotationHandle = useRef(false);
|
|
10325
|
+
var _b = useState({
|
|
10326
|
+
center: { lng: 0, lat: 0 },
|
|
10327
|
+
distance: 10,
|
|
10328
|
+
bearing: 0,
|
|
10329
|
+
geojson: undefined,
|
|
10330
|
+
}), geojsonProps = _b[0], setGeojsonProps = _b[1];
|
|
10331
|
+
var mapHook = useMap({
|
|
10332
|
+
mapId: props.mapId,
|
|
10333
|
+
waitForLayer: props.insertBeforeLayer,
|
|
10334
|
+
});
|
|
10335
|
+
useEffect(function () {
|
|
10336
|
+
if (!mapHook.map ||
|
|
10337
|
+
!pdfContext.geojsonRef ||
|
|
10338
|
+
!pdfContext.orientation ||
|
|
10339
|
+
!pdfContext.template ||
|
|
10340
|
+
initializedRef.current)
|
|
10341
|
+
return;
|
|
10342
|
+
initializedRef.current = true;
|
|
10343
|
+
var center = mapHook.map.map.getCenter();
|
|
10344
|
+
var canvasHeight = mapHook.map.map._canvas.height;
|
|
10345
|
+
var canvasWidth = mapHook.map.map._canvas.width;
|
|
10346
|
+
var bboxPixelHeight = Math.ceil(canvasHeight / 2);
|
|
10347
|
+
var bboxPixelWidth = Math.ceil((pdfContext.template.width / pdfContext.template.height) * bboxPixelHeight);
|
|
10348
|
+
var topLeft = mapHook.map.map.unproject([
|
|
10349
|
+
Math.floor(canvasWidth / 2 - bboxPixelWidth / 2),
|
|
10350
|
+
Math.floor(canvasHeight / 2 - bboxPixelHeight / 2),
|
|
10351
|
+
]);
|
|
10352
|
+
var distance = turf.distance([center.lng, center.lat], [topLeft.lng, topLeft.lat]);
|
|
10353
|
+
var tmpGeojsonProps = {
|
|
10354
|
+
center: center,
|
|
10355
|
+
distance: distance,
|
|
10356
|
+
bearing: 0,
|
|
10357
|
+
geojson: createPreviewGeojson({ center: center, distance: distance, bearing: 0 }, pdfContext.orientation),
|
|
10358
|
+
};
|
|
10359
|
+
setGeojsonProps(tmpGeojsonProps);
|
|
10360
|
+
pdfContext.geojsonRef.current = tmpGeojsonProps.geojson;
|
|
10361
|
+
}, [mapHook.map]);
|
|
10362
|
+
useEffect(function () {
|
|
10363
|
+
if (!pdfContext.orientation || !pdfContext.geojsonRef)
|
|
10364
|
+
return;
|
|
10365
|
+
var tmpGeojsonProps = JSON.parse(JSON.stringify(geojsonProps));
|
|
10366
|
+
tmpGeojsonProps.geojson = createPreviewGeojson(tmpGeojsonProps, pdfContext.orientation);
|
|
10367
|
+
setGeojsonProps(tmpGeojsonProps);
|
|
10368
|
+
pdfContext.geojsonRef.current = tmpGeojsonProps.geojson;
|
|
10369
|
+
}, [pdfContext.orientation]);
|
|
10370
|
+
// Resize handle events
|
|
10371
|
+
useLayerEvent({
|
|
10372
|
+
event: 'mouseenter',
|
|
10373
|
+
layerId: 'pdfPreviewGeojsonResizeHandle',
|
|
10374
|
+
eventHandler: function () {
|
|
10375
|
+
if (!mapHook.map)
|
|
10376
|
+
return;
|
|
10377
|
+
mapHook.map.map._canvas.style.cursor = 'nwse-resize';
|
|
10378
|
+
mapHook.map.map.dragPan.disable();
|
|
10379
|
+
},
|
|
10380
|
+
});
|
|
10381
|
+
useLayerEvent({
|
|
10382
|
+
event: 'mouseleave',
|
|
10383
|
+
layerId: 'pdfPreviewGeojsonResizeHandle',
|
|
10384
|
+
eventHandler: function () {
|
|
10385
|
+
if (!mapHook.map)
|
|
10386
|
+
return;
|
|
10387
|
+
mapHook.map.map._canvas.style.cursor = '';
|
|
10388
|
+
mapHook.map.map.dragPan.enable();
|
|
10389
|
+
},
|
|
10390
|
+
});
|
|
10391
|
+
useLayerEvent({
|
|
10392
|
+
event: 'mousedown',
|
|
10393
|
+
layerId: 'pdfPreviewGeojsonResizeHandle',
|
|
10394
|
+
addTouchEvents: true,
|
|
10395
|
+
eventHandler: function (e) {
|
|
10396
|
+
e.preventDefault();
|
|
10397
|
+
if (!mapHook.map)
|
|
10398
|
+
return;
|
|
10399
|
+
dragging.current = false;
|
|
10400
|
+
draggingRotationHandle.current = false;
|
|
10401
|
+
draggingResizeHandle.current = true;
|
|
10402
|
+
mapHook.map.map._canvas.style.cursor = 'move';
|
|
10403
|
+
function onMove(e) {
|
|
10404
|
+
if (!pdfContext.geojsonRef || !draggingResizeHandle.current || !pdfContext.orientation)
|
|
10405
|
+
return;
|
|
10406
|
+
var tmpGeojsonProps = JSON.parse(JSON.stringify(geojsonProps));
|
|
10407
|
+
var _distance = turf.distance([tmpGeojsonProps.center.lng, tmpGeojsonProps.center.lat], [e.lngLat.lng, e.lngLat.lat]);
|
|
10408
|
+
// limit max diagonal distance of PDF area to 120km as larger area lead to distortions for northern and southern areas
|
|
10409
|
+
if (_distance > 60) {
|
|
10410
|
+
_distance = 60;
|
|
10411
|
+
}
|
|
10412
|
+
tmpGeojsonProps.distance = _distance;
|
|
10413
|
+
tmpGeojsonProps.geojson = createPreviewGeojson(tmpGeojsonProps, pdfContext.orientation);
|
|
10414
|
+
pdfContext.geojsonRef.current = tmpGeojsonProps.geojson;
|
|
10415
|
+
setGeojsonProps(tmpGeojsonProps);
|
|
10416
|
+
}
|
|
10417
|
+
function onUp() {
|
|
10418
|
+
if (!draggingResizeHandle.current || !mapHook.map)
|
|
10419
|
+
return;
|
|
10420
|
+
mapHook.map.map._canvas.style.cursor = '';
|
|
10421
|
+
draggingResizeHandle.current = false;
|
|
10422
|
+
mapHook.map.map.dragPan.enable();
|
|
10423
|
+
// Unbind mouse events
|
|
10424
|
+
mapHook.map.map.off('mousemove', onMove);
|
|
10425
|
+
mapHook.map.map.off('touchmove', onMove);
|
|
10426
|
+
}
|
|
10427
|
+
// Mouse events
|
|
10428
|
+
mapHook.map.map.on('mousemove', onMove);
|
|
10429
|
+
mapHook.map.map.on('touchmove', onMove);
|
|
10430
|
+
mapHook.map.map.once('mouseup', onUp);
|
|
10431
|
+
mapHook.map.map.once('touchend', onUp);
|
|
10432
|
+
},
|
|
10433
|
+
});
|
|
10434
|
+
// Rotation handle events
|
|
10435
|
+
useLayerEvent({
|
|
10436
|
+
event: 'mouseenter',
|
|
10437
|
+
layerId: 'pdfPreviewGeojsonRotationHandle',
|
|
10438
|
+
eventHandler: function () {
|
|
10439
|
+
if (!mapHook.map)
|
|
10440
|
+
return;
|
|
10441
|
+
mapHook.map.map._canvas.style.cursor = 'nwse-resize';
|
|
10442
|
+
mapHook.map.map.dragPan.disable();
|
|
10443
|
+
},
|
|
10444
|
+
});
|
|
10445
|
+
useLayerEvent({
|
|
10446
|
+
event: 'mouseleave',
|
|
10447
|
+
layerId: 'pdfPreviewGeojsonRotationHandle',
|
|
10448
|
+
eventHandler: function () {
|
|
10449
|
+
if (!mapHook.map)
|
|
10450
|
+
return;
|
|
10451
|
+
mapHook.map.map._canvas.style.cursor = '';
|
|
10452
|
+
mapHook.map.map.dragPan.enable();
|
|
10453
|
+
},
|
|
10454
|
+
});
|
|
10455
|
+
useLayerEvent({
|
|
10456
|
+
event: 'mousedown',
|
|
10457
|
+
layerId: 'pdfPreviewGeojsonRotationHandle',
|
|
10458
|
+
addTouchEvents: true,
|
|
10459
|
+
eventHandler: function (e) {
|
|
10460
|
+
e.preventDefault();
|
|
10461
|
+
if (!mapHook.map || !pdfContext.orientation)
|
|
10462
|
+
return;
|
|
10463
|
+
dragging.current = false;
|
|
10464
|
+
draggingResizeHandle.current = false;
|
|
10465
|
+
draggingRotationHandle.current = true;
|
|
10466
|
+
mapHook.map.map._canvas.style.cursor = 'move';
|
|
10467
|
+
function onMove(e) {
|
|
10468
|
+
e.preventDefault();
|
|
10469
|
+
if (!draggingRotationHandle.current || !pdfContext.orientation || !pdfContext.geojsonRef)
|
|
10470
|
+
return;
|
|
10471
|
+
var tmpGeojsonProps = JSON.parse(JSON.stringify(geojsonProps));
|
|
10472
|
+
var _bearing = turf.bearing([tmpGeojsonProps.center.lng, tmpGeojsonProps.center.lat], [e.lngLat.lng, e.lngLat.lat]);
|
|
10473
|
+
tmpGeojsonProps.bearing = 144.7 + _bearing;
|
|
10474
|
+
tmpGeojsonProps.geojson = createPreviewGeojson(tmpGeojsonProps, pdfContext.orientation);
|
|
10475
|
+
pdfContext.geojsonRef.current = tmpGeojsonProps.geojson;
|
|
10476
|
+
setGeojsonProps(tmpGeojsonProps);
|
|
10477
|
+
}
|
|
10478
|
+
function onUp() {
|
|
10479
|
+
if (!draggingRotationHandle.current || !mapHook.map)
|
|
10480
|
+
return;
|
|
10481
|
+
mapHook.map.map._canvas.style.cursor = '';
|
|
10482
|
+
draggingRotationHandle.current = false;
|
|
10483
|
+
mapHook.map.map.dragPan.enable();
|
|
10484
|
+
// Unbind mouse events
|
|
10485
|
+
mapHook.map.map.off('mousemove', onMove);
|
|
10486
|
+
mapHook.map.map.off('touchmove', onMove);
|
|
10487
|
+
}
|
|
10488
|
+
// Mouse events
|
|
10489
|
+
mapHook.map.map.on('mousemove', onMove);
|
|
10490
|
+
mapHook.map.map.on('touchmove', onMove);
|
|
10491
|
+
mapHook.map.map.once('mouseup', onUp);
|
|
10492
|
+
mapHook.map.map.once('touchend', onUp);
|
|
10493
|
+
},
|
|
10494
|
+
});
|
|
10495
|
+
// drag & drop events
|
|
10496
|
+
useLayerEvent({
|
|
10497
|
+
event: 'mouseenter',
|
|
10498
|
+
layerId: 'pdfPreviewGeojson',
|
|
10499
|
+
eventHandler: function (e) {
|
|
10500
|
+
var _a;
|
|
10501
|
+
if (!mapHook.map || !((_a = e === null || e === void 0 ? void 0 : e.features) === null || _a === void 0 ? void 0 : _a.length))
|
|
10502
|
+
return;
|
|
10503
|
+
mapHook.map.map._canvas.style.cursor = 'move';
|
|
10504
|
+
activeFeature.current = e.features[0];
|
|
10505
|
+
},
|
|
10506
|
+
});
|
|
10507
|
+
useLayerEvent({
|
|
10508
|
+
event: 'mouseleave',
|
|
10509
|
+
layerId: 'pdfPreviewGeojson',
|
|
10510
|
+
eventHandler: function () {
|
|
10511
|
+
if (!mapHook.map)
|
|
10512
|
+
return;
|
|
10513
|
+
mapHook.map.map._canvas.style.cursor = '';
|
|
10514
|
+
mapHook.map.map.dragPan.enable();
|
|
10515
|
+
activeFeature.current = undefined;
|
|
10516
|
+
},
|
|
10517
|
+
});
|
|
10518
|
+
useLayerEvent({
|
|
10519
|
+
event: 'mousedown',
|
|
10520
|
+
addTouchEvents: true,
|
|
10521
|
+
layerId: 'pdfPreviewGeojson',
|
|
10522
|
+
eventHandler: function (e) {
|
|
10523
|
+
e.preventDefault();
|
|
10524
|
+
console.log('mousedown');
|
|
10525
|
+
if (!mapHook.map)
|
|
10526
|
+
return;
|
|
10527
|
+
draggingResizeHandle.current = false;
|
|
10528
|
+
draggingRotationHandle.current = false;
|
|
10529
|
+
dragging.current = true;
|
|
10530
|
+
mapHook.map.map._canvas.style.cursor = 'move';
|
|
10531
|
+
function onMove(e) {
|
|
10532
|
+
e.preventDefault();
|
|
10533
|
+
if (!dragging.current || !pdfContext.geojsonRef || !pdfContext.orientation)
|
|
10534
|
+
return;
|
|
10535
|
+
var tmpGeojsonProps = JSON.parse(JSON.stringify(geojsonProps));
|
|
10536
|
+
tmpGeojsonProps.center = e.lngLat;
|
|
10537
|
+
tmpGeojsonProps.geojson = createPreviewGeojson(tmpGeojsonProps, pdfContext.orientation);
|
|
10538
|
+
pdfContext.geojsonRef.current = tmpGeojsonProps.geojson;
|
|
10539
|
+
setGeojsonProps(tmpGeojsonProps);
|
|
10540
|
+
}
|
|
10541
|
+
function onUp() {
|
|
10542
|
+
if (!dragging.current || !mapHook.map)
|
|
10543
|
+
return;
|
|
10544
|
+
mapHook.map.map._canvas.style.cursor = '';
|
|
10545
|
+
dragging.current = false;
|
|
10546
|
+
mapHook.map.map.dragPan.enable();
|
|
10547
|
+
// Unbind mouse events
|
|
10548
|
+
mapHook.map.map.off('mousemove', onMove);
|
|
10549
|
+
mapHook.map.map.off('touchmove', onMove);
|
|
10550
|
+
}
|
|
10551
|
+
// Mouse events
|
|
10552
|
+
mapHook.map.map.on('mousemove', onMove);
|
|
10553
|
+
mapHook.map.map.on('touchmove', onMove);
|
|
10554
|
+
mapHook.map.map.once('mouseup', onUp);
|
|
10555
|
+
mapHook.map.map.once('touchend', onUp);
|
|
10556
|
+
},
|
|
10557
|
+
});
|
|
10558
|
+
//map.on('mouseleave', 'point', function() {
|
|
10559
|
+
// map.setPaintProperty('point', 'circle-color', '#3887be');
|
|
10560
|
+
// canvas.style.cursor = '';
|
|
10561
|
+
// isCursorOverPoint = false;
|
|
10562
|
+
// map.dragPan.enable();
|
|
10563
|
+
//});
|
|
10564
|
+
return (React__default.createElement(React__default.Fragment, null, ((_a = geojsonProps === null || geojsonProps === void 0 ? void 0 : geojsonProps.geojson) === null || _a === void 0 ? void 0 : _a.bbox) && (React__default.createElement(React__default.Fragment, null,
|
|
10565
|
+
React__default.createElement(MlGeoJsonLayer, { paint: { 'line-color': '#616161', 'line-width': 4 }, type: "line", layerId: "pdfPreviewGeojsonOutline", geojson: geojsonProps.geojson }),
|
|
10566
|
+
React__default.createElement(MlGeoJsonLayer, { paint: { 'fill-opacity': 0 }, type: "fill", layerId: "pdfPreviewGeojson", geojson: geojsonProps.geojson }),
|
|
10567
|
+
React__default.createElement(MlGeoJsonLayer, { layerId: "pdfPreviewGeojsonResizeHandle", paint: {
|
|
10568
|
+
'circle-radius': 10,
|
|
10569
|
+
'circle-color': '#1976d2',
|
|
10570
|
+
'circle-stroke-width': 2,
|
|
10571
|
+
'circle-stroke-color': '#ffffff',
|
|
10572
|
+
}, geojson: {
|
|
10573
|
+
type: 'Feature',
|
|
10574
|
+
geometry: {
|
|
10575
|
+
type: 'Point',
|
|
10576
|
+
//coordinates: [geojsonProps.geojson.bbox[2], geojsonProps.geojson.bbox[3]],
|
|
10577
|
+
coordinates: geojsonProps.geojson.geometry.coordinates[0][2],
|
|
10578
|
+
},
|
|
10579
|
+
properties: {},
|
|
10580
|
+
} }),
|
|
10581
|
+
React__default.createElement(MlGeoJsonLayer, { layerId: "pdfPreviewGeojsonRotationHandle", paint: {
|
|
10582
|
+
'circle-radius': 10,
|
|
10583
|
+
'circle-color': '#86dd71',
|
|
10584
|
+
'circle-stroke-width': 2,
|
|
10585
|
+
'circle-stroke-color': '#ffffff',
|
|
10586
|
+
}, geojson: {
|
|
10587
|
+
type: 'Feature',
|
|
10588
|
+
geometry: {
|
|
10589
|
+
type: 'Point',
|
|
10590
|
+
//coordinates: [geojsonProps.geojson.bbox[0], geojsonProps.geojson.bbox[3]],
|
|
10591
|
+
coordinates: geojsonProps.geojson.geometry.coordinates[0][3],
|
|
10592
|
+
},
|
|
10593
|
+
properties: {},
|
|
10594
|
+
} })))));
|
|
10595
|
+
}
|
|
10596
|
+
|
|
10597
|
+
var createExport = function (options) {
|
|
10598
|
+
var width = options.width;
|
|
10599
|
+
var height = options.height;
|
|
10600
|
+
// Create map container
|
|
10601
|
+
var hiddenContainer = document.createElement('div');
|
|
10602
|
+
hiddenContainer.className = 'hidden-map';
|
|
10603
|
+
document.body.appendChild(hiddenContainer);
|
|
10604
|
+
var container = document.createElement('div');
|
|
10605
|
+
container.style.width = width + 'px';
|
|
10606
|
+
container.style.height = height + 'px';
|
|
10607
|
+
hiddenContainer.appendChild(container);
|
|
10608
|
+
var style = options.map.map.getStyle();
|
|
10609
|
+
var _loop_1 = function (name_1) {
|
|
10610
|
+
var src = style.sources[name_1];
|
|
10611
|
+
Object.keys(src).forEach(function (key) {
|
|
10612
|
+
// delete property if value is undefined.
|
|
10613
|
+
// for instance, raster-dem might have undefined value in "url" and "bounds"
|
|
10614
|
+
if (!src[key]) {
|
|
10615
|
+
delete src[key];
|
|
10616
|
+
}
|
|
10617
|
+
});
|
|
10618
|
+
};
|
|
10619
|
+
// delete undefined source properties
|
|
10620
|
+
for (var name_1 in style.sources) {
|
|
10621
|
+
_loop_1(name_1);
|
|
10622
|
+
}
|
|
10623
|
+
// Create a new MapLibre-gl instance
|
|
10624
|
+
var renderMap = new Map$2({
|
|
10625
|
+
container: container,
|
|
10626
|
+
center: options.map.map.getCenter(),
|
|
10627
|
+
zoom: options.map.map.getZoom(),
|
|
10628
|
+
bearing: 0,
|
|
10629
|
+
pitch: 0,
|
|
10630
|
+
interactive: false,
|
|
10631
|
+
preserveDrawingBuffer: true,
|
|
10632
|
+
fadeDuration: 0,
|
|
10633
|
+
attributionControl: false,
|
|
10634
|
+
style: style,
|
|
10635
|
+
});
|
|
10636
|
+
var _previewGeojson = turf.bboxPolygon([
|
|
10637
|
+
options.bbox[0],
|
|
10638
|
+
options.bbox[1],
|
|
10639
|
+
options.bbox[2],
|
|
10640
|
+
options.bbox[3],
|
|
10641
|
+
]);
|
|
10642
|
+
_previewGeojson = turf.transformRotate(_previewGeojson, options.bearing);
|
|
10643
|
+
// use original unrotated bbox and bearing 0 to calculate the correct zoom value as the function always adds a padding if used on the rotated feature coordinates
|
|
10644
|
+
var bboxCamera = renderMap._cameraForBoxAndBearing([options.bboxUnrotated[0], options.bboxUnrotated[1]], [options.bboxUnrotated[2], options.bboxUnrotated[3]], 0);
|
|
10645
|
+
var geometryCamera = renderMap._cameraForBoxAndBearing(_previewGeojson.geometry.coordinates[0][0], _previewGeojson.geometry.coordinates[0][2], options.bearing);
|
|
10646
|
+
geometryCamera.zoom = bboxCamera.zoom;
|
|
10647
|
+
renderMap._fitInternal(geometryCamera);
|
|
10648
|
+
return new Promise(function (resolve) {
|
|
10649
|
+
renderMap.once('idle', function () {
|
|
10650
|
+
if (renderMap.getLayer('pdfPreviewGeojsonOutline')) {
|
|
10651
|
+
renderMap.setLayoutProperty('pdfPreviewGeojsonOutline', 'visibility', 'none');
|
|
10652
|
+
}
|
|
10653
|
+
if (renderMap.getLayer('pdfPreviewGeojson')) {
|
|
10654
|
+
renderMap.setLayoutProperty('pdfPreviewGeojson', 'visibility', 'none');
|
|
10655
|
+
}
|
|
10656
|
+
if (renderMap.getLayer('pdfPreviewGeojsonResizeHandle')) {
|
|
10657
|
+
renderMap.setLayoutProperty('pdfPreviewGeojsonResizeHandle', 'visibility', 'none');
|
|
10658
|
+
}
|
|
10659
|
+
if (renderMap.getLayer('pdfPreviewGeojsonRotationHandle')) {
|
|
10660
|
+
renderMap.setLayoutProperty('pdfPreviewGeojsonRotationHandle', 'visibility', 'none');
|
|
10661
|
+
}
|
|
10662
|
+
renderMap.once('idle', function () {
|
|
10663
|
+
var params = __assign(__assign({}, options), { renderMap: renderMap, hiddenContainer: hiddenContainer, createPdf: function (_options) {
|
|
10664
|
+
return createJsPdf(__assign(__assign(__assign({}, options), { renderMap: renderMap, hiddenContainer: hiddenContainer }), _options));
|
|
10665
|
+
} });
|
|
10666
|
+
resolve(params);
|
|
10667
|
+
});
|
|
10668
|
+
});
|
|
10669
|
+
});
|
|
10670
|
+
};
|
|
10671
|
+
function createJsPdf(options) {
|
|
10672
|
+
var pdf = new jsPDF({
|
|
10673
|
+
orientation: (options === null || options === void 0 ? void 0 : options.orientation) === 'portrait' ? 'p' : 'l',
|
|
10674
|
+
unit: 'mm',
|
|
10675
|
+
compress: true,
|
|
10676
|
+
format: options.format,
|
|
10677
|
+
});
|
|
10678
|
+
Object.defineProperty(window, 'devicePixelRatio', {
|
|
10679
|
+
get: function () {
|
|
10680
|
+
return 300 / 96;
|
|
10681
|
+
},
|
|
10682
|
+
});
|
|
10683
|
+
return new Promise(function (resolve) {
|
|
10684
|
+
var _a;
|
|
10685
|
+
//Render map image
|
|
10686
|
+
pdf.addImage(options.renderMap.getCanvas().toDataURL('image/png'), 'png', 0, 0, pdf.internal.pageSize.getWidth(), pdf.internal.pageSize.getHeight(), undefined, 'FAST');
|
|
10687
|
+
// remove DOM Elements
|
|
10688
|
+
options.renderMap.remove();
|
|
10689
|
+
(_a = options.hiddenContainer.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(options.hiddenContainer);
|
|
10690
|
+
var params = __assign(__assign({}, options), { pdf: pdf, downloadPdf: function (_options) { return downloadPdf(__assign(__assign({}, params), _options)); } });
|
|
10691
|
+
resolve(params);
|
|
10692
|
+
});
|
|
10693
|
+
}
|
|
10694
|
+
function downloadPdf(options) {
|
|
10695
|
+
options.pdf.save('Map.pdf');
|
|
10696
|
+
return new Promise(function (resolve) {
|
|
10697
|
+
resolve(__assign({}, options));
|
|
10698
|
+
});
|
|
10699
|
+
}
|
|
10700
|
+
|
|
10701
|
+
function exportMap(props) {
|
|
10702
|
+
var mapHook = useMap({ mapId: props.mapId });
|
|
10703
|
+
var _createExport = useMemo(function () {
|
|
10704
|
+
if (mapHook.map) {
|
|
10705
|
+
return function (options) {
|
|
10706
|
+
return createExport(__assign({ map: mapHook.map }, options));
|
|
10707
|
+
};
|
|
10708
|
+
}
|
|
10709
|
+
return;
|
|
10710
|
+
}, [mapHook.map]);
|
|
10711
|
+
return {
|
|
10712
|
+
createExport: _createExport,
|
|
10713
|
+
};
|
|
10714
|
+
}
|
|
10715
|
+
|
|
10716
|
+
var qualityOptions = [
|
|
10717
|
+
{
|
|
10718
|
+
value: '72dpi',
|
|
10719
|
+
label: 'Draft (72dpi)',
|
|
10720
|
+
},
|
|
10721
|
+
{
|
|
10722
|
+
value: '150dpi',
|
|
10723
|
+
label: 'Medium (150dpi)',
|
|
10724
|
+
},
|
|
10725
|
+
{
|
|
10726
|
+
value: '300dpi',
|
|
10727
|
+
label: 'High (300dpi)',
|
|
10728
|
+
},
|
|
10729
|
+
];
|
|
10730
|
+
function PdfForm(props) {
|
|
10731
|
+
var pdfContext = useContext(PdfContext);
|
|
10732
|
+
var mapHook = useMap({
|
|
10733
|
+
// eslint-disable-next-line react/prop-types
|
|
10734
|
+
mapId: props.mapId,
|
|
10735
|
+
});
|
|
10736
|
+
var mapExporter = exportMap({ mapId: props.mapId });
|
|
10737
|
+
var createPdfHandler = useCallback(function () {
|
|
10738
|
+
var _a, _b, _c, _d, _e;
|
|
10739
|
+
if (mapHook.map &&
|
|
10740
|
+
mapExporter.createExport &&
|
|
10741
|
+
pdfContext.template &&
|
|
10742
|
+
pdfContext.format &&
|
|
10743
|
+
pdfContext.orientation &&
|
|
10744
|
+
((_b = (_a = pdfContext.geojsonRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.bbox) &&
|
|
10745
|
+
((_c = pdfContext.geojsonRef) === null || _c === void 0 ? void 0 : _c.current)) {
|
|
10746
|
+
var bbox = turf.bbox(pdfContext.geojsonRef.current);
|
|
10747
|
+
mapExporter
|
|
10748
|
+
.createExport({
|
|
10749
|
+
width: pdfContext.template.width,
|
|
10750
|
+
height: pdfContext.template.height,
|
|
10751
|
+
bbox: bbox,
|
|
10752
|
+
bboxUnrotated: pdfContext.geojsonRef.current.bbox,
|
|
10753
|
+
bearing: ((_e = (_d = pdfContext.geojsonRef.current) === null || _d === void 0 ? void 0 : _d.properties) === null || _e === void 0 ? void 0 : _e.bearing) || 0,
|
|
10754
|
+
format: pdfContext.format.toLowerCase(),
|
|
10755
|
+
orientation: pdfContext.orientation,
|
|
10756
|
+
})
|
|
10757
|
+
.then(function (res) { return res.createPdf(); })
|
|
10758
|
+
.then(function (res) {
|
|
10759
|
+
if (typeof props.onCreatePdf === 'function') {
|
|
10760
|
+
props.onCreatePdf(res);
|
|
10761
|
+
}
|
|
10762
|
+
return res.downloadPdf();
|
|
10763
|
+
})
|
|
10764
|
+
.catch(function (error) {
|
|
10765
|
+
console.log(error);
|
|
10766
|
+
});
|
|
10767
|
+
}
|
|
10768
|
+
}, [mapHook.map, pdfContext]);
|
|
10769
|
+
var formControlStyles = useMemo(function () {
|
|
10770
|
+
return {
|
|
10771
|
+
margin: '5px 0 15px 0 ',
|
|
10772
|
+
//...props.formControlStyles,
|
|
10773
|
+
};
|
|
10774
|
+
}, [
|
|
10775
|
+
/*props.formControlStyles*/
|
|
10776
|
+
]);
|
|
10777
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
10778
|
+
React__default.createElement(FormControl, { fullWidth: true, sx: formControlStyles },
|
|
10779
|
+
React__default.createElement(InputLabel, { id: "format-select-label" }, "Format"),
|
|
10780
|
+
React__default.createElement(Select, { labelId: "format-select-label", id: "format-select", label: "Format", value: pdfContext.format, onChange: function (event) {
|
|
10781
|
+
var _a;
|
|
10782
|
+
(_a = pdfContext.setFormat) === null || _a === void 0 ? void 0 : _a.call(pdfContext, event.target.value);
|
|
10783
|
+
} }, Object.keys(PdfTemplates).map(function (el) { return (React__default.createElement(MenuItem, { key: el, value: el }, el)); }))),
|
|
10784
|
+
React__default.createElement(FormControl, { fullWidth: true, sx: formControlStyles },
|
|
10785
|
+
React__default.createElement(FormLabel, { id: "orientation-radio-buttons-group-label" }, "Orientation"),
|
|
10786
|
+
React__default.createElement(RadioGroup, { row: true, "aria-labelledby": "orientation-radio-buttons-group-label", name: "orientation-radio-buttons-group", value: pdfContext.orientation, onChange: function (event) {
|
|
10787
|
+
var _a;
|
|
10788
|
+
(_a = pdfContext.setOrientation) === null || _a === void 0 ? void 0 : _a.call(pdfContext, event.target.value);
|
|
10789
|
+
} },
|
|
10790
|
+
React__default.createElement(FormControlLabel, { value: "portrait", control: React__default.createElement(Radio, null), label: "Portrait" }),
|
|
10791
|
+
React__default.createElement(FormControlLabel, { value: "landscape", control: React__default.createElement(Radio, null), label: "Landscape" }))),
|
|
10792
|
+
React__default.createElement(FormControl, { fullWidth: true, sx: formControlStyles },
|
|
10793
|
+
React__default.createElement(InputLabel, { id: "quality-select-label" }, "Quality"),
|
|
10794
|
+
React__default.createElement(Select, { labelId: "quality-select-label", id: "quality-select", label: "Qualit\u00E4t", value: pdfContext.quality, onChange: function (event) {
|
|
10795
|
+
var _a;
|
|
10796
|
+
(_a = pdfContext.setQuality) === null || _a === void 0 ? void 0 : _a.call(pdfContext, event.target.value);
|
|
10797
|
+
} }, qualityOptions.map(function (el) { return (React__default.createElement(MenuItem, { key: el.value, value: el.value }, el.label)); }))),
|
|
10798
|
+
React__default.createElement(FormControl, { fullWidth: true, sx: formControlStyles },
|
|
10799
|
+
React__default.createElement(Button$2, { variant: "contained", onClick: createPdfHandler }, "PDF erstellen"))));
|
|
10800
|
+
}
|
|
10801
|
+
|
|
10802
|
+
/**
|
|
10803
|
+
* Create PDF Form Component
|
|
10804
|
+
*
|
|
10805
|
+
*/
|
|
10806
|
+
var MlCreatePdfForm = function (props) {
|
|
10807
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
10808
|
+
React__default.createElement(PdfContextProvider, null,
|
|
10809
|
+
React__default.createElement(PdfForm, __assign({}, props)),
|
|
10810
|
+
React__default.createElement(PdfPreview, null))));
|
|
10811
|
+
};
|
|
10812
|
+
MlCreatePdfForm.defaultProps = {
|
|
10813
|
+
mapId: undefined,
|
|
10814
|
+
};
|
|
10815
|
+
|
|
10816
|
+
/**
|
|
10817
|
+
* Code from https://github.com/mapbox/mapbox-gl-draw
|
|
10818
|
+
* and licensed under ISC
|
|
10819
|
+
*/
|
|
10820
|
+
var classes = {
|
|
10821
|
+
CONTROL_BASE: 'mapboxgl-ctrl',
|
|
10822
|
+
CONTROL_PREFIX: 'mapboxgl-ctrl-',
|
|
10823
|
+
CONTROL_BUTTON: 'mapbox-gl-draw_ctrl-draw-btn',
|
|
10824
|
+
CONTROL_BUTTON_LINE: 'mapbox-gl-draw_line',
|
|
10825
|
+
CONTROL_BUTTON_POLYGON: 'mapbox-gl-draw_polygon',
|
|
10826
|
+
CONTROL_BUTTON_POINT: 'mapbox-gl-draw_point',
|
|
10827
|
+
CONTROL_BUTTON_TRASH: 'mapbox-gl-draw_trash',
|
|
10828
|
+
CONTROL_BUTTON_COMBINE_FEATURES: 'mapbox-gl-draw_combine',
|
|
10829
|
+
CONTROL_BUTTON_UNCOMBINE_FEATURES: 'mapbox-gl-draw_uncombine',
|
|
10830
|
+
CONTROL_GROUP: 'mapboxgl-ctrl-group',
|
|
10831
|
+
ATTRIBUTION: 'mapboxgl-ctrl-attrib',
|
|
10832
|
+
ACTIVE_BUTTON: 'active',
|
|
10833
|
+
BOX_SELECT: 'mapbox-gl-draw_boxselect'
|
|
10834
|
+
};
|
|
10835
|
+
var cursors = {
|
|
10836
|
+
ADD: 'add',
|
|
10837
|
+
MOVE: 'move',
|
|
10838
|
+
DRAG: 'drag',
|
|
10839
|
+
POINTER: 'pointer',
|
|
10840
|
+
NONE: 'none'
|
|
10841
|
+
};
|
|
10842
|
+
var types$1 = {
|
|
10843
|
+
POLYGON: 'polygon',
|
|
10844
|
+
LINE: 'line_string',
|
|
10845
|
+
POINT: 'point'
|
|
10846
|
+
};
|
|
10847
|
+
var geojsonTypes = {
|
|
10848
|
+
FEATURE: 'Feature',
|
|
10849
|
+
POLYGON: 'Polygon',
|
|
10850
|
+
LINE_STRING: 'LineString',
|
|
10851
|
+
POINT: 'Point',
|
|
10852
|
+
FEATURE_COLLECTION: 'FeatureCollection',
|
|
10853
|
+
MULTI_PREFIX: 'Multi',
|
|
10854
|
+
MULTI_POINT: 'MultiPoint',
|
|
10855
|
+
MULTI_LINE_STRING: 'MultiLineString',
|
|
10856
|
+
MULTI_POLYGON: 'MultiPolygon'
|
|
10857
|
+
};
|
|
10858
|
+
var events = {
|
|
10859
|
+
CREATE: 'draw.create',
|
|
9970
10860
|
DELETE: 'draw.delete',
|
|
9971
10861
|
UPDATE: 'draw.update',
|
|
9972
10862
|
SELECTION_CHANGE: 'draw.selectionchange',
|
|
@@ -12223,188 +13113,49 @@ var MlFeatureEditor = function (props) {
|
|
|
12223
13113
|
custom_polygon: CustomPolygonMode,
|
|
12224
13114
|
custom_select: CustomSelectMode,
|
|
12225
13115
|
custom_direct_select: DirectSelect,
|
|
12226
|
-
}, MapboxDraw.modes),
|
|
12227
|
-
});
|
|
12228
|
-
mapHook.map.addControl(draw.current, "top-left", mapHook.componentId);
|
|
12229
|
-
mapHook.map.on("draw.modechange", modeChangeHandler, mapHook.componentId);
|
|
12230
|
-
setDrawToolsReady(true);
|
|
12231
|
-
}
|
|
12232
|
-
}, [mapHook.map, props, drawToolsInitialized]);
|
|
12233
|
-
useEffect(function () {
|
|
12234
|
-
if (!mapHook.map || !drawToolsReady)
|
|
12235
|
-
return;
|
|
12236
|
-
var changeHandler = function () {
|
|
12237
|
-
var _a, _b;
|
|
12238
|
-
if (draw.current) {
|
|
12239
|
-
// update drawnFeatures state object
|
|
12240
|
-
if (typeof props.onChange === "function") {
|
|
12241
|
-
var currentFeatureCollection = (_b = (_a = draw.current).getAll) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
12242
|
-
props.onChange(currentFeatureCollection === null || currentFeatureCollection === void 0 ? void 0 : currentFeatureCollection.features);
|
|
12243
|
-
}
|
|
12244
|
-
}
|
|
12245
|
-
};
|
|
12246
|
-
mapHook.map.on("mouseup", changeHandler);
|
|
12247
|
-
mapHook.map.on("touchend", changeHandler);
|
|
12248
|
-
return function () {
|
|
12249
|
-
if (!mapHook.map)
|
|
12250
|
-
return;
|
|
12251
|
-
mapHook.map.map.off("mouseup", changeHandler);
|
|
12252
|
-
mapHook.map.map.off("touchend", changeHandler);
|
|
12253
|
-
};
|
|
12254
|
-
}, [drawToolsReady, mapHook.map]);
|
|
12255
|
-
useEffect(function () {
|
|
12256
|
-
var _a;
|
|
12257
|
-
if (draw.current && ((_a = props.geojson) === null || _a === void 0 ? void 0 : _a.geometry)) {
|
|
12258
|
-
draw.current.set({ type: "FeatureCollection", features: [props.geojson] });
|
|
12259
|
-
}
|
|
12260
|
-
}, [props.geojson, drawToolsReady]);
|
|
12261
|
-
useEffect(function () {
|
|
12262
|
-
if (props.mode && draw.current) {
|
|
12263
|
-
// @ts-ignore
|
|
12264
|
-
draw.current.changeMode(props.mode);
|
|
12265
|
-
}
|
|
12266
|
-
}, [props.mode]);
|
|
12267
|
-
return React__default.createElement(React__default.Fragment, null);
|
|
12268
|
-
};
|
|
12269
|
-
|
|
12270
|
-
var legalLayerTypes = [
|
|
12271
|
-
'fill',
|
|
12272
|
-
'line',
|
|
12273
|
-
'symbol',
|
|
12274
|
-
'circle',
|
|
12275
|
-
'heatmap',
|
|
12276
|
-
'fill-extrusion',
|
|
12277
|
-
'raster',
|
|
12278
|
-
'hillshade',
|
|
12279
|
-
'background',
|
|
12280
|
-
];
|
|
12281
|
-
function useLayer(props) {
|
|
12282
|
-
var mapHook = useMap({
|
|
12283
|
-
mapId: props.mapId,
|
|
12284
|
-
waitForLayer: props.insertBeforeLayer,
|
|
12285
|
-
});
|
|
12286
|
-
var layerTypeRef = useRef('');
|
|
12287
|
-
var layerPaintConfRef = useRef('');
|
|
12288
|
-
var layerLayoutConfRef = useRef('');
|
|
12289
|
-
var _a = useState(), layer = _a[0], setLayer = _a[1];
|
|
12290
|
-
var initializedRef = useRef(false);
|
|
12291
|
-
var layerId = useRef(props.layerId || (props.idPrefix ? props.idPrefix : 'Layer-') + mapHook.componentId);
|
|
12292
|
-
var createLayer = useCallback(function () {
|
|
12293
|
-
var _a, _b;
|
|
12294
|
-
if (!mapHook.map)
|
|
12295
|
-
return;
|
|
12296
|
-
if (mapHook.map.map.getLayer(layerId.current)) {
|
|
12297
|
-
mapHook.cleanup();
|
|
12298
|
-
}
|
|
12299
|
-
if (mapHook.map.map.getSource(layerId.current)) {
|
|
12300
|
-
mapHook.map.map.removeSource(layerId.current);
|
|
12301
|
-
}
|
|
12302
|
-
if (typeof props.source === 'string') {
|
|
12303
|
-
if (props.source === '' || !mapHook.map.map.getSource(props.source)) {
|
|
12304
|
-
return;
|
|
12305
|
-
}
|
|
12306
|
-
}
|
|
12307
|
-
initializedRef.current = true;
|
|
12308
|
-
mapHook.map.addLayer(__assign(__assign(__assign(__assign({}, props.options), (props.geojson && !props.source
|
|
12309
|
-
? {
|
|
12310
|
-
source: {
|
|
12311
|
-
type: 'geojson',
|
|
12312
|
-
data: props.geojson,
|
|
12313
|
-
},
|
|
12314
|
-
}
|
|
12315
|
-
: {})), (props.source
|
|
12316
|
-
? {
|
|
12317
|
-
source: props.source,
|
|
12318
|
-
}
|
|
12319
|
-
: {})), { id: layerId.current }), props.insertBeforeLayer
|
|
12320
|
-
? props.insertBeforeLayer
|
|
12321
|
-
: props.insertBeforeFirstSymbolLayer
|
|
12322
|
-
? mapHook.map.firstSymbolLayer
|
|
12323
|
-
: undefined, mapHook.componentId);
|
|
12324
|
-
setLayer(mapHook.map.map.getLayer(layerId.current));
|
|
12325
|
-
if (typeof props.onHover !== 'undefined') {
|
|
12326
|
-
mapHook.map.on('mousemove', layerId.current, props.onHover, mapHook.componentId);
|
|
12327
|
-
}
|
|
12328
|
-
if (typeof props.onClick !== 'undefined') {
|
|
12329
|
-
mapHook.map.on('click', layerId.current, props.onClick, mapHook.componentId);
|
|
12330
|
-
}
|
|
12331
|
-
if (typeof props.onLeave !== 'undefined') {
|
|
12332
|
-
mapHook.map.on('mouseleave', layerId.current, props.onLeave, mapHook.componentId);
|
|
12333
|
-
}
|
|
12334
|
-
// recreate layer if style has changed
|
|
12335
|
-
mapHook.map.on('styledata', function () {
|
|
12336
|
-
var _a;
|
|
12337
|
-
if (initializedRef.current && !((_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map.getLayer(layerId.current))) {
|
|
12338
|
-
console.log('Recreate Layer');
|
|
12339
|
-
createLayer();
|
|
12340
|
-
}
|
|
12341
|
-
}, mapHook.componentId);
|
|
12342
|
-
layerPaintConfRef.current = JSON.stringify((_a = props.options) === null || _a === void 0 ? void 0 : _a.paint);
|
|
12343
|
-
layerLayoutConfRef.current = JSON.stringify((_b = props.options) === null || _b === void 0 ? void 0 : _b.layout);
|
|
12344
|
-
layerTypeRef.current = props.options.type;
|
|
12345
|
-
}, [props, mapHook.map]);
|
|
12346
|
-
useEffect(function () {
|
|
12347
|
-
if (!mapHook.map)
|
|
12348
|
-
return;
|
|
12349
|
-
if (initializedRef.current &&
|
|
12350
|
-
(legalLayerTypes.indexOf(props.options.type) === -1 ||
|
|
12351
|
-
(legalLayerTypes.indexOf(props.options.type) !== -1 &&
|
|
12352
|
-
props.options.type === layerTypeRef.current))) {
|
|
12353
|
-
return;
|
|
12354
|
-
}
|
|
12355
|
-
createLayer();
|
|
12356
|
-
}, [mapHook.map, props.options, createLayer]);
|
|
12357
|
-
useEffect(function () {
|
|
12358
|
-
var _a, _b, _c, _d;
|
|
12359
|
-
if (!initializedRef.current || !((_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.getSource(layerId.current)))
|
|
12360
|
-
return;
|
|
12361
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12362
|
-
//@ts-ignore setData only exists on GeoJsonSource
|
|
12363
|
-
(_d = (_c = mapHook.map.map.getSource(layerId.current)) === null || _c === void 0 ? void 0 : _c.setData) === null || _d === void 0 ? void 0 : _d.call(_c, props.geojson);
|
|
12364
|
-
}, [props.geojson, mapHook.map, props.options.type]);
|
|
12365
|
-
useEffect(function () {
|
|
12366
|
-
var _a, _b, _c, _d, _e;
|
|
12367
|
-
if (!mapHook.map ||
|
|
12368
|
-
!((_c = (_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.getLayer) === null || _c === void 0 ? void 0 : _c.call(_b, layerId.current)) ||
|
|
12369
|
-
!initializedRef.current ||
|
|
12370
|
-
props.options.type !== layerTypeRef.current)
|
|
12371
|
-
return;
|
|
12372
|
-
var key;
|
|
12373
|
-
var layoutString = JSON.stringify(props.options.layout);
|
|
12374
|
-
if (props.options.layout && layoutString !== layerLayoutConfRef.current) {
|
|
12375
|
-
var oldLayout = JSON.parse(layerLayoutConfRef.current);
|
|
12376
|
-
for (key in props.options.layout) {
|
|
12377
|
-
if (((_d = props.options.layout) === null || _d === void 0 ? void 0 : _d[key]) && props.options.layout[key] !== oldLayout[key]) {
|
|
12378
|
-
mapHook.map.map.setLayoutProperty(layerId.current, key, props.options.layout[key]);
|
|
12379
|
-
}
|
|
12380
|
-
}
|
|
12381
|
-
layerLayoutConfRef.current = layoutString;
|
|
13116
|
+
}, MapboxDraw.modes),
|
|
13117
|
+
});
|
|
13118
|
+
mapHook.map.addControl(draw.current, "top-left", mapHook.componentId);
|
|
13119
|
+
mapHook.map.on("draw.modechange", modeChangeHandler, mapHook.componentId);
|
|
13120
|
+
setDrawToolsReady(true);
|
|
12382
13121
|
}
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
13122
|
+
}, [mapHook.map, props, drawToolsInitialized]);
|
|
13123
|
+
useEffect(function () {
|
|
13124
|
+
if (!mapHook.map || !drawToolsReady)
|
|
13125
|
+
return;
|
|
13126
|
+
var changeHandler = function () {
|
|
13127
|
+
var _a, _b;
|
|
13128
|
+
if (draw.current) {
|
|
13129
|
+
// update drawnFeatures state object
|
|
13130
|
+
if (typeof props.onChange === "function") {
|
|
13131
|
+
var currentFeatureCollection = (_b = (_a = draw.current).getAll) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
13132
|
+
props.onChange(currentFeatureCollection === null || currentFeatureCollection === void 0 ? void 0 : currentFeatureCollection.features);
|
|
12389
13133
|
}
|
|
12390
13134
|
}
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
useEffect(function () {
|
|
13135
|
+
};
|
|
13136
|
+
mapHook.map.on("mouseup", changeHandler);
|
|
13137
|
+
mapHook.map.on("touchend", changeHandler);
|
|
12395
13138
|
return function () {
|
|
12396
|
-
|
|
12397
|
-
|
|
13139
|
+
if (!mapHook.map)
|
|
13140
|
+
return;
|
|
13141
|
+
mapHook.map.map.off("mouseup", changeHandler);
|
|
13142
|
+
mapHook.map.map.off("touchend", changeHandler);
|
|
12398
13143
|
};
|
|
12399
|
-
}, []);
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12407
|
-
|
|
13144
|
+
}, [drawToolsReady, mapHook.map]);
|
|
13145
|
+
useEffect(function () {
|
|
13146
|
+
var _a;
|
|
13147
|
+
if (draw.current && ((_a = props.geojson) === null || _a === void 0 ? void 0 : _a.geometry)) {
|
|
13148
|
+
draw.current.set({ type: "FeatureCollection", features: [props.geojson] });
|
|
13149
|
+
}
|
|
13150
|
+
}, [props.geojson, drawToolsReady]);
|
|
13151
|
+
useEffect(function () {
|
|
13152
|
+
if (props.mode && draw.current) {
|
|
13153
|
+
// @ts-ignore
|
|
13154
|
+
draw.current.changeMode(props.mode);
|
|
13155
|
+
}
|
|
13156
|
+
}, [props.mode]);
|
|
13157
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
13158
|
+
};
|
|
12408
13159
|
|
|
12409
13160
|
/**
|
|
12410
13161
|
* Adds a fill extrusion layer to the MapLibre instance reference by props.mapId
|
|
@@ -12442,84 +13193,6 @@ MlFillExtrusionLayer.defaultProps = {
|
|
|
12442
13193
|
},
|
|
12443
13194
|
};
|
|
12444
13195
|
|
|
12445
|
-
var getDefaultPaintPropsByType = function (type, defaultPaintOverrides) {
|
|
12446
|
-
switch (type) {
|
|
12447
|
-
case "fill":
|
|
12448
|
-
if (defaultPaintOverrides === null || defaultPaintOverrides === void 0 ? void 0 : defaultPaintOverrides.fill) {
|
|
12449
|
-
return defaultPaintOverrides.fill;
|
|
12450
|
-
}
|
|
12451
|
-
return {
|
|
12452
|
-
"fill-color": "rgba(10,240,256,0.6)",
|
|
12453
|
-
};
|
|
12454
|
-
case "line":
|
|
12455
|
-
if (defaultPaintOverrides === null || defaultPaintOverrides === void 0 ? void 0 : defaultPaintOverrides.line) {
|
|
12456
|
-
return defaultPaintOverrides.line;
|
|
12457
|
-
}
|
|
12458
|
-
return {
|
|
12459
|
-
"line-color": "rgb(203,211,2)",
|
|
12460
|
-
"line-width": 5,
|
|
12461
|
-
};
|
|
12462
|
-
case "circle":
|
|
12463
|
-
default:
|
|
12464
|
-
if (defaultPaintOverrides === null || defaultPaintOverrides === void 0 ? void 0 : defaultPaintOverrides.circle) {
|
|
12465
|
-
return defaultPaintOverrides.circle;
|
|
12466
|
-
}
|
|
12467
|
-
return {
|
|
12468
|
-
"circle-color": "rgba(10,240,256,0.8)",
|
|
12469
|
-
"circle-stroke-color": "#fff",
|
|
12470
|
-
"circle-stroke-width": 2,
|
|
12471
|
-
};
|
|
12472
|
-
}
|
|
12473
|
-
};
|
|
12474
|
-
|
|
12475
|
-
var mapGeometryTypesToLayerTypes = {
|
|
12476
|
-
Position: "circle",
|
|
12477
|
-
Point: "circle",
|
|
12478
|
-
MultiPoint: "circle",
|
|
12479
|
-
LineString: "line",
|
|
12480
|
-
MultiLineString: "line",
|
|
12481
|
-
Polygon: "fill",
|
|
12482
|
-
MultiPolygon: "fill",
|
|
12483
|
-
GeometryCollection: "circle",
|
|
12484
|
-
};
|
|
12485
|
-
var getDefaulLayerTypeByGeometry = function (geojson) {
|
|
12486
|
-
var _a;
|
|
12487
|
-
if ((geojson === null || geojson === void 0 ? void 0 : geojson.type) === "Feature") {
|
|
12488
|
-
return (mapGeometryTypesToLayerTypes === null || mapGeometryTypesToLayerTypes === void 0 ? void 0 : mapGeometryTypesToLayerTypes[(_a = geojson === null || geojson === void 0 ? void 0 : geojson.geometry) === null || _a === void 0 ? void 0 : _a.type])
|
|
12489
|
-
? mapGeometryTypesToLayerTypes[geojson.geometry.type]
|
|
12490
|
-
: "circle";
|
|
12491
|
-
}
|
|
12492
|
-
if ((geojson === null || geojson === void 0 ? void 0 : geojson.type) === "FeatureCollection") {
|
|
12493
|
-
if (geojson.features.length) {
|
|
12494
|
-
return getDefaulLayerTypeByGeometry(geojson.features[0]);
|
|
12495
|
-
}
|
|
12496
|
-
return "circle";
|
|
12497
|
-
}
|
|
12498
|
-
return "fill";
|
|
12499
|
-
};
|
|
12500
|
-
|
|
12501
|
-
/**
|
|
12502
|
-
* Adds source and layer of types "line", "fill" or "circle" to display GeoJSON data on the map.
|
|
12503
|
-
*
|
|
12504
|
-
* @component
|
|
12505
|
-
*/
|
|
12506
|
-
var MlGeoJsonLayer = function (props) {
|
|
12507
|
-
var layerType = props.type || getDefaulLayerTypeByGeometry(props.geojson);
|
|
12508
|
-
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
12509
|
-
useLayer({
|
|
12510
|
-
mapId: props.mapId,
|
|
12511
|
-
layerId: props.layerId || "MlGeoJsonLayer-" + v4(),
|
|
12512
|
-
geojson: props.geojson,
|
|
12513
|
-
options: __assign(__assign({ paint: props.paint ||
|
|
12514
|
-
getDefaultPaintPropsByType(layerType, props.defaultPaintOverrides), layout: props.layout || {} }, props.options), { type: layerType }),
|
|
12515
|
-
insertBeforeLayer: props.insertBeforeLayer,
|
|
12516
|
-
onHover: props.onHover,
|
|
12517
|
-
onClick: props.onClick,
|
|
12518
|
-
onLeave: props.onLeave,
|
|
12519
|
-
});
|
|
12520
|
-
return (React__default.createElement(React__default.Fragment, null));
|
|
12521
|
-
};
|
|
12522
|
-
|
|
12523
13196
|
var GpsFixed = {};
|
|
12524
13197
|
|
|
12525
13198
|
var _interopRequireDefault$4 = interopRequireDefault.exports;
|
|
@@ -19010,125 +19683,6 @@ function useSource(props) {
|
|
|
19010
19683
|
};
|
|
19011
19684
|
}
|
|
19012
19685
|
|
|
19013
|
-
var createExport = function (options) {
|
|
19014
|
-
var width = options.width;
|
|
19015
|
-
var height = options.height;
|
|
19016
|
-
// Create map container
|
|
19017
|
-
var hiddenContainer = document.createElement('div');
|
|
19018
|
-
hiddenContainer.className = 'hidden-map';
|
|
19019
|
-
document.body.appendChild(hiddenContainer);
|
|
19020
|
-
var container = document.createElement('div');
|
|
19021
|
-
container.style.width = width + 'px';
|
|
19022
|
-
container.style.height = height + 'px';
|
|
19023
|
-
hiddenContainer.appendChild(container);
|
|
19024
|
-
var style = options.map.map.getStyle();
|
|
19025
|
-
var _loop_1 = function (name_1) {
|
|
19026
|
-
var src = style.sources[name_1];
|
|
19027
|
-
Object.keys(src).forEach(function (key) {
|
|
19028
|
-
// delete property if value is undefined.
|
|
19029
|
-
// for instance, raster-dem might have undefined value in "url" and "bounds"
|
|
19030
|
-
if (!src[key]) {
|
|
19031
|
-
delete src[key];
|
|
19032
|
-
}
|
|
19033
|
-
});
|
|
19034
|
-
};
|
|
19035
|
-
// delete undefined source properties
|
|
19036
|
-
for (var name_1 in style.sources) {
|
|
19037
|
-
_loop_1(name_1);
|
|
19038
|
-
}
|
|
19039
|
-
// Create a new MapLibre-gl instance
|
|
19040
|
-
var renderMap = new Map$2({
|
|
19041
|
-
container: container,
|
|
19042
|
-
center: options.map.map.getCenter(),
|
|
19043
|
-
zoom: options.map.map.getZoom(),
|
|
19044
|
-
bearing: 0,
|
|
19045
|
-
pitch: 0,
|
|
19046
|
-
interactive: false,
|
|
19047
|
-
preserveDrawingBuffer: true,
|
|
19048
|
-
fadeDuration: 0,
|
|
19049
|
-
attributionControl: false,
|
|
19050
|
-
style: style,
|
|
19051
|
-
});
|
|
19052
|
-
var _previewGeojson = turf.bboxPolygon([
|
|
19053
|
-
options.bbox[0],
|
|
19054
|
-
options.bbox[1],
|
|
19055
|
-
options.bbox[2],
|
|
19056
|
-
options.bbox[3],
|
|
19057
|
-
]);
|
|
19058
|
-
_previewGeojson = turf.transformRotate(_previewGeojson, options.bearing);
|
|
19059
|
-
// use original unrotated bbox and bearing 0 to calculate the correct zoom value as the function always adds a padding if used on the rotated feature coordinates
|
|
19060
|
-
var bboxCamera = renderMap._cameraForBoxAndBearing([options.bboxUnrotated[0], options.bboxUnrotated[1]], [options.bboxUnrotated[2], options.bboxUnrotated[3]], 0);
|
|
19061
|
-
var geometryCamera = renderMap._cameraForBoxAndBearing(_previewGeojson.geometry.coordinates[0][0], _previewGeojson.geometry.coordinates[0][2], options.bearing);
|
|
19062
|
-
geometryCamera.zoom = bboxCamera.zoom;
|
|
19063
|
-
renderMap._fitInternal(geometryCamera);
|
|
19064
|
-
return new Promise(function (resolve) {
|
|
19065
|
-
renderMap.once('idle', function () {
|
|
19066
|
-
if (renderMap.getLayer('pdfPreviewGeojsonOutline')) {
|
|
19067
|
-
renderMap.setLayoutProperty('pdfPreviewGeojsonOutline', 'visibility', 'none');
|
|
19068
|
-
}
|
|
19069
|
-
if (renderMap.getLayer('pdfPreviewGeojson')) {
|
|
19070
|
-
renderMap.setLayoutProperty('pdfPreviewGeojson', 'visibility', 'none');
|
|
19071
|
-
}
|
|
19072
|
-
if (renderMap.getLayer('pdfPreviewGeojsonResizeHandle')) {
|
|
19073
|
-
renderMap.setLayoutProperty('pdfPreviewGeojsonResizeHandle', 'visibility', 'none');
|
|
19074
|
-
}
|
|
19075
|
-
if (renderMap.getLayer('pdfPreviewGeojsonRotationHandle')) {
|
|
19076
|
-
renderMap.setLayoutProperty('pdfPreviewGeojsonRotationHandle', 'visibility', 'none');
|
|
19077
|
-
}
|
|
19078
|
-
renderMap.once('idle', function () {
|
|
19079
|
-
var params = __assign(__assign({}, options), { renderMap: renderMap, hiddenContainer: hiddenContainer, createPdf: function (_options) {
|
|
19080
|
-
return createJsPdf(__assign(__assign(__assign({}, options), { renderMap: renderMap, hiddenContainer: hiddenContainer }), _options));
|
|
19081
|
-
} });
|
|
19082
|
-
resolve(params);
|
|
19083
|
-
});
|
|
19084
|
-
});
|
|
19085
|
-
});
|
|
19086
|
-
};
|
|
19087
|
-
function createJsPdf(options) {
|
|
19088
|
-
var pdf = new jsPDF({
|
|
19089
|
-
orientation: (options === null || options === void 0 ? void 0 : options.orientation) === 'portrait' ? 'p' : 'l',
|
|
19090
|
-
unit: 'mm',
|
|
19091
|
-
compress: true,
|
|
19092
|
-
format: options.format,
|
|
19093
|
-
});
|
|
19094
|
-
Object.defineProperty(window, 'devicePixelRatio', {
|
|
19095
|
-
get: function () {
|
|
19096
|
-
return 300 / 96;
|
|
19097
|
-
},
|
|
19098
|
-
});
|
|
19099
|
-
return new Promise(function (resolve) {
|
|
19100
|
-
var _a;
|
|
19101
|
-
//Render map image
|
|
19102
|
-
pdf.addImage(options.renderMap.getCanvas().toDataURL('image/png'), 'png', 0, 0, pdf.internal.pageSize.getWidth(), pdf.internal.pageSize.getHeight(), undefined, 'FAST');
|
|
19103
|
-
// remove DOM Elements
|
|
19104
|
-
options.renderMap.remove();
|
|
19105
|
-
(_a = options.hiddenContainer.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(options.hiddenContainer);
|
|
19106
|
-
var params = __assign(__assign({}, options), { pdf: pdf, downloadPdf: function (_options) { return downloadPdf(__assign(__assign({}, params), _options)); } });
|
|
19107
|
-
resolve(params);
|
|
19108
|
-
});
|
|
19109
|
-
}
|
|
19110
|
-
function downloadPdf(options) {
|
|
19111
|
-
options.pdf.save('Map.pdf');
|
|
19112
|
-
return new Promise(function (resolve) {
|
|
19113
|
-
resolve(__assign({}, options));
|
|
19114
|
-
});
|
|
19115
|
-
}
|
|
19116
|
-
|
|
19117
|
-
function exportMap(props) {
|
|
19118
|
-
var mapHook = useMap({ mapId: props.mapId });
|
|
19119
|
-
var _createExport = useMemo(function () {
|
|
19120
|
-
if (mapHook.map) {
|
|
19121
|
-
return function (options) {
|
|
19122
|
-
return createExport(__assign({ map: mapHook.map }, options));
|
|
19123
|
-
};
|
|
19124
|
-
}
|
|
19125
|
-
return;
|
|
19126
|
-
}, [mapHook.map]);
|
|
19127
|
-
return {
|
|
19128
|
-
createExport: _createExport,
|
|
19129
|
-
};
|
|
19130
|
-
}
|
|
19131
|
-
|
|
19132
19686
|
var SimpleDataContext = /*#__PURE__*/React__default.createContext({});
|
|
19133
19687
|
var SimpleDataContextProvider = SimpleDataContext.Provider;
|
|
19134
19688
|
|
|
@@ -19191,5 +19745,5 @@ SimpleDataProvider.propTypes = {
|
|
|
19191
19745
|
children: PropTypes.node.isRequired
|
|
19192
19746
|
};
|
|
19193
19747
|
|
|
19194
|
-
export { GeoJsonContext, GeoJsonProvider, MapComponentsProvider, MapContext, MapLibreMap, MlBasicComponent, MlComponentTemplate, MlCreatePdfButton,
|
|
19748
|
+
export { GeoJsonContext, GeoJsonProvider, MapComponentsProvider, MapContext, MapLibreMap, MlBasicComponent, MlComponentTemplate, MlCreatePdfButton, MlCreatePdfForm, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGPXViewer, MlGeoJsonLayer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlMarker, MlMeasureTool, MlNavigationCompass, MlNavigationTools, MlOsmLayer, MlScaleReference, MlSpatialElevationProfile, MlTransitionGeoJsonLayer, MlVectorTileLayer, MlWmsLayer, SimpleDataContext, SimpleDataProvider, exportMap as useExportMap, useLayer, useMap, useMapState, useSource, useWms };
|
|
19195
19749
|
//# sourceMappingURL=index.esm.js.map
|