Reorganize the citygml classes
This commit is contained in:
parent
8def8ece2d
commit
c1c0f598da
|
@ -22,7 +22,7 @@ class ExportsFactory:
|
||||||
@property
|
@property
|
||||||
def _citygml(self):
|
def _citygml(self):
|
||||||
"""
|
"""
|
||||||
Export to citygml with application domain extensions
|
Export to citygml_classes with application domain extensions
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
@ -30,7 +30,7 @@ class ExportsFactory:
|
||||||
@property
|
@property
|
||||||
def _energy_ade(self):
|
def _energy_ade(self):
|
||||||
"""
|
"""
|
||||||
Export to citygml with application domain extensions
|
Export to citygml_classes with application domain extensions
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
return EnergyAde(self._city, self._path)
|
return EnergyAde(self._city, self._path)
|
||||||
|
|
|
@ -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
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||||
"""
|
"""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import xmltodict
|
import xmltodict
|
||||||
|
|
||||||
from city_model_structure.city import City
|
from city_model_structure.city import City
|
||||||
from city_model_structure.building import Building
|
from city_model_structure.building import Building
|
||||||
from helpers.geometry_helper import GeometryHelper
|
from helpers.geometry_helper import GeometryHelper
|
||||||
from imports.geometry.citygml_lod2 import CityGmlLod2
|
from imports.geometry.citygml_classes.citygml_lod2 import CityGmlLod2
|
||||||
from imports.geometry.citygml_lod1 import CityGmlLod1
|
from imports.geometry.citygml_classes.citygml_lod1 import CityGmlLod1
|
||||||
from city_model_structure.parts_consisting_building import PartsConsistingBuilding
|
from city_model_structure.parts_consisting_building import PartsConsistingBuilding
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +22,7 @@ class CityGml:
|
||||||
self._lod1_tags = ['lod1Solid', 'lod1MultiSurface']
|
self._lod1_tags = ['lod1Solid', 'lod1MultiSurface']
|
||||||
self._lod2_tags = ['lod2Solid', 'lod2MultiSurface', 'lod2MultiCurve']
|
self._lod2_tags = ['lod2Solid', 'lod2MultiSurface', 'lod2MultiCurve']
|
||||||
with open(path) as gml:
|
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')
|
fl = ('cityObjectMember', 'curveMember', 'boundedBy', 'surfaceMember', 'consistsOfBuildingPart')
|
||||||
self._gml = xmltodict.parse(gml.read(), process_namespaces=True, xml_attribs=True, namespaces={
|
self._gml = xmltodict.parse(gml.read(), process_namespaces=True, xml_attribs=True, namespaces={
|
||||||
'http://www.opengis.net/gml': None,
|
'http://www.opengis.net/gml': None,
|
||||||
|
@ -59,7 +58,6 @@ class CityGml:
|
||||||
self._upper_corner = np.fromstring(envelope['upperCorner'], dtype=float, sep=' ')
|
self._upper_corner = np.fromstring(envelope['upperCorner'], dtype=float, sep=' ')
|
||||||
if '@srsName' in envelope:
|
if '@srsName' in envelope:
|
||||||
self._srs_name = envelope['@srsName']
|
self._srs_name = envelope['@srsName']
|
||||||
print(f'gmlread {path}')
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def content(self):
|
def content(self):
|
||||||
|
@ -95,7 +93,6 @@ class CityGml:
|
||||||
print(f'add city building part {building.name}')
|
print(f'add city building part {building.name}')
|
||||||
self._city.add_city_object(building)
|
self._city.add_city_object(building)
|
||||||
building_parts.append(building)
|
building_parts.append(building)
|
||||||
print(f'add building cluster {name}')
|
|
||||||
return PartsConsistingBuilding(name, building_parts)
|
return PartsConsistingBuilding(name, building_parts)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -110,7 +107,6 @@ class CityGml:
|
||||||
for o in self._gml['CityModel']['cityObjectMember']:
|
for o in self._gml['CityModel']['cityObjectMember']:
|
||||||
city_object = o['Building']
|
city_object = o['Building']
|
||||||
if 'consistsOfBuildingPart' in city_object:
|
if 'consistsOfBuildingPart' in city_object:
|
||||||
print('create building parts')
|
|
||||||
self._city.add_city_objects_cluster(self._create_parts_consisting_building(city_object))
|
self._city.add_city_objects_cluster(self._create_parts_consisting_building(city_object))
|
||||||
else:
|
else:
|
||||||
self._city.add_city_object(self._create_building(city_object))
|
self._city.add_city_object(self._create_building(city_object))
|
||||||
|
|
|
@ -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
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
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.surface import Surface
|
||||||
from city_model_structure.attributes.polygon import Polygon
|
from city_model_structure.attributes.polygon import Polygon
|
||||||
|
|
|
@ -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
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
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.surface import Surface
|
||||||
from city_model_structure.attributes.polygon import Polygon
|
from city_model_structure.attributes.polygon import Polygon
|
||||||
from imports.geometry.helpers.geometry_helper import GeometryHelper
|
from imports.geometry.helpers.geometry_helper import GeometryHelper
|
|
@ -7,6 +7,8 @@ from pathlib import Path
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from imports.geometry_factory import GeometryFactory
|
from imports.geometry_factory import GeometryFactory
|
||||||
from imports.geometry.helpers.geometry_helper import GeometryHelper
|
from imports.geometry.helpers.geometry_helper import GeometryHelper
|
||||||
|
from city_model_structure.city import City
|
||||||
|
from exports.exports_factory import ExportsFactory
|
||||||
|
|
||||||
|
|
||||||
class TestGeometryFactory(TestCase):
|
class TestGeometryFactory(TestCase):
|
||||||
|
@ -47,7 +49,7 @@ class TestGeometryFactory(TestCase):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
return new_function
|
return new_function
|
||||||
|
|
||||||
# citygml
|
# citygml_classes
|
||||||
def test_stuttgart_gml(self):
|
def test_stuttgart_gml(self):
|
||||||
file = 'ConcordiaSWGcampus.gml'
|
file = 'ConcordiaSWGcampus.gml'
|
||||||
city = self._get_citygml(file)
|
city = self._get_citygml(file)
|
||||||
|
|
|
@ -32,7 +32,7 @@ class TestGeometryFactory(TestCase):
|
||||||
|
|
||||||
def test_citygml_city_serialization(self):
|
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
|
:return: None
|
||||||
"""
|
"""
|
||||||
file = 'lod2_buildings.gml'
|
file = 'lod2_buildings.gml'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user