コード例 #1
0
    def drawAnno( self, a ):
        if len(a.connectMap) > 0:
            node_map = {}
            for from_node in a.connectMap.keys():
                if from_node not in node_map:
                   node_map[from_node] = len(node_map)
                for connect_tuple in a.connectMap[from_node]:
                    edge,to_node = connect_tuple
                    if to_node not in node_map:
                       node_map[to_node] = len(node_map)

                    if from_node is not None:
                       SketchGUI.drawLine( edge.tail.X, edge.tail.Y, from_node.center.X, from_node.center.Y, width=2, color="#FA8072")
                    if to_node is not None:
                       SketchGUI.drawLine( edge.tip.X, edge.tip.Y, to_node.center.X, to_node.center.Y, width=2, color="#FA8072")

                    SketchGUI.drawCircle( edge.tail.X, edge.tail.Y, radius=2, width=2, color="#ccffcc")
                    SketchGUI.drawCircle( edge.tip.X, edge.tip.Y, radius=2, width=2, color="#ccffcc")

                    #x1,y1 = from_node.center.X, from_node.center.Y
                    #x2,y2 = edge.tail.X, edge.tail.Y
                    #SketchGUI.drawLine( x1,y1,x2,y2, width=2,color="#ccffcc")
                    #x1,y1 = to_node.center.X, to_node.center.Y
                    #x2,y2 = edge.tip.X, edge.tip.Y
                    #SketchGUI.drawLine( x1,y1,x2,y2, width=2,color="#ccffcc")

            for nodeAnno, nodeNum in node_map.items():
                if nodeAnno is not None:
                    x1,y1 = nodeAnno.center.X, nodeAnno.center.Y
                    SketchGUI.drawText(x1, y1, str(nodeNum))
コード例 #2
0
ファイル: TextObserver.py プロジェクト: ASayre/UCSBsketch
 def drawAnno( self, a ):
     if len(a.text) >= 1:
         ul,br = GeomUtils.strokelistBoundingBox( a.Strokes )
         logger.debug(a.Strokes)
         height = ul.Y - br.Y
         left_x = ul.X# - height/3
         right_x = br.X + height/2
         midpoint = (ul.Y + br.Y) / 2
         SketchGUI.drawLine( left_x, midpoint, right_x, midpoint, color="#a0a0a0")
         y = br.Y + 5
         for idx, text in enumerate(a.alternates):
             SketchGUI.drawText( br.X, y, text, size=20, color="#a0a0a0" )
             y -= 20
コード例 #3
0
 def drawAnno(self, anno):
     #pdb.set_trace()
     if self.trackedAnno == None:
         self.trackedAnno = anno
     for stk in anno.Strokes:
         prevPt = None
         for i, point in enumerate(GeomUtils.strokeNormalizeSpacing(stk, numpoints = len(stk.Points)).Points):
             if prevPt != None:
                 color = self.colors[anno.pattern[ (i + anno.idx) % len(anno.pattern) ] ]
                 SketchGUI.drawLine(prevPt.X, prevPt.Y, point.X, point.Y, color=color, width = 3)
             prevPt = point
     if anno == self.trackedAnno:
         dt = time.time() - self.lastDraw
         self.lastDraw = time.time()
         logger.debug("Effective FPS = %s" % (1 / float(dt)))
コード例 #4
0
ファイル: LineObserver.py プロジェクト: ASayre/UCSBsketch
    def drawMyself( self ):
	for a in self.annotation_list:
            SketchGUI.drawLine( a.start_point.X, a.start_point.Y, a.end_point.X, a.end_point.Y,  color="#ddaaff", width=2.0)
コード例 #5
0
 def drawAnno(self, a):
     prev = None
     for cPt in a.corners + [a.corners[0]]:
         if prev != None:
             SketchGUI.drawLine( prev.X, prev.Y, cPt.X, cPt.Y, width=4,color="#ccffcc")
         prev = cPt