Commit 7630c3de authored by Rick Gruber-Riemer's avatar Rick Gruber-Riemer

Move rectify buildings objects into building_lib

parent 69435179
This diff is collapsed.
......@@ -24,7 +24,6 @@ import shapely.ops as sho
import building_lib
import cluster
import numpy as np
import owbb.models as m
import owbb.plotting as p
import parameters
import prepare_textures
......@@ -44,13 +43,13 @@ def _process_rectify_buildings(nodes_dict: Dict[int, op.Node], rel_nodes_dict: D
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()
for key, node in nodes_dict.items():
x, y = coords_transform.to_local((node.lon, node.lat))
rectify_node = m.RectifyNode(node.osm_id, x, y)
rectify_node = building_lib.RectifyNode(node.osm_id, x, y)
ref_nodes[node.osm_id] = rectify_node
rectify_buildings = list()
......@@ -63,7 +62,7 @@ def _process_rectify_buildings(nodes_dict: Dict[int, op.Node], rel_nodes_dict: D
for ref in way.refs:
if ref in ref_nodes:
rectify_nodes_list.append(ref_nodes[ref])
rectify_building = m.RectifyBuilding(way.osm_id, rectify_nodes_list)
rectify_building = building_lib.RectifyBuilding(way.osm_id, rectify_nodes_list)
rectify_buildings.append(rectify_building)
# make a pseudo rectify building to make sure nodes in relations / Simple3D buildings do not get changed
......@@ -71,7 +70,8 @@ def _process_rectify_buildings(nodes_dict: Dict[int, op.Node], rel_nodes_dict: D
rectify_nodes_list = list()
for key in rel_nodes_dict.keys():
rectify_nodes_list.append(ref_nodes[key])
m.RectifyBuilding(-1, rectify_nodes_list)
building_lib.RectifyBuilding(-1, rectify_nodes_list)
# classify the nodes
change_candidates = list()
......
This diff is collapsed.
......@@ -13,6 +13,7 @@ import numpy as np
from shapely.geometry import MultiPolygon, Polygon
from owbb import models as m
import building_lib as bl
def _create_a3_landscape_figure() -> mfig.Figure:
......@@ -164,17 +165,17 @@ def _draw_blocked_areas(building_zones, ax: maxs.Axes) -> None:
ax.add_patch(patch)
def _draw_blocked_nodes(blocked_nodes: List[m.NodeInRectifyBuilding], ax: maxs.Axes) -> None:
def _draw_blocked_nodes(blocked_nodes: List[bl.NodeInRectifyBuilding], ax: maxs.Axes) -> None:
for node in blocked_nodes:
if m.RectifyBlockedType.ninety_degrees in node.blocked_types:
if bl.RectifyBlockedType.ninety_degrees in node.blocked_types:
my_color = 'blue'
else:
my_color = 'red'
if m.RectifyBlockedType.corner_to_bow in node.blocked_types:
if bl.RectifyBlockedType.corner_to_bow in node.blocked_types:
my_fill = True
else:
my_fill = False
if m.RectifyBlockedType.multiple_buildings in node.blocked_types:
if bl.RectifyBlockedType.multiple_buildings in node.blocked_types:
my_alpha = 0.3
else:
my_alpha = 1.0
......@@ -184,7 +185,7 @@ def _draw_blocked_nodes(blocked_nodes: List[m.NodeInRectifyBuilding], ax: maxs.A
ax.add_patch(my_circle)
def _draw_nodes_to_change(nodes_to_change: List[m.NodeInRectifyBuilding], ax: maxs.Axes) -> None:
def _draw_nodes_to_change(nodes_to_change: List[bl.NodeInRectifyBuilding], ax: maxs.Axes) -> None:
for node in nodes_to_change:
ax.add_patch(pat.Circle((node.my_node.original_x, node.my_node.original_y), radius=0.4, linewidth=2,
color='green', fill=False))
......@@ -250,7 +251,7 @@ def draw_zones(highways_dict, buildings, building_zones, btg_building_zones, bou
pdf_pages.close()
def draw_rectify(rectify_buildings: List[m.RectifyBuilding], max_samples: int, seed_sample: bool) -> None:
def draw_rectify(rectify_buildings: List[bl.RectifyBuilding], max_samples: int, seed_sample: bool) -> None:
number_of_samples = len(rectify_buildings)
if number_of_samples > max_samples:
number_of_samples = max_samples
......
......@@ -345,6 +345,11 @@ OWBB_INDUSTRIAL_BUILDING_BACK_MAX = 20
OWBB_INDUSTRIAL_BUILDING_SIDE_MIN = 10
OWBB_INDUSTRIAL_BUILDING_SIDE_MAX = 20
# ==================== BUILDINGS LIBRARY ============
ALLOW_EMPTY_REGIONS = True
ACCEPTED_REGIONS = ['DE', 'DK']
# default_args_end # DO NOT MODIFY THIS LINE
......
......@@ -29,9 +29,10 @@ PSEUDO_OSM_ID = -1 # For those nodes and ways, which get added as part of proce
class OSMFeatureType(IntEnum):
building_relation = 0
building_generated = 1
landuse = 2
road = 3
pylon_way = 4
building_owbb = 3
landuse = 5
road = 6
pylon_way = 7
def get_next_pseudo_osm_id(osm_feature: OSMFeatureType) -> int:
......
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