summaryrefslogtreecommitdiffstats
path: root/server.py
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.liu.se>2020-11-19 16:19:42 +0100
committerGustav Sörnäs <gusso230@student.liu.se>2020-11-20 13:39:05 +0100
commit7f6aae6eb8f07b71c32311347ddbce92a3874c7d (patch)
tree35dc7367d2d5d1b501950c3efdc7589187395180 /server.py
parentcdcdf5de8846b0fe1cb91cc0c6ec41f5842c7c98 (diff)
downloadtdde25-7f6aae6eb8f07b71c32311347ddbce92a3874c7d.tar.gz
show unconnected nodes on map
Diffstat (limited to 'server.py')
-rw-r--r--server.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/server.py b/server.py
index 6a93018..ae74084 100644
--- a/server.py
+++ b/server.py
@@ -11,7 +11,9 @@ nodes = None
@get('/')
def index():
global nodes
- nodes = store.extract_osm_nodes("university.osm")
+ global unconnected_nodes
+ nodes, unconnected_nodes = store.extract_osm_nodes("university.osm")
+
return read_html('templates/index.html')
@@ -23,6 +25,12 @@ def show_area():
return json.dumps(rect)
+@get('/show-unconnected-nodes')
+def show_unconnected_nodes():
+ print(f"Showing {len(unconnected_nodes)} unconnected nodes")
+ return json.dumps({node.id: node.coord_tuple() for node in unconnected_nodes})
+
+
@post('/shortest-path')
def shortest_path(body):
body = json.loads(body)