@mapcomponents/react-maplibre 1.0.0 → 1.0.2
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 +11 -1
- package/dist/assets/index.cjs-Iqz0mZaU.css +98 -0
- package/dist/index.cjs.js +21050 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +951 -1065
- package/dist/index.esm.js.map +1 -1
- package/package.json +8 -6
- package/rollup.config.mjs +10 -24
package/dist/index.esm.js
CHANGED
|
@@ -1,111 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
function _interopNamespaceDefault(e) {
|
|
87
|
-
var n = Object.create(null);
|
|
88
|
-
if (e) {
|
|
89
|
-
Object.keys(e).forEach(function (k) {
|
|
90
|
-
if (k !== 'default') {
|
|
91
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
92
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
93
|
-
enumerable: true,
|
|
94
|
-
get: function () { return e[k]; }
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
n.default = e;
|
|
100
|
-
return Object.freeze(n);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
104
|
-
var turf__namespace = /*#__PURE__*/_interopNamespaceDefault(turf);
|
|
105
|
-
var xmldom__namespace = /*#__PURE__*/_interopNamespaceDefault(xmldom);
|
|
106
|
-
var csv2geojson__namespace = /*#__PURE__*/_interopNamespaceDefault(csv2geojson);
|
|
107
|
-
var externParser__namespace = /*#__PURE__*/_interopNamespaceDefault(externParser);
|
|
108
|
-
var d3__namespace = /*#__PURE__*/_interopNamespaceDefault(d3);
|
|
1
|
+
import maplibregl, { Map, Popup } from 'maplibre-gl';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { useMemo, useEffect, useCallback, useState, useRef, useContext } from 'react';
|
|
4
|
+
import { createTheme, ThemeProvider, useTheme, styled as styled$2 } from '@mui/material/styles';
|
|
5
|
+
import { v4 } from 'uuid';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { Button, CircularProgress, FormControl, InputLabel, Select, MenuItem, FormLabel, RadioGroup, FormControlLabel, Radio, useMediaQuery, Typography, styled, Box, ListItemIcon, Checkbox, Snackbar, Drawer, Grid, Slider, ListItem as ListItem$1, IconButton as IconButton$1, List as List$1, ListItemText as ListItemText$1, Paper as Paper$1, TextField, DialogTitle as DialogTitle$1, DialogActions as DialogActions$1, ListItemButton, ListItemAvatar, Avatar, DialogContent as DialogContent$1, OutlinedInput, Accordion, AccordionSummary, Dialog as Dialog$1 } from '@mui/material';
|
|
8
|
+
import FilterCenterFocusIcon from '@mui/icons-material/FilterCenterFocus';
|
|
9
|
+
import PrinterIcon from '@mui/icons-material/Print';
|
|
10
|
+
import Button$1 from '@mui/material/Button';
|
|
11
|
+
import jsPDF from 'jspdf';
|
|
12
|
+
import ReactDOM from 'react-dom';
|
|
13
|
+
import Moveable from 'react-moveable';
|
|
14
|
+
import * as turf from '@turf/turf';
|
|
15
|
+
import { point, circle, lineArc, bbox, booleanContains, bboxPolygon, featureCollection, distance, lineOffset } from '@turf/turf';
|
|
16
|
+
import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css';
|
|
17
|
+
import MapboxDraw from '@mapbox/mapbox-gl-draw';
|
|
18
|
+
import GpsFixedIcon from '@mui/icons-material/GpsFixed';
|
|
19
|
+
import ButtonGroup from '@mui/material/ButtonGroup';
|
|
20
|
+
import ControlPointIcon from '@mui/icons-material/ControlPoint';
|
|
21
|
+
import RemoveCircleOutlineIcon from '@mui/icons-material/RemoveCircleOutline';
|
|
22
|
+
import Box$1 from '@mui/material/Box';
|
|
23
|
+
import Divider from '@mui/material/Divider';
|
|
24
|
+
import useMediaQuery$1 from '@mui/material/useMediaQuery';
|
|
25
|
+
import syncMove from '@mapbox/mapbox-gl-sync-move';
|
|
26
|
+
import Paper from '@mui/material/Paper';
|
|
27
|
+
import * as xmldom from '@xmldom/xmldom';
|
|
28
|
+
import { featureCollection as featureCollection$1, lineString, polygon } from '@turf/helpers';
|
|
29
|
+
import WMSCapabilities from 'wms-capabilities';
|
|
30
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
31
|
+
import List from '@mui/material/List';
|
|
32
|
+
import ListItem from '@mui/material/ListItem';
|
|
33
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
34
|
+
import IconButton from '@mui/material/IconButton';
|
|
35
|
+
import { ExpandLess, ExpandMore, KeyboardArrowRight, Tune, Delete, ArrowCircleDown, ArrowCircleUp, CenterFocusWeak } from '@mui/icons-material';
|
|
36
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
37
|
+
import Dialog from '@mui/material/Dialog';
|
|
38
|
+
import DialogActions from '@mui/material/DialogActions';
|
|
39
|
+
import DialogContent from '@mui/material/DialogContent';
|
|
40
|
+
import DialogContentText from '@mui/material/DialogContentText';
|
|
41
|
+
import DialogTitle from '@mui/material/DialogTitle';
|
|
42
|
+
import { useSortable, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
43
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
44
|
+
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
|
|
45
|
+
import PauseIcon from '@mui/icons-material/Pause';
|
|
46
|
+
import StopIcon from '@mui/icons-material/Stop';
|
|
47
|
+
import FastForwardIcon from '@mui/icons-material/FastForward';
|
|
48
|
+
import FastRewindIcon from '@mui/icons-material/FastRewind';
|
|
49
|
+
import PentagonIcon from '@mui/icons-material/Pentagon';
|
|
50
|
+
import { styled as styled$1, Box as Box$2 } from '@mui/system';
|
|
51
|
+
import EditIcon from '@mui/icons-material/Edit';
|
|
52
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
53
|
+
import { ChromePicker } from 'react-color';
|
|
54
|
+
import TuneIcon from '@mui/icons-material/Tune';
|
|
55
|
+
import ScatterPlotIcon from '@mui/icons-material/ScatterPlot';
|
|
56
|
+
import PolylineIcon from '@mui/icons-material/Polyline';
|
|
57
|
+
import * as csv2geojson from 'csv2geojson';
|
|
58
|
+
import osm2geojson from 'osm2geojson-lite';
|
|
59
|
+
import { feature } from 'topojson-client';
|
|
60
|
+
import * as externParser from '@tmcw/togeojson';
|
|
61
|
+
import * as d3 from 'd3';
|
|
62
|
+
import { useSensor, PointerSensor, MouseSensor, useSensors, DndContext, closestCenter } from '@dnd-kit/core';
|
|
63
|
+
import { restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
|
64
|
+
import PlaylistAddIcon from '@mui/icons-material/PlaylistAdd';
|
|
65
|
+
import DynamicFeedIcon from '@mui/icons-material/DynamicFeed';
|
|
66
|
+
import AddBoxIcon from '@mui/icons-material/AddBox';
|
|
67
|
+
import IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';
|
|
68
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
69
|
+
import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
|
|
70
|
+
import AppBar from '@mui/material/AppBar';
|
|
71
|
+
import Toolbar from '@mui/material/Toolbar';
|
|
72
|
+
import Menu from '@mui/material/Menu';
|
|
73
|
+
import MenuIcon from '@mui/icons-material/Menu';
|
|
74
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
75
|
+
import { Global } from '@emotion/react';
|
|
76
|
+
import { Typography as Typography$1, SwipeableDrawer } from '@mui/material/';
|
|
77
|
+
import FileCopy from '@mui/icons-material/FileCopy';
|
|
78
|
+
import WallpaperIcon from '@mui/icons-material/Wallpaper';
|
|
79
|
+
import MuiSpeedDial from '@mui/material/SpeedDial';
|
|
80
|
+
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
81
|
+
import SpeedDialAction from '@mui/material/SpeedDialAction';
|
|
82
|
+
import LayersIcon from '@mui/icons-material/Layers';
|
|
83
|
+
import DesignServicesIcon from '@mui/icons-material/DesignServices';
|
|
84
|
+
import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
|
|
109
85
|
|
|
110
86
|
/******************************************************************************
|
|
111
87
|
Copyright (c) Microsoft Corporation.
|
|
@@ -703,7 +679,7 @@ var MapLibreGlWrapper = /** @class */ (function () {
|
|
|
703
679
|
_a.sent();
|
|
704
680
|
_a.label = 2;
|
|
705
681
|
case 2:
|
|
706
|
-
self.map = new
|
|
682
|
+
self.map = new Map(props.mapOptions);
|
|
707
683
|
self.addNativeMaplibreFunctionsAndProps();
|
|
708
684
|
self.wrapper.refreshViewport();
|
|
709
685
|
self.wrapper.fire('viewportchange');
|
|
@@ -732,12 +708,12 @@ var MapLibreGlWrapper = /** @class */ (function () {
|
|
|
732
708
|
return MapLibreGlWrapper;
|
|
733
709
|
}());
|
|
734
710
|
|
|
735
|
-
var lightDefault =
|
|
711
|
+
var lightDefault = createTheme({
|
|
736
712
|
palette: {
|
|
737
713
|
mode: 'light',
|
|
738
714
|
},
|
|
739
715
|
});
|
|
740
|
-
var darkDefault =
|
|
716
|
+
var darkDefault = createTheme({
|
|
741
717
|
palette: {
|
|
742
718
|
mode: 'dark',
|
|
743
719
|
},
|
|
@@ -799,7 +775,7 @@ var getTheme = function (mode) {
|
|
|
799
775
|
'light');
|
|
800
776
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
801
777
|
// @ts-ignore
|
|
802
|
-
return
|
|
778
|
+
return createTheme(theme, {
|
|
803
779
|
components: {
|
|
804
780
|
MuiTypography: {
|
|
805
781
|
styleOverrides: {
|
|
@@ -873,13 +849,13 @@ var config = {
|
|
|
873
849
|
sourceOptions_tiles: ['https://wms.wheregroup.com/tileserver/tile/world-0-14/{z}/{x}/{y}.pbf']
|
|
874
850
|
};
|
|
875
851
|
|
|
876
|
-
var LayerContext =
|
|
852
|
+
var LayerContext = React__default.createContext({});
|
|
877
853
|
function LayerContextProvider(props) {
|
|
878
|
-
var _a =
|
|
879
|
-
var _b =
|
|
880
|
-
var _c =
|
|
881
|
-
var _d =
|
|
882
|
-
var vtLayerConfig =
|
|
854
|
+
var _a = React__default.useState([]), layers = _a[0], setLayers = _a[1];
|
|
855
|
+
var _b = React__default.useState([]), backgroundLayers = _b[0], setBackgroundLayers = _b[1];
|
|
856
|
+
var _c = React__default.useState([]), symbolLayers = _c[0], setSymbolLayers = _c[1];
|
|
857
|
+
var _d = React__default.useState(config.sourceOptions_tiles[0]), tileUrl = _d[0], setTileUrl = _d[1];
|
|
858
|
+
var vtLayerConfig = useMemo(function () { return ({
|
|
883
859
|
layerId: 'openmaptiles',
|
|
884
860
|
sourceOptions: {
|
|
885
861
|
type: 'vector',
|
|
@@ -904,18 +880,18 @@ function LayerContextProvider(props) {
|
|
|
904
880
|
setBackgroundLayers(backgroundLayers);
|
|
905
881
|
setSymbolLayers(symbolLayers);
|
|
906
882
|
};
|
|
907
|
-
|
|
883
|
+
useEffect(function () {
|
|
908
884
|
if (layers.filter(function (el) { return !(el === null || el === void 0 ? void 0 : el.id); }).length) {
|
|
909
885
|
var _layers = __spreadArray([], layers, true);
|
|
910
886
|
_layers.forEach(function (el) {
|
|
911
887
|
if (!(el === null || el === void 0 ? void 0 : el.id)) {
|
|
912
|
-
el.id =
|
|
888
|
+
el.id = v4();
|
|
913
889
|
}
|
|
914
890
|
});
|
|
915
891
|
setLayers(_layers);
|
|
916
892
|
}
|
|
917
893
|
}, [layers]);
|
|
918
|
-
var moveLayer =
|
|
894
|
+
var moveLayer = useCallback(function (layerId, getNewPos) {
|
|
919
895
|
var _a;
|
|
920
896
|
var targetLayer = (_a = layers === null || layers === void 0 ? void 0 : layers.filter) === null || _a === void 0 ? void 0 : _a.call(layers, function (el) { return el.id === layerId; });
|
|
921
897
|
if (targetLayer.length > 0) {
|
|
@@ -930,10 +906,10 @@ function LayerContextProvider(props) {
|
|
|
930
906
|
}
|
|
931
907
|
}
|
|
932
908
|
}, [layers]);
|
|
933
|
-
var moveDown =
|
|
909
|
+
var moveDown = useCallback(function (layerId) {
|
|
934
910
|
moveLayer(layerId, function (idx) { return idx + 1; });
|
|
935
911
|
}, [moveLayer]);
|
|
936
|
-
var moveUp =
|
|
912
|
+
var moveUp = useCallback(function (layerId) {
|
|
937
913
|
moveLayer(layerId, function (idx) { return idx - 1; });
|
|
938
914
|
}, [moveLayer]);
|
|
939
915
|
var value = {
|
|
@@ -951,10 +927,10 @@ function LayerContextProvider(props) {
|
|
|
951
927
|
moveDown: moveDown,
|
|
952
928
|
moveLayer: moveLayer,
|
|
953
929
|
};
|
|
954
|
-
return
|
|
930
|
+
return React__default.createElement(LayerContext.Provider, { value: value }, props.children);
|
|
955
931
|
}
|
|
956
932
|
|
|
957
|
-
var MapContext =
|
|
933
|
+
var MapContext = React__default.createContext({});
|
|
958
934
|
/**
|
|
959
935
|
* MapComponentsProvider must be imported and wrapped around component where at least one of its child nodes requires access to a MapLibre-gl or openlayers instance that is registered in this mapContext.
|
|
960
936
|
MapComponentsProvider must be used one level higher than the first use of MapContext.
|
|
@@ -963,10 +939,10 @@ MapComponentsProvider must be used one level higher than the first use of MapCon
|
|
|
963
939
|
*/
|
|
964
940
|
var MapComponentsProvider = function (_a) {
|
|
965
941
|
var children = _a.children;
|
|
966
|
-
var _b =
|
|
967
|
-
var _c =
|
|
968
|
-
var mapIds_raw =
|
|
969
|
-
var maps =
|
|
942
|
+
var _b = useState(undefined), map = _b[0], setMap = _b[1];
|
|
943
|
+
var _c = useState([]), mapIds = _c[0], setMapIds = _c[1];
|
|
944
|
+
var mapIds_raw = useRef([]);
|
|
945
|
+
var maps = useRef({});
|
|
970
946
|
var removeMap = function (mapId) {
|
|
971
947
|
if (mapId) {
|
|
972
948
|
if (typeof maps.current[mapId] !== 'undefined') {
|
|
@@ -1028,9 +1004,9 @@ var MapComponentsProvider = function (_a) {
|
|
|
1028
1004
|
return null;
|
|
1029
1005
|
},
|
|
1030
1006
|
};
|
|
1031
|
-
return (
|
|
1032
|
-
|
|
1033
|
-
|
|
1007
|
+
return (React__default.createElement(MapContext.Provider, { value: value },
|
|
1008
|
+
React__default.createElement(LayerContextProvider, null,
|
|
1009
|
+
React__default.createElement(ThemeProvider, { theme: getTheme('light') }, children))));
|
|
1034
1010
|
};
|
|
1035
1011
|
|
|
1036
1012
|
var defaultProps$1 = {
|
|
@@ -1071,13 +1047,13 @@ var defaultProps$1 = {
|
|
|
1071
1047
|
*/
|
|
1072
1048
|
var MapLibreMap = function (props) {
|
|
1073
1049
|
var _a, _b;
|
|
1074
|
-
var mapRef =
|
|
1075
|
-
var mapContainer =
|
|
1076
|
-
var mapContext =
|
|
1077
|
-
var mapIdRef =
|
|
1078
|
-
var initializedRef =
|
|
1079
|
-
var currentStyle =
|
|
1080
|
-
|
|
1050
|
+
var mapRef = useRef();
|
|
1051
|
+
var mapContainer = useRef();
|
|
1052
|
+
var mapContext = useContext(MapContext);
|
|
1053
|
+
var mapIdRef = useRef(props.mapId);
|
|
1054
|
+
var initializedRef = useRef(false);
|
|
1055
|
+
var currentStyle = useRef((_a = props.options) === null || _a === void 0 ? void 0 : _a.style);
|
|
1056
|
+
useEffect(function () {
|
|
1081
1057
|
var mapId = mapIdRef.current;
|
|
1082
1058
|
return function () {
|
|
1083
1059
|
var _a, _b;
|
|
@@ -1090,7 +1066,7 @@ var MapLibreMap = function (props) {
|
|
|
1090
1066
|
}
|
|
1091
1067
|
};
|
|
1092
1068
|
}, []);
|
|
1093
|
-
|
|
1069
|
+
useEffect(function () {
|
|
1094
1070
|
var _a, _b;
|
|
1095
1071
|
if (initializedRef.current)
|
|
1096
1072
|
return;
|
|
@@ -1118,7 +1094,7 @@ var MapLibreMap = function (props) {
|
|
|
1118
1094
|
});
|
|
1119
1095
|
}
|
|
1120
1096
|
}, [props.options, props.mapId]);
|
|
1121
|
-
|
|
1097
|
+
useEffect(function () {
|
|
1122
1098
|
var _a, _b;
|
|
1123
1099
|
if (((_a = mapRef.current) === null || _a === void 0 ? void 0 : _a.map) &&
|
|
1124
1100
|
((_b = props === null || props === void 0 ? void 0 : props.options) === null || _b === void 0 ? void 0 : _b.style) &&
|
|
@@ -1127,7 +1103,7 @@ var MapLibreMap = function (props) {
|
|
|
1127
1103
|
mapRef.current.map.setStyle(props.options.style);
|
|
1128
1104
|
}
|
|
1129
1105
|
}, [(_b = props === null || props === void 0 ? void 0 : props.options) === null || _b === void 0 ? void 0 : _b.style]);
|
|
1130
|
-
return (
|
|
1106
|
+
return (React__default.createElement("div", { ref: mapContainer, className: "mapContainer", style: props.style }));
|
|
1131
1107
|
};
|
|
1132
1108
|
MapLibreMap.defaultProps = defaultProps$1;
|
|
1133
1109
|
|
|
@@ -1138,22 +1114,22 @@ MapLibreMap.defaultProps = defaultProps$1;
|
|
|
1138
1114
|
*/
|
|
1139
1115
|
function useMapState(props) {
|
|
1140
1116
|
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
1141
|
-
var mapContext =
|
|
1142
|
-
var initializedRef =
|
|
1143
|
-
var mapRef =
|
|
1144
|
-
var _a =
|
|
1145
|
-
var viewportRef =
|
|
1146
|
-
var _b =
|
|
1147
|
-
var layersRef =
|
|
1117
|
+
var mapContext = useContext(MapContext);
|
|
1118
|
+
var initializedRef = useRef(false);
|
|
1119
|
+
var mapRef = useRef();
|
|
1120
|
+
var _a = useState(), viewport = _a[0], setViewport = _a[1];
|
|
1121
|
+
var viewportRef = useRef(undefined);
|
|
1122
|
+
var _b = useState([]), layers = _b[0], setLayers = _b[1];
|
|
1123
|
+
var layersRef = useRef();
|
|
1148
1124
|
//const mapRef = useRef(props.map);
|
|
1149
|
-
var componentId =
|
|
1125
|
+
var componentId = useRef(v4());
|
|
1150
1126
|
/**
|
|
1151
1127
|
* returns the element if it matches the defined filter criteria
|
|
1152
1128
|
* to be used as filter function on the layers array
|
|
1153
1129
|
*
|
|
1154
1130
|
* @param {object} layer
|
|
1155
1131
|
*/
|
|
1156
|
-
var layerIdFilter =
|
|
1132
|
+
var layerIdFilter = useCallback(function (layer) {
|
|
1157
1133
|
var _a, _b;
|
|
1158
1134
|
if (!((_a = props === null || props === void 0 ? void 0 : props.filter) === null || _a === void 0 ? void 0 : _a.includeBaseLayers) && (layer === null || layer === void 0 ? void 0 : layer.baseLayer)) {
|
|
1159
1135
|
return false;
|
|
@@ -1168,7 +1144,7 @@ function useMapState(props) {
|
|
|
1168
1144
|
}
|
|
1169
1145
|
return true;
|
|
1170
1146
|
}, [props.filter]);
|
|
1171
|
-
var refreshLayerState =
|
|
1147
|
+
var refreshLayerState = useCallback(function () {
|
|
1172
1148
|
if (!mapRef.current)
|
|
1173
1149
|
return;
|
|
1174
1150
|
var _layerState = mapRef.current.wrapper.layerState.filter(layerIdFilter);
|
|
@@ -1178,7 +1154,7 @@ function useMapState(props) {
|
|
|
1178
1154
|
setLayers(_layerState);
|
|
1179
1155
|
}
|
|
1180
1156
|
}, [layerIdFilter]);
|
|
1181
|
-
|
|
1157
|
+
useEffect(function () {
|
|
1182
1158
|
var _componentId = componentId.current;
|
|
1183
1159
|
return function () {
|
|
1184
1160
|
// cleanup all event listeners
|
|
@@ -1189,7 +1165,7 @@ function useMapState(props) {
|
|
|
1189
1165
|
initializedRef.current = false;
|
|
1190
1166
|
};
|
|
1191
1167
|
}, []);
|
|
1192
|
-
|
|
1168
|
+
useEffect(function () {
|
|
1193
1169
|
var _a, _b, _c, _d;
|
|
1194
1170
|
if (!mapContext.mapExists(props.mapId) || initializedRef.current)
|
|
1195
1171
|
return;
|
|
@@ -1262,8 +1238,8 @@ useMapState.propTypes = {
|
|
|
1262
1238
|
};
|
|
1263
1239
|
|
|
1264
1240
|
function useMap(props) {
|
|
1265
|
-
var mapContext =
|
|
1266
|
-
var _a =
|
|
1241
|
+
var mapContext = useContext(MapContext);
|
|
1242
|
+
var _a = useState({ map: undefined, ready: false }), state = _a[0], setState = _a[1];
|
|
1267
1243
|
var mapState = useMapState({
|
|
1268
1244
|
mapId: props === null || props === void 0 ? void 0 : props.mapId,
|
|
1269
1245
|
watch: {
|
|
@@ -1275,20 +1251,20 @@ function useMap(props) {
|
|
|
1275
1251
|
includeBaseLayers: true,
|
|
1276
1252
|
},
|
|
1277
1253
|
});
|
|
1278
|
-
var mapRef =
|
|
1279
|
-
var componentId =
|
|
1254
|
+
var mapRef = useRef();
|
|
1255
|
+
var componentId = useRef(v4());
|
|
1280
1256
|
var cleanup = function () {
|
|
1281
1257
|
if (mapRef.current) {
|
|
1282
1258
|
mapRef.current.cleanup(componentId.current);
|
|
1283
1259
|
}
|
|
1284
1260
|
};
|
|
1285
|
-
|
|
1261
|
+
useEffect(function () {
|
|
1286
1262
|
return function () {
|
|
1287
1263
|
cleanup();
|
|
1288
1264
|
mapRef.current = undefined;
|
|
1289
1265
|
};
|
|
1290
1266
|
}, []);
|
|
1291
|
-
|
|
1267
|
+
useEffect(function () {
|
|
1292
1268
|
var _a;
|
|
1293
1269
|
if (mapRef.current && mapRef.current.cancelled === true) {
|
|
1294
1270
|
mapRef.current = undefined;
|
|
@@ -1330,11 +1306,11 @@ var MlCenterPosition = function (props) {
|
|
|
1330
1306
|
mapId: props.mapId,
|
|
1331
1307
|
waitForLayer: props.insertBeforeLayer,
|
|
1332
1308
|
});
|
|
1333
|
-
var _a =
|
|
1309
|
+
var _a = useState(false), locationAccessDenied = _a[0], setLocationAccessDenied = _a[1];
|
|
1334
1310
|
var centerCurrentLocation = function () {
|
|
1335
1311
|
navigator.geolocation.getCurrentPosition(getLocationSuccess, getLocationError);
|
|
1336
1312
|
};
|
|
1337
|
-
var getLocationSuccess =
|
|
1313
|
+
var getLocationSuccess = useCallback(function (location) {
|
|
1338
1314
|
var _a, _b, _c;
|
|
1339
1315
|
(_c = (_a = mapHook.map) === null || _a === void 0 ? void 0 : (_b = _a.map).setCenter) === null || _c === void 0 ? void 0 : _c.call(_b, [location.coords.longitude, location.coords.latitude]);
|
|
1340
1316
|
}, [mapHook.map]);
|
|
@@ -1342,12 +1318,12 @@ var MlCenterPosition = function (props) {
|
|
|
1342
1318
|
console.log('Access of user location denied');
|
|
1343
1319
|
setLocationAccessDenied(true);
|
|
1344
1320
|
};
|
|
1345
|
-
return (
|
|
1346
|
-
|
|
1321
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
1322
|
+
React__default.createElement(Button, { variant: "navtools", sx: {
|
|
1347
1323
|
zIndex: 1002,
|
|
1348
1324
|
color: !locationAccessDenied ? props.onColor : props.offColor,
|
|
1349
1325
|
}, onClick: centerCurrentLocation, disabled: locationAccessDenied },
|
|
1350
|
-
|
|
1326
|
+
React__default.createElement(FilterCenterFocusIcon, { sx: { fontSize: { xs: '1.4em', md: '1em' } } }))));
|
|
1351
1327
|
};
|
|
1352
1328
|
MlCenterPosition.defaultProps = {
|
|
1353
1329
|
mapId: undefined,
|
|
@@ -1362,7 +1338,7 @@ var MlComponentTemplate = function (props) {
|
|
|
1362
1338
|
mapId: props.mapId,
|
|
1363
1339
|
});
|
|
1364
1340
|
console.log(mapHook.componentId + " remove this log");
|
|
1365
|
-
return
|
|
1341
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
1366
1342
|
};
|
|
1367
1343
|
MlComponentTemplate.defaultProps = {
|
|
1368
1344
|
mapId: undefined,
|
|
@@ -1398,7 +1374,7 @@ var createExport = function (options) {
|
|
|
1398
1374
|
_loop_1(name_1);
|
|
1399
1375
|
}
|
|
1400
1376
|
// Create a new MapLibre-gl instance
|
|
1401
|
-
var renderMap = new
|
|
1377
|
+
var renderMap = new Map({
|
|
1402
1378
|
container: container,
|
|
1403
1379
|
center: options.map.map.getCenter(),
|
|
1404
1380
|
zoom: options.map.map.getZoom(),
|
|
@@ -1474,7 +1450,7 @@ function downloadPng(options) {
|
|
|
1474
1450
|
|
|
1475
1451
|
function useExportMap(props) {
|
|
1476
1452
|
var mapHook = useMap({ mapId: props.mapId });
|
|
1477
|
-
var _createExport =
|
|
1453
|
+
var _createExport = useMemo(function () {
|
|
1478
1454
|
if (mapHook.map) {
|
|
1479
1455
|
return function (options) {
|
|
1480
1456
|
return createExport(__assign({ map: mapHook.map }, options));
|
|
@@ -1495,9 +1471,9 @@ var MlCreatePdfButton = function (props) {
|
|
|
1495
1471
|
mapId: props.mapId,
|
|
1496
1472
|
});
|
|
1497
1473
|
var exportMap = useExportMap({ mapId: props.mapId });
|
|
1498
|
-
var _a =
|
|
1499
|
-
return (
|
|
1500
|
-
|
|
1474
|
+
var _a = React__default.useState(false), loading = _a[0], setLoading = _a[1];
|
|
1475
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
1476
|
+
React__default.createElement(Button$1, { color: "primary", variant: "contained", onClick: function () {
|
|
1501
1477
|
if (mapHook.map && (exportMap === null || exportMap === void 0 ? void 0 : exportMap.createExport)) {
|
|
1502
1478
|
setLoading(true);
|
|
1503
1479
|
var bounds = mapHook.map.getBounds();
|
|
@@ -1519,9 +1495,9 @@ var MlCreatePdfButton = function (props) {
|
|
|
1519
1495
|
setLoading(false);
|
|
1520
1496
|
});
|
|
1521
1497
|
}
|
|
1522
|
-
} }, loading ? (
|
|
1498
|
+
} }, loading ? (React__default.createElement(CircularProgress, { size: 24, sx: {
|
|
1523
1499
|
color: '#fff',
|
|
1524
|
-
} })) : (
|
|
1500
|
+
} })) : (React__default.createElement(PrinterIcon, null)))));
|
|
1525
1501
|
};
|
|
1526
1502
|
MlCreatePdfButton.defaultProps = {
|
|
1527
1503
|
mapId: undefined,
|
|
@@ -1600,13 +1576,13 @@ var PdfTemplates = {
|
|
|
1600
1576
|
},
|
|
1601
1577
|
};
|
|
1602
1578
|
|
|
1603
|
-
var PdfContext =
|
|
1579
|
+
var PdfContext = React__default.createContext({});
|
|
1604
1580
|
var defaultTemplate = PdfTemplates['A4']['72dpi'];
|
|
1605
1581
|
var PdfContextProvider = function (_a) {
|
|
1606
1582
|
var children = _a.children;
|
|
1607
|
-
var _b =
|
|
1608
|
-
var _c =
|
|
1609
|
-
var _d =
|
|
1583
|
+
var _b = useState('A4'), format = _b[0], setFormat = _b[1];
|
|
1584
|
+
var _c = useState('72dpi'), quality = _c[0], setQuality = _c[1];
|
|
1585
|
+
var _d = useState({
|
|
1610
1586
|
center: undefined,
|
|
1611
1587
|
scale: undefined,
|
|
1612
1588
|
rotate: 0,
|
|
@@ -1615,8 +1591,8 @@ var PdfContextProvider = function (_a) {
|
|
|
1615
1591
|
orientation: 'portrait',
|
|
1616
1592
|
fixedScale: 0,
|
|
1617
1593
|
}), options = _d[0], setOptions = _d[1];
|
|
1618
|
-
var geojsonRef =
|
|
1619
|
-
var template =
|
|
1594
|
+
var geojsonRef = useRef();
|
|
1595
|
+
var template = useMemo(function () {
|
|
1620
1596
|
if (typeof PdfTemplates[format][quality] !== 'undefined') {
|
|
1621
1597
|
return options.orientation === 'portrait'
|
|
1622
1598
|
? PdfTemplates[format][quality]
|
|
@@ -1637,7 +1613,7 @@ var PdfContextProvider = function (_a) {
|
|
|
1637
1613
|
geojsonRef: geojsonRef,
|
|
1638
1614
|
template: template,
|
|
1639
1615
|
};
|
|
1640
|
-
return
|
|
1616
|
+
return React__default.createElement(PdfContext.Provider, { value: value }, children);
|
|
1641
1617
|
};
|
|
1642
1618
|
|
|
1643
1619
|
function getTargetRotationAngle(target) {
|
|
@@ -1677,15 +1653,15 @@ function getMapZoomScaleModifier(point, _map) {
|
|
|
1677
1653
|
function PdfPreview(props) {
|
|
1678
1654
|
var _a;
|
|
1679
1655
|
var mapState = useMapState({ mapId: props.mapId, watch: { layers: false, viewport: true } });
|
|
1680
|
-
var targetRef =
|
|
1681
|
-
var fixedScaleRef =
|
|
1682
|
-
var moveableRef =
|
|
1683
|
-
var mapContainerRef =
|
|
1656
|
+
var targetRef = useRef(null);
|
|
1657
|
+
var fixedScaleRef = useRef();
|
|
1658
|
+
var moveableRef = useRef(null);
|
|
1659
|
+
var mapContainerRef = useRef(document.querySelector('.mapContainer'));
|
|
1684
1660
|
//const [transform, setTransform] = useState('translate(452.111px, 15.6148px)');
|
|
1685
1661
|
var mapHook = useMap({
|
|
1686
1662
|
mapId: props.mapId,
|
|
1687
1663
|
});
|
|
1688
|
-
|
|
1664
|
+
useEffect(function () {
|
|
1689
1665
|
var _a;
|
|
1690
1666
|
if (!((_a = mapState === null || mapState === void 0 ? void 0 : mapState.viewport) === null || _a === void 0 ? void 0 : _a.zoom) || !mapHook.map)
|
|
1691
1667
|
return;
|
|
@@ -1703,7 +1679,7 @@ function PdfPreview(props) {
|
|
|
1703
1679
|
props.setOptions(function (val) { return (__assign(__assign({}, val), { center: [_center_1.lng, _center_1.lat] })); });
|
|
1704
1680
|
}
|
|
1705
1681
|
}, [mapHook.map, (_a = mapState.viewport) === null || _a === void 0 ? void 0 : _a.zoom]);
|
|
1706
|
-
|
|
1682
|
+
useEffect(function () {
|
|
1707
1683
|
if (!mapHook.map)
|
|
1708
1684
|
return;
|
|
1709
1685
|
mapHook.map.map.setPitch(0);
|
|
@@ -1714,7 +1690,7 @@ function PdfPreview(props) {
|
|
|
1714
1690
|
(_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map.setMaxPitch(_maxPitch);
|
|
1715
1691
|
};
|
|
1716
1692
|
}, [mapHook.map]);
|
|
1717
|
-
var transformOrigin =
|
|
1693
|
+
var transformOrigin = useMemo(function () {
|
|
1718
1694
|
if (props.options.orientation === 'portrait') {
|
|
1719
1695
|
return [props.options.width / 2, props.options.height / 2];
|
|
1720
1696
|
}
|
|
@@ -1722,7 +1698,7 @@ function PdfPreview(props) {
|
|
|
1722
1698
|
return [props.options.height / 2, props.options.width / 2];
|
|
1723
1699
|
}
|
|
1724
1700
|
}, [props.options.orientation, props.options.width, props.options.height]);
|
|
1725
|
-
var transform =
|
|
1701
|
+
var transform = useMemo(function () {
|
|
1726
1702
|
var _a, _b;
|
|
1727
1703
|
if (!mapHook.map || !props.options.scale)
|
|
1728
1704
|
return 'none';
|
|
@@ -1743,11 +1719,11 @@ function PdfPreview(props) {
|
|
|
1743
1719
|
props.options.center,
|
|
1744
1720
|
transformOrigin,
|
|
1745
1721
|
]);
|
|
1746
|
-
|
|
1722
|
+
useEffect(function () {
|
|
1747
1723
|
var _a;
|
|
1748
1724
|
(_a = moveableRef.current) === null || _a === void 0 ? void 0 : _a.updateTarget();
|
|
1749
1725
|
}, [transform]);
|
|
1750
|
-
|
|
1726
|
+
useEffect(function () {
|
|
1751
1727
|
// update props.options.scale if fixedScale was changed
|
|
1752
1728
|
if (!mapHook.map ||
|
|
1753
1729
|
!props.options.center ||
|
|
@@ -1756,11 +1732,11 @@ function PdfPreview(props) {
|
|
|
1756
1732
|
fixedScaleRef.current === props.options.fixedScale))
|
|
1757
1733
|
return;
|
|
1758
1734
|
fixedScaleRef.current = props.options.fixedScale;
|
|
1759
|
-
var point =
|
|
1735
|
+
var point = turf.point(props.options.center);
|
|
1760
1736
|
var distance = props.options.fixedScale * (props.options.width / 1000);
|
|
1761
1737
|
var bearing = 90;
|
|
1762
1738
|
var options = { units: 'meters' };
|
|
1763
|
-
var destination =
|
|
1739
|
+
var destination = turf.destination(point, distance, bearing, options);
|
|
1764
1740
|
var centerInPixels = mapHook.map.map.project(point.geometry.coordinates);
|
|
1765
1741
|
var destinationInPixels = mapHook.map.map.project(destination.geometry.coordinates);
|
|
1766
1742
|
var scaleFactor = (Math.round(destinationInPixels.x - centerInPixels.x) / props.options.width) *
|
|
@@ -1768,7 +1744,7 @@ function PdfPreview(props) {
|
|
|
1768
1744
|
props.setOptions(function (val) { return (__assign(__assign({}, val), { scale: [scaleFactor, scaleFactor] })); });
|
|
1769
1745
|
}, [mapHook.map, props.options.width, props.options.center, props.options.fixedScale]);
|
|
1770
1746
|
// update props.geoJsonRef
|
|
1771
|
-
|
|
1747
|
+
useEffect(function () {
|
|
1772
1748
|
var _a;
|
|
1773
1749
|
if (targetRef.current && mapHook.map) {
|
|
1774
1750
|
// apply orientation
|
|
@@ -1818,9 +1794,9 @@ function PdfPreview(props) {
|
|
|
1818
1794
|
targetRef.current,
|
|
1819
1795
|
transformOrigin,
|
|
1820
1796
|
]);
|
|
1821
|
-
return mapContainerRef.current ? ReactDOM.createPortal(
|
|
1822
|
-
|
|
1823
|
-
|
|
1797
|
+
return mapContainerRef.current ? ReactDOM.createPortal(React__default.createElement(React__default.Fragment, null,
|
|
1798
|
+
React__default.createElement("div", { className: "target", ref: targetRef, style: { transform: transform, transformOrigin: 'center center' } }),
|
|
1799
|
+
React__default.createElement(Moveable
|
|
1824
1800
|
// eslint-disable-next-line
|
|
1825
1801
|
// @ts-ignore:
|
|
1826
1802
|
, {
|
|
@@ -1862,7 +1838,7 @@ function PdfPreview(props) {
|
|
|
1862
1838
|
var viewportBearing_1 = ((_a = mapState === null || mapState === void 0 ? void 0 : mapState.viewport) === null || _a === void 0 ? void 0 : _a.bearing) ? mapState.viewport.bearing : 0;
|
|
1863
1839
|
props.setOptions(function (val) { return (__assign(__assign({}, val), { rotate: parseFloat(_transformPartString_1) + viewportBearing_1 })); });
|
|
1864
1840
|
}
|
|
1865
|
-
} })), mapContainerRef.current) :
|
|
1841
|
+
} })), mapContainerRef.current) : React__default.createElement(React__default.Fragment, null);
|
|
1866
1842
|
}
|
|
1867
1843
|
|
|
1868
1844
|
var scaleOptions = [
|
|
@@ -1919,14 +1895,14 @@ var qualityOptions = [
|
|
|
1919
1895
|
];
|
|
1920
1896
|
function PdfForm(props) {
|
|
1921
1897
|
var _a, _b;
|
|
1922
|
-
var _c =
|
|
1923
|
-
var pdfContext =
|
|
1898
|
+
var _c = useState(false), loading = _c[0], setLoading = _c[1];
|
|
1899
|
+
var pdfContext = useContext(PdfContext);
|
|
1924
1900
|
var mapHook = useMap({
|
|
1925
1901
|
// eslint-disable-next-line react/prop-types
|
|
1926
1902
|
mapId: props.mapId,
|
|
1927
1903
|
});
|
|
1928
1904
|
var mapExporter = useExportMap({ mapId: props.mapId });
|
|
1929
|
-
var createPdfHandler =
|
|
1905
|
+
var createPdfHandler = useCallback(function () {
|
|
1930
1906
|
var _a, _b, _c, _d, _e, _f;
|
|
1931
1907
|
if (mapHook.map &&
|
|
1932
1908
|
mapExporter.createExport &&
|
|
@@ -1936,7 +1912,7 @@ function PdfForm(props) {
|
|
|
1936
1912
|
((_c = (_b = pdfContext.geojsonRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.bbox) &&
|
|
1937
1913
|
((_d = pdfContext.geojsonRef) === null || _d === void 0 ? void 0 : _d.current)) {
|
|
1938
1914
|
setLoading(true);
|
|
1939
|
-
var bbox =
|
|
1915
|
+
var bbox = turf.bbox(pdfContext.geojsonRef.current);
|
|
1940
1916
|
mapExporter
|
|
1941
1917
|
.createExport({
|
|
1942
1918
|
width: pdfContext.template.width,
|
|
@@ -1961,7 +1937,7 @@ function PdfForm(props) {
|
|
|
1961
1937
|
});
|
|
1962
1938
|
}
|
|
1963
1939
|
}, [mapHook.map, pdfContext]);
|
|
1964
|
-
var formControlStyles =
|
|
1940
|
+
var formControlStyles = useMemo(function () {
|
|
1965
1941
|
return {
|
|
1966
1942
|
margin: '5px 0 15px 0 ',
|
|
1967
1943
|
//...props.formControlStyles,
|
|
@@ -1969,37 +1945,37 @@ function PdfForm(props) {
|
|
|
1969
1945
|
}, [
|
|
1970
1946
|
/*props.formControlStyles*/
|
|
1971
1947
|
]);
|
|
1972
|
-
return (
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1948
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
1949
|
+
React__default.createElement(FormControl, { fullWidth: true, sx: formControlStyles },
|
|
1950
|
+
React__default.createElement(InputLabel, { sx: { marginTop: '3px' }, id: "format-select-label" }, "Format"),
|
|
1951
|
+
React__default.createElement(Select, { labelId: "format-select-label", id: "format-select", label: "Format", value: pdfContext.format, onChange: function (event) {
|
|
1976
1952
|
var _a;
|
|
1977
1953
|
(_a = pdfContext.setFormat) === null || _a === void 0 ? void 0 : _a.call(pdfContext, event.target.value);
|
|
1978
|
-
} }, Object.keys(PdfTemplates).map(function (el) { return (
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1954
|
+
} }, Object.keys(PdfTemplates).map(function (el) { return (React__default.createElement(MenuItem, { key: el, value: el }, el)); }))),
|
|
1955
|
+
React__default.createElement(FormControl, { fullWidth: true, sx: formControlStyles },
|
|
1956
|
+
React__default.createElement(FormLabel, { id: "orientation-radio-buttons-group-label" }, "Orientation"),
|
|
1957
|
+
React__default.createElement(RadioGroup, { row: true, "aria-labelledby": "orientation-radio-buttons-group-label", name: "orientation-radio-buttons-group", value: (_a = pdfContext.options) === null || _a === void 0 ? void 0 : _a.orientation, onChange: function (event) {
|
|
1982
1958
|
if (!pdfContext.setOptions)
|
|
1983
1959
|
return;
|
|
1984
1960
|
pdfContext.setOptions(function (val) { return (__assign(__assign({}, val), { orientation: event.target.value })); });
|
|
1985
1961
|
} },
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1962
|
+
React__default.createElement(FormControlLabel, { value: "portrait", control: React__default.createElement(Radio, null), label: "Portrait" }),
|
|
1963
|
+
React__default.createElement(FormControlLabel, { value: "landscape", control: React__default.createElement(Radio, null), label: "Landscape" }))),
|
|
1964
|
+
React__default.createElement(FormControl, { fullWidth: true, sx: formControlStyles },
|
|
1965
|
+
React__default.createElement(InputLabel, { id: "quality-select-label" }, "Quality"),
|
|
1966
|
+
React__default.createElement(Select, { labelId: "quality-select-label", id: "quality-select", label: "Quality", value: pdfContext.quality, onChange: function (event) {
|
|
1991
1967
|
var _a;
|
|
1992
1968
|
(_a = pdfContext.setQuality) === null || _a === void 0 ? void 0 : _a.call(pdfContext, event.target.value);
|
|
1993
|
-
} }, qualityOptions.map(function (el) { return (
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1969
|
+
} }, qualityOptions.map(function (el) { return (React__default.createElement(MenuItem, { key: el.value, value: el.value }, el.label)); }))),
|
|
1970
|
+
React__default.createElement(FormControl, { fullWidth: true, sx: formControlStyles },
|
|
1971
|
+
React__default.createElement(InputLabel, { id: "scale-select-label" }, "Scale"),
|
|
1972
|
+
React__default.createElement(Select, { labelId: "scale-select-label", id: "scale-select", label: "Scale", value: (_b = pdfContext === null || pdfContext === void 0 ? void 0 : pdfContext.options) === null || _b === void 0 ? void 0 : _b.fixedScale, onChange: function (event) {
|
|
1997
1973
|
var _a;
|
|
1998
1974
|
(_a = pdfContext.setOptions) === null || _a === void 0 ? void 0 : _a.call(pdfContext, function (val) { return (__assign(__assign({}, val), { fixedScale: event.target.value })); });
|
|
1999
|
-
} }, scaleOptions.map(function (el, idx) { return (
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
loading && (
|
|
1975
|
+
} }, scaleOptions.map(function (el, idx) { return (React__default.createElement(MenuItem, { key: idx, value: el.value }, el.label)); }))),
|
|
1976
|
+
React__default.createElement(FormControl, { fullWidth: true, sx: formControlStyles },
|
|
1977
|
+
React__default.createElement(Button, { variant: "contained", className: "createPdfButton", onClick: createPdfHandler, disabled: loading }, "create PDF"),
|
|
1978
|
+
loading && (React__default.createElement(CircularProgress, { size: 24, sx: {
|
|
2003
1979
|
color: 'primary.main',
|
|
2004
1980
|
position: 'absolute',
|
|
2005
1981
|
top: '50%',
|
|
@@ -2007,7 +1983,7 @@ function PdfForm(props) {
|
|
|
2007
1983
|
marginTop: '-12px',
|
|
2008
1984
|
marginLeft: '-12px',
|
|
2009
1985
|
} }))),
|
|
2010
|
-
pdfContext.options && pdfContext.setOptions && (
|
|
1986
|
+
pdfContext.options && pdfContext.setOptions && (React__default.createElement(PdfPreview, { options: pdfContext.options, setOptions: pdfContext.setOptions, geojsonRef: pdfContext.geojsonRef }))));
|
|
2011
1987
|
}
|
|
2012
1988
|
|
|
2013
1989
|
/**
|
|
@@ -2015,16 +1991,16 @@ function PdfForm(props) {
|
|
|
2015
1991
|
*
|
|
2016
1992
|
*/
|
|
2017
1993
|
var MlCreatePdfForm = function (props) {
|
|
2018
|
-
return (
|
|
2019
|
-
|
|
2020
|
-
|
|
1994
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
1995
|
+
React__default.createElement(PdfContextProvider, null,
|
|
1996
|
+
React__default.createElement(PdfForm, __assign({}, props)))));
|
|
2021
1997
|
};
|
|
2022
1998
|
MlCreatePdfForm.defaultProps = {
|
|
2023
1999
|
mapId: undefined,
|
|
2024
2000
|
};
|
|
2025
2001
|
|
|
2026
2002
|
function featureEditorStyle() {
|
|
2027
|
-
var mediaIsMobile =
|
|
2003
|
+
var mediaIsMobile = useMediaQuery(function (theme) { return theme.breakpoints.down('md'); });
|
|
2028
2004
|
var featureEditorStyle = [
|
|
2029
2005
|
{
|
|
2030
2006
|
id: 'gl-draw-polygon-fill-inactive',
|
|
@@ -2254,23 +2230,23 @@ function featureEditorStyle() {
|
|
|
2254
2230
|
* GeoJson Feature editor that allows to create or manipulate GeoJson data
|
|
2255
2231
|
*/
|
|
2256
2232
|
var useFeatureEditor = function (props) {
|
|
2257
|
-
var draw =
|
|
2233
|
+
var draw = useRef();
|
|
2258
2234
|
var mapHook = useMap({
|
|
2259
2235
|
mapId: props.mapId,
|
|
2260
2236
|
waitForLayer: props.insertBeforeLayer,
|
|
2261
2237
|
});
|
|
2262
|
-
var drawToolsInitialized =
|
|
2263
|
-
var _a =
|
|
2264
|
-
var _b =
|
|
2238
|
+
var drawToolsInitialized = useRef(false);
|
|
2239
|
+
var _a = useState(false), drawToolsReady = _a[0], setDrawToolsReady = _a[1];
|
|
2240
|
+
var _b = useState(), feature = _b[0], setFeature = _b[1];
|
|
2265
2241
|
var style = featureEditorStyle();
|
|
2266
|
-
var modeChangeHandler =
|
|
2242
|
+
var modeChangeHandler = useCallback(function (e) {
|
|
2267
2243
|
console.log('MlFeatureEditor mode change to ' + e.mode);
|
|
2268
2244
|
//setDrawMode(e.mode);
|
|
2269
2245
|
if (typeof props.onFinish === 'function' && e.mode === 'simple_select') {
|
|
2270
2246
|
props.onFinish();
|
|
2271
2247
|
}
|
|
2272
2248
|
}, [props.onFinish]);
|
|
2273
|
-
|
|
2249
|
+
useEffect(function () {
|
|
2274
2250
|
var _a;
|
|
2275
2251
|
if (mapHook.map && !drawToolsInitialized.current) {
|
|
2276
2252
|
drawToolsInitialized.current = true;
|
|
@@ -2296,7 +2272,7 @@ var useFeatureEditor = function (props) {
|
|
|
2296
2272
|
setDrawToolsReady(true);
|
|
2297
2273
|
}
|
|
2298
2274
|
}, [mapHook.map, props, drawToolsInitialized, modeChangeHandler]);
|
|
2299
|
-
|
|
2275
|
+
useEffect(function () {
|
|
2300
2276
|
if (!mapHook.map || !drawToolsReady)
|
|
2301
2277
|
return;
|
|
2302
2278
|
var changeHandler = function () {
|
|
@@ -2319,7 +2295,7 @@ var useFeatureEditor = function (props) {
|
|
|
2319
2295
|
mapHook.map.map.off('touchend', changeHandler);
|
|
2320
2296
|
};
|
|
2321
2297
|
}, [drawToolsReady, mapHook.map]);
|
|
2322
|
-
|
|
2298
|
+
useEffect(function () {
|
|
2323
2299
|
var _a;
|
|
2324
2300
|
if (draw.current && ((_a = props.geojson) === null || _a === void 0 ? void 0 : _a.geometry)) {
|
|
2325
2301
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2327,7 +2303,7 @@ var useFeatureEditor = function (props) {
|
|
|
2327
2303
|
draw.current.set({ type: 'FeatureCollection', features: [props.geojson] });
|
|
2328
2304
|
}
|
|
2329
2305
|
}, [props.geojson, drawToolsReady]);
|
|
2330
|
-
|
|
2306
|
+
useEffect(function () {
|
|
2331
2307
|
var _a, _b, _c, _d;
|
|
2332
2308
|
if (props.mode && draw.current && ((_b = (_a = draw.current) === null || _a === void 0 ? void 0 : _a.getMode) === null || _b === void 0 ? void 0 : _b.call(_a)) !== props.mode) {
|
|
2333
2309
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -2353,7 +2329,7 @@ var MlFeatureEditor = function (props) {
|
|
|
2353
2329
|
onFinish: props.onFinish,
|
|
2354
2330
|
mapId: props.mapId,
|
|
2355
2331
|
});
|
|
2356
|
-
return (
|
|
2332
|
+
return (React__default.createElement(React__default.Fragment, null));
|
|
2357
2333
|
};
|
|
2358
2334
|
|
|
2359
2335
|
var legalLayerTypes = [
|
|
@@ -2373,13 +2349,13 @@ function useLayer(props) {
|
|
|
2373
2349
|
mapId: props.mapId,
|
|
2374
2350
|
waitForLayer: props.insertBeforeLayer,
|
|
2375
2351
|
});
|
|
2376
|
-
var layerTypeRef =
|
|
2377
|
-
var layerPaintConfRef =
|
|
2378
|
-
var layerLayoutConfRef =
|
|
2379
|
-
var _b =
|
|
2380
|
-
var initializedRef =
|
|
2381
|
-
var layerId =
|
|
2382
|
-
var createLayer =
|
|
2352
|
+
var layerTypeRef = useRef('');
|
|
2353
|
+
var layerPaintConfRef = useRef('');
|
|
2354
|
+
var layerLayoutConfRef = useRef('');
|
|
2355
|
+
var _b = useState(), layer = _b[0], setLayer = _b[1];
|
|
2356
|
+
var initializedRef = useRef(false);
|
|
2357
|
+
var layerId = useRef(props.layerId || (props.idPrefix ? props.idPrefix : 'Layer-') + mapHook.componentId);
|
|
2358
|
+
var createLayer = useCallback(function () {
|
|
2383
2359
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
2384
2360
|
if (!mapHook.map || (mapHook === null || mapHook === void 0 ? void 0 : mapHook.map.cancelled))
|
|
2385
2361
|
return;
|
|
@@ -2455,7 +2431,7 @@ function useLayer(props) {
|
|
|
2455
2431
|
layerLayoutConfRef.current = JSON.stringify((_s = props.options) === null || _s === void 0 ? void 0 : _s.layout);
|
|
2456
2432
|
layerTypeRef.current = props.options.type;
|
|
2457
2433
|
}, [props, mapHook]);
|
|
2458
|
-
|
|
2434
|
+
useEffect(function () {
|
|
2459
2435
|
var _a, _b, _c, _d, _e;
|
|
2460
2436
|
if (!mapHook.map)
|
|
2461
2437
|
return;
|
|
@@ -2471,7 +2447,7 @@ function useLayer(props) {
|
|
|
2471
2447
|
}
|
|
2472
2448
|
createLayer();
|
|
2473
2449
|
}, [mapHook.map, mapHook.mapIsReady, props, createLayer]);
|
|
2474
|
-
|
|
2450
|
+
useEffect(function () {
|
|
2475
2451
|
var _a, _b, _c, _d, _e, _f;
|
|
2476
2452
|
if (((_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.cancelled) === true ||
|
|
2477
2453
|
!initializedRef.current ||
|
|
@@ -2481,7 +2457,7 @@ function useLayer(props) {
|
|
|
2481
2457
|
//@ts-ignore setData only exists on GeoJsonSource
|
|
2482
2458
|
(_f = (_e = mapHook.map.map.getSource(layerId.current)) === null || _e === void 0 ? void 0 : _e.setData) === null || _f === void 0 ? void 0 : _f.call(_e, props.geojson);
|
|
2483
2459
|
}, [props.geojson, mapHook.map, props.options.type]);
|
|
2484
|
-
|
|
2460
|
+
useEffect(function () {
|
|
2485
2461
|
var _a, _b, _c, _d, _e, _f;
|
|
2486
2462
|
if (((_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.cancelled) === true ||
|
|
2487
2463
|
!mapHook.map ||
|
|
@@ -2511,7 +2487,7 @@ function useLayer(props) {
|
|
|
2511
2487
|
layerPaintConfRef.current = paintString;
|
|
2512
2488
|
}
|
|
2513
2489
|
}, [props.options, mapHook.map]);
|
|
2514
|
-
|
|
2490
|
+
useEffect(function () {
|
|
2515
2491
|
if (!props.insertBeforeLayer ||
|
|
2516
2492
|
!mapHook.map ||
|
|
2517
2493
|
!mapHook.map.getLayer(props.insertBeforeLayer) ||
|
|
@@ -2519,13 +2495,13 @@ function useLayer(props) {
|
|
|
2519
2495
|
return;
|
|
2520
2496
|
mapHook.map.moveLayer(layerId.current, props.insertBeforeLayer);
|
|
2521
2497
|
}, [mapHook.map, props.insertBeforeLayer]);
|
|
2522
|
-
|
|
2498
|
+
useEffect(function () {
|
|
2523
2499
|
return function () {
|
|
2524
2500
|
initializedRef.current = false;
|
|
2525
2501
|
mapHook.cleanup();
|
|
2526
2502
|
};
|
|
2527
2503
|
}, []);
|
|
2528
|
-
|
|
2504
|
+
useEffect(function () {
|
|
2529
2505
|
var _a, _b, _c, _d, _e, _f;
|
|
2530
2506
|
if (typeof ((_a = props === null || props === void 0 ? void 0 : props.options) === null || _a === void 0 ? void 0 : _a.source) !== 'string' ||
|
|
2531
2507
|
!mapHook.map ||
|
|
@@ -2565,7 +2541,7 @@ useLayer.defaultProps = {};
|
|
|
2565
2541
|
var MlFillExtrusionLayer = function (props) {
|
|
2566
2542
|
useLayer({
|
|
2567
2543
|
mapId: props.mapId,
|
|
2568
|
-
layerId: props.layerId || "MlFillExtrusionLayer-" +
|
|
2544
|
+
layerId: props.layerId || "MlFillExtrusionLayer-" + v4(),
|
|
2569
2545
|
options: {
|
|
2570
2546
|
id: "",
|
|
2571
2547
|
type: "fill-extrusion",
|
|
@@ -2576,7 +2552,7 @@ var MlFillExtrusionLayer = function (props) {
|
|
|
2576
2552
|
},
|
|
2577
2553
|
insertBeforeFirstSymbolLayer: true,
|
|
2578
2554
|
});
|
|
2579
|
-
return
|
|
2555
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
2580
2556
|
};
|
|
2581
2557
|
MlFillExtrusionLayer.defaultProps = {
|
|
2582
2558
|
mapId: undefined,
|
|
@@ -2659,9 +2635,9 @@ function useSource(props) {
|
|
|
2659
2635
|
var mapHook = useMap({
|
|
2660
2636
|
mapId: props.mapId,
|
|
2661
2637
|
});
|
|
2662
|
-
var _b =
|
|
2663
|
-
var sourceId =
|
|
2664
|
-
var removeSource =
|
|
2638
|
+
var _b = useState(), source = _b[0], setSource = _b[1];
|
|
2639
|
+
var sourceId = useRef(props.sourceId || (props.idPrefix ? props.idPrefix : 'Source-') + mapHook.componentId);
|
|
2640
|
+
var removeSource = useCallback(function () {
|
|
2665
2641
|
var _a, _b;
|
|
2666
2642
|
if (mapHook.map && ((_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b._layers)) {
|
|
2667
2643
|
for (var _i = 0, _c = Object.entries(mapHook.map.map.style._layers); _i < _c.length; _i++) {
|
|
@@ -2675,7 +2651,7 @@ function useSource(props) {
|
|
|
2675
2651
|
}
|
|
2676
2652
|
}
|
|
2677
2653
|
}, [mapHook.map]);
|
|
2678
|
-
var createSource =
|
|
2654
|
+
var createSource = useCallback(function () {
|
|
2679
2655
|
var _a;
|
|
2680
2656
|
if (!mapHook.map)
|
|
2681
2657
|
return;
|
|
@@ -2687,7 +2663,7 @@ function useSource(props) {
|
|
|
2687
2663
|
(_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.addSource(sourceId.current, __assign({}, props.source));
|
|
2688
2664
|
setSource(mapHook.map.map.getSource(sourceId.current));
|
|
2689
2665
|
}, [props, mapHook, removeSource]);
|
|
2690
|
-
|
|
2666
|
+
useEffect(function () {
|
|
2691
2667
|
var _a, _b, _c, _d;
|
|
2692
2668
|
if (!((_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.getSource(sourceId.current)))
|
|
2693
2669
|
return;
|
|
@@ -2697,7 +2673,7 @@ function useSource(props) {
|
|
|
2697
2673
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2698
2674
|
//@ts-ignore data only exists on GeoJsonSource
|
|
2699
2675
|
}, [(_a = props.source) === null || _a === void 0 ? void 0 : _a.data]);
|
|
2700
|
-
|
|
2676
|
+
useEffect(function () {
|
|
2701
2677
|
var _a, _b, _c;
|
|
2702
2678
|
if (((_c = (_b = (_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.getSource) === null || _c === void 0 ? void 0 : _c.call(_b, props.sourceId)) && props.sourceId === sourceId.current)
|
|
2703
2679
|
return;
|
|
@@ -2705,7 +2681,7 @@ function useSource(props) {
|
|
|
2705
2681
|
createSource();
|
|
2706
2682
|
}, [mapHook.map, props, createSource]);
|
|
2707
2683
|
//cleanup
|
|
2708
|
-
|
|
2684
|
+
useEffect(function () {
|
|
2709
2685
|
return function () {
|
|
2710
2686
|
removeSource();
|
|
2711
2687
|
};
|
|
@@ -2726,11 +2702,11 @@ function useSource(props) {
|
|
|
2726
2702
|
var MlGeoJsonLayer = function (props) {
|
|
2727
2703
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2728
2704
|
var layerType = props.type || getDefaulLayerTypeByGeometry(props.geojson);
|
|
2729
|
-
var layerId =
|
|
2705
|
+
var layerId = useRef(props.layerId || 'MlGeoJsonLayer-' + v4());
|
|
2730
2706
|
var labelLayerId = "label-".concat(layerId.current);
|
|
2731
|
-
|
|
2707
|
+
useEffect(function () {
|
|
2732
2708
|
if (!props.layerId) {
|
|
2733
|
-
layerId.current = 'MlGeoJsonLayer-' +
|
|
2709
|
+
layerId.current = 'MlGeoJsonLayer-' + v4();
|
|
2734
2710
|
}
|
|
2735
2711
|
else {
|
|
2736
2712
|
layerId.current = props.layerId;
|
|
@@ -2759,7 +2735,7 @@ var MlGeoJsonLayer = function (props) {
|
|
|
2759
2735
|
mapId: props.mapId,
|
|
2760
2736
|
options: __assign(__assign(__assign({ source: props.labelProp ? 'source-' + layerId.current : undefined, id: labelLayerId, type: 'symbol', maxzoom: 24, minzoom: 1 }, ((props === null || props === void 0 ? void 0 : props.labelOptions) ? props.labelOptions : {})), (((_e = props === null || props === void 0 ? void 0 : props.options) === null || _e === void 0 ? void 0 : _e.filter) ? { filter: props.options.filter } : {})), { layout: __assign(__assign({ 'text-font': ['Open Sans Regular'], 'text-field': "{".concat(props.labelProp, "}"), 'text-size': 12, 'text-anchor': 'top' }, (((_f = props === null || props === void 0 ? void 0 : props.labelOptions) === null || _f === void 0 ? void 0 : _f.layout) ? props.labelOptions.layout : {})), (((_g = props === null || props === void 0 ? void 0 : props.layout) === null || _g === void 0 ? void 0 : _g.visibility) ? { visibility: props.layout.visibility } : {})), paint: __assign({ 'text-halo-width': 1, 'text-halo-color': '#fefefe', 'text-color': '#121212' }, (((_h = props === null || props === void 0 ? void 0 : props.labelOptions) === null || _h === void 0 ? void 0 : _h.paint) ? props.labelOptions.paint : {})) }),
|
|
2761
2737
|
});
|
|
2762
|
-
return
|
|
2738
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
2763
2739
|
};
|
|
2764
2740
|
|
|
2765
2741
|
/**
|
|
@@ -2772,13 +2748,13 @@ var MlFollowGps = function (props) {
|
|
|
2772
2748
|
mapId: props.mapId,
|
|
2773
2749
|
waitForLayer: props.insertBeforeLayer,
|
|
2774
2750
|
});
|
|
2775
|
-
var _a =
|
|
2776
|
-
var _b =
|
|
2777
|
-
var _c =
|
|
2778
|
-
var _d =
|
|
2779
|
-
var _e =
|
|
2780
|
-
var initiallyCentered =
|
|
2781
|
-
var getLocationSuccess =
|
|
2751
|
+
var _a = useState(false), isFollowed = _a[0], setIsFollowed = _a[1];
|
|
2752
|
+
var _b = useState(), userLocationGeoJson = _b[0], setUserLocationGeoJson = _b[1];
|
|
2753
|
+
var _c = useState(false), locationAccessDenied = _c[0], setLocationAccessDenied = _c[1];
|
|
2754
|
+
var _d = useState(), accuracyGeoJson = _d[0], setAccuracyGeoJson = _d[1];
|
|
2755
|
+
var _e = useState(0), deviceOrientation = _e[0], setDeviceOrientation = _e[1];
|
|
2756
|
+
var initiallyCentered = useRef(false);
|
|
2757
|
+
var getLocationSuccess = useCallback(function (pos) {
|
|
2782
2758
|
if (!mapHook.map)
|
|
2783
2759
|
return;
|
|
2784
2760
|
if ((!props.centerUserPosition && !initiallyCentered.current) || props.centerUserPosition) {
|
|
@@ -2797,15 +2773,15 @@ var MlFollowGps = function (props) {
|
|
|
2797
2773
|
}
|
|
2798
2774
|
if (!props.showUserLocation)
|
|
2799
2775
|
return;
|
|
2800
|
-
var geoJsonPoint =
|
|
2776
|
+
var geoJsonPoint = point([pos.coords.longitude, pos.coords.latitude]);
|
|
2801
2777
|
setUserLocationGeoJson(geoJsonPoint);
|
|
2802
|
-
setAccuracyGeoJson(
|
|
2778
|
+
setAccuracyGeoJson(circle(geoJsonPoint, pos.coords.accuracy / 1000));
|
|
2803
2779
|
}, [mapHook.map, props]);
|
|
2804
2780
|
var getLocationError = function () {
|
|
2805
2781
|
console.log('Access of user location denied');
|
|
2806
2782
|
setLocationAccessDenied(true);
|
|
2807
2783
|
};
|
|
2808
|
-
var orientationCone =
|
|
2784
|
+
var orientationCone = useMemo(function () {
|
|
2809
2785
|
if (!userLocationGeoJson) {
|
|
2810
2786
|
return undefined;
|
|
2811
2787
|
}
|
|
@@ -2813,7 +2789,7 @@ var MlFollowGps = function (props) {
|
|
|
2813
2789
|
var bearing1 = deviceOrientation - 15;
|
|
2814
2790
|
var bearing2 = deviceOrientation + 15;
|
|
2815
2791
|
var options = { steps: 65 };
|
|
2816
|
-
var arc =
|
|
2792
|
+
var arc = lineArc(userLocationGeoJson, radius, bearing1, bearing2, options);
|
|
2817
2793
|
var copy = arc;
|
|
2818
2794
|
copy.geometry.coordinates.push(userLocationGeoJson.geometry.coordinates);
|
|
2819
2795
|
copy.geometry.coordinates.slice(0, 0);
|
|
@@ -2824,7 +2800,7 @@ var MlFollowGps = function (props) {
|
|
|
2824
2800
|
setDeviceOrientation(-event.alpha);
|
|
2825
2801
|
}
|
|
2826
2802
|
};
|
|
2827
|
-
|
|
2803
|
+
useEffect(function () {
|
|
2828
2804
|
if (isFollowed) {
|
|
2829
2805
|
var _handleOrientation_1 = handleOrientation;
|
|
2830
2806
|
window.addEventListener('deviceorientation', _handleOrientation_1);
|
|
@@ -2837,7 +2813,7 @@ var MlFollowGps = function (props) {
|
|
|
2837
2813
|
}
|
|
2838
2814
|
return;
|
|
2839
2815
|
}, [isFollowed]);
|
|
2840
|
-
|
|
2816
|
+
useEffect(function () {
|
|
2841
2817
|
if (!mapHook.map)
|
|
2842
2818
|
return;
|
|
2843
2819
|
if (isFollowed) {
|
|
@@ -2848,7 +2824,7 @@ var MlFollowGps = function (props) {
|
|
|
2848
2824
|
}
|
|
2849
2825
|
return;
|
|
2850
2826
|
}, [mapHook.map, isFollowed, getLocationSuccess]);
|
|
2851
|
-
|
|
2827
|
+
useEffect(function () {
|
|
2852
2828
|
var _a, _b;
|
|
2853
2829
|
if (accuracyGeoJson === null || accuracyGeoJson === void 0 ? void 0 : accuracyGeoJson.type) {
|
|
2854
2830
|
var getBounds = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.getBounds();
|
|
@@ -2858,8 +2834,8 @@ var MlFollowGps = function (props) {
|
|
|
2858
2834
|
getBounds === null || getBounds === void 0 ? void 0 : getBounds._sw.lng,
|
|
2859
2835
|
getBounds === null || getBounds === void 0 ? void 0 : getBounds._sw.lat,
|
|
2860
2836
|
];
|
|
2861
|
-
var accurancyBounds =
|
|
2862
|
-
var contained =
|
|
2837
|
+
var accurancyBounds = bbox(accuracyGeoJson);
|
|
2838
|
+
var contained = booleanContains(bboxPolygon(actualBounds), bboxPolygon(accurancyBounds));
|
|
2863
2839
|
if (contained === false) {
|
|
2864
2840
|
(_b = mapHook.map) === null || _b === void 0 ? void 0 : _b.fitBounds(accurancyBounds, {
|
|
2865
2841
|
padding: { top: 25, bottom: 25 },
|
|
@@ -2867,11 +2843,11 @@ var MlFollowGps = function (props) {
|
|
|
2867
2843
|
}
|
|
2868
2844
|
}
|
|
2869
2845
|
}, [accuracyGeoJson]);
|
|
2870
|
-
return (
|
|
2871
|
-
isFollowed && userLocationGeoJson && (
|
|
2872
|
-
isFollowed && orientationCone && (
|
|
2873
|
-
isFollowed && userLocationGeoJson && (
|
|
2874
|
-
|
|
2846
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
2847
|
+
isFollowed && userLocationGeoJson && (React__default.createElement(MlGeoJsonLayer, { geojson: accuracyGeoJson, type: 'fill', paint: __assign({ 'fill-color': '#cbd300', 'fill-opacity': 0.3 }, props.accuracyPaint), insertBeforeLayer: props.insertBeforeLayer })),
|
|
2848
|
+
isFollowed && orientationCone && (React__default.createElement(MlGeoJsonLayer, { geojson: orientationCone, type: 'fill', paint: __assign({ 'fill-color': '#0000ff', 'fill-antialias': false, 'fill-opacity': 0.3 }, props.orientationConePaint), insertBeforeLayer: props.insertBeforeLayer })),
|
|
2849
|
+
isFollowed && userLocationGeoJson && (React__default.createElement(MlGeoJsonLayer, { geojson: userLocationGeoJson, type: 'circle', paint: __assign({ 'circle-color': '#009ee0', 'circle-radius': 5, 'circle-stroke-color': '#fafaff', 'circle-stroke-width': 1 }, props.circlePaint), insertBeforeLayer: props.insertBeforeLayer })),
|
|
2850
|
+
React__default.createElement(Button, { variant: "navtools", sx: {
|
|
2875
2851
|
zIndex: 1002,
|
|
2876
2852
|
color: isFollowed
|
|
2877
2853
|
? function (theme) { return theme.palette.GPS.GPSActiveColor; }
|
|
@@ -2882,7 +2858,7 @@ var MlFollowGps = function (props) {
|
|
|
2882
2858
|
}, disabled: locationAccessDenied, onClick: function () {
|
|
2883
2859
|
setIsFollowed(!isFollowed);
|
|
2884
2860
|
} },
|
|
2885
|
-
|
|
2861
|
+
React__default.createElement(GpsFixedIcon, { sx: { fontSize: { xs: '1.4em', md: '1em' } } }))));
|
|
2886
2862
|
};
|
|
2887
2863
|
MlFollowGps.defaultProps = {
|
|
2888
2864
|
mapId: undefined,
|
|
@@ -2900,9 +2876,9 @@ var MlImageMarkerLayer = function (props) {
|
|
|
2900
2876
|
mapId: props.mapId,
|
|
2901
2877
|
waitForLayer: props.insertBeforeLayer,
|
|
2902
2878
|
});
|
|
2903
|
-
var _e =
|
|
2904
|
-
var imageIdRef =
|
|
2905
|
-
var layerId =
|
|
2879
|
+
var _e = useState(), imageId = _e[0], setImageId = _e[1];
|
|
2880
|
+
var imageIdRef = useRef(props.imageId || 'img_' + v4());
|
|
2881
|
+
var layerId = useRef(props.layerId || 'MlImageMarkerLayer-' + mapHook.componentId);
|
|
2906
2882
|
useLayer({
|
|
2907
2883
|
geojson: (_b = (_a = props.options) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.data,
|
|
2908
2884
|
layerId: layerId.current,
|
|
@@ -2929,14 +2905,14 @@ var MlImageMarkerLayer = function (props) {
|
|
|
2929
2905
|
});
|
|
2930
2906
|
}
|
|
2931
2907
|
};
|
|
2932
|
-
|
|
2908
|
+
useEffect(function () {
|
|
2933
2909
|
if (!mapHook.map)
|
|
2934
2910
|
return;
|
|
2935
2911
|
if (props.imgSrc) {
|
|
2936
2912
|
createImage(mapHook, props);
|
|
2937
2913
|
}
|
|
2938
2914
|
}, [props, mapHook]);
|
|
2939
|
-
return
|
|
2915
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
2940
2916
|
};
|
|
2941
2917
|
|
|
2942
2918
|
//const unitSquareConvert = {
|
|
@@ -2950,15 +2926,15 @@ function getUnitLabel(measureType) {
|
|
|
2950
2926
|
return measureType === 'miles' ? 'mi' : 'km';
|
|
2951
2927
|
}
|
|
2952
2928
|
var MlMeasureTool = function (props) {
|
|
2953
|
-
var _a =
|
|
2954
|
-
var _b =
|
|
2955
|
-
|
|
2929
|
+
var _a = useState({ value: 0, label: 'km' }), displayValue = _a[0], setDisplayValue = _a[1];
|
|
2930
|
+
var _b = useState([]), currentFeatures = _b[0], setCurrentFeatures = _b[1];
|
|
2931
|
+
useEffect(function () {
|
|
2956
2932
|
if (currentFeatures[0]) {
|
|
2957
2933
|
var result = props.measureType === 'polygon'
|
|
2958
2934
|
? // for "polyong" mode calculate km²
|
|
2959
|
-
(
|
|
2935
|
+
(turf.area(currentFeatures[0]) / 1000000) *
|
|
2960
2936
|
getUnitSquareMultiplier(props.unit)
|
|
2961
|
-
:
|
|
2937
|
+
: turf.length(currentFeatures[0], { units: props.unit });
|
|
2962
2938
|
if (typeof props.onChange === 'function') {
|
|
2963
2939
|
props.onChange({ value: result, unit: props.unit, geojson: currentFeatures[0] });
|
|
2964
2940
|
}
|
|
@@ -2982,14 +2958,14 @@ var MlMeasureTool = function (props) {
|
|
|
2982
2958
|
}
|
|
2983
2959
|
}
|
|
2984
2960
|
}, [props.unit, currentFeatures]);
|
|
2985
|
-
return (
|
|
2986
|
-
|
|
2961
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
2962
|
+
React__default.createElement(MlFeatureEditor, { onChange: function (features) {
|
|
2987
2963
|
features && setCurrentFeatures(features);
|
|
2988
2964
|
}, mode: props.measureType === 'polygon' ? 'draw_polygon' : 'draw_line_string', onFinish: props.onFinish }),
|
|
2989
2965
|
displayValue.value.toFixed(2),
|
|
2990
2966
|
" ",
|
|
2991
2967
|
'',
|
|
2992
|
-
|
|
2968
|
+
React__default.createElement(Typography, null,
|
|
2993
2969
|
displayValue.label,
|
|
2994
2970
|
props.measureType === 'polygon' ? ' ²' : '')));
|
|
2995
2971
|
};
|
|
@@ -3002,19 +2978,19 @@ MlMeasureTool.defaultProps = {
|
|
|
3002
2978
|
var _g;
|
|
3003
2979
|
function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
3004
2980
|
var SvgCompassNeedle = function SvgCompassNeedle(props) {
|
|
3005
|
-
return /*#__PURE__*/
|
|
2981
|
+
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
3006
2982
|
width: 10,
|
|
3007
2983
|
height: 40,
|
|
3008
2984
|
viewBox: "0 0 10 40",
|
|
3009
2985
|
fill: "none",
|
|
3010
2986
|
id: "svg6"
|
|
3011
|
-
}, props), _g || (_g = /*#__PURE__*/
|
|
2987
|
+
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
3012
2988
|
id: "g14",
|
|
3013
2989
|
transform: "translate(0.67544,-1.25e-5)"
|
|
3014
|
-
}, /*#__PURE__*/
|
|
2990
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
3015
2991
|
d: "m 3.34715,4.52028 c 0.22737,-1.05154 1.72745,-1.05154 1.95482,0 L 8.64912,20 H 0 Z",
|
|
3016
2992
|
fill: "#cf003d"
|
|
3017
|
-
}), /*#__PURE__*/
|
|
2993
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3018
2994
|
d: "m 3.34715,35.4797 c 0.22737,1.0516 1.72745,1.0516 1.95482,0 L 8.64912,20 H 0 Z",
|
|
3019
2995
|
fill: "#d3dcf0"
|
|
3020
2996
|
}))));
|
|
@@ -3023,35 +2999,35 @@ var SvgCompassNeedle = function SvgCompassNeedle(props) {
|
|
|
3023
2999
|
var _circle, _path$1, _path2$1, _path3, _path4;
|
|
3024
3000
|
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
3025
3001
|
var SvgCompassBackground = function SvgCompassBackground(props) {
|
|
3026
|
-
return /*#__PURE__*/
|
|
3002
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
3027
3003
|
width: 52,
|
|
3028
3004
|
height: 53,
|
|
3029
3005
|
viewBox: "0 0 52 53",
|
|
3030
3006
|
fill: "none",
|
|
3031
3007
|
xmlns: "http://www.w3.org/2000/svg"
|
|
3032
|
-
}, props), _circle || (_circle = /*#__PURE__*/
|
|
3008
|
+
}, props), _circle || (_circle = /*#__PURE__*/React.createElement("circle", {
|
|
3033
3009
|
cx: 26.0001,
|
|
3034
3010
|
cy: 26.1843,
|
|
3035
3011
|
r: 24,
|
|
3036
3012
|
fill: "white",
|
|
3037
3013
|
stroke: "#009EE0",
|
|
3038
3014
|
strokeWidth: 2
|
|
3039
|
-
})), _path$1 || (_path$1 = /*#__PURE__*/
|
|
3015
|
+
})), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
3040
3016
|
d: "M26.4915 7.59161C26.3524 8.07338 25.6698 8.07338 25.5307 7.59161L24.2998 3.3276C24.2075 3.0079 24.4474 2.68893 24.7802 2.68893H27.242C27.5748 2.68893 27.8147 3.0079 27.7224 3.3276L26.4915 7.59161Z",
|
|
3041
3017
|
fill: "#009EE0"
|
|
3042
|
-
})), _path2$1 || (_path2$1 = /*#__PURE__*/
|
|
3018
|
+
})), _path2$1 || (_path2$1 = /*#__PURE__*/React.createElement("path", {
|
|
3043
3019
|
d: "M25.5085 44.7598C25.6476 44.278 26.3302 44.278 26.4693 44.7598L27.7002 49.0238C27.7925 49.3435 27.5526 49.6625 27.2198 49.6625H24.758C24.4252 49.6625 24.1853 49.3435 24.2776 49.0238L25.5085 44.7598Z",
|
|
3044
3020
|
fill: "#009EE0"
|
|
3045
|
-
})), _path3 || (_path3 = /*#__PURE__*/
|
|
3021
|
+
})), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
|
|
3046
3022
|
d: "M44.6641 26.4915C44.1823 26.3524 44.1823 25.6698 44.6641 25.5307L48.9281 24.2998C49.2478 24.2075 49.5668 24.4474 49.5668 24.7802V27.242C49.5668 27.5747 49.2478 27.8147 48.9281 27.7224L44.6641 26.4915Z",
|
|
3047
3023
|
fill: "#009EE0"
|
|
3048
|
-
})), _path4 || (_path4 = /*#__PURE__*/
|
|
3024
|
+
})), _path4 || (_path4 = /*#__PURE__*/React.createElement("path", {
|
|
3049
3025
|
d: "M7.3959 25.6085C7.87766 25.7476 7.87766 26.4302 7.3959 26.5693L3.13189 27.8002C2.81218 27.8925 2.49321 27.6526 2.49321 27.3198L2.49321 24.858C2.49321 24.5253 2.81218 24.2853 3.13189 24.3776L7.3959 25.6085Z",
|
|
3050
3026
|
fill: "#009EE0"
|
|
3051
3027
|
})));
|
|
3052
3028
|
};
|
|
3053
3029
|
|
|
3054
|
-
var BoxStyled$2 =
|
|
3030
|
+
var BoxStyled$2 = styled(Box)(function (_a) {
|
|
3055
3031
|
var _b;
|
|
3056
3032
|
var theme = _a.theme;
|
|
3057
3033
|
return (_b = {
|
|
@@ -3064,7 +3040,7 @@ var BoxStyled$2 = material.styled(material.Box)(function (_a) {
|
|
|
3064
3040
|
},
|
|
3065
3041
|
_b);
|
|
3066
3042
|
});
|
|
3067
|
-
var CompassBox =
|
|
3043
|
+
var CompassBox = styled(Box)(function (_a) {
|
|
3068
3044
|
var _b;
|
|
3069
3045
|
var theme = _a.theme;
|
|
3070
3046
|
return (_b = {
|
|
@@ -3094,7 +3070,7 @@ var CompassBox = material.styled(material.Box)(function (_a) {
|
|
|
3094
3070
|
},
|
|
3095
3071
|
_b);
|
|
3096
3072
|
});
|
|
3097
|
-
var NeedleBox =
|
|
3073
|
+
var NeedleBox = styled(Box)(function (_a) {
|
|
3098
3074
|
var theme = _a.theme;
|
|
3099
3075
|
return ({
|
|
3100
3076
|
display: 'flex',
|
|
@@ -3119,14 +3095,14 @@ var MlNavigationCompass = function (props) {
|
|
|
3119
3095
|
mapId: props.mapId,
|
|
3120
3096
|
waitForLayer: props.insertBeforeLayer,
|
|
3121
3097
|
});
|
|
3122
|
-
var _a =
|
|
3098
|
+
var _a = useState(0), bearing = _a[0], setBearing = _a[1];
|
|
3123
3099
|
var _updateBearing = function () {
|
|
3124
3100
|
var _a, _b;
|
|
3125
3101
|
if (!((_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.getBearing))
|
|
3126
3102
|
return;
|
|
3127
3103
|
setBearing(Math.round(mapHook.map.map.getBearing()));
|
|
3128
3104
|
};
|
|
3129
|
-
|
|
3105
|
+
useEffect(function () {
|
|
3130
3106
|
if (!mapHook.map)
|
|
3131
3107
|
return;
|
|
3132
3108
|
mapHook.map.on('rotate', _updateBearing, mapHook.componentId);
|
|
@@ -3151,12 +3127,12 @@ var MlNavigationCompass = function (props) {
|
|
|
3151
3127
|
(_d = mapHook.map) === null || _d === void 0 ? void 0 : _d.map.setBearing(0);
|
|
3152
3128
|
}
|
|
3153
3129
|
};
|
|
3154
|
-
return (
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3130
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
3131
|
+
React__default.createElement(BoxStyled$2, { sx: __assign({}, props.style) },
|
|
3132
|
+
React__default.createElement(CompassBox, { onClick: rotate, sx: __assign({}, props.backgroundStyle) },
|
|
3133
|
+
React__default.createElement(SvgCompassBackground, { style: { position: 'absolute', top: 0, left: 0 } }),
|
|
3134
|
+
React__default.createElement(NeedleBox, { onClick: rotate, sx: __assign({}, props.needleStyle) },
|
|
3135
|
+
React__default.createElement(SvgCompassNeedle, { style: {
|
|
3160
3136
|
transform: 'rotate(' + (bearing > 0 ? '-' + bearing : -1 * bearing) + 'deg)',
|
|
3161
3137
|
} }))))));
|
|
3162
3138
|
};
|
|
@@ -3169,9 +3145,9 @@ var MlNavigationTools = function (props) {
|
|
|
3169
3145
|
mapId: props.mapId,
|
|
3170
3146
|
waitForLayer: props.insertBeforeLayer,
|
|
3171
3147
|
});
|
|
3172
|
-
var _a =
|
|
3173
|
-
var mediaIsMobile = useMediaQuery(function (theme) { return theme.breakpoints.down('md'); });
|
|
3174
|
-
|
|
3148
|
+
var _a = useState(0), pitch = _a[0], setPitch = _a[1];
|
|
3149
|
+
var mediaIsMobile = useMediaQuery$1(function (theme) { return theme.breakpoints.down('md'); });
|
|
3150
|
+
useEffect(function () {
|
|
3175
3151
|
if (!mapHook.map)
|
|
3176
3152
|
return;
|
|
3177
3153
|
mapHook.map.on('pitchend', function () {
|
|
@@ -3181,43 +3157,43 @@ var MlNavigationTools = function (props) {
|
|
|
3181
3157
|
}, mapHook.componentId);
|
|
3182
3158
|
setPitch(mapHook.map.getPitch());
|
|
3183
3159
|
}, [mapHook.map, props.mapId]);
|
|
3184
|
-
var zoomIn =
|
|
3160
|
+
var zoomIn = useCallback(function () {
|
|
3185
3161
|
if (!mapHook.map)
|
|
3186
3162
|
return;
|
|
3187
3163
|
if (mapHook.map.transform._zoom + 0.5 <= mapHook.map.transform._maxZoom) {
|
|
3188
3164
|
mapHook.map.easeTo({ zoom: mapHook.map.transform._zoom + 0.5 });
|
|
3189
3165
|
}
|
|
3190
3166
|
}, [mapHook.map]);
|
|
3191
|
-
var zoomOut =
|
|
3167
|
+
var zoomOut = useCallback(function () {
|
|
3192
3168
|
if (!mapHook.map)
|
|
3193
3169
|
return;
|
|
3194
3170
|
if (mapHook.map.transform._zoom - 0.5 >= mapHook.map.transform._minZoom) {
|
|
3195
3171
|
mapHook.map.easeTo({ zoom: mapHook.map.transform._zoom - 0.5 });
|
|
3196
3172
|
}
|
|
3197
3173
|
}, [mapHook.map]);
|
|
3198
|
-
var adjustPitch =
|
|
3174
|
+
var adjustPitch = useCallback(function () {
|
|
3199
3175
|
if (!mapHook.map)
|
|
3200
3176
|
return;
|
|
3201
3177
|
setPitch(mapHook.map.getPitch());
|
|
3202
3178
|
var targetPitch = mapHook.map.getPitch() !== 0 ? 0 : 60;
|
|
3203
3179
|
mapHook.map.easeTo({ pitch: targetPitch });
|
|
3204
3180
|
}, [mapHook.map]);
|
|
3205
|
-
return (
|
|
3206
|
-
|
|
3207
|
-
props.show3DButton && (
|
|
3208
|
-
props.showFollowGpsButton &&
|
|
3209
|
-
props.showCenterLocationButton &&
|
|
3210
|
-
|
|
3181
|
+
return (React__default.createElement(Box$1, { sx: __assign(__assign({ zIndex: 501, position: 'absolute', display: 'flex', flexDirection: 'column', right: mediaIsMobile ? '15px' : '25px', bottom: mediaIsMobile ? '20px' : '30px' }, (mediaIsMobile ? { margin: '80px 10px 50px 10px' } : { marginTop: '50px' })), props.sx) },
|
|
3182
|
+
React__default.createElement(MlNavigationCompass, null),
|
|
3183
|
+
props.show3DButton && (React__default.createElement(Button$1, { variant: "navtools", onClick: adjustPitch }, pitch < 29 ? '3D' : '2D')),
|
|
3184
|
+
props.showFollowGpsButton && React__default.createElement(MlFollowGps, null),
|
|
3185
|
+
props.showCenterLocationButton && React__default.createElement(MlCenterPosition, null),
|
|
3186
|
+
React__default.createElement(ButtonGroup, { orientation: "vertical", sx: {
|
|
3211
3187
|
border: 'none',
|
|
3212
3188
|
Button: { minWidth: '20px !important' },
|
|
3213
3189
|
'Button:hover': { border: 'none' },
|
|
3214
|
-
} }, props.showZoomButtons && (
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
props.children &&
|
|
3190
|
+
} }, props.showZoomButtons && (React__default.createElement(React__default.Fragment, null,
|
|
3191
|
+
React__default.createElement(Button$1, { variant: "navtools", onClick: zoomIn },
|
|
3192
|
+
React__default.createElement(ControlPointIcon, { sx: { fontSize: { xs: '1.4em', md: '1em' } } })),
|
|
3193
|
+
React__default.createElement(Divider, { sx: { zIndex: 500, marginLeft: '7px', marginRight: '7px' } }),
|
|
3194
|
+
React__default.createElement(Button$1, { variant: "navtools", onClick: zoomOut },
|
|
3195
|
+
React__default.createElement(RemoveCircleOutlineIcon, { sx: { fontSize: { xs: '1.4em', md: '1em' } } }))))),
|
|
3196
|
+
props.children && React__default.cloneElement(props.children, {})));
|
|
3221
3197
|
};
|
|
3222
3198
|
MlNavigationTools.defaultProps = {
|
|
3223
3199
|
mapId: undefined,
|
|
@@ -3243,15 +3219,15 @@ var MlLayer = function (props) {
|
|
|
3243
3219
|
} }, props.options),
|
|
3244
3220
|
insertBeforeLayer: props.insertBeforeLayer,
|
|
3245
3221
|
});
|
|
3246
|
-
return
|
|
3222
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
3247
3223
|
};
|
|
3248
3224
|
|
|
3249
3225
|
var MlScaleReference = function (props) {
|
|
3250
|
-
var zoomRef =
|
|
3226
|
+
var zoomRef = useRef(0);
|
|
3251
3227
|
var mapHook = useMap({ mapId: props.mapId, waitForLayer: props.insertBeforeLayer });
|
|
3252
|
-
var _a =
|
|
3253
|
-
var _b =
|
|
3254
|
-
var updateScale =
|
|
3228
|
+
var _a = useState(0), pxWidth = _a[0], setPxWidth = _a[1];
|
|
3229
|
+
var _b = useState(''), text = _b[0], setText = _b[1];
|
|
3230
|
+
var updateScale = useCallback(function () {
|
|
3255
3231
|
var _a, _b;
|
|
3256
3232
|
if (!mapHook.map)
|
|
3257
3233
|
return;
|
|
@@ -3292,7 +3268,7 @@ var MlScaleReference = function (props) {
|
|
|
3292
3268
|
setScale(maxWidth, maxMeters, mapHook.map.map._getUIString('ScaleControl.Meters'));
|
|
3293
3269
|
}
|
|
3294
3270
|
}, [mapHook.map, props.unit, props.maxWidth]);
|
|
3295
|
-
|
|
3271
|
+
useEffect(function () {
|
|
3296
3272
|
if (!mapHook.map)
|
|
3297
3273
|
return;
|
|
3298
3274
|
var _updateScale = updateScale;
|
|
@@ -3319,8 +3295,8 @@ var MlScaleReference = function (props) {
|
|
|
3319
3295
|
d = d >= 10 ? 10 : d >= 5 ? 5 : d >= 3 ? 3 : d >= 2 ? 2 : d >= 1 ? 1 : getDecimalRoundNum(d);
|
|
3320
3296
|
return pow10 * d;
|
|
3321
3297
|
};
|
|
3322
|
-
return (
|
|
3323
|
-
|
|
3298
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
3299
|
+
React__default.createElement("div", { style: {
|
|
3324
3300
|
backgroundColor: 'hsla(0,0%,100%,.75)',
|
|
3325
3301
|
fontSize: '10px',
|
|
3326
3302
|
border: '2px solid #333',
|
|
@@ -3339,17 +3315,17 @@ var MlScaleReference = function (props) {
|
|
|
3339
3315
|
* the map and can be dragged around on top of the MapLibreMap referenced by props.map1Id
|
|
3340
3316
|
*/
|
|
3341
3317
|
var MlLayerMagnify = function (props) {
|
|
3342
|
-
var mapContext =
|
|
3343
|
-
var syncMoveInitializedRef =
|
|
3344
|
-
var syncCleanupFunctionRef =
|
|
3345
|
-
var _a =
|
|
3346
|
-
var swipeXRef =
|
|
3347
|
-
var _b =
|
|
3348
|
-
var swipeYRef =
|
|
3349
|
-
var magnifierRadius =
|
|
3318
|
+
var mapContext = useContext(MapContext);
|
|
3319
|
+
var syncMoveInitializedRef = useRef(false);
|
|
3320
|
+
var syncCleanupFunctionRef = useRef(function () { });
|
|
3321
|
+
var _a = useState(50), swipeX = _a[0], setSwipeX = _a[1];
|
|
3322
|
+
var swipeXRef = useRef(50);
|
|
3323
|
+
var _b = useState(50), swipeY = _b[0], setSwipeY = _b[1];
|
|
3324
|
+
var swipeYRef = useRef(50);
|
|
3325
|
+
var magnifierRadius = useMemo(function () {
|
|
3350
3326
|
return props.magnifierRadius || 200;
|
|
3351
3327
|
}, [props.magnifierRadius]);
|
|
3352
|
-
var mapExists =
|
|
3328
|
+
var mapExists = useCallback(function () {
|
|
3353
3329
|
if (!props.map1Id || !props.map2Id) {
|
|
3354
3330
|
return false;
|
|
3355
3331
|
}
|
|
@@ -3358,7 +3334,7 @@ var MlLayerMagnify = function (props) {
|
|
|
3358
3334
|
}
|
|
3359
3335
|
return true;
|
|
3360
3336
|
}, [props, mapContext]);
|
|
3361
|
-
var onResize =
|
|
3337
|
+
var onResize = useRef(function () {
|
|
3362
3338
|
if (!mapExists())
|
|
3363
3339
|
return;
|
|
3364
3340
|
onMove({
|
|
@@ -3366,7 +3342,7 @@ var MlLayerMagnify = function (props) {
|
|
|
3366
3342
|
clientY: swipeYRef.current,
|
|
3367
3343
|
});
|
|
3368
3344
|
});
|
|
3369
|
-
|
|
3345
|
+
useEffect(function () {
|
|
3370
3346
|
window.addEventListener('resize', onResize.current);
|
|
3371
3347
|
var _onResize = onResize.current;
|
|
3372
3348
|
return function () {
|
|
@@ -3374,7 +3350,7 @@ var MlLayerMagnify = function (props) {
|
|
|
3374
3350
|
syncCleanupFunctionRef.current();
|
|
3375
3351
|
};
|
|
3376
3352
|
}, []);
|
|
3377
|
-
var onMove =
|
|
3353
|
+
var onMove = useCallback(function (e) {
|
|
3378
3354
|
if (!mapExists())
|
|
3379
3355
|
return;
|
|
3380
3356
|
var bounds = mapContext.maps[props.map1Id].getCanvas().getBoundingClientRect();
|
|
@@ -3403,7 +3379,7 @@ var MlLayerMagnify = function (props) {
|
|
|
3403
3379
|
'px)';
|
|
3404
3380
|
}
|
|
3405
3381
|
}, [mapContext, mapExists, props, magnifierRadius]);
|
|
3406
|
-
|
|
3382
|
+
useEffect(function () {
|
|
3407
3383
|
if (!mapExists() || syncMoveInitializedRef.current)
|
|
3408
3384
|
return;
|
|
3409
3385
|
syncMoveInitializedRef.current = true;
|
|
@@ -3466,7 +3442,7 @@ var MlLayerMagnify = function (props) {
|
|
|
3466
3442
|
var evCopy = new WheelEvent(e.type, e);
|
|
3467
3443
|
(_a = mapContext.map) === null || _a === void 0 ? void 0 : _a.map.getCanvas().dispatchEvent(evCopy);
|
|
3468
3444
|
};
|
|
3469
|
-
return (
|
|
3445
|
+
return (React__default.createElement("div", { style: __assign({ position: 'absolute', left: swipeX + '%', top: swipeY + '%', borderRadius: '50%', width: magnifierRadius * 2 - 2 + 'px', height: magnifierRadius * 2 - 2 + 'px', background: 'rgba(0,0,0,0)', border: '2px solid #fafafa', boxShadow: '1px 2px 2px rgba(19, 19, 19, .5), inset 1px 1px 1px rgba(19, 19, 19, .2)', cursor: 'pointer', zIndex: '110', marginLeft: magnifierRadius * -1 - 1 + 'px', marginTop: magnifierRadius * -1 - 1 + 'px', textAlign: 'center', lineHeight: '91px', fontSize: '2em', color: '#fafafa', userSelect: 'none' }, props.magnifierStyle), onTouchStart: onDown, onMouseDown: onDown, onWheel: onWheel }));
|
|
3470
3446
|
};
|
|
3471
3447
|
MlLayerMagnify.defaultProps = {
|
|
3472
3448
|
magnifierRadius: 200,
|
|
@@ -3476,14 +3452,14 @@ MlLayerMagnify.defaultProps = {
|
|
|
3476
3452
|
var _path, _path2;
|
|
3477
3453
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3478
3454
|
var SvgIcononlyarrow = function SvgIcononlyarrow(props) {
|
|
3479
|
-
return /*#__PURE__*/
|
|
3455
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
3480
3456
|
viewBox: "0 0 47 30",
|
|
3481
3457
|
fill: "none",
|
|
3482
3458
|
xmlns: "http://www.w3.org/2000/svg"
|
|
3483
|
-
}, props), _path || (_path = /*#__PURE__*/
|
|
3459
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
3484
3460
|
d: "M29.5 21.25L35.75 15L29.5 8.75V21.25Z",
|
|
3485
3461
|
fill: "#009EE0"
|
|
3486
|
-
})), _path2 || (_path2 = /*#__PURE__*/
|
|
3462
|
+
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
|
|
3487
3463
|
d: "M17.5 8.75L11.25 15L17.5 21.25V8.75Z",
|
|
3488
3464
|
fill: "#009EE0"
|
|
3489
3465
|
})));
|
|
@@ -3493,12 +3469,12 @@ var SvgIcononlyarrow = function SvgIcononlyarrow(props) {
|
|
|
3493
3469
|
* creates a split view of 2 synchronised maplibre instances
|
|
3494
3470
|
*/
|
|
3495
3471
|
var MlLayerSwipe = function (props) {
|
|
3496
|
-
var mapContext =
|
|
3497
|
-
var initializedRef =
|
|
3498
|
-
var _a =
|
|
3499
|
-
var swipeXRef =
|
|
3500
|
-
var syncCleanupFunctionRef =
|
|
3501
|
-
var mapExists =
|
|
3472
|
+
var mapContext = useContext(MapContext);
|
|
3473
|
+
var initializedRef = useRef(false);
|
|
3474
|
+
var _a = useState(50), swipeX = _a[0], setSwipeX = _a[1];
|
|
3475
|
+
var swipeXRef = useRef(0);
|
|
3476
|
+
var syncCleanupFunctionRef = useRef(function () { });
|
|
3477
|
+
var mapExists = useCallback(function () {
|
|
3502
3478
|
if (!props.map1Id || !props.map2Id) {
|
|
3503
3479
|
return false;
|
|
3504
3480
|
}
|
|
@@ -3510,7 +3486,7 @@ var MlLayerSwipe = function (props) {
|
|
|
3510
3486
|
var cleanup = function () {
|
|
3511
3487
|
syncCleanupFunctionRef.current();
|
|
3512
3488
|
};
|
|
3513
|
-
var onMove =
|
|
3489
|
+
var onMove = useCallback(function (e) {
|
|
3514
3490
|
if (!mapExists())
|
|
3515
3491
|
return;
|
|
3516
3492
|
var bounds = mapContext.maps[props.map1Id].getCanvas().getBoundingClientRect();
|
|
@@ -3527,10 +3503,10 @@ var MlLayerSwipe = function (props) {
|
|
|
3527
3503
|
mapContext.maps[props.map2Id].getContainer().style.clip = clipA;
|
|
3528
3504
|
}
|
|
3529
3505
|
}, [mapContext, mapExists, props.map1Id, props.map2Id]);
|
|
3530
|
-
|
|
3506
|
+
useEffect(function () {
|
|
3531
3507
|
return cleanup;
|
|
3532
3508
|
}, []);
|
|
3533
|
-
|
|
3509
|
+
useEffect(function () {
|
|
3534
3510
|
if (!mapExists() || initializedRef.current)
|
|
3535
3511
|
return;
|
|
3536
3512
|
initializedRef.current = true;
|
|
@@ -3573,14 +3549,14 @@ var MlLayerSwipe = function (props) {
|
|
|
3573
3549
|
setSwipeX(50);
|
|
3574
3550
|
}
|
|
3575
3551
|
}
|
|
3576
|
-
|
|
3552
|
+
useEffect(function () {
|
|
3577
3553
|
window.addEventListener('resize', adjustWindowSize);
|
|
3578
3554
|
return function () {
|
|
3579
3555
|
window.removeEventListener('resize', adjustWindowSize);
|
|
3580
3556
|
};
|
|
3581
3557
|
}, [mapContext]);
|
|
3582
|
-
return (
|
|
3583
|
-
|
|
3558
|
+
return (React__default.createElement("div", { style: __assign({ position: 'absolute', left: swipeX + '%', top: '50%', borderRadius: '50%', width: '65px', height: '65px', background: 'rgba(234, 235, 241, 0.75)', border: '2px solid rgba(0, 158, 224, 0.75)', cursor: 'pointer', zIndex: '110', marginLeft: '-35px', marginTop: '-50px', textAlign: 'center', lineHeight: '91px', fontSize: '2em', color: '#fafafa', userSelect: 'none' }, props.buttonStyle), onTouchStart: onDown, onMouseDown: onDown },
|
|
3559
|
+
React__default.createElement(SvgIcononlyarrow, { color: "#0066ff", style: {
|
|
3584
3560
|
width: '65px',
|
|
3585
3561
|
height: '65px',
|
|
3586
3562
|
justifyContent: 'center',
|
|
@@ -3631,7 +3607,7 @@ var _showNextTransitionSegment = function _showNextTransitionSegment(props, map,
|
|
|
3631
3607
|
if (typeof transitionGeojsonDataRef.current[currentTransitionStepRef.current] !== "undefined") {
|
|
3632
3608
|
// if at last transition step set to target geojson
|
|
3633
3609
|
// else to an assembled LineString from common geometry and the current transition step geometry
|
|
3634
|
-
var newData = currentTransitionStepRef.current + 1 === transitionGeojsonDataRef.current.length ? props.geojson :
|
|
3610
|
+
var newData = currentTransitionStepRef.current + 1 === transitionGeojsonDataRef.current.length ? props.geojson : turf.lineString([].concat(_toConsumableArray(transitionGeojsonCommonDataRef.current), _toConsumableArray(transitionGeojsonDataRef.current[currentTransitionStepRef.current].geometry.coordinates)));
|
|
3635
3611
|
setDisplayGeojson(newData);
|
|
3636
3612
|
if (typeof props.onTransitionFrame === "function") {
|
|
3637
3613
|
props.onTransitionFrame(newData);
|
|
@@ -3672,9 +3648,9 @@ var _transitionToGeojson = function _transitionToGeojson(props, transitionGeojso
|
|
|
3672
3648
|
var reverseOrder = false;
|
|
3673
3649
|
// In case one geojson is missing completely use the first two coordinates of the other geojson
|
|
3674
3650
|
if (typeof longerGeojson.geometry === "undefined" && typeof shorterGeojson.geometry !== "undefined" && shorterGeojson.geometry.coordinates.length > 1) {
|
|
3675
|
-
longerGeojson =
|
|
3651
|
+
longerGeojson = turf.lineString(shorterGeojson.geometry.coordinates.slice(0, 2));
|
|
3676
3652
|
} else if (typeof shorterGeojson.geometry === "undefined" && typeof longerGeojson.geometry !== "undefined" && longerGeojson.geometry.coordinates.length > 1) {
|
|
3677
|
-
shorterGeojson =
|
|
3653
|
+
shorterGeojson = turf.lineString(longerGeojson.geometry.coordinates.slice(0, 2));
|
|
3678
3654
|
} else if (typeof shorterGeojson.geometry === "undefined" && typeof longerGeojson.geometry === "undefined") {
|
|
3679
3655
|
return;
|
|
3680
3656
|
}
|
|
@@ -3709,8 +3685,8 @@ var _transitionToGeojson = function _transitionToGeojson(props, transitionGeojso
|
|
|
3709
3685
|
// create props.transitionTime / msPerStep (=: transitionSteps) Versions of transitionGeojsonCommonDataRef.current + transitionCoordinates making the transitionCoordinates transitionCoordinatesDistance / transitionSteps longer on each step
|
|
3710
3686
|
|
|
3711
3687
|
var transitionSteps = props.transitionTime / msPerStep;
|
|
3712
|
-
var srcCoordinatesDistance = srcCoordinates.length > 1 ? Math.round(
|
|
3713
|
-
var targetCoordinatesDistance = targetCoordinates.length > 1 ? Math.round(
|
|
3688
|
+
var srcCoordinatesDistance = srcCoordinates.length > 1 ? Math.round(turf.length(turf.lineString(srcCoordinates))) : 0;
|
|
3689
|
+
var targetCoordinatesDistance = targetCoordinates.length > 1 ? Math.round(turf.length(turf.lineString(targetCoordinates))) : 0;
|
|
3714
3690
|
var transitionDistance = targetCoordinatesDistance + srcCoordinatesDistance;
|
|
3715
3691
|
var srcCoordinatesShare = srcCoordinatesDistance / transitionDistance;
|
|
3716
3692
|
var srcTransitionSteps = Math.round(transitionSteps * srcCoordinatesShare);
|
|
@@ -3735,13 +3711,13 @@ var _transitionToGeojson = function _transitionToGeojson(props, transitionGeojso
|
|
|
3735
3711
|
var createTransitionSteps = function createTransitionSteps(linestringCoordinates, perStepDistance, stepCnt) {
|
|
3736
3712
|
var transitionSteps = [];
|
|
3737
3713
|
if (linestringCoordinates.length > 1) {
|
|
3738
|
-
var tmpChunks =
|
|
3714
|
+
var tmpChunks = turf.lineChunk(turf.lineString(linestringCoordinates), perStepDistance);
|
|
3739
3715
|
// tmpLineString contains all coordinates of all previous plus current loop iteration
|
|
3740
3716
|
var tmpLinestring = tmpChunks.features[0];
|
|
3741
3717
|
for (var i = 0; i < stepCnt; i++) {
|
|
3742
3718
|
transitionSteps.push(tmpLinestring);
|
|
3743
3719
|
if (typeof tmpChunks.features[i] !== "undefined") {
|
|
3744
|
-
tmpLinestring =
|
|
3720
|
+
tmpLinestring = turf.lineString([].concat(_toConsumableArray(tmpLinestring.geometry.coordinates), _toConsumableArray(tmpChunks.features[i].geometry.coordinates)));
|
|
3745
3721
|
} else {
|
|
3746
3722
|
break;
|
|
3747
3723
|
}
|
|
@@ -3762,16 +3738,16 @@ var MlTransitionGeoJsonLayer = function (props) {
|
|
|
3762
3738
|
mapId: props.mapId,
|
|
3763
3739
|
waitForLayer: props.insertBeforeLayer,
|
|
3764
3740
|
});
|
|
3765
|
-
var initializedRef =
|
|
3741
|
+
var initializedRef = useRef(false);
|
|
3766
3742
|
// transition effect variables
|
|
3767
|
-
var oldGeojsonRef =
|
|
3768
|
-
var transitionInProgressRef =
|
|
3769
|
-
var transitionTimeoutRef =
|
|
3770
|
-
var currentTransitionStepRef =
|
|
3771
|
-
var transitionGeojsonDataRef =
|
|
3772
|
-
var transitionGeojsonCommonDataRef =
|
|
3773
|
-
var _a =
|
|
3774
|
-
|
|
3743
|
+
var oldGeojsonRef = useRef();
|
|
3744
|
+
var transitionInProgressRef = useRef(false);
|
|
3745
|
+
var transitionTimeoutRef = useRef(undefined);
|
|
3746
|
+
var currentTransitionStepRef = useRef(false);
|
|
3747
|
+
var transitionGeojsonDataRef = useRef([]);
|
|
3748
|
+
var transitionGeojsonCommonDataRef = useRef([]);
|
|
3749
|
+
var _a = useState(turf.featureCollection([])), displayGeojson = _a[0], setDisplayGeojson = _a[1];
|
|
3750
|
+
useEffect(function () {
|
|
3775
3751
|
return function () {
|
|
3776
3752
|
// This is the cleanup function, it is called when this react component is removed from react-dom
|
|
3777
3753
|
if (transitionTimeoutRef.current) {
|
|
@@ -3779,10 +3755,10 @@ var MlTransitionGeoJsonLayer = function (props) {
|
|
|
3779
3755
|
}
|
|
3780
3756
|
};
|
|
3781
3757
|
}, []);
|
|
3782
|
-
var transitionToGeojson =
|
|
3758
|
+
var transitionToGeojson = useCallback(function () {
|
|
3783
3759
|
_transitionToGeojson(props, transitionGeojsonCommonDataRef, transitionGeojsonDataRef, transitionInProgressRef, oldGeojsonRef, msPerStep, currentTransitionStepRef, mapHook.map, transitionTimeoutRef, setDisplayGeojson);
|
|
3784
3760
|
}, [props, mapHook.map]);
|
|
3785
|
-
|
|
3761
|
+
useEffect(function () {
|
|
3786
3762
|
if (!mapHook.map || !initializedRef.current)
|
|
3787
3763
|
return;
|
|
3788
3764
|
if (typeof props.transitionTime !== 'undefined' &&
|
|
@@ -3796,7 +3772,7 @@ var MlTransitionGeoJsonLayer = function (props) {
|
|
|
3796
3772
|
}
|
|
3797
3773
|
oldGeojsonRef.current = props.geojson;
|
|
3798
3774
|
}, [mapHook.map, transitionToGeojson, props]);
|
|
3799
|
-
var startTransition =
|
|
3775
|
+
var startTransition = useCallback(function () {
|
|
3800
3776
|
if (props.type === 'line' &&
|
|
3801
3777
|
typeof props.transitionTime !== 'undefined' &&
|
|
3802
3778
|
props.transitionTime &&
|
|
@@ -3806,14 +3782,14 @@ var MlTransitionGeoJsonLayer = function (props) {
|
|
|
3806
3782
|
oldGeojsonRef.current = props.geojson;
|
|
3807
3783
|
}
|
|
3808
3784
|
}, [props, transitionToGeojson]);
|
|
3809
|
-
|
|
3785
|
+
useEffect(function () {
|
|
3810
3786
|
if (!mapHook.mapIsReady || !props.geojson)
|
|
3811
3787
|
return;
|
|
3812
3788
|
initializedRef.current = true;
|
|
3813
3789
|
startTransition();
|
|
3814
3790
|
}, [mapHook.mapIsReady, startTransition, props]);
|
|
3815
|
-
return (
|
|
3816
|
-
|
|
3791
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
3792
|
+
React__default.createElement(MlGeoJsonLayer, __assign({}, restProps, { geojson: displayGeojson }))));
|
|
3817
3793
|
};
|
|
3818
3794
|
|
|
3819
3795
|
/**
|
|
@@ -3828,20 +3804,20 @@ var MlMarker = function (props) {
|
|
|
3828
3804
|
mapId: props.mapId,
|
|
3829
3805
|
watch: { viewport: true },
|
|
3830
3806
|
});
|
|
3831
|
-
var iframe =
|
|
3832
|
-
var _a =
|
|
3807
|
+
var iframe = useRef(null);
|
|
3808
|
+
var _a = useState({
|
|
3833
3809
|
width: "400px",
|
|
3834
3810
|
height: "500px",
|
|
3835
3811
|
}), iframeDimensions = _a[0], setIframeDimensions = _a[1];
|
|
3836
|
-
var _b =
|
|
3837
|
-
|
|
3812
|
+
var _b = useState(), markerPixelPos = _b[0], setMarkerPixelPos = _b[1];
|
|
3813
|
+
useEffect(function () {
|
|
3838
3814
|
var _a, _b;
|
|
3839
3815
|
if (!((_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.project))
|
|
3840
3816
|
return;
|
|
3841
3817
|
var _pixelPos = mapHook.map.map.project([props.lng, props.lat]);
|
|
3842
3818
|
setMarkerPixelPos(_pixelPos);
|
|
3843
3819
|
}, [mapHook.map, props.lng, props.lat, mapState.viewport]);
|
|
3844
|
-
|
|
3820
|
+
useEffect(function () {
|
|
3845
3821
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
3846
3822
|
if (!mapHook.map ||
|
|
3847
3823
|
!((_d = (_c = (_b = (_a = iframe.current) === null || _a === void 0 ? void 0 : _a.contentWindow) === null || _b === void 0 ? void 0 : _b.document) === null || _c === void 0 ? void 0 : _c.body) === null || _d === void 0 ? void 0 : _d.scrollHeight))
|
|
@@ -3856,8 +3832,8 @@ var MlMarker = function (props) {
|
|
|
3856
3832
|
height: (pixelToBottom < iframeHeight ? pixelToBottom : iframeHeight) + "px",
|
|
3857
3833
|
});
|
|
3858
3834
|
}, [props.lng, props.lat, props.content]);
|
|
3859
|
-
return (
|
|
3860
|
-
|
|
3835
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
3836
|
+
React__default.createElement(MlGeoJsonLayer, { geojson: {
|
|
3861
3837
|
type: "Feature",
|
|
3862
3838
|
geometry: {
|
|
3863
3839
|
type: "Point",
|
|
@@ -3868,7 +3844,7 @@ var MlMarker = function (props) {
|
|
|
3868
3844
|
"circle-radius": 14,
|
|
3869
3845
|
"circle-color": "rgba(40,200,20,0.5)",
|
|
3870
3846
|
}, type: "circle", mapId: props.mapId }),
|
|
3871
|
-
markerPixelPos && (
|
|
3847
|
+
markerPixelPos && (React__default.createElement(Paper, { sx: {
|
|
3872
3848
|
opacity: 0.7,
|
|
3873
3849
|
position: "fixed",
|
|
3874
3850
|
display: "flex",
|
|
@@ -3882,7 +3858,7 @@ var MlMarker = function (props) {
|
|
|
3882
3858
|
},
|
|
3883
3859
|
zIndex: -1,
|
|
3884
3860
|
} },
|
|
3885
|
-
|
|
3861
|
+
React__default.createElement("iframe", { style: { width: "100%" }, srcDoc: props.content, ref: iframe, sandbox: "allow-same-origin allow-popups-to-escape-sandbox", frameBorder: "0", title: mapHook.componentId })))));
|
|
3886
3862
|
};
|
|
3887
3863
|
MlMarker.defaultProps = {
|
|
3888
3864
|
mapId: undefined,
|
|
@@ -4012,7 +3988,7 @@ var toGeoJSON = function () {
|
|
|
4012
3988
|
var isNodeEnv = (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && !process.browser;
|
|
4013
3989
|
var isTitaniumEnv = (typeof Titanium === "undefined" ? "undefined" : _typeof(Titanium)) === 'object';
|
|
4014
3990
|
if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && (isNodeEnv || isTitaniumEnv)) {
|
|
4015
|
-
serializer =
|
|
3991
|
+
serializer = xmldom.XMLSerializer;
|
|
4016
3992
|
} else {
|
|
4017
3993
|
throw new Error('Unable to initialize serializer');
|
|
4018
3994
|
}
|
|
@@ -4403,8 +4379,8 @@ var toGeoJSON = function () {
|
|
|
4403
4379
|
*
|
|
4404
4380
|
*/
|
|
4405
4381
|
var useGpx = function (props) {
|
|
4406
|
-
var _a =
|
|
4407
|
-
var _b =
|
|
4382
|
+
var _a = useState(), geojson = _a[0], setGeojson = _a[1];
|
|
4383
|
+
var _b = useState([]), metadata = _b[0], setMetadata = _b[1];
|
|
4408
4384
|
var parseGpx = function (gpxAsString) {
|
|
4409
4385
|
try {
|
|
4410
4386
|
setMetadata([]);
|
|
@@ -4433,7 +4409,7 @@ var useGpx = function (props) {
|
|
|
4433
4409
|
console.log(e);
|
|
4434
4410
|
}
|
|
4435
4411
|
};
|
|
4436
|
-
|
|
4412
|
+
useEffect(function () {
|
|
4437
4413
|
if (!props.data)
|
|
4438
4414
|
return;
|
|
4439
4415
|
parseGpx(props.data);
|
|
@@ -4456,11 +4432,11 @@ var LayerHoverPopup = function (props) {
|
|
|
4456
4432
|
mapId: props.mapId,
|
|
4457
4433
|
waitForLayer: props.layerId,
|
|
4458
4434
|
});
|
|
4459
|
-
var popup =
|
|
4435
|
+
var popup = useRef(new Popup({
|
|
4460
4436
|
closeButton: false,
|
|
4461
4437
|
closeOnClick: true,
|
|
4462
4438
|
}));
|
|
4463
|
-
|
|
4439
|
+
useEffect(function () {
|
|
4464
4440
|
if (!mapHook.map || !props.layerId)
|
|
4465
4441
|
return;
|
|
4466
4442
|
mapHook.map.on('mouseenter', props.layerId, function (e) {
|
|
@@ -4487,7 +4463,7 @@ var LayerHoverPopup = function (props) {
|
|
|
4487
4463
|
}
|
|
4488
4464
|
}, mapHook.componentId);
|
|
4489
4465
|
}, [mapHook.map]);
|
|
4490
|
-
return
|
|
4466
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
4491
4467
|
};
|
|
4492
4468
|
LayerHoverPopup.defaultProps = {
|
|
4493
4469
|
mapId: undefined,
|
|
@@ -4499,9 +4475,9 @@ LayerHoverPopup.defaultProps = {
|
|
|
4499
4475
|
var MlGpxViewer = function (props) {
|
|
4500
4476
|
var parsedGpx = useGpx({ data: props.gpxData });
|
|
4501
4477
|
var mapHook = useMap({ mapId: props.mapId, waitForLayer: props.insertBeforeLayer });
|
|
4502
|
-
var sourceName =
|
|
4503
|
-
var layerNameLines =
|
|
4504
|
-
var layerNamePoints =
|
|
4478
|
+
var sourceName = useRef('gpx-viewer-source-' + v4());
|
|
4479
|
+
var layerNameLines = useRef('importer-layer-lines-' + v4());
|
|
4480
|
+
var layerNamePoints = useRef('importer-layer-points-' + v4());
|
|
4505
4481
|
LayerHoverPopup({
|
|
4506
4482
|
layerId: layerNamePoints.current,
|
|
4507
4483
|
getPopupContent: function (feature) { var _a; return (_a = feature === null || feature === void 0 ? void 0 : feature.properties) === null || _a === void 0 ? void 0 : _a.name; },
|
|
@@ -4511,7 +4487,7 @@ var MlGpxViewer = function (props) {
|
|
|
4511
4487
|
sourceId: sourceName.current,
|
|
4512
4488
|
source: {
|
|
4513
4489
|
type: 'geojson',
|
|
4514
|
-
data: (parsedGpx.geojson ||
|
|
4490
|
+
data: (parsedGpx.geojson || featureCollection([])),
|
|
4515
4491
|
},
|
|
4516
4492
|
});
|
|
4517
4493
|
useLayer({
|
|
@@ -4539,26 +4515,26 @@ var MlGpxViewer = function (props) {
|
|
|
4539
4515
|
},
|
|
4540
4516
|
insertBeforeLayer: props.insertBeforeLayer,
|
|
4541
4517
|
});
|
|
4542
|
-
|
|
4518
|
+
useEffect(function () {
|
|
4543
4519
|
if (!mapHook.map || !parsedGpx.geojson)
|
|
4544
4520
|
return;
|
|
4545
4521
|
if (typeof props.onParseGpxData === 'function') {
|
|
4546
4522
|
props.onParseGpxData(parsedGpx);
|
|
4547
4523
|
}
|
|
4548
4524
|
// fit map view to GeoJSON bbox
|
|
4549
|
-
var bounds =
|
|
4525
|
+
var bounds = bbox(parsedGpx.geojson);
|
|
4550
4526
|
mapHook.map.map.fitBounds(bounds);
|
|
4551
4527
|
}, [parsedGpx]);
|
|
4552
|
-
return
|
|
4528
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
4553
4529
|
};
|
|
4554
4530
|
MlGpxViewer.defaultProps = {};
|
|
4555
4531
|
|
|
4556
|
-
var GeoJsonContext =
|
|
4532
|
+
var GeoJsonContext = React__default.createContext({});
|
|
4557
4533
|
var GeoJsonContextProvider = GeoJsonContext.Provider;
|
|
4558
4534
|
|
|
4559
4535
|
var GeoJsonProvider = function (_a) {
|
|
4560
4536
|
var children = _a.children;
|
|
4561
|
-
var _b =
|
|
4537
|
+
var _b = useState({
|
|
4562
4538
|
type: "FeatureCollection",
|
|
4563
4539
|
features: [],
|
|
4564
4540
|
}), data = _b[0], setData = _b[1];
|
|
@@ -4573,7 +4549,7 @@ var GeoJsonProvider = function (_a) {
|
|
|
4573
4549
|
setData: setData,
|
|
4574
4550
|
getEmptyFeatureCollection: getEmptyFeatureCollection,
|
|
4575
4551
|
};
|
|
4576
|
-
return
|
|
4552
|
+
return React__default.createElement(GeoJsonContextProvider, { value: value }, children);
|
|
4577
4553
|
};
|
|
4578
4554
|
|
|
4579
4555
|
var getCurrentUrlParameters = function () {
|
|
@@ -4584,12 +4560,12 @@ var getCurrentUrlParameters = function () {
|
|
|
4584
4560
|
var initialUrlParams = getCurrentUrlParameters();
|
|
4585
4561
|
var MlShareMapState = function (props) {
|
|
4586
4562
|
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
4587
|
-
var mapContext =
|
|
4588
|
-
var initializedRef =
|
|
4589
|
-
var mapRef =
|
|
4590
|
-
var _a =
|
|
4591
|
-
var layersFromUrlParamsRef =
|
|
4592
|
-
var componentId =
|
|
4563
|
+
var mapContext = useContext(MapContext);
|
|
4564
|
+
var initializedRef = useRef(false);
|
|
4565
|
+
var mapRef = useRef();
|
|
4566
|
+
var _a = useState(undefined), map = _a[0], setMap = _a[1];
|
|
4567
|
+
var layersFromUrlParamsRef = useRef({});
|
|
4568
|
+
var componentId = useRef((props.idPrefix ? props.idPrefix : 'MlShareMapState-') + v4());
|
|
4593
4569
|
var mapState = useMapState({
|
|
4594
4570
|
watch: {
|
|
4595
4571
|
viewport: false,
|
|
@@ -4600,9 +4576,9 @@ var MlShareMapState = function (props) {
|
|
|
4600
4576
|
includeBaseLayers: false,
|
|
4601
4577
|
},
|
|
4602
4578
|
});
|
|
4603
|
-
var allStatesRestoredRef =
|
|
4604
|
-
var layerStatesRestored =
|
|
4605
|
-
var restoredStatesRef =
|
|
4579
|
+
var allStatesRestoredRef = useRef(false);
|
|
4580
|
+
var layerStatesRestored = useRef();
|
|
4581
|
+
var restoredStatesRef = useRef({
|
|
4606
4582
|
viewport: {
|
|
4607
4583
|
center: false,
|
|
4608
4584
|
bearing: false,
|
|
@@ -4612,8 +4588,8 @@ var MlShareMapState = function (props) {
|
|
|
4612
4588
|
layers: __assign({}, layersFromUrlParamsRef),
|
|
4613
4589
|
});
|
|
4614
4590
|
// initial URL-Params
|
|
4615
|
-
var mapStateRef =
|
|
4616
|
-
var refreshUrlParameters =
|
|
4591
|
+
var mapStateRef = useRef({});
|
|
4592
|
+
var refreshUrlParameters = useCallback(function () {
|
|
4617
4593
|
var _a, _b, _c;
|
|
4618
4594
|
if (!props.active)
|
|
4619
4595
|
return;
|
|
@@ -4636,7 +4612,7 @@ var MlShareMapState = function (props) {
|
|
|
4636
4612
|
window.history.pushState(__assign({}, mapStateRef.current), document.title, '?' + urlParams.toString());
|
|
4637
4613
|
}
|
|
4638
4614
|
}, [mapState.layers, props.active]);
|
|
4639
|
-
|
|
4615
|
+
useEffect(function () {
|
|
4640
4616
|
var _componentId = componentId.current;
|
|
4641
4617
|
mapStateRef.current = getCurrentUrlParameters();
|
|
4642
4618
|
return function () {
|
|
@@ -4652,12 +4628,12 @@ var MlShareMapState = function (props) {
|
|
|
4652
4628
|
initializedRef.current = false;
|
|
4653
4629
|
};
|
|
4654
4630
|
}, []);
|
|
4655
|
-
|
|
4631
|
+
useEffect(function () {
|
|
4656
4632
|
if (!mapRef.current)
|
|
4657
4633
|
return;
|
|
4658
4634
|
refreshUrlParameters();
|
|
4659
4635
|
}, [refreshUrlParameters]);
|
|
4660
|
-
|
|
4636
|
+
useEffect(function () {
|
|
4661
4637
|
if (!mapRef.current)
|
|
4662
4638
|
return;
|
|
4663
4639
|
var _refreshUrlParameters = refreshUrlParameters;
|
|
@@ -4667,7 +4643,7 @@ var MlShareMapState = function (props) {
|
|
|
4667
4643
|
(_a = mapRef.current) === null || _a === void 0 ? void 0 : _a.map.off('moveend', _refreshUrlParameters);
|
|
4668
4644
|
};
|
|
4669
4645
|
}, [refreshUrlParameters, map]);
|
|
4670
|
-
|
|
4646
|
+
useEffect(function () {
|
|
4671
4647
|
var _a;
|
|
4672
4648
|
if (!((_a = mapContext === null || mapContext === void 0 ? void 0 : mapContext.mapExists) === null || _a === void 0 ? void 0 : _a.call(mapContext, props.mapId)) || initializedRef.current)
|
|
4673
4649
|
return;
|
|
@@ -4680,7 +4656,7 @@ var MlShareMapState = function (props) {
|
|
|
4680
4656
|
restoreViewportState();
|
|
4681
4657
|
}
|
|
4682
4658
|
}, [mapContext.mapIds, mapContext, props.mapId, props.active]);
|
|
4683
|
-
|
|
4659
|
+
useEffect(function () {
|
|
4684
4660
|
var _a, _b;
|
|
4685
4661
|
if (!((_a = mapState === null || mapState === void 0 ? void 0 : mapState.layers) === null || _a === void 0 ? void 0 : _a.length))
|
|
4686
4662
|
return;
|
|
@@ -4713,7 +4689,7 @@ var MlShareMapState = function (props) {
|
|
|
4713
4689
|
});
|
|
4714
4690
|
}
|
|
4715
4691
|
}, [mapState.layers, props.mapId, props.active]);
|
|
4716
|
-
|
|
4692
|
+
useEffect(function () {
|
|
4717
4693
|
if (!map)
|
|
4718
4694
|
return;
|
|
4719
4695
|
if (!mapState.layers)
|
|
@@ -4760,7 +4736,7 @@ var MlShareMapState = function (props) {
|
|
|
4760
4736
|
});
|
|
4761
4737
|
}
|
|
4762
4738
|
};
|
|
4763
|
-
return
|
|
4739
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
4764
4740
|
};
|
|
4765
4741
|
MlShareMapState.defaultProps = {
|
|
4766
4742
|
mapId: undefined,
|
|
@@ -4775,16 +4751,16 @@ MlShareMapState.propTypes = {
|
|
|
4775
4751
|
function getElevationData(_geojsonInfo, elevationFactor) {
|
|
4776
4752
|
var createStep = function (x, y, z, x2, y2) {
|
|
4777
4753
|
//const summand = 0.0002;
|
|
4778
|
-
var line =
|
|
4754
|
+
var line = lineString([
|
|
4779
4755
|
[x, y],
|
|
4780
4756
|
[x2, y2],
|
|
4781
4757
|
]);
|
|
4782
|
-
var offsetLine =
|
|
4758
|
+
var offsetLine = lineOffset(line, 5, { units: 'meters' });
|
|
4783
4759
|
var x3 = offsetLine.geometry.coordinates[0][0];
|
|
4784
4760
|
var y3 = offsetLine.geometry.coordinates[0][1];
|
|
4785
4761
|
var x4 = offsetLine.geometry.coordinates[1][0];
|
|
4786
4762
|
var y4 = offsetLine.geometry.coordinates[1][1];
|
|
4787
|
-
return
|
|
4763
|
+
return polygon([
|
|
4788
4764
|
[
|
|
4789
4765
|
[x, y],
|
|
4790
4766
|
[x2, y2],
|
|
@@ -4800,7 +4776,7 @@ function getElevationData(_geojsonInfo, elevationFactor) {
|
|
|
4800
4776
|
//const point = createPoint(coordinate[0],coordinate[1],coordinate[2]-min);
|
|
4801
4777
|
//points.push(point);
|
|
4802
4778
|
if (_geojsonInfo.line.geometry.coordinates[index + 1]) {
|
|
4803
|
-
var wayLength =
|
|
4779
|
+
var wayLength = distance([coordinate[0], coordinate[1]], [
|
|
4804
4780
|
_geojsonInfo.line.geometry.coordinates[index + 1][0],
|
|
4805
4781
|
_geojsonInfo.line.geometry.coordinates[index + 1][1],
|
|
4806
4782
|
], { units: 'kilometers' });
|
|
@@ -4817,7 +4793,7 @@ function getElevationData(_geojsonInfo, elevationFactor) {
|
|
|
4817
4793
|
}
|
|
4818
4794
|
}
|
|
4819
4795
|
});
|
|
4820
|
-
var output =
|
|
4796
|
+
var output = featureCollection$1(points);
|
|
4821
4797
|
return output;
|
|
4822
4798
|
}
|
|
4823
4799
|
|
|
@@ -4839,10 +4815,10 @@ var defaultFillExtrusionColor = [
|
|
|
4839
4815
|
'yellow',
|
|
4840
4816
|
];
|
|
4841
4817
|
var MlSpatialElevationProfile = function (props) {
|
|
4842
|
-
var sourceName =
|
|
4843
|
-
var layerName =
|
|
4818
|
+
var sourceName = useRef('elevationprofile-' + v4());
|
|
4819
|
+
var layerName = useRef('elevationprofile-layer-' + v4());
|
|
4844
4820
|
var elevationFactor = props.elevationFactor || MlSpatialElevationProfile.defaultProps.elevationFactor;
|
|
4845
|
-
var _geojsonInfo =
|
|
4821
|
+
var _geojsonInfo = useMemo(function () {
|
|
4846
4822
|
var _a, _b;
|
|
4847
4823
|
if (!((_a = props === null || props === void 0 ? void 0 : props.geojson) === null || _a === void 0 ? void 0 : _a.features))
|
|
4848
4824
|
return;
|
|
@@ -4861,7 +4837,7 @@ var MlSpatialElevationProfile = function (props) {
|
|
|
4861
4837
|
max = max === 0 ? 1 : max;
|
|
4862
4838
|
return { max: max, min: min, line: line };
|
|
4863
4839
|
}, [props.geojson]);
|
|
4864
|
-
var _fillExtrusionColor =
|
|
4840
|
+
var _fillExtrusionColor = useMemo(function () {
|
|
4865
4841
|
if (!_geojsonInfo)
|
|
4866
4842
|
return defaultFillExtrusionColor;
|
|
4867
4843
|
return [
|
|
@@ -4874,7 +4850,7 @@ var MlSpatialElevationProfile = function (props) {
|
|
|
4874
4850
|
'rgb(255,0,0)',
|
|
4875
4851
|
];
|
|
4876
4852
|
}, [_geojsonInfo, props.elevationFactor]);
|
|
4877
|
-
var _geojson =
|
|
4853
|
+
var _geojson = useMemo(function () {
|
|
4878
4854
|
var _a;
|
|
4879
4855
|
if (!((_a = props.geojson) === null || _a === void 0 ? void 0 : _a.features) || !_geojsonInfo)
|
|
4880
4856
|
return;
|
|
@@ -4886,7 +4862,7 @@ var MlSpatialElevationProfile = function (props) {
|
|
|
4886
4862
|
sourceId: sourceName.current,
|
|
4887
4863
|
source: {
|
|
4888
4864
|
type: 'geojson',
|
|
4889
|
-
data: (_geojson ||
|
|
4865
|
+
data: (_geojson || featureCollection$1([])),
|
|
4890
4866
|
},
|
|
4891
4867
|
});
|
|
4892
4868
|
useLayer({
|
|
@@ -4903,7 +4879,7 @@ var MlSpatialElevationProfile = function (props) {
|
|
|
4903
4879
|
},
|
|
4904
4880
|
insertBeforeLayer: props.insertBeforeLayer,
|
|
4905
4881
|
});
|
|
4906
|
-
return
|
|
4882
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
4907
4883
|
};
|
|
4908
4884
|
MlSpatialElevationProfile.defaultProps = {
|
|
4909
4885
|
elevationFactor: 1,
|
|
@@ -4920,11 +4896,11 @@ var MlVectorTileLayer = function (props) {
|
|
|
4920
4896
|
mapId: props.mapId,
|
|
4921
4897
|
waitForLayer: props.insertBeforeLayer,
|
|
4922
4898
|
});
|
|
4923
|
-
var layerId =
|
|
4924
|
-
var layerPaintConfsRef =
|
|
4925
|
-
var layerLayoutConfsRef =
|
|
4926
|
-
var initializedRef =
|
|
4927
|
-
var createLayers =
|
|
4899
|
+
var layerId = useRef(props.layerId || 'MlVectorTileLayer-' + mapHook.componentId);
|
|
4900
|
+
var layerPaintConfsRef = useRef({});
|
|
4901
|
+
var layerLayoutConfsRef = useRef({});
|
|
4902
|
+
var initializedRef = useRef(false);
|
|
4903
|
+
var createLayers = useCallback(function () {
|
|
4928
4904
|
if (!mapHook.map)
|
|
4929
4905
|
return;
|
|
4930
4906
|
initializedRef.current = true;
|
|
@@ -4957,7 +4933,7 @@ var MlVectorTileLayer = function (props) {
|
|
|
4957
4933
|
}, mapHook.componentId);
|
|
4958
4934
|
});
|
|
4959
4935
|
}, [mapHook.map, props]);
|
|
4960
|
-
var updateLayers =
|
|
4936
|
+
var updateLayers = useCallback(function () {
|
|
4961
4937
|
if (!initializedRef.current)
|
|
4962
4938
|
return;
|
|
4963
4939
|
props.layers.forEach(function (layer) {
|
|
@@ -4984,24 +4960,24 @@ var MlVectorTileLayer = function (props) {
|
|
|
4984
4960
|
});
|
|
4985
4961
|
}, [mapHook.map, props.layers]);
|
|
4986
4962
|
// initial layer creation
|
|
4987
|
-
|
|
4963
|
+
useEffect(function () {
|
|
4988
4964
|
if (initializedRef.current)
|
|
4989
4965
|
return;
|
|
4990
4966
|
createLayers();
|
|
4991
4967
|
}, [createLayers]);
|
|
4992
4968
|
// if layers get removed or added
|
|
4993
|
-
|
|
4969
|
+
useEffect(function () {
|
|
4994
4970
|
if (!mapHook.map || !initializedRef.current)
|
|
4995
4971
|
return;
|
|
4996
4972
|
createLayers();
|
|
4997
4973
|
}, [props.layers.length, mapHook.map]);
|
|
4998
4974
|
// on layout/paint update
|
|
4999
|
-
|
|
4975
|
+
useEffect(function () {
|
|
5000
4976
|
if (!mapHook.map || !initializedRef.current)
|
|
5001
4977
|
return;
|
|
5002
4978
|
updateLayers();
|
|
5003
4979
|
}, [props.layers, mapHook.map]);
|
|
5004
|
-
return
|
|
4980
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
5005
4981
|
};
|
|
5006
4982
|
|
|
5007
4983
|
/**
|
|
@@ -5014,11 +4990,11 @@ var MlVectorTileLayer = function (props) {
|
|
|
5014
4990
|
*/
|
|
5015
4991
|
var MlWmsFeatureInfoPopup = function (props) {
|
|
5016
4992
|
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
5017
|
-
var mapContext =
|
|
5018
|
-
var initializedRef =
|
|
5019
|
-
var mapRef =
|
|
5020
|
-
var componentId =
|
|
5021
|
-
|
|
4993
|
+
var mapContext = useContext(MapContext);
|
|
4994
|
+
var initializedRef = useRef(false);
|
|
4995
|
+
var mapRef = useRef(undefined);
|
|
4996
|
+
var componentId = useRef(("MlWmsFeatureInfoPopup-") + v4());
|
|
4997
|
+
useEffect(function () {
|
|
5022
4998
|
var _componentId = componentId.current;
|
|
5023
4999
|
return function () {
|
|
5024
5000
|
// This is the cleanup function, it is called when this react component is removed from react-dom
|
|
@@ -5033,7 +5009,7 @@ var MlWmsFeatureInfoPopup = function (props) {
|
|
|
5033
5009
|
initializedRef.current = false;
|
|
5034
5010
|
};
|
|
5035
5011
|
}, []);
|
|
5036
|
-
|
|
5012
|
+
useEffect(function () {
|
|
5037
5013
|
if (!mapContext.mapExists(props.mapId) || initializedRef.current)
|
|
5038
5014
|
return;
|
|
5039
5015
|
// the MapLibre-gl instance (mapContext.getMap(props.mapId)) is accessible here
|
|
@@ -5042,7 +5018,7 @@ var MlWmsFeatureInfoPopup = function (props) {
|
|
|
5042
5018
|
mapRef.current = mapContext.getMap(props.mapId);
|
|
5043
5019
|
mapRef.current.setCenter([7.132122000552613, 50.716405378037706]);
|
|
5044
5020
|
}, [mapContext.mapIds, mapContext, props.mapId]);
|
|
5045
|
-
return
|
|
5021
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
5046
5022
|
};
|
|
5047
5023
|
MlWmsFeatureInfoPopup.defaultProps = {
|
|
5048
5024
|
mapId: undefined,
|
|
@@ -5098,9 +5074,9 @@ var MlWmsLayer = function (props) {
|
|
|
5098
5074
|
mapId: props.mapId,
|
|
5099
5075
|
waitForLayer: props.insertBeforeLayer,
|
|
5100
5076
|
});
|
|
5101
|
-
var initializedRef =
|
|
5102
|
-
var layerId =
|
|
5103
|
-
var tileUrl =
|
|
5077
|
+
var initializedRef = useRef(false);
|
|
5078
|
+
var layerId = useRef(props.layerId || 'MlWmsLayer-' + mapHook.componentId);
|
|
5079
|
+
var tileUrl = useMemo(function () {
|
|
5104
5080
|
var _propsUrlParams;
|
|
5105
5081
|
var _wmsUrl = props.url;
|
|
5106
5082
|
if (props.url.indexOf('?') !== -1) {
|
|
@@ -5114,7 +5090,7 @@ var MlWmsLayer = function (props) {
|
|
|
5114
5090
|
var urlParamsStr = decodeURIComponent(urlParams.toString()) + ''.replace(/%2F/g, '/').replace(/%3A/g, ':');
|
|
5115
5091
|
return _wmsUrl + '?' + urlParamsStr;
|
|
5116
5092
|
}, [props.urlParameters, props.url]);
|
|
5117
|
-
var createLayer =
|
|
5093
|
+
var createLayer = useCallback(function () {
|
|
5118
5094
|
if (!mapHook.map)
|
|
5119
5095
|
return;
|
|
5120
5096
|
initializedRef.current = true;
|
|
@@ -5135,12 +5111,12 @@ var MlWmsLayer = function (props) {
|
|
|
5135
5111
|
mapHook.map.map.setLayoutProperty(layerId.current, 'visibility', 'none');
|
|
5136
5112
|
}
|
|
5137
5113
|
}, [mapHook.map, props, tileUrl]);
|
|
5138
|
-
|
|
5114
|
+
useEffect(function () {
|
|
5139
5115
|
if (initializedRef.current)
|
|
5140
5116
|
return;
|
|
5141
5117
|
createLayer();
|
|
5142
5118
|
}, [createLayer]);
|
|
5143
|
-
|
|
5119
|
+
useEffect(function () {
|
|
5144
5120
|
var _a, _b, _c, _d;
|
|
5145
5121
|
if (!mapHook.map || !((_d = (_c = (_b = (_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.sourceCaches) === null || _d === void 0 ? void 0 : _d[layerId.current]) || !initializedRef.current)
|
|
5146
5122
|
return;
|
|
@@ -5150,7 +5126,7 @@ var MlWmsLayer = function (props) {
|
|
|
5150
5126
|
mapHook.map.map.style.sourceCaches[layerId.current].update(mapHook.map.map.transform);
|
|
5151
5127
|
mapHook.map.map.triggerRepaint();
|
|
5152
5128
|
}, [mapHook.map, tileUrl]);
|
|
5153
|
-
|
|
5129
|
+
useEffect(function () {
|
|
5154
5130
|
if (!mapHook.map || !initializedRef.current)
|
|
5155
5131
|
return;
|
|
5156
5132
|
// toggle layer visibility by changing the layout object's visibility property
|
|
@@ -5161,7 +5137,7 @@ var MlWmsLayer = function (props) {
|
|
|
5161
5137
|
mapHook.map.map.setLayoutProperty(layerId.current, 'visibility', 'none');
|
|
5162
5138
|
}
|
|
5163
5139
|
}, [props.visible, mapHook.map]);
|
|
5164
|
-
return
|
|
5140
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
5165
5141
|
};
|
|
5166
5142
|
MlWmsLayer.defaultProps = __assign({}, defaultProps);
|
|
5167
5143
|
MlWmsLayer.propTypes = {
|
|
@@ -5212,18 +5188,18 @@ MlWmsLayer.propTypes = {
|
|
|
5212
5188
|
|
|
5213
5189
|
function useWms(props) {
|
|
5214
5190
|
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
5215
|
-
var _a =
|
|
5216
|
-
var _b =
|
|
5217
|
-
var _c =
|
|
5218
|
-
var _d =
|
|
5219
|
-
var _e =
|
|
5191
|
+
var _a = useState(), getFeatureInfoUrl = _a[0], setGetFeatureInfoUrl = _a[1];
|
|
5192
|
+
var _b = useState(props.url), url = _b[0], setUrl = _b[1];
|
|
5193
|
+
var _c = useState(""), wmsUrl = _c[0], setWmsUrl = _c[1];
|
|
5194
|
+
var _d = useState(), capabilities = _d[0], setCapabilities = _d[1];
|
|
5195
|
+
var _e = useState(), error = _e[0], setError = _e[1];
|
|
5220
5196
|
var clearState = function () {
|
|
5221
5197
|
setGetFeatureInfoUrl(undefined);
|
|
5222
5198
|
setCapabilities(undefined);
|
|
5223
5199
|
//setLayers([]);
|
|
5224
5200
|
setWmsUrl("");
|
|
5225
5201
|
};
|
|
5226
|
-
|
|
5202
|
+
useEffect(function () {
|
|
5227
5203
|
// extract URL parameters from the given URL
|
|
5228
5204
|
clearState();
|
|
5229
5205
|
setError(undefined);
|
|
@@ -5259,7 +5235,7 @@ function useWms(props) {
|
|
|
5259
5235
|
setError(error.message);
|
|
5260
5236
|
});
|
|
5261
5237
|
}, [url, props.urlParameters]);
|
|
5262
|
-
|
|
5238
|
+
useEffect(function () {
|
|
5263
5239
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
5264
5240
|
if (!(capabilities === null || capabilities === void 0 ? void 0 : capabilities.Service))
|
|
5265
5241
|
return;
|
|
@@ -5285,14 +5261,14 @@ useWms.defaultProps = {
|
|
|
5285
5261
|
};
|
|
5286
5262
|
|
|
5287
5263
|
function ConfirmDialog(props) {
|
|
5288
|
-
return (
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5264
|
+
return (React.createElement(React.Fragment, null,
|
|
5265
|
+
React.createElement(Dialog, { open: props.open, onClose: props.onCancel, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description" },
|
|
5266
|
+
React.createElement(DialogTitle, { id: "alert-dialog-title" }, props.title),
|
|
5267
|
+
React.createElement(DialogContent, null,
|
|
5268
|
+
React.createElement(DialogContentText, { id: "alert-dialog-description" }, props.text)),
|
|
5269
|
+
React.createElement(DialogActions, null,
|
|
5270
|
+
React.createElement(Button$1, { onClick: props.onCancel }, "Cancel"),
|
|
5271
|
+
React.createElement(Button$1, { onClick: props.onConfirm, autoFocus: true }, "Confirm")))));
|
|
5296
5272
|
}
|
|
5297
5273
|
ConfirmDialog.defaultProps = {
|
|
5298
5274
|
title: 'Confirm',
|
|
@@ -5301,13 +5277,13 @@ ConfirmDialog.defaultProps = {
|
|
|
5301
5277
|
|
|
5302
5278
|
function SortableContainer(_a) {
|
|
5303
5279
|
var children = _a.children, layerId = _a.layerId;
|
|
5304
|
-
var _b =
|
|
5280
|
+
var _b = useSortable({
|
|
5305
5281
|
id: layerId,
|
|
5306
5282
|
}), attributes = _b.attributes, listeners = _b.listeners, setNodeRef = _b.setNodeRef, transform = _b.transform;
|
|
5307
5283
|
var style = {
|
|
5308
|
-
transform:
|
|
5284
|
+
transform: CSS.Transform.toString(transform),
|
|
5309
5285
|
};
|
|
5310
|
-
return (
|
|
5286
|
+
return (React__default.createElement("li", __assign({ ref: setNodeRef, style: style }, attributes, listeners), children));
|
|
5311
5287
|
}
|
|
5312
5288
|
|
|
5313
5289
|
var originShift = (2 * Math.PI * 6378137) / 2.0;
|
|
@@ -5335,44 +5311,44 @@ var MlWmsLoader = function (props) {
|
|
|
5335
5311
|
var _l = useWms({
|
|
5336
5312
|
urlParameters: props.urlParameters,
|
|
5337
5313
|
}), _capabilities = _l.capabilities, error = _l.error, setUrl = _l.setUrl, _getFeatureInfoUrl = _l.getFeatureInfoUrl, _wmsUrl = _l.wmsUrl;
|
|
5338
|
-
var _m =
|
|
5339
|
-
var _o =
|
|
5340
|
-
var _p =
|
|
5314
|
+
var _m = useState(((_a = props === null || props === void 0 ? void 0 : props.config) === null || _a === void 0 ? void 0 : _a.open) || false), open = _m[0], setOpen = _m[1];
|
|
5315
|
+
var _o = useState(((_b = props === null || props === void 0 ? void 0 : props.config) === null || _b === void 0 ? void 0 : _b.visible) || true), visible = _o[0], setVisible = _o[1];
|
|
5316
|
+
var _p = useState(false), showDeletionConfirmationDialog = _p[0], setShowDeletionConfirmationDialog = _p[1];
|
|
5341
5317
|
var mapHook = useMap({ mapId: props === null || props === void 0 ? void 0 : props.mapId });
|
|
5342
|
-
var _q =
|
|
5343
|
-
var _r =
|
|
5344
|
-
var _s =
|
|
5345
|
-
var _t =
|
|
5346
|
-
|
|
5318
|
+
var _q = useState(((_c = props === null || props === void 0 ? void 0 : props.config) === null || _c === void 0 ? void 0 : _c.layers) || []), _layers = _q[0], _setLayers = _q[1];
|
|
5319
|
+
var _r = useState(false), featureInfoEventsEnabled = _r[0], setFeatureInfoEventsEnabled = _r[1];
|
|
5320
|
+
var _s = useState(), featureInfoLngLat = _s[0], setFeatureInfoLngLat = _s[1];
|
|
5321
|
+
var _t = useState(undefined), featureInfoContent = _t[0], setFeatureInfoContent = _t[1];
|
|
5322
|
+
useEffect(function () {
|
|
5347
5323
|
if (props.config)
|
|
5348
5324
|
return;
|
|
5349
5325
|
setUrl(props.url);
|
|
5350
5326
|
}, [props.url]);
|
|
5351
|
-
var wmsUrl =
|
|
5327
|
+
var wmsUrl = useMemo(function () {
|
|
5352
5328
|
var _a;
|
|
5353
5329
|
return ((_a = props === null || props === void 0 ? void 0 : props.config) === null || _a === void 0 ? void 0 : _a.wmsUrl) || _wmsUrl;
|
|
5354
5330
|
}, [(_d = props === null || props === void 0 ? void 0 : props.config) === null || _d === void 0 ? void 0 : _d.wmsUrl, _wmsUrl]);
|
|
5355
|
-
var getFeatureInfoUrl =
|
|
5331
|
+
var getFeatureInfoUrl = useMemo(function () {
|
|
5356
5332
|
var _a;
|
|
5357
5333
|
return ((_a = props === null || props === void 0 ? void 0 : props.config) === null || _a === void 0 ? void 0 : _a.getFeatureInfoUrl) || _getFeatureInfoUrl;
|
|
5358
5334
|
}, [(_e = props === null || props === void 0 ? void 0 : props.config) === null || _e === void 0 ? void 0 : _e.getFeatureInfoUrl, _getFeatureInfoUrl]);
|
|
5359
|
-
var capabilities =
|
|
5335
|
+
var capabilities = useMemo(function () {
|
|
5360
5336
|
return _capabilities;
|
|
5361
5337
|
}, [_capabilities]);
|
|
5362
|
-
var name =
|
|
5338
|
+
var name = useMemo(function () {
|
|
5363
5339
|
var _a, _b;
|
|
5364
5340
|
return (props === null || props === void 0 ? void 0 : props.name) || ((_a = props === null || props === void 0 ? void 0 : props.config) === null || _a === void 0 ? void 0 : _a.name) || ((_b = capabilities === null || capabilities === void 0 ? void 0 : capabilities.Service) === null || _b === void 0 ? void 0 : _b.Title);
|
|
5365
5341
|
}, [props === null || props === void 0 ? void 0 : props.name, (_f = props === null || props === void 0 ? void 0 : props.config) === null || _f === void 0 ? void 0 : _f.name, (_g = capabilities === null || capabilities === void 0 ? void 0 : capabilities.Service) === null || _g === void 0 ? void 0 : _g.Title]);
|
|
5366
|
-
var layers =
|
|
5342
|
+
var layers = useMemo(function () {
|
|
5367
5343
|
var _a;
|
|
5368
5344
|
if (!(props === null || props === void 0 ? void 0 : props.setLayers))
|
|
5369
5345
|
return _layers;
|
|
5370
5346
|
return ((_a = props === null || props === void 0 ? void 0 : props.config) === null || _a === void 0 ? void 0 : _a.layers) || _layers;
|
|
5371
5347
|
}, [(_h = props === null || props === void 0 ? void 0 : props.config) === null || _h === void 0 ? void 0 : _h.layers, _layers]);
|
|
5372
|
-
var setLayers =
|
|
5348
|
+
var setLayers = useMemo(function () {
|
|
5373
5349
|
return (props === null || props === void 0 ? void 0 : props.setLayers) || _setLayers;
|
|
5374
5350
|
}, [props === null || props === void 0 ? void 0 : props.setLayers, _setLayers]);
|
|
5375
|
-
|
|
5351
|
+
useEffect(function () {
|
|
5376
5352
|
var _a;
|
|
5377
5353
|
(_a = props === null || props === void 0 ? void 0 : props.onConfigChange) === null || _a === void 0 ? void 0 : _a.call(props, {
|
|
5378
5354
|
layers: layers,
|
|
@@ -5384,7 +5360,7 @@ var MlWmsLoader = function (props) {
|
|
|
5384
5360
|
name: name,
|
|
5385
5361
|
});
|
|
5386
5362
|
}, [layers, capabilities, getFeatureInfoUrl, wmsUrl, visible, open, name]);
|
|
5387
|
-
var attribution =
|
|
5363
|
+
var attribution = useMemo(function () {
|
|
5388
5364
|
return layers
|
|
5389
5365
|
.filter(function (el) { var _a; return el.visible && ((_a = el === null || el === void 0 ? void 0 : el.Attribution) === null || _a === void 0 ? void 0 : _a.Title); })
|
|
5390
5366
|
.map(function (el) { var _a; return (_a = el === null || el === void 0 ? void 0 : el.Attribution) === null || _a === void 0 ? void 0 : _a.Title; })
|
|
@@ -5395,15 +5371,15 @@ var MlWmsLoader = function (props) {
|
|
|
5395
5371
|
setFeatureInfoLngLat(undefined);
|
|
5396
5372
|
setFeatureInfoContent(undefined);
|
|
5397
5373
|
};
|
|
5398
|
-
var getFeatureInfo =
|
|
5374
|
+
var getFeatureInfo = useCallback(function (ev) {
|
|
5399
5375
|
var _a, _b, _c;
|
|
5400
5376
|
if (!mapHook.map)
|
|
5401
5377
|
return;
|
|
5402
5378
|
resetFeatureInfo();
|
|
5403
5379
|
var unprojected = mapHook.map.unproject([ev.point.x, ev.point.y]);
|
|
5404
|
-
var point =
|
|
5405
|
-
var buffered =
|
|
5406
|
-
var _bbox =
|
|
5380
|
+
var point = turf.point([unprojected.lng, unprojected.lat]);
|
|
5381
|
+
var buffered = turf.buffer(point, 50, { units: 'meters' });
|
|
5382
|
+
var _bbox = turf.bbox(buffered);
|
|
5407
5383
|
var _sw = lngLatToMeters({ lng: _bbox[0], lat: _bbox[1] });
|
|
5408
5384
|
var _ne = lngLatToMeters({ lng: _bbox[2], lat: _bbox[3] });
|
|
5409
5385
|
var bbox = [_sw[0], _sw[1], _ne[0], _ne[1]];
|
|
@@ -5456,13 +5432,13 @@ var MlWmsLoader = function (props) {
|
|
|
5456
5432
|
})
|
|
5457
5433
|
.catch(function (error) { return console.log(error); });
|
|
5458
5434
|
}, [capabilities, getFeatureInfoUrl, props, mapHook, layers]);
|
|
5459
|
-
var _featureInfoEventsEnabled =
|
|
5435
|
+
var _featureInfoEventsEnabled = useMemo(function () {
|
|
5460
5436
|
return (((typeof (props === null || props === void 0 ? void 0 : props.featureInfoActive) !== 'undefined' && props.featureInfoActive) ||
|
|
5461
5437
|
featureInfoEventsEnabled) &&
|
|
5462
5438
|
(layers === null || layers === void 0 ? void 0 : layers.some(function (layer) { return layer.visible && layer.queryable; })) &&
|
|
5463
5439
|
!!mapHook.map);
|
|
5464
5440
|
}, [props === null || props === void 0 ? void 0 : props.featureInfoActive, featureInfoEventsEnabled, layers, mapHook.map]);
|
|
5465
|
-
|
|
5441
|
+
useEffect(function () {
|
|
5466
5442
|
if (!_featureInfoEventsEnabled) {
|
|
5467
5443
|
resetFeatureInfo();
|
|
5468
5444
|
return;
|
|
@@ -5476,7 +5452,7 @@ var MlWmsLoader = function (props) {
|
|
|
5476
5452
|
(_c = (_a = mapHook.map) === null || _a === void 0 ? void 0 : (_b = _a.map).off) === null || _c === void 0 ? void 0 : _c.call(_b, 'click', _getFeatureInfo);
|
|
5477
5453
|
};
|
|
5478
5454
|
}, [_featureInfoEventsEnabled, getFeatureInfo, mapHook.map]);
|
|
5479
|
-
|
|
5455
|
+
useEffect(function () {
|
|
5480
5456
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
5481
5457
|
if (!(capabilities === null || capabilities === void 0 ? void 0 : capabilities.Service))
|
|
5482
5458
|
return;
|
|
@@ -5524,9 +5500,9 @@ var MlWmsLoader = function (props) {
|
|
|
5524
5500
|
}
|
|
5525
5501
|
}
|
|
5526
5502
|
}, [capabilities, mapHook.map]);
|
|
5527
|
-
var listContent = (
|
|
5503
|
+
var listContent = (React__default.createElement(ListItem, { secondaryAction: React__default.createElement(React__default.Fragment, null,
|
|
5528
5504
|
props.buttons,
|
|
5529
|
-
props.featureInfoEnabled && (
|
|
5505
|
+
props.featureInfoEnabled && (React__default.createElement(IconButton, { sx: {
|
|
5530
5506
|
padding: '4px',
|
|
5531
5507
|
marginTop: '-3px',
|
|
5532
5508
|
marginRight: '4px',
|
|
@@ -5545,16 +5521,16 @@ var MlWmsLoader = function (props) {
|
|
|
5545
5521
|
setFeatureInfoEventsEnabled(function (current) { return !current; });
|
|
5546
5522
|
}
|
|
5547
5523
|
}, disabled: !(layers === null || layers === void 0 ? void 0 : layers.some(function (layer) { return layer.visible && layer.queryable; })) },
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
props.showDeleteButton && (
|
|
5551
|
-
|
|
5524
|
+
React__default.createElement(InfoIcon, null))),
|
|
5525
|
+
React__default.createElement(IconButton, { edge: props.showDeleteButton ? false : 'end', sx: __assign({ padding: '4px', marginTop: '-3px' }, (props.showDeleteButton ? { marginRight: '4px' } : {})), "aria-label": "open", onClick: function () { return setOpen(function (current) { return !current; }); } }, open ? React__default.createElement(ExpandLess, null) : React__default.createElement(ExpandMore, null)),
|
|
5526
|
+
props.showDeleteButton && (React__default.createElement(React__default.Fragment, null,
|
|
5527
|
+
React__default.createElement(IconButton, { "aria-label": "delete", edge: "end", onClick: function () {
|
|
5552
5528
|
if (typeof props.onConfigChange === 'function') {
|
|
5553
5529
|
setShowDeletionConfirmationDialog(true);
|
|
5554
5530
|
}
|
|
5555
5531
|
}, sx: { padding: '4px', marginTop: '-3px' } },
|
|
5556
|
-
|
|
5557
|
-
showDeletionConfirmationDialog && (
|
|
5532
|
+
React__default.createElement(DeleteIcon, null)),
|
|
5533
|
+
showDeletionConfirmationDialog && (React__default.createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
|
|
5558
5534
|
if (typeof props.onConfigChange === 'function') {
|
|
5559
5535
|
props.onConfigChange(false);
|
|
5560
5536
|
}
|
|
@@ -5566,31 +5542,31 @@ var MlWmsLoader = function (props) {
|
|
|
5566
5542
|
paddingTop: 0,
|
|
5567
5543
|
paddingBottom: '4px',
|
|
5568
5544
|
} },
|
|
5569
|
-
|
|
5570
|
-
|
|
5545
|
+
React__default.createElement(ListItemIcon, { sx: { minWidth: '30px' } },
|
|
5546
|
+
React__default.createElement(Checkbox, { sx: { padding: 0 }, checked: visible, onClick: function () {
|
|
5571
5547
|
setVisible(function (val) { return !val; });
|
|
5572
5548
|
} })),
|
|
5573
|
-
|
|
5574
|
-
return (
|
|
5575
|
-
error && (
|
|
5576
|
-
|
|
5577
|
-
wmsUrl && (
|
|
5578
|
-
props.layerId && props.sortable && (
|
|
5549
|
+
React__default.createElement(ListItemText, { primary: name, variant: "layerlist" })));
|
|
5550
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
5551
|
+
error && (React__default.createElement(Snackbar, null,
|
|
5552
|
+
React__default.createElement(Box, null, error))),
|
|
5553
|
+
wmsUrl && (React__default.createElement(React__default.Fragment, null,
|
|
5554
|
+
props.layerId && props.sortable && (React__default.createElement(SortableContainer, { layerId: props.layerId }, listContent)),
|
|
5579
5555
|
props.layerId && !props.sortable && (listContent),
|
|
5580
|
-
|
|
5581
|
-
|
|
5556
|
+
React__default.createElement(Box, { sx: { display: open ? 'block' : 'none' } },
|
|
5557
|
+
React__default.createElement(List, { dense: true, component: "div", disablePadding: true, sx: { paddingLeft: '18px' } }, wmsUrl &&
|
|
5582
5558
|
((_j = layers === null || layers === void 0 ? void 0 : layers.map) === null || _j === void 0 ? void 0 : _j.call(layers, function (layer, idx) {
|
|
5583
|
-
return (layer === null || layer === void 0 ? void 0 : layer.Name) ? (
|
|
5584
|
-
|
|
5585
|
-
|
|
5559
|
+
return (layer === null || layer === void 0 ? void 0 : layer.Name) ? (React__default.createElement(ListItem, { key: layer.Name + idx, secondaryAction: React__default.createElement(React__default.Fragment, null, (layer === null || layer === void 0 ? void 0 : layer.queryable) && React__default.createElement(InfoIcon, null)) },
|
|
5560
|
+
React__default.createElement(ListItemIcon, { sx: { minWidth: '30px' } },
|
|
5561
|
+
React__default.createElement(Checkbox, { checked: layer.visible, sx: { padding: 0 }, onClick: function () {
|
|
5586
5562
|
var _layers = __spreadArray([], layers, true);
|
|
5587
5563
|
_layers[idx].visible = !_layers[idx].visible;
|
|
5588
5564
|
setLayers(__spreadArray([], _layers, true));
|
|
5589
5565
|
} })),
|
|
5590
|
-
|
|
5566
|
+
React__default.createElement(ListItemText, { primary: layer === null || layer === void 0 ? void 0 : layer.Title, variant: "layerlist" }))) : (React__default.createElement(React__default.Fragment, null));
|
|
5591
5567
|
}))),
|
|
5592
|
-
wmsUrl && (layers === null || layers === void 0 ? void 0 : layers.length) && (
|
|
5593
|
-
props.featureInfoEnabled && featureInfoLngLat && (
|
|
5568
|
+
wmsUrl && (layers === null || layers === void 0 ? void 0 : layers.length) && (React__default.createElement(MlWmsLayer, { key: mapHook.componentId, url: wmsUrl, attribution: attribution, visible: visible, urlParameters: __assign(__assign({}, props.wmsUrlParameters), { layers: (_k = layers === null || layers === void 0 ? void 0 : layers.filter) === null || _k === void 0 ? void 0 : _k.call(layers, function (layer) { return layer.visible; }).map(function (el) { return el.Name; }).reverse().join(',') }), insertBeforeLayer: props === null || props === void 0 ? void 0 : props.insertBeforeLayer }))),
|
|
5569
|
+
props.featureInfoEnabled && featureInfoLngLat && (React__default.createElement(MlMarker, __assign({}, featureInfoLngLat, { content: featureInfoContent })))))));
|
|
5594
5570
|
};
|
|
5595
5571
|
//<p key="description" style={{ fontSize: '.7em' }}>
|
|
5596
5572
|
// {capabilities?.Capability?.Layer?.['Abstract']}
|
|
@@ -5795,7 +5771,7 @@ function MlTemporalControllerLabels(props) {
|
|
|
5795
5771
|
'text-field': ['get', props.labelField],
|
|
5796
5772
|
'text-font': ['Metropolis Regular'],
|
|
5797
5773
|
};
|
|
5798
|
-
return (
|
|
5774
|
+
return (React__default.createElement(MlLayer, { options: {
|
|
5799
5775
|
type: 'symbol',
|
|
5800
5776
|
layout: props.labelLayout || defaultLayout,
|
|
5801
5777
|
paint: props.labelPaint || currentPaint(),
|
|
@@ -5816,23 +5792,23 @@ var mobileScreenBoxStyle = {
|
|
|
5816
5792
|
alignItems: 'center',
|
|
5817
5793
|
};
|
|
5818
5794
|
function TemporalControllerPlayer(props) {
|
|
5819
|
-
var _a =
|
|
5820
|
-
var _b =
|
|
5795
|
+
var _a = useState(props.currentVal), currentVal = _a[0], setCurrentVal = _a[1];
|
|
5796
|
+
var _b = useState(props.isPlaying), isPlaying = _b[0], setIsPlaying = _b[1];
|
|
5821
5797
|
var range = props.maxVal - props.minVal;
|
|
5822
|
-
var intervalRef =
|
|
5823
|
-
var mediaIsMobile =
|
|
5824
|
-
|
|
5798
|
+
var intervalRef = useRef();
|
|
5799
|
+
var mediaIsMobile = useMediaQuery(function (theme) { return theme.breakpoints.down('md'); });
|
|
5800
|
+
useEffect(function () {
|
|
5825
5801
|
return function () {
|
|
5826
5802
|
if (intervalRef.current) {
|
|
5827
5803
|
clearInterval(intervalRef.current);
|
|
5828
5804
|
}
|
|
5829
5805
|
};
|
|
5830
5806
|
}, []);
|
|
5831
|
-
|
|
5807
|
+
useEffect(function () {
|
|
5832
5808
|
props.returnCurrent(currentVal);
|
|
5833
5809
|
props.returnPlaying(isPlaying);
|
|
5834
5810
|
}, [currentVal, isPlaying]);
|
|
5835
|
-
var play =
|
|
5811
|
+
var play = React__default.useCallback(function () {
|
|
5836
5812
|
var counter = currentVal - props.minVal;
|
|
5837
5813
|
if (intervalRef.current) {
|
|
5838
5814
|
clearInterval(intervalRef.current);
|
|
@@ -5899,30 +5875,30 @@ function TemporalControllerPlayer(props) {
|
|
|
5899
5875
|
}
|
|
5900
5876
|
}
|
|
5901
5877
|
};
|
|
5902
|
-
return (
|
|
5903
|
-
|
|
5878
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
5879
|
+
React__default.createElement(Drawer, { anchor: "bottom", open: props.open || true, variant: "persistent", sx: {
|
|
5904
5880
|
flexShrink: 0,
|
|
5905
5881
|
'& .MuiDrawer-paper': mediaIsMobile ? mobileScreenBoxStyle : bigScreenBoxStyle,
|
|
5906
5882
|
} },
|
|
5907
|
-
|
|
5908
|
-
mediaIsMobile ?
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
props.display && !mediaIsMobile && (
|
|
5918
|
-
|
|
5919
|
-
|
|
5883
|
+
React__default.createElement(Grid, { container: true },
|
|
5884
|
+
mediaIsMobile ? React__default.createElement(React__default.Fragment, null) : React__default.createElement(Grid, { item: true, xs: 3 }),
|
|
5885
|
+
React__default.createElement(Grid, { item: true, xs: mediaIsMobile ? 12 : 6, textAlign: "center" },
|
|
5886
|
+
React__default.createElement(Button, { onClick: handleFastRewind },
|
|
5887
|
+
React__default.createElement(FastRewindIcon, null)),
|
|
5888
|
+
React__default.createElement(Button, { onClick: handleStop },
|
|
5889
|
+
React__default.createElement(StopIcon, null)),
|
|
5890
|
+
React__default.createElement(Button, { onClick: handlePlayPause }, isPlaying ? React__default.createElement(PauseIcon, null) : React__default.createElement(PlayArrowIcon, null)),
|
|
5891
|
+
React__default.createElement(Button, { onClick: handleFastForward },
|
|
5892
|
+
React__default.createElement(FastForwardIcon, null))),
|
|
5893
|
+
props.display && !mediaIsMobile && (React__default.createElement(Grid, { item: true, xs: 3 },
|
|
5894
|
+
React__default.createElement(Typography, { variant: 'h5', textAlign: 'right', sx: { paddingRight: '25px' } }, Math.floor(currentVal))))),
|
|
5895
|
+
React__default.createElement(Slider, { sx: {
|
|
5920
5896
|
position: 'flex',
|
|
5921
5897
|
width: '95%',
|
|
5922
5898
|
paddingTop: '10px',
|
|
5923
5899
|
alignSelf: 'center',
|
|
5924
5900
|
}, "aria-label": "Custom marks", defaultValue: props.minVal, value: currentVal, step: props.step, onChange: handleChange, min: props.minVal, max: props.maxVal }),
|
|
5925
|
-
mediaIsMobile && props.display && (
|
|
5901
|
+
mediaIsMobile && props.display && (React__default.createElement(Typography, { variant: 'body1', textAlign: 'right' }, Math.floor(currentVal))))));
|
|
5926
5902
|
}
|
|
5927
5903
|
|
|
5928
5904
|
function getMinVal(geojson, timeField) {
|
|
@@ -5947,7 +5923,7 @@ function useFilterData(props) {
|
|
|
5947
5923
|
var mapHook = useMap({
|
|
5948
5924
|
mapId: props.mapId,
|
|
5949
5925
|
});
|
|
5950
|
-
var minVal =
|
|
5926
|
+
var minVal = useMemo(function () {
|
|
5951
5927
|
if (props.minVal) {
|
|
5952
5928
|
return props.minVal;
|
|
5953
5929
|
}
|
|
@@ -5955,7 +5931,7 @@ function useFilterData(props) {
|
|
|
5955
5931
|
return getMinVal(props.geojson, props.timeField);
|
|
5956
5932
|
}
|
|
5957
5933
|
}, [props.minVal, props.geojson, props.timeField]);
|
|
5958
|
-
var maxVal =
|
|
5934
|
+
var maxVal = useMemo(function () {
|
|
5959
5935
|
if (props.maxVal) {
|
|
5960
5936
|
return props.maxVal;
|
|
5961
5937
|
}
|
|
@@ -5964,9 +5940,9 @@ function useFilterData(props) {
|
|
|
5964
5940
|
}
|
|
5965
5941
|
}, [props.maxVal, props.geojson, props.timeField]);
|
|
5966
5942
|
// filter geojson
|
|
5967
|
-
var filteredData =
|
|
5943
|
+
var filteredData = useMemo(function () {
|
|
5968
5944
|
if (props.geojson !== undefined && mapHook.map && minVal && maxVal) {
|
|
5969
|
-
return
|
|
5945
|
+
return featureCollection(props.geojson.features.filter(function (e) {
|
|
5970
5946
|
var _a, _b;
|
|
5971
5947
|
return (((_a = e.properties) === null || _a === void 0 ? void 0 : _a[props.timeField]) >= minVal &&
|
|
5972
5948
|
((_b = e.properties) === null || _b === void 0 ? void 0 : _b[props.timeField]) <= maxVal);
|
|
@@ -5992,11 +5968,11 @@ var MlTemporalController = function (props) {
|
|
|
5992
5968
|
initialVal: props.initialVal,
|
|
5993
5969
|
mapId: props.mapId,
|
|
5994
5970
|
}), filteredData = _d.filteredData, minVal = _d.minVal, maxVal = _d.maxVal;
|
|
5995
|
-
var theme =
|
|
5996
|
-
var _e =
|
|
5971
|
+
var theme = useTheme();
|
|
5972
|
+
var _e = useState(props.initialVal || minVal), currentVal = _e[0], setCurrentVal = _e[1];
|
|
5997
5973
|
var featuresColor = props.featuresColor || theme.palette.primary.main;
|
|
5998
5974
|
var labelColor = props.labelColor || theme.palette.text.primary;
|
|
5999
|
-
var _f =
|
|
5975
|
+
var _f = useState(false), isPlaying = _f[0], setIsPlaying = _f[1];
|
|
6000
5976
|
var paint = paintPicker({
|
|
6001
5977
|
type: props.type,
|
|
6002
5978
|
timeField: props.timeField,
|
|
@@ -6011,7 +5987,7 @@ var MlTemporalController = function (props) {
|
|
|
6011
5987
|
userPaint: props.paint,
|
|
6012
5988
|
});
|
|
6013
5989
|
//Set Initial values and clear references
|
|
6014
|
-
|
|
5990
|
+
useEffect(function () {
|
|
6015
5991
|
if (!props.initialVal && minVal) {
|
|
6016
5992
|
setCurrentVal(minVal);
|
|
6017
5993
|
}
|
|
@@ -6027,14 +6003,14 @@ var MlTemporalController = function (props) {
|
|
|
6027
6003
|
});
|
|
6028
6004
|
}
|
|
6029
6005
|
// Fit map to bbox
|
|
6030
|
-
|
|
6006
|
+
useEffect(function () {
|
|
6031
6007
|
var _a;
|
|
6032
6008
|
if (props.fitBounds && typeof filteredData !== 'undefined') {
|
|
6033
|
-
var geojsonBbox =
|
|
6009
|
+
var geojsonBbox = bbox(filteredData);
|
|
6034
6010
|
(_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.map.fitBounds(geojsonBbox);
|
|
6035
6011
|
}
|
|
6036
6012
|
}, [filteredData]);
|
|
6037
|
-
|
|
6013
|
+
useEffect(function () {
|
|
6038
6014
|
var _a, _b, _c;
|
|
6039
6015
|
if (!mapHook.map)
|
|
6040
6016
|
return;
|
|
@@ -6070,8 +6046,8 @@ var MlTemporalController = function (props) {
|
|
|
6070
6046
|
}
|
|
6071
6047
|
};
|
|
6072
6048
|
}, [mapHook.map, props.onClick, props.onHover, props.onLeave]);
|
|
6073
|
-
return (
|
|
6074
|
-
filteredData && props.ownLayer && (
|
|
6049
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
6050
|
+
filteredData && props.ownLayer && (React__default.createElement(MlGeoJsonLayer, { type: props.type, mapId: props.mapId,
|
|
6075
6051
|
//layerId="timeController"
|
|
6076
6052
|
//insertBeforeLayer={props.insertBeforeLayer || 'timeControllerLabels'}
|
|
6077
6053
|
paint: props.paint ||
|
|
@@ -6082,8 +6058,8 @@ var MlTemporalController = function (props) {
|
|
|
6082
6058
|
data: filteredData
|
|
6083
6059
|
},
|
|
6084
6060
|
} })),
|
|
6085
|
-
filteredData && props.label && (
|
|
6086
|
-
|
|
6061
|
+
filteredData && props.label && (React__default.createElement(MlTemporalControllerLabels, { data: filteredData, currentVal: currentVal, fadeIn: props.labelFadeIn, fadeOut: props.labelFadeOut, step: props.step, labelField: labelField, labelColor: labelColor, timeField: props.timeField, minVal: minVal, accumulate: props.accumulate, isPlaying: isPlaying })),
|
|
6062
|
+
React__default.createElement(TemporalControllerPlayer, { currentVal: currentVal, isPlaying: isPlaying, step: props.step, interval: props.interval, minVal: minVal, maxVal: maxVal, returnCurrent: setCurrentVal, returnPlaying: setIsPlaying, open: false, fadeIn: props.fadeIn, fadeOut: props.fadeOut, featuresColor: featuresColor, labels: props.label, labelColor: labelColor, labelFadeIn: props.labelFadeIn, labelFadeOut: props.labelFadeOut, accumulate: props.accumulate, display: props.displayCurrentValue })));
|
|
6087
6063
|
};
|
|
6088
6064
|
MlTemporalController.defaultProps = {
|
|
6089
6065
|
mapId: undefined,
|
|
@@ -6108,9 +6084,9 @@ MlTemporalController.defaultProps = {
|
|
|
6108
6084
|
*/
|
|
6109
6085
|
var MlOrderLayers = function (props) {
|
|
6110
6086
|
var _a;
|
|
6111
|
-
return (
|
|
6087
|
+
return (React__default.createElement(React__default.Fragment, null, (_a = props === null || props === void 0 ? void 0 : props.layerIds) === null || _a === void 0 ? void 0 : _a.map(function (layer, idx) {
|
|
6112
6088
|
var _a;
|
|
6113
|
-
return (
|
|
6089
|
+
return (React__default.createElement(MlLayer, __assign({ layerId: layer, options: {
|
|
6114
6090
|
display: 'none',
|
|
6115
6091
|
}, key: layer }, (idx > 0
|
|
6116
6092
|
? {
|
|
@@ -6130,7 +6106,7 @@ MlOrderLayers.defaultProps = {
|
|
|
6130
6106
|
*/
|
|
6131
6107
|
var MlTerrainLayer = function (props) {
|
|
6132
6108
|
var mapHook = useMap({ mapId: 'map_1' });
|
|
6133
|
-
|
|
6109
|
+
useEffect(function () {
|
|
6134
6110
|
if (!mapHook.map)
|
|
6135
6111
|
return;
|
|
6136
6112
|
if (!mapHook.map.map.getSource('terrain')) {
|
|
@@ -6153,68 +6129,68 @@ var MlTerrainLayer = function (props) {
|
|
|
6153
6129
|
}
|
|
6154
6130
|
};
|
|
6155
6131
|
}, [mapHook.map, props.sourceOptions, props.terrainOptions]);
|
|
6156
|
-
return
|
|
6132
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
6157
6133
|
};
|
|
6158
6134
|
MlTerrainLayer.defaultProps = {
|
|
6159
6135
|
mapId: undefined,
|
|
6160
6136
|
};
|
|
6161
6137
|
|
|
6162
|
-
var ListItemStyled$1 =
|
|
6138
|
+
var ListItemStyled$1 = styled$1(ListItem$1)({
|
|
6163
6139
|
paddingRight: 0,
|
|
6164
6140
|
paddingLeft: 0,
|
|
6165
6141
|
paddingTop: 0,
|
|
6166
6142
|
paddingBottom: '4px',
|
|
6167
6143
|
});
|
|
6168
|
-
var ListItemIconStyled =
|
|
6144
|
+
var ListItemIconStyled = styled$1(ListItemIcon)({
|
|
6169
6145
|
minWidth: '30px',
|
|
6170
6146
|
});
|
|
6171
|
-
var IconButtonStyled$1 =
|
|
6147
|
+
var IconButtonStyled$1 = styled$1(IconButton$1)({
|
|
6172
6148
|
marginRight: '0px',
|
|
6173
6149
|
padding: '0px',
|
|
6174
6150
|
});
|
|
6175
|
-
var CheckboxStyled$1 =
|
|
6151
|
+
var CheckboxStyled$1 = styled$1(Checkbox)({
|
|
6176
6152
|
padding: 0,
|
|
6177
6153
|
marginRight: '5px',
|
|
6178
6154
|
});
|
|
6179
|
-
var BoxStyled$1 =
|
|
6155
|
+
var BoxStyled$1 = styled$1(Box$2)(function (_a) {
|
|
6180
6156
|
var open = _a.open;
|
|
6181
6157
|
return ({
|
|
6182
6158
|
display: open ? 'block' : 'none',
|
|
6183
6159
|
});
|
|
6184
6160
|
});
|
|
6185
|
-
var ListStyled$1 =
|
|
6161
|
+
var ListStyled$1 = styled$1(List$1)({
|
|
6186
6162
|
marginLeft: '50px',
|
|
6187
6163
|
});
|
|
6188
6164
|
function LayerListFolder(_a) {
|
|
6189
6165
|
var _b = _a.visible, visible = _b === void 0 ? true : _b, name = _a.name, children = _a.children, setVisible = _a.setVisible;
|
|
6190
|
-
var _c =
|
|
6191
|
-
var _d =
|
|
6192
|
-
var _visible =
|
|
6166
|
+
var _c = useState(false), open = _c[0], setOpen = _c[1];
|
|
6167
|
+
var _d = useState(true), localVisible = _d[0], setLocalVisible = _d[1];
|
|
6168
|
+
var _visible = useMemo(function () {
|
|
6193
6169
|
if (!visible) {
|
|
6194
6170
|
return false;
|
|
6195
6171
|
}
|
|
6196
6172
|
return localVisible;
|
|
6197
6173
|
}, [visible, localVisible]);
|
|
6198
|
-
var _children =
|
|
6174
|
+
var _children = useMemo(function () {
|
|
6199
6175
|
if (children) {
|
|
6200
6176
|
if (Array.isArray(children)) {
|
|
6201
6177
|
return children.map(function (element) {
|
|
6202
|
-
return
|
|
6178
|
+
return React__default.cloneElement(element, {
|
|
6203
6179
|
visible: _visible,
|
|
6204
6180
|
});
|
|
6205
6181
|
});
|
|
6206
6182
|
}
|
|
6207
|
-
return
|
|
6183
|
+
return React__default.cloneElement(children, {
|
|
6208
6184
|
visible: _visible,
|
|
6209
6185
|
});
|
|
6210
6186
|
}
|
|
6211
|
-
return
|
|
6187
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
6212
6188
|
}, [_visible]);
|
|
6213
|
-
return (
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6189
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
6190
|
+
React__default.createElement(ListItemStyled$1, null,
|
|
6191
|
+
React__default.createElement(ListItemIconStyled, null,
|
|
6192
|
+
React__default.createElement(IconButtonStyled$1, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React__default.createElement(ExpandMore, null) : React__default.createElement(KeyboardArrowRight, null)),
|
|
6193
|
+
React__default.createElement(CheckboxStyled$1, { disabled: setVisible ? false : !visible, checked: setVisible ? visible : localVisible, onClick: function () {
|
|
6218
6194
|
if (setVisible) {
|
|
6219
6195
|
setVisible(function (val) { return !val; });
|
|
6220
6196
|
}
|
|
@@ -6222,9 +6198,9 @@ function LayerListFolder(_a) {
|
|
|
6222
6198
|
setLocalVisible(function (val) { return !val; });
|
|
6223
6199
|
}
|
|
6224
6200
|
} })),
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6201
|
+
React__default.createElement(ListItemText$1, { primary: name, variant: "layerlist" })),
|
|
6202
|
+
React__default.createElement(BoxStyled$1, { open: open },
|
|
6203
|
+
React__default.createElement(ListStyled$1, { disablePadding: true }, _children))));
|
|
6228
6204
|
}
|
|
6229
6205
|
|
|
6230
6206
|
var converters = {
|
|
@@ -6237,12 +6213,12 @@ var converters = {
|
|
|
6237
6213
|
|
|
6238
6214
|
var ColorPicker = function (_a) {
|
|
6239
6215
|
var convert = _a.convert, props = __rest(_a, ["convert"]);
|
|
6240
|
-
var _b =
|
|
6241
|
-
var _c =
|
|
6242
|
-
return (
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6216
|
+
var _b = useState(false), showPicker = _b[0], setShowPicker = _b[1];
|
|
6217
|
+
var _c = useState((props === null || props === void 0 ? void 0 : props.value) || ''), value = _c[0], setValue = _c[1];
|
|
6218
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
6219
|
+
React__default.createElement(Grid, { container: true, sx: { flexWrap: 'nowrap' } },
|
|
6220
|
+
React__default.createElement(Grid, { xs: 12, item: true },
|
|
6221
|
+
React__default.createElement(Button, { variant: "outlined", onClick: function () { return setShowPicker(true); }, sx: {
|
|
6246
6222
|
minWidth: '100%',
|
|
6247
6223
|
padding: '5px',
|
|
6248
6224
|
marginBottom: '10px',
|
|
@@ -6250,19 +6226,19 @@ var ColorPicker = function (_a) {
|
|
|
6250
6226
|
borderColor: function (theme) { return theme.palette.text.primary; },
|
|
6251
6227
|
color: function (theme) { return theme.palette.text.primary; },
|
|
6252
6228
|
} },
|
|
6253
|
-
|
|
6229
|
+
React__default.createElement("div", { style: {
|
|
6254
6230
|
width: '25px',
|
|
6255
6231
|
height: '25px',
|
|
6256
6232
|
marginRight: '10px',
|
|
6257
6233
|
backgroundColor: value,
|
|
6258
6234
|
} }),
|
|
6259
6235
|
value))),
|
|
6260
|
-
showPicker && (
|
|
6261
|
-
|
|
6262
|
-
|
|
6236
|
+
showPicker && (React__default.createElement("div", { style: { position: 'relative', marginTop: 0 } },
|
|
6237
|
+
React__default.createElement("div", { style: { position: 'absolute', zIndex: 1000 } },
|
|
6238
|
+
React__default.createElement("div", { style: { position: 'fixed', top: '0px', right: '0px', bottom: '0px', left: '0px' }, onClick: function () {
|
|
6263
6239
|
setShowPicker(false);
|
|
6264
6240
|
} }),
|
|
6265
|
-
|
|
6241
|
+
React__default.createElement(ChromePicker, { color: value, onChange: function (c) {
|
|
6266
6242
|
var _a;
|
|
6267
6243
|
var newValue = converters[convert](c);
|
|
6268
6244
|
setValue(newValue);
|
|
@@ -6277,7 +6253,7 @@ ColorPicker.defaultProps = {
|
|
|
6277
6253
|
|
|
6278
6254
|
function PaintPropsColorPicker(_a) {
|
|
6279
6255
|
var propKey = _a.propKey, value = _a.value, setPaintProps = _a.setPaintProps;
|
|
6280
|
-
return (
|
|
6256
|
+
return (React__default.createElement(ColorPicker, { value: value, label: "Color", onChange: function (value) {
|
|
6281
6257
|
setPaintProps(function (current) {
|
|
6282
6258
|
var _a;
|
|
6283
6259
|
var newProps = __assign(__assign({}, current), (_a = {}, _a[propKey] = value, _a));
|
|
@@ -6286,7 +6262,7 @@ function PaintPropsColorPicker(_a) {
|
|
|
6286
6262
|
} }));
|
|
6287
6263
|
}
|
|
6288
6264
|
|
|
6289
|
-
var PaperStyled =
|
|
6265
|
+
var PaperStyled = styled(Paper$1)({
|
|
6290
6266
|
marginLeft: '-100px',
|
|
6291
6267
|
marginRight: '-21px',
|
|
6292
6268
|
paddingLeft: '53px',
|
|
@@ -6294,7 +6270,7 @@ var PaperStyled = material.styled(material.Paper)({
|
|
|
6294
6270
|
boxShadow: 'none',
|
|
6295
6271
|
backgroundColor: 'rgb(0, 0, 0, 0)',
|
|
6296
6272
|
});
|
|
6297
|
-
var BoxStyled =
|
|
6273
|
+
var BoxStyled = styled(Box)({
|
|
6298
6274
|
marginLeft: '61px',
|
|
6299
6275
|
});
|
|
6300
6276
|
var mapPropKeyToFormInputType = {
|
|
@@ -6333,16 +6309,16 @@ var inputPropsByPropKey = {
|
|
|
6333
6309
|
};
|
|
6334
6310
|
function LayerPropertyForm(_a) {
|
|
6335
6311
|
var _b = _a.paintProps, paintProps = _b === void 0 ? {} : _b, setPaintProps = _a.setPaintProps;
|
|
6336
|
-
var key =
|
|
6337
|
-
var getFormInputByType =
|
|
6312
|
+
var key = useRef(Math.round(Math.random() * 10000000000));
|
|
6313
|
+
var getFormInputByType = useCallback(function (key) {
|
|
6338
6314
|
if (mapPropKeyToFormInputTypeKeys.indexOf(key) !== -1 &&
|
|
6339
6315
|
(typeof paintProps[key] === 'number' || typeof paintProps[key] === 'string')) {
|
|
6340
|
-
var label = (
|
|
6316
|
+
var label = (React__default.createElement(Typography, { id: key + '_label', gutterBottom: true }, key));
|
|
6341
6317
|
switch (mapPropKeyToFormInputType[key]) {
|
|
6342
6318
|
case 'slider':
|
|
6343
|
-
return (
|
|
6319
|
+
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
6344
6320
|
label,
|
|
6345
|
-
|
|
6321
|
+
React__default.createElement(Slider, __assign({}, inputPropsByPropKey[key], { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], valueLabelDisplay: "auto", onChange: function (_ev, value) {
|
|
6346
6322
|
if (value) {
|
|
6347
6323
|
setPaintProps(function (current) {
|
|
6348
6324
|
var _a;
|
|
@@ -6351,9 +6327,9 @@ function LayerPropertyForm(_a) {
|
|
|
6351
6327
|
}
|
|
6352
6328
|
} }))));
|
|
6353
6329
|
case 'numberfield':
|
|
6354
|
-
return (
|
|
6330
|
+
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
6355
6331
|
label,
|
|
6356
|
-
|
|
6332
|
+
React__default.createElement(TextField, { inputProps: { inputMode: 'decimal', pattern: '[0-9]*' }, value: paintProps[key], onChange: function (ev) {
|
|
6357
6333
|
var _a;
|
|
6358
6334
|
if ((_a = ev === null || ev === void 0 ? void 0 : ev.target) === null || _a === void 0 ? void 0 : _a.value) {
|
|
6359
6335
|
setPaintProps(function (current) {
|
|
@@ -6363,42 +6339,42 @@ function LayerPropertyForm(_a) {
|
|
|
6363
6339
|
}
|
|
6364
6340
|
} })));
|
|
6365
6341
|
case 'colorpicker':
|
|
6366
|
-
return (
|
|
6342
|
+
return (React__default.createElement(React__default.Fragment, { key: key },
|
|
6367
6343
|
label,
|
|
6368
|
-
|
|
6369
|
-
|
|
6344
|
+
React__default.createElement(Box, { sx: { '& > div': { width: 'initial !important' } } },
|
|
6345
|
+
React__default.createElement(PaintPropsColorPicker, { key: key, value: paintProps[key], propKey: key, setPaintProps: setPaintProps }))));
|
|
6370
6346
|
}
|
|
6371
6347
|
}
|
|
6372
6348
|
return null;
|
|
6373
6349
|
}, [paintProps]);
|
|
6374
|
-
return (
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6350
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
6351
|
+
React__default.createElement(PaperStyled, null,
|
|
6352
|
+
React__default.createElement(ListItem$1, { key: key + '_paintPropForm' },
|
|
6353
|
+
React__default.createElement(BoxStyled, null, Object.keys(paintProps).map(function (el) { return getFormInputByType(el); }))))));
|
|
6378
6354
|
}
|
|
6379
6355
|
|
|
6380
|
-
var ListItemStyled =
|
|
6356
|
+
var ListItemStyled = styled(ListItem$1)(function (configurable) { return ({
|
|
6381
6357
|
paddingRight: configurable ? '56px' : 0,
|
|
6382
6358
|
paddingLeft: 0,
|
|
6383
6359
|
paddingTop: 0,
|
|
6384
6360
|
paddingBottom: '4px',
|
|
6385
6361
|
}); });
|
|
6386
|
-
var TuneIconButton$1 =
|
|
6362
|
+
var TuneIconButton$1 = styled(IconButton$1)({
|
|
6387
6363
|
padding: '4px',
|
|
6388
6364
|
marginTop: '-3px',
|
|
6389
6365
|
});
|
|
6390
|
-
var CheckboxListItemIcon =
|
|
6366
|
+
var CheckboxListItemIcon = styled(ListItemIcon)({
|
|
6391
6367
|
minWidth: '30px',
|
|
6392
6368
|
});
|
|
6393
|
-
var CheckboxStyled =
|
|
6369
|
+
var CheckboxStyled = styled(Checkbox)({
|
|
6394
6370
|
padding: 0,
|
|
6395
6371
|
});
|
|
6396
6372
|
function LayerListItemVectorLayer(_a) {
|
|
6397
6373
|
var configurable = _a.configurable, vtProps = _a.vtProps, setVtProps = _a.setVtProps, id = _a.id, props = __rest(_a, ["configurable", "vtProps", "setVtProps", "id"]);
|
|
6398
|
-
var _b =
|
|
6399
|
-
var _c =
|
|
6400
|
-
var _d =
|
|
6401
|
-
|
|
6374
|
+
var _b = useState(false), paintPropsFormVisible = _b[0], setPaintPropsFormVisible = _b[1];
|
|
6375
|
+
var _c = useState(true), visible = _c[0], setVisible = _c[1];
|
|
6376
|
+
var _d = useState(vtProps.layers[id].paint), paintProps = _d[0], setPaintProps = _d[1];
|
|
6377
|
+
useEffect(function () {
|
|
6402
6378
|
var _a, _b, _c, _d, _e, _f;
|
|
6403
6379
|
if (!setVtProps ||
|
|
6404
6380
|
(typeof ((_b = (_a = vtProps.layers[id]) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.visibility) === 'undefined' && visible) ||
|
|
@@ -6414,10 +6390,10 @@ function LayerListItemVectorLayer(_a) {
|
|
|
6414
6390
|
}
|
|
6415
6391
|
setVtProps(__assign(__assign({}, vtProps), { layers: _layers }));
|
|
6416
6392
|
}, [visible, id, setVtProps, vtProps]);
|
|
6417
|
-
|
|
6393
|
+
useEffect(function () {
|
|
6418
6394
|
setVisible(!!props.visibleMaster);
|
|
6419
6395
|
}, [props.visibleMaster]);
|
|
6420
|
-
|
|
6396
|
+
useEffect(function () {
|
|
6421
6397
|
if (!setVtProps)
|
|
6422
6398
|
return;
|
|
6423
6399
|
if (JSON.stringify(paintProps) !== JSON.stringify(vtProps.layers[id].paint)) {
|
|
@@ -6427,49 +6403,49 @@ function LayerListItemVectorLayer(_a) {
|
|
|
6427
6403
|
setVtProps(__assign(__assign({}, vtProps), { layers: _layers }));
|
|
6428
6404
|
}
|
|
6429
6405
|
}, [paintProps, id, setVtProps, vtProps]);
|
|
6430
|
-
return (
|
|
6431
|
-
|
|
6406
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
6407
|
+
React__default.createElement(ListItemStyled, { key: id, secondaryAction: configurable ? (React__default.createElement(TuneIconButton$1, { edge: "end", "aria-label": "comments", onClick: function () {
|
|
6432
6408
|
setPaintPropsFormVisible(function (current) {
|
|
6433
6409
|
return !current;
|
|
6434
6410
|
});
|
|
6435
6411
|
} },
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6412
|
+
React__default.createElement(TuneIcon, null))) : undefined },
|
|
6413
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
6414
|
+
React__default.createElement(CheckboxStyled, { checked: visible, onClick: function () {
|
|
6439
6415
|
setVisible(function (val) { return !val; });
|
|
6440
6416
|
} })),
|
|
6441
|
-
|
|
6442
|
-
configurable && paintPropsFormVisible && (
|
|
6417
|
+
React__default.createElement(ListItemText$1, { primary: vtProps.layers[id].id, variant: "layerlist" })),
|
|
6418
|
+
configurable && paintPropsFormVisible && (React__default.createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: vtProps.layers[id].type }))));
|
|
6443
6419
|
}
|
|
6444
6420
|
LayerListItemVectorLayer.defaultProps = {
|
|
6445
6421
|
configurable: true,
|
|
6446
6422
|
};
|
|
6447
6423
|
|
|
6448
|
-
var TuneIconButton =
|
|
6424
|
+
var TuneIconButton = styled(IconButton$1)({
|
|
6449
6425
|
padding: '4px',
|
|
6450
6426
|
marginTop: '-3px',
|
|
6451
6427
|
});
|
|
6452
|
-
var DeleteIconButton =
|
|
6428
|
+
var DeleteIconButton = styled(IconButton$1)({
|
|
6453
6429
|
marginLeft: '20px',
|
|
6454
6430
|
});
|
|
6455
6431
|
function LayerListItem(_a) {
|
|
6456
6432
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
6457
6433
|
var layerComponent = _a.layerComponent, visible = _a.visible, type = _a.type, name = _a.name, description = _a.description, configurable = _a.configurable, setLayerState = _a.setLayerState, props = __rest(_a, ["layerComponent", "visible", "type", "name", "description", "configurable", "setLayerState"]);
|
|
6458
|
-
var _r =
|
|
6459
|
-
var _s =
|
|
6460
|
-
var _t =
|
|
6461
|
-
var deletedRef =
|
|
6462
|
-
var visibleRef =
|
|
6434
|
+
var _r = useState(true), localVisible = _r[0], setLocalVisible = _r[1];
|
|
6435
|
+
var _s = useState(false), paintPropsFormVisible = _s[0], setPaintPropsFormVisible = _s[1];
|
|
6436
|
+
var _t = useState(false), showDeletionConfirmationDialog = _t[0], setShowDeletionConfirmationDialog = _t[1];
|
|
6437
|
+
var deletedRef = useRef(false);
|
|
6438
|
+
var visibleRef = useRef(visible);
|
|
6463
6439
|
// this state variable is used for layer components that provide a paint attribute
|
|
6464
|
-
var _u =
|
|
6440
|
+
var _u = useState(((_b = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _b === void 0 ? void 0 : _b.paint) || ((_d = (_c = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.paint) ||
|
|
6465
6441
|
getDefaultPaintPropsByType(((_e = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _e === void 0 ? void 0 : _e.type) || getDefaulLayerTypeByGeometry(layerComponent.props.geojson))), paintProps = _u[0], setPaintProps = _u[1];
|
|
6466
|
-
var _visible =
|
|
6442
|
+
var _visible = useMemo(function () {
|
|
6467
6443
|
if (!visible) {
|
|
6468
6444
|
return false;
|
|
6469
6445
|
}
|
|
6470
6446
|
return localVisible;
|
|
6471
6447
|
}, [visible, localVisible]);
|
|
6472
|
-
|
|
6448
|
+
useEffect(function () {
|
|
6473
6449
|
var _a, _b, _c;
|
|
6474
6450
|
if (!setLayerState || !((_a = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _a === void 0 ? void 0 : _a.layers) || _visible === visibleRef.current)
|
|
6475
6451
|
return;
|
|
@@ -6495,7 +6471,7 @@ function LayerListItem(_a) {
|
|
|
6495
6471
|
break;
|
|
6496
6472
|
}
|
|
6497
6473
|
}, [_visible, setLayerState, layerComponent]);
|
|
6498
|
-
|
|
6474
|
+
useEffect(function () {
|
|
6499
6475
|
var _a, _b;
|
|
6500
6476
|
if (!setLayerState || deletedRef.current || !paintProps || ((_a = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _a === void 0 ? void 0 : _a.layers))
|
|
6501
6477
|
return;
|
|
@@ -6503,17 +6479,17 @@ function LayerListItem(_a) {
|
|
|
6503
6479
|
return;
|
|
6504
6480
|
setLayerState(__assign(__assign({}, layerComponent.props), { paint: paintProps }));
|
|
6505
6481
|
}, [paintProps, setLayerState, (_f = layerComponent.props) === null || _f === void 0 ? void 0 : _f.paint]);
|
|
6506
|
-
var _layerComponent =
|
|
6482
|
+
var _layerComponent = useMemo(function () {
|
|
6507
6483
|
var _a;
|
|
6508
6484
|
if (layerComponent && type === 'layer') {
|
|
6509
6485
|
switch (layerComponent.type.name) {
|
|
6510
6486
|
case 'MlWmsLayer':
|
|
6511
|
-
return
|
|
6487
|
+
return React__default.cloneElement(layerComponent, __assign(__assign({}, layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props), { visible: _visible }));
|
|
6512
6488
|
case 'MlVectorTileLayer':
|
|
6513
|
-
return
|
|
6489
|
+
return React__default.cloneElement(layerComponent, __assign({}, layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props));
|
|
6514
6490
|
default:
|
|
6515
6491
|
case 'MlGeoJsonLayer':
|
|
6516
|
-
return
|
|
6492
|
+
return React__default.cloneElement(layerComponent, {
|
|
6517
6493
|
layout: {
|
|
6518
6494
|
visibility: _visible ? 'visible' : 'none',
|
|
6519
6495
|
},
|
|
@@ -6521,9 +6497,9 @@ function LayerListItem(_a) {
|
|
|
6521
6497
|
});
|
|
6522
6498
|
}
|
|
6523
6499
|
}
|
|
6524
|
-
return
|
|
6500
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
6525
6501
|
}, [type, layerComponent, paintProps, _visible, (_g = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _g === void 0 ? void 0 : _g.layers, setLayerState]);
|
|
6526
|
-
var layerType =
|
|
6502
|
+
var layerType = useMemo(function () {
|
|
6527
6503
|
if (layerComponent && type === 'layer') {
|
|
6528
6504
|
if (layerComponent.props.type) {
|
|
6529
6505
|
return layerComponent.props.type;
|
|
@@ -6534,35 +6510,35 @@ function LayerListItem(_a) {
|
|
|
6534
6510
|
}
|
|
6535
6511
|
return undefined;
|
|
6536
6512
|
}, [layerComponent]);
|
|
6537
|
-
var listContent = (
|
|
6513
|
+
var listContent = (React__default.createElement(ListItemStyled, { sx: __assign({}, props.listItemSx), secondaryAction: configurable && ((_h = Object.keys(paintProps)) === null || _h === void 0 ? void 0 : _h.length) > 0 ? (React__default.createElement(React__default.Fragment, null, props === null || props === void 0 ? void 0 :
|
|
6538
6514
|
props.buttons,
|
|
6539
|
-
|
|
6515
|
+
React__default.createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
6540
6516
|
setPaintPropsFormVisible(function (current) {
|
|
6541
6517
|
return !current;
|
|
6542
6518
|
});
|
|
6543
6519
|
} },
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6520
|
+
React__default.createElement(Tune, null)))) : undefined },
|
|
6521
|
+
React__default.createElement(CheckboxListItemIcon, null,
|
|
6522
|
+
React__default.createElement(CheckboxStyled, { disabled: !visible, checked: localVisible, onClick: function () {
|
|
6547
6523
|
setLocalVisible(function (val) { return !val; });
|
|
6548
6524
|
} })),
|
|
6549
|
-
|
|
6550
|
-
return (
|
|
6551
|
-
props.sortable && props.layerId && !((_j = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _j === void 0 ? void 0 : _j.layers) && (
|
|
6525
|
+
React__default.createElement(ListItemText$1, { variant: "layerlist", primary: name, secondary: description, primaryTypographyProps: { overflow: 'hidden' } })));
|
|
6526
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
6527
|
+
props.sortable && props.layerId && !((_j = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _j === void 0 ? void 0 : _j.layers) && (React__default.createElement(SortableContainer, { layerId: props.layerId }, listContent)),
|
|
6552
6528
|
!props.sortable && !((_k = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _k === void 0 ? void 0 : _k.layers) && (listContent),
|
|
6553
6529
|
_layerComponent,
|
|
6554
6530
|
!((_l = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _l === void 0 ? void 0 : _l.layers) &&
|
|
6555
6531
|
Object.keys(paintProps).length > 0 &&
|
|
6556
6532
|
configurable &&
|
|
6557
|
-
paintPropsFormVisible && (
|
|
6558
|
-
props.showDeleteButton && (
|
|
6559
|
-
|
|
6533
|
+
paintPropsFormVisible && (React__default.createElement(React__default.Fragment, null,
|
|
6534
|
+
props.showDeleteButton && (React__default.createElement(React__default.Fragment, null,
|
|
6535
|
+
React__default.createElement(DeleteIconButton, { edge: "end", "aria-label": "delete", onClick: function () {
|
|
6560
6536
|
if (typeof setLayerState === 'function') {
|
|
6561
6537
|
setShowDeletionConfirmationDialog(true);
|
|
6562
6538
|
}
|
|
6563
6539
|
} },
|
|
6564
|
-
|
|
6565
|
-
showDeletionConfirmationDialog && (
|
|
6540
|
+
React__default.createElement(Delete, null)),
|
|
6541
|
+
showDeletionConfirmationDialog && (React__default.createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
|
|
6566
6542
|
if (typeof setLayerState === 'function') {
|
|
6567
6543
|
deletedRef.current = true;
|
|
6568
6544
|
setLayerState(false);
|
|
@@ -6571,20 +6547,20 @@ function LayerListItem(_a) {
|
|
|
6571
6547
|
}, onCancel: function () {
|
|
6572
6548
|
setShowDeletionConfirmationDialog(false);
|
|
6573
6549
|
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" })))),
|
|
6574
|
-
|
|
6575
|
-
((_m = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _m === void 0 ? void 0 : _m.layers) && (
|
|
6550
|
+
React__default.createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: layerType }))),
|
|
6551
|
+
((_m = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _m === void 0 ? void 0 : _m.layers) && (React__default.createElement(LayerListFolder, { visible: localVisible, setVisible: setLocalVisible, name: name }, (_q = (_p = (_o = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _o === void 0 ? void 0 : _o.layers) === null || _p === void 0 ? void 0 : _p.map) === null || _q === void 0 ? void 0 : _q.call(_p, function (_el, idx) { return (React__default.createElement(LayerListItemVectorLayer, { vtProps: layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props, setVtProps: setLayerState, id: '' + idx, key: '' + idx, visibleMaster: _visible })); })))));
|
|
6576
6552
|
}
|
|
6577
6553
|
LayerListItem.defaultProps = {
|
|
6578
6554
|
type: 'layer',
|
|
6579
6555
|
visible: true,
|
|
6580
6556
|
showDeleteButton: false,
|
|
6581
|
-
buttons:
|
|
6557
|
+
buttons: React__default.createElement(React__default.Fragment, null),
|
|
6582
6558
|
};
|
|
6583
6559
|
|
|
6584
6560
|
var sketchTools = [
|
|
6585
|
-
{ name: 'Point', mode: 'draw_point', icon:
|
|
6586
|
-
{ name: 'LineString', mode: 'draw_line_string', icon:
|
|
6587
|
-
{ name: 'Polygon', mode: 'draw_polygon', icon:
|
|
6561
|
+
{ name: 'Point', mode: 'draw_point', icon: React__default.createElement(ScatterPlotIcon, null) },
|
|
6562
|
+
{ name: 'LineString', mode: 'draw_line_string', icon: React__default.createElement(PolylineIcon, null) },
|
|
6563
|
+
{ name: 'Polygon', mode: 'draw_polygon', icon: React__default.createElement(PentagonIcon, null) },
|
|
6588
6564
|
];
|
|
6589
6565
|
/**
|
|
6590
6566
|
* Component template
|
|
@@ -6596,14 +6572,14 @@ var MlSketchTool = function (props) {
|
|
|
6596
6572
|
mapId: props.mapId,
|
|
6597
6573
|
waitForLayer: props.insertBeforeLayer,
|
|
6598
6574
|
});
|
|
6599
|
-
var _c =
|
|
6600
|
-
var _d =
|
|
6575
|
+
var _c = useState(), hoveredGeometry = _c[0], setHoveredGeometry = _c[1];
|
|
6576
|
+
var _d = useState({
|
|
6601
6577
|
activeGeometryIndex: undefined,
|
|
6602
6578
|
selectedGeoJson: undefined,
|
|
6603
6579
|
geometries: [],
|
|
6604
6580
|
drawMode: undefined,
|
|
6605
6581
|
}), sketchState = _d[0], setSketchState = _d[1];
|
|
6606
|
-
|
|
6582
|
+
useEffect(function () {
|
|
6607
6583
|
if (!(typeof props.onChange === 'function'))
|
|
6608
6584
|
return;
|
|
6609
6585
|
props.onChange(sketchState);
|
|
@@ -6627,7 +6603,7 @@ var MlSketchTool = function (props) {
|
|
|
6627
6603
|
});
|
|
6628
6604
|
};
|
|
6629
6605
|
var SketchToolButtons = function () {
|
|
6630
|
-
return (
|
|
6606
|
+
return (React__default.createElement(React__default.Fragment, null, sketchTools.map(function (el) {
|
|
6631
6607
|
var stateColor = function (theme) {
|
|
6632
6608
|
if (sketchState.drawMode === el.mode) {
|
|
6633
6609
|
return theme.palette.primary.main;
|
|
@@ -6644,20 +6620,20 @@ var MlSketchTool = function (props) {
|
|
|
6644
6620
|
return theme.palette.navigation.navColor;
|
|
6645
6621
|
}
|
|
6646
6622
|
};
|
|
6647
|
-
return (
|
|
6648
|
-
|
|
6649
|
-
|
|
6623
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
6624
|
+
React__default.createElement(Tooltip, { title: el.name },
|
|
6625
|
+
React__default.createElement(Button, { sx: __assign({ color: stateIconColor, backgroundColor: stateColor, '&:hover': {
|
|
6650
6626
|
backgroundColor: stateColor,
|
|
6651
6627
|
} }, buttonStyle), onClick: function () { return buttonClickHandler(el.mode); } }, el.icon))));
|
|
6652
6628
|
})));
|
|
6653
6629
|
};
|
|
6654
|
-
return (
|
|
6655
|
-
|
|
6630
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
6631
|
+
React__default.createElement(Box$2, { sx: {
|
|
6656
6632
|
zIndex: 104,
|
|
6657
6633
|
} },
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
sketchState.drawMode && (
|
|
6634
|
+
React__default.createElement(ButtonGroup, null,
|
|
6635
|
+
React__default.createElement(SketchToolButtons, null))),
|
|
6636
|
+
sketchState.drawMode && (React__default.createElement(MlFeatureEditor, { mode: sketchState.drawMode, geojson: sketchState.selectedGeoJson, onChange: function (feature) {
|
|
6661
6637
|
if (!(feature === null || feature === void 0 ? void 0 : feature[0]))
|
|
6662
6638
|
return;
|
|
6663
6639
|
setSketchState(function (_sketchState) {
|
|
@@ -6676,11 +6652,11 @@ var MlSketchTool = function (props) {
|
|
|
6676
6652
|
}, onFinish: function () {
|
|
6677
6653
|
setSketchState(function (_sketchState) { return (__assign(__assign({}, _sketchState), { drawMode: undefined, activeGeometryIndex: undefined, selectedGeoJson: undefined })); });
|
|
6678
6654
|
} })),
|
|
6679
|
-
|
|
6680
|
-
sketchState.geometries.map(function (el) { return (
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6655
|
+
React__default.createElement(List, { sx: { zIndex: 105, marginBottom: '-10px' } },
|
|
6656
|
+
sketchState.geometries.map(function (el) { return (React__default.createElement(React__default.Fragment, null,
|
|
6657
|
+
React__default.createElement(Box$2, { key: el.id, sx: { display: 'flex', flexDirection: 'column' } },
|
|
6658
|
+
React__default.createElement("br", null),
|
|
6659
|
+
React__default.createElement(Box$2, { flexDirection: 'row', sx: {
|
|
6684
6660
|
'&:hover': {
|
|
6685
6661
|
backgroundColor: 'rgb(177, 177, 177, 0.2)',
|
|
6686
6662
|
},
|
|
@@ -6690,28 +6666,28 @@ var MlSketchTool = function (props) {
|
|
|
6690
6666
|
}, onMouseLeave: function () {
|
|
6691
6667
|
setHoveredGeometry(undefined);
|
|
6692
6668
|
} },
|
|
6693
|
-
|
|
6694
|
-
|
|
6669
|
+
React__default.createElement(LayerListItem, { listItemSx: buttonStyle, configurable: true, layerComponent: React__default.createElement(MlGeoJsonLayer, { mapId: props.mapId, geojson: el, layerId: String(el.id) }), type: 'layer', name: String(el.id), description: el.geometry.type }),
|
|
6670
|
+
React__default.createElement(Box$2, { sx: {
|
|
6695
6671
|
padding: '3px 30px',
|
|
6696
6672
|
} },
|
|
6697
|
-
|
|
6698
|
-
|
|
6673
|
+
React__default.createElement(ButtonGroup, { size: "small" },
|
|
6674
|
+
React__default.createElement(Button, { onClick: function () {
|
|
6699
6675
|
var _a;
|
|
6700
6676
|
(_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.map.setCenter(el.geometry.type === 'Point'
|
|
6701
6677
|
? el.geometry.coordinates
|
|
6702
|
-
:
|
|
6678
|
+
: turf.centerOfMass(el).geometry.coordinates);
|
|
6703
6679
|
} },
|
|
6704
|
-
|
|
6705
|
-
|
|
6680
|
+
React__default.createElement(GpsFixedIcon, null)),
|
|
6681
|
+
React__default.createElement(Button, { sx: buttonStyle, onClick: function () {
|
|
6706
6682
|
setSketchState(function (_sketchState) { return (__assign(__assign({}, _sketchState), { selectedGeoJson: el, activeGeometryIndex: _sketchState.geometries.indexOf(el), drawMode: 'simple_select' })); });
|
|
6707
6683
|
} },
|
|
6708
|
-
|
|
6709
|
-
|
|
6684
|
+
React__default.createElement(EditIcon, null)),
|
|
6685
|
+
React__default.createElement(Button, { sx: buttonStyle, onClick: function () {
|
|
6710
6686
|
removeGeoJson(el);
|
|
6711
6687
|
setHoveredGeometry(undefined);
|
|
6712
6688
|
} },
|
|
6713
|
-
|
|
6714
|
-
hoveredGeometry && (
|
|
6689
|
+
React__default.createElement(DeleteIcon, null)))))))); }),
|
|
6690
|
+
hoveredGeometry && (React__default.createElement(MlGeoJsonLayer, { mapId: props.mapId, geojson: { type: 'FeatureCollection', features: [hoveredGeometry] }, layerId: 'highlightBorder', defaultPaintOverrides: {
|
|
6715
6691
|
circle: {
|
|
6716
6692
|
'circle-color': '#dd9900',
|
|
6717
6693
|
'circle-opacity': 0.4,
|
|
@@ -6727,7 +6703,7 @@ var MlSketchTool = function (props) {
|
|
|
6727
6703
|
'fill-opacity': 0.4
|
|
6728
6704
|
},
|
|
6729
6705
|
} }))),
|
|
6730
|
-
sketchState.drawMode === 'simple_select' && (
|
|
6706
|
+
sketchState.drawMode === 'simple_select' && (React__default.createElement(Typography, { sx: { fontSize: '0.6em' } },
|
|
6731
6707
|
"Edit ", (_b = (_a = sketchState.selectedGeoJson) === null || _a === void 0 ? void 0 : _a.geometry) === null || _b === void 0 ? void 0 :
|
|
6732
6708
|
_b.type))));
|
|
6733
6709
|
};
|
|
@@ -6743,27 +6719,27 @@ MlSketchTool.defaultProps = {
|
|
|
6743
6719
|
var useCameraFollowPath = function (props) {
|
|
6744
6720
|
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
6745
6721
|
// without the requirement of adding it to the dependency list (ignore the false eslint exhaustive deps warning)
|
|
6746
|
-
var initializedRef =
|
|
6747
|
-
var pause =
|
|
6748
|
-
var zoom =
|
|
6749
|
-
var pitch =
|
|
6750
|
-
var step =
|
|
6751
|
-
var speed =
|
|
6752
|
-
var timeoutId =
|
|
6722
|
+
var initializedRef = useRef(false);
|
|
6723
|
+
var pause = useRef(props.pause);
|
|
6724
|
+
var zoom = useRef(props.zoom);
|
|
6725
|
+
var pitch = useRef(props.pitch);
|
|
6726
|
+
var step = useRef(1);
|
|
6727
|
+
var speed = useRef(props.speed);
|
|
6728
|
+
var timeoutId = useRef();
|
|
6753
6729
|
var kmPerStep = props.kmPerStep || 0.01;
|
|
6754
|
-
var routeDistance =
|
|
6730
|
+
var routeDistance = turf.lineDistance(props.route);
|
|
6755
6731
|
var stepDuration = props.stepDuration || 70;
|
|
6756
6732
|
var mapHook = useMap({
|
|
6757
6733
|
mapId: props.mapId,
|
|
6758
6734
|
waitForLayer: props.insertBeforeLayer,
|
|
6759
6735
|
});
|
|
6760
|
-
|
|
6736
|
+
useEffect(function () {
|
|
6761
6737
|
pause.current = props.pause;
|
|
6762
6738
|
if (!pause.current) {
|
|
6763
6739
|
play();
|
|
6764
6740
|
}
|
|
6765
6741
|
}, [props.pause]);
|
|
6766
|
-
|
|
6742
|
+
useEffect(function () {
|
|
6767
6743
|
if (!mapHook.map)
|
|
6768
6744
|
return;
|
|
6769
6745
|
zoom.current = props.zoom;
|
|
@@ -6771,7 +6747,7 @@ var useCameraFollowPath = function (props) {
|
|
|
6771
6747
|
mapHook.map.map.setZoom(zoom.current);
|
|
6772
6748
|
}
|
|
6773
6749
|
}, [mapHook.map, props.zoom]);
|
|
6774
|
-
|
|
6750
|
+
useEffect(function () {
|
|
6775
6751
|
if (!mapHook.map)
|
|
6776
6752
|
return;
|
|
6777
6753
|
pitch.current = props.pitch;
|
|
@@ -6779,10 +6755,10 @@ var useCameraFollowPath = function (props) {
|
|
|
6779
6755
|
mapHook.map.map.setPitch(pitch.current);
|
|
6780
6756
|
}
|
|
6781
6757
|
}, [mapHook.map, props.pitch]);
|
|
6782
|
-
|
|
6758
|
+
useEffect(function () {
|
|
6783
6759
|
speed.current = props.speed;
|
|
6784
6760
|
}, [props.speed]);
|
|
6785
|
-
var disableInteractivity =
|
|
6761
|
+
var disableInteractivity = useCallback(function () {
|
|
6786
6762
|
if (!mapHook.map)
|
|
6787
6763
|
return;
|
|
6788
6764
|
mapHook.map.map['scrollZoom'].disable();
|
|
@@ -6793,7 +6769,7 @@ var useCameraFollowPath = function (props) {
|
|
|
6793
6769
|
mapHook.map.map['doubleClickZoom'].disable();
|
|
6794
6770
|
mapHook.map.map['touchZoomRotate'].disable();
|
|
6795
6771
|
}, [mapHook.map]);
|
|
6796
|
-
var enableInteractivity =
|
|
6772
|
+
var enableInteractivity = useCallback(function () {
|
|
6797
6773
|
if (!mapHook.map)
|
|
6798
6774
|
return;
|
|
6799
6775
|
mapHook.map.map['scrollZoom'].enable();
|
|
@@ -6807,7 +6783,7 @@ var useCameraFollowPath = function (props) {
|
|
|
6807
6783
|
function centerRoute() {
|
|
6808
6784
|
if (!mapHook.map || !props.route)
|
|
6809
6785
|
return;
|
|
6810
|
-
var bbox =
|
|
6786
|
+
var bbox = turf.bbox(props.route);
|
|
6811
6787
|
var bounds;
|
|
6812
6788
|
if (bbox && bbox.length > 3) {
|
|
6813
6789
|
bounds = [
|
|
@@ -6825,12 +6801,12 @@ var useCameraFollowPath = function (props) {
|
|
|
6825
6801
|
if (typeof zoom.current !== 'undefined' && mapHook.map.map.getZoom() !== zoom.current) {
|
|
6826
6802
|
mapHook.map.map.setZoom(zoom.current);
|
|
6827
6803
|
}
|
|
6828
|
-
var alongRoutelati =
|
|
6804
|
+
var alongRoutelati = turf.along(props.route, step.current * kmPerStep).geometry
|
|
6829
6805
|
.coordinates;
|
|
6830
6806
|
if (step.current * kmPerStep < routeDistance) {
|
|
6831
6807
|
mapHook.map.map.easeTo({
|
|
6832
6808
|
center: alongRoutelati,
|
|
6833
|
-
bearing:
|
|
6809
|
+
bearing: turf.bearing(turf.point([mapHook.map.map.getCenter().lng, mapHook.map.map.getCenter().lat]), turf.point(alongRoutelati)),
|
|
6834
6810
|
duration: stepDuration,
|
|
6835
6811
|
essential: true,
|
|
6836
6812
|
});
|
|
@@ -6864,13 +6840,13 @@ var useCameraFollowPath = function (props) {
|
|
|
6864
6840
|
enableInteractivity();
|
|
6865
6841
|
step.current = 1;
|
|
6866
6842
|
}
|
|
6867
|
-
|
|
6843
|
+
useEffect(function () {
|
|
6868
6844
|
if (!mapHook.map || initializedRef.current)
|
|
6869
6845
|
return;
|
|
6870
6846
|
initializedRef.current = true;
|
|
6871
6847
|
centerRoute();
|
|
6872
6848
|
}, [mapHook.map]);
|
|
6873
|
-
|
|
6849
|
+
useEffect(function () {
|
|
6874
6850
|
return function () {
|
|
6875
6851
|
if (timeoutId.current) {
|
|
6876
6852
|
clearTimeout(timeoutId.current);
|
|
@@ -6889,7 +6865,7 @@ useCameraFollowPath.defaultProps = {
|
|
|
6889
6865
|
|
|
6890
6866
|
function useLayerFilter(props) {
|
|
6891
6867
|
var mapHook = useMap({ mapId: props.mapId });
|
|
6892
|
-
|
|
6868
|
+
useEffect(function () {
|
|
6893
6869
|
if (!mapHook.map || !props.layerId || !props.filter)
|
|
6894
6870
|
return;
|
|
6895
6871
|
if (mapHook.map.map.getLayer(props.layerId)) {
|
|
@@ -6922,7 +6898,7 @@ function useLayerEvent(props) {
|
|
|
6922
6898
|
var mapHook = useMap({
|
|
6923
6899
|
mapId: props.mapId
|
|
6924
6900
|
});
|
|
6925
|
-
|
|
6901
|
+
useEffect(function () {
|
|
6926
6902
|
if (!mapHook.map) return true;
|
|
6927
6903
|
if (typeof props.condition !== 'undefined' && props.condition === false) return;
|
|
6928
6904
|
//console.log('useLayerEvent');
|
|
@@ -6955,7 +6931,7 @@ function useLayerEvent(props) {
|
|
|
6955
6931
|
}
|
|
6956
6932
|
|
|
6957
6933
|
var useLayerContext = function () {
|
|
6958
|
-
var layerContext =
|
|
6934
|
+
var layerContext = useContext(LayerContext);
|
|
6959
6935
|
return layerContext;
|
|
6960
6936
|
};
|
|
6961
6937
|
|
|
@@ -6964,7 +6940,7 @@ var useLayerContext = function () {
|
|
|
6964
6940
|
*
|
|
6965
6941
|
*/
|
|
6966
6942
|
var useAddProtocol = function (props) {
|
|
6967
|
-
|
|
6943
|
+
useEffect(function () {
|
|
6968
6944
|
if (!props.protocol || typeof props.handler !== 'function')
|
|
6969
6945
|
return;
|
|
6970
6946
|
maplibregl.addProtocol(props.protocol, props.handler);
|
|
@@ -7031,7 +7007,7 @@ function convertCsv(filename, options) {
|
|
|
7031
7007
|
}
|
|
7032
7008
|
getProtocolData(filename).then(function (rawData) {
|
|
7033
7009
|
// Use the csv2geojson library to convert the CSV to GeoJSON
|
|
7034
|
-
|
|
7010
|
+
csv2geojson.csv2geojson(rawData, useOptions, function (err, data) {
|
|
7035
7011
|
if (err) {
|
|
7036
7012
|
reject(err);
|
|
7037
7013
|
}
|
|
@@ -7167,7 +7143,7 @@ function convertTopojson(params) {
|
|
|
7167
7143
|
result = {
|
|
7168
7144
|
type: 'FeatureCollection',
|
|
7169
7145
|
features: Object.keys(topoJsonData.objects).map(function (key) {
|
|
7170
|
-
return
|
|
7146
|
+
return feature(topoJsonData, key);
|
|
7171
7147
|
}),
|
|
7172
7148
|
};
|
|
7173
7149
|
result.features = reduceFeatures(result);
|
|
@@ -7209,7 +7185,7 @@ function convertXML(params) {
|
|
|
7209
7185
|
var newData = function () {
|
|
7210
7186
|
// use an extern converter for tcx files
|
|
7211
7187
|
if (params.protocolId === 'tcx') {
|
|
7212
|
-
return
|
|
7188
|
+
return externParser[params.protocolId](new DOMParser().parseFromString(rawData, 'text/xml'));
|
|
7213
7189
|
// use the projects gpxConverter function for gpx and kml files
|
|
7214
7190
|
}
|
|
7215
7191
|
else {
|
|
@@ -7256,8 +7232,8 @@ var useAddImage = function (props) {
|
|
|
7256
7232
|
var mapHook = useMap({
|
|
7257
7233
|
mapId: undefined,
|
|
7258
7234
|
});
|
|
7259
|
-
var initializedRef =
|
|
7260
|
-
|
|
7235
|
+
var initializedRef = useRef(false);
|
|
7236
|
+
useEffect(function () {
|
|
7261
7237
|
var _a;
|
|
7262
7238
|
if (!mapHook.map || initializedRef.current)
|
|
7263
7239
|
return;
|
|
@@ -7281,23 +7257,23 @@ useAddImage.defaultProps = {
|
|
|
7281
7257
|
mapId: undefined,
|
|
7282
7258
|
};
|
|
7283
7259
|
|
|
7284
|
-
var SimpleDataContext =
|
|
7260
|
+
var SimpleDataContext = React__default.createContext({});
|
|
7285
7261
|
var SimpleDataContextProvider = SimpleDataContext.Provider;
|
|
7286
7262
|
|
|
7287
7263
|
var SimpleDataProvider = function (props) {
|
|
7288
|
-
var _a =
|
|
7289
|
-
|
|
7264
|
+
var _a = useState(), data = _a[0], setData = _a[1];
|
|
7265
|
+
useEffect(function () {
|
|
7290
7266
|
if (!props.url)
|
|
7291
7267
|
return;
|
|
7292
7268
|
var data_promise = null;
|
|
7293
7269
|
if (props.format === "json") {
|
|
7294
|
-
data_promise =
|
|
7270
|
+
data_promise = d3.json(props.url);
|
|
7295
7271
|
}
|
|
7296
7272
|
else if (props.format === "csv") {
|
|
7297
|
-
data_promise =
|
|
7273
|
+
data_promise = d3.csv(props.url);
|
|
7298
7274
|
}
|
|
7299
7275
|
else if (props.format === "xml") {
|
|
7300
|
-
data_promise =
|
|
7276
|
+
data_promise = d3.xml(props.url);
|
|
7301
7277
|
}
|
|
7302
7278
|
if (data_promise) {
|
|
7303
7279
|
data_promise.then(function (received_data) {
|
|
@@ -7334,20 +7310,20 @@ var SimpleDataProvider = function (props) {
|
|
|
7334
7310
|
data: data,
|
|
7335
7311
|
setData: setData,
|
|
7336
7312
|
};
|
|
7337
|
-
return (
|
|
7313
|
+
return (React__default.createElement(SimpleDataContextProvider, { value: value }, props.children));
|
|
7338
7314
|
};
|
|
7339
7315
|
SimpleDataProvider.propTypes = {
|
|
7340
7316
|
children: PropTypes.node.isRequired,
|
|
7341
7317
|
};
|
|
7342
7318
|
|
|
7343
|
-
var ListStyled =
|
|
7319
|
+
var ListStyled = styled(List$1)({
|
|
7344
7320
|
marginTop: '15px',
|
|
7345
7321
|
});
|
|
7346
7322
|
function LayerList(props) {
|
|
7347
|
-
return
|
|
7323
|
+
return React__default.createElement(ListStyled, null, props === null || props === void 0 ? void 0 : props.children);
|
|
7348
7324
|
}
|
|
7349
7325
|
|
|
7350
|
-
var IconButtonStyled =
|
|
7326
|
+
var IconButtonStyled = styled(IconButton$1)({
|
|
7351
7327
|
padding: '4px',
|
|
7352
7328
|
marginTop: '-3px',
|
|
7353
7329
|
background: 'none',
|
|
@@ -7369,7 +7345,7 @@ function LayerListItemFactory(props) {
|
|
|
7369
7345
|
switch (layer.type) {
|
|
7370
7346
|
case 'geojson':
|
|
7371
7347
|
if ((_e = layer.config) === null || _e === void 0 ? void 0 : _e.geojson) {
|
|
7372
|
-
(_f = mapHook.map) === null || _f === void 0 ? void 0 : _f.fitBounds(
|
|
7348
|
+
(_f = mapHook.map) === null || _f === void 0 ? void 0 : _f.fitBounds(bbox((_g = layer.config) === null || _g === void 0 ? void 0 : _g.geojson), props.fitBoundsOptions);
|
|
7373
7349
|
}
|
|
7374
7350
|
else {
|
|
7375
7351
|
if (!layerSource) {
|
|
@@ -7383,7 +7359,7 @@ function LayerListItemFactory(props) {
|
|
|
7383
7359
|
(_j = mapHook.map) === null || _j === void 0 ? void 0 : _j.zoomTo(1);
|
|
7384
7360
|
_geojson.features = (_k = mapHook.map) === null || _k === void 0 ? void 0 : _k.querySourceFeatures(layerSource);
|
|
7385
7361
|
}
|
|
7386
|
-
_bbox =
|
|
7362
|
+
_bbox = bbox(_geojson);
|
|
7387
7363
|
}
|
|
7388
7364
|
break;
|
|
7389
7365
|
case 'vt':
|
|
@@ -7399,7 +7375,7 @@ function LayerListItemFactory(props) {
|
|
|
7399
7375
|
(_q = mapHook.map) === null || _q === void 0 ? void 0 : _q.fitBounds(_bbox, props.fitBoundsOptions);
|
|
7400
7376
|
}
|
|
7401
7377
|
}
|
|
7402
|
-
var orderLayers =
|
|
7378
|
+
var orderLayers = useMemo(function () {
|
|
7403
7379
|
var layerIds = __spreadArray(__spreadArray([
|
|
7404
7380
|
'order-background'
|
|
7405
7381
|
], __spreadArray([], layerContext.layers, true).map(function (_el, idx) { return 'content_order_' + idx; }), true), [
|
|
@@ -7407,59 +7383,59 @@ function LayerListItemFactory(props) {
|
|
|
7407
7383
|
], false);
|
|
7408
7384
|
return layerIds.reverse();
|
|
7409
7385
|
}, [layerContext.layers]);
|
|
7410
|
-
var layers =
|
|
7386
|
+
var layers = useMemo(function () {
|
|
7411
7387
|
if (props.layers)
|
|
7412
7388
|
return props.layers;
|
|
7413
7389
|
if (layerContext === null || layerContext === void 0 ? void 0 : layerContext.layers)
|
|
7414
7390
|
return layerContext.layers;
|
|
7415
7391
|
return [];
|
|
7416
7392
|
}, [props.layers, layerContext.layers]);
|
|
7417
|
-
var setLayers =
|
|
7393
|
+
var setLayers = useMemo(function () {
|
|
7418
7394
|
if (props.setLayers)
|
|
7419
7395
|
return props.setLayers;
|
|
7420
7396
|
return layerContext.setLayers;
|
|
7421
7397
|
}, [props.setLayers, layerContext.setLayers]);
|
|
7422
|
-
var pointerSensor =
|
|
7398
|
+
var pointerSensor = useSensor(PointerSensor, {
|
|
7423
7399
|
activationConstraint: {
|
|
7424
7400
|
distance: 5,
|
|
7425
7401
|
},
|
|
7426
7402
|
});
|
|
7427
|
-
var mouseSensor =
|
|
7403
|
+
var mouseSensor = useSensor(MouseSensor, {
|
|
7428
7404
|
activationConstraint: {
|
|
7429
7405
|
distance: 5,
|
|
7430
7406
|
},
|
|
7431
7407
|
});
|
|
7432
|
-
var sensors =
|
|
7408
|
+
var sensors = useSensors(mouseSensor, pointerSensor);
|
|
7433
7409
|
function dragEnd(event) {
|
|
7434
7410
|
var _a, _b, _c;
|
|
7435
7411
|
var dragLayerId = event.active.id;
|
|
7436
7412
|
var dragLayerNewPosition = (_c = (_b = (_a = event.over) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.sortable.index;
|
|
7437
7413
|
layerContext.moveLayer(String(dragLayerId), function () { return dragLayerNewPosition; });
|
|
7438
7414
|
}
|
|
7439
|
-
return (
|
|
7440
|
-
|
|
7441
|
-
((_a = layerContext === null || layerContext === void 0 ? void 0 : layerContext.symbolLayers) === null || _a === void 0 ? void 0 : _a.length) > 0 && (
|
|
7415
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7416
|
+
React__default.createElement(MlOrderLayers, { layerIds: orderLayers, insertBeforeLayer: "_background" }),
|
|
7417
|
+
((_a = layerContext === null || layerContext === void 0 ? void 0 : layerContext.symbolLayers) === null || _a === void 0 ? void 0 : _a.length) > 0 && (React__default.createElement(LayerListItem, { key: 'background_labels', layerComponent: React__default.createElement(MlVectorTileLayer, __assign({}, layerContext.vtLayerConfig, { layers: layerContext.symbolLayers, mapId: props === null || props === void 0 ? void 0 : props.mapId, insertBeforeLayer: 'order-labels' })), setLayerState: function (state) {
|
|
7442
7418
|
return layerContext.setSymbolLayers(state === null || state === void 0 ? void 0 : state.layers);
|
|
7443
7419
|
}, visible: true, configurable: true, type: "layer", name: "Labels" })),
|
|
7444
|
-
|
|
7445
|
-
|
|
7420
|
+
React__default.createElement(DndContext, { collisionDetection: closestCenter, sensors: sensors, onDragEnd: function (event) { return dragEnd(event); }, modifiers: [restrictToVerticalAxis] },
|
|
7421
|
+
React__default.createElement(SortableContext, { items: layers, strategy: verticalListSortingStrategy },
|
|
7446
7422
|
__spreadArray([], layers, true).map(function (layer, idx) {
|
|
7447
7423
|
var _a, _b, _c, _d, _e;
|
|
7448
7424
|
if (!(layer === null || layer === void 0 ? void 0 : layer.id))
|
|
7449
7425
|
return null;
|
|
7450
7426
|
switch (layer.type) {
|
|
7451
7427
|
case 'geojson':
|
|
7452
|
-
return (
|
|
7453
|
-
|
|
7428
|
+
return (React__default.createElement(LayerListItem, { key: layer.id, layerId: layer.id, sortable: props.sortable, name: (layer === null || layer === void 0 ? void 0 : layer.name) || ((_a = layer === null || layer === void 0 ? void 0 : layer.config) === null || _a === void 0 ? void 0 : _a.type) + ' layer' || 'unnamed layer', layerComponent: React__default.createElement(MlGeoJsonLayer, __assign({}, layer.config, { mapId: props === null || props === void 0 ? void 0 : props.mapId, layerId: layer.id, insertBeforeLayer: 'content_order_' + (layers.length - 1 - idx) })), buttons: React__default.createElement(React__default.Fragment, null,
|
|
7429
|
+
React__default.createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7454
7430
|
layerContext.moveDown(layer.id || '');
|
|
7455
7431
|
} },
|
|
7456
|
-
|
|
7457
|
-
|
|
7432
|
+
React__default.createElement(ArrowCircleDown, null)),
|
|
7433
|
+
React__default.createElement(IconButtonStyled, { disabled: idx === 0, onClick: function () {
|
|
7458
7434
|
layerContext.moveUp(layer.id || '');
|
|
7459
7435
|
} },
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7436
|
+
React__default.createElement(ArrowCircleUp, null)),
|
|
7437
|
+
React__default.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7438
|
+
React__default.createElement(CenterFocusWeak, null))), setLayerState: function (layerConfig) {
|
|
7463
7439
|
return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7464
7440
|
var _layers = __spreadArray([], current, true);
|
|
7465
7441
|
if (layerConfig === false) {
|
|
@@ -7472,8 +7448,8 @@ function LayerListItemFactory(props) {
|
|
|
7472
7448
|
});
|
|
7473
7449
|
}, configurable: true, showDeleteButton: true }));
|
|
7474
7450
|
case 'wms':
|
|
7475
|
-
return (
|
|
7476
|
-
|
|
7451
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7452
|
+
React__default.createElement(MlWmsLoader, __assign({}, layer.config, { key: layer.id, layerId: layer.id, sortable: props.sortable, mapId: props === null || props === void 0 ? void 0 : props.mapId, insertBeforeLayer: 'content_order_' + (layers.length - 1 - idx), onConfigChange: function (layerConfig) {
|
|
7477
7453
|
setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7478
7454
|
var _layers = __spreadArray([], current, true);
|
|
7479
7455
|
if (layerConfig === false) {
|
|
@@ -7495,30 +7471,30 @@ function LayerListItemFactory(props) {
|
|
|
7495
7471
|
}
|
|
7496
7472
|
return _layers;
|
|
7497
7473
|
});
|
|
7498
|
-
}, showDeleteButton: true, buttons:
|
|
7499
|
-
|
|
7474
|
+
}, showDeleteButton: true, buttons: React__default.createElement(React__default.Fragment, null,
|
|
7475
|
+
React__default.createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7500
7476
|
layerContext.moveDown(layer.id || '');
|
|
7501
7477
|
} },
|
|
7502
|
-
|
|
7503
|
-
|
|
7478
|
+
React__default.createElement(ArrowCircleDown, null)),
|
|
7479
|
+
React__default.createElement(IconButtonStyled, { disabled: idx === 0, onClick: function () {
|
|
7504
7480
|
layerContext.moveUp(layer.id || '');
|
|
7505
7481
|
} },
|
|
7506
|
-
|
|
7507
|
-
|
|
7508
|
-
|
|
7482
|
+
React__default.createElement(ArrowCircleUp, null)),
|
|
7483
|
+
React__default.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7484
|
+
React__default.createElement(CenterFocusWeak, null))) }))));
|
|
7509
7485
|
case 'vt':
|
|
7510
|
-
return (
|
|
7511
|
-
|
|
7512
|
-
|
|
7486
|
+
return (React__default.createElement(React__default.Fragment, { key: (layer === null || layer === void 0 ? void 0 : layer.id) + '_listItem' },
|
|
7487
|
+
React__default.createElement(LayerListItem, { key: layer.id, name: (layer === null || layer === void 0 ? void 0 : layer.name) || (layer === null || layer === void 0 ? void 0 : layer.type) + ' layer' || 'unnamed layer', layerComponent: React__default.createElement(MlVectorTileLayer, { layers: ((_c = layer === null || layer === void 0 ? void 0 : layer.config) === null || _c === void 0 ? void 0 : _c.layers) || [], key: layer.id, mapId: layer === null || layer === void 0 ? void 0 : layer.config.mapId, sourceOptions: (_d = layer === null || layer === void 0 ? void 0 : layer.config) === null || _d === void 0 ? void 0 : _d.sourceOptions, layerId: layer.id, url: (_e = layer === null || layer === void 0 ? void 0 : layer.config) === null || _e === void 0 ? void 0 : _e.url }), buttons: React__default.createElement(React__default.Fragment, null,
|
|
7488
|
+
React__default.createElement(IconButtonStyled, { key: layer.id + '_button1', disabled: idx === layers.length - 1, onClick: function () {
|
|
7513
7489
|
layerContext.moveDown(layer.id || '');
|
|
7514
7490
|
} },
|
|
7515
|
-
|
|
7516
|
-
|
|
7491
|
+
React__default.createElement(ArrowCircleDown, null)),
|
|
7492
|
+
React__default.createElement(IconButtonStyled, { key: layer.id + '_button2', disabled: idx === 0, onClick: function () {
|
|
7517
7493
|
layerContext.moveUp(layer.id || '');
|
|
7518
7494
|
} },
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7495
|
+
React__default.createElement(ArrowCircleUp, null)),
|
|
7496
|
+
React__default.createElement(IconButtonStyled, { onClick: function () { return fitLayer(layer); } },
|
|
7497
|
+
React__default.createElement(CenterFocusWeak, null))), setLayerState: function (layerConfig) {
|
|
7522
7498
|
return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7523
7499
|
var _layers = __spreadArray([], current, true);
|
|
7524
7500
|
if (layerConfig === false) {
|
|
@@ -7534,7 +7510,7 @@ function LayerListItemFactory(props) {
|
|
|
7534
7510
|
return null;
|
|
7535
7511
|
}
|
|
7536
7512
|
}),
|
|
7537
|
-
((_b = layerContext === null || layerContext === void 0 ? void 0 : layerContext.backgroundLayers) === null || _b === void 0 ? void 0 : _b.length) > 0 && (
|
|
7513
|
+
((_b = layerContext === null || layerContext === void 0 ? void 0 : layerContext.backgroundLayers) === null || _b === void 0 ? void 0 : _b.length) > 0 && (React__default.createElement(LayerListItem, { key: 'background_geometry', layerComponent: React__default.createElement(MlVectorTileLayer, __assign({}, layerContext.vtLayerConfig, { layers: layerContext.backgroundLayers, mapId: props === null || props === void 0 ? void 0 : props.mapId, insertBeforeLayer: 'order-background' })), setLayerState: function (state) {
|
|
7538
7514
|
layerContext.setBackgroundLayers(state === null || state === void 0 ? void 0 : state.layers);
|
|
7539
7515
|
}, visible: true, configurable: true, type: "layer", name: "Background" }))))));
|
|
7540
7516
|
}
|
|
@@ -7548,81 +7524,81 @@ var types$1 = [
|
|
|
7548
7524
|
'circle',
|
|
7549
7525
|
];
|
|
7550
7526
|
function GeoJsonLayerForm(props) {
|
|
7551
|
-
var _a =
|
|
7552
|
-
var configIsValid =
|
|
7527
|
+
var _a = React__default.useState({ type: 'circle' }), config = _a[0], setConfig = _a[1];
|
|
7528
|
+
var configIsValid = useMemo(function () {
|
|
7553
7529
|
if (!(config === null || config === void 0 ? void 0 : config.type) || !(config === null || config === void 0 ? void 0 : config.geojson))
|
|
7554
7530
|
return false;
|
|
7555
7531
|
return true;
|
|
7556
7532
|
}, [config]);
|
|
7557
|
-
return (
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7533
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7534
|
+
React__default.createElement(DialogTitle$1, null, "GeoJSON layer"),
|
|
7535
|
+
React__default.createElement(FormControl, { fullWidth: true },
|
|
7536
|
+
React__default.createElement(InputLabel, { id: "type-label" }, "Type"),
|
|
7537
|
+
React__default.createElement(Select, { labelId: "type-label", value: config.type, label: "Type", onChange: function (ev) {
|
|
7562
7538
|
return setConfig(function (current) { return (__assign(__assign({}, current), { type: ev.target.value })); });
|
|
7563
|
-
} }, types$1.map(function (type) { return (
|
|
7564
|
-
|
|
7565
|
-
|
|
7539
|
+
} }, types$1.map(function (type) { return (React__default.createElement(MenuItem, { key: type, value: type }, type)); }))),
|
|
7540
|
+
React__default.createElement(FormControl, { fullWidth: true },
|
|
7541
|
+
React__default.createElement(Button, { variant: "contained", component: "label", sx: { marginTop: '10px' } },
|
|
7566
7542
|
"Upload File",
|
|
7567
|
-
|
|
7543
|
+
React__default.createElement("input", { type: "file", hidden: true, onChange: function (ev) {
|
|
7568
7544
|
var _a;
|
|
7569
7545
|
(_a = ev.target.files) === null || _a === void 0 ? void 0 : _a[0].text().then(function (data) {
|
|
7570
7546
|
return setConfig(function (current) { return (__assign(__assign({}, current), { geojson: JSON.parse(data) })); });
|
|
7571
7547
|
});
|
|
7572
7548
|
} }))),
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7549
|
+
React__default.createElement(DialogActions$1, null,
|
|
7550
|
+
React__default.createElement(Button, { onClick: props.onCancel }, "Cancel"),
|
|
7551
|
+
React__default.createElement(Button, { disabled: !configIsValid, onClick: function () { return props.onSubmit(config); } }, "Add"))));
|
|
7576
7552
|
}
|
|
7577
7553
|
|
|
7578
7554
|
var LayerTypeForm = function (props) {
|
|
7579
|
-
return (
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
|
|
7555
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7556
|
+
React__default.createElement(DialogTitle$1, null, props.layerTypes.length > 1 ? "Select a layer type" : "Load new layer"),
|
|
7557
|
+
React__default.createElement(List$1, null, props.layerTypes.map(function (type, idx) { return (React__default.createElement(ListItem$1, { disableGutters: true, key: idx },
|
|
7558
|
+
React__default.createElement(ListItemButton, { autoFocus: true, onClick: function () {
|
|
7583
7559
|
props.onSelect(type);
|
|
7584
7560
|
} },
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7561
|
+
React__default.createElement(ListItemAvatar, null,
|
|
7562
|
+
React__default.createElement(Avatar, null,
|
|
7563
|
+
React__default.createElement(DynamicFeedIcon, null))),
|
|
7564
|
+
React__default.createElement(ListItemText$1, { primary: type })))); }))));
|
|
7589
7565
|
};
|
|
7590
7566
|
LayerTypeForm.defaultProps = {};
|
|
7591
7567
|
|
|
7592
7568
|
function WmsLayerForm(props) {
|
|
7593
|
-
var _a =
|
|
7594
|
-
var configIsValid =
|
|
7569
|
+
var _a = React__default.useState({ url: '' }), config = _a[0], setConfig = _a[1];
|
|
7570
|
+
var configIsValid = useMemo(function () {
|
|
7595
7571
|
if (!(config === null || config === void 0 ? void 0 : config.url))
|
|
7596
7572
|
return false;
|
|
7597
7573
|
return true;
|
|
7598
7574
|
}, [config]);
|
|
7599
|
-
return (
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7575
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7576
|
+
React__default.createElement(DialogTitle$1, null, "WMS layer"),
|
|
7577
|
+
React__default.createElement(DialogContent$1, null,
|
|
7578
|
+
React__default.createElement(FormControl, { fullWidth: true, sx: { marginTop: '10px' } },
|
|
7579
|
+
React__default.createElement(InputLabel, { htmlFor: "wms-url-input" }, "WMS URL"),
|
|
7580
|
+
React__default.createElement(OutlinedInput, { id: "wms-url-input", label: "WMS URL", value: config.url, onChange: function (ev) { return setConfig(__assign(__assign({}, config), { url: ev.target.value })); } }))),
|
|
7581
|
+
React__default.createElement(DialogActions$1, null,
|
|
7582
|
+
React__default.createElement(Button, { onClick: props.onCancel }, "Cancel"),
|
|
7583
|
+
React__default.createElement(Button, { disabled: !configIsValid, onClick: function () { return props.onSubmit(config); } }, "Add"))));
|
|
7608
7584
|
}
|
|
7609
7585
|
|
|
7610
7586
|
var optionFields$1 = ['latfield', 'lonfield', 'delimiter'];
|
|
7611
7587
|
function CSVOptionsFormular(props) {
|
|
7612
|
-
var _a =
|
|
7613
|
-
return (
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7588
|
+
var _a = useState(false), open = _a[0], setOpen = _a[1];
|
|
7589
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7590
|
+
React__default.createElement(Typography, null, " Options "),
|
|
7591
|
+
React__default.createElement(Button, { onClick: function () { return setOpen(!open); } }, open ? React__default.createElement(IndeterminateCheckBoxIcon, null) : React__default.createElement(AddBoxIcon, null)),
|
|
7592
|
+
React__default.createElement(List$1, null, open &&
|
|
7617
7593
|
(optionFields$1 === null || optionFields$1 === void 0 ? void 0 : optionFields$1.map(function (el) {
|
|
7618
|
-
return (
|
|
7619
|
-
|
|
7620
|
-
|
|
7594
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7595
|
+
React__default.createElement(ListItem$1, null,
|
|
7596
|
+
React__default.createElement(Typography, null,
|
|
7621
7597
|
" ",
|
|
7622
7598
|
el,
|
|
7623
7599
|
" ")),
|
|
7624
|
-
|
|
7625
|
-
|
|
7600
|
+
React__default.createElement(ListItem$1, null,
|
|
7601
|
+
React__default.createElement(TextField, { size: "small", onChange: function (ev) {
|
|
7626
7602
|
var newObject = {};
|
|
7627
7603
|
newObject[el] = ev.target.value;
|
|
7628
7604
|
props.setter(newObject);
|
|
@@ -7638,19 +7614,19 @@ var optionFields = [
|
|
|
7638
7614
|
'suppressWay',
|
|
7639
7615
|
];
|
|
7640
7616
|
function OsmOptionsFomular(props) {
|
|
7641
|
-
var _a =
|
|
7642
|
-
return (
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7617
|
+
var _a = useState(false), open = _a[0], setOpen = _a[1];
|
|
7618
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7619
|
+
React__default.createElement(Typography, null, " Options "),
|
|
7620
|
+
React__default.createElement(Button, { onClick: function () { return setOpen(!open); } }, open ? React__default.createElement(IndeterminateCheckBoxIcon, null) : React__default.createElement(AddBoxIcon, null)),
|
|
7621
|
+
React__default.createElement(List$1, null, open &&
|
|
7646
7622
|
(optionFields === null || optionFields === void 0 ? void 0 : optionFields.map(function (el) {
|
|
7647
|
-
return (
|
|
7648
|
-
|
|
7649
|
-
|
|
7623
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7624
|
+
React__default.createElement(ListItem$1, null,
|
|
7625
|
+
React__default.createElement(Typography, null,
|
|
7650
7626
|
" ",
|
|
7651
7627
|
el,
|
|
7652
7628
|
" "),
|
|
7653
|
-
|
|
7629
|
+
React__default.createElement(Checkbox, { onChange: function (ev) {
|
|
7654
7630
|
var newObject = {};
|
|
7655
7631
|
newObject[el] = ev.target.value === 'on' ? true : false;
|
|
7656
7632
|
props.setter(newObject);
|
|
@@ -7669,17 +7645,17 @@ var handlers = {
|
|
|
7669
7645
|
};
|
|
7670
7646
|
var types = ['fill', 'line', 'circle'];
|
|
7671
7647
|
function ProtocolHandlerLayerForm(props) {
|
|
7672
|
-
var _a =
|
|
7673
|
-
var _b =
|
|
7674
|
-
var _c =
|
|
7675
|
-
var _d =
|
|
7648
|
+
var _a = useState({ type: 'circle' }), config = _a[0], setConfig = _a[1];
|
|
7649
|
+
var _b = useState(), fileName = _b[0], setFileName = _b[1];
|
|
7650
|
+
var _c = useState(), filePath = _c[0], setFilePath = _c[1];
|
|
7651
|
+
var _d = useState({}), optionsObject = _d[0], setOptionsObject = _d[1];
|
|
7676
7652
|
var mapHook = useMap({ mapId: props.mapId });
|
|
7677
7653
|
var optionsURL = '?' + new URLSearchParams(optionsObject).toString();
|
|
7678
7654
|
useAddProtocol({
|
|
7679
7655
|
protocol: props.originType,
|
|
7680
7656
|
handler: handlers[props.originType],
|
|
7681
7657
|
});
|
|
7682
|
-
var configIsValid =
|
|
7658
|
+
var configIsValid = useMemo(function () {
|
|
7683
7659
|
if (!(config === null || config === void 0 ? void 0 : config.type))
|
|
7684
7660
|
return false;
|
|
7685
7661
|
if (filePath && fileName)
|
|
@@ -7687,7 +7663,7 @@ function ProtocolHandlerLayerForm(props) {
|
|
|
7687
7663
|
else
|
|
7688
7664
|
return false;
|
|
7689
7665
|
}, [config, filePath, fileName]);
|
|
7690
|
-
|
|
7666
|
+
useEffect(function () {
|
|
7691
7667
|
var _a, _b;
|
|
7692
7668
|
if (typeof fileName !== 'undefined' && typeof filePath !== 'undefined') {
|
|
7693
7669
|
if (!((_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.getSource(fileName)))
|
|
@@ -7700,7 +7676,7 @@ function ProtocolHandlerLayerForm(props) {
|
|
|
7700
7676
|
return function () { };
|
|
7701
7677
|
}, [fileName, mapHook.map, filePath]);
|
|
7702
7678
|
//the temporally storage adress of the uploaded file will be revoked, after source and layer are loaded in the map
|
|
7703
|
-
|
|
7679
|
+
useEffect(function () {
|
|
7704
7680
|
var _a;
|
|
7705
7681
|
if (filePath && fileName && ((_a = mapHook.map) === null || _a === void 0 ? void 0 : _a.getLayer(fileName))) {
|
|
7706
7682
|
URL.revokeObjectURL(filePath);
|
|
@@ -7710,19 +7686,19 @@ function ProtocolHandlerLayerForm(props) {
|
|
|
7710
7686
|
var newOptions = __assign(__assign({}, optionsObject), newObject);
|
|
7711
7687
|
return setOptionsObject(newOptions);
|
|
7712
7688
|
}
|
|
7713
|
-
return (
|
|
7714
|
-
|
|
7689
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7690
|
+
React__default.createElement(DialogTitle$1, null,
|
|
7715
7691
|
"Layer from ",
|
|
7716
7692
|
props.originType),
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7693
|
+
React__default.createElement(FormControl, { fullWidth: true },
|
|
7694
|
+
React__default.createElement(InputLabel, { id: "type-label" }, "Type"),
|
|
7695
|
+
React__default.createElement(Select, { labelId: "type-label", value: config.type, label: "Type", onChange: function (ev) {
|
|
7720
7696
|
return setConfig(function (current) { return (__assign(__assign({}, current), { type: ev.target.value })); });
|
|
7721
|
-
} }, types.map(function (type) { return (
|
|
7722
|
-
|
|
7723
|
-
|
|
7697
|
+
} }, types.map(function (type) { return (React__default.createElement(MenuItem, { key: type, value: type }, type)); }))),
|
|
7698
|
+
React__default.createElement(FormControl, { fullWidth: true },
|
|
7699
|
+
React__default.createElement(Button, { variant: "contained", component: "label", sx: { marginTop: '10px' } },
|
|
7724
7700
|
"Select origin file",
|
|
7725
|
-
|
|
7701
|
+
React__default.createElement("input", { type: "file", hidden: true, accept: props.originType, onChange: function (ev) {
|
|
7726
7702
|
var _a, _b, _c;
|
|
7727
7703
|
setFileName((_a = ev.target.files) === null || _a === void 0 ? void 0 : _a[0].name);
|
|
7728
7704
|
if ((_b = ev.target.files) === null || _b === void 0 ? void 0 : _b[0]) {
|
|
@@ -7730,11 +7706,11 @@ function ProtocolHandlerLayerForm(props) {
|
|
|
7730
7706
|
setFilePath(dataUrl);
|
|
7731
7707
|
}
|
|
7732
7708
|
} })),
|
|
7733
|
-
props.originType === 'csv' &&
|
|
7734
|
-
props.originType === 'osm' &&
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7709
|
+
props.originType === 'csv' && React__default.createElement(CSVOptionsFormular, { setter: addOption }),
|
|
7710
|
+
props.originType === 'osm' && React__default.createElement(OsmOptionsFomular, { setter: addOption })),
|
|
7711
|
+
React__default.createElement(DialogActions$1, null,
|
|
7712
|
+
React__default.createElement(Button, { onClick: props.onCancel }, "Cancel"),
|
|
7713
|
+
React__default.createElement(Button, { disabled: !configIsValid, onClick: function () { return props.onSubmit(config); } }, "Add"))));
|
|
7738
7714
|
}
|
|
7739
7715
|
|
|
7740
7716
|
var LayerSpecificationKeys = [
|
|
@@ -7748,16 +7724,16 @@ var LayerSpecificationKeys = [
|
|
|
7748
7724
|
'options',
|
|
7749
7725
|
];
|
|
7750
7726
|
function MbtilesLayerPropFormular(props) {
|
|
7751
|
-
var _a =
|
|
7727
|
+
var _a = useState([]), layers = _a[0], setLayers = _a[1];
|
|
7752
7728
|
var newLayer = {};
|
|
7753
7729
|
var toJSON = ['paint', 'layout', 'options', 'metadata'];
|
|
7754
|
-
|
|
7730
|
+
useEffect(function () {
|
|
7755
7731
|
props.setter(layers);
|
|
7756
7732
|
}, [layers]);
|
|
7757
7733
|
var TextFields = function () {
|
|
7758
|
-
return (
|
|
7759
|
-
return (
|
|
7760
|
-
|
|
7734
|
+
return (React__default.createElement(React__default.Fragment, null, LayerSpecificationKeys.map(function (key) {
|
|
7735
|
+
return (React__default.createElement(React__default.Fragment, { key: key + '_fragment' },
|
|
7736
|
+
React__default.createElement(TextField, { label: key, onChange: function (ev) {
|
|
7761
7737
|
return newLayer[key] = ev.target.value;
|
|
7762
7738
|
} })));
|
|
7763
7739
|
})));
|
|
@@ -7782,22 +7758,22 @@ function MbtilesLayerPropFormular(props) {
|
|
|
7782
7758
|
}
|
|
7783
7759
|
});
|
|
7784
7760
|
}
|
|
7785
|
-
return (
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7761
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7762
|
+
React__default.createElement(FormControl, { fullWidth: true },
|
|
7763
|
+
React__default.createElement(TextFields, null)),
|
|
7764
|
+
React__default.createElement(Button, { onClick: addLayer }, " Add")));
|
|
7789
7765
|
}
|
|
7790
7766
|
|
|
7791
7767
|
function MbtilesLayerForm(props) {
|
|
7792
|
-
var _a =
|
|
7793
|
-
var _b =
|
|
7794
|
-
var _c =
|
|
7795
|
-
var _d =
|
|
7768
|
+
var _a = React__default.useState(props.config), config = _a[0], setConfig = _a[1];
|
|
7769
|
+
var _b = useState(), fileName = _b[0], setFileName = _b[1];
|
|
7770
|
+
var _c = useState(), filePath = _c[0], setFilePath = _c[1];
|
|
7771
|
+
var _d = useState([]), layers = _d[0], setLayers = _d[1];
|
|
7796
7772
|
var mapHook = useMap({ mapId: props.mapId });
|
|
7797
|
-
var _e =
|
|
7773
|
+
var _e = useState(false), expanded = _e[0], setExpanded = _e[1];
|
|
7798
7774
|
console.log(layers);
|
|
7799
7775
|
var LayersToCall = function () {
|
|
7800
|
-
return (
|
|
7776
|
+
return (React__default.createElement(React__default.Fragment, null, layers.map(function (el, idx) { return (React__default.createElement(Typography, { variant: "body2", key: idx },
|
|
7801
7777
|
idx + 1,
|
|
7802
7778
|
": ",
|
|
7803
7779
|
JSON.stringify(el))); })));
|
|
@@ -7814,12 +7790,12 @@ function MbtilesLayerForm(props) {
|
|
|
7814
7790
|
* layout: {},
|
|
7815
7791
|
* paint: { "fill-color": "#f9a5f5", "fill-opacity": 0.5 },
|
|
7816
7792
|
*/
|
|
7817
|
-
var configIsValid =
|
|
7793
|
+
var configIsValid = useMemo(function () {
|
|
7818
7794
|
if (!fileName)
|
|
7819
7795
|
return false;
|
|
7820
7796
|
return true;
|
|
7821
7797
|
}, [fileName]);
|
|
7822
|
-
|
|
7798
|
+
useEffect(function () {
|
|
7823
7799
|
if (typeof fileName !== 'undefined' && typeof filePath !== 'undefined') {
|
|
7824
7800
|
setConfig({
|
|
7825
7801
|
url: 'mbtiles://' + filePath + '/{z}/{x}/{y}',
|
|
@@ -7833,12 +7809,12 @@ function MbtilesLayerForm(props) {
|
|
|
7833
7809
|
});
|
|
7834
7810
|
}
|
|
7835
7811
|
}, [fileName, mapHook.map, filePath, layers]);
|
|
7836
|
-
return (
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7812
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7813
|
+
React__default.createElement(DialogTitle$1, null, " Layer from mbtiles file"),
|
|
7814
|
+
React__default.createElement(DialogContent$1, null,
|
|
7815
|
+
React__default.createElement(Button, { variant: "contained", component: "label", sx: { marginTop: '10px' } },
|
|
7840
7816
|
"Select origin file",
|
|
7841
|
-
|
|
7817
|
+
React__default.createElement("input", { type: "file", hidden: true, accept: props.originType, onChange: function (ev) {
|
|
7842
7818
|
var _a, _b, _c;
|
|
7843
7819
|
setFileName((_a = ev.target.files) === null || _a === void 0 ? void 0 : _a[0].name);
|
|
7844
7820
|
if ((_b = ev.target.files) === null || _b === void 0 ? void 0 : _b[0]) {
|
|
@@ -7846,21 +7822,21 @@ function MbtilesLayerForm(props) {
|
|
|
7846
7822
|
setFilePath(dataUrl);
|
|
7847
7823
|
}
|
|
7848
7824
|
} })),
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
layers.length > 0 ?
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7825
|
+
React__default.createElement(Accordion, { expanded: expanded },
|
|
7826
|
+
React__default.createElement(AccordionSummary, { "aria-controls": "panel1d-content", id: "panel1d-header" },
|
|
7827
|
+
React__default.createElement(Typography, null, "MB-Tile Layer properties"),
|
|
7828
|
+
React__default.createElement(Button, { onClick: function () { return setExpanded(!expanded); } }, expanded ? React__default.createElement(KeyboardArrowUpIcon, null) : React__default.createElement(KeyboardArrowDownIcon, null))),
|
|
7829
|
+
React__default.createElement(Typography, { variant: "body1" }, " Layers"),
|
|
7830
|
+
layers.length > 0 ? React__default.createElement(LayersToCall, null) : React__default.createElement(Typography, { variant: "body2" }, " 0 "),
|
|
7831
|
+
React__default.createElement(MbtilesLayerPropFormular, { setter: setLayers }))),
|
|
7832
|
+
React__default.createElement(DialogActions$1, null,
|
|
7833
|
+
React__default.createElement(Button, { onClick: props.onCancel }, "Cancel"),
|
|
7834
|
+
React__default.createElement(Button, { disabled: !configIsValid, onClick: function () { return props.onSubmit(config); } }, "Add"))));
|
|
7859
7835
|
}
|
|
7860
7836
|
|
|
7861
7837
|
var AddLayerPopup = function (props) {
|
|
7862
|
-
var _a =
|
|
7863
|
-
var _b =
|
|
7838
|
+
var _a = useState(props === null || props === void 0 ? void 0 : props.config), layerConfig = _a[0], setLayerConfig = _a[1];
|
|
7839
|
+
var _b = useState(), originType = _b[0], setOriginType = _b[1];
|
|
7864
7840
|
var layerTypes = props.layerTypes;
|
|
7865
7841
|
var supportedProtocols = layerTypes.filter(function (el) { return el !== 'wms' && el !== 'geojson' && el !== 'mbtiles'; });
|
|
7866
7842
|
var updateLayerType = function (type) {
|
|
@@ -7880,39 +7856,39 @@ var AddLayerPopup = function (props) {
|
|
|
7880
7856
|
setLayerConfig(undefined);
|
|
7881
7857
|
};
|
|
7882
7858
|
var ProtocolTypeFormulars = function () {
|
|
7883
|
-
return (
|
|
7884
|
-
return (
|
|
7859
|
+
return (React__default.createElement(React__default.Fragment, null, supportedProtocols.map(function (el, idx) {
|
|
7860
|
+
return (React__default.createElement(React__default.Fragment, null, (layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) === 'geojson' && originType === el && (React__default.createElement(ProtocolHandlerLayerForm, { key: idx, originType: el, onSubmit: function (config) {
|
|
7885
7861
|
var _a;
|
|
7886
7862
|
(_a = props === null || props === void 0 ? void 0 : props.onComplete) === null || _a === void 0 ? void 0 : _a.call(props, __assign(__assign({}, layerConfig), { config: config, type: 'geojson' }));
|
|
7887
7863
|
handleCancel();
|
|
7888
7864
|
}, onCancel: handleCancel }))));
|
|
7889
7865
|
})));
|
|
7890
7866
|
};
|
|
7891
|
-
return (
|
|
7892
|
-
!(layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) &&
|
|
7893
|
-
(layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) === 'geojson' && originType === 'geojson' && (
|
|
7867
|
+
return (React__default.createElement(Dialog$1, { open: props.open, onClose: handleCancel, PaperProps: { sx: { padding: '20px' } } },
|
|
7868
|
+
!(layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) && React__default.createElement(LayerTypeForm, { onSelect: updateLayerType, layerTypes: layerTypes }),
|
|
7869
|
+
(layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) === 'geojson' && originType === 'geojson' && (React__default.createElement(GeoJsonLayerForm, { onSubmit: function (config) {
|
|
7894
7870
|
var _a;
|
|
7895
7871
|
(_a = props === null || props === void 0 ? void 0 : props.onComplete) === null || _a === void 0 ? void 0 : _a.call(props, __assign(__assign({}, layerConfig), { config: config }));
|
|
7896
7872
|
handleCancel();
|
|
7897
7873
|
}, onCancel: handleCancel })),
|
|
7898
|
-
(layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) === 'wms' && (
|
|
7874
|
+
(layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) === 'wms' && (React__default.createElement(WmsLayerForm, { onSubmit: function (config) {
|
|
7899
7875
|
var _a;
|
|
7900
7876
|
(_a = props === null || props === void 0 ? void 0 : props.onComplete) === null || _a === void 0 ? void 0 : _a.call(props, __assign(__assign({}, layerConfig), { config: config }));
|
|
7901
7877
|
handleCancel();
|
|
7902
7878
|
}, onCancel: handleCancel })),
|
|
7903
|
-
(layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) === 'vt' && originType !== undefined && (
|
|
7879
|
+
(layerConfig === null || layerConfig === void 0 ? void 0 : layerConfig.type) === 'vt' && originType !== undefined && (React__default.createElement(MbtilesLayerForm, { config: layerConfig, originType: originType, onSubmit: function (config) {
|
|
7904
7880
|
var _a;
|
|
7905
7881
|
if (layerConfig) {
|
|
7906
7882
|
(_a = props === null || props === void 0 ? void 0 : props.onComplete) === null || _a === void 0 ? void 0 : _a.call(props, __assign(__assign({}, layerConfig), { config: config }));
|
|
7907
7883
|
handleCancel();
|
|
7908
7884
|
}
|
|
7909
7885
|
}, onCancel: handleCancel })),
|
|
7910
|
-
|
|
7886
|
+
React__default.createElement(ProtocolTypeFormulars, { key: 'protocol' })));
|
|
7911
7887
|
};
|
|
7912
7888
|
AddLayerPopup.defaultProps = {};
|
|
7913
7889
|
|
|
7914
7890
|
var AddLayerButton = function (props) {
|
|
7915
|
-
var _a =
|
|
7891
|
+
var _a = React__default.useState(false), popupOpen = _a[0], setPopupOpen = _a[1];
|
|
7916
7892
|
var layerTypes = props.layerTypes || [
|
|
7917
7893
|
'geojson',
|
|
7918
7894
|
'wms',
|
|
@@ -7924,10 +7900,10 @@ var AddLayerButton = function (props) {
|
|
|
7924
7900
|
'kml',
|
|
7925
7901
|
'tcx',
|
|
7926
7902
|
];
|
|
7927
|
-
return (
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7903
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7904
|
+
React__default.createElement(Button, { variant: "contained", sx: __assign({ marginTop: '10px' }, props.sx), onClick: function () { return setPopupOpen(true); } },
|
|
7905
|
+
React__default.createElement(PlaylistAddIcon, null)),
|
|
7906
|
+
React__default.createElement(AddLayerPopup, { open: popupOpen, setOpen: setPopupOpen, onComplete: props === null || props === void 0 ? void 0 : props.onComplete, layerTypes: layerTypes })));
|
|
7931
7907
|
};
|
|
7932
7908
|
AddLayerButton.defaultProps = {};
|
|
7933
7909
|
|
|
@@ -7936,40 +7912,40 @@ var logoUrl = ghPagesUrl + 'assets/WG-MapComponents-Logo_rgb.svg';
|
|
|
7936
7912
|
var logoUrl_dark = ghPagesUrl + 'assets/WG-MapComponents-Logo_rgb-weisse-schrift.svg';
|
|
7937
7913
|
var logoUrl_mobile = ghPagesUrl + 'assets/mapcomponents_logo.png';
|
|
7938
7914
|
function TopToolbar(props) {
|
|
7939
|
-
var theme =
|
|
7940
|
-
var _a =
|
|
7915
|
+
var theme = useTheme();
|
|
7916
|
+
var _a = useState(null), anchorElNav = _a[0], setAnchorElNav = _a[1];
|
|
7941
7917
|
var handleOpenNavMenu = function (event) {
|
|
7942
7918
|
setAnchorElNav(event.currentTarget);
|
|
7943
7919
|
};
|
|
7944
7920
|
var handleCloseNavMenu = function () {
|
|
7945
7921
|
setAnchorElNav(null);
|
|
7946
7922
|
};
|
|
7947
|
-
return (
|
|
7923
|
+
return (React.createElement(AppBar, { sx: {
|
|
7948
7924
|
minHeight: '62px',
|
|
7949
7925
|
position: 'absolute',
|
|
7950
7926
|
zIndex: 1300,
|
|
7951
7927
|
top: 0,
|
|
7952
7928
|
} },
|
|
7953
|
-
|
|
7954
|
-
props.logo || (
|
|
7955
|
-
|
|
7929
|
+
React.createElement(Toolbar, { disableGutters: true },
|
|
7930
|
+
props.logo || (React.createElement(React.Fragment, null,
|
|
7931
|
+
React.createElement(Box$1, { sx: {
|
|
7956
7932
|
marginLeft: '25px',
|
|
7957
7933
|
display: { xs: 'none', md: 'flex' },
|
|
7958
7934
|
flexGrow: { md: '30' },
|
|
7959
7935
|
} },
|
|
7960
|
-
|
|
7961
|
-
|
|
7936
|
+
React.createElement("img", { src: theme.palette.mode === 'dark' ? logoUrl_dark : logoUrl, style: { width: '100%', maxWidth: '250px' } })),
|
|
7937
|
+
React.createElement(Box$1, { sx: {
|
|
7962
7938
|
marginLeft: '25px',
|
|
7963
7939
|
display: { xs: 'flex', sm: 'flex', md: 'none' },
|
|
7964
7940
|
flexGrow: { xs: '500' },
|
|
7965
7941
|
mr: { sm: '0px' },
|
|
7966
7942
|
} },
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
props.buttons ? (
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7943
|
+
React.createElement("img", { src: logoUrl_mobile, width: "50px", height: "50px" })))),
|
|
7944
|
+
React.createElement(Box$1, { sx: { flexGrow: 1, display: { xs: 'flex' } } }, props.unmovableButtons),
|
|
7945
|
+
props.buttons ? (React.createElement(Box$1, { sx: { flexGrow: 22, display: { xs: 'flex', sm: 'none' } } },
|
|
7946
|
+
React.createElement(IconButton, { onClick: handleOpenNavMenu },
|
|
7947
|
+
React.createElement(MenuIcon, null)),
|
|
7948
|
+
React.createElement(Menu, { id: "menu-appbar", anchorEl: anchorElNav, anchorOrigin: {
|
|
7973
7949
|
vertical: 'bottom',
|
|
7974
7950
|
horizontal: 'left',
|
|
7975
7951
|
}, keepMounted: true, transformOrigin: {
|
|
@@ -7984,16 +7960,16 @@ function TopToolbar(props) {
|
|
|
7984
7960
|
}, sx: {
|
|
7985
7961
|
display: { xs: 'block', sm: 'none' },
|
|
7986
7962
|
} },
|
|
7987
|
-
|
|
7988
|
-
|
|
7963
|
+
React.createElement(Box$1, { sx: { paddingLeft: '10px', paddingRight: '10px' }, onClick: handleCloseNavMenu }, props.buttons)))) : (''),
|
|
7964
|
+
React.createElement(Box$1, { sx: { marginRight: '25px', display: { xs: 'none', sm: 'flex' } } }, props.buttons))));
|
|
7989
7965
|
}
|
|
7990
7966
|
|
|
7991
|
-
var DrawerHeader =
|
|
7967
|
+
var DrawerHeader = styled$2('div')(function () { return ({
|
|
7992
7968
|
display: 'flex',
|
|
7993
7969
|
alignItems: 'center',
|
|
7994
7970
|
}); });
|
|
7995
7971
|
var drawerBleeding = 56;
|
|
7996
|
-
var Puller =
|
|
7972
|
+
var Puller = styled$2(Box$1)(function (_a) {
|
|
7997
7973
|
var theme = _a.theme;
|
|
7998
7974
|
return ({
|
|
7999
7975
|
width: 30,
|
|
@@ -8007,19 +7983,19 @@ var Puller = styles.styled(Box)(function (_a) {
|
|
|
8007
7983
|
});
|
|
8008
7984
|
function Sidebar(_a) {
|
|
8009
7985
|
var drawerPaperProps = _a.drawerPaperProps, drawerHeaderProps = _a.drawerHeaderProps, setOpen = _a.setOpen, props = __rest(_a, ["drawerPaperProps", "drawerHeaderProps", "setOpen"]);
|
|
8010
|
-
var mediaIsMobile = useMediaQuery(function (theme) { return theme.breakpoints.down('sm'); });
|
|
8011
|
-
var _b =
|
|
8012
|
-
return (
|
|
8013
|
-
!mediaIsMobile ? (
|
|
8014
|
-
|
|
7986
|
+
var mediaIsMobile = useMediaQuery$1(function (theme) { return theme.breakpoints.down('sm'); });
|
|
7987
|
+
var _b = useState(false), drawerOpen = _b[0], setDrawerOpen = _b[1];
|
|
7988
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7989
|
+
!mediaIsMobile ? (React__default.createElement(Box$1, { sx: { display: { xs: 'none', sm: 'flex' }, mr: 1 } },
|
|
7990
|
+
React__default.createElement(Drawer, __assign({ transitionDuration: 0, variant: "persistent", anchor: "left", open: typeof props.open === 'undefined' ? drawerOpen : props.open, PaperProps: __assign(__assign({}, drawerPaperProps), { sx: __assign({ maxWidth: { lg: '30%', md: '40%', sm: '50%', xs: '78%' }, padding: { sm: '84px 20px 20px 20px', xs: '74px 10px 10px 10px' }, width: {
|
|
8015
7991
|
xs: '80%',
|
|
8016
7992
|
sm: '60%',
|
|
8017
7993
|
md: '350px',
|
|
8018
7994
|
lg: '350px',
|
|
8019
7995
|
}, boxSizing: 'border-box' }, drawerPaperProps === null || drawerPaperProps === void 0 ? void 0 : drawerPaperProps.sx) }), sx: __assign({ flexGrow: 1, zIndex: 105, position: 'absolute', bottom: 0, display: 'flex', flexDirection: 'column', maxWidth: { lg: '30%', md: '40%', sm: '50%', xs: '78%' } }, (drawerOpen ? {} : { left: mediaIsMobile ? '-90vw' : '-20vw' })) }, props),
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
7996
|
+
React__default.createElement(DrawerHeader, __assign({}, drawerHeaderProps),
|
|
7997
|
+
React__default.createElement(Typography$1, { variant: "h6" }, props.name),
|
|
7998
|
+
React__default.createElement(IconButton$1, { onClick: setOpen
|
|
8023
7999
|
? function () {
|
|
8024
8000
|
setOpen === null || setOpen === void 0 ? void 0 : setOpen(false);
|
|
8025
8001
|
}
|
|
@@ -8029,15 +8005,15 @@ function Sidebar(_a) {
|
|
|
8029
8005
|
position: 'absolute',
|
|
8030
8006
|
right: '20px',
|
|
8031
8007
|
} },
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8008
|
+
React__default.createElement(CloseIcon, null))),
|
|
8009
|
+
React__default.createElement(Box$1, null, props.children)))) : (React__default.createElement(Box$1, { sx: { display: { xs: 'flex', sm: 'none' } } },
|
|
8010
|
+
React__default.createElement(Global, { styles: {
|
|
8035
8011
|
'.MuiDrawer-root > .MuiPaper-root': {
|
|
8036
8012
|
height: "calc(50% - ".concat(drawerBleeding, "px)"),
|
|
8037
8013
|
overflow: 'visible',
|
|
8038
8014
|
},
|
|
8039
8015
|
} }),
|
|
8040
|
-
|
|
8016
|
+
React__default.createElement(SwipeableDrawer, { anchor: "bottom", open: typeof props.open === 'undefined' ? drawerOpen : props.open, onClose: setOpen
|
|
8041
8017
|
? function () {
|
|
8042
8018
|
setOpen === null || setOpen === void 0 ? void 0 : setOpen(false);
|
|
8043
8019
|
}
|
|
@@ -8055,7 +8031,7 @@ function Sidebar(_a) {
|
|
|
8055
8031
|
top: "calc(90%)",
|
|
8056
8032
|
},
|
|
8057
8033
|
} },
|
|
8058
|
-
|
|
8034
|
+
React__default.createElement(Paper$1, { sx: {
|
|
8059
8035
|
position: 'absolute',
|
|
8060
8036
|
top: -drawerBleeding,
|
|
8061
8037
|
borderTopLeftRadius: 8,
|
|
@@ -8064,9 +8040,9 @@ function Sidebar(_a) {
|
|
|
8064
8040
|
right: 0,
|
|
8065
8041
|
left: 0,
|
|
8066
8042
|
} },
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8043
|
+
React__default.createElement(Puller, null),
|
|
8044
|
+
React__default.createElement(Typography$1, { variant: "h6", sx: { p: '13px' } }, props.name)),
|
|
8045
|
+
React__default.createElement(Paper$1, { sx: {
|
|
8070
8046
|
px: '15px',
|
|
8071
8047
|
pb: '15px',
|
|
8072
8048
|
height: '100%',
|
|
@@ -8077,7 +8053,7 @@ function Sidebar(_a) {
|
|
|
8077
8053
|
}
|
|
8078
8054
|
|
|
8079
8055
|
function UploadButton(props) {
|
|
8080
|
-
var fileupload =
|
|
8056
|
+
var fileupload = useRef(null);
|
|
8081
8057
|
var fileUploadOnChange = function () {
|
|
8082
8058
|
var _a, _b;
|
|
8083
8059
|
if (!fileupload.current)
|
|
@@ -8103,10 +8079,10 @@ function UploadButton(props) {
|
|
|
8103
8079
|
return;
|
|
8104
8080
|
fileupload.current.click();
|
|
8105
8081
|
};
|
|
8106
|
-
return (
|
|
8107
|
-
props.buttonComponent ? (
|
|
8108
|
-
|
|
8109
|
-
|
|
8082
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
8083
|
+
props.buttonComponent ? (React__default.cloneElement(props.buttonComponent, { onClick: upload })) : (React__default.createElement(Button, { onClick: upload },
|
|
8084
|
+
React__default.createElement(FileCopy, null))),
|
|
8085
|
+
React__default.createElement("input", { ref: fileupload, onChange: fileUploadOnChange, type: "file", accept: props.accept, id: "input", multiple: true, style: { display: 'none' } })));
|
|
8110
8086
|
}
|
|
8111
8087
|
|
|
8112
8088
|
var SelectStylePopup = function (props) {
|
|
@@ -8114,18 +8090,18 @@ var SelectStylePopup = function (props) {
|
|
|
8114
8090
|
var handleCancel = function () {
|
|
8115
8091
|
props.setOpen(false);
|
|
8116
8092
|
};
|
|
8117
|
-
return (
|
|
8118
|
-
|
|
8119
|
-
|
|
8093
|
+
return (React__default.createElement(Dialog$1, { open: props.open, onClose: handleCancel, PaperProps: { sx: { padding: '20px' } } },
|
|
8094
|
+
React__default.createElement(DialogTitle$1, null, "Select a style"),
|
|
8095
|
+
React__default.createElement(List$1, null, (_a = props === null || props === void 0 ? void 0 : props.styles) === null || _a === void 0 ? void 0 : _a.map(function (style) {
|
|
8120
8096
|
var _a;
|
|
8121
|
-
return (
|
|
8122
|
-
|
|
8097
|
+
return (React__default.createElement(ListItem$1, { disableGutters: true, key: style.name },
|
|
8098
|
+
React__default.createElement(ListItemButton, { autoFocus: true, onClick: function () {
|
|
8123
8099
|
var _a;
|
|
8124
8100
|
(_a = props === null || props === void 0 ? void 0 : props.onSelect) === null || _a === void 0 ? void 0 : _a.call(props, style);
|
|
8125
8101
|
} },
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8102
|
+
React__default.createElement(ListItemAvatar, null,
|
|
8103
|
+
React__default.createElement(Avatar, { sx: { width: '50px', height: '50px' }, alt: style.name, src: (style === null || style === void 0 ? void 0 : style.name) && ((_a = props === null || props === void 0 ? void 0 : props.styleThumbnailPaths) === null || _a === void 0 ? void 0 : _a[style.name]) })),
|
|
8104
|
+
React__default.createElement(ListItemText$1, { primary: style.name }))));
|
|
8129
8105
|
}))));
|
|
8130
8106
|
};
|
|
8131
8107
|
SelectStylePopup.defaultProps = {
|
|
@@ -20894,12 +20870,12 @@ var GruvboxStyle = {
|
|
|
20894
20870
|
|
|
20895
20871
|
var defaultStyleThumbnailPath = 'https://mapcomponents.github.io/react-map-components-maplibre/assets/style_thumbnails/';
|
|
20896
20872
|
var SelectStyleButton = function (props) {
|
|
20897
|
-
var layerContext =
|
|
20898
|
-
var _a =
|
|
20899
|
-
return (
|
|
20900
|
-
|
|
20901
|
-
|
|
20902
|
-
|
|
20873
|
+
var layerContext = React__default.useContext(LayerContext);
|
|
20874
|
+
var _a = React__default.useState(false), popupOpen = _a[0], setPopupOpen = _a[1];
|
|
20875
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
20876
|
+
React__default.createElement(Button, { variant: "contained", sx: __assign({ marginTop: '10px' }, props.sx), onClick: function () { return setPopupOpen(true); } },
|
|
20877
|
+
React__default.createElement(WallpaperIcon, null)),
|
|
20878
|
+
React__default.createElement(SelectStylePopup, { styles: __spreadArray(__spreadArray([], (props.defaultStyles
|
|
20903
20879
|
? [MonokaiStyle, SolarizedStyle, OceanicNextStyle, MedievalKingdomStyle, GruvboxStyle]
|
|
20904
20880
|
: []), true), (props.styles || []), true), styleThumbnailPaths: __assign(__assign({}, props === null || props === void 0 ? void 0 : props.styleThumbnailPaths), (props.defaultStyles
|
|
20905
20881
|
? {
|
|
@@ -20924,23 +20900,23 @@ SelectStyleButton.defaultProps = {
|
|
|
20924
20900
|
};
|
|
20925
20901
|
|
|
20926
20902
|
var actions = [
|
|
20927
|
-
{ icon:
|
|
20928
|
-
{ icon:
|
|
20929
|
-
{ icon:
|
|
20930
|
-
{ icon:
|
|
20903
|
+
{ icon: React__default.createElement(PictureAsPdfIcon, null), name: 'Create PDF' },
|
|
20904
|
+
{ icon: React__default.createElement(DesignServicesIcon, null), name: 'Sketch' },
|
|
20905
|
+
{ icon: React__default.createElement(LayersIcon, null), name: 'Layers' },
|
|
20906
|
+
{ icon: React__default.createElement(WallpaperIcon, null), name: 'Background' },
|
|
20931
20907
|
];
|
|
20932
20908
|
/*
|
|
20933
20909
|
* SpeedDial Button, which opens up options for Background, Layers, Sketch and Create PDF
|
|
20934
20910
|
*/
|
|
20935
20911
|
var SpeedDial = function () {
|
|
20936
|
-
var _a =
|
|
20912
|
+
var _a = useState(false), open = _a[0], setOpen = _a[1];
|
|
20937
20913
|
var handleOpen = function (_event, reason) {
|
|
20938
20914
|
if (reason === 'toggle') {
|
|
20939
20915
|
setOpen(true);
|
|
20940
20916
|
}
|
|
20941
20917
|
};
|
|
20942
20918
|
var handleClose = function () { return setOpen(false); };
|
|
20943
|
-
return (
|
|
20919
|
+
return (React__default.createElement(Box$1, { sx: {
|
|
20944
20920
|
height: 330,
|
|
20945
20921
|
transform: 'translateZ(0px)',
|
|
20946
20922
|
flexGrow: 1,
|
|
@@ -20950,101 +20926,11 @@ var SpeedDial = function () {
|
|
|
20950
20926
|
width: '100px',
|
|
20951
20927
|
zIndex: '1000',
|
|
20952
20928
|
} },
|
|
20953
|
-
|
|
20929
|
+
React__default.createElement(MuiSpeedDial, { ariaLabel: "SpeedDial tooltip example", sx: { position: 'absolute', bottom: 16, right: 16 }, icon: open ? React__default.createElement(CloseIcon, { fontSize: "large" }) : React__default.createElement(MoreVertIcon, { fontSize: "large" }), onClick: open ? handleClose : handleOpen, onOpen: handleOpen, open: open }, actions.map(function (action) { return (React__default.createElement(SpeedDialAction, { key: action.name, icon: action.icon, tooltipTitle: action.name, tooltipOpen: true, onClick: handleClose, FabProps: { sx: { color: 'text.primary' } } })); }))));
|
|
20954
20930
|
};
|
|
20955
20931
|
SpeedDial.defaultProps = {
|
|
20956
20932
|
mapId: undefined,
|
|
20957
20933
|
};
|
|
20958
20934
|
|
|
20959
|
-
|
|
20960
|
-
exports.AddLayerPopup = AddLayerPopup;
|
|
20961
|
-
exports.CSVProtocolHandler = CSVProtocolHandler;
|
|
20962
|
-
exports.ColorPicker = PaintPropsColorPicker;
|
|
20963
|
-
exports.ConfirmDialog = ConfirmDialog;
|
|
20964
|
-
exports.GeoJsonContext = GeoJsonContext;
|
|
20965
|
-
exports.GeoJsonLayerForm = GeoJsonLayerForm;
|
|
20966
|
-
exports.GeoJsonProvider = GeoJsonProvider;
|
|
20967
|
-
exports.GruvboxStyle = GruvboxStyle;
|
|
20968
|
-
exports.LayerContext = LayerContext;
|
|
20969
|
-
exports.LayerContextProvider = LayerContextProvider;
|
|
20970
|
-
exports.LayerList = LayerList;
|
|
20971
|
-
exports.LayerListFolder = LayerListFolder;
|
|
20972
|
-
exports.LayerListItem = LayerListItem;
|
|
20973
|
-
exports.LayerListItemFactory = LayerListItemFactory;
|
|
20974
|
-
exports.LayerListItemVectorLayer = LayerListItemVectorLayer;
|
|
20975
|
-
exports.LayerPropertyForm = LayerPropertyForm;
|
|
20976
|
-
exports.LayerTypeForm = LayerTypeForm;
|
|
20977
|
-
exports.MapComponentsProvider = MapComponentsProvider;
|
|
20978
|
-
exports.MapContext = MapContext;
|
|
20979
|
-
exports.MapLibreGlWrapper = MapLibreGlWrapper;
|
|
20980
|
-
exports.MapLibreMap = MapLibreMap;
|
|
20981
|
-
exports.MedievalKingdomStyle = MedievalKingdomStyle;
|
|
20982
|
-
exports.MlCenterPosition = MlCenterPosition;
|
|
20983
|
-
exports.MlComponentTemplate = MlComponentTemplate;
|
|
20984
|
-
exports.MlCreatePdfButton = MlCreatePdfButton;
|
|
20985
|
-
exports.MlCreatePdfForm = MlCreatePdfForm;
|
|
20986
|
-
exports.MlFeatureEditor = MlFeatureEditor;
|
|
20987
|
-
exports.MlFillExtrusionLayer = MlFillExtrusionLayer;
|
|
20988
|
-
exports.MlFollowGps = MlFollowGps;
|
|
20989
|
-
exports.MlGeoJsonLayer = MlGeoJsonLayer;
|
|
20990
|
-
exports.MlGpxViewer = MlGpxViewer;
|
|
20991
|
-
exports.MlImageMarkerLayer = MlImageMarkerLayer;
|
|
20992
|
-
exports.MlLayer = MlLayer;
|
|
20993
|
-
exports.MlLayerMagnify = MlLayerMagnify;
|
|
20994
|
-
exports.MlLayerSwipe = MlLayerSwipe;
|
|
20995
|
-
exports.MlMarker = MlMarker;
|
|
20996
|
-
exports.MlMeasureTool = MlMeasureTool;
|
|
20997
|
-
exports.MlNavigationCompass = MlNavigationCompass;
|
|
20998
|
-
exports.MlNavigationTools = MlNavigationTools;
|
|
20999
|
-
exports.MlOrderLayers = MlOrderLayers;
|
|
21000
|
-
exports.MlPdfPreview = PdfPreview;
|
|
21001
|
-
exports.MlScaleReference = MlScaleReference;
|
|
21002
|
-
exports.MlShareMapState = MlShareMapState;
|
|
21003
|
-
exports.MlSketchTool = MlSketchTool;
|
|
21004
|
-
exports.MlSpatialElevationProfile = MlSpatialElevationProfile;
|
|
21005
|
-
exports.MlTemporalController = MlTemporalController;
|
|
21006
|
-
exports.MlTerrainLayer = MlTerrainLayer;
|
|
21007
|
-
exports.MlTransitionGeoJsonLayer = MlTransitionGeoJsonLayer;
|
|
21008
|
-
exports.MlVectorTileLayer = MlVectorTileLayer;
|
|
21009
|
-
exports.MlWmsFeatureInfoPopup = MlWmsFeatureInfoPopup;
|
|
21010
|
-
exports.MlWmsLayer = MlWmsLayer;
|
|
21011
|
-
exports.MlWmsLoader = MlWmsLoader;
|
|
21012
|
-
exports.MonokaiStyle = MonokaiStyle;
|
|
21013
|
-
exports.OSMProtocolHandler = OSMProtocolHandler;
|
|
21014
|
-
exports.OceanicNextStyle = OceanicNextStyle;
|
|
21015
|
-
exports.PdfContext = PdfContext;
|
|
21016
|
-
exports.PdfForm = PdfForm;
|
|
21017
|
-
exports.SelectStyleButton = SelectStyleButton;
|
|
21018
|
-
exports.SelectStylePopup = SelectStylePopup;
|
|
21019
|
-
exports.Sidebar = Sidebar;
|
|
21020
|
-
exports.SimpleDataContext = SimpleDataContext;
|
|
21021
|
-
exports.SimpleDataProvider = SimpleDataProvider;
|
|
21022
|
-
exports.SolarizedStyle = SolarizedStyle;
|
|
21023
|
-
exports.SpeedDial = SpeedDial;
|
|
21024
|
-
exports.TopToolbar = TopToolbar;
|
|
21025
|
-
exports.TopojsonProtocolHandler = TopojsonProtocolHandler;
|
|
21026
|
-
exports.UploadButton = UploadButton;
|
|
21027
|
-
exports.WmsLayerForm = WmsLayerForm;
|
|
21028
|
-
exports.XMLProtocolHandler = XMLProtocolHandler;
|
|
21029
|
-
exports.convertCsv = convertCsv;
|
|
21030
|
-
exports.convertOSM = convertOSM;
|
|
21031
|
-
exports.convertTopojson = convertTopojson;
|
|
21032
|
-
exports.convertXML = convertXML;
|
|
21033
|
-
exports.getTheme = getTheme;
|
|
21034
|
-
exports.useAddImage = useAddImage;
|
|
21035
|
-
exports.useAddProtocol = useAddProtocol;
|
|
21036
|
-
exports.useCameraFollowPath = useCameraFollowPath;
|
|
21037
|
-
exports.useExportMap = useExportMap;
|
|
21038
|
-
exports.useFeatureEditor = useFeatureEditor;
|
|
21039
|
-
exports.useFilterData = useFilterData;
|
|
21040
|
-
exports.useGpx = useGpx;
|
|
21041
|
-
exports.useLayer = useLayer;
|
|
21042
|
-
exports.useLayerContext = useLayerContext;
|
|
21043
|
-
exports.useLayerEvent = useLayerEvent;
|
|
21044
|
-
exports.useLayerFilter = useLayerFilter;
|
|
21045
|
-
exports.useLayerHoverPopup = LayerHoverPopup;
|
|
21046
|
-
exports.useMap = useMap;
|
|
21047
|
-
exports.useMapState = useMapState;
|
|
21048
|
-
exports.useSource = useSource;
|
|
21049
|
-
exports.useWms = useWms;
|
|
20935
|
+
export { AddLayerButton, AddLayerPopup, CSVProtocolHandler, PaintPropsColorPicker as ColorPicker, ConfirmDialog, GeoJsonContext, GeoJsonLayerForm, GeoJsonProvider, GruvboxStyle, LayerContext, LayerContextProvider, LayerList, LayerListFolder, LayerListItem, LayerListItemFactory, LayerListItemVectorLayer, LayerPropertyForm, LayerTypeForm, MapComponentsProvider, MapContext, MapLibreGlWrapper, MapLibreMap, MedievalKingdomStyle, MlCenterPosition, MlComponentTemplate, MlCreatePdfButton, MlCreatePdfForm, MlFeatureEditor, MlFillExtrusionLayer, MlFollowGps, MlGeoJsonLayer, MlGpxViewer, MlImageMarkerLayer, MlLayer, MlLayerMagnify, MlLayerSwipe, MlMarker, MlMeasureTool, MlNavigationCompass, MlNavigationTools, MlOrderLayers, PdfPreview as MlPdfPreview, MlScaleReference, MlShareMapState, MlSketchTool, MlSpatialElevationProfile, MlTemporalController, MlTerrainLayer, MlTransitionGeoJsonLayer, MlVectorTileLayer, MlWmsFeatureInfoPopup, MlWmsLayer, MlWmsLoader, MonokaiStyle, OSMProtocolHandler, OceanicNextStyle, PdfContext, PdfForm, SelectStyleButton, SelectStylePopup, Sidebar, SimpleDataContext, SimpleDataProvider, SolarizedStyle, SpeedDial, TopToolbar, TopojsonProtocolHandler, UploadButton, WmsLayerForm, XMLProtocolHandler, convertCsv, convertOSM, convertTopojson, convertXML, getTheme, useAddImage, useAddProtocol, useCameraFollowPath, useExportMap, useFeatureEditor, useFilterData, useGpx, useLayer, useLayerContext, useLayerEvent, useLayerFilter, LayerHoverPopup as useLayerHoverPopup, useMap, useMapState, useSource, useWms };
|
|
21050
20936
|
//# sourceMappingURL=index.esm.js.map
|