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 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.
|
- 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.
|
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:
|
- 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
|
- 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).
|
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
|
class OsmIDTyped
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
enum class Type : uint8_t
|
||||||
|
{
|
||||||
|
Unknown = 0,
|
||||||
|
Node,
|
||||||
|
Way,
|
||||||
|
Relation
|
||||||
|
};
|
||||||
|
|
||||||
using HashType = std::uint64_t;
|
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
|
// check if type value not above type size bound
|
||||||
BOOST_ASSERT(id_ < (std::uint64_t(1) << 56));
|
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); }
|
inline HashType Hash() const { return (std::uint64_t(id) | std::uint64_t(type) << 56); }
|
||||||
|
|
||||||
std::uint64_t GetID() const { return id; }
|
std::uint64_t GetID() const { return id; }
|
||||||
std::uint8_t GetType() const { return type; }
|
Type GetType() const { return type; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::uint64_t id : 56;
|
std::uint64_t id : 56;
|
||||||
std::uint8_t type;
|
Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
||||||
|
@ -353,7 +353,25 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
|
|||||||
osmium::item_type GetItemType() const { return item_type; }
|
osmium::item_type GetItemType() const { return item_type; }
|
||||||
osmium::object_id_type GetId() const { return id; }
|
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;
|
std::string role;
|
||||||
osmium::item_type item_type;
|
osmium::item_type item_type;
|
||||||
@ -804,7 +822,7 @@ void Sol2ScriptingEnvironment::ProcessElements(
|
|||||||
local_context.properties.call_tagless_node_function))
|
local_context.properties.call_tagless_node_function))
|
||||||
{
|
{
|
||||||
const osmium::Node &node = static_cast<const osmium::Node &>(*entity);
|
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));
|
local_context.ProcessNode(node, result_node, relations.Get(id));
|
||||||
}
|
}
|
||||||
resulting_nodes.push_back(std::pair<const osmium::Node &, ExtractionNode>(
|
resulting_nodes.push_back(std::pair<const osmium::Node &, ExtractionNode>(
|
||||||
@ -815,7 +833,7 @@ void Sol2ScriptingEnvironment::ProcessElements(
|
|||||||
if (local_context.has_way_function)
|
if (local_context.has_way_function)
|
||||||
{
|
{
|
||||||
const osmium::Way &way = static_cast<const osmium::Way &>(*entity);
|
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));
|
local_context.ProcessWay(way, result_way, relations.Get(id));
|
||||||
}
|
}
|
||||||
resulting_ways.push_back(std::pair<const osmium::Way &, ExtractionWay>(
|
resulting_ways.push_back(std::pair<const osmium::Way &, ExtractionWay>(
|
||||||
|
Loading…
Reference in New Issue
Block a user