mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 09:24:26 +03:00
Make the map_editor read .osm directly
This commit is contained in:
parent
15b154aa23
commit
2c0334a37d
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2109,6 +2109,7 @@ dependencies = [
|
||||
"aabb-quadtree",
|
||||
"abstio",
|
||||
"abstutil",
|
||||
"convert_osm",
|
||||
"geom",
|
||||
"log",
|
||||
"map_gui",
|
||||
|
@ -12,6 +12,7 @@ wasm = ["widgetry/wasm-backend"]
|
||||
aabb-quadtree = "0.1.0"
|
||||
abstio = { path = "../abstio" }
|
||||
abstutil = { path = "../abstutil" }
|
||||
convert_osm = { path = "../convert_osm" }
|
||||
geom = { path = "../geom" }
|
||||
log = "0.4.14"
|
||||
map_gui = { path = "../map_gui", features=["native"] }
|
||||
|
@ -52,9 +52,36 @@ impl Model {
|
||||
let mut timer = Timer::new("import map");
|
||||
let mut model = Model::blank();
|
||||
model.include_bldgs = include_bldgs;
|
||||
model.map = abstio::read_binary(path, &mut timer);
|
||||
model.intersection_geom = intersection_geom;
|
||||
|
||||
model.map = if path.ends_with(".osm") {
|
||||
convert_osm::convert(
|
||||
convert_osm::Options {
|
||||
name: MapName::new("zz", "oneshot", &abstutil::basename(&path)),
|
||||
osm_input: path,
|
||||
clip: None,
|
||||
map_config: map_model::MapConfig {
|
||||
driving_side: map_model::DrivingSide::Right,
|
||||
bikes_can_use_bus_lanes: true,
|
||||
inferred_sidewalks: true,
|
||||
separate_cycleways: false,
|
||||
street_parking_spot_length: Distance::meters(8.0),
|
||||
},
|
||||
onstreet_parking: convert_osm::OnstreetParking::JustOSM,
|
||||
public_offstreet_parking: convert_osm::PublicOffstreetParking::None,
|
||||
private_offstreet_parking: convert_osm::PrivateOffstreetParking::FixedPerBldg(
|
||||
0,
|
||||
),
|
||||
elevation: None,
|
||||
include_railroads: true,
|
||||
extra_buildings: None,
|
||||
},
|
||||
&mut timer,
|
||||
)
|
||||
} else {
|
||||
abstio::read_binary(path, &mut timer)
|
||||
};
|
||||
|
||||
if model.include_bldgs {
|
||||
for id in model.map.buildings.keys().cloned().collect::<Vec<_>>() {
|
||||
model.bldg_added(id, ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user