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()
Пример #2
0
    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)
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 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']
Пример #6
0
 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
Пример #7
0
    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 = {}
Пример #8
0
 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
Пример #9
0
 def __init__(self, scale, type, number = 0):
     "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.type = type
     self.number = number
Пример #10
0
 def __init__(self, horizArrow, vertArrow):
     Annotation.__init__(self)
     self.horizontalArrow = horizArrow
     self.verticalArrow = vertArrow
     self.equations = []
Пример #11
0
 def __init__(self, linearity, angle, start_point, end_point ):
     Annotation.__init__(self) 
     self.linearity = linearity
     self.angle = angle
     self.start_point = start_point
     self.end_point = end_point
Пример #12
0
 def __init__(self, text, scale):
     "Create a Bin annotation. text is the string, and scale is an appropriate size"
     Annotation.__init__(self)
     self.text = text # a string for the text
     self.scale = scale # an approximate "size" for the text
     self.alternates = [text]
Пример #13
0
 def __init__(self, corners):
     Annotation.__init__(self)
     assert len(corners) == 4, "BoxAnnotation: Wrong number of corners in box annotation."
     self.corners = list(corners)
Пример #14
0
    def __init__(self, latex):
        Annotation.__init__(self)
#        logger.debug("Annotating as %s" % (latex))
        self.latex = latex
 def __init__(self, tag):
     Annotation.__init__(self)
     self.name = tag
Пример #16
0
 def __init__(self, circ, cen, avgDist):
     Annotation.__init__(self)
     self.circularity = circ # float
     self.center = cen # Point
     self.radius = avgDist # float
Пример #17
0
 def __init__(self, tag, template):
     Annotation.__init__(self)
     self.template = template
     self.name = tag
Пример #18
0
 def __init__(self):
     Annotation.__init__(self)
     self.dt = 0
     self.pattern = [1,1,1,1,1,0,0,0,0,0,2,0,0,0,0,0]
     self.idx = 0
Пример #19
0
 def __init__(self, tip, tail, linearity=0):
     Annotation.__init__(self)
     self.tip = tip  # Point
     self.tail = tail  # Point
     self.linearity = linearity