This repository has been archived by the owner on Mar 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Split of "#111 Fix lane count calculation" #146
Merged
droogmic
merged 55 commits into
a-b-street:main
from
droogmic:rust_guess_lane_count_source
Apr 25, 2022
Merged
Split of "#111 Fix lane count calculation" #146
droogmic
merged 55 commits into
a-b-street:main
from
droogmic:rust_guess_lane_count_source
Apr 25, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Forward and backward lanes are independently guessed to be half of the lanes, but the tags on the website assume that providing `lanes` and `lanes:backward` is enough.
Co-authored-by: droogmic <droogmic@gmail.com>
Incorporate lanes:both_ways and centre_turn_lanes. Add assumption that oneway=no, lanes=1 means lanes:both_ways=1
Reveals a bunch of failed tests...
…sway and lanes:{bus,psv}
Probably doesn't compile, but close
…tructure. The code is a mess, gesturing generally at the idea, without compiling. I feel like the whole lot should mean close to what it actually says.
This is much closer to something useful. Still doesn't compile.
Conflicts: rust/osm2lanes/src/transform/lanes_to_tags.rs rust/osm2lanes/src/transform/tags_to_lanes/bus.rs rust/osm2lanes/src/transform/tags_to_lanes/mod.rs
each schema parses their own tags, and so we always would want to warn.
Fixing Merge
# Conflicts: # rust/osm2lanes/src/transform/lanes_to_tags/mod.rs # rust/osm2lanes/src/transform/mod.rs # rust/osm2lanes/src/transform/tags_to_lanes/mod.rs # rust/osm2lanes/src/transform/tags_to_lanes/modes/bus.rs # rust/osm2lanes/src/transform/tags_to_lanes/modes/mod.rs
droogmic
commented
Apr 24, 2022
@@ -255,6 +296,7 @@ fn lanes_bus( | |||
Ok(()) | |||
} | |||
|
|||
//noinspection ALL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, this was a side-effect of trying to fix that reported error. Well spotted.
…ss_lane_count_source
BudgieInWA
reviewed
Apr 26, 2022
Comment on lines
215
to
228
// Parse lane count schemas first. | ||
let oneway = Oneway::from( | ||
tags.is_any("oneway", &["yes", "-1"]) || tags.is("junction", "roundabout"), | ||
); | ||
let bus_lane_counts = BusLanesCount::from_tags(tags, locale, oneway, warnings)?; | ||
let centre_turn_lanes = CentreTurnLaneScheme::new(tags, oneway, locale, warnings); | ||
let lanes = Counts::new( | ||
tags, | ||
oneway, | ||
¢re_turn_lanes, | ||
&bus_lane_counts, | ||
locale, | ||
warnings, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the idea that the road builder is responsible for all of this. It's pretty clearly the right spot.
Combined with "builder" in the name, it makes me think of something like this. The call graph becomes the things that describes the dependencies, which is interesting.
struct RoadBuilder {
// ...
pub oneway: Oneway,
pub bus_lane_counts: BusLanesCount,
pub centre_turn_lanes: CentreTurnLaneScheme,
pub lane_counts: Counts,
pub locale: Locale,
warnings: RoadWarnings,
}
impl RoadBuilder {
pub fn from_tags(tags: &Tags, locale: &Locale) -> Result {
let road = Self::local_default(locale);
road.oneway = Oneway::from(tags.is_any("oneway", &["yes", "-1"]) || tags.is("junction", "roundabout"));
road.bus_lane_counts = BusLanesCount::from_tags(tags, &self)?;
road.centre_turn_lanes = CentreTurnLaneScheme::from_tags(tags, &self)?;
road.lane_counts = Counts::from_tags(tags, &self);
}
pub fn add_warning(...){...}
}
// ::default() for everything...
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is what #111 would look like applied to:
This is getting to a reviewable size.