|
|
@ -22,13 +22,10 @@ class TestGeometryFactory(TestCase):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
self._city_gml = None
|
|
|
|
self._city_gml = None
|
|
|
|
self._example_path = (Path(__file__).parent.parent / 'tests_data').resolve()
|
|
|
|
self._example_path = (Path(__file__).parent.parent / 'tests_data').resolve()
|
|
|
|
self._pickle_file = (self._example_path / 'kelowna_test_case.pickle').resolve()
|
|
|
|
|
|
|
|
self._kelowna_pickle_file = (self._example_path / 'kelowna_test_case.pickle').resolve()
|
|
|
|
|
|
|
|
self._output_path = (Path(__file__).parent / 'surface_outputs').resolve()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _get_citygml(self):
|
|
|
|
def _get_citygml(self, file):
|
|
|
|
if self._city_gml is None:
|
|
|
|
if self._city_gml is None:
|
|
|
|
file_path = (self._example_path / 'lod2_buildings.gml').resolve()
|
|
|
|
file_path = (self._example_path / file).resolve()
|
|
|
|
self._city_gml = GeometryFactory('citygml', file_path)._city_debug
|
|
|
|
self._city_gml = GeometryFactory('citygml', file_path)._city_debug
|
|
|
|
self.assertIsNotNone(self._city_gml, 'city is none')
|
|
|
|
self.assertIsNotNone(self._city_gml, 'city is none')
|
|
|
|
return self._city_gml
|
|
|
|
return self._city_gml
|
|
|
@ -48,7 +45,9 @@ class TestGeometryFactory(TestCase):
|
|
|
|
Test the City from citygml serialization de-serialization
|
|
|
|
Test the City from citygml serialization de-serialization
|
|
|
|
:return: None
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
city = self._get_citygml()
|
|
|
|
file = 'lod2_buildings.gml'
|
|
|
|
|
|
|
|
pickle_file = (self._example_path / 'lod2_buildings.pickle').resolve()
|
|
|
|
|
|
|
|
city = self._get_citygml(file)
|
|
|
|
self.assertIsNotNone(city.city_objects, 'city_objects is none')
|
|
|
|
self.assertIsNotNone(city.city_objects, 'city_objects is none')
|
|
|
|
for building in city.buildings:
|
|
|
|
for building in city.buildings:
|
|
|
|
self.assertIsNotNone(city.city_object(building.name), 'city_object return none')
|
|
|
|
self.assertIsNotNone(city.city_object(building.name), 'city_object return none')
|
|
|
@ -57,8 +56,8 @@ class TestGeometryFactory(TestCase):
|
|
|
|
self.assertIsNotNone(city.upper_corner, 'upper_corner is none')
|
|
|
|
self.assertIsNotNone(city.upper_corner, 'upper_corner is none')
|
|
|
|
self.assertIsNotNone(city.name, 'name is none')
|
|
|
|
self.assertIsNotNone(city.name, 'name is none')
|
|
|
|
self.assertIsNotNone(city.country_code, 'country code is none')
|
|
|
|
self.assertIsNotNone(city.country_code, 'country code is none')
|
|
|
|
city.save(self._pickle_file)
|
|
|
|
city.save(pickle_file)
|
|
|
|
city = City.load(self._pickle_file)
|
|
|
|
city = City.load(pickle_file)
|
|
|
|
# repeat the city tests
|
|
|
|
# repeat the city tests
|
|
|
|
self.assertIsNotNone(city.city_objects, 'city_objects is none')
|
|
|
|
self.assertIsNotNone(city.city_objects, 'city_objects is none')
|
|
|
|
for building in city.buildings:
|
|
|
|
for building in city.buildings:
|
|
|
@ -68,31 +67,15 @@ class TestGeometryFactory(TestCase):
|
|
|
|
self.assertIsNotNone(city.upper_corner, 'upper_corner is none')
|
|
|
|
self.assertIsNotNone(city.upper_corner, 'upper_corner is none')
|
|
|
|
self.assertIsNotNone(city.name, 'name is none')
|
|
|
|
self.assertIsNotNone(city.name, 'name is none')
|
|
|
|
self.assertIsNotNone(city.country_code, 'country code is none')
|
|
|
|
self.assertIsNotNone(city.country_code, 'country code is none')
|
|
|
|
os.remove(self._pickle_file.resolve())
|
|
|
|
os.remove(pickle_file)
|
|
|
|
|
|
|
|
|
|
|
|
def test_surfaces_triangulation(self):
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
Test city surfaces triangulation and polygon creation
|
|
|
|
|
|
|
|
:return:
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
print(self._pickle_file)
|
|
|
|
|
|
|
|
city = City.load(self._pickle_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
counter = 0
|
|
|
|
|
|
|
|
for building in city.buildings:
|
|
|
|
|
|
|
|
if building.name != 'BLD121958':
|
|
|
|
|
|
|
|
print('building name', building.name)
|
|
|
|
|
|
|
|
print('volume', building.name, building.volume)
|
|
|
|
|
|
|
|
if str(building.volume) == 'inf':
|
|
|
|
|
|
|
|
counter += 1
|
|
|
|
|
|
|
|
print('total number of buildings with volume inf', counter)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_citygml_buildings(self):
|
|
|
|
def test_citygml_buildings(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Test city objects in the city
|
|
|
|
Test city objects in the city
|
|
|
|
:return: None
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
city = self._get_citygml()
|
|
|
|
file = 'lod2_buildings.gml'
|
|
|
|
|
|
|
|
city = self._get_citygml(file)
|
|
|
|
for building in city.buildings:
|
|
|
|
for building in city.buildings:
|
|
|
|
self.assertIsNotNone(building.name, 'building name is none')
|
|
|
|
self.assertIsNotNone(building.name, 'building name is none')
|
|
|
|
self.assertIsNotNone(building.lod, 'building lod is none')
|
|
|
|
self.assertIsNotNone(building.lod, 'building lod is none')
|
|
|
@ -102,26 +85,24 @@ class TestGeometryFactory(TestCase):
|
|
|
|
self.assertIsNotNone(building.volume, 'building volume is none')
|
|
|
|
self.assertIsNotNone(building.volume, 'building volume is none')
|
|
|
|
self.assertIsNotNone(building.surfaces, 'building surfaces is none')
|
|
|
|
self.assertIsNotNone(building.surfaces, 'building surfaces is none')
|
|
|
|
self.assertIsNotNone(building.surfaces[0].name, 'surface not found')
|
|
|
|
self.assertIsNotNone(building.surfaces[0].name, 'surface not found')
|
|
|
|
self.assertIsNotNone(building.basement_heated, 'building basement_heated is none')
|
|
|
|
self.assertIsNone(building.basement_heated, 'building basement_heated is not none')
|
|
|
|
self.assertIsNotNone(building.attic_heated, 'building attic_heated is none')
|
|
|
|
self.assertIsNone(building.attic_heated, 'building attic_heated is not none')
|
|
|
|
self.assertIsNotNone(building.terrains, 'building terrains is none')
|
|
|
|
self.assertIsNotNone(building.terrains, 'building terrains is none')
|
|
|
|
self.assertIsNotNone(building.foot_print, 'building foot_print is none')
|
|
|
|
|
|
|
|
self.assertIsNotNone(building.usage_zones, 'building usage_zones is none')
|
|
|
|
self.assertIsNotNone(building.usage_zones, 'building usage_zones is none')
|
|
|
|
self.assertIsNone(building.average_storey_height, 'building average_storey_height is not none')
|
|
|
|
self.assertIsNone(building.average_storey_height, 'building average_storey_height is not none')
|
|
|
|
self.assertIsNone(building.storeys_above_ground, 'building storeys_above_ground is not none')
|
|
|
|
self.assertIsNone(building.storeys_above_ground, 'building storeys_above_ground is not none')
|
|
|
|
self.assertIsNotNone(building.heated_volume, 'building heated_volume is none')
|
|
|
|
|
|
|
|
self.assertIsNotNone(building.thermal_zones, 'building thermal_zones is none')
|
|
|
|
self.assertIsNotNone(building.thermal_zones, 'building thermal_zones is none')
|
|
|
|
self.assertIsNotNone(building.type, 'building type is none')
|
|
|
|
self.assertIsNotNone(building.type, 'building type is none')
|
|
|
|
self.assertIsNotNone(building.max_height, 'building max_height is none')
|
|
|
|
self.assertIsNotNone(building.max_height, 'building max_height is none')
|
|
|
|
building.stl_export(self._example_path)
|
|
|
|
self.assertIsNotNone(building.floor_area, 'building floor_area is none')
|
|
|
|
os.remove(Path(self._example_path, building.name + '.stl').resolve())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_citygml_surfaces(self):
|
|
|
|
def test_citygml_surfaces(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Test surfaces in city objects
|
|
|
|
Test surfaces in city objects
|
|
|
|
:return: None
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
city = self._get_citygml()
|
|
|
|
file = 'lod2_buildings.gml'
|
|
|
|
|
|
|
|
city = self._get_citygml(file)
|
|
|
|
for building in city.buildings:
|
|
|
|
for building in city.buildings:
|
|
|
|
for surface in building.surfaces:
|
|
|
|
for surface in building.surfaces:
|
|
|
|
self.assertIsNotNone(surface.name, 'surface name is none')
|
|
|
|
self.assertIsNotNone(surface.name, 'surface name is none')
|
|
|
@ -131,36 +112,45 @@ class TestGeometryFactory(TestCase):
|
|
|
|
self.assertIsNotNone(surface.area_below_ground, 'surface area_below_ground is none')
|
|
|
|
self.assertIsNotNone(surface.area_below_ground, 'surface area_below_ground is none')
|
|
|
|
self.assertIsNotNone(surface.area_above_ground, 'surface area_above_ground is none')
|
|
|
|
self.assertIsNotNone(surface.area_above_ground, 'surface area_above_ground is none')
|
|
|
|
self.assertIsNotNone(surface.points, 'surface points is none')
|
|
|
|
self.assertIsNotNone(surface.points, 'surface points is none')
|
|
|
|
|
|
|
|
self.assertIsNone(surface.holes_points, 'surface holes_points is not none')
|
|
|
|
|
|
|
|
self.assertIsNotNone(surface.perimeter_points, 'surface perimeter_points is none')
|
|
|
|
self.assertIsNotNone(surface.points_list, 'surface points_list is none')
|
|
|
|
self.assertIsNotNone(surface.points_list, 'surface points_list is none')
|
|
|
|
|
|
|
|
self.assertIsNone(surface.holes_points_list, 'surface holes_points_list is not none')
|
|
|
|
|
|
|
|
self.assertIsNotNone(surface.perimeter_points_list, 'surface perimeter_points_list is none')
|
|
|
|
self.assertIsNotNone(surface.global_irradiance, 'monthly irradiance is none')
|
|
|
|
self.assertIsNotNone(surface.global_irradiance, 'monthly irradiance is none')
|
|
|
|
self.assertIsNotNone(surface.swr, 'surface swr is none')
|
|
|
|
self.assertIsNone(surface.swr, 'surface swr is not none')
|
|
|
|
self.assertIsNotNone(surface.min_x, 'surface min_x is none')
|
|
|
|
self.assertIsNotNone(surface.min_x, 'surface min_x is none')
|
|
|
|
self.assertIsNotNone(surface.min_y, 'surface min_y is none')
|
|
|
|
self.assertIsNotNone(surface.min_y, 'surface min_y is none')
|
|
|
|
self.assertIsNotNone(surface.min_z, 'surface min_z is none')
|
|
|
|
self.assertIsNotNone(surface.min_z, 'surface min_z is none')
|
|
|
|
|
|
|
|
self.assertIsNotNone(surface.area_above_ground, 'surface area_above_ground is none')
|
|
|
|
|
|
|
|
self.assertIsNotNone(surface.perimeter_polygon, 'surface perimeter_polygon is none')
|
|
|
|
|
|
|
|
self.assertIsNone(surface.hole_polygons, 'surface hole_polygons is not none')
|
|
|
|
|
|
|
|
self.assertIsNotNone(surface.solid_polygon, 'surface solid_polygon is none')
|
|
|
|
|
|
|
|
|
|
|
|
def test_citygml_thermal_zone(self):
|
|
|
|
def test_citygml_thermal_zone(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Test thermal zones in city objects
|
|
|
|
Test thermal zones in city objects
|
|
|
|
:return: None
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
city = self._get_citygml()
|
|
|
|
file = 'lod2_buildings.gml'
|
|
|
|
|
|
|
|
city = self._get_citygml(file)
|
|
|
|
for building in city.buildings:
|
|
|
|
for building in city.buildings:
|
|
|
|
for thermal_zone in building.thermal_zones:
|
|
|
|
for thermal_zone in building.thermal_zones:
|
|
|
|
self.assertIsNotNone(thermal_zone.surfaces, 'thermal_zone surfaces is none')
|
|
|
|
self.assertIsNotNone(thermal_zone.surfaces, 'thermal_zone surfaces is none')
|
|
|
|
self.assertIsNotNone(thermal_zone.bounded, 'thermal_zone bounded is none')
|
|
|
|
self.assertIsNotNone(thermal_zone.bounded, 'thermal_zone bounded is none')
|
|
|
|
self.assertIsNotNone(thermal_zone.floor_area, 'thermal_zone floor_area is none')
|
|
|
|
self.assertIsNotNone(thermal_zone.floor_area, 'thermal_zone floor_area is none')
|
|
|
|
self.assertIsNotNone(thermal_zone.heated, 'thermal_zone heated is none')
|
|
|
|
self.assertIsNone(thermal_zone.is_heated, 'thermal_zone heated is not none')
|
|
|
|
self.assertIsNotNone(thermal_zone.cooled, 'thermal_zone cooled is none')
|
|
|
|
self.assertIsNone(thermal_zone.is_cooled, 'thermal_zone cooled is not none')
|
|
|
|
self.assertEqual(thermal_zone.additional_thermal_bridge_u_value, 0.0,
|
|
|
|
self.assertIsNone(thermal_zone.additional_thermal_bridge_u_value,
|
|
|
|
'thermal_zone additional_thermal_bridge_u_value is not 0.0')
|
|
|
|
'thermal_zone additional_thermal_bridge_u_value is not none')
|
|
|
|
self.assertIsNone(thermal_zone.effective_thermal_capacity,
|
|
|
|
self.assertIsNone(thermal_zone.effective_thermal_capacity,
|
|
|
|
'thermal_zone effective_thermal_capacity is not none')
|
|
|
|
'thermal_zone effective_thermal_capacity is not none')
|
|
|
|
self.assertEqual(thermal_zone.indirectly_heated_area_ratio, 0.0,
|
|
|
|
self.assertIsNone(thermal_zone.indirectly_heated_area_ratio,
|
|
|
|
'thermal_zone indirectly_heated_area_ratio is not none')
|
|
|
|
'thermal_zone indirectly_heated_area_ratio is not none')
|
|
|
|
self.assertIsNone(thermal_zone.infiltration_rate_system_off,
|
|
|
|
self.assertIsNone(thermal_zone.infiltration_rate_system_off,
|
|
|
|
'thermal_zone infiltration_rate_system_off is not none')
|
|
|
|
'thermal_zone infiltration_rate_system_off is not none')
|
|
|
|
self.assertEqual(thermal_zone.infiltration_rate_system_on, 0.0,
|
|
|
|
self.assertIsNone(thermal_zone.infiltration_rate_system_on,
|
|
|
|
'thermal_zone infiltration_rate_system_on is not none')
|
|
|
|
'thermal_zone infiltration_rate_system_on is not none')
|
|
|
|
self.assertIsNone(thermal_zone.usage_zones,
|
|
|
|
self.assertIsNone(thermal_zone.usage_zones,
|
|
|
|
'thermal_zone usage_zones are not none')
|
|
|
|
'thermal_zone usage_zones are not none')
|
|
|
|
|
|
|
|
|
|
|
@ -169,10 +159,12 @@ class TestGeometryFactory(TestCase):
|
|
|
|
Test thermal boundaries in thermal zones
|
|
|
|
Test thermal boundaries in thermal zones
|
|
|
|
:return: None
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
city = self._get_citygml()
|
|
|
|
file = 'lod2_buildings.gml'
|
|
|
|
|
|
|
|
city = self._get_citygml(file)
|
|
|
|
for building in city.buildings:
|
|
|
|
for building in city.buildings:
|
|
|
|
for thermal_zone in building.thermal_zones:
|
|
|
|
for thermal_zone in building.thermal_zones:
|
|
|
|
for thermal_boundary in thermal_zone.bounded:
|
|
|
|
for thermal_boundary in thermal_zone.bounded:
|
|
|
|
|
|
|
|
self.assertIsNotNone(thermal_boundary.surface, 'thermal_boundary surface is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.type, 'thermal_boundary type is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.type, 'thermal_boundary type is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.area, 'thermal_boundary area is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.area, 'thermal_boundary area is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.area_above_ground, 'thermal_boundary area_above_ground is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.area_above_ground, 'thermal_boundary area_above_ground is none')
|
|
|
@ -180,31 +172,22 @@ class TestGeometryFactory(TestCase):
|
|
|
|
self.assertIsNotNone(thermal_boundary.azimuth, 'thermal_boundary azimuth is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.azimuth, 'thermal_boundary azimuth is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.delimits, 'thermal_boundary delimits is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.delimits, 'thermal_boundary delimits is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.inclination, 'thermal_boundary inclination is none')
|
|
|
|
self.assertIsNotNone(thermal_boundary.inclination, 'thermal_boundary inclination is none')
|
|
|
|
self.assertRaises(Exception, lambda: thermal_boundary.u_value, 'thermal_boundary u_value was initialized')
|
|
|
|
# todo: assert exception
|
|
|
|
self.assertIsNone(thermal_boundary.layers, 'thermal_boundary layers was initialized')
|
|
|
|
|
|
|
|
self.assertRaises(Exception, lambda: thermal_boundary.outside_solar_absorptance,
|
|
|
|
|
|
|
|
'thermal_boundary outside_solar_absorptance was initialized')
|
|
|
|
|
|
|
|
self.assertIsNone(thermal_boundary.outside_thermal_absorptance,
|
|
|
|
|
|
|
|
'thermal_boundary outside_thermal_absorptance was initialized')
|
|
|
|
|
|
|
|
self.assertIsNone(thermal_boundary.outside_visible_absorptance,
|
|
|
|
|
|
|
|
'thermal_boundary outside_visible_absorptance was initialized')
|
|
|
|
|
|
|
|
self.assertRaises(Exception, lambda: thermal_boundary.shortwave_reflectance,
|
|
|
|
|
|
|
|
'thermal_boundary shortwave_reflectance was initialized')
|
|
|
|
|
|
|
|
self.assertRaises(Exception, lambda: thermal_boundary.window_area,
|
|
|
|
self.assertRaises(Exception, lambda: thermal_boundary.window_area,
|
|
|
|
'thermal_boundary window_area was initialized')
|
|
|
|
'thermal_boundary window_area was initialized')
|
|
|
|
self.assertIsNone(thermal_boundary.window_ratio, 'thermal_boundary window_ratio was initialized')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_citygml_thermal_opening(self):
|
|
|
|
def test_citygml_thermal_opening(self):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
Test thermal openings in thermal zones
|
|
|
|
Test thermal openings in thermal zones
|
|
|
|
:return: None
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
city = self._get_citygml()
|
|
|
|
file = 'lod2_buildings.gml'
|
|
|
|
|
|
|
|
city = self._get_citygml(file)
|
|
|
|
for building in city.buildings:
|
|
|
|
for building in city.buildings:
|
|
|
|
for thermal_zone in building.thermal_zones:
|
|
|
|
for thermal_zone in building.thermal_zones:
|
|
|
|
for thermal_boundary in thermal_zone.bounded:
|
|
|
|
for thermal_boundary in thermal_zone.bounded:
|
|
|
|
for thermal_opening in thermal_boundary.thermal_openings:
|
|
|
|
for thermal_opening in thermal_boundary.thermal_openings:
|
|
|
|
self.assertTrue(thermal_opening.frame_ratio == 0, 'thermal_opening frame_ratio was not 0')
|
|
|
|
self.assertIsNone(thermal_opening.frame_ratio, 'thermal_opening frame_ratio was initialized')
|
|
|
|
self.assertIsNone(thermal_opening.g_value, 'thermal_opening g_value was initialized')
|
|
|
|
self.assertIsNone(thermal_opening.g_value, 'thermal_opening g_value was initialized')
|
|
|
|
self.assertIsNone(thermal_opening.conductivity, 'thermal_opening conductivity_w_mk was initialized')
|
|
|
|
self.assertIsNone(thermal_opening.conductivity, 'thermal_opening conductivity_w_mk was initialized')
|
|
|
|
self.assertIsNone(thermal_opening.back_side_solar_transmittance_at_normal_incidence,
|
|
|
|
self.assertIsNone(thermal_opening.back_side_solar_transmittance_at_normal_incidence,
|
|
|
@ -215,27 +198,39 @@ class TestGeometryFactory(TestCase):
|
|
|
|
'thermal_opening front_side_solar_transmittance_at_normal_incidence was initialized')
|
|
|
|
'thermal_opening front_side_solar_transmittance_at_normal_incidence was initialized')
|
|
|
|
self.assertIsNone(thermal_opening.thickness, 'thermal_opening thickness_m was initialized')
|
|
|
|
self.assertIsNone(thermal_opening.thickness, 'thermal_opening thickness_m was initialized')
|
|
|
|
self.assertRaises(Exception, lambda: thermal_opening.u_value, 'thermal_opening u_value was initialized')
|
|
|
|
self.assertRaises(Exception, lambda: thermal_opening.u_value, 'thermal_opening u_value was initialized')
|
|
|
|
|
|
|
|
self.assertIsNone(thermal_opening.overall_u_value, 'thermal_opening overall_u_value was initialized')
|
|
|
|
|
|
|
|
self.assertIsNone(thermal_opening.hi, 'thermal_opening hi was initialized')
|
|
|
|
|
|
|
|
self.assertIsNone(thermal_opening.he, 'thermal_opening he was initialized')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_surfaces_triangulation(self):
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
Test city surfaces triangulation and polygon creation
|
|
|
|
|
|
|
|
:return:
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
file = (self._example_path / 'gml_17_12_2020.pickle').resolve()
|
|
|
|
|
|
|
|
city = City.load(file)
|
|
|
|
|
|
|
|
|
|
|
|
def test_stuttgart_gml(self):
|
|
|
|
|
|
|
|
file_path = (self._example_path / '20190815_mitte_out_MC_FloursurfaceADD.gml').resolve()
|
|
|
|
|
|
|
|
city = GeometryFactory('citygml', file_path).city
|
|
|
|
|
|
|
|
pickle_file = (self._example_path / '20190815_mitte_out_MC_FloursurfaceADD.pickle').resolve()
|
|
|
|
|
|
|
|
city.save(pickle_file)
|
|
|
|
|
|
|
|
counter = 0
|
|
|
|
counter = 0
|
|
|
|
for building in city.buildings:
|
|
|
|
for building in city.buildings:
|
|
|
|
if building.name != 'BLD121958':
|
|
|
|
if building.name != 'BLD121958':
|
|
|
|
print('building name', building.name)
|
|
|
|
print(building.name, building.volume)
|
|
|
|
print('volume', building.name, building.volume)
|
|
|
|
|
|
|
|
if str(building.volume) == 'inf':
|
|
|
|
if str(building.volume) == 'inf':
|
|
|
|
counter += 1
|
|
|
|
counter += 1
|
|
|
|
building.stl_export(self._output_path)
|
|
|
|
|
|
|
|
print('total number of buildings with volume inf', counter)
|
|
|
|
print('total number of buildings with volume inf', counter)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_stuttgart_gml(self):
|
|
|
|
|
|
|
|
file = '20190815_mitte_out_MC_FloursurfaceADD.gml'
|
|
|
|
|
|
|
|
city = self._get_citygml(file)
|
|
|
|
|
|
|
|
pickle_file = (self._example_path / '20190815_mitte_out_MC_FloursurfaceADD.pickle').resolve()
|
|
|
|
|
|
|
|
city.save(pickle_file)
|
|
|
|
|
|
|
|
for building in city.buildings:
|
|
|
|
|
|
|
|
self.assertIsNotNone(building.volume, 'building volume is none')
|
|
|
|
|
|
|
|
|
|
|
|
def test_divide_mesh_by_plane(self):
|
|
|
|
def test_divide_mesh_by_plane(self):
|
|
|
|
file_path = (self._example_path / 'FZK-Haus-LoD-all-KIT-IAI-KHH-B36-V1.gml').resolve()
|
|
|
|
file = 'FZK-Haus-LoD-all-KIT-IAI-KHH-B36-V1.gml'
|
|
|
|
# todo @Guille: this file has 5 lods (0, 1, 2, 3 and 4), all as one single city_object.
|
|
|
|
# todo @Guille: this file has 5 lods (0, 1, 2, 3 and 4), all as one single city_object.
|
|
|
|
# Only lod1 is read and saved
|
|
|
|
# Only lod1 is read and saved
|
|
|
|
city = GeometryFactory('citygml', file_path).city
|
|
|
|
city = self._get_citygml(file)
|
|
|
|
for building in city.buildings:
|
|
|
|
for building in city.buildings:
|
|
|
|
print(building.name)
|
|
|
|
print(building.name)
|
|
|
|
print(building.volume)
|
|
|
|
print(building.volume)
|
|
|
|