Partial correction for unit tests

This commit is contained in:
Guille Gutierrez 2021-04-07 12:57:56 -04:00
parent c480a6c4cb
commit 86fe064a25
3 changed files with 18 additions and 12 deletions

View File

@ -25,7 +25,7 @@ class Building(CityObject):
Building(CityObject) class
"""
def __init__(self, name, lod, surfaces, terrains, year_of_construction, function,
city_lower_corner, zones_surfaces_ids=[]):
city_lower_corner, zones_surfaces_ids=None):
super().__init__(lod, surfaces, name, city_lower_corner)
self._basement_heated = None
self._attic_heated = None
@ -48,12 +48,15 @@ class Building(CityObject):
self._internal_walls = []
self._thermal_zones = []
zone_surfaces = None
if zones_surfaces_ids is not None:
for zone_surfaces_ids in zones_surfaces_ids:
zone_surfaces = []
for surface_id in zone_surfaces_ids:
zone_surfaces.append(self.surface(surface_id))
else:
zone_surfaces = surfaces
self._thermal_zones.append(ThermalZone(zone_surfaces))
for t_zones in self._thermal_zones:
t_zones.bounded = [ThermalBoundary(s, [t_zones]) for s in t_zones.surfaces]
for surface in self.surfaces:

View File

@ -6,11 +6,13 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
import numpy as np
import xmltodict
from city_model_structure.city import City
from city_model_structure.building import Building
from city_model_structure.attributes.surface import Surface
from helpers.geometry_helper import GeometryHelper
from city_model_structure.attributes.polygon import Polygon
from city_model_structure.attributes.thermal_zone import ThermalZone
class CityGml:
@ -108,8 +110,9 @@ class CityGml:
year_of_construction = o['Building']['yearOfConstruction']
if 'function' in o['Building']:
function = o['Building']['function']
self._city.add_city_object(Building(name, lod, surfaces, terrains, year_of_construction, function,
self._lower_corner))
building = Building(name, lod, surfaces, terrains, year_of_construction, function, self._lower_corner)
self._city.add_city_object(building)
return self._city
def _terrains(self, city_object, lod_terrain_str):
@ -174,7 +177,7 @@ class CityGml:
if 'CompositeSurface' in s:
surfaces = surfaces + CityGml._lod2_composite_surface(s)
else:
surfaces = surfaces + CityGml._lod2_multi_surface(s, surface_type)
surfaces = surfaces + CityGml._lod2_multi_surface(s, GeometryHelper.gml_surface_to_libs(surface_type))
return surfaces
@staticmethod

View File

@ -132,8 +132,8 @@ class TestGeometryFactory(TestCase):
self.assertIsNotNone(thermal_zone.surfaces, 'thermal_zone surfaces 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.assertIsNone(thermal_zone.is_heated, 'thermal_zone heated is not none')
self.assertIsNone(thermal_zone.is_cooled, 'thermal_zone cooled is not none')
self.assertIsNotNone(thermal_zone.is_heated, 'thermal_zone heated is none')
self.assertIsNotNone(thermal_zone.is_cooled, 'thermal_zone cooled is none')
self.assertIsNone(thermal_zone.additional_thermal_bridge_u_value,
'thermal_zone additional_thermal_bridge_u_value is not none')
self.assertIsNone(thermal_zone.effective_thermal_capacity,