Replace optional<EdgeWeight> with constant value
This commit is contained in:
parent
f65958fc14
commit
84845ffaa6
@ -10,8 +10,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
@ -41,8 +39,8 @@ class CompressedEdgeContainer
|
||||
const EdgeDuration duration2,
|
||||
// node-penalties can be added before/or after the traversal of an edge which
|
||||
// depends on whether we traverse the link forwards or backwards.
|
||||
const boost::optional<EdgeWeight> node_weight_penalty = boost::none,
|
||||
const boost::optional<EdgeDuration> node_duration_penalty = boost::none);
|
||||
const EdgeWeight node_weight_penalty = INVALID_EDGE_WEIGHT,
|
||||
const EdgeDuration node_duration_penalty = MAXIMAL_EDGE_DURATION);
|
||||
|
||||
void AddUncompressedEdge(const EdgeID edge_id,
|
||||
const NodeID target_node,
|
||||
|
@ -112,8 +112,8 @@ void CompressedEdgeContainer::CompressEdge(
|
||||
const EdgeWeight weight2,
|
||||
const EdgeDuration duration1,
|
||||
const EdgeDuration duration2,
|
||||
const boost::optional<EdgeWeight> node_weight_penalty,
|
||||
const boost::optional<EdgeDuration> node_duration_penalty)
|
||||
const EdgeWeight node_weight_penalty,
|
||||
const EdgeDuration node_duration_penalty)
|
||||
{
|
||||
// remove super-trivial geometries
|
||||
BOOST_ASSERT(SPECIAL_EDGEID != edge_id_1);
|
||||
@ -169,10 +169,10 @@ void CompressedEdgeContainer::CompressEdge(
|
||||
|
||||
// if the via-node offers a penalty, we add the weight of the penalty as an artificial
|
||||
// segment that references SPECIAL_NODEID
|
||||
if (node_weight_penalty && node_duration_penalty)
|
||||
if (node_weight_penalty != INVALID_EDGE_WEIGHT && node_duration_penalty != MAXIMAL_EDGE_DURATION)
|
||||
{
|
||||
edge_bucket_list1.emplace_back(OnewayCompressedEdge{
|
||||
via_node_id, ClipWeight(*node_weight_penalty), ClipDuration(*node_duration_penalty)});
|
||||
via_node_id, ClipWeight(node_weight_penalty), ClipDuration(node_duration_penalty)});
|
||||
}
|
||||
|
||||
if (HasEntryForID(edge_id_2))
|
||||
|
@ -211,8 +211,8 @@ void GraphCompressor::Compress(
|
||||
// doesn't have access to.
|
||||
*/
|
||||
const bool has_node_penalty = traffic_signals.find(node_v) != traffic_signals.end();
|
||||
boost::optional<EdgeDuration> node_duration_penalty = boost::none;
|
||||
boost::optional<EdgeWeight> node_weight_penalty = boost::none;
|
||||
EdgeDuration node_duration_penalty = MAXIMAL_EDGE_DURATION;
|
||||
EdgeWeight node_weight_penalty = INVALID_EDGE_WEIGHT;
|
||||
if (has_node_penalty)
|
||||
{
|
||||
// we cannot handle this as node penalty, if it depends on turn direction
|
||||
@ -277,12 +277,12 @@ void GraphCompressor::Compress(
|
||||
graph.GetEdgeData(forward_e1).duration += forward_duration2;
|
||||
graph.GetEdgeData(reverse_e1).duration += reverse_duration2;
|
||||
|
||||
if (node_weight_penalty && node_duration_penalty)
|
||||
if (node_weight_penalty != INVALID_EDGE_WEIGHT && node_duration_penalty != MAXIMAL_EDGE_DURATION)
|
||||
{
|
||||
graph.GetEdgeData(forward_e1).weight += *node_weight_penalty;
|
||||
graph.GetEdgeData(reverse_e1).weight += *node_weight_penalty;
|
||||
graph.GetEdgeData(forward_e1).duration += *node_duration_penalty;
|
||||
graph.GetEdgeData(reverse_e1).duration += *node_duration_penalty;
|
||||
graph.GetEdgeData(forward_e1).weight += node_weight_penalty;
|
||||
graph.GetEdgeData(reverse_e1).weight += node_weight_penalty;
|
||||
graph.GetEdgeData(forward_e1).duration += node_duration_penalty;
|
||||
graph.GetEdgeData(reverse_e1).duration += node_duration_penalty;
|
||||
}
|
||||
|
||||
// extend e1's to targets of e2's
|
||||
|
Loading…
Reference in New Issue
Block a user