Review fixes
This commit is contained in:
parent
84cb7865ab
commit
ff3b398e23
@ -14,6 +14,7 @@
|
||||
- New property for profile table: `excludable` that can be used to configure which classes are excludable at query time.
|
||||
- New optional property for profile table: `classes` that allows you to specify which classes you expect to be used.
|
||||
We recommend this for better error messages around classes, otherwise the possible class names are infered automatically.
|
||||
- New function to support relations: `process_relation`. Read more in profiles documentation.
|
||||
- Traffic:
|
||||
- If traffic data files contain an empty 4th column, they will update edge durations but not modify the edge weight. This is useful for
|
||||
updating ETAs returned, without changing route selection (for example, in a distance-based profile with traffic data loaded).
|
||||
|
@ -11,9 +11,17 @@ namespace util
|
||||
class OsmIDTyped
|
||||
{
|
||||
public:
|
||||
enum class Type : uint8_t
|
||||
{
|
||||
Unknown = 0,
|
||||
Node,
|
||||
Way,
|
||||
Relation
|
||||
};
|
||||
|
||||
using HashType = std::uint64_t;
|
||||
|
||||
OsmIDTyped(std::uint64_t id_, std::uint8_t type_) : id(id_), type(type_)
|
||||
OsmIDTyped(std::uint64_t id_, Type type_) : id(id_), type(type_)
|
||||
{
|
||||
// check if type value not above type size bound
|
||||
BOOST_ASSERT(id_ < (std::uint64_t(1) << 56));
|
||||
@ -25,11 +33,11 @@ class OsmIDTyped
|
||||
inline HashType Hash() const { return (std::uint64_t(id) | std::uint64_t(type) << 56); }
|
||||
|
||||
std::uint64_t GetID() const { return id; }
|
||||
std::uint8_t GetType() const { return type; }
|
||||
Type GetType() const { return type; }
|
||||
|
||||
private:
|
||||
std::uint64_t id : 56;
|
||||
std::uint8_t type;
|
||||
Type type;
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
|
@ -353,7 +353,25 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
||||
osmium::item_type GetItemType() const { return item_type; }
|
||||
osmium::object_id_type GetId() const { return id; }
|
||||
|
||||
util::OsmIDTyped ref() const { return util::OsmIDTyped(id, std::uint8_t(item_type)); }
|
||||
util::OsmIDTyped ref() const
|
||||
{
|
||||
switch (item_type)
|
||||
{
|
||||
case osmium::item_type::node:
|
||||
return util::OsmIDTyped(id, util::OsmIDTyped::Type::Node);
|
||||
|
||||
case osmium::item_type::way:
|
||||
return util::OsmIDTyped(id, util::OsmIDTyped::Type::Way);
|
||||
|
||||
case osmium::item_type::relation:
|
||||
return util::OsmIDTyped(id, util::OsmIDTyped::Type::Relation);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return util::OsmIDTyped(id, util::OsmIDTyped::Type::Unknown);
|
||||
}
|
||||
|
||||
std::string role;
|
||||
osmium::item_type item_type;
|
||||
@ -804,7 +822,7 @@ void Sol2ScriptingEnvironment::ProcessElements(
|
||||
local_context.properties.call_tagless_node_function))
|
||||
{
|
||||
const osmium::Node &node = static_cast<const osmium::Node &>(*entity);
|
||||
const util::OsmIDTyped id(node.id(), std::uint8_t(node.type()));
|
||||
const util::OsmIDTyped id(node.id(), util::OsmIDTyped::Type::Node);
|
||||
local_context.ProcessNode(node, result_node, relations.Get(id));
|
||||
}
|
||||
resulting_nodes.push_back(std::pair<const osmium::Node &, ExtractionNode>(
|
||||
@ -815,7 +833,7 @@ void Sol2ScriptingEnvironment::ProcessElements(
|
||||
if (local_context.has_way_function)
|
||||
{
|
||||
const osmium::Way &way = static_cast<const osmium::Way &>(*entity);
|
||||
const util::OsmIDTyped id(way.id(), std::uint8_t(way.type()));
|
||||
const util::OsmIDTyped id(way.id(), util::OsmIDTyped::Type::Way);
|
||||
local_context.ProcessWay(way, result_way, relations.Get(id));
|
||||
}
|
||||
resulting_ways.push_back(std::pair<const osmium::Way &, ExtractionWay>(
|
||||
|
Loading…
Reference in New Issue
Block a user