def action(self): if self.points is None: messagebox.showerror( title="No points", message="No points loaded! Please load points first.") return loading_screen = LoadingScreen(self.window, "Inserting to database", "Initializing...") loading_screen.set_message( "Inserting points to relational database...") relational_data = rp_repository.insert_points(self.points) loading_screen.set_message("Points inserted to relational database.") loading_screen.set_progress_value(33.33) loading_screen.set_message( "Inserting points to spatial Core database...") spatial_core_data = scp_repository.insert_points(self.points) loading_screen.set_message("Points inserted to spatial Core database.") loading_screen.set_progress_value(66.66) loading_screen.set_message( "Inserting points to spatial PostGIS database...") spatial_postgis_data = spp_repository.insert_points(self.points) loading_screen.set_message( "Points inserted to spatial PostGIS database.") loading_screen.set_progress_value(100.0) loading_screen.set_message("Done.") loading_screen.close() self.change_active_dataset() self.show_statistics(self.title, relational_data, spatial_core_data, spatial_postgis_data)
def action(self): try: center = (float(self.center_x_var.get()), float(self.center_y_var.get())) radius = float(self.radius_var.get()) except InvalidInputException as e: messagebox.showerror(title="Invalid input", message=str(e)) self.reset_inputs() return except Exception as e: messagebox.showerror(title="Invalid input", message="'center x', 'center y' and 'radius' must be floats") self.reset_inputs() raise e loading_screen = LoadingScreen(self.window, "Reading from database", "Initializing...") loading_screen.set_message("Reading points from relational database...") relational_data = rp_repository.find_points_in_circle(center, radius) loading_screen.set_message("Points read from relational database.") loading_screen.set_progress_value(33.33) loading_screen.set_message("Reading points from spatial Core database...") spatial_core_data = scp_repository.find_points_in_circle(center, radius) loading_screen.set_message("Points read from spatial Core database.") loading_screen.set_progress_value(66.66) loading_screen.set_message("Reading points from spatial PostGIS database...") spatial_postgis_data = spp_repository.find_points_in_circle(center, radius) loading_screen.set_message("Points read from spatial PostGIS database.") loading_screen.set_progress_value(100.0) loading_screen.set_message("Done.") loading_screen.close() self.show_statistics(self.title, relational_data, spatial_core_data, spatial_postgis_data)
def action(self): try: bottom_left_corner = (float(self.x_var.get()), float(self.y_var.get())) width = float(self.width_var.get()) height = float(self.height_var.get()) angle = float(self.angle_var.get()) except InvalidInputException as e: messagebox.showerror(title="Invalid input", message=str(e)) self.reset_inputs() return except Exception as e: messagebox.showerror(title="Invalid input", message="'x', 'y', 'width', 'height' and 'angle' must be floats") self.reset_inputs() raise e loading_screen = LoadingScreen(self.window, "Reading from database", "Initializing...") loading_screen.set_message("Reading points from relational database...") relational_data = rp_repository.find_points_in_rotated_rectangle( bottom_left_corner, width, height, angle ) loading_screen.set_message("Points read from relational database.") loading_screen.set_progress_value(33.33) loading_screen.set_message("Reading points from spatial Core database...") spatial_core_data = scp_repository.find_points_in_rotated_rectangle( bottom_left_corner, width, height, angle ) loading_screen.set_message("Points read from spatial Core database.") loading_screen.set_progress_value(66.66) loading_screen.set_message("Reading points from spatial PostGIS database...") spatial_postgis_data = spp_repository.find_points_in_rotated_rectangle( bottom_left_corner, width, height, angle ) loading_screen.set_message("Points read from spatial PostGIS database.") loading_screen.set_progress_value(100.0) loading_screen.set_message("Done.") loading_screen.close() self.show_statistics(self.title, relational_data, spatial_core_data, spatial_postgis_data)