def move(self, measure, direction): [dx, dy, dz, _] = normalize(direction) @ rotate(self.angle) self.origin = (self.x + measure * dx, self.y + measure * dy, self.z + measure * dz) __log__(landscape=str(self)) __project__("landscape")
def transform(object, transformation): object.coordinates = [ (x, y, z) for [x, y, z, _] in [ normalize(coordinate) @ transformation for coordinate in object.coordinates ] ] __project__("transformation")
def register(shape): global ID_COUNTER ID_COUNTER += 1 shape.id = ID_COUNTER global DISPLAY_FILE DISPLAY_FILE.append(shape) __log__(new_object=shape) __project__("display_file")
def delete(id): global DISPLAY_FILE i = 0 while i < len(DISPLAY_FILE): if DISPLAY_FILE[i].id == id: DISPLAY_FILE.pop(i) break i += 1 __log__(object_deleted=id) __project__("display_file")
def __init__(self): super().__init__() self.object_list = ObjectListComponent(self.builder) self.drawing_area = DrawingAreaComponent(self.builder) self.transformation = TransformationComponent(self.builder) self.logger = LogComponent(self.builder) __project__("log", welcome=""" Interactive graphic system project Arthur Henrique Della Fraga Federal University of Santa Catarina""")
def selection_changed(self, widget): __project__("object_selection", id=self.selected_object_id)
def zoom(self, measure, direction): self.scale *= 1 + measure / 100 * direction[2] __log__(landscape=str(self)) __project__("landscape")
def turn(self, measure, direction): self.angle += math.radians(measure * direction[0]) self.angle %= math.radians(360) __log__(landscape=str(self)) __project__("landscape")
def load(path): Loader().load(path) __log__(file_loaded=path) __project__("display_file")