merge changes with main
This commit is contained in:
parent
8c6e34cd22
commit
67227a0a79
|
@ -20,8 +20,8 @@ class Building(CityObject):
|
|||
"""
|
||||
Building(CityObject) class
|
||||
"""
|
||||
def __init__(self, name, surfaces, year_of_construction, function, city_lower_corner, terrains=None):
|
||||
super().__init__(name, surfaces, city_lower_corner)
|
||||
def __init__(self, name, surfaces, year_of_construction, function, terrains=None):
|
||||
super().__init__(name, surfaces)
|
||||
self._households = None
|
||||
self._basement_heated = None
|
||||
self._attic_heated = None
|
||||
|
|
|
@ -20,7 +20,7 @@ class CityObjectsCluster(ABC, CityObject):
|
|||
self._cluster_type = cluster_type
|
||||
self._city_objects = city_objects
|
||||
self._sensors = []
|
||||
super().__init__(name, None, None)
|
||||
super().__init__(name, None)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
|
|
@ -82,7 +82,7 @@ class AirSourceHeatPumpParameters:
|
|||
heat_pump.heating_comp_power = h_data[1]
|
||||
heat_pump.heating_capacity_coff = self._compute_coefficients(h_data)
|
||||
|
||||
energy_system = EnergySystem('{} capacity heat pump'.format(heat_pump.model), [], None)
|
||||
energy_system = EnergySystem('{} capacity heat pump'.format(heat_pump.model), [])
|
||||
energy_system.air_source_hp = heat_pump
|
||||
self._city.add_city_object(energy_system)
|
||||
return self._city
|
||||
|
|
|
@ -129,7 +129,7 @@ class WaterToWaterHPParameters:
|
|||
heat_pump.entering_water_temp = data['ewt']
|
||||
heat_pump.leaving_water_temp = data['lwt']
|
||||
heat_pump.power_demand_coff = self._compute_coefficients(data)
|
||||
energy_system = EnergySystem(heat_pump.model, [], None)
|
||||
energy_system = EnergySystem(heat_pump.model, [])
|
||||
energy_system.water_to_water_hp = heat_pump
|
||||
self._city.add_city_object(energy_system)
|
||||
return self._city
|
||||
|
|
|
@ -60,17 +60,15 @@ class Geojson:
|
|||
points = GeometryHelper.points_from_string(GeometryHelper.remove_last_point_from_string(surface_coordinates))
|
||||
polygon = Polygon(points)
|
||||
surfaces.append(Surface(polygon, polygon))
|
||||
buildings.append(Building(f'{name}_zone_{zone}', 0, surfaces, year_of_construction, function))
|
||||
buildings.append(Building(f'{name}_zone_{zone}', surfaces, year_of_construction, function))
|
||||
return buildings
|
||||
|
||||
@staticmethod
|
||||
def _create_buildings_lod1(name, year_of_construction, function, height, surface_coordinates):
|
||||
print(f'create lod 1 {name}')
|
||||
lod0_buildings = Geojson._create_buildings_lod0(name, year_of_construction, function, surface_coordinates)
|
||||
surfaces = []
|
||||
buildings = []
|
||||
for zone, lod0_building in enumerate(lod0_buildings):
|
||||
print(len(lod0_building.surfaces))
|
||||
for surface in lod0_building.surfaces:
|
||||
shapely_polygon = ShapelyPolygon(surface.solid_polygon.coordinates)
|
||||
if not shapely_polygon.is_valid:
|
||||
|
@ -85,8 +83,7 @@ class Geojson:
|
|||
polygon = Polygon(points)
|
||||
surface = Surface(polygon, polygon)
|
||||
surfaces.append(surface)
|
||||
print(f'{name}_zone_{zone}_surface_{zone}')
|
||||
buildings.append(Building(f'{name}_zone_{zone}', 1, surfaces, year_of_construction, function))
|
||||
buildings.append(Building(f'{name}_zone_{zone}', surfaces, year_of_construction, function))
|
||||
return buildings
|
||||
|
||||
def _get_polygons(self, polygons, coordinates):
|
||||
|
|
|
@ -81,7 +81,7 @@ class GPandas:
|
|||
perimeter_polygon = solid_polygon
|
||||
surface = Surface(solid_polygon, perimeter_polygon)
|
||||
surfaces.append(surface)
|
||||
building = Building(name, surfaces, year_of_construction, function, self._lower_corner, terrains=None)
|
||||
building = Building(name, surfaces, year_of_construction, function, terrains=None)
|
||||
self._city.add_city_object(building)
|
||||
self._city.level_of_detail.geometry = lod
|
||||
return self._city
|
||||
|
|
|
@ -77,7 +77,7 @@ class Obj:
|
|||
perimeter_polygon = solid_polygon
|
||||
surface = Surface(solid_polygon, perimeter_polygon)
|
||||
surfaces.append(surface)
|
||||
building = Building(name, surfaces, year_of_construction, function, self._lower_corner, terrains=None)
|
||||
building = Building(name, surfaces, year_of_construction, function, terrains=None)
|
||||
self._city.add_city_object(building)
|
||||
self._city.level_of_detail.geometry = lod
|
||||
return self._city
|
||||
|
|
|
@ -101,7 +101,7 @@ class Rhino:
|
|||
if face is None:
|
||||
break
|
||||
hub_surfaces = hub_surfaces + self._add_face(face)
|
||||
building = Building(name, hub_surfaces, 'unknown', 'unknown', (self._min_x, self._min_y, self._min_z), [])
|
||||
building = Building(name, hub_surfaces, 'unknown', 'unknown', [])
|
||||
city_objects.append(building)
|
||||
lower_corner = (self._min_x, self._min_y, self._min_z)
|
||||
upper_corner = (self._max_x, self._max_y, self._max_z)
|
||||
|
|
|
@ -156,18 +156,6 @@ class TestGeometryFactory(TestCase):
|
|||
year_of_construction_field='ANNEE_CONS',
|
||||
function_field='LIBELLE_UT')
|
||||
|
||||
for building in city.buildings:
|
||||
print(building.name, building.volume)
|
||||
exports.exports_factory.ExportsFactory('obj', city, self._output_path).export_debug()
|
||||
self.assertEqual(203, len(city.buildings), 'wrong number of buildings')
|
||||
self.assertEqual(207, len(city.buildings), 'wrong number of buildings')
|
||||
self._check_buildings(city)
|
||||
|
||||
def test_subway(self):
|
||||
"""
|
||||
Test subway parsing
|
||||
:return:
|
||||
"""
|
||||
file = 'subway.osm'
|
||||
city = self._get_city(file, 'osm_subway')
|
||||
self.assertIsNotNone(city, 'subway entrances is none')
|
||||
self.assertEqual(len(city.city_objects), 20, 'Wrong number of subway entrances')
|
||||
|
|
Loading…
Reference in New Issue
Block a user