From def1bd221f1964466be7b1484706bab5de61084f Mon Sep 17 00:00:00 2001 From: guille Date: Fri, 24 Feb 2023 07:19:01 -0500 Subject: [PATCH] Clean mapping test --- hub/helpers/geometry_helper.py | 5 +++-- hub/unittests/test_geometry_factory.py | 14 ++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/hub/helpers/geometry_helper.py b/hub/helpers/geometry_helper.py index b61e3b78..0327f97b 100644 --- a/hub/helpers/geometry_helper.py +++ b/hub/helpers/geometry_helper.py @@ -62,7 +62,7 @@ class GeometryHelper: return MapPoint(((city.upper_corner[0] - coordinate[0]) * 0.5), ((city.upper_corner[1] - coordinate[1]) * 0.5)) @staticmethod - def city_mapping(city, building_names=None): + def city_mapping(city, building_names=None, plot=False): if building_names is None: building_names = [b.name for b in city.buildings] x = int((city.upper_corner[0] - city.lower_corner[0]) * 0.5) + 1 @@ -101,7 +101,8 @@ class GeometryHelper: neighbour.neighbours = [building] elif building not in neighbour.neighbours: neighbour.neighbours.append(building) - img.show() + if plot: + img.show() @staticmethod def segment_list_to_trimesh(lines) -> Trimesh: diff --git a/hub/unittests/test_geometry_factory.py b/hub/unittests/test_geometry_factory.py index 5ca0e272..a503bc3b 100644 --- a/hub/unittests/test_geometry_factory.py +++ b/hub/unittests/test_geometry_factory.py @@ -152,20 +152,10 @@ class TestGeometryFactory(TestCase): """ Test neighbours map creation """ - start = datetime.datetime.now() file = 'concordia.geojson' city = self._get_city(file, 'geojson', + height_field='citygml_me', year_of_construction_field='ANNEE_CONS', function_field='LIBELLE_UT') - city_end = datetime.datetime.now() - print(f'city load {city_end-start}') - GeometryHelper.city_mapping(city) - end = datetime.datetime.now() - print(f'city map {end-city_end}') - - for building in city.buildings: - if building.neighbours is not None: - print(f'{building.name} [{[b.name for b in building.neighbours]}]') - else: - print(f'{building.name} has no neighbours') + GeometryHelper.city_mapping(city, plot=False) self.assertTrue(False)