@mapcomponents/react-maplibre 0.1.86 → 0.1.87
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 +9 -0
- package/dist/components/MlFeatureEditor/MlFeatureEditor.stories.d.ts +1 -0
- package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.d.ts +1 -1
- package/dist/components/MlFillExtrusionLayer/MlFillExtrusionLayer.stories.d.ts +26 -9
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.stories.d.ts +1 -0
- package/dist/components/MlMeasureTool/MlMeasureTool.d.ts +12 -2
- package/dist/components/MlMeasureTool/MlMeasureTool.stories.d.ts +1 -0
- package/dist/components/MlNavigationCompass/MlNavigationCompass.stories.d.ts +1 -1
- package/dist/components/MlNavigationTools/MlNavigationTools.stories.d.ts +2 -1
- package/dist/components/MlScaleReference/MlScaleReference.stories.d.ts +1 -1
- package/dist/components/MlTemporalController/MlTemporalController.stories.d.ts +1 -0
- package/dist/components/MlWmsLoader/MlWmsLoader.d.ts +2 -0
- package/dist/contexts/LayerContext.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +750 -546
- package/dist/index.esm.js.map +1 -1
- package/dist/ui_components/LayerList/LayerListItem.d.ts +2 -0
- package/dist/ui_components/LayerList/LayerListItemFactory.d.ts +1 -0
- package/dist/ui_components/LayerList/util/SortableContainer.d.ts +7 -0
- package/package.json +4 -1
package/dist/index.esm.js
CHANGED
|
@@ -42,15 +42,24 @@ var DialogActions = require('@mui/material/DialogActions');
|
|
|
42
42
|
var DialogContent = require('@mui/material/DialogContent');
|
|
43
43
|
var DialogContentText = require('@mui/material/DialogContentText');
|
|
44
44
|
var DialogTitle = require('@mui/material/DialogTitle');
|
|
45
|
+
var sortable = require('@dnd-kit/sortable');
|
|
46
|
+
var utilities = require('@dnd-kit/utilities');
|
|
45
47
|
var PlayArrowIcon = require('@mui/icons-material/PlayArrow');
|
|
46
48
|
var PauseIcon = require('@mui/icons-material/Pause');
|
|
47
49
|
var StopIcon = require('@mui/icons-material/Stop');
|
|
48
50
|
var FastForwardIcon = require('@mui/icons-material/FastForward');
|
|
49
51
|
var FastRewindIcon = require('@mui/icons-material/FastRewind');
|
|
50
|
-
var
|
|
52
|
+
var PentagonIcon = require('@mui/icons-material/Pentagon');
|
|
51
53
|
var system = require('@mui/system');
|
|
54
|
+
var EditIcon = require('@mui/icons-material/Edit');
|
|
55
|
+
var Tooltip = require('@mui/material/Tooltip');
|
|
52
56
|
var reactColor = require('react-color');
|
|
53
57
|
var TuneIcon = require('@mui/icons-material/Tune');
|
|
58
|
+
var ScatterPlotIcon = require('@mui/icons-material/ScatterPlot');
|
|
59
|
+
var PolylineIcon = require('@mui/icons-material/Polyline');
|
|
60
|
+
var d3 = require('d3');
|
|
61
|
+
var core = require('@dnd-kit/core');
|
|
62
|
+
var modifiers = require('@dnd-kit/modifiers');
|
|
54
63
|
var PlaylistAddIcon = require('@mui/icons-material/PlaylistAdd');
|
|
55
64
|
var DynamicFeedIcon = require('@mui/icons-material/DynamicFeed');
|
|
56
65
|
var AppBar = require('@mui/material/AppBar');
|
|
@@ -128,8 +137,13 @@ var PauseIcon__default = /*#__PURE__*/_interopDefaultLegacy(PauseIcon);
|
|
|
128
137
|
var StopIcon__default = /*#__PURE__*/_interopDefaultLegacy(StopIcon);
|
|
129
138
|
var FastForwardIcon__default = /*#__PURE__*/_interopDefaultLegacy(FastForwardIcon);
|
|
130
139
|
var FastRewindIcon__default = /*#__PURE__*/_interopDefaultLegacy(FastRewindIcon);
|
|
131
|
-
var
|
|
140
|
+
var PentagonIcon__default = /*#__PURE__*/_interopDefaultLegacy(PentagonIcon);
|
|
141
|
+
var EditIcon__default = /*#__PURE__*/_interopDefaultLegacy(EditIcon);
|
|
142
|
+
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
|
|
132
143
|
var TuneIcon__default = /*#__PURE__*/_interopDefaultLegacy(TuneIcon);
|
|
144
|
+
var ScatterPlotIcon__default = /*#__PURE__*/_interopDefaultLegacy(ScatterPlotIcon);
|
|
145
|
+
var PolylineIcon__default = /*#__PURE__*/_interopDefaultLegacy(PolylineIcon);
|
|
146
|
+
var d3__namespace = /*#__PURE__*/_interopNamespace(d3);
|
|
133
147
|
var PlaylistAddIcon__default = /*#__PURE__*/_interopDefaultLegacy(PlaylistAddIcon);
|
|
134
148
|
var DynamicFeedIcon__default = /*#__PURE__*/_interopDefaultLegacy(DynamicFeedIcon);
|
|
135
149
|
var AppBar__default = /*#__PURE__*/_interopDefaultLegacy(AppBar);
|
|
@@ -978,6 +992,7 @@ function LayerContextProvider(props) {
|
|
|
978
992
|
setTileUrl: setTileUrl,
|
|
979
993
|
moveUp: moveUp,
|
|
980
994
|
moveDown: moveDown,
|
|
995
|
+
moveLayer: moveLayer,
|
|
981
996
|
};
|
|
982
997
|
return React__default["default"].createElement(LayerContext.Provider, { value: value }, props.children);
|
|
983
998
|
}
|
|
@@ -2569,7 +2584,7 @@ var MlFillExtrusionLayer = function (props) {
|
|
|
2569
2584
|
type: "fill-extrusion",
|
|
2570
2585
|
source: props.sourceId || "openmaptiles",
|
|
2571
2586
|
"source-layer": props.sourceLayer || "building",
|
|
2572
|
-
minzoom: props.minZoom ||
|
|
2587
|
+
minzoom: props.minZoom || 6,
|
|
2573
2588
|
paint: __assign({}, props.paint),
|
|
2574
2589
|
},
|
|
2575
2590
|
insertBeforeFirstSymbolLayer: true,
|
|
@@ -2854,34 +2869,50 @@ var MlImageMarkerLayer = function (props) {
|
|
|
2854
2869
|
// miles: 1 / 2.58998811,
|
|
2855
2870
|
//};
|
|
2856
2871
|
function getUnitSquareMultiplier(measureType) {
|
|
2857
|
-
return measureType ===
|
|
2872
|
+
return measureType === 'miles' ? 1 / 2.58998811 : 1;
|
|
2858
2873
|
}
|
|
2859
2874
|
function getUnitLabel(measureType) {
|
|
2860
|
-
return measureType ===
|
|
2875
|
+
return measureType === 'miles' ? 'mi' : 'km';
|
|
2861
2876
|
}
|
|
2862
2877
|
var MlMeasureTool = function (props) {
|
|
2863
|
-
var _a = React.useState(0),
|
|
2878
|
+
var _a = React.useState({ value: 0, label: 'km' }), displayValue = _a[0], setDisplayValue = _a[1];
|
|
2864
2879
|
var _b = React.useState([]), currentFeatures = _b[0], setCurrentFeatures = _b[1];
|
|
2865
2880
|
React.useEffect(function () {
|
|
2866
2881
|
if (currentFeatures[0]) {
|
|
2867
|
-
|
|
2882
|
+
var result = props.measureType === 'polygon'
|
|
2883
|
+
// turf area does actually return mm^2 contrary to the documentation stating it will return m^2
|
|
2868
2884
|
? (turf__namespace.area(currentFeatures[0]) / 1000000) * getUnitSquareMultiplier(props.unit)
|
|
2869
|
-
: turf__namespace.length(currentFeatures[0], { units: props.unit })
|
|
2885
|
+
: turf__namespace.length(currentFeatures[0], { units: props.unit });
|
|
2886
|
+
if (typeof props.onChange === 'function') {
|
|
2887
|
+
props.onChange({ value: result, unit: props.unit, geojson: currentFeatures[0] });
|
|
2888
|
+
}
|
|
2889
|
+
if (result >= 0.1) {
|
|
2890
|
+
setDisplayValue({ value: result, label: getUnitLabel(props.unit) });
|
|
2891
|
+
}
|
|
2892
|
+
else {
|
|
2893
|
+
var label = 'm';
|
|
2894
|
+
var value = result * 1000000;
|
|
2895
|
+
if (getUnitLabel(props.unit) === 'mi') {
|
|
2896
|
+
label = 'in';
|
|
2897
|
+
value = result * 63360;
|
|
2898
|
+
}
|
|
2899
|
+
setDisplayValue({ value: value, label: label });
|
|
2900
|
+
}
|
|
2870
2901
|
}
|
|
2871
2902
|
}, [props.unit, currentFeatures]);
|
|
2872
2903
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
2873
2904
|
React__default["default"].createElement(MlFeatureEditor, { onChange: function (features) {
|
|
2874
2905
|
setCurrentFeatures(features);
|
|
2875
|
-
}, mode: props.measureType ===
|
|
2876
|
-
|
|
2906
|
+
}, mode: props.measureType === 'polygon' ? 'draw_polygon' : 'draw_line_string' }),
|
|
2907
|
+
displayValue.value.toFixed(2),
|
|
2877
2908
|
" ",
|
|
2878
|
-
|
|
2879
|
-
props.measureType ===
|
|
2909
|
+
displayValue.label,
|
|
2910
|
+
props.measureType === 'polygon' ? '²' : ''));
|
|
2880
2911
|
};
|
|
2881
2912
|
MlMeasureTool.defaultProps = {
|
|
2882
2913
|
mapId: undefined,
|
|
2883
|
-
measureType:
|
|
2884
|
-
unit:
|
|
2914
|
+
measureType: 'line',
|
|
2915
|
+
unit: 'kilometers',
|
|
2885
2916
|
};
|
|
2886
2917
|
|
|
2887
2918
|
var _path$1, _path2$1;
|
|
@@ -3081,7 +3112,7 @@ var MlNavigationTools = function (props) {
|
|
|
3081
3112
|
}, [mapHook.map]);
|
|
3082
3113
|
return (React__default["default"].createElement(Box__default["default"], { 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) },
|
|
3083
3114
|
React__default["default"].createElement(MlNavigationCompass, null),
|
|
3084
|
-
props.show3DButton && (React__default["default"].createElement(Button__default["default"], { variant: "navtools", onClick: adjustPitch }, pitch <
|
|
3115
|
+
props.show3DButton && (React__default["default"].createElement(Button__default["default"], { variant: "navtools", onClick: adjustPitch }, pitch < 29 ? '3D' : '2D')),
|
|
3085
3116
|
props.showFollowGpsButton && React__default["default"].createElement(MlFollowGps, null),
|
|
3086
3117
|
props.showCenterLocationButton && React__default["default"].createElement(MlCenterPosition, null),
|
|
3087
3118
|
React__default["default"].createElement(ButtonGroup__default["default"], { orientation: "vertical", sx: {
|
|
@@ -5347,6 +5378,17 @@ ConfirmDialog.defaultProps = {
|
|
|
5347
5378
|
text: 'Are you sure?',
|
|
5348
5379
|
};
|
|
5349
5380
|
|
|
5381
|
+
function SortableContainer(_a) {
|
|
5382
|
+
var children = _a.children, layerId = _a.layerId;
|
|
5383
|
+
var _b = sortable.useSortable({
|
|
5384
|
+
id: layerId,
|
|
5385
|
+
}), attributes = _b.attributes, listeners = _b.listeners, setNodeRef = _b.setNodeRef, transform = _b.transform;
|
|
5386
|
+
var style = {
|
|
5387
|
+
transform: utilities.CSS.Transform.toString(transform),
|
|
5388
|
+
};
|
|
5389
|
+
return (React__default["default"].createElement("li", __assign({ ref: setNodeRef, style: style }, attributes, listeners), children));
|
|
5390
|
+
}
|
|
5391
|
+
|
|
5350
5392
|
var originShift = (2 * Math.PI * 6378137) / 2.0;
|
|
5351
5393
|
var lngLatToMeters = function (lnglat, accuracy) {
|
|
5352
5394
|
if (accuracy === void 0) { accuracy = { enable: true, decimal: 1 }; }
|
|
@@ -5561,57 +5603,59 @@ var MlWmsLoader = function (props) {
|
|
|
5561
5603
|
}
|
|
5562
5604
|
}
|
|
5563
5605
|
}, [capabilities, mapHook.map]);
|
|
5606
|
+
var listContent = (React__default["default"].createElement(ListItem__default["default"], { secondaryAction: React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
5607
|
+
props.buttons,
|
|
5608
|
+
props.featureInfoEnabled && (React__default["default"].createElement(IconButton__default["default"], { sx: {
|
|
5609
|
+
padding: '4px',
|
|
5610
|
+
marginTop: '-3px',
|
|
5611
|
+
marginRight: '4px',
|
|
5612
|
+
background: function (theme) {
|
|
5613
|
+
if (!(layers === null || layers === void 0 ? void 0 : layers.some(function (layer) { return layer.visible && layer.queryable; })))
|
|
5614
|
+
return 'initial';
|
|
5615
|
+
if (_featureInfoEventsEnabled)
|
|
5616
|
+
return theme.palette.info.light;
|
|
5617
|
+
return theme.palette.grey[300];
|
|
5618
|
+
},
|
|
5619
|
+
}, "aria-label": "featureinfo", onClick: function () {
|
|
5620
|
+
if (typeof (props === null || props === void 0 ? void 0 : props.setFeatureInfoActive) === 'function') {
|
|
5621
|
+
props.setFeatureInfoActive(function (current) { return !current; });
|
|
5622
|
+
}
|
|
5623
|
+
else {
|
|
5624
|
+
setFeatureInfoEventsEnabled(function (current) { return !current; });
|
|
5625
|
+
}
|
|
5626
|
+
}, disabled: !(layers === null || layers === void 0 ? void 0 : layers.some(function (layer) { return layer.visible && layer.queryable; })) },
|
|
5627
|
+
React__default["default"].createElement(InfoIcon__default["default"], null))),
|
|
5628
|
+
React__default["default"].createElement(IconButton__default["default"], { 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["default"].createElement(iconsMaterial.ExpandLess, null) : React__default["default"].createElement(iconsMaterial.ExpandMore, null)),
|
|
5629
|
+
props.showDeleteButton && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
5630
|
+
React__default["default"].createElement(IconButton__default["default"], { "aria-label": "delete", edge: "end", onClick: function () {
|
|
5631
|
+
if (typeof props.onConfigChange === 'function') {
|
|
5632
|
+
setShowDeletionConfirmationDialog(true);
|
|
5633
|
+
}
|
|
5634
|
+
}, sx: { padding: '4px', marginTop: '-3px' } },
|
|
5635
|
+
React__default["default"].createElement(DeleteIcon__default["default"], null)),
|
|
5636
|
+
showDeletionConfirmationDialog && (React__default["default"].createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
|
|
5637
|
+
if (typeof props.onConfigChange === 'function') {
|
|
5638
|
+
props.onConfigChange(false);
|
|
5639
|
+
}
|
|
5640
|
+
}, onCancel: function () {
|
|
5641
|
+
setShowDeletionConfirmationDialog(false);
|
|
5642
|
+
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" }))))), sx: {
|
|
5643
|
+
paddingRight: 0,
|
|
5644
|
+
paddingLeft: 0,
|
|
5645
|
+
paddingTop: 0,
|
|
5646
|
+
paddingBottom: '4px',
|
|
5647
|
+
} },
|
|
5648
|
+
React__default["default"].createElement(material.ListItemIcon, { sx: { minWidth: '30px' } },
|
|
5649
|
+
React__default["default"].createElement(material.Checkbox, { sx: { padding: 0 }, checked: visible, onClick: function () {
|
|
5650
|
+
setVisible(function (val) { return !val; });
|
|
5651
|
+
} })),
|
|
5652
|
+
React__default["default"].createElement(ListItemText__default["default"], { primary: name, variant: "layerlist" })));
|
|
5564
5653
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
5565
5654
|
error && (React__default["default"].createElement(material.Snackbar, null,
|
|
5566
5655
|
React__default["default"].createElement(material.Box, null, error))),
|
|
5567
5656
|
wmsUrl && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
5568
|
-
React__default["default"].createElement(
|
|
5569
|
-
|
|
5570
|
-
props.featureInfoEnabled && (React__default["default"].createElement(IconButton__default["default"], { sx: {
|
|
5571
|
-
padding: '4px',
|
|
5572
|
-
marginTop: '-3px',
|
|
5573
|
-
marginRight: '4px',
|
|
5574
|
-
background: function (theme) {
|
|
5575
|
-
if (!(layers === null || layers === void 0 ? void 0 : layers.some(function (layer) { return layer.visible && layer.queryable; })))
|
|
5576
|
-
return 'initial';
|
|
5577
|
-
if (_featureInfoEventsEnabled)
|
|
5578
|
-
return theme.palette.info.light;
|
|
5579
|
-
return theme.palette.grey[300];
|
|
5580
|
-
},
|
|
5581
|
-
}, "aria-label": "featureinfo", onClick: function () {
|
|
5582
|
-
if (typeof (props === null || props === void 0 ? void 0 : props.setFeatureInfoActive) === 'function') {
|
|
5583
|
-
props.setFeatureInfoActive(function (current) { return !current; });
|
|
5584
|
-
}
|
|
5585
|
-
else {
|
|
5586
|
-
setFeatureInfoEventsEnabled(function (current) { return !current; });
|
|
5587
|
-
}
|
|
5588
|
-
}, disabled: !(layers === null || layers === void 0 ? void 0 : layers.some(function (layer) { return layer.visible && layer.queryable; })) },
|
|
5589
|
-
React__default["default"].createElement(InfoIcon__default["default"], null))),
|
|
5590
|
-
React__default["default"].createElement(IconButton__default["default"], { 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["default"].createElement(iconsMaterial.ExpandLess, null) : React__default["default"].createElement(iconsMaterial.ExpandMore, null)),
|
|
5591
|
-
props.showDeleteButton && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
5592
|
-
React__default["default"].createElement(IconButton__default["default"], { "aria-label": "delete", edge: "end", onClick: function () {
|
|
5593
|
-
if (typeof props.onConfigChange === 'function') {
|
|
5594
|
-
setShowDeletionConfirmationDialog(true);
|
|
5595
|
-
}
|
|
5596
|
-
}, sx: { padding: '4px', marginTop: '-3px' } },
|
|
5597
|
-
React__default["default"].createElement(DeleteIcon__default["default"], null)),
|
|
5598
|
-
showDeletionConfirmationDialog && (React__default["default"].createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
|
|
5599
|
-
if (typeof props.onConfigChange === 'function') {
|
|
5600
|
-
props.onConfigChange(false);
|
|
5601
|
-
}
|
|
5602
|
-
}, onCancel: function () {
|
|
5603
|
-
setShowDeletionConfirmationDialog(false);
|
|
5604
|
-
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" }))))), sx: {
|
|
5605
|
-
paddingRight: 0,
|
|
5606
|
-
paddingLeft: 0,
|
|
5607
|
-
paddingTop: 0,
|
|
5608
|
-
paddingBottom: '4px',
|
|
5609
|
-
} },
|
|
5610
|
-
React__default["default"].createElement(material.ListItemIcon, { sx: { minWidth: '30px' } },
|
|
5611
|
-
React__default["default"].createElement(material.Checkbox, { sx: { padding: 0 }, checked: visible, onClick: function () {
|
|
5612
|
-
setVisible(function (val) { return !val; });
|
|
5613
|
-
} })),
|
|
5614
|
-
React__default["default"].createElement(ListItemText__default["default"], { primary: name, variant: "layerlist" })),
|
|
5657
|
+
props.layerId && props.sortable && (React__default["default"].createElement(SortableContainer, { layerId: props.layerId }, listContent)),
|
|
5658
|
+
props.layerId && !props.sortable && (listContent),
|
|
5615
5659
|
React__default["default"].createElement(material.Box, { sx: { display: open ? 'block' : 'none' } },
|
|
5616
5660
|
React__default["default"].createElement(List__default["default"], { dense: true, component: "div", disablePadding: true, sx: { paddingLeft: '18px' } }, wmsUrl &&
|
|
5617
5661
|
((_j = layers === null || layers === void 0 ? void 0 : layers.map) === null || _j === void 0 ? void 0 : _j.call(layers, function (layer, idx) {
|
|
@@ -6220,377 +6264,72 @@ MlTerrainLayer.defaultProps = {
|
|
|
6220
6264
|
mapId: undefined,
|
|
6221
6265
|
};
|
|
6222
6266
|
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6267
|
+
var ListItemStyled$1 = system.styled(material.ListItem)({
|
|
6268
|
+
paddingRight: 0,
|
|
6269
|
+
paddingLeft: 0,
|
|
6270
|
+
paddingTop: 0,
|
|
6271
|
+
paddingBottom: '4px',
|
|
6272
|
+
});
|
|
6273
|
+
var ListItemIconStyled = system.styled(material.ListItemIcon)({
|
|
6274
|
+
minWidth: '30px',
|
|
6275
|
+
});
|
|
6276
|
+
var IconButtonStyled$1 = system.styled(material.IconButton)({
|
|
6277
|
+
marginRight: '0px',
|
|
6278
|
+
padding: '0px',
|
|
6279
|
+
});
|
|
6280
|
+
var CheckboxStyled$1 = system.styled(material.Checkbox)({
|
|
6281
|
+
padding: 0,
|
|
6282
|
+
marginRight: '5px',
|
|
6283
|
+
});
|
|
6284
|
+
var BoxStyled$1 = system.styled(system.Box)(function (_a) {
|
|
6285
|
+
var open = _a.open;
|
|
6286
|
+
return ({
|
|
6287
|
+
display: open ? 'block' : 'none',
|
|
6243
6288
|
});
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
React.
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
mapHook.map.map.setZoom(zoom.current);
|
|
6256
|
-
}
|
|
6257
|
-
}, [mapHook.map, props.zoom]);
|
|
6258
|
-
React.useEffect(function () {
|
|
6259
|
-
if (!mapHook.map)
|
|
6260
|
-
return;
|
|
6261
|
-
pitch.current = props.pitch;
|
|
6262
|
-
if (typeof pitch.current !== 'undefined' && pitch.current !== mapHook.map.map.getPitch()) {
|
|
6263
|
-
mapHook.map.map.setPitch(pitch.current);
|
|
6264
|
-
}
|
|
6265
|
-
}, [mapHook.map, props.pitch]);
|
|
6266
|
-
React.useEffect(function () {
|
|
6267
|
-
speed.current = props.speed;
|
|
6268
|
-
}, [props.speed]);
|
|
6269
|
-
var disableInteractivity = React.useCallback(function () {
|
|
6270
|
-
if (!mapHook.map)
|
|
6271
|
-
return;
|
|
6272
|
-
mapHook.map.map['scrollZoom'].disable();
|
|
6273
|
-
mapHook.map.map['boxZoom'].disable();
|
|
6274
|
-
mapHook.map.map['dragRotate'].disable();
|
|
6275
|
-
mapHook.map.map['dragPan'].disable();
|
|
6276
|
-
mapHook.map.map['keyboard'].disable();
|
|
6277
|
-
mapHook.map.map['doubleClickZoom'].disable();
|
|
6278
|
-
mapHook.map.map['touchZoomRotate'].disable();
|
|
6279
|
-
}, [mapHook.map]);
|
|
6280
|
-
var enableInteractivity = React.useCallback(function () {
|
|
6281
|
-
if (!mapHook.map)
|
|
6282
|
-
return;
|
|
6283
|
-
mapHook.map.map['scrollZoom'].enable();
|
|
6284
|
-
mapHook.map.map['boxZoom'].enable();
|
|
6285
|
-
mapHook.map.map['dragRotate'].enable();
|
|
6286
|
-
mapHook.map.map['dragPan'].enable();
|
|
6287
|
-
mapHook.map.map['keyboard'].enable();
|
|
6288
|
-
mapHook.map.map['doubleClickZoom'].enable();
|
|
6289
|
-
mapHook.map.map['touchZoomRotate'].enable();
|
|
6290
|
-
}, [mapHook.map]);
|
|
6291
|
-
function centerRoute() {
|
|
6292
|
-
if (!mapHook.map || !props.route)
|
|
6293
|
-
return;
|
|
6294
|
-
var bbox = turf__namespace.bbox(props.route);
|
|
6295
|
-
var bounds;
|
|
6296
|
-
if (bbox && bbox.length > 3) {
|
|
6297
|
-
bounds = [
|
|
6298
|
-
[bbox[0], bbox[1]],
|
|
6299
|
-
[bbox[2], bbox[3]],
|
|
6300
|
-
];
|
|
6301
|
-
mapHook.map.map.fitBounds(bounds, { padding: 100 });
|
|
6289
|
+
});
|
|
6290
|
+
var ListStyled$1 = system.styled(material.List)({
|
|
6291
|
+
marginLeft: '50px',
|
|
6292
|
+
});
|
|
6293
|
+
function LayerListFolder(_a) {
|
|
6294
|
+
var _b = _a.visible, visible = _b === void 0 ? true : _b, name = _a.name, children = _a.children, setVisible = _a.setVisible;
|
|
6295
|
+
var _c = React.useState(false), open = _c[0], setOpen = _c[1];
|
|
6296
|
+
var _d = React.useState(true), localVisible = _d[0], setLocalVisible = _d[1];
|
|
6297
|
+
var _visible = React.useMemo(function () {
|
|
6298
|
+
if (!visible) {
|
|
6299
|
+
return false;
|
|
6302
6300
|
}
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
var alongRoutelati = turf__namespace.along(props.route, step.current * kmPerStep).geometry
|
|
6313
|
-
.coordinates;
|
|
6314
|
-
if (step.current * kmPerStep < routeDistance) {
|
|
6315
|
-
mapHook.map.map.easeTo({
|
|
6316
|
-
center: alongRoutelati,
|
|
6317
|
-
bearing: turf__namespace.bearing(turf__namespace.point([mapHook.map.map.getCenter().lng, mapHook.map.map.getCenter().lat]), turf__namespace.point(alongRoutelati)),
|
|
6318
|
-
duration: stepDuration,
|
|
6319
|
-
essential: true,
|
|
6301
|
+
return localVisible;
|
|
6302
|
+
}, [visible, localVisible]);
|
|
6303
|
+
var _children = React.useMemo(function () {
|
|
6304
|
+
if (children) {
|
|
6305
|
+
if (Array.isArray(children)) {
|
|
6306
|
+
return children.map(function (element) {
|
|
6307
|
+
return React__default["default"].cloneElement(element, {
|
|
6308
|
+
visible: _visible,
|
|
6309
|
+
});
|
|
6320
6310
|
});
|
|
6321
|
-
if (typeof speed.current !== 'undefined') {
|
|
6322
|
-
step.current = step.current + speed.current;
|
|
6323
|
-
}
|
|
6324
|
-
else {
|
|
6325
|
-
step.current++;
|
|
6326
|
-
}
|
|
6327
|
-
console.log('PAN MOVE');
|
|
6328
|
-
setTimeout(function () {
|
|
6329
|
-
play();
|
|
6330
|
-
}, 100);
|
|
6331
|
-
}
|
|
6332
|
-
else {
|
|
6333
|
-
mapHook.map.map.setPitch(0);
|
|
6334
|
-
centerRoute();
|
|
6335
|
-
enableInteractivity();
|
|
6336
|
-
console.log('ENABLE CONTROLS');
|
|
6337
|
-
step.current = 1;
|
|
6338
|
-
}
|
|
6339
|
-
}
|
|
6340
|
-
else {
|
|
6341
|
-
enableInteractivity();
|
|
6342
|
-
}
|
|
6343
|
-
}
|
|
6344
|
-
function reset() {
|
|
6345
|
-
if (!mapHook.map)
|
|
6346
|
-
return;
|
|
6347
|
-
centerRoute();
|
|
6348
|
-
enableInteractivity();
|
|
6349
|
-
step.current = 1;
|
|
6350
|
-
}
|
|
6351
|
-
React.useEffect(function () {
|
|
6352
|
-
if (!mapHook.map || initializedRef.current)
|
|
6353
|
-
return;
|
|
6354
|
-
initializedRef.current = true;
|
|
6355
|
-
centerRoute();
|
|
6356
|
-
}, [mapHook.map]);
|
|
6357
|
-
React.useEffect(function () {
|
|
6358
|
-
return function () {
|
|
6359
|
-
if (timeoutId.current) {
|
|
6360
|
-
clearTimeout(timeoutId.current);
|
|
6361
6311
|
}
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
play: play,
|
|
6366
|
-
reset: reset,
|
|
6367
|
-
};
|
|
6368
|
-
};
|
|
6369
|
-
useCameraFollowPath.defaultProps = {
|
|
6370
|
-
mapId: undefined,
|
|
6371
|
-
zoom: 18,
|
|
6372
|
-
};
|
|
6373
|
-
|
|
6374
|
-
function useLayerFilter(props) {
|
|
6375
|
-
var mapHook = useMap({ mapId: props.mapId });
|
|
6376
|
-
React.useEffect(function () {
|
|
6377
|
-
if (!mapHook.map || !props.layerId || !props.filter)
|
|
6378
|
-
return;
|
|
6379
|
-
if (mapHook.map.map.getLayer(props.layerId)) {
|
|
6380
|
-
var _layerId_1 = props.layerId;
|
|
6381
|
-
mapHook.map.map.setFilter(_layerId_1, props.filter);
|
|
6382
|
-
return function () {
|
|
6383
|
-
if (mapHook.map) {
|
|
6384
|
-
mapHook.map.map.setFilter(_layerId_1, null);
|
|
6385
|
-
}
|
|
6386
|
-
};
|
|
6312
|
+
return React__default["default"].cloneElement(children, {
|
|
6313
|
+
visible: _visible,
|
|
6314
|
+
});
|
|
6387
6315
|
}
|
|
6388
|
-
return;
|
|
6389
|
-
}, [
|
|
6390
|
-
return
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
}
|
|
6398
|
-
|
|
6399
|
-
function
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
});
|
|
6406
|
-
var mapHook = useMap({
|
|
6407
|
-
mapId: props.mapId
|
|
6408
|
-
});
|
|
6409
|
-
React.useEffect(function () {
|
|
6410
|
-
if (!mapHook.map) return true;
|
|
6411
|
-
if (typeof props.condition !== 'undefined' && props.condition === false) return;
|
|
6412
|
-
//console.log('useLayerEvent');
|
|
6413
|
-
//console.log(mapState);
|
|
6414
|
-
|
|
6415
|
-
if (mapHook.map.map.getLayer(props.layerId)) {
|
|
6416
|
-
//console.log("layer avail");
|
|
6417
|
-
var _event = props.event;
|
|
6418
|
-
var _layerId = props.layerId;
|
|
6419
|
-
var _eventHandler = props.eventHandler;
|
|
6420
|
-
|
|
6421
|
-
//console.log(_event);
|
|
6422
|
-
mapHook.map.on(_event, _layerId, _eventHandler, mapHook.componentId);
|
|
6423
|
-
if ((props === null || props === void 0 ? void 0 : props.addTouchEvents) === true) {
|
|
6424
|
-
if (touchEquivalentsKeys.indexOf(_event) !== -1) {
|
|
6425
|
-
mapHook.map.on(touchEquivalents[_event], _layerId, _eventHandler, mapHook.componentId);
|
|
6426
|
-
}
|
|
6427
|
-
}
|
|
6428
|
-
return function () {
|
|
6429
|
-
mapHook.map.off(_event, _layerId, _eventHandler);
|
|
6430
|
-
if ((props === null || props === void 0 ? void 0 : props.addTouchEvents) === true) {
|
|
6431
|
-
if (touchEquivalentsKeys.indexOf(_event) !== -1) {
|
|
6432
|
-
mapHook.map.off(touchEquivalents[_event], _layerId, _eventHandler, mapHook.componentId);
|
|
6433
|
-
}
|
|
6434
|
-
}
|
|
6435
|
-
};
|
|
6436
|
-
}
|
|
6437
|
-
}, [props, mapState, mapHook.map]);
|
|
6438
|
-
return {};
|
|
6439
|
-
}
|
|
6440
|
-
|
|
6441
|
-
var useLayerContext = function () {
|
|
6442
|
-
var layerContext = React.useContext(LayerContext);
|
|
6443
|
-
return layerContext;
|
|
6444
|
-
};
|
|
6445
|
-
|
|
6446
|
-
/**
|
|
6447
|
-
* Enables the use of custom protocols (basically custom tile load functions) in the maplibre-gl-js library.
|
|
6448
|
-
*
|
|
6449
|
-
*/
|
|
6450
|
-
var useAddProtocol = function (props) {
|
|
6451
|
-
React.useEffect(function () {
|
|
6452
|
-
if (!props.protocol || typeof props.handler !== 'function')
|
|
6453
|
-
return;
|
|
6454
|
-
maplibregl__default["default"].addProtocol(props.protocol, props.handler);
|
|
6455
|
-
return function () {
|
|
6456
|
-
maplibregl__default["default"].removeProtocol(props.protocol);
|
|
6457
|
-
};
|
|
6458
|
-
}, []);
|
|
6459
|
-
return {};
|
|
6460
|
-
};
|
|
6461
|
-
useAddProtocol.defaultProps = {
|
|
6462
|
-
mapId: undefined,
|
|
6463
|
-
};
|
|
6464
|
-
|
|
6465
|
-
var SimpleDataContext = /*#__PURE__*/React__default["default"].createContext({});
|
|
6466
|
-
var SimpleDataContextProvider = SimpleDataContext.Provider;
|
|
6467
|
-
|
|
6468
|
-
var SimpleDataProvider = function SimpleDataProvider(props) {
|
|
6469
|
-
var _useState = React.useState(null),
|
|
6470
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
6471
|
-
data = _useState2[0],
|
|
6472
|
-
setData = _useState2[1];
|
|
6473
|
-
React.useEffect(function () {
|
|
6474
|
-
if (!props.url) return;
|
|
6475
|
-
var data_promise = null;
|
|
6476
|
-
if (props.format === "json") {
|
|
6477
|
-
data_promise = d3__namespace.json(props.url);
|
|
6478
|
-
} else if (props.format === "csv") {
|
|
6479
|
-
data_promise = d3__namespace.csv(props.url);
|
|
6480
|
-
} else if (props.format === "xml") {
|
|
6481
|
-
data_promise = d3__namespace.xml(props.url);
|
|
6482
|
-
}
|
|
6483
|
-
if (data_promise) {
|
|
6484
|
-
data_promise.then(function (received_data) {
|
|
6485
|
-
if (props.format === "xml") {
|
|
6486
|
-
if (props.nodeType) {
|
|
6487
|
-
var dataTmp = [];
|
|
6488
|
-
received_data.querySelectorAll(props.nodeType).forEach(function (el) {
|
|
6489
|
-
dataTmp.push(props.formatData(el));
|
|
6490
|
-
});
|
|
6491
|
-
setData(dataTmp);
|
|
6492
|
-
}
|
|
6493
|
-
} else {
|
|
6494
|
-
if (props.data_property) {
|
|
6495
|
-
received_data = received_data[props.data_property];
|
|
6496
|
-
}
|
|
6497
|
-
if (typeof props.formatData === "function") {
|
|
6498
|
-
setData(received_data.map(props.formatData));
|
|
6499
|
-
} else {
|
|
6500
|
-
setData(received_data);
|
|
6501
|
-
}
|
|
6502
|
-
}
|
|
6503
|
-
if (typeof props.onData === "function") {
|
|
6504
|
-
props.onData();
|
|
6505
|
-
}
|
|
6506
|
-
});
|
|
6507
|
-
}
|
|
6508
|
-
}, [props.url, props]);
|
|
6509
|
-
var value = {
|
|
6510
|
-
data: data,
|
|
6511
|
-
setData: setData
|
|
6512
|
-
};
|
|
6513
|
-
return /*#__PURE__*/React__default["default"].createElement(SimpleDataContextProvider, {
|
|
6514
|
-
value: value
|
|
6515
|
-
}, props.children);
|
|
6516
|
-
};
|
|
6517
|
-
SimpleDataProvider.propTypes = {
|
|
6518
|
-
children: PropTypes__default["default"].node.isRequired
|
|
6519
|
-
};
|
|
6520
|
-
|
|
6521
|
-
var ListStyled$1 = material.styled(material.List)({
|
|
6522
|
-
marginTop: '15px',
|
|
6523
|
-
});
|
|
6524
|
-
function LayerList(props) {
|
|
6525
|
-
return React__default["default"].createElement(ListStyled$1, null, props === null || props === void 0 ? void 0 : props.children);
|
|
6526
|
-
}
|
|
6527
|
-
|
|
6528
|
-
var ListItemStyled$1 = system.styled(material.ListItem)({
|
|
6529
|
-
paddingRight: 0,
|
|
6530
|
-
paddingLeft: 0,
|
|
6531
|
-
paddingTop: 0,
|
|
6532
|
-
paddingBottom: '4px',
|
|
6533
|
-
});
|
|
6534
|
-
var ListItemIconStyled = system.styled(material.ListItemIcon)({
|
|
6535
|
-
minWidth: '30px',
|
|
6536
|
-
});
|
|
6537
|
-
var IconButtonStyled$1 = system.styled(material.IconButton)({
|
|
6538
|
-
marginRight: '0px',
|
|
6539
|
-
padding: '0px',
|
|
6540
|
-
});
|
|
6541
|
-
var CheckboxStyled$1 = system.styled(material.Checkbox)({
|
|
6542
|
-
padding: 0,
|
|
6543
|
-
marginRight: '5px',
|
|
6544
|
-
});
|
|
6545
|
-
var BoxStyled$1 = system.styled(system.Box)(function (_a) {
|
|
6546
|
-
var open = _a.open;
|
|
6547
|
-
return ({
|
|
6548
|
-
display: open ? 'block' : 'none',
|
|
6549
|
-
});
|
|
6550
|
-
});
|
|
6551
|
-
var ListStyled = system.styled(material.List)({
|
|
6552
|
-
marginLeft: '50px',
|
|
6553
|
-
});
|
|
6554
|
-
function LayerListFolder(_a) {
|
|
6555
|
-
var _b = _a.visible, visible = _b === void 0 ? true : _b, name = _a.name, children = _a.children, setVisible = _a.setVisible;
|
|
6556
|
-
var _c = React.useState(false), open = _c[0], setOpen = _c[1];
|
|
6557
|
-
var _d = React.useState(true), localVisible = _d[0], setLocalVisible = _d[1];
|
|
6558
|
-
var _visible = React.useMemo(function () {
|
|
6559
|
-
if (!visible) {
|
|
6560
|
-
return false;
|
|
6561
|
-
}
|
|
6562
|
-
return localVisible;
|
|
6563
|
-
}, [visible, localVisible]);
|
|
6564
|
-
var _children = React.useMemo(function () {
|
|
6565
|
-
if (children) {
|
|
6566
|
-
if (Array.isArray(children)) {
|
|
6567
|
-
return children.map(function (element) {
|
|
6568
|
-
return React__default["default"].cloneElement(element, {
|
|
6569
|
-
visible: _visible,
|
|
6570
|
-
});
|
|
6571
|
-
});
|
|
6572
|
-
}
|
|
6573
|
-
return React__default["default"].cloneElement(children, {
|
|
6574
|
-
visible: _visible,
|
|
6575
|
-
});
|
|
6576
|
-
}
|
|
6577
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
6578
|
-
}, [_visible]);
|
|
6579
|
-
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6580
|
-
React__default["default"].createElement(ListItemStyled$1, null,
|
|
6581
|
-
React__default["default"].createElement(ListItemIconStyled, null,
|
|
6582
|
-
React__default["default"].createElement(IconButtonStyled$1, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React__default["default"].createElement(iconsMaterial.ExpandMore, null) : React__default["default"].createElement(iconsMaterial.KeyboardArrowRight, null)),
|
|
6583
|
-
React__default["default"].createElement(CheckboxStyled$1, { disabled: setVisible ? false : !visible, checked: setVisible ? visible : localVisible, onClick: function () {
|
|
6584
|
-
if (setVisible) {
|
|
6585
|
-
setVisible(function (val) { return !val; });
|
|
6586
|
-
}
|
|
6587
|
-
else {
|
|
6588
|
-
setLocalVisible(function (val) { return !val; });
|
|
6589
|
-
}
|
|
6590
|
-
} })),
|
|
6591
|
-
React__default["default"].createElement(material.ListItemText, { primary: name, variant: "layerlist" })),
|
|
6592
|
-
React__default["default"].createElement(BoxStyled$1, { open: open },
|
|
6593
|
-
React__default["default"].createElement(ListStyled, { disablePadding: true }, _children))));
|
|
6316
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
6317
|
+
}, [_visible]);
|
|
6318
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6319
|
+
React__default["default"].createElement(ListItemStyled$1, null,
|
|
6320
|
+
React__default["default"].createElement(ListItemIconStyled, null,
|
|
6321
|
+
React__default["default"].createElement(IconButtonStyled$1, { edge: "end", "aria-label": "open", onClick: function () { return setOpen(!open); } }, open ? React__default["default"].createElement(iconsMaterial.ExpandMore, null) : React__default["default"].createElement(iconsMaterial.KeyboardArrowRight, null)),
|
|
6322
|
+
React__default["default"].createElement(CheckboxStyled$1, { disabled: setVisible ? false : !visible, checked: setVisible ? visible : localVisible, onClick: function () {
|
|
6323
|
+
if (setVisible) {
|
|
6324
|
+
setVisible(function (val) { return !val; });
|
|
6325
|
+
}
|
|
6326
|
+
else {
|
|
6327
|
+
setLocalVisible(function (val) { return !val; });
|
|
6328
|
+
}
|
|
6329
|
+
} })),
|
|
6330
|
+
React__default["default"].createElement(material.ListItemText, { primary: name, variant: "layerlist" })),
|
|
6331
|
+
React__default["default"].createElement(BoxStyled$1, { open: open },
|
|
6332
|
+
React__default["default"].createElement(ListStyled$1, { disablePadding: true }, _children))));
|
|
6594
6333
|
}
|
|
6595
6334
|
|
|
6596
6335
|
var converters = {
|
|
@@ -6817,16 +6556,16 @@ var DeleteIconButton = material.styled(material.IconButton)({
|
|
|
6817
6556
|
marginLeft: '20px',
|
|
6818
6557
|
});
|
|
6819
6558
|
function LayerListItem(_a) {
|
|
6820
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6559
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
6821
6560
|
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"]);
|
|
6822
|
-
var
|
|
6823
|
-
var
|
|
6824
|
-
var
|
|
6561
|
+
var _p = React.useState(true), localVisible = _p[0], setLocalVisible = _p[1];
|
|
6562
|
+
var _q = React.useState(false), paintPropsFormVisible = _q[0], setPaintPropsFormVisible = _q[1];
|
|
6563
|
+
var _r = React.useState(false), showDeletionConfirmationDialog = _r[0], setShowDeletionConfirmationDialog = _r[1];
|
|
6825
6564
|
var deletedRef = React.useRef(false);
|
|
6826
6565
|
var visibleRef = React.useRef(visible);
|
|
6827
6566
|
// this state variable is used for layer components that provide a paint attribute
|
|
6828
|
-
var
|
|
6829
|
-
getDefaultPaintPropsByType(((_c = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _c === void 0 ? void 0 : _c.type) || getDefaulLayerTypeByGeometry(layerComponent.props.geojson))), paintProps =
|
|
6567
|
+
var _s = React.useState(((_b = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _b === void 0 ? void 0 : _b.paint) ||
|
|
6568
|
+
getDefaultPaintPropsByType(((_c = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _c === void 0 ? void 0 : _c.type) || getDefaulLayerTypeByGeometry(layerComponent.props.geojson))), paintProps = _s[0], setPaintProps = _s[1];
|
|
6830
6569
|
var _visible = React.useMemo(function () {
|
|
6831
6570
|
if (!visible) {
|
|
6832
6571
|
return false;
|
|
@@ -6894,22 +6633,24 @@ function LayerListItem(_a) {
|
|
|
6894
6633
|
}
|
|
6895
6634
|
return undefined;
|
|
6896
6635
|
}, [layerComponent]);
|
|
6636
|
+
var listContent = (React__default["default"].createElement(ListItemStyled, { sx: __assign({}, props.listItemSx), secondaryAction: configurable && ((_f = Object.keys(paintProps)) === null || _f === void 0 ? void 0 : _f.length) > 0 ? (React__default["default"].createElement(React__default["default"].Fragment, null, props === null || props === void 0 ? void 0 :
|
|
6637
|
+
props.buttons,
|
|
6638
|
+
React__default["default"].createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
6639
|
+
setPaintPropsFormVisible(function (current) {
|
|
6640
|
+
return !current;
|
|
6641
|
+
});
|
|
6642
|
+
} },
|
|
6643
|
+
React__default["default"].createElement(iconsMaterial.Tune, null)))) : undefined },
|
|
6644
|
+
React__default["default"].createElement(CheckboxListItemIcon, null,
|
|
6645
|
+
React__default["default"].createElement(CheckboxStyled, { disabled: !visible, checked: localVisible, onClick: function () {
|
|
6646
|
+
setLocalVisible(function (val) { return !val; });
|
|
6647
|
+
} })),
|
|
6648
|
+
React__default["default"].createElement(material.ListItemText, { variant: "layerlist", primary: name, secondary: description, primaryTypographyProps: { overflow: 'hidden' } })));
|
|
6897
6649
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6898
|
-
!((
|
|
6899
|
-
|
|
6900
|
-
React__default["default"].createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
6901
|
-
setPaintPropsFormVisible(function (current) {
|
|
6902
|
-
return !current;
|
|
6903
|
-
});
|
|
6904
|
-
} },
|
|
6905
|
-
React__default["default"].createElement(iconsMaterial.Tune, null)))) : undefined },
|
|
6906
|
-
React__default["default"].createElement(CheckboxListItemIcon, null,
|
|
6907
|
-
React__default["default"].createElement(CheckboxStyled, { disabled: !visible, checked: localVisible, onClick: function () {
|
|
6908
|
-
setLocalVisible(function (val) { return !val; });
|
|
6909
|
-
} })),
|
|
6910
|
-
React__default["default"].createElement(material.ListItemText, { variant: "layerlist", primary: name, secondary: description, primaryTypographyProps: { overflow: 'hidden' } }))),
|
|
6650
|
+
props.sortable && props.layerId && !((_g = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _g === void 0 ? void 0 : _g.layers) && (React__default["default"].createElement(SortableContainer, { layerId: props.layerId }, listContent)),
|
|
6651
|
+
!props.sortable && !((_h = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _h === void 0 ? void 0 : _h.layers) && (listContent),
|
|
6911
6652
|
_layerComponent,
|
|
6912
|
-
!((
|
|
6653
|
+
!((_j = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _j === void 0 ? void 0 : _j.layers) &&
|
|
6913
6654
|
Object.keys(paintProps).length > 0 &&
|
|
6914
6655
|
configurable &&
|
|
6915
6656
|
paintPropsFormVisible && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
@@ -6930,7 +6671,7 @@ function LayerListItem(_a) {
|
|
|
6930
6671
|
setShowDeletionConfirmationDialog(false);
|
|
6931
6672
|
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" })))),
|
|
6932
6673
|
React__default["default"].createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: layerType }))),
|
|
6933
|
-
((
|
|
6674
|
+
((_k = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _k === void 0 ? void 0 : _k.layers) && (React__default["default"].createElement(LayerListFolder, { visible: localVisible, setVisible: setLocalVisible, name: name }, (_o = (_m = (_l = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _l === void 0 ? void 0 : _l.layers) === null || _m === void 0 ? void 0 : _m.map) === null || _o === void 0 ? void 0 : _o.call(_m, function (_el, idx) { return (React__default["default"].createElement(LayerListItemVectorLayer, { vtProps: layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props, setVtProps: setLayerState, id: '' + idx, key: '' + idx, visibleMaster: _visible })); })))));
|
|
6934
6675
|
}
|
|
6935
6676
|
LayerListItem.defaultProps = {
|
|
6936
6677
|
type: 'layer',
|
|
@@ -6939,108 +6680,569 @@ LayerListItem.defaultProps = {
|
|
|
6939
6680
|
buttons: React__default["default"].createElement(React__default["default"].Fragment, null),
|
|
6940
6681
|
};
|
|
6941
6682
|
|
|
6942
|
-
var
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6683
|
+
var sketchTools = [
|
|
6684
|
+
{ name: 'Point', mode: 'draw_point', icon: React__default["default"].createElement(ScatterPlotIcon__default["default"], null) },
|
|
6685
|
+
{ name: 'LineString', mode: 'draw_line_string', icon: React__default["default"].createElement(PolylineIcon__default["default"], null) },
|
|
6686
|
+
{ name: 'Polygon', mode: 'draw_polygon', icon: React__default["default"].createElement(PentagonIcon__default["default"], null) },
|
|
6687
|
+
];
|
|
6688
|
+
/**
|
|
6689
|
+
* Component template
|
|
6690
|
+
*
|
|
6691
|
+
*/
|
|
6692
|
+
var MlSketchTool = function (props) {
|
|
6951
6693
|
var _a, _b;
|
|
6952
|
-
var
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6694
|
+
var mapHook = useMap({
|
|
6695
|
+
mapId: props.mapId,
|
|
6696
|
+
waitForLayer: props.insertBeforeLayer,
|
|
6697
|
+
});
|
|
6698
|
+
var _c = React.useState(), hoveredGeometry = _c[0], setHoveredGeometry = _c[1];
|
|
6699
|
+
var _d = React.useState({
|
|
6700
|
+
activeGeometryIndex: undefined,
|
|
6701
|
+
selectedGeoJson: undefined,
|
|
6702
|
+
geometries: [],
|
|
6703
|
+
drawMode: undefined,
|
|
6704
|
+
}), sketchState = _d[0], setSketchState = _d[1];
|
|
6705
|
+
var buttonStyle = __assign({}, props.buttonStyleOverride);
|
|
6706
|
+
var buttonClickHandler = function (buttonDrawMode) {
|
|
6707
|
+
setSketchState(function (_state) { return ({
|
|
6708
|
+
drawMode: _state.drawMode !== buttonDrawMode ? buttonDrawMode : undefined,
|
|
6709
|
+
geometries: _state.geometries,
|
|
6710
|
+
activeGeometryIndex: undefined,
|
|
6711
|
+
selectedGeoJson: undefined,
|
|
6712
|
+
}); });
|
|
6713
|
+
};
|
|
6714
|
+
var removeGeoJson = function (geoJson) {
|
|
6715
|
+
setSketchState(function (_sketchState) {
|
|
6716
|
+
var _geometries = __spreadArray([], _sketchState.geometries, true);
|
|
6717
|
+
_geometries.splice(_geometries.indexOf(geoJson), 1);
|
|
6718
|
+
return __assign(__assign({}, _sketchState), { geometries: _geometries, activeGeometryIndex: _sketchState.activeGeometryIndex
|
|
6719
|
+
? _sketchState.activeGeometryIndex - 1
|
|
6720
|
+
: undefined });
|
|
6721
|
+
});
|
|
6722
|
+
};
|
|
6723
|
+
var SketchToolButtons = function () {
|
|
6724
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, sketchTools.map(function (el) {
|
|
6725
|
+
var stateColor = function (theme) {
|
|
6726
|
+
if (sketchState.drawMode === el.mode) {
|
|
6727
|
+
return theme.palette.primary.main;
|
|
6728
|
+
}
|
|
6729
|
+
else {
|
|
6730
|
+
return theme.palette.navigation.navColor;
|
|
6731
|
+
}
|
|
6732
|
+
};
|
|
6733
|
+
var stateIconColor = function (theme) {
|
|
6734
|
+
if (sketchState.drawMode !== el.mode) {
|
|
6735
|
+
return theme.palette.primary.main;
|
|
6736
|
+
}
|
|
6737
|
+
else {
|
|
6738
|
+
return theme.palette.navigation.navColor;
|
|
6739
|
+
}
|
|
6740
|
+
};
|
|
6741
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6742
|
+
React__default["default"].createElement(Tooltip__default["default"], { title: el.name },
|
|
6743
|
+
React__default["default"].createElement(material.Button, { sx: __assign({ color: stateIconColor, backgroundColor: stateColor, '&:hover': {
|
|
6744
|
+
backgroundColor: stateColor,
|
|
6745
|
+
} }, buttonStyle), onClick: function () { return buttonClickHandler(el.mode); } }, el.icon))));
|
|
6746
|
+
})));
|
|
6747
|
+
};
|
|
6973
6748
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6974
|
-
React__default["default"].createElement(
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6749
|
+
React__default["default"].createElement(system.Box, { sx: {
|
|
6750
|
+
zIndex: 104,
|
|
6751
|
+
} },
|
|
6752
|
+
React__default["default"].createElement(ButtonGroup__default["default"], null,
|
|
6753
|
+
React__default["default"].createElement(SketchToolButtons, null))),
|
|
6754
|
+
sketchState.drawMode && (React__default["default"].createElement(MlFeatureEditor, { mode: sketchState.drawMode, geojson: sketchState.selectedGeoJson, onChange: function (feature) {
|
|
6755
|
+
if (!(feature === null || feature === void 0 ? void 0 : feature[0]))
|
|
6756
|
+
return;
|
|
6757
|
+
setSketchState(function (_sketchState) {
|
|
6758
|
+
var _geometries = __spreadArray([], sketchState.geometries, true);
|
|
6759
|
+
if (typeof _sketchState.activeGeometryIndex === 'undefined') {
|
|
6760
|
+
var tempFeature = feature[0];
|
|
6761
|
+
tempFeature.properties.id = tempFeature.id;
|
|
6762
|
+
_sketchState.activeGeometryIndex = _geometries.length;
|
|
6763
|
+
_geometries.push(tempFeature);
|
|
6764
|
+
}
|
|
6765
|
+
else {
|
|
6766
|
+
_geometries[_sketchState.activeGeometryIndex] = feature[0];
|
|
6767
|
+
}
|
|
6768
|
+
return __assign(__assign({}, _sketchState), { geometries: _geometries });
|
|
6769
|
+
});
|
|
6770
|
+
}, onFinish: function () {
|
|
6771
|
+
setSketchState(function (_sketchState) { return (__assign(__assign({}, _sketchState), { drawMode: undefined, activeGeometryIndex: undefined, selectedGeoJson: undefined })); });
|
|
6772
|
+
} })),
|
|
6773
|
+
React__default["default"].createElement(List__default["default"], { sx: { zIndex: 105 } },
|
|
6774
|
+
sketchState.geometries.map(function (el) { return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6775
|
+
React__default["default"].createElement(system.Box, { key: el.id, sx: { display: 'flex', flexDirection: 'column' } },
|
|
6776
|
+
React__default["default"].createElement("br", null),
|
|
6777
|
+
React__default["default"].createElement(system.Box, { flexDirection: 'row', sx: {
|
|
6778
|
+
'&:hover': {
|
|
6779
|
+
backgroundColor: 'rgb(177, 177, 177, 0.2)',
|
|
6780
|
+
},
|
|
6781
|
+
}, onMouseOver: function () {
|
|
6782
|
+
setHoveredGeometry(el);
|
|
6783
|
+
}, onMouseLeave: function () {
|
|
6784
|
+
setHoveredGeometry(undefined);
|
|
6785
|
+
} },
|
|
6786
|
+
React__default["default"].createElement(LayerListItem, { listItemSx: buttonStyle, configurable: true, layerComponent: React__default["default"].createElement(MlGeoJsonLayer, { mapId: props.mapId, geojson: el, layerId: String(el.id) }), type: 'layer', name: String(el.id), description: el.geometry.type }),
|
|
6787
|
+
React__default["default"].createElement(system.Box, { sx: {
|
|
6788
|
+
padding: '3px 30px',
|
|
6789
|
+
} },
|
|
6790
|
+
React__default["default"].createElement(ButtonGroup__default["default"], { size: "small" },
|
|
6791
|
+
React__default["default"].createElement(material.Button, { onClick: function () {
|
|
6792
|
+
var _a;
|
|
6793
|
+
(_a = mapHook === null || mapHook === void 0 ? void 0 : mapHook.map) === null || _a === void 0 ? void 0 : _a.map.setCenter(el.geometry.type === 'Point'
|
|
6794
|
+
? el.geometry.coordinates
|
|
6795
|
+
: turf__namespace.centerOfMass(el).geometry.coordinates);
|
|
6992
6796
|
} },
|
|
6993
|
-
React__default["default"].createElement(
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
if (layerConfig === false) {
|
|
6997
|
-
_layers.splice(idx, 1);
|
|
6998
|
-
}
|
|
6999
|
-
else {
|
|
7000
|
-
_layers[idx].config = layerConfig;
|
|
7001
|
-
}
|
|
7002
|
-
return _layers;
|
|
7003
|
-
});
|
|
7004
|
-
}, configurable: true, showDeleteButton: true })));
|
|
7005
|
-
case 'wms':
|
|
7006
|
-
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
7007
|
-
React__default["default"].createElement(MlWmsLoader, __assign({}, layer.config, { key: layer.id, mapId: props === null || props === void 0 ? void 0 : props.mapId, insertBeforeLayer: 'content_order_' + (layers.length - 1 - idx), onConfigChange: function (layerConfig) {
|
|
7008
|
-
setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7009
|
-
var _layers = __spreadArray([], current, true);
|
|
7010
|
-
if (layerConfig === false) {
|
|
7011
|
-
_layers.splice(idx, 1);
|
|
7012
|
-
}
|
|
7013
|
-
else {
|
|
7014
|
-
_layers[idx].config.config = layerConfig;
|
|
7015
|
-
}
|
|
7016
|
-
return _layers;
|
|
7017
|
-
});
|
|
7018
|
-
}, featureInfoActive: ((_b = layer === null || layer === void 0 ? void 0 : layer.config) === null || _b === void 0 ? void 0 : _b.featureInfoActive) || false, setFeatureInfoActive: function (updateFunction) {
|
|
7019
|
-
setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7020
|
-
var _a;
|
|
7021
|
-
var _layers = __spreadArray([], current, true);
|
|
7022
|
-
if (typeof updateFunction === 'function') {
|
|
7023
|
-
_layers[idx].config.featureInfoActive =
|
|
7024
|
-
updateFunction(((_a = _layers[idx].config) === null || _a === void 0 ? void 0 : _a.featureInfoActive) || false);
|
|
7025
|
-
}
|
|
7026
|
-
return _layers;
|
|
7027
|
-
});
|
|
7028
|
-
}, showDeleteButton: true, buttons: React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
7029
|
-
React__default["default"].createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7030
|
-
layerContext.moveDown(layer.id || '');
|
|
6797
|
+
React__default["default"].createElement(GpsFixedIcon__default["default"], null)),
|
|
6798
|
+
React__default["default"].createElement(material.Button, { sx: buttonStyle, onClick: function () {
|
|
6799
|
+
setSketchState(function (_sketchState) { return (__assign(__assign({}, _sketchState), { selectedGeoJson: el, activeGeometryIndex: _sketchState.geometries.indexOf(el), drawMode: 'simple_select' })); });
|
|
7031
6800
|
} },
|
|
7032
|
-
React__default["default"].createElement(
|
|
7033
|
-
React__default["default"].createElement(
|
|
7034
|
-
|
|
6801
|
+
React__default["default"].createElement(EditIcon__default["default"], null)),
|
|
6802
|
+
React__default["default"].createElement(material.Button, { sx: buttonStyle, onClick: function () {
|
|
6803
|
+
removeGeoJson(el);
|
|
6804
|
+
setHoveredGeometry(undefined);
|
|
7035
6805
|
} },
|
|
7036
|
-
React__default["default"].createElement(
|
|
7037
|
-
|
|
7038
|
-
|
|
6806
|
+
React__default["default"].createElement(DeleteIcon__default["default"], null)))))))); }),
|
|
6807
|
+
hoveredGeometry && (React__default["default"].createElement(MlGeoJsonLayer, { mapId: props.mapId, geojson: { type: 'FeatureCollection', features: [hoveredGeometry] }, type: 'line', layerId: 'highlightBorder', paint: {
|
|
6808
|
+
'line-color': '#dd9900',
|
|
6809
|
+
'line-opacity': 0.4,
|
|
6810
|
+
'line-width': 10,
|
|
6811
|
+
} }))),
|
|
6812
|
+
sketchState.drawMode === 'simple_select' && (React__default["default"].createElement(material.Typography, { sx: { fontSize: '0.6em' } },
|
|
6813
|
+
"Edit ", (_b = (_a = sketchState.selectedGeoJson) === null || _a === void 0 ? void 0 : _a.geometry) === null || _b === void 0 ? void 0 :
|
|
6814
|
+
_b.type))));
|
|
6815
|
+
};
|
|
6816
|
+
MlSketchTool.defaultProps = {
|
|
6817
|
+
mapId: undefined,
|
|
6818
|
+
buttonStyleOverride: {},
|
|
6819
|
+
};
|
|
6820
|
+
|
|
6821
|
+
/**
|
|
6822
|
+
* Component template
|
|
6823
|
+
*
|
|
6824
|
+
*/
|
|
6825
|
+
var useCameraFollowPath = function (props) {
|
|
6826
|
+
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
6827
|
+
// without the requirement of adding it to the dependency list (ignore the false eslint exhaustive deps warning)
|
|
6828
|
+
var initializedRef = React.useRef(false);
|
|
6829
|
+
var pause = React.useRef(props.pause);
|
|
6830
|
+
var zoom = React.useRef(props.zoom);
|
|
6831
|
+
var pitch = React.useRef(props.pitch);
|
|
6832
|
+
var step = React.useRef(1);
|
|
6833
|
+
var speed = React.useRef(props.speed);
|
|
6834
|
+
var timeoutId = React.useRef();
|
|
6835
|
+
var kmPerStep = props.kmPerStep || 0.01;
|
|
6836
|
+
var routeDistance = turf__namespace.lineDistance(props.route);
|
|
6837
|
+
var stepDuration = props.stepDuration || 70;
|
|
6838
|
+
var mapHook = useMap({
|
|
6839
|
+
mapId: props.mapId,
|
|
6840
|
+
waitForLayer: props.insertBeforeLayer,
|
|
6841
|
+
});
|
|
6842
|
+
React.useEffect(function () {
|
|
6843
|
+
pause.current = props.pause;
|
|
6844
|
+
if (!pause.current) {
|
|
6845
|
+
play();
|
|
6846
|
+
}
|
|
6847
|
+
}, [props.pause]);
|
|
6848
|
+
React.useEffect(function () {
|
|
6849
|
+
if (!mapHook.map)
|
|
6850
|
+
return;
|
|
6851
|
+
zoom.current = props.zoom;
|
|
6852
|
+
if (typeof zoom.current !== 'undefined' && mapHook.map.map.getZoom() !== zoom.current) {
|
|
6853
|
+
mapHook.map.map.setZoom(zoom.current);
|
|
6854
|
+
}
|
|
6855
|
+
}, [mapHook.map, props.zoom]);
|
|
6856
|
+
React.useEffect(function () {
|
|
6857
|
+
if (!mapHook.map)
|
|
6858
|
+
return;
|
|
6859
|
+
pitch.current = props.pitch;
|
|
6860
|
+
if (typeof pitch.current !== 'undefined' && pitch.current !== mapHook.map.map.getPitch()) {
|
|
6861
|
+
mapHook.map.map.setPitch(pitch.current);
|
|
6862
|
+
}
|
|
6863
|
+
}, [mapHook.map, props.pitch]);
|
|
6864
|
+
React.useEffect(function () {
|
|
6865
|
+
speed.current = props.speed;
|
|
6866
|
+
}, [props.speed]);
|
|
6867
|
+
var disableInteractivity = React.useCallback(function () {
|
|
6868
|
+
if (!mapHook.map)
|
|
6869
|
+
return;
|
|
6870
|
+
mapHook.map.map['scrollZoom'].disable();
|
|
6871
|
+
mapHook.map.map['boxZoom'].disable();
|
|
6872
|
+
mapHook.map.map['dragRotate'].disable();
|
|
6873
|
+
mapHook.map.map['dragPan'].disable();
|
|
6874
|
+
mapHook.map.map['keyboard'].disable();
|
|
6875
|
+
mapHook.map.map['doubleClickZoom'].disable();
|
|
6876
|
+
mapHook.map.map['touchZoomRotate'].disable();
|
|
6877
|
+
}, [mapHook.map]);
|
|
6878
|
+
var enableInteractivity = React.useCallback(function () {
|
|
6879
|
+
if (!mapHook.map)
|
|
6880
|
+
return;
|
|
6881
|
+
mapHook.map.map['scrollZoom'].enable();
|
|
6882
|
+
mapHook.map.map['boxZoom'].enable();
|
|
6883
|
+
mapHook.map.map['dragRotate'].enable();
|
|
6884
|
+
mapHook.map.map['dragPan'].enable();
|
|
6885
|
+
mapHook.map.map['keyboard'].enable();
|
|
6886
|
+
mapHook.map.map['doubleClickZoom'].enable();
|
|
6887
|
+
mapHook.map.map['touchZoomRotate'].enable();
|
|
6888
|
+
}, [mapHook.map]);
|
|
6889
|
+
function centerRoute() {
|
|
6890
|
+
if (!mapHook.map || !props.route)
|
|
6891
|
+
return;
|
|
6892
|
+
var bbox = turf__namespace.bbox(props.route);
|
|
6893
|
+
var bounds;
|
|
6894
|
+
if (bbox && bbox.length > 3) {
|
|
6895
|
+
bounds = [
|
|
6896
|
+
[bbox[0], bbox[1]],
|
|
6897
|
+
[bbox[2], bbox[3]],
|
|
6898
|
+
];
|
|
6899
|
+
mapHook.map.map.fitBounds(bounds, { padding: 100 });
|
|
6900
|
+
}
|
|
6901
|
+
}
|
|
6902
|
+
function play() {
|
|
6903
|
+
if (!mapHook.map)
|
|
6904
|
+
return;
|
|
6905
|
+
if (!pause.current) {
|
|
6906
|
+
disableInteractivity();
|
|
6907
|
+
if (typeof zoom.current !== 'undefined' && mapHook.map.map.getZoom() !== zoom.current) {
|
|
6908
|
+
mapHook.map.map.setZoom(zoom.current);
|
|
6909
|
+
}
|
|
6910
|
+
var alongRoutelati = turf__namespace.along(props.route, step.current * kmPerStep).geometry
|
|
6911
|
+
.coordinates;
|
|
6912
|
+
if (step.current * kmPerStep < routeDistance) {
|
|
6913
|
+
mapHook.map.map.easeTo({
|
|
6914
|
+
center: alongRoutelati,
|
|
6915
|
+
bearing: turf__namespace.bearing(turf__namespace.point([mapHook.map.map.getCenter().lng, mapHook.map.map.getCenter().lat]), turf__namespace.point(alongRoutelati)),
|
|
6916
|
+
duration: stepDuration,
|
|
6917
|
+
essential: true,
|
|
6918
|
+
});
|
|
6919
|
+
if (typeof speed.current !== 'undefined') {
|
|
6920
|
+
step.current = step.current + speed.current;
|
|
6921
|
+
}
|
|
6922
|
+
else {
|
|
6923
|
+
step.current++;
|
|
6924
|
+
}
|
|
6925
|
+
console.log('PAN MOVE');
|
|
6926
|
+
setTimeout(function () {
|
|
6927
|
+
play();
|
|
6928
|
+
}, 100);
|
|
6929
|
+
}
|
|
6930
|
+
else {
|
|
6931
|
+
mapHook.map.map.setPitch(0);
|
|
6932
|
+
centerRoute();
|
|
6933
|
+
enableInteractivity();
|
|
6934
|
+
console.log('ENABLE CONTROLS');
|
|
6935
|
+
step.current = 1;
|
|
7039
6936
|
}
|
|
7040
|
-
}
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
6937
|
+
}
|
|
6938
|
+
else {
|
|
6939
|
+
enableInteractivity();
|
|
6940
|
+
}
|
|
6941
|
+
}
|
|
6942
|
+
function reset() {
|
|
6943
|
+
if (!mapHook.map)
|
|
6944
|
+
return;
|
|
6945
|
+
centerRoute();
|
|
6946
|
+
enableInteractivity();
|
|
6947
|
+
step.current = 1;
|
|
6948
|
+
}
|
|
6949
|
+
React.useEffect(function () {
|
|
6950
|
+
if (!mapHook.map || initializedRef.current)
|
|
6951
|
+
return;
|
|
6952
|
+
initializedRef.current = true;
|
|
6953
|
+
centerRoute();
|
|
6954
|
+
}, [mapHook.map]);
|
|
6955
|
+
React.useEffect(function () {
|
|
6956
|
+
return function () {
|
|
6957
|
+
if (timeoutId.current) {
|
|
6958
|
+
clearTimeout(timeoutId.current);
|
|
6959
|
+
}
|
|
6960
|
+
};
|
|
6961
|
+
}, []);
|
|
6962
|
+
return {
|
|
6963
|
+
play: play,
|
|
6964
|
+
reset: reset,
|
|
6965
|
+
};
|
|
6966
|
+
};
|
|
6967
|
+
useCameraFollowPath.defaultProps = {
|
|
6968
|
+
mapId: undefined,
|
|
6969
|
+
zoom: 18,
|
|
6970
|
+
};
|
|
6971
|
+
|
|
6972
|
+
function useLayerFilter(props) {
|
|
6973
|
+
var mapHook = useMap({ mapId: props.mapId });
|
|
6974
|
+
React.useEffect(function () {
|
|
6975
|
+
if (!mapHook.map || !props.layerId || !props.filter)
|
|
6976
|
+
return;
|
|
6977
|
+
if (mapHook.map.map.getLayer(props.layerId)) {
|
|
6978
|
+
var _layerId_1 = props.layerId;
|
|
6979
|
+
mapHook.map.map.setFilter(_layerId_1, props.filter);
|
|
6980
|
+
return function () {
|
|
6981
|
+
if (mapHook.map) {
|
|
6982
|
+
mapHook.map.map.setFilter(_layerId_1, null);
|
|
6983
|
+
}
|
|
6984
|
+
};
|
|
6985
|
+
}
|
|
6986
|
+
return;
|
|
6987
|
+
}, [props, mapHook.map]);
|
|
6988
|
+
return {};
|
|
6989
|
+
}
|
|
6990
|
+
|
|
6991
|
+
var touchEquivalents = {
|
|
6992
|
+
mousedown: 'touchstart',
|
|
6993
|
+
mouseup: 'touchend',
|
|
6994
|
+
mousemove: 'touchmove'
|
|
6995
|
+
};
|
|
6996
|
+
var touchEquivalentsKeys = Object.keys(touchEquivalents);
|
|
6997
|
+
function useLayerEvent(props) {
|
|
6998
|
+
var mapState = useMapState({
|
|
6999
|
+
mapId: props.mapId,
|
|
7000
|
+
watch: {
|
|
7001
|
+
layers: true
|
|
7002
|
+
}
|
|
7003
|
+
});
|
|
7004
|
+
var mapHook = useMap({
|
|
7005
|
+
mapId: props.mapId
|
|
7006
|
+
});
|
|
7007
|
+
React.useEffect(function () {
|
|
7008
|
+
if (!mapHook.map) return true;
|
|
7009
|
+
if (typeof props.condition !== 'undefined' && props.condition === false) return;
|
|
7010
|
+
//console.log('useLayerEvent');
|
|
7011
|
+
//console.log(mapState);
|
|
7012
|
+
|
|
7013
|
+
if (mapHook.map.map.getLayer(props.layerId)) {
|
|
7014
|
+
//console.log("layer avail");
|
|
7015
|
+
var _event = props.event;
|
|
7016
|
+
var _layerId = props.layerId;
|
|
7017
|
+
var _eventHandler = props.eventHandler;
|
|
7018
|
+
|
|
7019
|
+
//console.log(_event);
|
|
7020
|
+
mapHook.map.on(_event, _layerId, _eventHandler, mapHook.componentId);
|
|
7021
|
+
if ((props === null || props === void 0 ? void 0 : props.addTouchEvents) === true) {
|
|
7022
|
+
if (touchEquivalentsKeys.indexOf(_event) !== -1) {
|
|
7023
|
+
mapHook.map.on(touchEquivalents[_event], _layerId, _eventHandler, mapHook.componentId);
|
|
7024
|
+
}
|
|
7025
|
+
}
|
|
7026
|
+
return function () {
|
|
7027
|
+
mapHook.map.off(_event, _layerId, _eventHandler);
|
|
7028
|
+
if ((props === null || props === void 0 ? void 0 : props.addTouchEvents) === true) {
|
|
7029
|
+
if (touchEquivalentsKeys.indexOf(_event) !== -1) {
|
|
7030
|
+
mapHook.map.off(touchEquivalents[_event], _layerId, _eventHandler, mapHook.componentId);
|
|
7031
|
+
}
|
|
7032
|
+
}
|
|
7033
|
+
};
|
|
7034
|
+
}
|
|
7035
|
+
}, [props, mapState, mapHook.map]);
|
|
7036
|
+
return {};
|
|
7037
|
+
}
|
|
7038
|
+
|
|
7039
|
+
var useLayerContext = function () {
|
|
7040
|
+
var layerContext = React.useContext(LayerContext);
|
|
7041
|
+
return layerContext;
|
|
7042
|
+
};
|
|
7043
|
+
|
|
7044
|
+
/**
|
|
7045
|
+
* Enables the use of custom protocols (basically custom tile load functions) in the maplibre-gl-js library.
|
|
7046
|
+
*
|
|
7047
|
+
*/
|
|
7048
|
+
var useAddProtocol = function (props) {
|
|
7049
|
+
React.useEffect(function () {
|
|
7050
|
+
if (!props.protocol || typeof props.handler !== 'function')
|
|
7051
|
+
return;
|
|
7052
|
+
maplibregl__default["default"].addProtocol(props.protocol, props.handler);
|
|
7053
|
+
return function () {
|
|
7054
|
+
maplibregl__default["default"].removeProtocol(props.protocol);
|
|
7055
|
+
};
|
|
7056
|
+
}, []);
|
|
7057
|
+
return {};
|
|
7058
|
+
};
|
|
7059
|
+
useAddProtocol.defaultProps = {
|
|
7060
|
+
mapId: undefined,
|
|
7061
|
+
};
|
|
7062
|
+
|
|
7063
|
+
var SimpleDataContext = /*#__PURE__*/React__default["default"].createContext({});
|
|
7064
|
+
var SimpleDataContextProvider = SimpleDataContext.Provider;
|
|
7065
|
+
|
|
7066
|
+
var SimpleDataProvider = function SimpleDataProvider(props) {
|
|
7067
|
+
var _useState = React.useState(null),
|
|
7068
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
7069
|
+
data = _useState2[0],
|
|
7070
|
+
setData = _useState2[1];
|
|
7071
|
+
React.useEffect(function () {
|
|
7072
|
+
if (!props.url) return;
|
|
7073
|
+
var data_promise = null;
|
|
7074
|
+
if (props.format === "json") {
|
|
7075
|
+
data_promise = d3__namespace.json(props.url);
|
|
7076
|
+
} else if (props.format === "csv") {
|
|
7077
|
+
data_promise = d3__namespace.csv(props.url);
|
|
7078
|
+
} else if (props.format === "xml") {
|
|
7079
|
+
data_promise = d3__namespace.xml(props.url);
|
|
7080
|
+
}
|
|
7081
|
+
if (data_promise) {
|
|
7082
|
+
data_promise.then(function (received_data) {
|
|
7083
|
+
if (props.format === "xml") {
|
|
7084
|
+
if (props.nodeType) {
|
|
7085
|
+
var dataTmp = [];
|
|
7086
|
+
received_data.querySelectorAll(props.nodeType).forEach(function (el) {
|
|
7087
|
+
dataTmp.push(props.formatData(el));
|
|
7088
|
+
});
|
|
7089
|
+
setData(dataTmp);
|
|
7090
|
+
}
|
|
7091
|
+
} else {
|
|
7092
|
+
if (props.data_property) {
|
|
7093
|
+
received_data = received_data[props.data_property];
|
|
7094
|
+
}
|
|
7095
|
+
if (typeof props.formatData === "function") {
|
|
7096
|
+
setData(received_data.map(props.formatData));
|
|
7097
|
+
} else {
|
|
7098
|
+
setData(received_data);
|
|
7099
|
+
}
|
|
7100
|
+
}
|
|
7101
|
+
if (typeof props.onData === "function") {
|
|
7102
|
+
props.onData();
|
|
7103
|
+
}
|
|
7104
|
+
});
|
|
7105
|
+
}
|
|
7106
|
+
}, [props.url, props]);
|
|
7107
|
+
var value = {
|
|
7108
|
+
data: data,
|
|
7109
|
+
setData: setData
|
|
7110
|
+
};
|
|
7111
|
+
return /*#__PURE__*/React__default["default"].createElement(SimpleDataContextProvider, {
|
|
7112
|
+
value: value
|
|
7113
|
+
}, props.children);
|
|
7114
|
+
};
|
|
7115
|
+
SimpleDataProvider.propTypes = {
|
|
7116
|
+
children: PropTypes__default["default"].node.isRequired
|
|
7117
|
+
};
|
|
7118
|
+
|
|
7119
|
+
var ListStyled = material.styled(material.List)({
|
|
7120
|
+
marginTop: '15px',
|
|
7121
|
+
});
|
|
7122
|
+
function LayerList(props) {
|
|
7123
|
+
return React__default["default"].createElement(ListStyled, null, props === null || props === void 0 ? void 0 : props.children);
|
|
7124
|
+
}
|
|
7125
|
+
|
|
7126
|
+
var IconButtonStyled = material.styled(material.IconButton)({
|
|
7127
|
+
padding: '4px',
|
|
7128
|
+
marginTop: '-3px',
|
|
7129
|
+
background: 'none',
|
|
7130
|
+
'&:hover': {
|
|
7131
|
+
background: 'none',
|
|
7132
|
+
},
|
|
7133
|
+
});
|
|
7134
|
+
function LayerListItemFactory(props) {
|
|
7135
|
+
var _a, _b;
|
|
7136
|
+
var layerContext = useLayerContext();
|
|
7137
|
+
var orderLayers = React.useMemo(function () {
|
|
7138
|
+
var layerIds = __spreadArray(__spreadArray([
|
|
7139
|
+
'order-background'
|
|
7140
|
+
], __spreadArray([], layerContext.layers, true).map(function (_el, idx) { return 'content_order_' + idx; }), true), [
|
|
7141
|
+
'order-labels',
|
|
7142
|
+
], false);
|
|
7143
|
+
return layerIds.reverse();
|
|
7144
|
+
}, [layerContext.layers]);
|
|
7145
|
+
var layers = React.useMemo(function () {
|
|
7146
|
+
if (props.layers)
|
|
7147
|
+
return props.layers;
|
|
7148
|
+
if (layerContext === null || layerContext === void 0 ? void 0 : layerContext.layers)
|
|
7149
|
+
return layerContext.layers;
|
|
7150
|
+
return [];
|
|
7151
|
+
}, [props.layers, layerContext.layers]);
|
|
7152
|
+
var setLayers = React.useMemo(function () {
|
|
7153
|
+
if (props.setLayers)
|
|
7154
|
+
return props.setLayers;
|
|
7155
|
+
return layerContext.setLayers;
|
|
7156
|
+
}, [props.setLayers, layerContext.setLayers]);
|
|
7157
|
+
var pointerSensor = core.useSensor(core.PointerSensor, {
|
|
7158
|
+
activationConstraint: {
|
|
7159
|
+
distance: 5,
|
|
7160
|
+
},
|
|
7161
|
+
});
|
|
7162
|
+
var mouseSensor = core.useSensor(core.MouseSensor, {
|
|
7163
|
+
activationConstraint: {
|
|
7164
|
+
distance: 5,
|
|
7165
|
+
},
|
|
7166
|
+
});
|
|
7167
|
+
var sensors = core.useSensors(mouseSensor, pointerSensor);
|
|
7168
|
+
function dragEnd(event) {
|
|
7169
|
+
var _a, _b, _c;
|
|
7170
|
+
var dragLayerId = event.active.id;
|
|
7171
|
+
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;
|
|
7172
|
+
layerContext.moveLayer(String(dragLayerId), function () { return dragLayerNewPosition; });
|
|
7173
|
+
}
|
|
7174
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
7175
|
+
React__default["default"].createElement(MlOrderLayers, { layerIds: orderLayers, insertBeforeLayer: "_background" }),
|
|
7176
|
+
((_a = layerContext === null || layerContext === void 0 ? void 0 : layerContext.symbolLayers) === null || _a === void 0 ? void 0 : _a.length) > 0 && (React__default["default"].createElement(LayerListItem, { key: 'background_labels', layerComponent: React__default["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) {
|
|
7177
|
+
return layerContext.setSymbolLayers(state === null || state === void 0 ? void 0 : state.layers);
|
|
7178
|
+
}, visible: true, configurable: true, type: "layer", name: "Labels" })),
|
|
7179
|
+
React__default["default"].createElement(core.DndContext, { collisionDetection: core.closestCenter, sensors: sensors, onDragEnd: function (event) { return dragEnd(event); }, modifiers: [modifiers.restrictToVerticalAxis] },
|
|
7180
|
+
React__default["default"].createElement(sortable.SortableContext, { items: layers, strategy: sortable.verticalListSortingStrategy },
|
|
7181
|
+
__spreadArray([], layers, true).map(function (layer, idx) {
|
|
7182
|
+
var _a, _b;
|
|
7183
|
+
if (!(layer === null || layer === void 0 ? void 0 : layer.id))
|
|
7184
|
+
return null;
|
|
7185
|
+
switch (layer.type) {
|
|
7186
|
+
case 'geojson':
|
|
7187
|
+
return (React__default["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["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["default"].createElement(React__default["default"].Fragment, null,
|
|
7188
|
+
React__default["default"].createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7189
|
+
layerContext.moveDown(layer.id || '');
|
|
7190
|
+
} },
|
|
7191
|
+
React__default["default"].createElement(iconsMaterial.ArrowCircleDown, null)),
|
|
7192
|
+
React__default["default"].createElement(IconButtonStyled, { disabled: idx === 0, onClick: function () {
|
|
7193
|
+
layerContext.moveUp(layer.id || '');
|
|
7194
|
+
} },
|
|
7195
|
+
React__default["default"].createElement(iconsMaterial.ArrowCircleUp, null))), setLayerState: function (layerConfig) {
|
|
7196
|
+
return setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7197
|
+
var _layers = __spreadArray([], current, true);
|
|
7198
|
+
if (layerConfig === false) {
|
|
7199
|
+
_layers.splice(idx, 1);
|
|
7200
|
+
}
|
|
7201
|
+
else {
|
|
7202
|
+
_layers[idx].config = layerConfig;
|
|
7203
|
+
}
|
|
7204
|
+
return _layers;
|
|
7205
|
+
});
|
|
7206
|
+
}, configurable: true, showDeleteButton: true }));
|
|
7207
|
+
case 'wms':
|
|
7208
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
7209
|
+
React__default["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) {
|
|
7210
|
+
setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7211
|
+
var _layers = __spreadArray([], current, true);
|
|
7212
|
+
if (layerConfig === false) {
|
|
7213
|
+
_layers.splice(idx, 1);
|
|
7214
|
+
}
|
|
7215
|
+
else {
|
|
7216
|
+
_layers[idx].config.config = layerConfig;
|
|
7217
|
+
}
|
|
7218
|
+
return _layers;
|
|
7219
|
+
});
|
|
7220
|
+
}, featureInfoActive: ((_b = layer === null || layer === void 0 ? void 0 : layer.config) === null || _b === void 0 ? void 0 : _b.featureInfoActive) || false, setFeatureInfoActive: function (updateFunction) {
|
|
7221
|
+
setLayers === null || setLayers === void 0 ? void 0 : setLayers(function (current) {
|
|
7222
|
+
var _a;
|
|
7223
|
+
var _layers = __spreadArray([], current, true);
|
|
7224
|
+
if (typeof updateFunction === 'function') {
|
|
7225
|
+
_layers[idx].config.featureInfoActive =
|
|
7226
|
+
updateFunction(((_a = _layers[idx].config) === null || _a === void 0 ? void 0 : _a.featureInfoActive) || false);
|
|
7227
|
+
}
|
|
7228
|
+
return _layers;
|
|
7229
|
+
});
|
|
7230
|
+
}, showDeleteButton: true, buttons: React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
7231
|
+
React__default["default"].createElement(IconButtonStyled, { disabled: idx === layers.length - 1, onClick: function () {
|
|
7232
|
+
layerContext.moveDown(layer.id || '');
|
|
7233
|
+
} },
|
|
7234
|
+
React__default["default"].createElement(iconsMaterial.ArrowCircleDown, null)),
|
|
7235
|
+
React__default["default"].createElement(IconButtonStyled, { disabled: idx === 0, onClick: function () {
|
|
7236
|
+
layerContext.moveUp(layer.id || '');
|
|
7237
|
+
} },
|
|
7238
|
+
React__default["default"].createElement(iconsMaterial.ArrowCircleUp, null))) }))));
|
|
7239
|
+
default:
|
|
7240
|
+
return null;
|
|
7241
|
+
}
|
|
7242
|
+
}),
|
|
7243
|
+
((_b = layerContext === null || layerContext === void 0 ? void 0 : layerContext.backgroundLayers) === null || _b === void 0 ? void 0 : _b.length) > 0 && (React__default["default"].createElement(LayerListItem, { key: 'background_geometry', layerComponent: React__default["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) {
|
|
7244
|
+
layerContext.setBackgroundLayers(state === null || state === void 0 ? void 0 : state.layers);
|
|
7245
|
+
}, visible: true, configurable: true, type: "layer", name: "Background" }))))));
|
|
7044
7246
|
}
|
|
7045
7247
|
LayerListItemFactory.defaultProps = {
|
|
7046
7248
|
mapId: undefined,
|
|
@@ -7162,7 +7364,8 @@ function TopToolbar(props) {
|
|
|
7162
7364
|
minHeight: '62px',
|
|
7163
7365
|
position: 'absolute',
|
|
7164
7366
|
zIndex: 1300,
|
|
7165
|
-
|
|
7367
|
+
top: 0,
|
|
7368
|
+
} },
|
|
7166
7369
|
React__namespace.createElement(Toolbar__default["default"], { disableGutters: true },
|
|
7167
7370
|
props.logo || (React__namespace.createElement(React__namespace.Fragment, null,
|
|
7168
7371
|
React__namespace.createElement(Box__default["default"], { sx: {
|
|
@@ -20214,6 +20417,7 @@ exports.MlOsmLayer = MlOsmLayer;
|
|
|
20214
20417
|
exports.MlPdfPreview = PdfPreview;
|
|
20215
20418
|
exports.MlScaleReference = MlScaleReference;
|
|
20216
20419
|
exports.MlShareMapState = MlShareMapState;
|
|
20420
|
+
exports.MlSketchTool = MlSketchTool;
|
|
20217
20421
|
exports.MlSpatialElevationProfile = MlSpatialElevationProfile;
|
|
20218
20422
|
exports.MlTemporalController = MlTemporalController;
|
|
20219
20423
|
exports.MlTerrainLayer = MlTerrainLayer;
|