summaryrefslogtreecommitdiffstats
path: root/server.py
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.liu.se>2020-12-15 17:52:58 +0100
committerGustav Sörnäs <gusso230@student.liu.se>2020-12-15 17:52:58 +0100
commit6c8acb4f4eabb20da41b941158bf52038035699f (patch)
treeef680ba06131b77d82b6dafc3c9750b58b256c14 /server.py
parentace809ebf6f38b1d4fc9f4ec59890d738b7ca583 (diff)
parent21a531eac5b953aeab14e4e8ae887695e8a4c4aa (diff)
downloadtdde25-6c8acb4f4eabb20da41b941158bf52038035699f.tar.gz
Merge remote-tracking branch 'origin/union-find'
Diffstat (limited to 'server.py')
-rw-r--r--server.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/server.py b/server.py
index 6786125..25d2826 100644
--- a/server.py
+++ b/server.py
@@ -6,14 +6,15 @@ from lib import run_server, get, post, read_html
grid = None
nodes = None
-
+unconnected_nodes = None
@get('/')
def index():
global nodes
global grid
+ global unconnected_nodes
- nodes, grid = store.extract_osm_nodes("university.osm")
+ nodes, grid, unconnected_nodes = store.extract_osm_nodes("university.osm")
return read_html('templates/index.html')
@@ -37,6 +38,12 @@ def favicon():
return image_bytes
+@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)