Fix formatting
This commit is contained in:
parent
4e5f74aebe
commit
4b8daac104
@ -21,18 +21,12 @@ struct ExtractionRelation
|
||||
class OsmIDTyped
|
||||
{
|
||||
public:
|
||||
OsmIDTyped(osmium::object_id_type _id, osmium::item_type _type)
|
||||
: id(_id), type(_type)
|
||||
{
|
||||
}
|
||||
OsmIDTyped(osmium::object_id_type _id, osmium::item_type _type) : id(_id), type(_type) {}
|
||||
|
||||
std::uint64_t GetID() const { return std::uint64_t(id); }
|
||||
osmium::item_type GetType() const { return type; }
|
||||
|
||||
std::uint64_t Hash() const
|
||||
{
|
||||
return id ^ (static_cast<std::uint64_t>(type) << 56);
|
||||
}
|
||||
std::uint64_t Hash() const { return id ^ (static_cast<std::uint64_t>(type) << 56); }
|
||||
|
||||
private:
|
||||
osmium::object_id_type id;
|
||||
@ -42,10 +36,7 @@ struct ExtractionRelation
|
||||
using AttributesList = std::vector<std::pair<std::string, std::string>>;
|
||||
using MembersRolesList = std::vector<std::pair<std::uint64_t, std::string>>;
|
||||
|
||||
explicit ExtractionRelation(const OsmIDTyped & _id)
|
||||
: id(_id)
|
||||
{
|
||||
}
|
||||
explicit ExtractionRelation(const OsmIDTyped &_id) : id(_id) {}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
@ -56,9 +47,7 @@ struct ExtractionRelation
|
||||
const char *GetAttr(const std::string &attr) const
|
||||
{
|
||||
auto it = std::lower_bound(
|
||||
attributes.begin(),
|
||||
attributes.end(),
|
||||
std::make_pair(attr, std::string()));
|
||||
attributes.begin(), attributes.end(), std::make_pair(attr, std::string()));
|
||||
|
||||
if (it != attributes.end() && (*it).first == attr)
|
||||
return (*it).second.c_str();
|
||||
@ -81,9 +70,7 @@ struct ExtractionRelation
|
||||
{
|
||||
const auto hash = member_id.Hash();
|
||||
auto it = std::lower_bound(
|
||||
members_role.begin(),
|
||||
members_role.end(),
|
||||
std::make_pair(hash, std::string()));
|
||||
members_role.begin(), members_role.end(), std::make_pair(hash, std::string()));
|
||||
|
||||
if (it != members_role.end() && (*it).first == hash)
|
||||
return (*it).second.c_str();
|
||||
@ -144,8 +131,7 @@ class ExtractionRelationContainer
|
||||
(void)res; // prevent unused warning in release
|
||||
}
|
||||
|
||||
auto MergeRefMap = [&](RelationRefMap & source, RelationRefMap & target)
|
||||
{
|
||||
auto MergeRefMap = [&](RelationRefMap &source, RelationRefMap &target) {
|
||||
for (auto it : source)
|
||||
{
|
||||
auto &v = target[it.first];
|
||||
@ -158,15 +144,12 @@ class ExtractionRelationContainer
|
||||
MergeRefMap(other.rel_refs, rel_refs);
|
||||
}
|
||||
|
||||
std::size_t GetRelationsNum() const
|
||||
{
|
||||
return relations_data.size();
|
||||
}
|
||||
std::size_t GetRelationsNum() const { return relations_data.size(); }
|
||||
|
||||
const RelationIDList &GetRelations(const OsmIDTyped &member_id) const
|
||||
{
|
||||
auto getFromMap = [this](std::uint64_t id, const RelationRefMap & map) -> const RelationIDList &
|
||||
{
|
||||
auto getFromMap = [this](std::uint64_t id,
|
||||
const RelationRefMap &map) -> const RelationIDList & {
|
||||
auto it = map.find(id);
|
||||
if (it != map.end())
|
||||
return it->second;
|
||||
@ -196,7 +179,8 @@ class ExtractionRelationContainer
|
||||
{
|
||||
auto it = relations_data.find(rel_id.GetID());
|
||||
if (it == relations_data.end())
|
||||
throw osrm::util::exception("Can't find relation data for " + std::to_string(rel_id.GetID()));
|
||||
throw osrm::util::exception("Can't find relation data for " +
|
||||
std::to_string(rel_id.GetID()));
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ class ScriptingEnvironment
|
||||
virtual void ProcessTurn(ExtractionTurn &turn) = 0;
|
||||
virtual void ProcessSegment(ExtractionSegment &segment) = 0;
|
||||
|
||||
virtual void ProcessElements(
|
||||
const osmium::memory::Buffer &buffer,
|
||||
virtual void
|
||||
ProcessElements(const osmium::memory::Buffer &buffer,
|
||||
const RestrictionParser &restriction_parser,
|
||||
const ExtractionRelationContainer &relations,
|
||||
std::vector<std::pair<const osmium::Node &, ExtractionNode>> &resulting_nodes,
|
||||
|
@ -85,8 +85,8 @@ class Sol2ScriptingEnvironment final : public ScriptingEnvironment
|
||||
void ProcessTurn(ExtractionTurn &turn) override;
|
||||
void ProcessSegment(ExtractionSegment &segment) override;
|
||||
|
||||
void ProcessElements(
|
||||
const osmium::memory::Buffer &buffer,
|
||||
void
|
||||
ProcessElements(const osmium::memory::Buffer &buffer,
|
||||
const RestrictionParser &restriction_parser,
|
||||
const ExtractionRelationContainer &relations,
|
||||
std::vector<std::pair<const osmium::Node &, ExtractionNode>> &resulting_nodes,
|
||||
|
@ -494,7 +494,9 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||
const auto &rel = static_cast<const osmium::Relation &>(*entity);
|
||||
|
||||
const char *rel_type = rel.get_value_by_key("type");
|
||||
if (!rel_type || !std::binary_search(relation_types.begin(), relation_types.end(), std::string(rel_type)))
|
||||
if (!rel_type ||
|
||||
!std::binary_search(
|
||||
relation_types.begin(), relation_types.end(), std::string(rel_type)))
|
||||
continue;
|
||||
|
||||
ExtractionRelation extracted_rel({rel.id(), osmium::item_type::relation});
|
||||
@ -515,7 +517,8 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||
|
||||
unsigned number_of_relations = 0;
|
||||
tbb::filter_t<std::shared_ptr<ExtractionRelationContainer>, void> buffer_storage_relation(
|
||||
tbb::filter::serial_in_order, [&](const std::shared_ptr<ExtractionRelationContainer> parsed_relations) {
|
||||
tbb::filter::serial_in_order,
|
||||
[&](const std::shared_ptr<ExtractionRelationContainer> parsed_relations) {
|
||||
|
||||
number_of_relations += parsed_relations->GetRelationsNum();
|
||||
relations.Merge(std::move(*parsed_relations));
|
||||
@ -536,8 +539,10 @@ Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||
|
||||
{ // Nodes and ways reading pipeline
|
||||
util::Log() << "Parse ways and nodes ...";
|
||||
osmium::io::Reader reader(
|
||||
input_file, osmium::osm_entity_bits::node | osmium::osm_entity_bits::way | osmium::osm_entity_bits::relation, read_meta);
|
||||
osmium::io::Reader reader(input_file,
|
||||
osmium::osm_entity_bits::node | osmium::osm_entity_bits::way |
|
||||
osmium::osm_entity_bits::relation,
|
||||
read_meta);
|
||||
|
||||
const auto pipeline =
|
||||
scripting_environment.HasLocationDependentData() && config.use_locations_cache
|
||||
|
@ -323,7 +323,6 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||
return boost::apply_visitor(to_lua_object(context.state), value);
|
||||
});
|
||||
|
||||
|
||||
context.state.new_usertype<osmium::Node>("Node",
|
||||
"location",
|
||||
&osmium::Node::location,
|
||||
|
@ -35,8 +35,7 @@ class MockScriptingEnvironment : public extractor::ScriptingEnvironment
|
||||
void ProcessTurn(extractor::ExtractionTurn &) override final {}
|
||||
void ProcessSegment(extractor::ExtractionSegment &) override final {}
|
||||
|
||||
void ProcessElements(
|
||||
const osmium::memory::Buffer &,
|
||||
void ProcessElements(const osmium::memory::Buffer &,
|
||||
const extractor::RestrictionParser &,
|
||||
const extractor::ExtractionRelationContainer &,
|
||||
std::vector<std::pair<const osmium::Node &, extractor::ExtractionNode>> &,
|
||||
|
Loading…
Reference in New Issue
Block a user