Beispiel #1
0
    def _reconstituteLinkDataModel(self, oglLink: OglLink):
        """
        Updates one the following lists in a PyutLinkedObject:

        ._parents   for Inheritance links
        ._links     for all other link types

        Args:
            oglLink:       An OglLink
        """
        srcShape: OglClass = oglLink.getSourceShape()
        destShape: OglClass = oglLink.getDestinationShape()
        self.logger.debug(
            f'source ID: {srcShape.GetID()} - destination ID: {destShape.GetID()}'
        )

        pyutLink: PyutLink = oglLink.getPyutObject()

        if pyutLink.getType() == LinkType.INHERITANCE:
            childPyutClass: PyutClass = srcShape.getPyutObject()
            parentPyutClass: PyutClass = destShape.getPyutObject()
            childPyutClass.addParent(parentPyutClass)
        else:
            srcPyutClass: PyutClass = srcShape.getPyutObject()
            srcPyutClass.addLink(pyutLink)
Beispiel #2
0
    def __generateUniqueEdge(self, oglLink: OglLink, gml: str) -> str:

        srcOglId:  int = oglLink.getSourceShape().GetID()
        destOglId: int = oglLink.getDestinationShape().GetID()

        gml = (
            f'{gml}'
            f'{GMLExporter.singleTab}{GMLExporter.EDGE_TOKEN} {GMLExporter.START_TOKEN}\n'
            f'{GMLExporter.doubleTab}{GMLExporter.ID_TOKEN} {oglLink.GetID()}\n'
            f'{GMLExporter.doubleTab}{GMLExporter.SOURCE_ID_TOKEN} {srcOglId}\n'
            f'{GMLExporter.doubleTab}{GMLExporter.TARGET_ID_TOKEN} {destOglId}\n'
            f'{self.__generateEdgeGraphicsSection(oglLink=oglLink)}'
            f'{GMLExporter.singleTab}{GMLExporter.END_TOKEN}\n'
        )

        return gml