if last2: street_vertices = last2 + [b.coords, new1] polylist.append( Polygon2D(street_vertices, poly_type="road")) street_vertices = [b.coords, new2, new1] polylist.append( Polygon2D(street_vertices, poly_type="road")) last2 = [new2, b.coords] else: old_poly.poly_type = "road" return [old_poly] street_vertices = last2 + [old_vertices[-1].coords, new_vertices[0]] polylist.append(Polygon2D(street_vertices, poly_type="road")) #All new vertices are in old polygon: append block polygon block_poly = Polygon2D(new_vertices) if block_poly.area < singleton.max_area: block_poly.poly_type = "lot" polylist.append(block_poly) return polylist if __name__ == "__main__": import matplotlib.pyplot as plt import construct_polygons as cp polys, vertices = cp.main() for p in getBlock(polys[1], vertices): p.selfplot() plt.show()
return Polygon2D([p1,p2,p3,p4]) else: #TODO: assign issue to lenny ... why return false return False if __name__=="__main__": import matplotlib.pyplot as plt from plot_poly import plot_poly from getBlock import getBlock from getLots import getLots import construct_polygons as cp polys, vertices = cp.main() lots = getLots(polys[:20], vertices) for poly in lots: if poly.poly_type == "lot": f = getFoundation(poly) if f: plot_poly(poly, mode="k") plot_poly(f, mode="g") else: plot_poly(poly, mode="r") plt.show()