From 511361b70bea5c2b73b8d54fbdf8bb2f90504a8f Mon Sep 17 00:00:00 2001 From: guille Date: Thu, 23 Feb 2023 15:40:09 -0500 Subject: [PATCH] Correct bug in citygml year_of_construction field default value --- hub/imports/geometry/citygml.py | 10 +++++++--- hub/unittests/test_geometry_factory.py | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hub/imports/geometry/citygml.py b/hub/imports/geometry/citygml.py index bcd3dec8..3b4e688d 100644 --- a/hub/imports/geometry/citygml.py +++ b/hub/imports/geometry/citygml.py @@ -19,11 +19,12 @@ class CityGml: """ CityGml class """ + def __init__(self, path, extrusion_height_field=None, - year_of_construction_field='yearOfConstruction', - function_field='function', + year_of_construction_field=None, + function_field=None, function_to_hub=None): self._city = None self._lod = None @@ -31,9 +32,12 @@ class CityGml: self._lod2_tags = ['lod2Solid', 'lod2MultiSurface', 'lod2MultiCurve'] self._extrusion_height_field = extrusion_height_field self._function_to_hub = function_to_hub - self._year_of_construction_field = year_of_construction_field + if function_field is None: function_field = 'function' + if year_of_construction_field is None: + year_of_construction_field = 'yearOfConstruction' + self._year_of_construction_field = year_of_construction_field self._function_field = function_field self._lower_corner = None diff --git a/hub/unittests/test_geometry_factory.py b/hub/unittests/test_geometry_factory.py index 695b3192..1c8ef5bb 100644 --- a/hub/unittests/test_geometry_factory.py +++ b/hub/unittests/test_geometry_factory.py @@ -103,12 +103,11 @@ class TestGeometryFactory(TestCase): :return: None """ file = 'FZK_Haus_LoD_2.gml' - city = self._get_city(file, 'citygml', year_of_construction_field='yearOfConstruction') + city = self._get_city(file, 'citygml') self.assertTrue(len(city.buildings) == 1) self._check_buildings(city) for building in city.buildings: self._check_surfaces(building) - building.year_of_construction = 2006 city = ConstructionFactory('nrel', city).enrich() def test_import_rhino(self):