Exemple #1
0
    def growRight(self, w, h):
        root = BlockNode(self, 0, 0, self.root.w + w, self.root.h)
        root.used = True
        root.down = self.root
        root.right = BlockNode(self, self.root.w, 0, w, self.root.h)

        self.root = root

        node = self.findNode(self.root, w, h)

        if node:
            return self.splitNode(node, w, h)
        else:
            return None
Exemple #2
0
    def growDown(self, w, h):
        root = BlockNode(self, 0, 0, self.root.w, self.root.h + h)
        root.used = True
        root.down = BlockNode(self, 0, self.root.h, self.root.w, h)
        root.right = self.root

        self.root = root

        node = self.findNode(self.root, w, h)

        if node:
            return self.splitNode(node, w, h)
        else:
            return None