Commit 69435179 authored by Rick Gruber-Riemer's avatar Rick Gruber-Riemer

Added parameter RECTIFY_ENABLED

parent 9fe9b667
......@@ -42,6 +42,9 @@ ALLOWED_BUILDING_PART_VALUES = ['yes', 'residential', 'apartments', 'house', 'co
def _process_rectify_buildings(nodes_dict: Dict[int, op.Node], rel_nodes_dict: Dict[int, op.Node],
ways_dict: Dict[int, op.Way], coords_transform: coordinates.Transformation) -> None:
if not parameters.RECTIFY_ENABLED:
return
last_time = time.time()
# create rectify objects
ref_nodes = dict()
......
......@@ -53,11 +53,13 @@ An unstructured list of stuff you might need to know as a developer:
* The code has evolved over time by contributions from persons, who are not necessarily professional Python developers. Whenever you touch or even only read a piece of code, please leave the place in a better state by adding comments with your understanding, refactoring etc.
* The level of unit testing is minimal and below what is achievable. There is no system testing. All system testing is done in a visual way - one of the reasons being that the scenery generation has randomising elements plus parametrisation, which means there is not deterministic right solution even from a regression point of view.
* Apart from testing the results in FlightGear by flying around with e.g. the UFO_, a few operations make use of parameter ``DEBUG_PLOT``, which plots results to a pdf-file.
* Use an editor, which supports `PEP 08`_. However the current main developer prefers a line length of 120 instead. You should be able to live with that.
* Use Python `type hints`_ as far as possible — and help improve the current situation. It might make the code a bit harder to read, but it gets so much easier to understand.
* Try to stick to the Python version as referenced in :ref:`Python<chapter-python-label>`.
* All code in utf-8. On Windows please make sure that line endings get correct in git (core.autocrlf)
.. _UFO: http://wiki.flightgear.org/UFO_from_the_%27White_Project%27_of_the_UNESCO
.. _PEP 08: https://www.python.org/dev/peps/pep-0008/
.. _type hints: https://docs.python.org/3/library/typing.html
......@@ -285,7 +285,7 @@ Examples of overlap objects based on static objects at LSZS (light grey structur
-----------------
Rectify Buildings
-----------------
Rectify angles of corners in buildings to 90 degrees as far as possible (configurable). This operation works on existing buildings as mapped in OSM. It corrects human errors during mapping, when angles are not straight 90 degrees (which they are in reality for the major part of corners). I.e. there is no new information added, only existing information corrected.
Rectifies angles of corners in buildings to 90 degrees as far as possible (configurable). This operation works on existing buildings as mapped in OSM. It corrects human errors during mapping, when angles are not straight 90 degrees (which they are in reality for the major part of corners). I.e. there is no new information added, only existing information corrected.
This operation is mainly used for eye-candy and to allow easier 3-D visualization. It can be left out if you feel that the OSM mappers have done a good job / used good tooling. On the other hand the processing time compared to other operations is negligible.
......@@ -298,7 +298,9 @@ Please note that if you are annoyed with angles in OSM, then you have to rectify
============================================= ======== ======= ==============================================================================
Parameter Type Default Description / Example
============================================= ======== ======= ==============================================================================
RECTIFY_90_TOLERANCE Number 0.1 Small tolerance from 90 degrees not leading to rectification of corner
RECTIFY_ENABLED Boolean True Toggle whether the rectify operation should be used.
RECTIFY_90_TOLERANCE Number 0.1 Small tolerance from 90 degrees not leading to rectification of corner.
RECTIFY_MAX_90_DEVIATION Number 7 By how much an angle can be smaller or larger than 90 to still be rectified.
You might need to experiment a bit and use plotting to determine a good value.
......
......@@ -26,7 +26,7 @@ def _create_a4_landscape_figure() -> mfig.Figure:
def _create_pdf_pages(title_part: str) -> PdfPages:
today = datetime.datetime.now()
date_string = today.strftime("%Y-%m-%d_%H%M")
return PdfPages("owbb_debug_{0}_{1}.pdf".format(title_part, date_string))
return PdfPages("osm2city_debug_{0}_{1}.pdf".format(title_part, date_string))
def _plot_line(ax: maxs.Axes, ob, my_color, my_width) -> None:
......
......@@ -128,6 +128,7 @@ BUILDING_ROOF_HIPPED_RATIO = 0.1
BUILDING_ROOF_PYRAMIDAL_RATIO = 0.05
# ==================== RECTIFY BUILDINGS ============
RECTIFY_ENABLED = True
RECTIFY_MAX_DRAW_SAMPLE = 20
RECTIFY_SEED_SAMPLE = True
RECTIFY_MAX_90_DEVIATION = 7
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment