Skip to content

Commit

Permalink
feat (taxi routes): Added support for one way/two way flags
Browse files Browse the repository at this point in the history
  • Loading branch information
s3cur3 committed Dec 28, 2020
1 parent 08b2cd4 commit f806f18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion xplane_airports/AptDat.py
Expand Up @@ -224,11 +224,12 @@ class TaxiRouteEdge:
node_end: int # The identifier of the terminal node
name: str # The taxiway identifier, used to build ATC taxi clearances (like "taxi via A, T, Q")---may be the empty string
is_runway: bool = False # If false, it's a taxiway
one_way: bool = False # If false, it supports two-way traffic
icao_width: Optional[IcaoWidth] = None # The width class of the taxiway; unknown if None

@staticmethod
def from_line(line: AptDatLine) -> 'TaxiRouteEdge':
edge = TaxiRouteEdge(name=" ".join(line.tokens[5:]), node_begin=int(line.tokens[1]), node_end=int(line.tokens[2]))
edge = TaxiRouteEdge(name=" ".join(line.tokens[5:]), node_begin=int(line.tokens[1]), node_end=int(line.tokens[2]), one_way=line.tokens[3] == 'oneway')

taxiway_type = line.tokens[4]
if taxiway_type.startswith('taxiway_'): # has an explicit width class
Expand Down
9 changes: 5 additions & 4 deletions xplane_airports/test_TaxiRouteNetwork.py
Expand Up @@ -131,9 +131,10 @@ def test_edges(self):
self.assertTrue(all(edge.node_begin in nodes for edge in edges), "Missing begin node referenced by edge")
self.assertTrue(all(edge.node_end in nodes for edge in edges), "Missing end node referenced by edge")

test_edges = (TaxiRouteEdge(node_begin=3, node_end=16, name="", is_runway=False, icao_width=IcaoWidth.A),
TaxiRouteEdge(node_begin=15, node_end=8, name="B", is_runway=False, icao_width=IcaoWidth.B),
TaxiRouteEdge(node_begin=23, node_end=9, name="D", is_runway=False, icao_width=IcaoWidth.B),
TaxiRouteEdge(node_begin=26, node_end=27, name="18/36", is_runway=True, icao_width=None))
test_edges = (TaxiRouteEdge(node_begin=3, node_end=16, name="", is_runway=False, one_way=False, icao_width=IcaoWidth.A),
TaxiRouteEdge(node_begin=7, node_end=0, name="", is_runway=False, one_way=True, icao_width=IcaoWidth.B),
TaxiRouteEdge(node_begin=15, node_end=8, name="B", is_runway=False, one_way=False, icao_width=IcaoWidth.B),
TaxiRouteEdge(node_begin=23, node_end=9, name="D", is_runway=False, one_way=False, icao_width=IcaoWidth.B),
TaxiRouteEdge(node_begin=26, node_end=27, name="18/36", is_runway=True, one_way=False, icao_width=None))
self.assertTrue(all(edge in edges
for edge in test_edges))

0 comments on commit f806f18

Please sign in to comment.