a big cutover -- synthetic model is just a thin wrapper on a raw_data map. mostly everything works!

This commit is contained in:
Dustin Carlino 2019-09-17 12:55:33 -07:00
parent 83834f7d40
commit 33ab7d4553
4 changed files with 455 additions and 574 deletions

View File

@ -10,11 +10,11 @@ pub fn get_lane_types(
parking_lane_back: bool,
) -> (Vec<LaneType>, Vec<LaneType>) {
// The raw_data might come from the synthetic map editor.
if let Some(s) = osm_tags.get("synthetic_lanes") {
if let Some(s) = osm_tags.get("abst:synthetic_lanes") {
if let Some(spec) = RoadSpec::parse(s.to_string()) {
return (spec.fwd, spec.back);
} else {
panic!("Bad synthetic_lanes RoadSpec: {}", s);
panic!("Bad abst:synthetic_lanes RoadSpec: {}", s);
}
}

View File

@ -512,9 +512,9 @@ impl Map {
continue;
}
let r = self.get_parent(l.id);
if (r.is_forwards(l.id) && r.osm_tags.get("fwd_label") == Some(&label.to_string()))
if (r.is_forwards(l.id) && r.osm_tags.get("abst:fwd_label") == Some(&label.to_string()))
|| (r.is_backwards(l.id)
&& r.osm_tags.get("back_label") == Some(&label.to_string()))
&& r.osm_tags.get("abst:back_label") == Some(&label.to_string()))
{
return l;
}
@ -528,9 +528,9 @@ impl Map {
continue;
}
let r = self.get_parent(l.id);
if (r.is_forwards(l.id) && r.osm_tags.get("fwd_label") == Some(&label.to_string()))
if (r.is_forwards(l.id) && r.osm_tags.get("abst:fwd_label") == Some(&label.to_string()))
|| (r.is_backwards(l.id)
&& r.osm_tags.get("back_label") == Some(&label.to_string()))
&& r.osm_tags.get("abst:back_label") == Some(&label.to_string()))
{
let actual_spots = l.number_parking_spots();
if expected_spots != actual_spots {

View File

@ -31,7 +31,7 @@ impl UI {
let model = if let Some(path) = load {
Model::import(path, exclude_bldgs, ctx.prerender)
} else {
Model::new()
Model::blank()
};
UI {
model,
@ -113,7 +113,7 @@ impl GUI for UI {
State::EditingRoad(id, ref mut wizard) => {
if let Some(s) = wizard
.wrap(ctx)
.input_string_prefilled("Specify the lanes", self.model.get_lanes(id))
.input_string_prefilled("Specify the lanes", self.model.get_road_spec(id))
{
self.model.edit_lanes(id, s, ctx.prerender);
self.state = State::Viewing;
@ -125,7 +125,7 @@ impl GUI for UI {
}
State::SavingModel(ref mut wizard) => {
if let Some(name) = wizard.wrap(ctx).input_string("Name the synthetic map") {
self.model.name = Some(name);
self.model.map.name = name;
self.model.export();
self.state = State::Viewing;
} else if wizard.aborted() {
@ -174,7 +174,7 @@ impl GUI for UI {
} else if ctx.input.unimportant_key_pressed(Key::Escape, "quit") {
process::exit(0);
} else if ctx.input.key_pressed(Key::S, "save") {
if self.model.name.is_some() {
if self.model.map.name != "" {
self.model.export();
} else {
self.state = State::SavingModel(Wizard::new());

File diff suppressed because it is too large Load Diff