Compare commits
2 Commits
e03fc6e1b3
...
1f6b3e2d8a
Author | SHA1 | Date | |
---|---|---|---|
1f6b3e2d8a | |||
81e7d580cf |
|
@ -152,6 +152,10 @@ class Polygon:
|
|||
self._area += np.linalg.norm(np.cross(ab, ac)) / 2
|
||||
return self._area
|
||||
|
||||
@area.setter
|
||||
def area(self, value):
|
||||
self._area = value
|
||||
|
||||
@property
|
||||
def normal(self) -> np.ndarray:
|
||||
"""
|
||||
|
|
|
@ -68,6 +68,7 @@ class Geojson:
|
|||
# geojson provides the roofs, need to be transform into grounds
|
||||
points = igh.invert_points(points)
|
||||
polygon = Polygon(points)
|
||||
polygon.area = igh.ground_area(points)
|
||||
surfaces.append(Surface(polygon, polygon))
|
||||
buildings.append(Building(f'{name}_zone_{zone}', surfaces, year_of_construction, function))
|
||||
return buildings
|
||||
|
|
|
@ -134,7 +134,7 @@ class TestGeometryFactory(TestCase):
|
|||
"""
|
||||
Test geojson import
|
||||
"""
|
||||
file = '10000_buildings.geojson'
|
||||
file = '2000_buildings.geojson'
|
||||
start = datetime.datetime.now()
|
||||
city = self._get_city(file, 'geojson',
|
||||
height_field='building_height',
|
||||
|
@ -146,7 +146,7 @@ class TestGeometryFactory(TestCase):
|
|||
hub.exports.exports_factory.ExportsFactory('obj', city, self._output_path).export()
|
||||
end = datetime.datetime.now()
|
||||
print(f'geometry export in {end - start} s')
|
||||
self.assertEqual(195, len(city.buildings), 'wrong number of buildings')
|
||||
self.assertEqual(2356, len(city.buildings), 'wrong number of buildings')
|
||||
self._check_buildings(city)
|
||||
|
||||
def test_map_neighbours(self):
|
||||
|
@ -159,6 +159,10 @@ class TestGeometryFactory(TestCase):
|
|||
year_of_construction_field='ANNEE_CONS',
|
||||
function_field='LIBELLE_UT')
|
||||
info_lod1 = GeometryHelper.city_mapping(city, plot=False)
|
||||
city = self._get_city(file, 'geojson',
|
||||
year_of_construction_field='ANNEE_CONS',
|
||||
function_field='LIBELLE_UT')
|
||||
info_lod0 = GeometryHelper.city_mapping(city, plot=False)
|
||||
hub.exports.exports_factory.ExportsFactory('obj', city, self._output_path).export()
|
||||
self.assertEqual(info_lod0, info_lod1)
|
||||
for building in city.buildings:
|
||||
|
|
1
hub/unittests/tests_data/2000_buildings.geojson
Normal file
1
hub/unittests/tests_data/2000_buildings.geojson
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user