-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap2.ego.go
165 lines (158 loc) · 5.54 KB
/
map2.ego.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// Generated by ego.
// DO NOT EDIT
//line map2.ego:1
package main
import "fmt"
import "html"
import "io"
import "context"
import "github.com/tkrajina/gpxgo/gpx"
import "time"
func (m *Map) renderLines(w io.Writer, t *Track) {
//line map2.ego:9
_, _ = io.WriteString(w, "\n<svg width=\"")
//line map2.ego:9
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(m.w)))
//line map2.ego:9
_, _ = io.WriteString(w, "\" height=\"")
//line map2.ego:9
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(m.h)))
//line map2.ego:9
_, _ = io.WriteString(w, "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n <style type=\"text/css\" >\n <![CDATA[\n .segment { fill: none; stroke-width: 4 }\n .segment:hover { stroke-width: 8 }\n ]]>\n </style>\n <g id=\"legend\">\n ")
//line map2.ego:17
for i := range palette {
//line map2.ego:18
_, _ = io.WriteString(w, "\n <rect x=\"")
//line map2.ego:18
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(30*i)))
//line map2.ego:18
_, _ = io.WriteString(w, "\" y=\"0\" width=\"30\" height=\"20\" fill=\"")
//line map2.ego:18
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(fmt.Sprintf("#%03x", palette[i]))))
//line map2.ego:18
_, _ = io.WriteString(w, "\"/>\n <rect x=\"")
//line map2.ego:19
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(30*i)))
//line map2.ego:19
_, _ = io.WriteString(w, "\" y=\"")
//line map2.ego:19
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(m.h-20)))
//line map2.ego:19
_, _ = io.WriteString(w, "\" width=\"30\" height=\"20\" fill=\"")
//line map2.ego:19
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(fmt.Sprintf("#%03x", palette[i]))))
//line map2.ego:19
_, _ = io.WriteString(w, "\"/>\n ")
//line map2.ego:20
}
//line map2.ego:21
_, _ = io.WriteString(w, "\n ")
//line map2.ego:21
for i := 0; i < len(palette); i += 5 {
//line map2.ego:22
_, _ = io.WriteString(w, "\n <text x=\"")
//line map2.ego:22
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(30*i+5)))
//line map2.ego:22
_, _ = io.WriteString(w, "\" y=\"16\" fill=\"white\">")
//line map2.ego:22
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(fmt.Sprint(i))))
//line map2.ego:22
_, _ = io.WriteString(w, "kts</text>\n <text x=\"")
//line map2.ego:23
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(30*i+5)))
//line map2.ego:23
_, _ = io.WriteString(w, "\" y=\"")
//line map2.ego:23
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(m.h-4)))
//line map2.ego:23
_, _ = io.WriteString(w, "\" fill=\"white\">")
//line map2.ego:23
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(fmt.Sprint(i))))
//line map2.ego:23
_, _ = io.WriteString(w, "kts</text>\n ")
//line map2.ego:24
}
//line map2.ego:25
_, _ = io.WriteString(w, "\n </g>\n ")
//line map2.ego:26
totalDistance := float64(0)
//line map2.ego:27
_, _ = io.WriteString(w, "\n ")
//line map2.ego:27
for i := range t.gpx.Segments {
//line map2.ego:28
_, _ = io.WriteString(w, "\n <g class=\"segment\">\n ")
//line map2.ego:29
t.Segment(i).EachPair(func(prev, next *gpx.GPXPoint) {
//line map2.ego:30
_, _ = io.WriteString(w, "\n ")
//line map2.ego:30
x1, y1 := m.Point(prev)
x2, y2 := m.Point(next)
c := m.SpeedColor(prev, next)
//line map2.ego:31
_, _ = io.WriteString(w, "\n ")
//line map2.ego:31
totalDistance += m.Distance(prev, next, nm)
//line map2.ego:32
_, _ = io.WriteString(w, "\n ")
//line map2.ego:32
heading := m.Heading(prev, next)
direction := direction(heading)
//line map2.ego:33
_, _ = io.WriteString(w, "\n <line class=\"step\" x1=\"")
//line map2.ego:33
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(x1)))
//line map2.ego:33
_, _ = io.WriteString(w, "\" y1=\"")
//line map2.ego:33
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(y1)))
//line map2.ego:33
_, _ = io.WriteString(w, "\" x2=\"")
//line map2.ego:33
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(x2)))
//line map2.ego:33
_, _ = io.WriteString(w, "\" y2=\"")
//line map2.ego:33
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(y2)))
//line map2.ego:33
_, _ = io.WriteString(w, "\" stroke=\"")
//line map2.ego:33
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(c)))
//line map2.ego:33
_, _ = io.WriteString(w, "\">\n <title> ")
//line map2.ego:34
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(next.Timestamp.In(t.Timezone()).Format(time.TimeOnly))))
//line map2.ego:34
_, _ = io.WriteString(w, ": ")
//line map2.ego:34
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(fmt.Sprintf("%0.1f m", m.Distance(prev, next, meter)))))
//line map2.ego:34
_, _ = io.WriteString(w, " @ ")
//line map2.ego:34
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(fmt.Sprintf("%0.1f kts", m.Speed(prev, next, nm)))))
//line map2.ego:34
_, _ = io.WriteString(w, " ↑ ")
//line map2.ego:34
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(fmt.Sprintf("%d\u00b0 %s", heading, direction))))
//line map2.ego:34
_, _ = io.WriteString(w, " = ")
//line map2.ego:34
_, _ = io.WriteString(w, html.EscapeString(fmt.Sprint(fmt.Sprintf("%0.2f nm", totalDistance))))
//line map2.ego:34
_, _ = io.WriteString(w, "</title>\n </line>\n\t ")
//line map2.ego:36
})
//line map2.ego:37
_, _ = io.WriteString(w, "\n </g>\n\t")
//line map2.ego:38
}
//line map2.ego:39
_, _ = io.WriteString(w, "\n</svg>\n")
//line map2.ego:40
}
var _ fmt.Stringer
var _ io.Reader
var _ context.Context
var _ = html.EscapeString