Reorganize the citygml classes

This commit is contained in:
Guille Gutierrez 2021-06-04 09:22:06 -04:00
parent 8def8ece2d
commit c1c0f598da
7 changed files with 14 additions and 16 deletions

View File

@ -22,7 +22,7 @@ class ExportsFactory:
@property
def _citygml(self):
"""
Export to citygml with application domain extensions
Export to citygml_classes with application domain extensions
:return: None
"""
raise NotImplementedError
@ -30,7 +30,7 @@ class ExportsFactory:
@property
def _energy_ade(self):
"""
Export to citygml with application domain extensions
Export to citygml_classes with application domain extensions
:return: None
"""
return EnergyAde(self._city, self._path)

View File

@ -1,16 +1,15 @@
"""
CityGml module parses citygml files and import the geometry into the city model structure
CityGml module parses citygml_classes files and import the geometry into the city model structure
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
import numpy as np
import xmltodict
from city_model_structure.city import City
from city_model_structure.building import Building
from helpers.geometry_helper import GeometryHelper
from imports.geometry.citygml_lod2 import CityGmlLod2
from imports.geometry.citygml_lod1 import CityGmlLod1
from imports.geometry.citygml_classes.citygml_lod2 import CityGmlLod2
from imports.geometry.citygml_classes.citygml_lod1 import CityGmlLod1
from city_model_structure.parts_consisting_building import PartsConsistingBuilding
@ -23,7 +22,7 @@ class CityGml:
self._lod1_tags = ['lod1Solid', 'lod1MultiSurface']
self._lod2_tags = ['lod2Solid', 'lod2MultiSurface', 'lod2MultiCurve']
with open(path) as gml:
# Clean the namespaces is an important task to prevent wrong ns:field due poor citygml implementations
# Clean the namespaces is an important task to prevent wrong ns:field due poor citygml_classes implementations
fl = ('cityObjectMember', 'curveMember', 'boundedBy', 'surfaceMember', 'consistsOfBuildingPart')
self._gml = xmltodict.parse(gml.read(), process_namespaces=True, xml_attribs=True, namespaces={
'http://www.opengis.net/gml': None,
@ -59,7 +58,6 @@ class CityGml:
self._upper_corner = np.fromstring(envelope['upperCorner'], dtype=float, sep=' ')
if '@srsName' in envelope:
self._srs_name = envelope['@srsName']
print(f'gmlread {path}')
@property
def content(self):
@ -95,7 +93,6 @@ class CityGml:
print(f'add city building part {building.name}')
self._city.add_city_object(building)
building_parts.append(building)
print(f'add building cluster {name}')
return PartsConsistingBuilding(name, building_parts)
@property
@ -110,7 +107,6 @@ class CityGml:
for o in self._gml['CityModel']['cityObjectMember']:
city_object = o['Building']
if 'consistsOfBuildingPart' in city_object:
print('create building parts')
self._city.add_city_objects_cluster(self._create_parts_consisting_building(city_object))
else:
self._city.add_city_object(self._create_building(city_object))

View File

@ -1,10 +1,10 @@
"""
CityGmlLod1 module parses citygml files with level of detail 1 and import the geometry into the city model structure
CityGmlLod1 module parses citygml_classes files with level of detail 1 and import the geometry into the city model structure
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from imports.geometry.citygml_base import CityGmlBase
from imports.geometry.citygml_classes.citygml_base import CityGmlBase
from city_model_structure.attributes.surface import Surface
from city_model_structure.attributes.polygon import Polygon

View File

@ -1,10 +1,10 @@
"""
CityGmlLod1 module parses citygml files with level of detail 1 and import the geometry into the city model structure
CityGmlLod1 module parses citygml_classes files with level of detail 1 and import the geometry into the city model structure
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from imports.geometry.citygml_base import CityGmlBase
from imports.geometry.citygml_classes.citygml_base import CityGmlBase
from city_model_structure.attributes.surface import Surface
from city_model_structure.attributes.polygon import Polygon
from imports.geometry.helpers.geometry_helper import GeometryHelper

View File

@ -7,6 +7,8 @@ from pathlib import Path
from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from imports.geometry.helpers.geometry_helper import GeometryHelper
from city_model_structure.city import City
from exports.exports_factory import ExportsFactory
class TestGeometryFactory(TestCase):
@ -47,7 +49,7 @@ class TestGeometryFactory(TestCase):
raise NotImplementedError
return new_function
# citygml
# citygml_classes
def test_stuttgart_gml(self):
file = 'ConcordiaSWGcampus.gml'
city = self._get_citygml(file)

View File

@ -32,7 +32,7 @@ class TestGeometryFactory(TestCase):
def test_citygml_city_serialization(self):
"""
Test the City from citygml serialization de-serialization
Test the City from citygml_classes serialization de-serialization
:return: None
"""
file = 'lod2_buildings.gml'