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
use serde::Deserialize;

use abstutil::{CmdArgs, Timer};
use map_model::Map;
use sim::{ExternalPerson, Scenario};

fn main() {
    let mut args = CmdArgs::new();
    let map = args.required("--map");
    let input = args.required("--input");
    args.done();

    let mut timer = Timer::new("import traffic demand data");
    let map = Map::new(map, &mut timer);
    let input: Input = abstio::read_json(input, &mut timer);

    let mut s = Scenario::empty(&map, &input.scenario_name);
    // Include all buses/trains
    s.only_seed_buses = None;
    s.people = ExternalPerson::import(&map, input.people).unwrap();
    s.save();
}

#[derive(Deserialize)]
struct Input {
    scenario_name: String,
    people: Vec<ExternalPerson>,
}