def set_virtual_brick_at_global_pos_of(self, brick: Brick): virtual_brick = brick.clone() Extent.calc_local_pos(virtual_brick, self.extent_tracker.board, self.extent_tracker.map_extent) self.virtual_bricks.append(virtual_brick) Tracker.BRICKS_REFRESHED = True
def mark_external_bricks_outdated_if_map_updated(self): # if the extent changed, set external bricks as outdated self.extent_changed = self.extent_tracker.extent_changed if self.extent_changed is True: logger.debug("recalculate virtual brick position") for brick in self.virtual_bricks: if brick.status == BrickStatus.EXTERNAL_BRICK: Extent.calc_local_pos(brick, self.extent_tracker.board, self.extent_tracker.map_extent) logger.info("set bricks outdated because extent changed") self.invalidate_external_bricks() # set the flag back self.extent_tracker.extent_changed = False
def add_external_brick(self, brick: Brick): # TODO: maybe add security checks to not add the same brick twice etc? Extent.calc_local_pos(brick, self.extent_tracker.board, self.extent_tracker.map_extent) self.virtual_bricks.append(brick)