aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-10-25 16:27:58 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-10-25 16:27:58 -0700
commit43ff7c49ba1c8cfeca148055765b16b10a4f0c44 (patch)
tree7d4701511cb3e02248ef26741c6d4f9b2c2e5ee0 /modern/src
parent5df4c5743d7b501529d4e3823fe02184ef0259fe (diff)
downloadetbsa-traccar-web-43ff7c49ba1c8cfeca148055765b16b10a4f0c44.tar.gz
etbsa-traccar-web-43ff7c49ba1c8cfeca148055765b16b10a4f0c44.tar.bz2
etbsa-traccar-web-43ff7c49ba1c8cfeca148055765b16b10a4f0c44.zip
Show geofences layers
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/MainPage.js2
-rw-r--r--modern/src/map/GeofenceMap.js41
2 files changed, 37 insertions, 6 deletions
diff --git a/modern/src/MainPage.js b/modern/src/MainPage.js
index de486b2..adb86b2 100644
--- a/modern/src/MainPage.js
+++ b/modern/src/MainPage.js
@@ -9,6 +9,7 @@ import MainToolbar from './MainToolbar';
import Map from './map/Map';
import PositionsMap from './map/PositionsMap';
import SelectedDeviceMap from './map/SelectedDeviceMap';
+import GeofenceMap from './map/GeofenceMap';
const useStyles = makeStyles(theme => ({
root: {
@@ -56,6 +57,7 @@ const MainPage = ({ width }) => {
<div className={classes.mapContainer}>
<ContainerDimensions>
<Map>
+ <GeofenceMap />
<PositionsMap />
<SelectedDeviceMap />
</Map>
diff --git a/modern/src/map/GeofenceMap.js b/modern/src/map/GeofenceMap.js
index 965efaa..53d951d 100644
--- a/modern/src/map/GeofenceMap.js
+++ b/modern/src/map/GeofenceMap.js
@@ -26,18 +26,47 @@ const GeofenceMap = () => {
}
});
map.addLayer({
- 'id': id,
+ 'source': id,
+ 'id': 'geofences-fill',
'type': 'fill',
+ 'filter': [
+ 'all',
+ ['==', '$type', 'Polygon'],
+ ],
+ 'paint': {
+ 'fill-color':'#3bb2d0',
+ 'fill-outline-color':'#3bb2d0',
+ 'fill-opacity':0.1,
+ },
+ });
+ map.addLayer({
'source': id,
- 'layout': {},
+ 'id': 'geofences-line',
+ 'type': 'line',
'paint': {
- 'fill-color': '#088',
- 'fill-opacity': 0.8
- }
+ 'line-color': '#3bb2d0',
+ 'line-width': 2,
+ },
+ });
+ map.addLayer({
+ 'source': id,
+ 'id': 'geofences-title',
+ 'type': 'symbol',
+ 'layout': {
+ 'text-field': '{name}',
+ 'text-font': ['Roboto Regular'],
+ 'text-size': 12,
+ },
+ 'paint': {
+ 'text-halo-color': 'white',
+ 'text-halo-width': 1,
+ },
});
return () => {
- map.removeLayer(id);
+ map.removeLayer('geofences-fill');
+ map.removeLayer('geofences-line');
+ map.removeLayer('geofences-title');
map.removeSource(id);
};
}, []);