Skip to content
Snippets Groups Projects
Commit 1e321981 authored by tolgayurt's avatar tolgayurt
Browse files

added csv file

parent aaaf71ec
No related branches found
No related tags found
No related merge requests found
Polygon
[(2.0, 0.0),(0.0, 1.0),(0.0, 4.0),(3.0, 5.0),(5.0, 3.0),(5.0, 1.0),(2.0, 0.0)]
[(2.0, 0.0),(0.0, 1.0),(0.0, 4.0),(3.0, 5.0),(5.0, 3.0),(5.0, 1.0),(2.0, 0.0)]
\ No newline at end of file
......@@ -41,6 +41,7 @@ from bokeh.models import PolyDrawTool, PolyEditTool
from bokeh.models.callbacks import CustomJS
from bokeh.embed import json_item
import json
import pandas
def index(request):
......@@ -125,6 +126,13 @@ class PolygonEditView(View):
def post(self, request, *args, **kwargs):
df = pandas.read_csv('plots/polygon.txt', sep="+")
csv_polygons =[]
for csv_polygon in df["Polygon"]:
polygon_shell = eval(csv_polygon)
polygon = poly.ConvexPolygon(polygon_shell)
csv_polygons.append(polygon)
print(csv_polygons)
test = request.POST["your_name"]
dict_poly = json.loads(test)
print(dict_poly["x"])
......@@ -170,16 +178,16 @@ class PolygonEditView(View):
polygon_max_y_list.append(polygon2.max_y)
polygon_min_y_list.append(polygon2.min_y)
real_polygons.append(polygon2)
# for setting the plot
PolygonEditView.polygons = real_polygons
all_polygons = real_polygons + csv_polygons
PolygonEditView.polygons = all_polygons
PolygonEditView.plot_max_y = max(polygon_max_y_list)
PolygonEditView.plot_min_y = min(polygon_min_y_list)
PolygonEditView.plot_max_x = max(polygon_max_x_list)
PolygonEditView.plot_min_x = min(polygon_min_x_list)
polygons_single_plot = poly.plot_polygons_in_single_plot(real_polygons,plot_height=1000, plot_width=2000,render=False)
plot = poly.plot_polygons(real_polygons,render=False)
polygons_single_plot = poly.plot_polygons_in_single_plot(all_polygons,plot_height=850, plot_width=2000,render=False)
plot = poly.plot_polygons(all_polygons,render=False)
# print(type(test))
# p = figure()
# p.multi_line("x", "y", source=source)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment