@mapcomponents/react-maplibre 0.1.11 → 0.1.15
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/.github/workflows/storybook.yml +10 -5
- package/coverage/clover.xml +894 -747
- package/coverage/coverage-final.json +22 -17
- package/coverage/lcov-report/block-navigation.js +8 -0
- package/coverage/lcov-report/index.html +188 -122
- package/coverage/lcov-report/sorter.js +26 -0
- package/coverage/lcov-report/{components → src/components}/MapLibreMap/MapLibreMap.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MapLibreMap/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlCreatePdfButton/MlCreatePdfButton.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlCreatePdfButton/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlFeatureEditor/MlFeatureEditor.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlFeatureEditor/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlFillExtrusionLayer/MlFillExtrusionLayer.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlFillExtrusionLayer/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlFollowGps/MlFollowGps.js.html +84 -69
- package/coverage/lcov-report/{components → src/components}/MlFollowGps/index.html +27 -21
- package/coverage/lcov-report/{components → src/components}/MlGPXViewer/MlGPXViewer.js.html +73 -61
- package/coverage/lcov-report/{components → src/components}/MlGPXViewer/gpxConverter.js.html +56 -71
- package/coverage/lcov-report/{components → src/components}/MlGPXViewer/index.html +32 -26
- package/coverage/lcov-report/{components → src/components}/MlGeoJsonLayer/MlGeoJsonLayer.js.html +162 -48
- package/coverage/lcov-report/{components → src/components}/MlGeoJsonLayer/index.html +35 -29
- package/coverage/lcov-report/src/components/MlImageMarkerLayer/MlImageMarkerLayer.js.html +311 -0
- package/coverage/lcov-report/{components → src/components}/MlImageMarkerLayer/index.html +35 -29
- package/coverage/lcov-report/{components/MlImageMarkerLayer/MlImageMarkerLayer.js.html → src/components/MlLayer/MlLayer.js.html} +123 -126
- package/coverage/lcov-report/src/components/MlLayer/index.html +117 -0
- package/coverage/lcov-report/{components → src/components}/MlLayerMagnify/MlLayerMagnify.js.html +48 -42
- package/coverage/lcov-report/{components → src/components}/MlLayerMagnify/index.html +31 -25
- package/coverage/lcov-report/{components → src/components}/MlLayerSwipe/MlLayerSwipe.js.html +45 -42
- package/coverage/lcov-report/{components → src/components}/MlLayerSwipe/index.html +31 -25
- package/coverage/lcov-report/src/components/MlLayerSwitcher/MlLayerSwitcher.js.html +755 -0
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/LayerBox.js.html +380 -0
- package/coverage/lcov-report/src/components/MlLayerSwitcher/components/index.html +117 -0
- package/coverage/lcov-report/src/components/MlLayerSwitcher/index.html +117 -0
- package/coverage/lcov-report/{components → src/components}/MlMarker/MlMarker.js.html +18 -12
- package/coverage/lcov-report/{components → src/components}/MlMarker/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlNavigationCompass/MlNavigationCompass.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlNavigationCompass/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlNavigationTools/MlNavigationTools.js.html +57 -42
- package/coverage/lcov-report/{components → src/components}/MlNavigationTools/index.html +25 -19
- package/coverage/lcov-report/{components → src/components}/MlOsmLayer/MlOsmLayer.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlOsmLayer/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlScaleReference/MlScaleReference.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlScaleReference/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlShareMapState/MlShareMapState.js.html +224 -26
- package/coverage/lcov-report/{components → src/components}/MlShareMapState/index.html +25 -19
- package/coverage/lcov-report/{components → src/components}/MlSpatialElevationProfile/MlSpatialElevationProfile.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlSpatialElevationProfile/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlThreeJsLayer/MlThreeJsLayer.js.html +37 -55
- package/coverage/lcov-report/{components → src/components}/MlThreeJsLayer/index.html +31 -25
- package/coverage/lcov-report/{components → src/components}/MlUseMapDebugger/MlUseMapDebugger.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlUseMapDebugger/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlVectorTileLayer/MlVectorTileLayer.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlVectorTileLayer/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlWmsFeatureInfoPopup/MlWmsFeatureInfoPopup.js.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlWmsFeatureInfoPopup/index.html +17 -11
- package/coverage/lcov-report/{components → src/components}/MlWmsLayer/MlWmsLayer.js.html +20 -14
- package/coverage/lcov-report/{components → src/components}/MlWmsLayer/index.html +21 -15
- package/coverage/lcov-report/{components → src/components}/MlWmsLoader/MlWmsLoader.js.html +38 -20
- package/coverage/lcov-report/{components → src/components}/MlWmsLoader/index.html +23 -17
- package/coverage/lcov-report/src/hooks/index.html +147 -0
- package/coverage/lcov-report/{components/MlLayer/MlLayer.js.html → src/hooks/useMap.js.html} +86 -119
- package/coverage/lcov-report/{hooks → src/hooks}/useMapState.js.html +98 -92
- package/coverage/lcov-report/{hooks → src/hooks}/useWms.js.html +25 -19
- package/coverage/lcov-report/src/i18n.js.html +167 -0
- package/coverage/lcov-report/src/index.html +117 -0
- package/coverage/lcov-report/src/translations/english.js.html +95 -0
- package/coverage/lcov-report/src/translations/german.js.html +95 -0
- package/coverage/lcov-report/src/translations/index.html +132 -0
- package/coverage/lcov.info +1620 -1306
- package/dist/b556faa3bc6829d2.png +0 -0
- package/dist/index.esm.js +976 -688
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -1
- package/public/assets/dop.png +0 -0
- package/public/assets/historic.png +0 -0
- package/public/assets/osm.png +0 -0
- package/public/thumbnails/MlFollowGps.png +0 -0
- package/public/thumbnails/MlThreeJsLayer.png +0 -0
- package/rollup.config.js +7 -1
- package/src/components/MapLibreMap/lib/MapLibreGlWrapper.js +53 -67
- package/src/components/MlCreatePdfButton/MlCreatePdfButton.meta.json +1 -1
- package/src/components/MlFeatureEditor/MlFeatureEditor.meta.json +2 -2
- package/src/components/MlFollowGps/MlFollowGps.js +49 -46
- package/src/components/MlFollowGps/MlFollowGps.meta.json +2 -2
- package/src/components/MlFollowGps/assets/marker.png +0 -0
- package/src/components/MlGPXViewer/MlGPXViewer.js +45 -43
- package/src/components/MlGPXViewer/gpxConverter.js +22 -29
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.js +45 -9
- package/src/components/MlGeoJsonLayer/MlGeoJsonLayer.meta.json +1 -1
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.js +21 -57
- package/src/components/MlImageMarkerLayer/MlImageMarkerLayer.test.js +6 -7
- package/src/components/MlLayer/MlLayer.js +28 -6
- package/src/components/MlLayer/MlLayer.test.js +12 -10
- package/src/components/MlLayerMagnify/MlLayerMagnify.js +3 -3
- package/src/components/MlLayerSwipe/MlLayerSwipe.js +4 -5
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.css +17 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.doc.de.md +3 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.js +223 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.meta_.json +15 -0
- package/src/components/MlLayerSwitcher/MlLayerSwitcher.stories.js +106 -0
- package/src/components/MlLayerSwitcher/assets/sample_1.json +26 -0
- package/src/components/MlLayerSwitcher/assets/sample_2.json +22 -0
- package/src/components/MlLayerSwitcher/components/LayerBox.js +98 -0
- package/src/components/MlMarker/MlMarker.js +1 -1
- package/src/components/MlNavigationTools/MlNavigationTools.js +29 -26
- package/src/components/MlScaleReference/MlScaleReference.meta.json +1 -1
- package/src/components/MlScaleReference/MlScaleReference.stories.js +25 -21
- package/src/components/MlShareMapState/MlShareMapState.js +73 -9
- package/src/components/MlShareMapState/MlShareMapState.stories.js +24 -1
- package/src/components/MlSpatialElevationProfile/MlSpatialElevationProfile.stories.js +12 -6
- package/src/components/MlThreeJsLayer/MlThreeJsLayer.js +8 -15
- package/src/components/MlVectorTileLayer/MlVectorTileLayer.meta.json +3 -3
- package/src/components/MlWmsLayer/MlWmsLayer.js +1 -1
- package/src/components/MlWmsLoader/MlWmsLoader.js +8 -4
- package/src/components/MlWmsLoader/MlWmsLoader.meta.json +1 -1
- package/src/components/MlWmsLoader/MlWmsLoader.stories.js +5 -4
- package/src/decorators/EmptyMapContextDecorator.js +11 -6
- package/src/decorators/MapContext3DDecorator.js +25 -20
- package/src/decorators/MapContextDashboardDecorator.js +7 -2
- package/src/decorators/MapContextDecorator.js +7 -3
- package/src/decorators/MapContextKlokantechBasicDecorator.js +8 -4
- package/src/decorators/MultiMapContextDecorator.js +2 -1
- package/src/hooks/useMap.js +36 -62
- package/src/hooks/useMapState.js +3 -3
- package/src/hooks/useWms.js +7 -6
- package/src/i18n.js +28 -0
- package/src/index.js +3 -0
- package/src/translations/english.js +4 -0
- package/src/translations/german.js +4 -0
- package/src/ui_components/ImageLoader.js +73 -0
- package/src/ui_components/Sidebar.js +76 -22
- package/src/ui_components/TopToolbar.js +18 -18
- package/coverage/lcov-report/components/MlLayer/index.html +0 -111
- package/coverage/lcov-report/hooks/index.html +0 -141
- package/coverage/lcov-report/hooks/useMap.js.html +0 -377
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
<html lang="en">
|
|
4
4
|
|
|
5
5
|
<head>
|
|
6
|
-
<title>Code coverage report for components/MlGPXViewer</title>
|
|
6
|
+
<title>Code coverage report for src/components/MlGPXViewer</title>
|
|
7
7
|
<meta charset="utf-8" />
|
|
8
|
-
<link rel="stylesheet" href="
|
|
9
|
-
<link rel="stylesheet" href="
|
|
10
|
-
<link rel="shortcut icon" type="image/x-icon" href="
|
|
8
|
+
<link rel="stylesheet" href="../../../prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="../../../base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.png" />
|
|
11
11
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
12
|
<style type='text/css'>
|
|
13
13
|
.coverage-summary .sorter {
|
|
14
|
-
background-image: url(
|
|
14
|
+
background-image: url(../../../sort-arrow-sprite.png);
|
|
15
15
|
}
|
|
16
16
|
</style>
|
|
17
17
|
</head>
|
|
@@ -19,20 +19,20 @@
|
|
|
19
19
|
<body>
|
|
20
20
|
<div class='wrapper'>
|
|
21
21
|
<div class='pad1'>
|
|
22
|
-
<h1><a href="
|
|
22
|
+
<h1><a href="../../../index.html">All files</a> src/components/MlGPXViewer</h1>
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">16.04% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>73/455</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">3.
|
|
33
|
+
<span class="strong">3.86% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>9/233</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">17.
|
|
47
|
+
<span class="strong">17.88% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>71/397</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -54,6 +54,12 @@
|
|
|
54
54
|
<p class="quiet">
|
|
55
55
|
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
56
|
</p>
|
|
57
|
+
<template id="filterTemplate">
|
|
58
|
+
<div class="quiet">
|
|
59
|
+
Filter:
|
|
60
|
+
<input oninput="onInput()" type="search" id="fileSearch">
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
57
63
|
</div>
|
|
58
64
|
<div class='status-line low'></div>
|
|
59
65
|
<div class="pad1">
|
|
@@ -74,17 +80,17 @@
|
|
|
74
80
|
</thead>
|
|
75
81
|
<tbody><tr>
|
|
76
82
|
<td class="file medium" data-value="MlGPXViewer.js"><a href="MlGPXViewer.js.html">MlGPXViewer.js</a></td>
|
|
77
|
-
<td data-value="51.
|
|
83
|
+
<td data-value="51.56" class="pic medium">
|
|
78
84
|
<div class="chart"><div class="cover-fill" style="width: 51%"></div><div class="cover-empty" style="width: 49%"></div></div>
|
|
79
85
|
</td>
|
|
80
|
-
<td data-value="51.
|
|
81
|
-
<td data-value="
|
|
82
|
-
<td data-value="
|
|
83
|
-
<td data-value="
|
|
86
|
+
<td data-value="51.56" class="pct medium">51.56%</td>
|
|
87
|
+
<td data-value="128" class="abs medium">66/128</td>
|
|
88
|
+
<td data-value="26.66" class="pct low">26.66%</td>
|
|
89
|
+
<td data-value="30" class="abs low">8/30</td>
|
|
84
90
|
<td data-value="29.62" class="pct low">29.62%</td>
|
|
85
91
|
<td data-value="27" class="abs low">8/27</td>
|
|
86
|
-
<td data-value="52.
|
|
87
|
-
<td data-value="
|
|
92
|
+
<td data-value="52.89" class="pct medium">52.89%</td>
|
|
93
|
+
<td data-value="121" class="abs medium">64/121</td>
|
|
88
94
|
</tr>
|
|
89
95
|
|
|
90
96
|
<tr>
|
|
@@ -98,8 +104,8 @@
|
|
|
98
104
|
<td data-value="203" class="abs low">1/203</td>
|
|
99
105
|
<td data-value="3.33" class="pct low">3.33%</td>
|
|
100
106
|
<td data-value="30" class="abs low">1/30</td>
|
|
101
|
-
<td data-value="2.
|
|
102
|
-
<td data-value="
|
|
107
|
+
<td data-value="2.53" class="pct low">2.53%</td>
|
|
108
|
+
<td data-value="276" class="abs low">7/276</td>
|
|
103
109
|
</tr>
|
|
104
110
|
|
|
105
111
|
</tbody>
|
|
@@ -109,18 +115,18 @@
|
|
|
109
115
|
</div><!-- /wrapper -->
|
|
110
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
111
117
|
Code coverage generated by
|
|
112
|
-
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
113
|
-
at
|
|
118
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener">istanbul</a>
|
|
119
|
+
at Tue Dec 21 2021 11:51:22 GMT+0000 (Coordinated Universal Time)
|
|
114
120
|
</div>
|
|
115
121
|
</div>
|
|
116
|
-
<script src="
|
|
122
|
+
<script src="../../../prettify.js"></script>
|
|
117
123
|
<script>
|
|
118
124
|
window.onload = function () {
|
|
119
125
|
prettyPrint();
|
|
120
126
|
};
|
|
121
127
|
</script>
|
|
122
|
-
<script src="
|
|
123
|
-
<script src="
|
|
128
|
+
<script src="../../../sorter.js"></script>
|
|
129
|
+
<script src="../../../block-navigation.js"></script>
|
|
124
130
|
</body>
|
|
125
131
|
</html>
|
|
126
132
|
|
package/coverage/lcov-report/{components → src/components}/MlGeoJsonLayer/MlGeoJsonLayer.js.html
RENAMED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
<html lang="en">
|
|
4
4
|
|
|
5
5
|
<head>
|
|
6
|
-
<title>Code coverage report for components/MlGeoJsonLayer/MlGeoJsonLayer.js</title>
|
|
6
|
+
<title>Code coverage report for src/components/MlGeoJsonLayer/MlGeoJsonLayer.js</title>
|
|
7
7
|
<meta charset="utf-8" />
|
|
8
|
-
<link rel="stylesheet" href="
|
|
9
|
-
<link rel="stylesheet" href="
|
|
10
|
-
<link rel="shortcut icon" type="image/x-icon" href="
|
|
8
|
+
<link rel="stylesheet" href="../../../prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="../../../base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="../../../favicon.png" />
|
|
11
11
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
12
|
<style type='text/css'>
|
|
13
13
|
.coverage-summary .sorter {
|
|
14
|
-
background-image: url(
|
|
14
|
+
background-image: url(../../../sort-arrow-sprite.png);
|
|
15
15
|
}
|
|
16
16
|
</style>
|
|
17
17
|
</head>
|
|
@@ -19,34 +19,34 @@
|
|
|
19
19
|
<body>
|
|
20
20
|
<div class='wrapper'>
|
|
21
21
|
<div class='pad1'>
|
|
22
|
-
<h1><a href="
|
|
22
|
+
<h1><a href="../../../index.html">All files</a> / <a href="index.html">src/components/MlGeoJsonLayer</a> MlGeoJsonLayer.js</h1>
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">63.51% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>47/74</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">53.22% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>33/62</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">77.77% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>7/9</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">61.42% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>43/70</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -54,6 +54,12 @@
|
|
|
54
54
|
<p class="quiet">
|
|
55
55
|
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
56
|
</p>
|
|
57
|
+
<template id="filterTemplate">
|
|
58
|
+
<div class="quiet">
|
|
59
|
+
Filter:
|
|
60
|
+
<input oninput="onInput()" type="search" id="fileSearch">
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
57
63
|
</div>
|
|
58
64
|
<div class='status-line medium'></div>
|
|
59
65
|
<pre><table class="coverage">
|
|
@@ -283,7 +289,44 @@
|
|
|
283
289
|
<a name='L224'></a><a href='#L224'>224</a>
|
|
284
290
|
<a name='L225'></a><a href='#L225'>225</a>
|
|
285
291
|
<a name='L226'></a><a href='#L226'>226</a>
|
|
286
|
-
<a name='L227'></a><a href='#L227'>227</a
|
|
292
|
+
<a name='L227'></a><a href='#L227'>227</a>
|
|
293
|
+
<a name='L228'></a><a href='#L228'>228</a>
|
|
294
|
+
<a name='L229'></a><a href='#L229'>229</a>
|
|
295
|
+
<a name='L230'></a><a href='#L230'>230</a>
|
|
296
|
+
<a name='L231'></a><a href='#L231'>231</a>
|
|
297
|
+
<a name='L232'></a><a href='#L232'>232</a>
|
|
298
|
+
<a name='L233'></a><a href='#L233'>233</a>
|
|
299
|
+
<a name='L234'></a><a href='#L234'>234</a>
|
|
300
|
+
<a name='L235'></a><a href='#L235'>235</a>
|
|
301
|
+
<a name='L236'></a><a href='#L236'>236</a>
|
|
302
|
+
<a name='L237'></a><a href='#L237'>237</a>
|
|
303
|
+
<a name='L238'></a><a href='#L238'>238</a>
|
|
304
|
+
<a name='L239'></a><a href='#L239'>239</a>
|
|
305
|
+
<a name='L240'></a><a href='#L240'>240</a>
|
|
306
|
+
<a name='L241'></a><a href='#L241'>241</a>
|
|
307
|
+
<a name='L242'></a><a href='#L242'>242</a>
|
|
308
|
+
<a name='L243'></a><a href='#L243'>243</a>
|
|
309
|
+
<a name='L244'></a><a href='#L244'>244</a>
|
|
310
|
+
<a name='L245'></a><a href='#L245'>245</a>
|
|
311
|
+
<a name='L246'></a><a href='#L246'>246</a>
|
|
312
|
+
<a name='L247'></a><a href='#L247'>247</a>
|
|
313
|
+
<a name='L248'></a><a href='#L248'>248</a>
|
|
314
|
+
<a name='L249'></a><a href='#L249'>249</a>
|
|
315
|
+
<a name='L250'></a><a href='#L250'>250</a>
|
|
316
|
+
<a name='L251'></a><a href='#L251'>251</a>
|
|
317
|
+
<a name='L252'></a><a href='#L252'>252</a>
|
|
318
|
+
<a name='L253'></a><a href='#L253'>253</a>
|
|
319
|
+
<a name='L254'></a><a href='#L254'>254</a>
|
|
320
|
+
<a name='L255'></a><a href='#L255'>255</a>
|
|
321
|
+
<a name='L256'></a><a href='#L256'>256</a>
|
|
322
|
+
<a name='L257'></a><a href='#L257'>257</a>
|
|
323
|
+
<a name='L258'></a><a href='#L258'>258</a>
|
|
324
|
+
<a name='L259'></a><a href='#L259'>259</a>
|
|
325
|
+
<a name='L260'></a><a href='#L260'>260</a>
|
|
326
|
+
<a name='L261'></a><a href='#L261'>261</a>
|
|
327
|
+
<a name='L262'></a><a href='#L262'>262</a>
|
|
328
|
+
<a name='L263'></a><a href='#L263'>263</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
329
|
+
<span class="cline-any cline-neutral"> </span>
|
|
287
330
|
<span class="cline-any cline-neutral"> </span>
|
|
288
331
|
<span class="cline-any cline-neutral"> </span>
|
|
289
332
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -301,21 +344,29 @@
|
|
|
301
344
|
<span class="cline-any cline-neutral"> </span>
|
|
302
345
|
<span class="cline-any cline-yes">2x</span>
|
|
303
346
|
<span class="cline-any cline-neutral"> </span>
|
|
304
|
-
<span class="cline-any cline-yes">
|
|
305
|
-
<span class="cline-any cline-yes">
|
|
306
|
-
<span class="cline-any cline-yes">8x</span>
|
|
307
|
-
<span class="cline-any cline-yes">8x</span>
|
|
308
|
-
<span class="cline-any cline-yes">8x</span>
|
|
309
|
-
<span class="cline-any cline-yes">8x</span>
|
|
310
|
-
<span class="cline-any cline-yes">8x</span>
|
|
311
|
-
<span class="cline-any cline-yes">8x</span>
|
|
312
|
-
<span class="cline-any cline-yes">8x</span>
|
|
313
|
-
<span class="cline-any cline-yes">8x</span>
|
|
347
|
+
<span class="cline-any cline-yes">12x</span>
|
|
348
|
+
<span class="cline-any cline-yes">12x</span>
|
|
314
349
|
<span class="cline-any cline-neutral"> </span>
|
|
315
350
|
<span class="cline-any cline-neutral"> </span>
|
|
316
|
-
<span class="cline-any cline-yes">8x</span>
|
|
317
351
|
<span class="cline-any cline-neutral"> </span>
|
|
318
|
-
<span class="cline-any cline-
|
|
352
|
+
<span class="cline-any cline-neutral"> </span>
|
|
353
|
+
<span class="cline-any cline-neutral"> </span>
|
|
354
|
+
<span class="cline-any cline-neutral"> </span>
|
|
355
|
+
<span class="cline-any cline-neutral"> </span>
|
|
356
|
+
<span class="cline-any cline-yes">12x</span>
|
|
357
|
+
<span class="cline-any cline-yes">12x</span>
|
|
358
|
+
<span class="cline-any cline-yes">12x</span>
|
|
359
|
+
<span class="cline-any cline-yes">12x</span>
|
|
360
|
+
<span class="cline-any cline-yes">12x</span>
|
|
361
|
+
<span class="cline-any cline-yes">12x</span>
|
|
362
|
+
<span class="cline-any cline-yes">12x</span>
|
|
363
|
+
<span class="cline-any cline-yes">12x</span>
|
|
364
|
+
<span class="cline-any cline-yes">12x</span>
|
|
365
|
+
<span class="cline-any cline-neutral"> </span>
|
|
366
|
+
<span class="cline-any cline-neutral"> </span>
|
|
367
|
+
<span class="cline-any cline-yes">12x</span>
|
|
368
|
+
<span class="cline-any cline-neutral"> </span>
|
|
369
|
+
<span class="cline-any cline-yes">12x</span>
|
|
319
370
|
<span class="cline-any cline-yes">4x</span>
|
|
320
371
|
<span class="cline-any cline-yes">4x</span>
|
|
321
372
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -323,7 +374,6 @@
|
|
|
323
374
|
<span class="cline-any cline-no"> </span>
|
|
324
375
|
<span class="cline-any cline-neutral"> </span>
|
|
325
376
|
<span class="cline-any cline-yes">2x</span>
|
|
326
|
-
<span class="cline-any cline-neutral"> </span>
|
|
327
377
|
<span class="cline-any cline-yes">2x</span>
|
|
328
378
|
<span class="cline-any cline-neutral"> </span>
|
|
329
379
|
<span class="cline-any cline-yes">2x</span>
|
|
@@ -331,17 +381,23 @@
|
|
|
331
381
|
<span class="cline-any cline-neutral"> </span>
|
|
332
382
|
<span class="cline-any cline-neutral"> </span>
|
|
333
383
|
<span class="cline-any cline-neutral"> </span>
|
|
384
|
+
<span class="cline-any cline-yes">12x</span>
|
|
334
385
|
<span class="cline-any cline-yes">8x</span>
|
|
335
|
-
<span class="cline-any cline-
|
|
386
|
+
<span class="cline-any cline-neutral"> </span>
|
|
387
|
+
<span class="cline-any cline-no"> </span>
|
|
388
|
+
<span class="cline-any cline-no"> </span>
|
|
389
|
+
<span class="cline-any cline-neutral"> </span>
|
|
336
390
|
<span class="cline-any cline-neutral"> </span>
|
|
337
391
|
<span class="cline-any cline-neutral"> </span>
|
|
392
|
+
<span class="cline-any cline-yes">12x</span>
|
|
393
|
+
<span class="cline-any cline-yes">8x</span>
|
|
338
394
|
<span class="cline-any cline-neutral"> </span>
|
|
339
395
|
<span class="cline-any cline-no"> </span>
|
|
340
396
|
<span class="cline-any cline-no"> </span>
|
|
341
397
|
<span class="cline-any cline-neutral"> </span>
|
|
342
398
|
<span class="cline-any cline-neutral"> </span>
|
|
343
399
|
<span class="cline-any cline-neutral"> </span>
|
|
344
|
-
<span class="cline-any cline-yes">
|
|
400
|
+
<span class="cline-any cline-yes">12x</span>
|
|
345
401
|
<span class="cline-any cline-neutral"> </span>
|
|
346
402
|
<span class="cline-any cline-no"> </span>
|
|
347
403
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -360,7 +416,7 @@
|
|
|
360
416
|
<span class="cline-any cline-neutral"> </span>
|
|
361
417
|
<span class="cline-any cline-neutral"> </span>
|
|
362
418
|
<span class="cline-any cline-neutral"> </span>
|
|
363
|
-
<span class="cline-any cline-yes">
|
|
419
|
+
<span class="cline-any cline-yes">12x</span>
|
|
364
420
|
<span class="cline-any cline-yes">8x</span>
|
|
365
421
|
<span class="cline-any cline-neutral"> </span>
|
|
366
422
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -388,12 +444,25 @@
|
|
|
388
444
|
<span class="cline-any cline-neutral"> </span>
|
|
389
445
|
<span class="cline-any cline-neutral"> </span>
|
|
390
446
|
<span class="cline-any cline-neutral"> </span>
|
|
391
|
-
<span class="cline-any cline-yes">
|
|
392
|
-
<span class="cline-any cline-yes">
|
|
447
|
+
<span class="cline-any cline-yes">12x</span>
|
|
448
|
+
<span class="cline-any cline-yes">12x</span>
|
|
393
449
|
<span class="cline-any cline-neutral"> </span>
|
|
394
450
|
<span class="cline-any cline-neutral"> </span>
|
|
395
451
|
<span class="cline-any cline-neutral"> </span>
|
|
396
452
|
<span class="cline-any cline-yes">4x</span>
|
|
453
|
+
<span class="cline-any cline-neutral"> </span>
|
|
454
|
+
<span class="cline-any cline-yes">4x</span>
|
|
455
|
+
<span class="cline-any cline-no"> </span>
|
|
456
|
+
<span class="cline-any cline-neutral"> </span>
|
|
457
|
+
<span class="cline-any cline-no"> </span>
|
|
458
|
+
<span class="cline-any cline-no"> </span>
|
|
459
|
+
<span class="cline-any cline-no"> </span>
|
|
460
|
+
<span class="cline-any cline-neutral"> </span>
|
|
461
|
+
<span class="cline-any cline-neutral"> </span>
|
|
462
|
+
<span class="cline-any cline-no"> </span>
|
|
463
|
+
<span class="cline-any cline-no"> </span>
|
|
464
|
+
<span class="cline-any cline-neutral"> </span>
|
|
465
|
+
<span class="cline-any cline-neutral"> </span>
|
|
397
466
|
<span class="cline-any cline-yes">4x</span>
|
|
398
467
|
<span class="cline-any cline-yes">4x</span>
|
|
399
468
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -426,6 +495,7 @@
|
|
|
426
495
|
<span class="cline-any cline-neutral"> </span>
|
|
427
496
|
<span class="cline-any cline-neutral"> </span>
|
|
428
497
|
<span class="cline-any cline-neutral"> </span>
|
|
498
|
+
<span class="cline-any cline-neutral"> </span>
|
|
429
499
|
<span class="cline-any cline-yes">4x</span>
|
|
430
500
|
<span class="cline-any cline-no"> </span>
|
|
431
501
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -449,7 +519,7 @@
|
|
|
449
519
|
<span class="cline-any cline-neutral"> </span>
|
|
450
520
|
<span class="cline-any cline-neutral"> </span>
|
|
451
521
|
<span class="cline-any cline-neutral"> </span>
|
|
452
|
-
<span class="cline-any cline-yes">
|
|
522
|
+
<span class="cline-any cline-yes">12x</span>
|
|
453
523
|
<span class="cline-any cline-neutral"> </span>
|
|
454
524
|
<span class="cline-any cline-neutral"> </span>
|
|
455
525
|
<span class="cline-any cline-yes">2x</span>
|
|
@@ -509,12 +579,21 @@
|
|
|
509
579
|
<span class="cline-any cline-neutral"> </span>
|
|
510
580
|
<span class="cline-any cline-neutral"> </span>
|
|
511
581
|
<span class="cline-any cline-neutral"> </span>
|
|
582
|
+
<span class="cline-any cline-neutral"> </span>
|
|
583
|
+
<span class="cline-any cline-neutral"> </span>
|
|
584
|
+
<span class="cline-any cline-neutral"> </span>
|
|
585
|
+
<span class="cline-any cline-neutral"> </span>
|
|
586
|
+
<span class="cline-any cline-neutral"> </span>
|
|
587
|
+
<span class="cline-any cline-neutral"> </span>
|
|
588
|
+
<span class="cline-any cline-neutral"> </span>
|
|
589
|
+
<span class="cline-any cline-neutral"> </span>
|
|
512
590
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { useRef, useEffect, useContext, useCallback } from "react";
|
|
513
591
|
import PropTypes from "prop-types";
|
|
514
592
|
|
|
515
593
|
import { v4 as uuidv4 } from "uuid";
|
|
516
594
|
import * as turf from "@turf/turf";
|
|
517
595
|
import { MapContext } from "@mapcomponents/react-core";
|
|
596
|
+
import useMapState from "../../hooks/useMapState";
|
|
518
597
|
|
|
519
598
|
import { _transitionToGeojson } from "./util/transitionFunctions";
|
|
520
599
|
|
|
@@ -528,6 +607,14 @@ const msPerStep = 50;
|
|
|
528
607
|
const MlGeoJsonLayer = (props) => {
|
|
529
608
|
// Use a useRef hook to reference the layer object to be able to access it later inside useEffect hooks
|
|
530
609
|
const mapContext = useContext(MapContext);
|
|
610
|
+
const mapState = useMapState({
|
|
611
|
+
mapId: props.mapId,
|
|
612
|
+
watch: {
|
|
613
|
+
viewport: false,
|
|
614
|
+
layers: true,
|
|
615
|
+
sources: false,
|
|
616
|
+
},
|
|
617
|
+
});
|
|
531
618
|
const oldGeojsonRef = useRef(null);
|
|
532
619
|
const mapRef = useRef(null);
|
|
533
620
|
const initializedRef = useRef(false);
|
|
@@ -545,11 +632,10 @@ const MlGeoJsonLayer = (props) => {
|
|
|
545
632
|
let _componentId = componentId.current;
|
|
546
633
|
return () => {
|
|
547
634
|
// This is the cleanup function, it is called when this react component is removed from react-dom
|
|
548
|
-
<span class="missing-if-branch" title="if path not taken" >I</span>if(transitionTimeoutRef.current){
|
|
549
|
-
<span class="cstat-no" title="statement not covered" > clearTimeout(transitionTimeoutRef.current)
|
|
635
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (transitionTimeoutRef.current) {
|
|
636
|
+
<span class="cstat-no" title="statement not covered" > clearTimeout(transitionTimeoutRef.current);</span>
|
|
550
637
|
}
|
|
551
638
|
if (mapRef.current) {
|
|
552
|
-
|
|
553
639
|
mapRef.current.cleanup(_componentId);
|
|
554
640
|
|
|
555
641
|
mapRef.current = null;
|
|
@@ -559,11 +645,17 @@ const MlGeoJsonLayer = (props) => {
|
|
|
559
645
|
|
|
560
646
|
useEffect(() => {
|
|
561
647
|
if (!mapRef.current || <span class="branch-1 cbranch-no" title="branch not covered" >!initializedRef.current)</span> return;
|
|
562
|
-
|
|
563
|
-
|
|
648
|
+
|
|
649
|
+
<span class="cstat-no" title="statement not covered" > for (var key in props.layout) {</span>
|
|
650
|
+
<span class="cstat-no" title="statement not covered" > mapContext.getMap(props.mapId).setLayoutProperty(layerId.current, key, props.layout[key]);</span>
|
|
651
|
+
}
|
|
652
|
+
}, [props.layout, mapContext, props.mapId]);
|
|
653
|
+
|
|
654
|
+
useEffect(() => {
|
|
655
|
+
if (!mapRef.current || <span class="branch-1 cbranch-no" title="branch not covered" >!initializedRef.current)</span> return;
|
|
564
656
|
|
|
565
657
|
<span class="cstat-no" title="statement not covered" > for (var key in props.paint) {</span>
|
|
566
|
-
<span class="cstat-no" title="statement not covered" > mapContext.getMap(props.mapId).setPaintProperty(
|
|
658
|
+
<span class="cstat-no" title="statement not covered" > mapContext.getMap(props.mapId).setPaintProperty(layerId.current, key, props.paint[key]);</span>
|
|
567
659
|
}
|
|
568
660
|
}, [props.paint, mapContext, props.mapId]);
|
|
569
661
|
|
|
@@ -620,6 +712,19 @@ const MlGeoJsonLayer = (props) => {
|
|
|
620
712
|
// initialize the layer and add it to the MapLibre-gl instance or do something else with it
|
|
621
713
|
|
|
622
714
|
if (props.geojson) {
|
|
715
|
+
//check if insertBeforeLayer exists
|
|
716
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (props.insertBeforeLayer) {
|
|
717
|
+
let layerFound = <span class="cstat-no" title="statement not covered" >false;</span>
|
|
718
|
+
|
|
719
|
+
<span class="cstat-no" title="statement not covered" > mapState?.layers?.forEach(<span class="fstat-no" title="function not covered" >(l</span>ayer) => {</span>
|
|
720
|
+
<span class="cstat-no" title="statement not covered" > if (layer.id === props.insertBeforeLayer) {</span>
|
|
721
|
+
<span class="cstat-no" title="statement not covered" > layerFound = true;</span>
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
<span class="cstat-no" title="statement not covered" > if (!layerFound) {</span>
|
|
725
|
+
<span class="cstat-no" title="statement not covered" > return;</span>
|
|
726
|
+
}
|
|
727
|
+
}
|
|
623
728
|
initializedRef.current = true;
|
|
624
729
|
let geojson = props.geojson;
|
|
625
730
|
|
|
@@ -647,6 +752,7 @@ const MlGeoJsonLayer = (props) => {
|
|
|
647
752
|
"line-color": "rgb(100,200,100)",
|
|
648
753
|
"line-width": 10,
|
|
649
754
|
},
|
|
755
|
+
layout: props.layout || {},
|
|
650
756
|
},
|
|
651
757
|
props.insertBeforeLayer,
|
|
652
758
|
componentId.current
|
|
@@ -673,7 +779,7 @@ const MlGeoJsonLayer = (props) => {
|
|
|
673
779
|
<span class="cstat-no" title="statement not covered" > oldGeojsonRef.current = props.geojson;</span>
|
|
674
780
|
}
|
|
675
781
|
}
|
|
676
|
-
}, [mapContext.mapIds, mapContext, props, transitionToGeojson]);
|
|
782
|
+
}, [mapContext.mapIds, mapContext, props, transitionToGeojson, mapState.layers]);
|
|
677
783
|
|
|
678
784
|
return <></>;
|
|
679
785
|
};
|
|
@@ -689,8 +795,16 @@ MlGeoJsonLayer.propTypes = {
|
|
|
689
795
|
*/
|
|
690
796
|
type: PropTypes.string,
|
|
691
797
|
/**
|
|
692
|
-
*
|
|
693
|
-
* Possible
|
|
798
|
+
* Layout property object, that is passed to the addLayer call.
|
|
799
|
+
* Possible props depend on the layer type.
|
|
800
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
|
|
801
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
|
|
802
|
+
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
803
|
+
*/
|
|
804
|
+
layout: PropTypes.object,
|
|
805
|
+
/**
|
|
806
|
+
* Paint property object, that is passed to the addLayer call.
|
|
807
|
+
* Possible props depend on the layer type.
|
|
694
808
|
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#line
|
|
695
809
|
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#circle
|
|
696
810
|
* https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/#fill
|
|
@@ -741,18 +855,18 @@ export default MlGeoJsonLayer;
|
|
|
741
855
|
</div><!-- /wrapper -->
|
|
742
856
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
743
857
|
Code coverage generated by
|
|
744
|
-
<a href="https://istanbul.js.org/" target="_blank">istanbul</a>
|
|
745
|
-
at
|
|
858
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener">istanbul</a>
|
|
859
|
+
at Tue Dec 21 2021 11:51:22 GMT+0000 (Coordinated Universal Time)
|
|
746
860
|
</div>
|
|
747
861
|
</div>
|
|
748
|
-
<script src="
|
|
862
|
+
<script src="../../../prettify.js"></script>
|
|
749
863
|
<script>
|
|
750
864
|
window.onload = function () {
|
|
751
865
|
prettyPrint();
|
|
752
866
|
};
|
|
753
867
|
</script>
|
|
754
|
-
<script src="
|
|
755
|
-
<script src="
|
|
868
|
+
<script src="../../../sorter.js"></script>
|
|
869
|
+
<script src="../../../block-navigation.js"></script>
|
|
756
870
|
</body>
|
|
757
871
|
</html>
|
|
758
872
|
|