system_assignation/imports/geometry/citygml_base.py

46 lines
1.0 KiB
Python
Raw Normal View History

2021-06-03 10:12:06 -04:00
from abc import ABC
import numpy as np
from imports.geometry.helpers.geometry_helper import GeometryHelper
2021-06-03 10:12:06 -04:00
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)
2021-06-03 10:12:06 -04:00
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