1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#[macro_use]
extern crate anyhow;
use std::collections::BTreeMap;
use geom::{Distance, PolyLine, Polygon, Pt2D, Speed};
pub use self::raw::{Connection, Direction, EdgeID, InternalLaneID, LaneID, NodeID};
mod normalize;
mod raw;
pub struct Network {
pub location: raw::Location,
pub normal_edges: BTreeMap<EdgeID, Edge>,
pub internal_edges: BTreeMap<EdgeID, InternalEdge>,
pub junctions: BTreeMap<NodeID, Junction>,
pub connections: Vec<Connection>,
}
pub struct Edge {
pub id: EdgeID,
pub edge_type: String,
pub name: Option<String>,
pub from: NodeID,
pub to: NodeID,
pub priority: usize,
pub lanes: Vec<Lane>,
pub center_line: PolyLine,
}
pub struct Lane {
pub id: LaneID,
pub index: usize,
pub speed: Speed,
pub length: Distance,
pub width: Distance,
pub center_line: PolyLine,
pub allow: Vec<VehicleClass>,
}
pub struct InternalEdge {
pub id: EdgeID,
pub lanes: Vec<InternalLane>,
}
pub struct InternalLane {
pub id: InternalLaneID,
pub index: usize,
pub speed: Speed,
pub length: Distance,
pub center_line: Option<PolyLine>,
pub allow: Vec<VehicleClass>,
}
pub struct Junction {
pub id: NodeID,
pub junction_type: String,
pub pt: Pt2D,
pub incoming_lanes: Vec<LaneID>,
pub internal_lanes: Vec<InternalLaneID>,
pub shape: Polygon,
}
#[derive(PartialEq)]
pub enum VehicleClass {
Pedestrian,
Bicycle,
RailUrban,
Other(String),
}