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))
|
||||
|
||||
@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,6 +101,7 @@ class GeometryHelper:
|
|||
neighbour.neighbours = [building]
|
||||
elif building not in neighbour.neighbours:
|
||||
neighbour.neighbours.append(building)
|
||||
if plot:
|
||||
img.show()
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user