change route.describe() call
This commit is contained in:
parent
c527392749
commit
fa8561b69a
3 changed files with 10 additions and 10 deletions
|
@ -269,7 +269,8 @@ class Graph:
|
|||
def _allowed_points_index(self, points, allowed_points_i):
|
||||
return np.array(tuple(i for i, point in enumerate(points) if point in allowed_points_i))
|
||||
|
||||
def get_route(self, origin: Location, destination: Location, allowed_ctypes, allow_nonpublic, avoid, include):
|
||||
def get_route(self, origin: Location, destination: Location,
|
||||
allowed_ctypes, allow_nonpublic, avoid, include, visible_nonpublic_areas=None):
|
||||
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')
|
||||
|
||||
|
@ -453,8 +454,6 @@ class Graph:
|
|||
best_route = SegmentRouteWrapper(best_route, orig_point=add_orig_point, dest_point=add_dest_point,
|
||||
orig_ctype=orig_ctype, dest_ctype=dest_ctype)
|
||||
best_route = best_route.split()
|
||||
best_route.create_routeparts()
|
||||
best_route.check_allowed_ctypes(allowed_ctypes)
|
||||
return best_route
|
||||
|
||||
def _room_transfers(self, rooms, room_points, routers, mode):
|
||||
|
|
|
@ -52,8 +52,6 @@ class Route:
|
|||
for routepart in routeparts:
|
||||
routepart.render_svg_coordinates()
|
||||
|
||||
self.describe(routeparts)
|
||||
|
||||
self.routeparts = routeparts
|
||||
|
||||
@staticmethod
|
||||
|
@ -69,8 +67,10 @@ class Route:
|
|||
else:
|
||||
return locations[0].title, locations[0].subtitle
|
||||
|
||||
def describe(self, routeparts):
|
||||
for i, routepart in enumerate(routeparts):
|
||||
def describe(self, allowed_ctypes):
|
||||
self.create_routeparts()
|
||||
|
||||
for i, routepart in enumerate(self.routeparts):
|
||||
for j, line in enumerate(routepart.lines):
|
||||
from_room = line.from_point.room
|
||||
to_room = line.to_point.room
|
||||
|
@ -208,17 +208,17 @@ class Route:
|
|||
line.icon = 'location'
|
||||
line.title, line.description = self.describe_point(point)
|
||||
|
||||
last_line = routeparts[-1].lines[-1]
|
||||
last_line = self.routeparts[-1].lines[-1]
|
||||
if last_line.icon == 'location':
|
||||
last_line.ignore = True
|
||||
|
||||
def check_allowed_ctypes(self, allowed_ctypes):
|
||||
# check allowed ctypes
|
||||
allowed_ctypes = set(allowed_ctypes)
|
||||
self.ctypes_exception = False
|
||||
for connection in self.connections:
|
||||
if connection.ctype not in allowed_ctypes:
|
||||
self.ctypes_exception = True
|
||||
return
|
||||
break
|
||||
|
||||
|
||||
class RoutePart:
|
||||
|
|
|
@ -213,6 +213,7 @@ def main(request, location=None, origin=None, destination=None):
|
|||
except NotYetRoutable:
|
||||
ctx.update({'error': 'notyetroutable'})
|
||||
else:
|
||||
route.describe(allowed_ctypes)
|
||||
ctx.update({'route': route})
|
||||
|
||||
response = render(request, 'site/main.html', ctx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue