2021-06-03 11:27:48 -04:00
|
|
|
"""
|
2021-06-04 09:22:06 -04:00
|
|
|
CityGmlLod1 module parses citygml_classes files with level of detail 1 and import the geometry into the city model structure
|
2021-06-03 11:27:48 -04:00
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2021 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
|
|
|
|
2021-06-04 09:22:06 -04:00
|
|
|
from imports.geometry.citygml_classes.citygml_base import CityGmlBase
|
2021-06-02 11:16:00 -04:00
|
|
|
from city_model_structure.attributes.surface import Surface
|
|
|
|
from city_model_structure.attributes.polygon import Polygon
|
|
|
|
|
|
|
|
|
2021-06-03 10:12:06 -04:00
|
|
|
class CityGmlLod1(CityGmlBase):
|
2021-06-03 11:27:48 -04:00
|
|
|
"""
|
|
|
|
CityGmlLod1 class to parse level of detail 1 city gml files
|
|
|
|
"""
|
2021-06-03 10:12:06 -04:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _multi_curve(cls, o):
|
|
|
|
pass
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _multi_surface(cls, o):
|
|
|
|
pass
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def _solid(cls, o):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def __init__(self, o):
|
|
|
|
super().__init__()
|
|
|
|
self._o = o
|
2021-06-02 11:16:00 -04:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def lod1_solid(o):
|
|
|
|
try:
|
|
|
|
solid_points = [
|
2021-06-03 10:12:06 -04:00
|
|
|
CityGmlBase._solid_points(CityGmlBase._remove_last_point(s['Polygon']['exterior']['LinearRing']['posList']['#text']))
|
2021-06-02 11:16:00 -04:00
|
|
|
for s in o['Building']['lod1Solid']['Solid']['exterior']['CompositeSurface']['surfaceMember']]
|
|
|
|
except TypeError:
|
|
|
|
solid_points = [
|
2021-06-03 10:12:06 -04:00
|
|
|
CityGmlBase._solid_points(CityGmlBase._remove_last_point(s['Polygon']['exterior']['LinearRing']['posList']))
|
2021-06-02 11:16:00 -04:00
|
|
|
for s in o['Building']['lod1Solid']['Solid']['exterior']['CompositeSurface']['surfaceMember']]
|
|
|
|
|
|
|
|
return [Surface(Polygon(sp), Polygon(sp)) for sp in solid_points]
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def lod1_multi_surface(o):
|
2021-06-03 10:12:06 -04:00
|
|
|
solid_points = [CityGmlBase._solid_points(CityGmlBase._remove_last_point(s['Polygon']['exterior']['LinearRing']['posList']))
|
2021-06-02 11:16:00 -04:00
|
|
|
for s in o['Building']['lod1MultiSurface']['MultiSurface']['surfaceMember']]
|
|
|
|
return [Surface(Polygon(sp), Polygon(sp)) for sp in solid_points]
|