city_retrofit/imports/geometry/citygml_base.py

46 lines
1.0 KiB
Python

from abc import ABC
import numpy as np
from imports.geometry.helpers.geometry_helper import GeometryHelper
class CityGmlBase(ABC):
def __init__(self):
self._surfaces = []
@property
def surfaces(self):
return self._surfaces
@staticmethod
def _remove_last_point(points):
array = points.split(' ')
res = " "
return res.join(array[0:len(array) - 3])
@staticmethod
def _solid_points(coordinates) -> np.ndarray:
"""
Solid surface point matrix [[x, y, z],[x, y, z],...]
:parameter coordinates: string from file
:return: np.ndarray
"""
solid_points = np.fromstring(coordinates, dtype=float, sep=' ')
solid_points = GeometryHelper.to_points_matrix(solid_points)
return solid_points
@classmethod
def _solid(cls, o):
raise NotImplementedError
@classmethod
def _multi_surface(cls, o):
raise NotImplementedError
@classmethod
def _multi_curve(cls, o):
raise NotImplementedError
@classmethod
def _building_parts(cls, o):
raise NotImplementedError