48 |
interval, unit = deriveInterval(width, scale) |
interval, unit = deriveInterval(width, scale) |
49 |
interval, label = roundInterval(interval) |
interval, label = roundInterval(interval) |
50 |
|
|
51 |
# We draw 2 rectangles with half the width |
if interval > 0.0: |
52 |
if unit == 'km': |
# We draw 2 rectangles with half the width |
53 |
width = int(interval*1000.0*scale/2) |
if unit == 'km': |
54 |
else: |
width = int(interval*1000.0*scale/2) |
55 |
width = int(interval*scale/2) |
else: |
56 |
|
width = int(interval*scale/2) |
57 |
|
|
58 |
dc.SetPen(BlackPen) |
dc.SetPen(BlackPen) |
59 |
|
|
60 |
brush = wxBrush(wxWHITE, wxSOLID) |
brush = wxBrush(wxWHITE, wxSOLID) |
61 |
dc.SetBrush(brush) |
dc.SetBrush(brush) |
62 |
dc.DrawRectangle(4,2,width,8) |
dc.DrawRectangle(4,2,width,8) |
63 |
|
|
64 |
dc.SetBrush(BlackBrush) |
dc.SetBrush(BlackBrush) |
65 |
dc.DrawRectangle(width+4,2,width,8) |
dc.DrawRectangle(width+4,2,width,8) |
66 |
|
|
67 |
dc.SetTextForeground(BlackText) |
dc.SetTextForeground(BlackText) |
68 |
dc.DrawText("%d"%0, 4 - l1width/2, 12) |
dc.DrawText("%d"%0, 4 - l1width/2, 12) |
69 |
|
|
70 |
l2width, l2height = dc.GetTextExtent("%s %s"%(label, unit)) |
l2width, l2height = dc.GetTextExtent("%s %s"%(label, unit)) |
71 |
dc.DrawText("%s %s"%(interval, unit), 2*width+4 - l2width/2, 12) |
dc.DrawText("%s %s"%(interval, unit), 2*width+4 - l2width/2, 12) |
72 |
|
|