refactor c3nav.routing
This commit is contained in:
parent
575af6c06e
commit
834d6f0064
13 changed files with 381 additions and 364 deletions
20
src/c3nav/routing/graph/graph.py
Normal file
20
src/c3nav/routing/graph/graph.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
from c3nav.mapdata.models import Level
|
||||
from c3nav.routing.graph.connection import GraphConnection
|
||||
from c3nav.routing.graph.level import GraphLevel
|
||||
|
||||
|
||||
class Graph():
|
||||
def __init__(self):
|
||||
self.levels = {}
|
||||
self.connections = []
|
||||
|
||||
def build(self):
|
||||
for level in Level.objects.all():
|
||||
self.levels[level.name] = GraphLevel(self, level)
|
||||
|
||||
for level in self.levels.values():
|
||||
level.build()
|
||||
level.draw_png()
|
||||
|
||||
def add_connection(self, from_point, to_point):
|
||||
self.connections.append(GraphConnection(self, from_point, to_point))
|
Loading…
Add table
Add a link
Reference in a new issue