diff --git a/package-lock.json b/package-lock.json index cd3c97e..d6937e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10242,11 +10242,6 @@ "rbush": "^3.0.1" } }, - "ol-layerswitcher": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/ol-layerswitcher/-/ol-layerswitcher-3.8.3.tgz", - "integrity": "sha512-UwUhalf/sGXjz3rvr0EjwsaUVlJAhyJCfcIPciKk1QdNbMKq/2ZXNKGafOjwP2eDxiqhkvnhpIrDGD8+gQ19Cg==" - }, "ol-mapbox-style": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/ol-mapbox-style/-/ol-mapbox-style-6.3.1.tgz", diff --git a/package.json b/package.json index 38ce949..33cbf33 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "luxon": "^1.25.0", "node-sass": "^4.14.1", "ol": "^6.5.0", - "ol-layerswitcher": "^3.8.3", "proj4": "^2.7.0", "react": "^17.0.1", "react-dom": "^17.0.1", diff --git a/src/components/Map/index.js b/src/components/Map/index.js index 60df454..d703064 100644 --- a/src/components/Map/index.js +++ b/src/components/Map/index.js @@ -9,11 +9,8 @@ import OSM from 'ol/source/OSM' import proj4 from 'proj4' import {register} from 'ol/proj/proj4' -import OlLayerSwitcher from 'ol-layerswitcher' - // Import styles for open layers + addons import 'ol/ol.css' -import 'ol-layerswitcher/dist/ol-layerswitcher.css' // Prepare projection proj4.defs( @@ -126,22 +123,8 @@ function View({...options}) { return null } -function LayerSwitcher({...options}) { - const map = React.useContext(MapContext) - - const control = React.useMemo(() => new OlLayerSwitcher(options), []) - - React.useEffect(() => { - map?.addControl(control) - return () => map?.removeControl(control) - }, [control, map]) - - return null -} - Map.FitView = FitView Map.GroupLayer = GroupLayer -Map.LayerSwitcher = LayerSwitcher Map.TileLayer = TileLayer Map.VectorLayer = VectorLayer Map.View = View diff --git a/src/pages/TrackPage/TrackMap.tsx b/src/pages/TrackPage/TrackMap.tsx index ca6fcbc..4978b7c 100644 --- a/src/pages/TrackPage/TrackMap.tsx +++ b/src/pages/TrackPage/TrackMap.tsx @@ -85,7 +85,7 @@ function PointLayer({features, title, visible}) { return } -export default function TrackMap({trackData, ...props}: {trackData: TrackData}) { +export default function TrackMap({trackData, show, ...props}: {trackData: TrackData}) { const { trackVectorSource, trackPointsD1, @@ -157,19 +157,18 @@ export default function TrackMap({trackData, ...props}: {trackData: TrackData}) style={trackLayerStyle} /> - - - + + + - - - + + + - ) } diff --git a/src/pages/TrackPage/index.tsx b/src/pages/TrackPage/index.tsx index 2f4eccf..645ef4f 100644 --- a/src/pages/TrackPage/index.tsx +++ b/src/pages/TrackPage/index.tsx @@ -1,6 +1,6 @@ import React from 'react' import {connect} from 'react-redux' -import {Segment, Dimmer, Grid, Loader, Header} from 'semantic-ui-react' +import {Table, Checkbox, Segment, Dimmer, Grid, Loader, Header} from 'semantic-ui-react' import {useParams} from 'react-router-dom' import {concat, combineLatest, of, from, Subject} from 'rxjs' import {pluck, distinctUntilChanged, map, switchMap, startWith, sample} from 'rxjs/operators' @@ -81,6 +81,11 @@ const TrackPage = connect((state) => ({login: state.login}))(function TrackPage( const loading = track == null || trackData == null + const [left, setLeft] = React.useState(true) + const [right, setRight] = React.useState(false) + const [leftUnconfirmed, setLeftUnconfirmed] = React.useState(false) + const [rightUnconfirmed, setRightUnconfirmed] = React.useState(false) + return ( @@ -89,7 +94,10 @@ const TrackPage = connect((state) => ({login: state.login}))(function TrackPage(
- +
@@ -103,6 +111,39 @@ const TrackPage = connect((state) => ({login: state.login}))(function TrackPage( )} + +
Show in Map
+ + + + + Left + Points + Right + + + + + + + setLeft(d.checked)} />{' '} + + Confirmed + + setRight(d.checked)} />{' '} + + + + + setLeftUnconfirmed(d.checked)} />{' '} + + Other + + setRightUnconfirmed(d.checked)} />{' '} + + + +