2021-03-16 12:33:22 -04:00
|
|
|
"""
|
|
|
|
TestExports test and validate the city export formats
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
from unittest import TestCase
|
2021-03-25 09:11:30 -04:00
|
|
|
from imports.geometry_factory import GeometryFactory
|
2021-03-16 12:33:22 -04:00
|
|
|
from exports.exports_factory import ExportsFactory
|
2021-03-16 20:14:40 -04:00
|
|
|
from city_model_structure.city import City
|
2021-03-16 16:58:52 -04:00
|
|
|
|
2021-03-23 10:13:01 -04:00
|
|
|
|
2021-03-16 12:33:22 -04:00
|
|
|
class TestExports(TestCase):
|
|
|
|
"""
|
|
|
|
TestGeometryFactory TestCase 1
|
|
|
|
"""
|
|
|
|
def setUp(self) -> None:
|
|
|
|
"""
|
|
|
|
Test setup
|
|
|
|
:return: None
|
|
|
|
"""
|
|
|
|
self._city_gml = None
|
|
|
|
self._example_path = (Path(__file__).parent / 'tests_data').resolve()
|
|
|
|
self._output_path = (Path(__file__).parent / 'tests_outputs').resolve()
|
|
|
|
|
|
|
|
def _get_city(self):
|
|
|
|
if self._city_gml is None:
|
2021-04-07 10:33:05 -04:00
|
|
|
file_path = (self._example_path / 'one_building_in_kelowna.gml').resolve()
|
|
|
|
self._city_gml = GeometryFactory('citygml', file_path)._city_debug
|
2021-03-16 12:33:22 -04:00
|
|
|
return self._city_gml
|
|
|
|
|
|
|
|
def _export(self, export_type):
|
|
|
|
self._city_gml = self._get_city()
|
|
|
|
ExportsFactory(export_type, self._city_gml, self._output_path).export
|
|
|
|
|
|
|
|
def test_obj_export(self):
|
|
|
|
self._export('obj')
|
|
|
|
|
|
|
|
def test_stl_export(self):
|
|
|
|
self._export('stl')
|
2021-03-16 20:14:40 -04:00
|
|
|
|
|
|
|
def test_energy_ade_export(self):
|
|
|
|
self._export('energy_ade')
|