Пример #1
0
    def __init__(self, aLayoutManager, aName):
        self.theCounter = 0
        self.theLayoutManager = aLayoutManager
        self.theLayoutBufferFactory = self.theLayoutManager.theLayoutBufferFactory
        self.thePackingStrategy = PackingStrategy(self)
        self.theLayoutBufferPaster = self.theLayoutManager.theLayoutBufferPaster
        self.theName = aName
        self.theObjectMap = {}
        self.thePropertyMap = {}

        default_scrollregion = [-1000, -1000, 1000, 1000]
        self.orgScrollRegion = default_scrollregion

        self.thePropertyMap[
            OB_DIMENSION_X] = default_scrollregion[2] - default_scrollregion[0]
        self.thePropertyMap[
            OB_DIMENSION_Y] = default_scrollregion[3] - default_scrollregion[1]

        default_zoomratio = 1
        self.thePropertyMap[LO_SCROLL_REGION] = default_scrollregion
        self.thePropertyMap[LO_ZOOM_RATIO] = default_zoomratio
        self.theCanvas = None
        self.thePathwayEditor = None
        self.theSelectedObjectIDList = []

        # allways add root dir object
        anObjectID = self.getUniqueObjectID(ME_SYSTEM_TYPE)
        self.createObject(anObjectID, ME_SYSTEM_TYPE, ME_ROOTID,
                          default_scrollregion[0], default_scrollregion[1],
                          None)
        self.theRootObject = self.getObject(anObjectID)

        self.thePropertyMap[LO_ROOT_SYSTEM] = anObjectID
Пример #2
0
    def __init__(self, aLayout, objectID, x, y, parentSystem):
        self.theLayout = aLayout
        self.theID = objectID
        self.parentSystem = parentSystem

        self.thePropertyMap = {}
        self.thePropertyMap[OB_SHAPE_TYPE] = DEFAULT_SHAPE_NAME
        self.thePropertyMap[OB_POS_X] = x
        self.thePropertyMap[OB_POS_Y] = y
        self.theModelEditor = self.theLayout.theLayoutManager.theModelEditor
        self.ShapePluginManager = self.theModelEditor.getShapePluginManager()
        self.thePropertyMap[OB_HASFULLID] = False

        self.thePackingStrategy = PackingStrategy(self.theLayout)

        self.theCanvas = None
        self.theShape = None
        # default colors
        self.thePropertyMap[OB_OUTLINE_COLOR] = self.theLayout.graphUtils(
        ).getRRGByName("black")
        self.thePropertyMap[OB_FILL_COLOR] = self.theLayout.graphUtils(
        ).getRRGByName("white")
        self.thePropertyMap[OB_TEXT_COLOR] = self.theLayout.graphUtils(
        ).getRRGByName("blue")
        # default outline
        self.thePropertyMap[OB_OUTLINE_WIDTH] = 1
        self.parentSystem.registerObject(self)
        #self.theSD = None
        self.isSelected = False

        self.existobjectFullIDList = []

        self.thexorg = 0
        self.theyorg = 0
        self.lastx = 0
        self.lasty = 0
        self.rn = None
        self.totalLabelWidth = 0
        self.labelLimit = 0
        self.maxShiftMap = {
            DIRECTION_LEFT: [0],
            DIRECTION_RIGHT: [2],
            DIRECTION_UP: [1],
            DIRECTION_DOWN: [3],
            DIRECTION_BOTTOM_RIGHT: [2, 3],
            DIRECTION_BOTTOM_LEFT: [0, 3],
            DIRECTION_TOP_RIGHT: [2, 1],
            DIRECTION_TOP_LEFT: [0, 1]
        }