本文整理汇总了Python中al_lib.ArchiLib.ArchiLib.insertRel方法的典型用法代码示例。如果您正苦于以下问题:Python ArchiLib.insertRel方法的具体用法?Python ArchiLib.insertRel怎么用?Python ArchiLib.insertRel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类al_lib.ArchiLib.ArchiLib
的用法示例。
在下文中一共展示了ArchiLib.insertRel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DrawModels
# 需要导入模块: from al_lib.ArchiLib import ArchiLib [as 别名]
# 或者: from al_lib.ArchiLib.ArchiLib import insertRel [as 别名]
class DrawModels(object):
fileArchimate= None
n = None
al = None
width = None
height = None
def __init__(self, fileArchimate):
self.fileAchimate = fileArchimate
self.n = 0
self.al = ArchiLib(fileArchimate)
self.start_time = ArchiLib.startTimer()
self.width = u"120"
self.height = u"55"
def createArchimateElement(self, tag, folder, attrib):
self.al.insertNode(tag, folder, attrib, new=False)
AE_ID = attrib[ID]
return AE_ID
def createArchimateRelations(self, tag, folder, attrib):
self.al.insertRel(tag, folder, attrib, new=False)
AR_ID = attrib[ID]
return AR_ID
# <element
# xsi:type="archimate:ArchimateDiagramModel"
# id="66de3166"
# name="Info">
def createDiagramModel(self, tag=None, folder=None, attrib=None):
if tag is None and folder is None and attrib is None:
tag = u"element"
folder = u"Views"
attrib = dict()
attrib[NAME] = u"DM-TDO%d" % self.n
attrib[ARCHI_TYPE] = DIAGRAM_MODEL
self.al.insertNode(tag, folder, attrib)
DMO_ID = attrib[ID]
DMO = self.al.findDiagramModel(attrib[ID])
if len(DMO) == 1:
DMO = DMO[0]
else:
logger.error(u"Diagram Model Not Found")
raise LookupError(u"Ops")
return DMO
else:
self.al.insertNode(tag, folder, attrib)
DMO_ID = attrib[ID]
DMO = self.al.findDiagramModel(attrib[ID])
if len(DMO) == 1:
DMO = DMO[0]
else:
logger.error(u"Diagram Model Not Found")
raise LookupError(u"Ops")
# <child
# xsi:type="archimate:DiagramObject"
# id="ffc36ce0"
# lineColor="#000000"
# textAlignment="2"
# fillColor="#00ffff"
# archimateElement="4b326945">
# </child>
def createDiagramObject(self, DMO, AE_ID, Bounds):
tag = u"child"
attrib = dict()
attrib[ID] = self.al.getID()
attrib[ARCHI_TYPE] = DIAGRAM_OBJECT
attrib[u"lineColor"] = u"#000000"
attrib[u"textAlignment"] = u"2"
attrib[u"targetConnections"] = u""
attrib[u"fillColor"] = u"#ffff00"
attrib[u"archimateElement"] = AE_ID
elm = etree.Element(tag, attrib, nsmap=NS_MAP)
DMO.append(elm)
DOE = self.al.findDiagramObject(attrib[ID])
if len(DOE) == 1:
DOE = DOE[0]
else:
logger.error(u"Diagram Object Not Found")
raise LookupError(u"Ops")
self.createBounds(DOE, Bounds)
#.........这里部分代码省略.........