forked from s_ranjbar/city_retrofit
Clean mapping test
This commit is contained in:
parent
e070ee5779
commit
def1bd221f
|
@ -62,7 +62,7 @@ class GeometryHelper:
|
||||||
return MapPoint(((city.upper_corner[0] - coordinate[0]) * 0.5), ((city.upper_corner[1] - coordinate[1]) * 0.5))
|
return MapPoint(((city.upper_corner[0] - coordinate[0]) * 0.5), ((city.upper_corner[1] - coordinate[1]) * 0.5))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def city_mapping(city, building_names=None):
|
def city_mapping(city, building_names=None, plot=False):
|
||||||
if building_names is None:
|
if building_names is None:
|
||||||
building_names = [b.name for b in city.buildings]
|
building_names = [b.name for b in city.buildings]
|
||||||
x = int((city.upper_corner[0] - city.lower_corner[0]) * 0.5) + 1
|
x = int((city.upper_corner[0] - city.lower_corner[0]) * 0.5) + 1
|
||||||
|
@ -101,7 +101,8 @@ class GeometryHelper:
|
||||||
neighbour.neighbours = [building]
|
neighbour.neighbours = [building]
|
||||||
elif building not in neighbour.neighbours:
|
elif building not in neighbour.neighbours:
|
||||||
neighbour.neighbours.append(building)
|
neighbour.neighbours.append(building)
|
||||||
img.show()
|
if plot:
|
||||||
|
img.show()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def segment_list_to_trimesh(lines) -> Trimesh:
|
def segment_list_to_trimesh(lines) -> Trimesh:
|
||||||
|
|
|
@ -152,20 +152,10 @@ class TestGeometryFactory(TestCase):
|
||||||
"""
|
"""
|
||||||
Test neighbours map creation
|
Test neighbours map creation
|
||||||
"""
|
"""
|
||||||
start = datetime.datetime.now()
|
|
||||||
file = 'concordia.geojson'
|
file = 'concordia.geojson'
|
||||||
city = self._get_city(file, 'geojson',
|
city = self._get_city(file, 'geojson',
|
||||||
|
height_field='citygml_me',
|
||||||
year_of_construction_field='ANNEE_CONS',
|
year_of_construction_field='ANNEE_CONS',
|
||||||
function_field='LIBELLE_UT')
|
function_field='LIBELLE_UT')
|
||||||
city_end = datetime.datetime.now()
|
GeometryHelper.city_mapping(city, plot=False)
|
||||||
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')
|
|
||||||
self.assertTrue(False)
|
self.assertTrue(False)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user