当前位置: 首页>>代码示例>>Python>>正文


Python ArchiLib.insertNode方法代码示例

本文整理汇总了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")
开发者ID:RichDijk,项目名称:ArchiConcepts,代码行数:28,代码来源:al_ImportConceptsIntoArchi.py

示例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)
开发者ID:RichDijk,项目名称:ArchiConcepts,代码行数:42,代码来源:al_OrganizeFolders.py

示例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)

#.........这里部分代码省略.........
开发者ID:RichDijk,项目名称:ArchiConcepts,代码行数:103,代码来源:al_DrawModel.py


注:本文中的al_lib.ArchiLib.ArchiLib.insertNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。