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
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
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
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
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
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
def xml(self): root = Annotation.xml(self) root.attrib['scale'] = str(self.scale) return root
def xml(self): root = Annotation.xml(self) return root