|
1 class EmptyLine: |
|
2 def __repr__(self): |
|
3 return 'linetypes.EmptyLine()' |
|
4 |
|
5 class Comment: |
|
6 def __init__(self, text, style = 'old'): |
|
7 if style == 'old' and text.startswith('//'): |
|
8 self.text = text[3:].strip() |
|
9 self.style = 'new' |
|
10 else: |
|
11 self.text = text |
|
12 self.style = style |
|
13 def __repr__(self): |
|
14 return str.format('linetypes.Comment({text!r}, {style!r})', |
|
15 text = self.text, |
|
16 style = self.style, |
|
17 ) |
|
18 |
|
19 class SubfileReference: |
|
20 def __init__(self, *, color, subfile_path, anchor, matrix): |
|
21 self.color, self.subfile_path, = color, subfile_path |
|
22 self.anchor, self.matrix = anchor, matrix |
|
23 def __repr__(self): |
|
24 return str.format('linetypes.SubfileReference(' \ |
|
25 'color = {color!r}, ' \ |
|
26 'subfile_path = {subfile_path!r}, ' \ |
|
27 'anchor = {anchor!r}, ' \ |
|
28 'matrix = {matrix!r})', **self.__dict__) |
|
29 |
|
30 class LineSegment: |
|
31 def __init__(self, *, color, geometry): |
|
32 self.color, self.geometry = color, geometry |
|
33 def __repr__(self): |
|
34 return str.format('linetypes.{typename}(' \ |
|
35 'color = {color!r}, ' \ |
|
36 'geometry = {geometry!r})', |
|
37 typename = type(self).__name__, |
|
38 color = self.color, |
|
39 geometry = self.geometry, |
|
40 ) |
|
41 |
|
42 class Triangle(LineSegment): |
|
43 pass |
|
44 |
|
45 class Quadrilateral(LineSegment): |
|
46 pass |