Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 0d90d67b

Přidáno uživatelem Václav Honzík před asi 2 roky(ů)

map dialogs + catalog filter fix

re #9547 #9545

Zobrazit rozdíly:

frontend/src/features/TrackingTool/TrackingTool.tsx
4 4
import { MapContainer, Marker, Polyline, Popup, TileLayer } from 'react-leaflet'
5 5
import mapConfig from '../../config/mapConfig'
6 6
import TextPath from 'react-leaflet-textpath'
7
import PlaintextUpload from './PlaintextUpload'
8
import FileUpload from './FileUpload'
7 9

  
8 10
// Page with tracking tool
9 11
const TrackingTool = () => {
10
    const generateDummyPath = () => {
12
    const createDummyPathCoords = () => {
11 13
        // Sample dummy path to display
12 14
        const dummyPath = []
13 15
        for (let i = 0; i < 10; i += 1) {
......
25 27
        return dummyPath
26 28
    }
27 29

  
28
    const createDummyPathPolylines = () => {
29
        const dummyPath = generateDummyPath()
30
    const createDummyPath = () => {
31
        const coords = createDummyPathCoords()
30 32
        const polylines: any[] = []
31 33

  
32
        if (dummyPath.length < 2) {
34
        if (coords.length < 2) {
33 35
            return []
34 36
        }
35 37

  
36
        for (let i = 0; i < dummyPath.length - 1; i += 1) {
38
        for (let i = 0; i < coords.length - 1; i += 1) {
37 39
            polylines.push(
38 40
                // <Polyline
39 41
                //     key={i}
......
51 53
                //     </Polyline>
52 54
                <TextPath
53 55
                    positions={[
54
                        [dummyPath[i].latitude, dummyPath[i].longitude],
55
                        [dummyPath[i + 1].latitude, dummyPath[i + 1].longitude],
56
                        [coords[i].latitude, coords[i].longitude],
57
                        [coords[i + 1].latitude, coords[i + 1].longitude],
56 58
                    ]}
57 59
                    text="►"
58 60
                    attributes={{
59 61
                        'font-size': 25,
60
                        'fill': 'blue'
62
                        fill: 'blue',
61 63
                    }}
62 64
                    repeat
63 65
                    center
......
68 70
            )
69 71
        }
70 72

  
71
        return polylines
73
        return [polylines, coords]
72 74
    }
73 75

  
74
    const polylines = createDummyPathPolylines()
76
    const [polylines, coords] = createDummyPath()
75 77

  
76 78
    return (
77 79
        <Fragment>
......
94 96
                        >
95 97
                            Upload:
96 98
                        </Typography>
97
                        <Button
98
                            variant="contained"
99
                            color="primary"
100
                            startIcon={<AddIcon />}
101
                        >
102
                            Plaintext
103
                        </Button>
104
                        <Button
105
                            variant="contained"
106
                            color="primary"
107
                            startIcon={<AddIcon />}
108
                        >
109
                            File
110
                        </Button>
99
                        <PlaintextUpload />
100
                        <FileUpload />
111 101
                    </Stack>
112 102
                </Grid>
113 103
                <Grid
......
132 122
                            attribution={mapConfig.attribution}
133 123
                            url={mapConfig.url}
134 124
                        />
125
                        {coords.map(({ latitude, longitude }, idx) => (
126
                            <Marker position={[latitude, longitude]} />
127
                        ))}
135 128
                        {polylines}
136 129
                    </MapContainer>
137 130
                </Grid>

Také k dispozici: Unified diff