diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/subway_map.cpp | 71 |
1 files changed, 39 insertions, 32 deletions
diff --git a/src/subway_map.cpp b/src/subway_map.cpp index 460532c..6070fd5 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp | |||
@@ -135,47 +135,54 @@ void SubwayMap::OnPaint(wxPaintEvent &event) { | |||
135 | int halfwidth = right - left; | 135 | int halfwidth = right - left; |
136 | int halfheight = bottom - top; | 136 | int halfheight = bottom - top; |
137 | 137 | ||
138 | int ellipse_x; | 138 | if (halfwidth < 4 || halfheight < 4) { |
139 | int ellipse_y; | 139 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 4)); |
140 | double start; | 140 | dc.DrawLine(item1_x, item1_y, item2_x, item2_y); |
141 | double end; | 141 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxCYAN, 2)); |
142 | dc.DrawLine(item1_x, item1_y, item2_x, item2_y); | ||
143 | } else { | ||
144 | int ellipse_x; | ||
145 | int ellipse_y; | ||
146 | double start; | ||
147 | double end; | ||
142 | 148 | ||
143 | if (item1_x > item2_x) { | 149 | if (item1_x > item2_x) { |
144 | ellipse_y = top; | 150 | ellipse_y = top; |
145 | 151 | ||
146 | if (item1_y > item2_y) { | 152 | if (item1_y > item2_y) { |
147 | ellipse_x = left - halfwidth; | 153 | ellipse_x = left - halfwidth; |
148 | 154 | ||
149 | start = 0; | 155 | start = 0; |
150 | end = 90; | 156 | end = 90; |
151 | } else { | 157 | } else { |
152 | ellipse_x = left; | 158 | ellipse_x = left; |
153 | 159 | ||
154 | start = 90; | 160 | start = 90; |
155 | end = 180; | 161 | end = 180; |
156 | } | 162 | } |
157 | } else { | 163 | } else { |
158 | ellipse_y = top - halfheight; | 164 | ellipse_y = top - halfheight; |
159 | 165 | ||
160 | if (item1_y > item2_y) { | 166 | if (item1_y > item2_y) { |
161 | ellipse_x = left - halfwidth; | 167 | ellipse_x = left - halfwidth; |
162 | 168 | ||
163 | start = 270; | 169 | start = 270; |
164 | end = 360; | 170 | end = 360; |
165 | } else { | 171 | } else { |
166 | ellipse_x = left; | 172 | ellipse_x = left; |
167 | 173 | ||
168 | start = 180; | 174 | start = 180; |
169 | end = 270; | 175 | end = 270; |
176 | } | ||
170 | } | 177 | } |
171 | } | ||
172 | 178 | ||
173 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 4)); | 179 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxBLACK, 4)); |
174 | dc.DrawEllipticArc(ellipse_x, ellipse_y, halfwidth * 2, halfheight * 2, | 180 | dc.DrawEllipticArc(ellipse_x, ellipse_y, halfwidth * 2, halfheight * 2, |
175 | start, end); | 181 | start, end); |
176 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxCYAN, 2)); | 182 | dc.SetPen(*wxThePenList->FindOrCreatePen(*wxCYAN, 2)); |
177 | dc.DrawEllipticArc(ellipse_x, ellipse_y, halfwidth * 2, halfheight * 2, | 183 | dc.DrawEllipticArc(ellipse_x, ellipse_y, halfwidth * 2, halfheight * 2, |
178 | start, end); | 184 | start, end); |
185 | } | ||
179 | } | 186 | } |
180 | } | 187 | } |
181 | 188 | ||