Пример #1
0
    def _determineAttachmentPoint(self, attachmentPoint: AttachmentPoint, oglClass: OglClass) -> OglPosition:

        oglPosition: OglPosition = OglPosition()

        dw, dh     = oglClass.GetSize()

        if attachmentPoint == AttachmentPoint.NORTH:
            northX: int = dw // 2
            northY: int = 0
            oglPosition.x = northX
            oglPosition.y = northY
        elif attachmentPoint == AttachmentPoint.SOUTH:
            southX = dw // 2
            southY = dh
            oglPosition.x = southX
            oglPosition.y = southY
        elif attachmentPoint == AttachmentPoint.WEST:
            westX: int = 0
            westY: int = dh // 2
            oglPosition.x = westX
            oglPosition.y = westY
        elif attachmentPoint == AttachmentPoint.EAST:
            eastX: int = dw
            eastY: int = dh // 2
            oglPosition.x = eastX
            oglPosition.y = eastY
        else:
            self.logger.warning(f'Unknown attachment point: {attachmentPoint}')
            assert False, 'Unknown attachment point'

        return oglPosition
Пример #2
0
    def __createPotentialAttachmentPoints(self, destinationClass: OglClass,
                                          umlFrame):

        dw, dh = destinationClass.GetSize()

        southX, southY = dw / 2, dh
        northX, northY = dw / 2, 0
        westX, westY = 0.0, dh / 2
        eastX, eastY = dw, dh / 2

        self.__createAnchorHints(destinationClass, southX, southY,
                                 AttachmentPoint.SOUTH, umlFrame)
        self.__createAnchorHints(destinationClass, northX, northY,
                                 AttachmentPoint.NORTH, umlFrame)
        self.__createAnchorHints(destinationClass, westX, westY,
                                 AttachmentPoint.WEST, umlFrame)
        self.__createAnchorHints(destinationClass, eastX, eastY,
                                 AttachmentPoint.EAST, umlFrame)