예제 #1
0
파일: canvas.py 프로젝트: donsheehy/dsviz
 def rectangle(self, topleft, width, height, style = '_polygon'):
     for s in self.styles[style]:
         a = Vector(topleft)
         b = a + Vector(width, 0)
         c = a + Vector(width, height)
         d = a + Vector(0, height)
         self._primitives.append(DP_Polygon([a,b,c,d], s))
예제 #2
0
파일: element.py 프로젝트: donsheehy/dsviz
 def __init__(self, a, b, style='_path', stylesheet=default_styles):
     super().__init__(style, stylesheet)
     start = Vector(a)
     end = Vector(b)
     self._box = Box(min(start.y, end.y), max(start.x, end.x),
                     max(start.y, end.y), min(start.x, end.x))
     self.setanchor('start', start)
     self.setanchor('end', end)
예제 #3
0
파일: element.py 프로젝트: donsheehy/dsviz
 def draw(self, canvas):
     right = Vector(60, 0)
     pos = self.globalposition()
     a = pos + self._a('start')
     b = pos + self._a('end')
     u = a + right
     v = b - right
     canvas.bezier([a, u, v, b])
예제 #4
0
파일: element.py 프로젝트: donsheehy/dsviz
 def __init__(self, style='', stylesheet=default_styles, xy=(0, 0)):
     self._position = Vector(xy)
     self._box = Box(0, 0, 0, 0)
     self.anchor = defaultdict(Vector)
     self.tags = set()
     self.stylesheet = stylesheet
     self.style = style
     self.parent = None
     self.padding = float(next(stylesheet[style])['padding'])
     self.margin = float(next(stylesheet[style])['margin'])
예제 #5
0
파일: element.py 프로젝트: donsheehy/dsviz
 def _align(self, anchor, point):
     return Vector(point) - self._a(anchor)
예제 #6
0
파일: element.py 프로젝트: donsheehy/dsviz
 def setanchor(self, label, v):
     self.anchor[label] = Vector(v)
예제 #7
0
파일: element.py 프로젝트: donsheehy/dsviz
 def __init__(self, elements, style='', stylesheet=default_styles):
     super().__init__(elements, style, stylesheet)
     for e in self.elements:
         e.setwidth(self.width)
     self.alignelements('top', 'bottom', Vector(0, 1))
예제 #8
0
파일: element.py 프로젝트: donsheehy/dsviz
 def __init__(self, elements, style='', stylesheet=default_styles):
     super().__init__(elements, style, stylesheet)
     for e in self.elements:
         e.setheight(self.height)
     self.alignelements('left', 'right', Vector(1, 0))
예제 #9
0
파일: element.py 프로젝트: donsheehy/dsviz
 def alignelements(self, anchor1, anchor2, gapvector=Vector(0, 0)):
     for i in range(1, len(self.elements)):
         e0 = self.elements[i - 1]
         e1 = self.elements[i]
         gap = gapvector * max(e0.padding, e1.padding)
         e1.align(anchor1, e0.a(anchor2) + gap)
예제 #10
0
파일: element.py 프로젝트: donsheehy/dsviz
 def position(self, x, y=None):
     self._position = Vector(x, y)