mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 07:25:47 +03:00
Refactor convert_osm::Options default settings
This commit is contained in:
parent
0da4d75b69
commit
360870a72c
@ -43,6 +43,29 @@ pub struct Options {
|
|||||||
pub elevation: bool,
|
pub elevation: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Options {
|
||||||
|
pub fn default_for_side(driving_side: raw_map::DrivingSide) -> Self {
|
||||||
|
Self {
|
||||||
|
map_config: MapConfig {
|
||||||
|
driving_side,
|
||||||
|
bikes_can_use_bus_lanes: true,
|
||||||
|
inferred_sidewalks: true,
|
||||||
|
street_parking_spot_length: Distance::meters(8.0),
|
||||||
|
turn_on_red: true,
|
||||||
|
},
|
||||||
|
onstreet_parking: OnstreetParking::JustOSM,
|
||||||
|
public_offstreet_parking: PublicOffstreetParking::None,
|
||||||
|
private_offstreet_parking: PrivateOffstreetParking::FixedPerBldg(1),
|
||||||
|
include_railroads: true,
|
||||||
|
extra_buildings: None,
|
||||||
|
skip_local_roads: false,
|
||||||
|
filter_crosswalks: false,
|
||||||
|
gtfs_url: None,
|
||||||
|
elevation: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// What roads will have on-street parking lanes? Data from
|
/// What roads will have on-street parking lanes? Data from
|
||||||
/// <https://wiki.openstreetmap.org/wiki/Key:parking:lane> is always used if available.
|
/// <https://wiki.openstreetmap.org/wiki/Key:parking:lane> is always used if available.
|
||||||
#[derive(Clone, Serialize, Deserialize)]
|
#[derive(Clone, Serialize, Deserialize)]
|
||||||
|
@ -13,7 +13,6 @@ use structopt::StructOpt;
|
|||||||
|
|
||||||
use abstio::{CityName, MapName};
|
use abstio::{CityName, MapName};
|
||||||
use abstutil::Timer;
|
use abstutil::Timer;
|
||||||
use geom::Distance;
|
|
||||||
use map_model::RawToMapOptions;
|
use map_model::RawToMapOptions;
|
||||||
|
|
||||||
use self::configuration::{load_configuration, ImporterConfiguration};
|
use self::configuration::{load_configuration, ImporterConfiguration};
|
||||||
@ -58,29 +57,13 @@ pub async fn oneshot(
|
|||||||
let mut timer = abstutil::Timer::new("oneshot");
|
let mut timer = abstutil::Timer::new("oneshot");
|
||||||
println!("- Running convert_osm on {}", osm_path);
|
println!("- Running convert_osm on {}", osm_path);
|
||||||
let name = abstutil::basename(&osm_path);
|
let name = abstutil::basename(&osm_path);
|
||||||
|
let mut options = convert_osm::Options::default_for_side(driving_side);
|
||||||
|
options.filter_crosswalks = filter_crosswalks;
|
||||||
let raw = convert_osm::convert(
|
let raw = convert_osm::convert(
|
||||||
osm_path,
|
osm_path,
|
||||||
MapName::new("zz", "oneshot", &name),
|
MapName::new("zz", "oneshot", &name),
|
||||||
clip,
|
clip,
|
||||||
convert_osm::Options {
|
options,
|
||||||
map_config: map_model::MapConfig {
|
|
||||||
driving_side,
|
|
||||||
bikes_can_use_bus_lanes: true,
|
|
||||||
inferred_sidewalks: true,
|
|
||||||
street_parking_spot_length: Distance::meters(8.0),
|
|
||||||
turn_on_red: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
onstreet_parking: convert_osm::OnstreetParking::JustOSM,
|
|
||||||
public_offstreet_parking: convert_osm::PublicOffstreetParking::None,
|
|
||||||
private_offstreet_parking: convert_osm::PrivateOffstreetParking::FixedPerBldg(1),
|
|
||||||
include_railroads: true,
|
|
||||||
extra_buildings: None,
|
|
||||||
skip_local_roads: false,
|
|
||||||
filter_crosswalks,
|
|
||||||
gtfs_url: None,
|
|
||||||
elevation: false,
|
|
||||||
},
|
|
||||||
&mut timer,
|
&mut timer,
|
||||||
);
|
);
|
||||||
// Often helpful to save intermediate representation in case user wants to load into map_editor
|
// Often helpful to save intermediate representation in case user wants to load into map_editor
|
||||||
|
@ -8,7 +8,7 @@ use rand::seq::SliceRandom;
|
|||||||
|
|
||||||
use abstio::{CityName, MapName};
|
use abstio::{CityName, MapName};
|
||||||
use abstutil::Timer;
|
use abstutil::Timer;
|
||||||
use geom::{Distance, Duration, Time};
|
use geom::{Duration, Time};
|
||||||
use map_model::{IntersectionID, LaneType, Map, Perimeter, RoadID};
|
use map_model::{IntersectionID, LaneType, Map, Perimeter, RoadID};
|
||||||
use sim::{AlertHandler, PrebakeSummary, Sim, SimFlags, SimOptions};
|
use sim::{AlertHandler, PrebakeSummary, Sim, SimFlags, SimOptions};
|
||||||
use synthpop::{IndividTrip, PersonSpec, Scenario, TripEndpoint, TripMode, TripPurpose};
|
use synthpop::{IndividTrip, PersonSpec, Scenario, TripEndpoint, TripMode, TripPurpose};
|
||||||
@ -59,24 +59,7 @@ fn import_map(path: String) -> Map {
|
|||||||
path,
|
path,
|
||||||
name,
|
name,
|
||||||
clip,
|
clip,
|
||||||
convert_osm::Options {
|
convert_osm::Options::default_for_side(map_model::DrivingSide::Right),
|
||||||
map_config: map_model::MapConfig {
|
|
||||||
driving_side: map_model::DrivingSide::Right,
|
|
||||||
bikes_can_use_bus_lanes: true,
|
|
||||||
inferred_sidewalks: true,
|
|
||||||
street_parking_spot_length: Distance::meters(8.0),
|
|
||||||
turn_on_red: false,
|
|
||||||
},
|
|
||||||
onstreet_parking: convert_osm::OnstreetParking::JustOSM,
|
|
||||||
public_offstreet_parking: convert_osm::PublicOffstreetParking::None,
|
|
||||||
private_offstreet_parking: convert_osm::PrivateOffstreetParking::FixedPerBldg(0),
|
|
||||||
include_railroads: true,
|
|
||||||
extra_buildings: None,
|
|
||||||
skip_local_roads: false,
|
|
||||||
filter_crosswalks: false,
|
|
||||||
gtfs_url: None,
|
|
||||||
elevation: false,
|
|
||||||
},
|
|
||||||
&mut timer,
|
&mut timer,
|
||||||
);
|
);
|
||||||
Map::create_from_raw(raw, map_model::RawToMapOptions::default(), &mut timer)
|
Map::create_from_raw(raw, map_model::RawToMapOptions::default(), &mut timer)
|
||||||
|
Loading…
Reference in New Issue
Block a user