Ejemplo n.º 1
0
def are_buildings_close_to_eachother(x_1, y_1, solid2):
    box2 = calculate.get_bounding_box(solid2)
    x_2 = box2[0]
    y_2 = box2[1]
    delta = math.sqrt((y_2 - y_1)**2 + (x_2 - x_1)**2)
    if delta <= 100:
        return True
    else:
        return False
Ejemplo n.º 2
0
def calc_building_geometry_zone(name, building_solid, all_building_solid_list,
                                architecture_wwr_df, geometry_pickle_dir,
                                consider_intersections):
    # now get all surfaces and create windows only if the buildings are in the area of study
    window_list = []
    wall_list = []
    orientation = []
    orientation_win = []
    normals_walls = []
    normals_win = []
    intersect_wall = []

    # check if buildings are close together and it merits to check the intersection
    potentially_intersecting_solids = []
    if consider_intersections:
        box = calculate.get_bounding_box(building_solid)
        x, y = box[0], box[1]
        for solid in all_building_solid_list:
            if are_buildings_close_to_eachother(x, y, solid):
                potentially_intersecting_solids.append(solid)

    # identify building surfaces according to angle:
    face_list = fetch.faces_frm_solid(building_solid)
    facade_list_north, facade_list_west, \
    facade_list_east, facade_list_south, roof_list, footprint_list = identify_surfaces_type(face_list)

    # get window properties
    wwr_west = architecture_wwr_df.loc[name, "wwr_west"]
    wwr_east = architecture_wwr_df.loc[name, "wwr_east"]
    wwr_north = architecture_wwr_df.loc[name, "wwr_north"]
    wwr_south = architecture_wwr_df.loc[name, "wwr_south"]

    window_west, \
    wall_west, \
    normals_windows_west, \
    normals_walls_west, \
    wall_intersects_west = calc_windows_walls(facade_list_west, wwr_west, potentially_intersecting_solids)
    if len(window_west) != 0:
        window_list.extend(window_west)
        orientation_win.extend(['west'] * len(window_west))
        normals_win.extend(normals_windows_west)
    wall_list.extend(wall_west)
    orientation.extend(['west'] * len(wall_west))
    normals_walls.extend(normals_walls_west)
    intersect_wall.extend(wall_intersects_west)

    window_east, \
    wall_east, \
    normals_windows_east, \
    normals_walls_east, \
    wall_intersects_east = calc_windows_walls(facade_list_east, wwr_east, potentially_intersecting_solids)
    if len(window_east) != 0:
        window_list.extend(window_east)
        orientation_win.extend(['east'] * len(window_east))
        normals_win.extend(normals_windows_east)
    wall_list.extend(wall_east)
    orientation.extend(['east'] * len(wall_east))
    normals_walls.extend(normals_walls_east)
    intersect_wall.extend(wall_intersects_east)

    window_north, \
    wall_north, \
    normals_windows_north, \
    normals_walls_north, \
    wall_intersects_north = calc_windows_walls(facade_list_north, wwr_north, potentially_intersecting_solids)
    if len(window_north) != 0:
        window_list.extend(window_north)
        orientation_win.extend(['north'] * len(window_north))
        normals_win.extend(normals_windows_north)
    wall_list.extend(wall_north)
    orientation.extend(['north'] * len(wall_north))
    normals_walls.extend(normals_walls_north)
    intersect_wall.extend(wall_intersects_north)

    window_south, \
    wall_south, \
    normals_windows_south, \
    normals_walls_south, \
    wall_intersects_south = calc_windows_walls(facade_list_south, wwr_south, potentially_intersecting_solids)
    if len(window_south) != 0:
        window_list.extend(window_south)
        orientation_win.extend(['south'] * len(window_south))
        normals_win.extend(normals_windows_south)
    wall_list.extend(wall_south)
    orientation.extend(['south'] * len(wall_south))
    normals_walls.extend(normals_walls_south)
    intersect_wall.extend(wall_intersects_south)

    geometry_3D_zone = {
        "name": name,
        "windows": window_list,
        "walls": wall_list,
        "roofs": roof_list,
        "footprint": footprint_list,
        "orientation_walls": orientation,
        "orientation_windows": orientation_win,
        "normals_windows": normals_win,
        "normals_walls": normals_walls,
        "intersect_walls": intersect_wall
    }

    building_geometry = BuildingGeometry(**geometry_3D_zone)
    building_geometry.save(os.path.join(geometry_pickle_dir, 'zone',
                                        str(name)))
    return name
def calc_building_geometry_zone(name, building_solid, data_preprocessed, consider_intersections):
    # now get all surfaces and create windows only if the buildings are in the area of study
    window_list = []
    wall_list = []
    orientation = []
    orientation_win = []
    normals_walls = []
    normals_win = []
    intersect_wall = []

    #check if buildings are close together and it merits to check the intersection
    if consider_intersections:
        potentially_intersecting_solids = []
        box =  calculate.get_bounding_box(building_solid)
        x, y = box[0], box[1]
        for solid in data_preprocessed.all_building_solid_list:
            if are_buildings_close_to_eachother(x, y, solid):
                potentially_intersecting_solids.append(solid)
        data_preprocessed.potentially_intersecting_solids = potentially_intersecting_solids

    # identify building surfaces according to angle:
    face_list = py3dmodel.fetch.faces_frm_solid(building_solid)
    facade_list_north, facade_list_west, \
    facade_list_east, facade_list_south, roof_list, footprint_list = identify_surfaces_type(face_list)

    # get window properties
    wwr_west = data_preprocessed.architecture_wwr_df.loc[name, "wwr_west"]
    wwr_east = data_preprocessed.architecture_wwr_df.loc[name, "wwr_east"]
    wwr_north = data_preprocessed.architecture_wwr_df.loc[name, "wwr_north"]
    wwr_south = data_preprocessed.architecture_wwr_df.loc[name, "wwr_south"]

    window_west, \
    wall_west, \
    normals_windows_west, \
    normals_walls_west, \
    wall_intersects_west= calc_windows_walls(facade_list_west, wwr_west, data_preprocessed)
    if len(window_west) != 0:
        window_list.extend(window_west)
        orientation_win.extend(['west'] * len(window_west))
        normals_win.extend(normals_windows_west)
    wall_list.extend(wall_west)
    orientation.extend(['west'] * len(wall_west))
    normals_walls.extend(normals_walls_west)
    intersect_wall.extend(wall_intersects_west)

    window_east, \
    wall_east, \
    normals_windows_east, \
    normals_walls_east, \
    wall_intersects_east = calc_windows_walls(facade_list_east, wwr_east, data_preprocessed)
    if len(window_east) != 0:
        window_list.extend(window_east)
        orientation_win.extend(['east'] * len(window_east))
        normals_win.extend(normals_windows_east)
    wall_list.extend(wall_east)
    orientation.extend(['east'] * len(wall_east))
    normals_walls.extend(normals_walls_east)
    intersect_wall.extend(wall_intersects_east)

    window_north, \
    wall_north, \
    normals_windows_north, \
    normals_walls_north, \
    wall_intersects_north = calc_windows_walls(facade_list_north, wwr_north, data_preprocessed)
    if len(window_north) != 0:
        window_list.extend(window_north)
        orientation_win.extend(['north'] * len(window_north))
        normals_win.extend(normals_windows_north)
    wall_list.extend(wall_north)
    orientation.extend(['north'] * len(wall_north))
    normals_walls.extend(normals_walls_north)
    intersect_wall.extend(wall_intersects_north)

    window_south, \
    wall_south, \
    normals_windows_south, \
    normals_walls_south, \
    wall_intersects_south= calc_windows_walls(facade_list_south, wwr_south, data_preprocessed)
    if len(window_south) != 0:
        window_list.extend(window_south)
        orientation_win.extend(['south'] * len(window_south))
        normals_win.extend(normals_windows_south)
    wall_list.extend(wall_south)
    orientation.extend(['south'] * len(wall_south))
    normals_walls.extend(normals_walls_south)
    intersect_wall.extend(wall_intersects_south)

    geometry_3D_zone = {"name": name, "windows": window_list, "walls": wall_list, "roofs": roof_list,
                        "footprint": footprint_list, "orientation_walls": orientation,
                        "orientation_windows": orientation_win,
                        "normals_windows": normals_win, "normals_walls": normals_walls,
                        "intersect_walls": intersect_wall}
    print("Building %s done" %name)
    return geometry_3D_zone