@mapcomponents/react-maplibre 0.1.85 → 0.1.86
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 +13 -0
- package/dist/components/MlCenterPosition/MlCenterPosition.d.ts +0 -2
- package/dist/components/MlCenterPosition/MlCenterPosition.stories.d.ts +0 -2
- package/dist/components/MlFollowGps/MlFollowGps.d.ts +0 -1
- package/dist/components/MlGeoJsonLayer/MlGeoJsonLayer.d.ts +1 -1
- package/dist/components/MlThreeJsLayer/MlThreeJsLayer.d.ts +1 -1
- package/dist/hooks/useAddImage/useAddImage.d.ts +20 -0
- package/dist/hooks/useAddImage/useAddImage.stories.d.ts +14 -0
- package/dist/index.esm.js +183 -146
- package/dist/index.esm.js.map +1 -1
- package/dist/ui_components/MapcomponentsTheme.d.ts +8 -0
- package/package.json +4 -5
package/dist/index.esm.js
CHANGED
|
@@ -27,6 +27,7 @@ var Divider = require('@mui/material/Divider');
|
|
|
27
27
|
var useMediaQuery = require('@mui/material/useMediaQuery');
|
|
28
28
|
var syncMove = require('@mapbox/mapbox-gl-sync-move');
|
|
29
29
|
var Paper = require('@mui/material/Paper');
|
|
30
|
+
var xmldom = require('@xmldom/xmldom');
|
|
30
31
|
var helpers = require('@turf/helpers');
|
|
31
32
|
var WMSCapabilities = require('wms-capabilities');
|
|
32
33
|
var InfoIcon = require('@mui/icons-material/Info');
|
|
@@ -109,6 +110,7 @@ var Divider__default = /*#__PURE__*/_interopDefaultLegacy(Divider);
|
|
|
109
110
|
var useMediaQuery__default = /*#__PURE__*/_interopDefaultLegacy(useMediaQuery);
|
|
110
111
|
var syncMove__default = /*#__PURE__*/_interopDefaultLegacy(syncMove);
|
|
111
112
|
var Paper__default = /*#__PURE__*/_interopDefaultLegacy(Paper);
|
|
113
|
+
var xmldom__namespace = /*#__PURE__*/_interopNamespace(xmldom);
|
|
112
114
|
var WMSCapabilities__default = /*#__PURE__*/_interopDefaultLegacy(WMSCapabilities);
|
|
113
115
|
var InfoIcon__default = /*#__PURE__*/_interopDefaultLegacy(InfoIcon);
|
|
114
116
|
var List__default = /*#__PURE__*/_interopDefaultLegacy(List);
|
|
@@ -783,7 +785,18 @@ var getDesignTokens = function (mode) { return (__assign(__assign({}, (mode ===
|
|
|
783
785
|
},
|
|
784
786
|
topToolbar: { barColor: '#000' },
|
|
785
787
|
navigation: { navColor: '#313131', navHover: '#747577' },
|
|
786
|
-
|
|
788
|
+
GPS: {
|
|
789
|
+
GPSActiveColor: '#fff',
|
|
790
|
+
GPSInactiveColor: '#fff',
|
|
791
|
+
GPSActiveBackgroundColor: '#747577',
|
|
792
|
+
},
|
|
793
|
+
compass: {
|
|
794
|
+
compColor: '#313131',
|
|
795
|
+
compHover: '#747577',
|
|
796
|
+
compStroke: '#d3dce1',
|
|
797
|
+
compNorth: '#cf003f',
|
|
798
|
+
compSouth: '#d3dcf0',
|
|
799
|
+
},
|
|
787
800
|
}
|
|
788
801
|
: {
|
|
789
802
|
primary: {
|
|
@@ -796,7 +809,18 @@ var getDesignTokens = function (mode) { return (__assign(__assign({}, (mode ===
|
|
|
796
809
|
},
|
|
797
810
|
topToolbar: { barColor: '#fff' },
|
|
798
811
|
navigation: { navColor: '#fff', navHover: '#f5f5f5' },
|
|
799
|
-
|
|
812
|
+
GPS: {
|
|
813
|
+
GPSActiveColor: '#009EE0',
|
|
814
|
+
GPSInactiveColor: '#000',
|
|
815
|
+
GPSActiveBackgroundColor: '#fff',
|
|
816
|
+
},
|
|
817
|
+
compass: {
|
|
818
|
+
compColor: '#fff',
|
|
819
|
+
compHover: '#f5f5f5',
|
|
820
|
+
compStroke: '#009ee0',
|
|
821
|
+
compNorth: '#cf003f',
|
|
822
|
+
compSouth: '#d3dcf0',
|
|
823
|
+
},
|
|
800
824
|
})) })); };
|
|
801
825
|
var getTheme = function (mode) {
|
|
802
826
|
var _a;
|
|
@@ -1359,8 +1383,6 @@ var MlCenterPosition = function (props) {
|
|
|
1359
1383
|
};
|
|
1360
1384
|
MlCenterPosition.defaultProps = {
|
|
1361
1385
|
mapId: undefined,
|
|
1362
|
-
onColor: '#ececec',
|
|
1363
|
-
offColor: '#666',
|
|
1364
1386
|
};
|
|
1365
1387
|
|
|
1366
1388
|
/**
|
|
@@ -2763,7 +2785,12 @@ var MlFollowGps = function (props) {
|
|
|
2763
2785
|
isFollowed && userLocationGeoJson && (React__default["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 })),
|
|
2764
2786
|
React__default["default"].createElement(material.Button, { variant: "navtools", sx: {
|
|
2765
2787
|
zIndex: 1002,
|
|
2766
|
-
color: isFollowed
|
|
2788
|
+
color: isFollowed
|
|
2789
|
+
? function (theme) { return theme.palette.GPS.GPSActiveColor; }
|
|
2790
|
+
: function (theme) { return theme.palette.GPS.GPSInactiveColor; },
|
|
2791
|
+
backgroundColor: isFollowed
|
|
2792
|
+
? function (theme) { return theme.palette.GPS.GPSActiveBackgroundColor; }
|
|
2793
|
+
: function (theme) { return theme.palette.navigation.navColor; },
|
|
2767
2794
|
}, disabled: locationAccessDenied, onClick: function () {
|
|
2768
2795
|
setIsFollowed(!isFollowed);
|
|
2769
2796
|
} },
|
|
@@ -2771,7 +2798,6 @@ var MlFollowGps = function (props) {
|
|
|
2771
2798
|
};
|
|
2772
2799
|
MlFollowGps.defaultProps = {
|
|
2773
2800
|
mapId: undefined,
|
|
2774
|
-
onColor: '#ececec',
|
|
2775
2801
|
offColor: '#666',
|
|
2776
2802
|
showAccuracyCircle: true,
|
|
2777
2803
|
showUserLocation: true,
|
|
@@ -2934,16 +2960,29 @@ var CompassBox = material.styled(material.Box)(function (_a) {
|
|
|
2934
2960
|
},
|
|
2935
2961
|
_b.circle = {
|
|
2936
2962
|
fill: theme.palette.compass.compColor,
|
|
2963
|
+
stroke: theme.palette.compass.compStroke,
|
|
2964
|
+
},
|
|
2965
|
+
_b.path = {
|
|
2966
|
+
fill: theme.palette.compass.compStroke,
|
|
2937
2967
|
},
|
|
2938
2968
|
_b['&:hover circle'] = {
|
|
2939
2969
|
fill: theme.palette.compass.compHover,
|
|
2940
2970
|
},
|
|
2941
2971
|
_b);
|
|
2942
2972
|
});
|
|
2943
|
-
var NeedleBox = material.styled(material.Box)({
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2973
|
+
var NeedleBox = material.styled(material.Box)(function (_a) {
|
|
2974
|
+
var theme = _a.theme;
|
|
2975
|
+
return ({
|
|
2976
|
+
position: 'absolute',
|
|
2977
|
+
right: '21.4px',
|
|
2978
|
+
top: '6px',
|
|
2979
|
+
'path:nth-of-type(2)': {
|
|
2980
|
+
fill: theme.palette.compass.compSouth,
|
|
2981
|
+
},
|
|
2982
|
+
'path:nth-of-type(1)': {
|
|
2983
|
+
fill: theme.palette.compass.compNorth,
|
|
2984
|
+
},
|
|
2985
|
+
});
|
|
2947
2986
|
});
|
|
2948
2987
|
/**
|
|
2949
2988
|
* Navigation component that displays a compass component which indicates the current oriantation of the map it is registered for and offers controls to turn the bearing 90° left/right or reset north to point up.
|
|
@@ -3042,7 +3081,7 @@ var MlNavigationTools = function (props) {
|
|
|
3042
3081
|
}, [mapHook.map]);
|
|
3043
3082
|
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) },
|
|
3044
3083
|
React__default["default"].createElement(MlNavigationCompass, null),
|
|
3045
|
-
props.show3DButton && (React__default["default"].createElement(Button__default["default"], { variant: "navtools", onClick: adjustPitch }, pitch < 59 ? '
|
|
3084
|
+
props.show3DButton && (React__default["default"].createElement(Button__default["default"], { variant: "navtools", onClick: adjustPitch }, pitch < 59 ? '3D' : '2D')),
|
|
3046
3085
|
props.showFollowGpsButton && React__default["default"].createElement(MlFollowGps, null),
|
|
3047
3086
|
props.showCenterLocationButton && React__default["default"].createElement(MlCenterPosition, null),
|
|
3048
3087
|
React__default["default"].createElement(ButtonGroup__default["default"], { orientation: "vertical", sx: {
|
|
@@ -3898,7 +3937,7 @@ var toGeoJSON = function () {
|
|
|
3898
3937
|
if (x) {
|
|
3899
3938
|
norm(x);
|
|
3900
3939
|
}
|
|
3901
|
-
return x && x.textContent ||
|
|
3940
|
+
return x && x.textContent || '';
|
|
3902
3941
|
}
|
|
3903
3942
|
// get the contents of multiple text nodes, if present
|
|
3904
3943
|
function getMulti(x, ys) {
|
|
@@ -3917,11 +3956,11 @@ var toGeoJSON = function () {
|
|
|
3917
3956
|
}
|
|
3918
3957
|
// get one coordinate from a coordinate array, if any
|
|
3919
3958
|
function coord1(v) {
|
|
3920
|
-
return numarray(v.replace(removeSpace,
|
|
3959
|
+
return numarray(v.replace(removeSpace, '').split(','));
|
|
3921
3960
|
}
|
|
3922
3961
|
// get all coordinates from a coordinate array as [[],[]]
|
|
3923
3962
|
function coord(v) {
|
|
3924
|
-
var coords = v.replace(trimSpace,
|
|
3963
|
+
var coords = v.replace(trimSpace, '').split(splitSpace),
|
|
3925
3964
|
o = [];
|
|
3926
3965
|
for (var i = 0; i < coords.length; i++) {
|
|
3927
3966
|
o.push(coord1(coords[i]));
|
|
@@ -3929,11 +3968,11 @@ var toGeoJSON = function () {
|
|
|
3929
3968
|
return o;
|
|
3930
3969
|
}
|
|
3931
3970
|
function coordPair(x) {
|
|
3932
|
-
var ll = [attrf(x,
|
|
3933
|
-
ele = get1(x,
|
|
3971
|
+
var ll = [attrf(x, 'lon'), attrf(x, 'lat')],
|
|
3972
|
+
ele = get1(x, 'ele'),
|
|
3934
3973
|
// handle namespaced attribute in browser
|
|
3935
|
-
heartRate = get1(x,
|
|
3936
|
-
time = get1(x,
|
|
3974
|
+
heartRate = get1(x, 'gpxtpx:hr') || get1(x, 'hr'),
|
|
3975
|
+
time = get1(x, 'time'),
|
|
3937
3976
|
e;
|
|
3938
3977
|
if (ele) {
|
|
3939
3978
|
e = parseFloat(nodeVal(ele));
|
|
@@ -3951,22 +3990,21 @@ var toGeoJSON = function () {
|
|
|
3951
3990
|
// create a new feature collection parent object
|
|
3952
3991
|
function fc() {
|
|
3953
3992
|
return {
|
|
3954
|
-
type:
|
|
3993
|
+
type: 'FeatureCollection',
|
|
3955
3994
|
features: []
|
|
3956
3995
|
};
|
|
3957
3996
|
}
|
|
3958
3997
|
var serializer;
|
|
3959
|
-
if (typeof XMLSerializer !==
|
|
3998
|
+
if (typeof XMLSerializer !== 'undefined') {
|
|
3960
3999
|
/* istanbul ignore next */
|
|
3961
4000
|
serializer = new XMLSerializer();
|
|
3962
4001
|
} else {
|
|
3963
|
-
var isNodeEnv = (typeof process === "undefined" ? "undefined" : _typeof(process)) ===
|
|
3964
|
-
var isTitaniumEnv = (typeof Titanium === "undefined" ? "undefined" : _typeof(Titanium)) ===
|
|
3965
|
-
if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) ===
|
|
3966
|
-
|
|
3967
|
-
serializer = new (require("xmldom").XMLSerializer)();
|
|
4002
|
+
var isNodeEnv = (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && !process.browser;
|
|
4003
|
+
var isTitaniumEnv = (typeof Titanium === "undefined" ? "undefined" : _typeof(Titanium)) === 'object';
|
|
4004
|
+
if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object' && (isNodeEnv || isTitaniumEnv)) {
|
|
4005
|
+
serializer = xmldom__namespace.XMLSerializer;
|
|
3968
4006
|
} else {
|
|
3969
|
-
throw new Error(
|
|
4007
|
+
throw new Error('Unable to initialize serializer');
|
|
3970
4008
|
}
|
|
3971
4009
|
}
|
|
3972
4010
|
function xml2str(str) {
|
|
@@ -3986,32 +4024,32 @@ var toGeoJSON = function () {
|
|
|
3986
4024
|
styleMapIndex = {},
|
|
3987
4025
|
// atomic geospatial types supported by KML - MultiGeometry is
|
|
3988
4026
|
// handled separately
|
|
3989
|
-
geotypes = [
|
|
4027
|
+
geotypes = ['Polygon', 'LineString', 'Point', 'Track', 'gx:Track'],
|
|
3990
4028
|
// all root placemarks in the file
|
|
3991
|
-
placemarks = get(doc,
|
|
3992
|
-
styles = get(doc,
|
|
3993
|
-
styleMaps = get(doc,
|
|
4029
|
+
placemarks = get(doc, 'Placemark'),
|
|
4030
|
+
styles = get(doc, 'Style'),
|
|
4031
|
+
styleMaps = get(doc, 'StyleMap');
|
|
3994
4032
|
for (var k = 0; k < styles.length; k++) {
|
|
3995
4033
|
var hash = okhash(xml2str(styles[k])).toString(16);
|
|
3996
|
-
styleIndex[
|
|
4034
|
+
styleIndex['#' + attr(styles[k], 'id')] = hash;
|
|
3997
4035
|
styleByHash[hash] = styles[k];
|
|
3998
4036
|
}
|
|
3999
4037
|
for (var l = 0; l < styleMaps.length; l++) {
|
|
4000
|
-
styleIndex[
|
|
4001
|
-
var pairs = get(styleMaps[l],
|
|
4038
|
+
styleIndex['#' + attr(styleMaps[l], 'id')] = okhash(xml2str(styleMaps[l])).toString(16);
|
|
4039
|
+
var pairs = get(styleMaps[l], 'Pair');
|
|
4002
4040
|
var pairsMap = {};
|
|
4003
4041
|
for (var m = 0; m < pairs.length; m++) {
|
|
4004
|
-
pairsMap[nodeVal(get1(pairs[m],
|
|
4042
|
+
pairsMap[nodeVal(get1(pairs[m], 'key'))] = nodeVal(get1(pairs[m], 'styleUrl'));
|
|
4005
4043
|
}
|
|
4006
|
-
styleMapIndex[
|
|
4044
|
+
styleMapIndex['#' + attr(styleMaps[l], 'id')] = pairsMap;
|
|
4007
4045
|
}
|
|
4008
4046
|
for (var j = 0; j < placemarks.length; j++) {
|
|
4009
4047
|
gj.features = gj.features.concat(getPlacemark(placemarks[j]));
|
|
4010
4048
|
}
|
|
4011
4049
|
function kmlColor(v) {
|
|
4012
4050
|
var color, opacity;
|
|
4013
|
-
v = v ||
|
|
4014
|
-
if (v.substr(0, 1) ===
|
|
4051
|
+
v = v || '';
|
|
4052
|
+
if (v.substr(0, 1) === '#') {
|
|
4015
4053
|
v = v.substr(1);
|
|
4016
4054
|
}
|
|
4017
4055
|
if (v.length === 6 || v.length === 3) {
|
|
@@ -4019,20 +4057,20 @@ var toGeoJSON = function () {
|
|
|
4019
4057
|
}
|
|
4020
4058
|
if (v.length === 8) {
|
|
4021
4059
|
opacity = parseInt(v.substr(0, 2), 16) / 255;
|
|
4022
|
-
color =
|
|
4060
|
+
color = '#' + v.substr(6, 2) + v.substr(4, 2) + v.substr(2, 2);
|
|
4023
4061
|
}
|
|
4024
4062
|
return [color, isNaN(opacity) ? undefined : opacity];
|
|
4025
4063
|
}
|
|
4026
4064
|
function gxCoord(v) {
|
|
4027
|
-
return numarray(v.split(
|
|
4065
|
+
return numarray(v.split(' '));
|
|
4028
4066
|
}
|
|
4029
4067
|
function gxCoords(root) {
|
|
4030
|
-
var elems = get(root,
|
|
4068
|
+
var elems = get(root, 'coord'),
|
|
4031
4069
|
coords = [],
|
|
4032
4070
|
times = [];
|
|
4033
|
-
if (elems.length === 0) elems = get(root,
|
|
4071
|
+
if (elems.length === 0) elems = get(root, 'gx:coord');
|
|
4034
4072
|
for (var i = 0; i < elems.length; i++) coords.push(gxCoord(nodeVal(elems[i])));
|
|
4035
|
-
var timeElems = get(root,
|
|
4073
|
+
var timeElems = get(root, 'when');
|
|
4036
4074
|
for (var j = 0; j < timeElems.length; j++) times.push(nodeVal(timeElems[j]));
|
|
4037
4075
|
return {
|
|
4038
4076
|
coords: coords,
|
|
@@ -4047,44 +4085,44 @@ var toGeoJSON = function () {
|
|
|
4047
4085
|
k,
|
|
4048
4086
|
geoms = [],
|
|
4049
4087
|
coordTimes = [];
|
|
4050
|
-
if (get1(root,
|
|
4051
|
-
return getGeometry(get1(root,
|
|
4088
|
+
if (get1(root, 'MultiGeometry')) {
|
|
4089
|
+
return getGeometry(get1(root, 'MultiGeometry'));
|
|
4052
4090
|
}
|
|
4053
|
-
if (get1(root,
|
|
4054
|
-
return getGeometry(get1(root,
|
|
4091
|
+
if (get1(root, 'MultiTrack')) {
|
|
4092
|
+
return getGeometry(get1(root, 'MultiTrack'));
|
|
4055
4093
|
}
|
|
4056
|
-
if (get1(root,
|
|
4057
|
-
return getGeometry(get1(root,
|
|
4094
|
+
if (get1(root, 'gx:MultiTrack')) {
|
|
4095
|
+
return getGeometry(get1(root, 'gx:MultiTrack'));
|
|
4058
4096
|
}
|
|
4059
4097
|
for (i = 0; i < geotypes.length; i++) {
|
|
4060
4098
|
geomNodes = get(root, geotypes[i]);
|
|
4061
4099
|
if (geomNodes) {
|
|
4062
4100
|
for (j = 0; j < geomNodes.length; j++) {
|
|
4063
4101
|
geomNode = geomNodes[j];
|
|
4064
|
-
if (geotypes[i] ===
|
|
4102
|
+
if (geotypes[i] === 'Point') {
|
|
4065
4103
|
geoms.push({
|
|
4066
|
-
type:
|
|
4067
|
-
coordinates: coord1(nodeVal(get1(geomNode,
|
|
4104
|
+
type: 'Point',
|
|
4105
|
+
coordinates: coord1(nodeVal(get1(geomNode, 'coordinates')))
|
|
4068
4106
|
});
|
|
4069
|
-
} else if (geotypes[i] ===
|
|
4107
|
+
} else if (geotypes[i] === 'LineString') {
|
|
4070
4108
|
geoms.push({
|
|
4071
|
-
type:
|
|
4072
|
-
coordinates: coord(nodeVal(get1(geomNode,
|
|
4109
|
+
type: 'LineString',
|
|
4110
|
+
coordinates: coord(nodeVal(get1(geomNode, 'coordinates')))
|
|
4073
4111
|
});
|
|
4074
|
-
} else if (geotypes[i] ===
|
|
4075
|
-
var rings = get(geomNode,
|
|
4112
|
+
} else if (geotypes[i] === 'Polygon') {
|
|
4113
|
+
var rings = get(geomNode, 'LinearRing'),
|
|
4076
4114
|
coords = [];
|
|
4077
4115
|
for (k = 0; k < rings.length; k++) {
|
|
4078
|
-
coords.push(coord(nodeVal(get1(rings[k],
|
|
4116
|
+
coords.push(coord(nodeVal(get1(rings[k], 'coordinates'))));
|
|
4079
4117
|
}
|
|
4080
4118
|
geoms.push({
|
|
4081
|
-
type:
|
|
4119
|
+
type: 'Polygon',
|
|
4082
4120
|
coordinates: coords
|
|
4083
4121
|
});
|
|
4084
|
-
} else if (geotypes[i] ===
|
|
4122
|
+
} else if (geotypes[i] === 'Track' || geotypes[i] === 'gx:Track') {
|
|
4085
4123
|
var track = gxCoords(geomNode);
|
|
4086
4124
|
geoms.push({
|
|
4087
|
-
type:
|
|
4125
|
+
type: 'LineString',
|
|
4088
4126
|
coordinates: track.coords
|
|
4089
4127
|
});
|
|
4090
4128
|
if (track.times.length) coordTimes.push(track.times);
|
|
@@ -4101,22 +4139,22 @@ var toGeoJSON = function () {
|
|
|
4101
4139
|
var geomsAndTimes = getGeometry(root),
|
|
4102
4140
|
i,
|
|
4103
4141
|
properties = {},
|
|
4104
|
-
name = nodeVal(get1(root,
|
|
4105
|
-
address = nodeVal(get1(root,
|
|
4106
|
-
styleUrl = nodeVal(get1(root,
|
|
4107
|
-
description = nodeVal(get1(root,
|
|
4108
|
-
timeSpan = get1(root,
|
|
4109
|
-
timeStamp = get1(root,
|
|
4110
|
-
extendedData = get1(root,
|
|
4111
|
-
lineStyle = get1(root,
|
|
4112
|
-
polyStyle = get1(root,
|
|
4113
|
-
visibility = get1(root,
|
|
4142
|
+
name = nodeVal(get1(root, 'name')),
|
|
4143
|
+
address = nodeVal(get1(root, 'address')),
|
|
4144
|
+
styleUrl = nodeVal(get1(root, 'styleUrl')),
|
|
4145
|
+
description = nodeVal(get1(root, 'description')),
|
|
4146
|
+
timeSpan = get1(root, 'TimeSpan'),
|
|
4147
|
+
timeStamp = get1(root, 'TimeStamp'),
|
|
4148
|
+
extendedData = get1(root, 'ExtendedData'),
|
|
4149
|
+
lineStyle = get1(root, 'LineStyle'),
|
|
4150
|
+
polyStyle = get1(root, 'PolyStyle'),
|
|
4151
|
+
visibility = get1(root, 'visibility');
|
|
4114
4152
|
if (!geomsAndTimes.geoms.length) return [];
|
|
4115
4153
|
if (name) properties.name = name;
|
|
4116
4154
|
if (address) properties.address = address;
|
|
4117
4155
|
if (styleUrl) {
|
|
4118
|
-
if (styleUrl[0] !==
|
|
4119
|
-
styleUrl =
|
|
4156
|
+
if (styleUrl[0] !== '#') {
|
|
4157
|
+
styleUrl = '#' + styleUrl;
|
|
4120
4158
|
}
|
|
4121
4159
|
properties.styleUrl = styleUrl;
|
|
4122
4160
|
if (styleIndex[styleUrl]) {
|
|
@@ -4129,13 +4167,13 @@ var toGeoJSON = function () {
|
|
|
4129
4167
|
// Try to populate the lineStyle or polyStyle since we got the style hash
|
|
4130
4168
|
var style = styleByHash[properties.styleHash];
|
|
4131
4169
|
if (style) {
|
|
4132
|
-
if (!lineStyle) lineStyle = get1(style,
|
|
4133
|
-
if (!polyStyle) polyStyle = get1(style,
|
|
4134
|
-
var iconStyle = get1(style,
|
|
4170
|
+
if (!lineStyle) lineStyle = get1(style, 'LineStyle');
|
|
4171
|
+
if (!polyStyle) polyStyle = get1(style, 'PolyStyle');
|
|
4172
|
+
var iconStyle = get1(style, 'IconStyle');
|
|
4135
4173
|
if (iconStyle) {
|
|
4136
|
-
var icon = get1(iconStyle,
|
|
4174
|
+
var icon = get1(iconStyle, 'Icon');
|
|
4137
4175
|
if (icon) {
|
|
4138
|
-
var href = nodeVal(get1(icon,
|
|
4176
|
+
var href = nodeVal(get1(icon, 'href'));
|
|
4139
4177
|
if (href) properties.icon = href;
|
|
4140
4178
|
}
|
|
4141
4179
|
}
|
|
@@ -4143,44 +4181,44 @@ var toGeoJSON = function () {
|
|
|
4143
4181
|
}
|
|
4144
4182
|
if (description) properties.description = description;
|
|
4145
4183
|
if (timeSpan) {
|
|
4146
|
-
var begin = nodeVal(get1(timeSpan,
|
|
4147
|
-
var end = nodeVal(get1(timeSpan,
|
|
4184
|
+
var begin = nodeVal(get1(timeSpan, 'begin'));
|
|
4185
|
+
var end = nodeVal(get1(timeSpan, 'end'));
|
|
4148
4186
|
properties.timespan = {
|
|
4149
4187
|
begin: begin,
|
|
4150
4188
|
end: end
|
|
4151
4189
|
};
|
|
4152
4190
|
}
|
|
4153
4191
|
if (timeStamp) {
|
|
4154
|
-
properties.timestamp = nodeVal(get1(timeStamp,
|
|
4192
|
+
properties.timestamp = nodeVal(get1(timeStamp, 'when'));
|
|
4155
4193
|
}
|
|
4156
4194
|
if (lineStyle) {
|
|
4157
|
-
var linestyles = kmlColor(nodeVal(get1(lineStyle,
|
|
4195
|
+
var linestyles = kmlColor(nodeVal(get1(lineStyle, 'color'))),
|
|
4158
4196
|
color = linestyles[0],
|
|
4159
4197
|
opacity = linestyles[1],
|
|
4160
|
-
width = parseFloat(nodeVal(get1(lineStyle,
|
|
4198
|
+
width = parseFloat(nodeVal(get1(lineStyle, 'width')));
|
|
4161
4199
|
if (color) properties.stroke = color;
|
|
4162
|
-
if (!isNaN(opacity)) properties[
|
|
4163
|
-
if (!isNaN(width)) properties[
|
|
4200
|
+
if (!isNaN(opacity)) properties['stroke-opacity'] = opacity;
|
|
4201
|
+
if (!isNaN(width)) properties['stroke-width'] = width;
|
|
4164
4202
|
}
|
|
4165
4203
|
if (polyStyle) {
|
|
4166
|
-
var polystyles = kmlColor(nodeVal(get1(polyStyle,
|
|
4204
|
+
var polystyles = kmlColor(nodeVal(get1(polyStyle, 'color'))),
|
|
4167
4205
|
pcolor = polystyles[0],
|
|
4168
4206
|
popacity = polystyles[1],
|
|
4169
|
-
fill = nodeVal(get1(polyStyle,
|
|
4170
|
-
outline = nodeVal(get1(polyStyle,
|
|
4207
|
+
fill = nodeVal(get1(polyStyle, 'fill')),
|
|
4208
|
+
outline = nodeVal(get1(polyStyle, 'outline'));
|
|
4171
4209
|
if (pcolor) properties.fill = pcolor;
|
|
4172
|
-
if (!isNaN(popacity)) properties[
|
|
4173
|
-
if (fill) properties[
|
|
4174
|
-
if (outline) properties[
|
|
4210
|
+
if (!isNaN(popacity)) properties['fill-opacity'] = popacity;
|
|
4211
|
+
if (fill) properties['fill-opacity'] = fill === '1' ? properties['fill-opacity'] || 1 : 0;
|
|
4212
|
+
if (outline) properties['stroke-opacity'] = outline === '1' ? properties['stroke-opacity'] || 1 : 0;
|
|
4175
4213
|
}
|
|
4176
4214
|
if (extendedData) {
|
|
4177
|
-
var datas = get(extendedData,
|
|
4178
|
-
simpleDatas = get(extendedData,
|
|
4215
|
+
var datas = get(extendedData, 'Data'),
|
|
4216
|
+
simpleDatas = get(extendedData, 'SimpleData');
|
|
4179
4217
|
for (i = 0; i < datas.length; i++) {
|
|
4180
|
-
properties[datas[i].getAttribute(
|
|
4218
|
+
properties[datas[i].getAttribute('name')] = nodeVal(get1(datas[i], 'value'));
|
|
4181
4219
|
}
|
|
4182
4220
|
for (i = 0; i < simpleDatas.length; i++) {
|
|
4183
|
-
properties[simpleDatas[i].getAttribute(
|
|
4221
|
+
properties[simpleDatas[i].getAttribute('name')] = nodeVal(simpleDatas[i]);
|
|
4184
4222
|
}
|
|
4185
4223
|
}
|
|
4186
4224
|
if (visibility) {
|
|
@@ -4190,23 +4228,23 @@ var toGeoJSON = function () {
|
|
|
4190
4228
|
properties.coordTimes = geomsAndTimes.coordTimes.length === 1 ? geomsAndTimes.coordTimes[0] : geomsAndTimes.coordTimes;
|
|
4191
4229
|
}
|
|
4192
4230
|
var feature = {
|
|
4193
|
-
type:
|
|
4231
|
+
type: 'Feature',
|
|
4194
4232
|
geometry: geomsAndTimes.geoms.length === 1 ? geomsAndTimes.geoms[0] : {
|
|
4195
|
-
type:
|
|
4233
|
+
type: 'GeometryCollection',
|
|
4196
4234
|
geometries: geomsAndTimes.geoms
|
|
4197
4235
|
},
|
|
4198
4236
|
properties: properties
|
|
4199
4237
|
};
|
|
4200
|
-
if (attr(root,
|
|
4238
|
+
if (attr(root, 'id')) feature.id = attr(root, 'id');
|
|
4201
4239
|
return [feature];
|
|
4202
4240
|
}
|
|
4203
4241
|
return gj;
|
|
4204
4242
|
},
|
|
4205
4243
|
gpx: function gpx(doc) {
|
|
4206
4244
|
var i,
|
|
4207
|
-
tracks = get(doc,
|
|
4208
|
-
routes = get(doc,
|
|
4209
|
-
waypoints = get(doc,
|
|
4245
|
+
tracks = get(doc, 'trk'),
|
|
4246
|
+
routes = get(doc, 'rte'),
|
|
4247
|
+
waypoints = get(doc, 'wpt'),
|
|
4210
4248
|
// a feature collection
|
|
4211
4249
|
gj = fc(),
|
|
4212
4250
|
feature;
|
|
@@ -4250,13 +4288,13 @@ var toGeoJSON = function () {
|
|
|
4250
4288
|
};
|
|
4251
4289
|
}
|
|
4252
4290
|
function getTrack(node) {
|
|
4253
|
-
var segments = get(node,
|
|
4291
|
+
var segments = get(node, 'trkseg'),
|
|
4254
4292
|
track = [],
|
|
4255
4293
|
times = [],
|
|
4256
4294
|
heartRates = [],
|
|
4257
4295
|
line;
|
|
4258
4296
|
for (var i = 0; i < segments.length; i++) {
|
|
4259
|
-
line = getPoints(segments[i],
|
|
4297
|
+
line = getPoints(segments[i], 'trkpt');
|
|
4260
4298
|
if (line) {
|
|
4261
4299
|
if (line.line) track.push(line.line);
|
|
4262
4300
|
if (line.times && line.times.length) times.push(line.times);
|
|
@@ -4276,28 +4314,28 @@ var toGeoJSON = function () {
|
|
|
4276
4314
|
}
|
|
4277
4315
|
if (track.length === 0) return;
|
|
4278
4316
|
var properties = getProperties(node);
|
|
4279
|
-
extend(properties, getLineStyle(get1(node,
|
|
4317
|
+
extend(properties, getLineStyle(get1(node, 'extensions')));
|
|
4280
4318
|
if (times.length) properties.coordTimes = track.length === 1 ? times[0] : times;
|
|
4281
4319
|
if (heartRates.length) properties.heartRates = track.length === 1 ? heartRates[0] : heartRates;
|
|
4282
4320
|
return {
|
|
4283
|
-
type:
|
|
4321
|
+
type: 'Feature',
|
|
4284
4322
|
properties: properties,
|
|
4285
4323
|
geometry: {
|
|
4286
|
-
type: track.length === 1 ?
|
|
4324
|
+
type: track.length === 1 ? 'LineString' : 'MultiLineString',
|
|
4287
4325
|
coordinates: track.length === 1 ? track[0] : track
|
|
4288
4326
|
}
|
|
4289
4327
|
};
|
|
4290
4328
|
}
|
|
4291
4329
|
function getRoute(node) {
|
|
4292
|
-
var line = getPoints(node,
|
|
4330
|
+
var line = getPoints(node, 'rtept');
|
|
4293
4331
|
if (!line.line) return;
|
|
4294
4332
|
var prop = getProperties(node);
|
|
4295
|
-
extend(prop, getLineStyle(get1(node,
|
|
4333
|
+
extend(prop, getLineStyle(get1(node, 'extensions')));
|
|
4296
4334
|
var routeObj = {
|
|
4297
|
-
type:
|
|
4335
|
+
type: 'Feature',
|
|
4298
4336
|
properties: prop,
|
|
4299
4337
|
geometry: {
|
|
4300
|
-
type:
|
|
4338
|
+
type: 'LineString',
|
|
4301
4339
|
coordinates: line.line
|
|
4302
4340
|
}
|
|
4303
4341
|
};
|
|
@@ -4305,12 +4343,12 @@ var toGeoJSON = function () {
|
|
|
4305
4343
|
}
|
|
4306
4344
|
function getPoint(node) {
|
|
4307
4345
|
var prop = getProperties(node);
|
|
4308
|
-
extend(prop, getMulti(node, [
|
|
4346
|
+
extend(prop, getMulti(node, ['sym']));
|
|
4309
4347
|
return {
|
|
4310
|
-
type:
|
|
4348
|
+
type: 'Feature',
|
|
4311
4349
|
properties: prop,
|
|
4312
4350
|
geometry: {
|
|
4313
|
-
type:
|
|
4351
|
+
type: 'Point',
|
|
4314
4352
|
coordinates: coordPair(node).coordinates
|
|
4315
4353
|
}
|
|
4316
4354
|
};
|
|
@@ -4318,28 +4356,28 @@ var toGeoJSON = function () {
|
|
|
4318
4356
|
function getLineStyle(extensions) {
|
|
4319
4357
|
var style = {};
|
|
4320
4358
|
if (extensions) {
|
|
4321
|
-
var lineStyle = get1(extensions,
|
|
4359
|
+
var lineStyle = get1(extensions, 'line');
|
|
4322
4360
|
if (lineStyle) {
|
|
4323
|
-
var color = nodeVal(get1(lineStyle,
|
|
4324
|
-
opacity = parseFloat(nodeVal(get1(lineStyle,
|
|
4325
|
-
width = parseFloat(nodeVal(get1(lineStyle,
|
|
4361
|
+
var color = nodeVal(get1(lineStyle, 'color')),
|
|
4362
|
+
opacity = parseFloat(nodeVal(get1(lineStyle, 'opacity'))),
|
|
4363
|
+
width = parseFloat(nodeVal(get1(lineStyle, 'width')));
|
|
4326
4364
|
if (color) style.stroke = color;
|
|
4327
|
-
if (!isNaN(opacity)) style[
|
|
4365
|
+
if (!isNaN(opacity)) style['stroke-opacity'] = opacity;
|
|
4328
4366
|
// GPX width is in mm, convert to px with 96 px per inch
|
|
4329
|
-
if (!isNaN(width)) style[
|
|
4367
|
+
if (!isNaN(width)) style['stroke-width'] = width * 96 / 25.4;
|
|
4330
4368
|
}
|
|
4331
4369
|
}
|
|
4332
4370
|
return style;
|
|
4333
4371
|
}
|
|
4334
4372
|
function getProperties(node) {
|
|
4335
|
-
var prop = getMulti(node, [
|
|
4336
|
-
links = get(node,
|
|
4373
|
+
var prop = getMulti(node, ['name', 'cmt', 'desc', 'type', 'time', 'keywords']),
|
|
4374
|
+
links = get(node, 'link');
|
|
4337
4375
|
if (links.length) prop.links = [];
|
|
4338
4376
|
for (var i = 0, link; i < links.length; i++) {
|
|
4339
4377
|
link = {
|
|
4340
|
-
href: attr(links[i],
|
|
4378
|
+
href: attr(links[i], 'href')
|
|
4341
4379
|
};
|
|
4342
|
-
extend(link, getMulti(links[i], [
|
|
4380
|
+
extend(link, getMulti(links[i], ['text', 'type']));
|
|
4343
4381
|
prop.links.push(link);
|
|
4344
4382
|
}
|
|
4345
4383
|
return prop;
|
|
@@ -6771,14 +6809,12 @@ LayerListItemVectorLayer.defaultProps = {
|
|
|
6771
6809
|
configurable: true,
|
|
6772
6810
|
};
|
|
6773
6811
|
|
|
6774
|
-
var TuneIconButton = material.styled(material.IconButton)(
|
|
6775
|
-
marginRight: showDeleteButton ? '4px' : '1000px',
|
|
6812
|
+
var TuneIconButton = material.styled(material.IconButton)({
|
|
6776
6813
|
padding: '4px',
|
|
6777
6814
|
marginTop: '-3px',
|
|
6778
|
-
});
|
|
6815
|
+
});
|
|
6779
6816
|
var DeleteIconButton = material.styled(material.IconButton)({
|
|
6780
|
-
|
|
6781
|
-
marginTop: '-3px',
|
|
6817
|
+
marginLeft: '20px',
|
|
6782
6818
|
});
|
|
6783
6819
|
function LayerListItem(_a) {
|
|
6784
6820
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
@@ -6861,28 +6897,12 @@ function LayerListItem(_a) {
|
|
|
6861
6897
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6862
6898
|
!((_f = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _f === void 0 ? void 0 : _f.layers) && (React__default["default"].createElement(ListItemStyled, { sx: __assign({}, props.listItemSx), secondaryAction: configurable && ((_g = Object.keys(paintProps)) === null || _g === void 0 ? void 0 : _g.length) > 0 ? (React__default["default"].createElement(React__default["default"].Fragment, null, props === null || props === void 0 ? void 0 :
|
|
6863
6899
|
props.buttons,
|
|
6864
|
-
React__default["default"].createElement(TuneIconButton, { edge:
|
|
6900
|
+
React__default["default"].createElement(TuneIconButton, { edge: 'end', "aria-label": "settings", onClick: function () {
|
|
6865
6901
|
setPaintPropsFormVisible(function (current) {
|
|
6866
6902
|
return !current;
|
|
6867
6903
|
});
|
|
6868
6904
|
} },
|
|
6869
|
-
React__default["default"].createElement(iconsMaterial.Tune, null)),
|
|
6870
|
-
props.showDeleteButton && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6871
|
-
React__default["default"].createElement(DeleteIconButton, { edge: "end", "aria-label": "delete", onClick: function () {
|
|
6872
|
-
if (typeof setLayerState === 'function') {
|
|
6873
|
-
setShowDeletionConfirmationDialog(true);
|
|
6874
|
-
}
|
|
6875
|
-
} },
|
|
6876
|
-
React__default["default"].createElement(iconsMaterial.Delete, null)),
|
|
6877
|
-
showDeletionConfirmationDialog && (React__default["default"].createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
|
|
6878
|
-
if (typeof setLayerState === 'function') {
|
|
6879
|
-
deletedRef.current = true;
|
|
6880
|
-
setLayerState(false);
|
|
6881
|
-
setShowDeletionConfirmationDialog(false);
|
|
6882
|
-
}
|
|
6883
|
-
}, onCancel: function () {
|
|
6884
|
-
setShowDeletionConfirmationDialog(false);
|
|
6885
|
-
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" })))))) : undefined },
|
|
6905
|
+
React__default["default"].createElement(iconsMaterial.Tune, null)))) : undefined },
|
|
6886
6906
|
React__default["default"].createElement(CheckboxListItemIcon, null,
|
|
6887
6907
|
React__default["default"].createElement(CheckboxStyled, { disabled: !visible, checked: localVisible, onClick: function () {
|
|
6888
6908
|
setLocalVisible(function (val) { return !val; });
|
|
@@ -6892,7 +6912,24 @@ function LayerListItem(_a) {
|
|
|
6892
6912
|
!((_h = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _h === void 0 ? void 0 : _h.layers) &&
|
|
6893
6913
|
Object.keys(paintProps).length > 0 &&
|
|
6894
6914
|
configurable &&
|
|
6895
|
-
paintPropsFormVisible && (React__default["default"].createElement(
|
|
6915
|
+
paintPropsFormVisible && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6916
|
+
props.showDeleteButton && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
6917
|
+
React__default["default"].createElement(DeleteIconButton, { edge: "end", "aria-label": "delete", onClick: function () {
|
|
6918
|
+
if (typeof setLayerState === 'function') {
|
|
6919
|
+
setShowDeletionConfirmationDialog(true);
|
|
6920
|
+
}
|
|
6921
|
+
} },
|
|
6922
|
+
React__default["default"].createElement(iconsMaterial.Delete, null)),
|
|
6923
|
+
showDeletionConfirmationDialog && (React__default["default"].createElement(ConfirmDialog, { open: showDeletionConfirmationDialog, onConfirm: function () {
|
|
6924
|
+
if (typeof setLayerState === 'function') {
|
|
6925
|
+
deletedRef.current = true;
|
|
6926
|
+
setLayerState(false);
|
|
6927
|
+
setShowDeletionConfirmationDialog(false);
|
|
6928
|
+
}
|
|
6929
|
+
}, onCancel: function () {
|
|
6930
|
+
setShowDeletionConfirmationDialog(false);
|
|
6931
|
+
}, title: "Delete layer", text: "Are you sure you want to delete this layer?" })))),
|
|
6932
|
+
React__default["default"].createElement(LayerPropertyForm, { paintProps: paintProps, setPaintProps: setPaintProps, layerType: layerType }))),
|
|
6896
6933
|
((_j = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _j === void 0 ? void 0 : _j.layers) && (React__default["default"].createElement(LayerListFolder, { visible: localVisible, setVisible: setLocalVisible, name: name }, (_m = (_l = (_k = layerComponent === null || layerComponent === void 0 ? void 0 : layerComponent.props) === null || _k === void 0 ? void 0 : _k.layers) === null || _l === void 0 ? void 0 : _l.map) === null || _m === void 0 ? void 0 : _m.call(_l, 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 })); })))));
|
|
6897
6934
|
}
|
|
6898
6935
|
LayerListItem.defaultProps = {
|