Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Jun 6, 2024
1 parent b52862f commit 27bda30
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions include/osr/extract/tags.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ struct tags {
if (highway_ == "elevator") {
is_elevator_ = true;
}
if (highway_ == "bus_stop") {
is_platform_ = true;
}
break;
case cista::hash("level"): {
has_level_ = true;
Expand Down
9 changes: 7 additions & 2 deletions include/osr/platforms.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ struct platforms {
mm("platform_ref_index.bin")}},
platform_names_{{mm_vec<std::uint64_t>{mm("platform_names_idx_0.bin")},
mm_vec<std::uint64_t>{mm("platform_names_idx_1.bin")}},
mm_vec<char>{mm("platform_names_data.bin")}} {}
mm_vec<char>{mm("platform_names_data.bin")}},
platform_pos_{
mm_vec<pair<osm_node_idx_t, point>>{mm("platform_pos.bin")}} {}

~platforms() {
if (rtree_ != nullptr) {
Expand Down Expand Up @@ -135,7 +137,9 @@ struct platforms {
return std::visit(
utl::overloaded{
[&](way_idx_t x) { return w.r_->way_properties_[x].from_level(); },
[&](node_idx_t x) { return w.r_->node_properties_[x].from_level(); }},
[&](node_idx_t x) {
return w.r_->node_properties_[x].from_level();
}},
to_ref(platform_ref_[i][0]));
}

Expand Down Expand Up @@ -213,6 +217,7 @@ struct platforms {
mm_bitvec<way_idx_t> way_is_platform_;
mm_paged_vecvec<platform_idx_t, ref_value_t> platform_ref_;
mm_nvec<platform_idx_t, char, 2> platform_names_;
mm_vec<pair<osm_node_idx_t, point>> platform_pos_;

vecvec<std::uint32_t, char> strings_;

Expand Down
11 changes: 8 additions & 3 deletions src/extract.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ struct node_handler : public osm::handler::Handler {
platforms* platforms,
std::vector<resolved_restriction>& r,
hash_map<osm_node_idx_t, level_bits_t> const& elevator_nodes)
: platforms_{platforms}, r_{r}, w_{w}, elevator_nodes_{elevator_nodes} {
: platforms_{platforms}, r_{r}, w_{w}, elevator_nodes_{elevator_nodes} {
w_.r_->node_properties_.resize(w_.n_nodes());
}

Expand Down Expand Up @@ -334,7 +334,7 @@ struct node_handler : public osm::handler::Handler {
};

struct mark_inaccessible_handler : public osm::handler::Handler {
explicit mark_inaccessible_handler(ways& w) : w_{w} {}
explicit mark_inaccessible_handler(platforms* pl, ways& w) : pl_{pl}, w_{w} {}

void node(osm::Node const& n) {
auto const t = tags{n};
Expand All @@ -345,8 +345,13 @@ struct mark_inaccessible_handler : public osm::handler::Handler {
if (!accessible || t.is_elevator_ || t.is_platform_) {
w_.node_way_counter_.increment(n.positive_id());
}
if (t.is_platform_ && pl_ != nullptr) {
pl_->platform_pos_.emplace_back(osm_node_idx_t{n.positive_id()},
point::from_location(n.location()));
}
}

platforms* pl_;
ways& w_;
};

Expand Down Expand Up @@ -418,7 +423,7 @@ void extract(bool const with_platforms,

auto node_idx_builder = tiles::hybrid_node_idx_builder{node_idx};

auto inaccessible_handler = mark_inaccessible_handler{w};
auto inaccessible_handler = mark_inaccessible_handler{pl.get(), w};
auto rel_ways_h = rel_ways_handler{pl.get(), rel_ways};
auto reader = osm_io::Reader{input_file, osm_eb::node | osm_eb::relation,
osmium::io::read_meta::no};
Expand Down

0 comments on commit 27bda30

Please sign in to comment.