forked from s_ranjbar/city_retrofit
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""
|
|
Configuration helper
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
"""
|
|
import configparser
|
|
from pathlib import Path
|
|
|
|
|
|
class ConfigurationHelper:
|
|
"""
|
|
Configuration class
|
|
"""
|
|
def __init__(self):
|
|
config_file = Path(Path(__file__).parent.parent / 'config/configuration.ini').resolve()
|
|
self._config = configparser.ConfigParser()
|
|
self._config.read(config_file)
|
|
|
|
@property
|
|
def max_location_distance_for_shared_walls(self) -> float:
|
|
"""
|
|
Get configured maximal distance between attributes to consider that they may share walls in meters
|
|
:return: 5.0
|
|
"""
|
|
return self._config.getfloat('buildings', 'max_location_distance_for_shared_walls')
|
|
|
|
@property
|
|
def min_coordinate(self) -> float:
|
|
"""
|
|
Get configured minimal coordinate value
|
|
:return: -1.7976931348623157e+308
|
|
"""
|
|
return self._config.getfloat('buildings', 'min_coordinate')
|
|
|
|
@property
|
|
def max_coordinate(self) -> float:
|
|
"""
|
|
Get configured maximal coordinate value
|
|
:return: 1.7976931348623157e+308
|
|
"""
|
|
return self._config.getfloat('buildings', 'max_coordinate').real
|