本文整理汇总了Python中al_lib.ArchiLib.ArchiLib.insertNode方法的典型用法代码示例。如果您正苦于以下问题:Python ArchiLib.insertNode方法的具体用法?Python ArchiLib.insertNode怎么用?Python ArchiLib.insertNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类al_lib.ArchiLib.ArchiLib
的用法示例。
在下文中一共展示了ArchiLib.insertNode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: importConceptsIntoArchi
# 需要导入模块: from al_lib.ArchiLib import ArchiLib [as 别名]
# 或者: from al_lib.ArchiLib.ArchiLib import insertNode [as 别名]
def importConceptsIntoArchi():
logger.info(u"Using : %s" % fileArchimateTest)
conceptFile = fileConceptsBatches
logger.info(u"Loading :" + conceptFile)
concepts = Concepts.loadConcepts(conceptFile)
al = ArchiLib()
# Create Subfolder
folder = u"Implementation & Migration"
subfolder = u"Dependancy Analysis - %s" % time.strftime(u"%Y%d%m_%H%M%S")
attrib = dict()
attrib[u"id"] = al.getID()
attrib[u"name"] = subfolder
al.insertNode(u"folder", folder, attrib)
logger.info(u"--- Insert Nodes ---")
insertConceptNode(al, concepts, subfolder)
logger.info(u"--- Insert Relations ---")
insertConceptRelation(al, concepts)
al.outputXMLtoFile(filename=u"import_concepts.archimate")
示例2: organizeFolders
# 需要导入模块: from al_lib.ArchiLib import ArchiLib [as 别名]
# 或者: from al_lib.ArchiLib.ArchiLib import insertNode [as 别名]
def organizeFolders(fileArchimate):
logger.info(u"Using : %s" % fileArchimate)
al = ArchiLib(fileArchimate)
for folder in entityFolders:
pass
sl = al.logTypeCounts()
nl = [(x[10:], y) for x, y in sl]
n = 0
for k, v in al.dictNodes.items():
logger.debug(u"%s" % v)
n += 1
try:
af = v[ARCHI_TYPE][10:]
except KeyError, msg:
continue
if af in entityFolders:
logger.debug(u"%d - %s - %s : %s" % (n, v[NAME], af, entityFolders[af]))
Add(af)
else:
logger.info(u"%d Missing - %s" % (n, af))
if False:
# Create Subfolder
folder = u"Implementation & Migration"
subfolder = u"Dependancy Analysis - %s" % time.strftime(u"%Y%d%m_%H%M%S")
attrib = dict()
attrib[u"id"] = al.getID()
attrib[u"name"] = subfolder
al.insertNode(u"folder", folder, attrib)
示例3: DrawModels
# 需要导入模块: from al_lib.ArchiLib import ArchiLib [as 别名]
# 或者: from al_lib.ArchiLib.ArchiLib import insertNode [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)
#.........这里部分代码省略.........