2021-03-16 12:33:22 -04:00
|
|
|
"""
|
|
|
|
ExportsFactory export a city into several formats
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
|
|
|
|
|
|
|
from exports.formats.stl import Stl
|
|
|
|
from exports.formats.obj import Obj
|
2021-03-16 20:14:40 -04:00
|
|
|
from exports.formats.energy_ade import EnergyAde
|
2021-04-13 14:12:45 -04:00
|
|
|
from exports.formats.simplified_radiosity_algorithm import SimplifiedRadiosityAlgorithm
|
2021-08-11 10:29:54 -04:00
|
|
|
from exports.formats.idf import Idf
|
2021-03-16 12:33:22 -04:00
|
|
|
|
2021-03-16 16:58:52 -04:00
|
|
|
|
2021-03-16 12:33:22 -04:00
|
|
|
class ExportsFactory:
|
|
|
|
"""
|
|
|
|
Exports factory class
|
|
|
|
"""
|
|
|
|
def __init__(self, export_type, city, path):
|
|
|
|
self._city = city
|
|
|
|
self._export_type = '_' + export_type.lower()
|
|
|
|
self._path = path
|
|
|
|
|
|
|
|
@property
|
|
|
|
def _citygml(self):
|
|
|
|
"""
|
2021-06-04 09:22:06 -04:00
|
|
|
Export to citygml_classes with application domain extensions
|
2021-03-16 12:33:22 -04:00
|
|
|
:return: None
|
|
|
|
"""
|
2021-05-27 17:20:06 -04:00
|
|
|
raise NotImplementedError
|
2021-03-16 12:33:22 -04:00
|
|
|
|
2021-03-16 20:14:40 -04:00
|
|
|
@property
|
|
|
|
def _energy_ade(self):
|
|
|
|
"""
|
2021-06-04 09:22:06 -04:00
|
|
|
Export to citygml_classes with application domain extensions
|
2021-03-16 20:14:40 -04:00
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
return EnergyAde(self._city, self._path)
|
|
|
|
|
2021-03-16 12:33:22 -04:00
|
|
|
@property
|
|
|
|
def _stl(self):
|
|
|
|
"""
|
|
|
|
Export the city geometry to stl
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
return Stl(self._city, self._path)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def _obj(self):
|
2021-04-13 14:12:45 -04:00
|
|
|
"""
|
|
|
|
Export the city geometry to obj
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
return Obj(self._city, self._path)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def _grounded_obj(self):
|
2021-03-16 12:33:22 -04:00
|
|
|
"""
|
|
|
|
Export the city geometry to obj
|
|
|
|
:return: None
|
|
|
|
"""
|
2021-03-16 16:58:52 -04:00
|
|
|
return Obj(self._city, self._path).to_ground_points()
|
2021-03-16 12:33:22 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def _idf(self):
|
|
|
|
"""
|
|
|
|
Export the city to Energy+ idf format
|
|
|
|
:return:
|
|
|
|
"""
|
2021-08-11 15:23:57 -04:00
|
|
|
return Idf(self._city, (self._path / f'{self._city.name}.idf'), (self._path / f'{self._city.name}.idd'),(self._path / f'{self._city.name}.epw'))
|
2021-03-16 12:33:22 -04:00
|
|
|
|
2021-04-13 14:12:45 -04:00
|
|
|
@property
|
|
|
|
def _sra(self):
|
2021-04-13 19:00:28 -04:00
|
|
|
return SimplifiedRadiosityAlgorithm(self._city, (self._path / f'{self._city.name}_sra.xml'))
|
2021-04-13 14:12:45 -04:00
|
|
|
|
2021-03-16 12:33:22 -04:00
|
|
|
def export(self):
|
|
|
|
"""
|
|
|
|
Export the city model structure to the given export type
|
2021-04-07 11:52:39 -04:00
|
|
|
:return: None
|
2021-03-16 12:33:22 -04:00
|
|
|
"""
|
|
|
|
return getattr(self, self._export_type, lambda: None)
|
|
|
|
|