diff --git a/city_model_structure/city_object.py b/city_model_structure/city_object.py index 5d368ff1..5babaf5d 100644 --- a/city_model_structure/city_object.py +++ b/city_model_structure/city_object.py @@ -15,7 +15,7 @@ from shapely.geometry import MultiPolygon import numpy as np import matplotlib.patches as patches -from helpers.geometry import Geometry +from helpers.geometry_helper import GeometryHelper from city_model_structure.usage_zone import UsageZone @@ -35,7 +35,7 @@ class CityObject: self._year_of_construction = year_of_construction self._function = function self._lower_corner = lower_corner - self._geometry = Geometry() + self._geometry = GeometryHelper() self._average_storey_height = None self._storeys_above_ground = None self._foot_print = None diff --git a/city_model_structure/polyhedron.py b/city_model_structure/polyhedron.py index 9fdaa2cd..d1665029 100644 --- a/city_model_structure/polyhedron.py +++ b/city_model_structure/polyhedron.py @@ -5,7 +5,7 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc """ import numpy as np import stl -from helpers.geometry import Geometry +from helpers.geometry_helper import GeometryHelper class Polyhedron: @@ -20,7 +20,7 @@ class Polyhedron: self._faces = None self._vertices = None self._mesh = None - self._geometry = Geometry() + self._geometry = GeometryHelper() def _position_of(self, point): vertices = self.vertices diff --git a/city_model_structure/surface.py b/city_model_structure/surface.py index 0776461d..d0936c5a 100644 --- a/city_model_structure/surface.py +++ b/city_model_structure/surface.py @@ -7,7 +7,7 @@ from __future__ import annotations from typing import Union import numpy as np import pyny3d.geoms as pn -from helpers.geometry import Geometry +from helpers.geometry_helper import GeometryHelper class Surface: @@ -21,7 +21,7 @@ class Surface: self._swr = swr self._remove_last = remove_last self._is_projected = is_projected - self._geometry = Geometry() + self._geometry = GeometryHelper() self._polygon = None self._ground_polygon = None self._area = None @@ -89,7 +89,7 @@ class Surface: """ if self._points is None: self._points = np.fromstring(self._coordinates, dtype=float, sep=' ') - self._points = Geometry.to_points_matrix(self._points, self._remove_last) + self._points = GeometryHelper.to_points_matrix(self._points, self._remove_last) return self._points def _min_coord(self, axis): @@ -153,7 +153,7 @@ class Surface: coordinates = coordinates + ' ' coordinates = coordinates + str(x) + ' ' + str(y) + ' ' + str(z) self._ground_points = np.fromstring(coordinates, dtype=float, sep=' ') - self._ground_points = Geometry.to_points_matrix(self._ground_points, False) + self._ground_points = GeometryHelper.to_points_matrix(self._ground_points, False) return self._ground_points @property diff --git a/city_model_structure/thermal_boundary.py b/city_model_structure/thermal_boundary.py index 88048198..01bb6181 100644 --- a/city_model_structure/thermal_boundary.py +++ b/city_model_structure/thermal_boundary.py @@ -7,7 +7,7 @@ from typing import List from city_model_structure.thermal_opening import ThermalOpening from city_model_structure.thermal_zone import ThermalZone from city_model_structure.layer import Layer -from helpers.configuration import Configuration +from helpers.configuration_helper import ConfigurationHelper class ThermalBoundary: @@ -20,7 +20,7 @@ class ThermalBoundary: # ToDo: up to at least LOD2 will be just one thermal opening per Thermal boundary, review for LOD3 and LOD4 self._thermal_openings = [ThermalOpening()] self._layers = None - self._outside_solar_absorptance = Configuration().outside_solar_absorptance + self._outside_solar_absorptance = ConfigurationHelper().outside_solar_absorptance self._outside_thermal_absorptance = None self._outside_visible_absorptance = None self._window_ratio = None @@ -208,8 +208,8 @@ class ThermalBoundary: :return: float """ if self._u_value is None: - h_i = Configuration().h_i - h_e = Configuration().h_e + h_i = ConfigurationHelper().h_i + h_e = ConfigurationHelper().h_e r_value = 1.0/h_i + 1.0/h_e try: for layer in self.layers: diff --git a/city_model_structure/thermal_opening.py b/city_model_structure/thermal_opening.py index 4623be31..68b986b9 100644 --- a/city_model_structure/thermal_opening.py +++ b/city_model_structure/thermal_opening.py @@ -3,7 +3,7 @@ ThermalOpening module SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ -from helpers.configuration import Configuration +from helpers.configuration_helper import ConfigurationHelper class ThermalOpening: @@ -13,7 +13,7 @@ class ThermalOpening: def __init__(self): self._openable_ratio = None self._conductivity = None - self._frame_ratio = Configuration().frame_ratio + self._frame_ratio = ConfigurationHelper().frame_ratio self._g_value = None self._thickness = None self._front_side_solar_transmittance_at_normal_incidence = None @@ -56,8 +56,8 @@ class ThermalOpening: # This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read. self._conductivity = value if self._overall_u_value is None and self.thickness is not None: - h_i = Configuration().h_i - h_e = Configuration().h_e + h_i = ConfigurationHelper().h_i + h_e = ConfigurationHelper().h_e r_value = 1 / h_i + 1 / h_e + float(self.conductivity) / float(self.thickness) self._overall_u_value = 1 / r_value @@ -114,8 +114,8 @@ class ThermalOpening: # This ensures a more robust code that returns the overall_u_value regardless the order the parameters are read. self._thickness = value if self._overall_u_value is None and self.conductivity is not None: - h_i = Configuration().h_i - h_e = Configuration().h_e + h_i = ConfigurationHelper().h_i + h_e = ConfigurationHelper().h_e r_value = 1 / h_i + 1 / h_e + float(self.conductivity) / float(self.thickness) self._overall_u_value = 1 / r_value diff --git a/city_model_structure/thermal_zone.py b/city_model_structure/thermal_zone.py index 60c5a0d3..392b82f7 100644 --- a/city_model_structure/thermal_zone.py +++ b/city_model_structure/thermal_zone.py @@ -6,7 +6,7 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc from typing import List, TypeVar from city_model_structure.usage_zone import UsageZone from city_model_structure.surface import Surface -from helpers.configuration import Configuration +from helpers.configuration_helper import ConfigurationHelper ThermalBoundary = TypeVar('ThermalBoundary') @@ -19,12 +19,12 @@ class ThermalZone: self._surfaces = surfaces self._floor_area = None self._bounded = None - self._heated = Configuration().heated - self._cooled = Configuration().cooled - self._additional_thermal_bridge_u_value = Configuration().additional_thermal_bridge_u_value + self._heated = ConfigurationHelper().heated + self._cooled = ConfigurationHelper().cooled + self._additional_thermal_bridge_u_value = ConfigurationHelper().additional_thermal_bridge_u_value self._effective_thermal_capacity = None - self._indirectly_heated_area_ratio = Configuration().indirectly_heated_area_ratio - self._infiltration_rate_system_on = Configuration().infiltration_rate_system_on + self._indirectly_heated_area_ratio = ConfigurationHelper().indirectly_heated_area_ratio + self._infiltration_rate_system_on = ConfigurationHelper().infiltration_rate_system_on self._infiltration_rate_system_off = None self._usage_zones = None diff --git a/geometry/geometry_feeders/city_gml.py b/geometry/geometry_feeders/city_gml.py index b9948711..fead90b0 100644 --- a/geometry/geometry_feeders/city_gml.py +++ b/geometry/geometry_feeders/city_gml.py @@ -8,7 +8,7 @@ import numpy as np from city_model_structure.city import City from city_model_structure.city_object import CityObject from city_model_structure.surface import Surface -from helpers.geometry import Geometry +from helpers.geometry_helper import GeometryHelper class CityGml: @@ -32,7 +32,7 @@ class CityGml: 'http://www.opengis.net/citygml/2.0': None }, force_list=('cityObjectMember', 'curveMember')) self._cityObjects = None - self._geometry = Geometry() + self._geometry = GeometryHelper() envelope = self._gml['CityModel']['boundedBy']['Envelope'] if '#text' in envelope['lowerCorner']: self._lower_corner = np.fromstring(envelope['lowerCorner']['#text'], dtype=float, sep=' ') diff --git a/helpers/configuration.py b/helpers/configuration_helper.py similarity index 98% rename from helpers/configuration.py rename to helpers/configuration_helper.py index 803266f1..02d4cd66 100644 --- a/helpers/configuration.py +++ b/helpers/configuration_helper.py @@ -7,7 +7,7 @@ import configparser from pathlib import Path -class Configuration: +class ConfigurationHelper: """ Configuration class """ diff --git a/helpers/geometry.py b/helpers/geometry_helper.py similarity index 95% rename from helpers/geometry.py rename to helpers/geometry_helper.py index 09689f26..a2558392 100644 --- a/helpers/geometry.py +++ b/helpers/geometry_helper.py @@ -10,7 +10,7 @@ from trimesh import intersections import open3d as o3d -class Geometry: +class GeometryHelper: """ Geometry helper class """ @@ -155,11 +155,11 @@ class Geometry: mesh_final.append(mesh) break else: - points = Geometry._segment_list_to_point_cloud(mesh_1_segments) + points = GeometryHelper._segment_list_to_point_cloud(mesh_1_segments) points_normals = [[None] * 3] * len(points) for j in range(0, len(points_normals)): points_normals[j] = normal_opp[i] - mesh_2 = Geometry._point_cloud_to_mesh(points, points_normals) - mesh_final.append(Geometry._merge_meshes(mesh_1, mesh_2)) + mesh_2 = GeometryHelper._point_cloud_to_mesh(points, points_normals) + mesh_final.append(GeometryHelper._merge_meshes(mesh_1, mesh_2)) return mesh_final