| 24 | 'body':{1:points, 2:line, 3:layer}} |
| 25 | |
| 26 | def plot(pts, dc, f, **key): |
| 27 | pen, brush = dc.GetPen(), dc.GetBrush() |
| 28 | width, color = pen.GetWidth(), pen.GetColour() |
| 29 | fcolor, style = brush.GetColour(), brush.GetStyle() |
| 30 | |
| 31 | if 'color' in pts: |
| 32 | pen.SetColour(pts['color']) |
| 33 | if 'fcolor' in pts: |
| 34 | brush.SetColour(pts['fcolor']) |
| 35 | if 'lw' in pts: |
| 36 | pen.SetWidth(pts['lw']) |
| 37 | if 'fill' in pts: |
| 38 | brush.SetStyle((106,100)[pts['fill']]) |
| 39 | |
| 40 | dc.SetPen(pen) |
| 41 | dc.SetBrush(brush) |
| 42 | |
| 43 | if pts['type'] == 'point': |
| 44 | pen.SetWidth(1) |
| 45 | brush.SetStyle(100) |
| 46 | brush.SetColour(pen.GetColour()) |
| 47 | dc.SetPen(pen) |
| 48 | dc.SetBrush(brush) |
| 49 | r = pts['r'] if 'r' in pts else 2 |
| 50 | x, y = f(*pts['body']) |
| 51 | dc.DrawEllipse (x-r,y-r,r*2,r*2) |
| 52 | pen.SetWidth(pts['lw'] if 'lw' in pts else width) |
| 53 | brush.SetStyle((106,100)[pts['fill']] if 'fill' in pts else style) |
| 54 | brush.SetColour(pts['fc'] if 'fc' in pts else fcolor) |
| 55 | dc.SetPen(pen) |
| 56 | dc.SetBrush(brush) |
| 57 | elif pts['type'] in {'points','line','polygon'}: |
| 58 | lst, plst = [], [] |
| 59 | r = pts['r'] if 'r' in pts else 2 |
| 60 | for p in pts['body']: |
| 61 | x, y = f(*p) |
| 62 | lst.append((x-r,y-r,r*2,r*2)) |
| 63 | plst.append((x,y)) |
| 64 | isline = 'style' in pts and '-' in pts['style'] |
| 65 | ispoint = 'style' in pts and 'o' in pts['style'] |
| 66 | if pts['type'] == 'polygon': |
| 67 | dc.DrawPolygon(plst) |
| 68 | |
| 69 | if isline or pts['type'] == 'line': |
| 70 | dc.DrawLines(plst) |
| 71 | |
| 72 | if pts['type']=='points' or ispoint: |
| 73 | pen.SetWidth(1) |
| 74 | brush.SetStyle(100) |
| 75 | brush.SetColour(pen.GetColour()) |
| 76 | dc.SetPen(pen) |
| 77 | dc.SetBrush(brush) |
| 78 | dc.DrawEllipseList(lst) |
| 79 | pen.SetWidth(pts['lw'] if 'lw' in pts else width) |
| 80 | brush.SetStyle((106,100)[pts['fill']] if 'fill' in pts else style) |
| 81 | brush.SetColour(pts['fc'] if 'fc' in pts else fcolor) |
| 82 | dc.SetPen(pen) |
| 83 | dc.SetBrush(brush) |