From 0445dcc4642ead6a897b05c066dba8f47b257784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Wed, 21 Dec 2016 11:33:53 +0100 Subject: [PATCH] fix some errors when routing --- src/c3nav/routing/graph.py | 2 +- src/c3nav/routing/room.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/c3nav/routing/graph.py b/src/c3nav/routing/graph.py index 5f1ba666..034b63bb 100644 --- a/src/c3nav/routing/graph.py +++ b/src/c3nav/routing/graph.py @@ -269,7 +269,7 @@ class Graph: orig_points_i, orig_distances, orig_ctypes = self.get_location_points(origin, 'orig') dest_points_i, dest_distances, dest_ctypes = self.get_location_points(destination, 'dest') - if not orig_points_i or not dest_points_i: + if not len(orig_points_i) or not len(dest_points_i): raise NoRouteFound() add_orig_point = origin if isinstance(origin, PointLocation) else None diff --git a/src/c3nav/routing/room.py b/src/c3nav/routing/room.py index 0de88bbd..15b0ee50 100644 --- a/src/c3nav/routing/room.py +++ b/src/c3nav/routing/room.py @@ -264,7 +264,7 @@ class GraphRoom(): def _build_router(self, ctypes, public, nonpublic, avoid, include): ctype_factors = np.ones((len(self.ctypes), 1, 1))*1000 - ctype_factors[ctypes] = 1 + ctype_factors[ctypes, :, :] = 1 distances = np.amin(self.distances*ctype_factors, axis=0).astype(np.float32) factors = np.ones_like(distances, dtype=np.float16)