summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Bringemo <maxbr167@student.liu.se>2020-12-05 12:25:46 +0100
committerMax Bringemo <maxbr167@student.liu.se>2020-12-05 12:25:46 +0100
commitab68f747a3aa2c23430a45ae91edbfeb6106a4a0 (patch)
treec60efa40dfa319af07af0fad01f974ff09163fe4
parent10e3d6874745283b545d3b8029a3e5e184932c5d (diff)
parentd4540e1322b7aa029e909696a83d7cfd3201299c (diff)
downloadtdde25-ab68f747a3aa2c23430a45ae91edbfeb6106a4a0.tar.gz
Merge branch 'browser-icon' into 'master'
Browser icon See merge request tdde25-2020/tdde25-2020-projekt-sg3-maps-05!12
-rw-r--r--server.py18
-rw-r--r--store.py2
2 files changed, 15 insertions, 5 deletions
diff --git a/server.py b/server.py
index 6a93018..9a275e9 100644
--- a/server.py
+++ b/server.py
@@ -4,7 +4,6 @@ import algorithms
import store
from lib import run_server, get, post, read_html
-
nodes = None
@@ -23,11 +22,24 @@ def show_area():
return json.dumps(rect)
+@get('/favicon.ico')
+def favicon():
+ with open("data/favicon.ico", "rb") as image:
+ read_image = image.read()
+ image_bytes = bytearray(read_image)
+
+ return image_bytes
+
+
@post('/shortest-path')
def shortest_path(body):
body = json.loads(body)
- source_id = algorithms.get_closest_node_id(nodes, store.Node(-1, body['lat1'], body['lng1']))
- target_id = algorithms.get_closest_node_id(nodes, store.Node(-1, body['lat2'], body['lng2']))
+ source_id = algorithms.get_closest_node_id(nodes,
+ store.Node(-1, body['lat1'],
+ body['lng1']))
+ target_id = algorithms.get_closest_node_id(nodes,
+ store.Node(-1, body['lat2'],
+ body['lng2']))
path = algorithms.find_shortest_path(nodes, source_id, target_id)
print(path)
diff --git a/store.py b/store.py
index 9e6d4f7..4af13ef 100644
--- a/store.py
+++ b/store.py
@@ -8,7 +8,6 @@ class Node:
self.lng = float(lng)
self.neighbours = []
-
def coord_tuple(self):
return self.lat, self.lng
@@ -55,4 +54,3 @@ def select_nodes_in_rectangle(nodes, min_lat, max_lat, min_long, max_long):
return [node for node in nodes.values()
if min_lat <= node.lat <= max_lat
and min_long <= node.lng <= max_long]
-