diff --git a/city_model_structure/attributes/polygon.py b/city_model_structure/attributes/polygon.py index 126e9ae4..4064ad81 100644 --- a/city_model_structure/attributes/polygon.py +++ b/city_model_structure/attributes/polygon.py @@ -104,7 +104,6 @@ class Polygon: if module != 0: angle = abs(np.arcsin(scalar_product / module)) angle_sum += angle - print(angle_sum) return abs(angle_sum - math.pi*2) < cte.EPSILON def contains_polygon(self, polygon): @@ -112,13 +111,10 @@ class Polygon: Determines if the given polygon is contained by the current polygon :return: boolean """ - print('contains') - for point in polygon.points: - print(point.coordinates, self.contains_point(point)) + for point in polygon.points: if not self.contains_point(point): return False - print('Belong!') return True @property diff --git a/city_model_structure/city.py b/city_model_structure/city.py index b9f029b3..b0e19e81 100644 --- a/city_model_structure/city.py +++ b/city_model_structure/city.py @@ -8,8 +8,9 @@ from __future__ import annotations import sys import pickle import math -from typing import List, Union +import copy import pyproj +from typing import List, Union from pyproj import Transformer from pathlib import Path @@ -434,3 +435,9 @@ class City: return lca_material return None + @property + def copy(self) -> City: + """ + Get a copy of the current city + """ + return copy.deepcopy(self) diff --git a/imports/geometry/rhino.py b/imports/geometry/rhino.py index 53f21088..1d0b63c0 100644 --- a/imports/geometry/rhino.py +++ b/imports/geometry/rhino.py @@ -7,7 +7,6 @@ from numpy import inf from rhino3dm import * from rhino3dm._rhino3dm import MeshType - from city_model_structure.attributes.point import Point import numpy as np @@ -16,7 +15,6 @@ from city_model_structure.attributes.polygon import Polygon from city_model_structure.building import Building from city_model_structure.city import City from city_model_structure.building_demand.surface import Surface as LibsSurface -from helpers.constants import EPSILON from imports.geometry.helpers.geometry_helper import GeometryHelper @@ -31,7 +29,6 @@ class Rhino: @staticmethod def _in_perimeter(wall, corner): res = wall.contains_point(Point(corner)) - print(f'belong: {res} wall:({wall.coordinates}) corner: ({corner})') return res @staticmethod @@ -98,7 +95,6 @@ class Rhino: windows.append(Polygon(surface.perimeter_polygon.inverse)) else: buildings.append(rhino_object) - print(f'windows: {len(windows)}') # todo: this method will be pretty inefficient for hole in windows: corner = hole.coordinates[0]