当前位置: 首页>>代码示例>>Python>>正文


Python Annotation.Annotation类代码示例

本文整理汇总了Python中SketchFramework.Annotation.Annotation的典型用法代码示例。如果您正苦于以下问题:Python Annotation类的具体用法?Python Annotation怎么用?Python Annotation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Annotation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, rightwalls = [], leftwalls = []):
        Annotation.__init__(self)
        self.rightwalls = rightwalls # A list of strokes making up the right walls of the track
        self.leftwalls = leftwalls #A list of strokes making up the left walls

        self.centerline = None #Stroke for the centerline
        self.rebuildCenterline()
开发者ID:loserpenguin15,项目名称:UCSBsketch,代码行数:7,代码来源:RaceTrackObserver.py

示例2: __init__

    def __init__(self, state_graph_anno = None, edge_labels = set([])):
        Annotation.__init__(self)
        tm_logger.debug("Creating new turing machine")


        #Which state we are currently in
        self.active_state = None
        #Where on the tape we are currently residing
        self.tape_idx = -1
        #What is currently on the tape
        self.tape_string = []
        #What edge brought us here
        self.leading_edge = {'edge': None, 'label' : None} #edge ArrowAnno, label TextAnno

        self.tape_text_anno = None
        self.tape_box = None

        #A dictionary mapping edges to their labels. 
        self.edge2labels_map = {}
        self.labels2edge_map = {}
        for l in edge_labels:
            self.assocLabel2Edge(l, None)

        #A DiGraphAnnotation that keeps track of all of the edges and nodes and their connections
        self.state_graph_anno = None
        self.setDiGraphAnno(state_graph_anno)
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:26,代码来源:TuringMachineObserver.py

示例3: __init__

 def __init__(self, tip, tail, headstroke = None, tailstroke = None, direction = 'tail2head', linearity=0):
     Annotation.__init__(self)
     self.tip = tip  # Point
     self.tail = tail  # Point
     self.linearity = linearity
     self.headstroke = headstroke
     self.tailstroke = tailstroke
     self.direction = direction # 'tail2head' vs. 'head2tail' for the direction the tail stroke was drawn in
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:8,代码来源:ArrowObserver.py

示例4: __init__

 def __init__(self, scale):
     "Create a Text annotation. text is the string, and scale is an appropriate size"
     Annotation.__init__(self)
     self.scale = scale # an approximate "size" for the text
     self.number = None
     self.parent = None
     self.left = None
     self.right = None
     self.op = None
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:9,代码来源:ExpressionObserver.py

示例5: __init__

 def __init__(self, scores):
     "Create a Rubin annotation."
     Annotation.__init__(self)
     #self.type = type # Deprecated
     #self.accuracy = accuracy Deprecated
     #self.scale = scale # Deprecated
     self.scores = scores
     self.name = ""
     if len(self.scores) > 0:
         self.name = scores[0]['symbol']
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:10,代码来源:RubineObserver.py

示例6: __init__

 def __init__(self, text, alternates, stroke_letter_map, scale):
     """Create a Text annotation. text is the string, stroke_letter_map bins 
     strokes according to the letter they're associated with, 
     e.g. "Hi" : [ [<strokes for 'H'>], [<strokes for 'i'>] ]. 
     scale is an appropriate size
     alternates is a tuple (indexed by letter) of a list of that letter's alternates"""
     Annotation.__init__(self)
     self.text = text # a string for the text
     assert len(stroke_letter_map) == len(text)
     self.letter2strokesMap = stroke_letter_map
     assert scale > 0.0
     self.scale = scale # an approximate "size" for the text
     self.alternates = alternates #([],) * len(text) # a tuple (indexed per letter) of lists of alternate letters
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:13,代码来源:TextObserver.py

示例7: xml

 def xml(self):
     root = Annotation.xml(self)
     root.attrib['name'] = self.name
     #root.attrib["type"] = self.type
     #root.attrib['scale'] = str(self.scale)
     #root.attrib['accuracy'] = str(self.accuracy)
     return root
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:7,代码来源:RubineObserver.py

示例8: xml

    def xml(self):
        root = Annotation.xml(self)

        for node_anno in self.node_set:
            nodeEl = ET.SubElement(root, "node")
            nodeEl.attrib['id'] = str(node_anno.ident)

        for edge_anno in self.edge_set:
            edgeEl = ET.SubElement(root, "edge")
            edgeEl.attrib['id'] = str(edge_anno.ident)

        for from_node, connList in self.connectMap.items():
            for connEdge, to_node in connList:
                connEl = ET.SubElement(root, "conn")
                fid = tid = eid = -1
                if from_node is not None:
                    fid = from_node.ident
                if to_node is not None:
                    tid = to_node.ident
                if connEdge is not None:
                    eid = connEdge.ident

                connEl.attrib['from'] = str(fid)
                connEl.attrib['to'] = str(tid)
                connEl.attrib['e'] = str(eid)

        return root
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:27,代码来源:DiGraphObserver.py

示例9: xml

    def xml( self ):
        "Returns an element tree object for the XML serialization of this annotation"
        root = Annotation.xml(self)

        root.attrib['circularity'] = str(self.circularity)
        root.attrib['x'] = str(self.center.X)
        root.attrib['y'] = str(self.center.Y)
        root.attrib['radius'] = str(self.radius)

        return root
开发者ID:loserpenguin15,项目名称:UCSBsketch,代码行数:10,代码来源:CircleObserver.py

示例10: xml

 def xml(self):
     root = Annotation.xml(self)
     root.attrib["text"] = self.text
     root.attrib['scale'] = str(self.scale)
     for i, a in enumerate(self.alternates):
         textEl = ET.SubElement(root, "alt")
         textEl.attrib['priority'] = str(i)
         textEl.attrib['text'] = str(a)
         root.append(textEl)
     return root
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:10,代码来源:BinObserver.py

示例11: __init__

    def __init__(self, node_set=None, edge_set=None):
        Annotation.__init__(self)
        # DiGraph annotations maintain 3 things:
        # 1) a list of the nodes (which points to the circle_annos)
        # 2) a list of the edges (which points to the arrow_annos)
        # 3) a connectivity map (which is of the form { node_anno: [ (edge_anno, node_anno), (edge_anno, node_anno) ]}

        # set of circle annotations for nodes
        if node_set is None:
            self.node_set = set([])
        else:
            self.node_set = node_set

        # set of arrow annotations for edges
        if edge_set is None:
            self.edge_set = set([])
        else:
            self.edge_set = edge_set

        # set the map of connections
        self.connectMap = {}
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:21,代码来源:DiGraphObserver.py

示例12: xml

    def xml( self ):
        "Returns an element tree object for the XML serialization of this annotation"
        root = Annotation.xml(self)

        root.attrib['headstroke'] = str(self.headstroke.ident)
        root.attrib['tailstroke'] = str(self.tailstroke.ident)
        root.attrib['direction'] = str(self.direction)

        tail  = ET.SubElement(root, "tail")
        tail.attrib['x'] = str(self.tail.X)
        tail.attrib['y'] = str(self.tail.Y)

        tip  = ET.SubElement(root, "tip")
        tip.attrib['x'] = str(self.tip.X)
        tip.attrib['y'] = str(self.tip.Y)


        return root
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:18,代码来源:ArrowObserver.py

示例13: xml

    def xml(self):
        root = Annotation.xml(self)

        mapEl = ET.SubElement(root, "edge_label_map")
            
        for e, labelset in self.edge2labels_map.items():
            #edgeEl = e.xml()
            #edgeEl.tag = "edge"
            #root.append(edgeEl)
            edgeEl = ET.SubElement(root, "edge")
            edgeEl.attrib['id'] = str(e.ident)

            for  l in labelset:
                e_label = ET.SubElement(mapEl, "m")
                e_label.attrib['e'] = str(e.ident)
                e_label.attrib['l'] = str(l.ident)

        for l, edgeset in self.labels2edge_map.items():
            #labelEl = l.xml()
            #labelEl.tag = "label"
            #root.append(labelEl)
            labelEl = ET.SubElement(root, "label")
            labelEl.attrib['id'] = str(l.ident)

        leadEdge = self.leading_edge['edge']
        if leadEdge is not None:
            eid = leadEdge.ident
        else:
            eid = -1
        root.attrib['leading_edge'] = str(eid)

        #graphEl = self.state_graph_anno.xml()
        #graphEl.tag = "state_graph"
        #root.append(graphEl)
        graphEl = ET.SubElement(root, "state_graph")
        graphEl.attrib['id'] = str(self.state_graph_anno.ident)

        return root
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:38,代码来源:TuringMachineObserver.py

示例14: __init__

 def __init__(self, circ, cen, avgDist):
     Annotation.__init__(self)
     self.circularity = circ # float
     self.center = cen # Point
     self.radius = avgDist # float
开发者ID:loserpenguin15,项目名称:UCSBsketch,代码行数:5,代码来源:CircleObserver.py

示例15: __init__

 def __init__(self, tag):
     Annotation.__init__(self)
     self.name = tag
开发者ID:jbrowne,项目名称:UCSBsketch,代码行数:3,代码来源:MultiStrokeFeatureObserver.py


注:本文中的SketchFramework.Annotation.Annotation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。