2020-06-09 14:07:47 -04:00
|
|
|
"""
|
|
|
|
Configuration helper
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
2020-06-05 12:24:03 -04:00
|
|
|
import configparser
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
2020-06-11 16:22:58 -04:00
|
|
|
class ConfigurationHelper:
|
2020-06-11 15:45:11 -04:00
|
|
|
"""
|
|
|
|
Configuration class
|
|
|
|
"""
|
2020-06-05 12:24:03 -04:00
|
|
|
def __init__(self):
|
2020-06-15 14:59:53 -04:00
|
|
|
config_file = Path(Path(__file__).parent.parent / 'config/configuration.ini').resolve()
|
2020-06-05 12:24:03 -04:00
|
|
|
self._config = configparser.ConfigParser()
|
|
|
|
self._config.read(config_file)
|
|
|
|
|
2020-06-22 14:35:40 -04:00
|
|
|
@property
|
|
|
|
def max_location_distance_for_shared_walls(self):
|
|
|
|
"""
|
2020-12-01 07:33:23 -05:00
|
|
|
Configured maximal distance between attributes to consider that they may share walls in meters
|
2020-06-22 14:35:40 -04:00
|
|
|
:return: float
|
|
|
|
"""
|
2020-10-28 13:57:56 -04:00
|
|
|
return self._config.getfloat('buildings', 'max_location_distance_for_shared_walls')
|
2020-12-01 07:33:23 -05:00
|
|
|
|
|
|
|
@property
|
|
|
|
def min_coordinate(self) -> float:
|
|
|
|
"""
|
|
|
|
Configured minimal coordinate value
|
|
|
|
:return: float
|
|
|
|
"""
|
|
|
|
return self._config.getfloat('buildings', 'min_coordinate')
|
2021-03-25 09:11:42 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def max_coordinate(self) -> float:
|
|
|
|
"""
|
|
|
|
Configured maximal coordinate value
|
|
|
|
:return: float
|
|
|
|
"""
|
|
|
|
return self._config.getfloat('buildings', 'max_coordinate')
|