本文整理汇总了Python中SketchFramework.Annotation.Annotation.xml方法的典型用法代码示例。如果您正苦于以下问题:Python Annotation.xml方法的具体用法?Python Annotation.xml怎么用?Python Annotation.xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SketchFramework.Annotation.Annotation
的用法示例。
在下文中一共展示了Annotation.xml方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: xml
# 需要导入模块: from SketchFramework.Annotation import Annotation [as 别名]
# 或者: from SketchFramework.Annotation.Annotation import xml [as 别名]
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
示例2: xml
# 需要导入模块: from SketchFramework.Annotation import Annotation [as 别名]
# 或者: from SketchFramework.Annotation.Annotation import xml [as 别名]
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
示例3: xml
# 需要导入模块: from SketchFramework.Annotation import Annotation [as 别名]
# 或者: from SketchFramework.Annotation.Annotation import xml [as 别名]
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
示例4: xml
# 需要导入模块: from SketchFramework.Annotation import Annotation [as 别名]
# 或者: from SketchFramework.Annotation.Annotation import xml [as 别名]
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
示例5: xml
# 需要导入模块: from SketchFramework.Annotation import Annotation [as 别名]
# 或者: from SketchFramework.Annotation.Annotation import xml [as 别名]
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
示例6: xml
# 需要导入模块: from SketchFramework.Annotation import Annotation [as 别名]
# 或者: from SketchFramework.Annotation.Annotation import xml [as 别名]
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
示例7: xml
# 需要导入模块: from SketchFramework.Annotation import Annotation [as 别名]
# 或者: from SketchFramework.Annotation.Annotation import xml [as 别名]
def xml(self):
root = Annotation.xml(self)
root.attrib['scale'] = str(self.scale)
return root
示例8: xml
# 需要导入模块: from SketchFramework.Annotation import Annotation [as 别名]
# 或者: from SketchFramework.Annotation.Annotation import xml [as 别名]
def xml(self):
root = Annotation.xml(self)
return root