2016-01-11 10:55:22 -05:00
|
|
|
#ifndef NODE_BASED_EDGE_HPP
|
|
|
|
#define NODE_BASED_EDGE_HPP
|
|
|
|
|
2017-06-27 18:01:05 -04:00
|
|
|
#include "extractor/class_data.hpp"
|
2016-01-11 10:55:22 -05:00
|
|
|
#include "extractor/travel_mode.hpp"
|
|
|
|
#include "util/typedefs.hpp"
|
|
|
|
|
2016-06-24 10:06:45 -04:00
|
|
|
#include "extractor/guidance/road_classification.hpp"
|
2016-02-24 04:29:23 -05:00
|
|
|
|
2016-01-11 10:55:22 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace extractor
|
|
|
|
{
|
|
|
|
|
|
|
|
struct NodeBasedEdge
|
|
|
|
{
|
|
|
|
NodeBasedEdge();
|
|
|
|
|
|
|
|
NodeBasedEdge(NodeID source,
|
|
|
|
NodeID target,
|
|
|
|
NodeID name_id,
|
|
|
|
EdgeWeight weight,
|
2017-04-10 15:09:14 -04:00
|
|
|
EdgeDuration duration,
|
2016-01-11 10:55:22 -05:00
|
|
|
bool forward,
|
|
|
|
bool backward,
|
|
|
|
bool roundabout,
|
2016-11-24 07:29:17 -05:00
|
|
|
bool circular,
|
2016-01-11 10:55:22 -05:00
|
|
|
bool startpoint,
|
2017-02-14 06:59:16 -05:00
|
|
|
bool restricted,
|
2016-02-24 04:29:23 -05:00
|
|
|
bool is_split,
|
2017-02-14 06:59:16 -05:00
|
|
|
TravelMode travel_mode,
|
2017-06-27 18:01:05 -04:00
|
|
|
ClassData classes,
|
2016-06-21 04:41:08 -04:00
|
|
|
const LaneDescriptionID lane_description_id,
|
2016-06-24 10:06:45 -04:00
|
|
|
guidance::RoadClassification road_classification);
|
2016-01-11 10:55:22 -05:00
|
|
|
|
|
|
|
bool operator<(const NodeBasedEdge &other) const;
|
|
|
|
|
2017-02-14 06:59:16 -05:00
|
|
|
NodeID source; // 32 4
|
|
|
|
NodeID target; // 32 4
|
|
|
|
NodeID name_id; // 32 4
|
|
|
|
EdgeWeight weight; // 32 4
|
2017-04-10 15:09:14 -04:00
|
|
|
EdgeDuration duration; // 32 4
|
2017-02-14 06:59:16 -05:00
|
|
|
std::uint8_t forward : 1; // 1
|
|
|
|
std::uint8_t backward : 1; // 1
|
|
|
|
std::uint8_t roundabout : 1; // 1
|
|
|
|
std::uint8_t circular : 1; // 1
|
|
|
|
std::uint8_t startpoint : 1; // 1
|
|
|
|
std::uint8_t restricted : 1; // 1
|
|
|
|
std::uint8_t is_split : 1; // 1
|
|
|
|
TravelMode travel_mode : 4; // 4
|
2017-06-27 18:01:05 -04:00
|
|
|
ClassData classes; // 8 1
|
2017-02-14 06:59:16 -05:00
|
|
|
LaneDescriptionID lane_description_id; // 16 2
|
|
|
|
guidance::RoadClassification road_classification; // 16 2
|
2016-01-11 10:55:22 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct NodeBasedEdgeWithOSM : NodeBasedEdge
|
|
|
|
{
|
|
|
|
NodeBasedEdgeWithOSM(OSMNodeID source,
|
|
|
|
OSMNodeID target,
|
|
|
|
NodeID name_id,
|
|
|
|
EdgeWeight weight,
|
2017-04-10 15:09:14 -04:00
|
|
|
EdgeDuration duration,
|
2016-01-11 10:55:22 -05:00
|
|
|
bool forward,
|
|
|
|
bool backward,
|
|
|
|
bool roundabout,
|
2016-11-24 07:29:17 -05:00
|
|
|
bool circular,
|
2016-01-11 10:55:22 -05:00
|
|
|
bool startpoint,
|
2017-02-14 06:59:16 -05:00
|
|
|
bool restricted,
|
2016-02-24 04:29:23 -05:00
|
|
|
bool is_split,
|
2017-02-14 06:59:16 -05:00
|
|
|
TravelMode travel_mode,
|
2017-06-27 18:01:05 -04:00
|
|
|
ClassData classes,
|
2016-06-21 04:41:08 -04:00
|
|
|
const LaneDescriptionID lane_description_id,
|
2016-06-24 10:06:45 -04:00
|
|
|
guidance::RoadClassification road_classification);
|
2016-01-11 10:55:22 -05:00
|
|
|
|
|
|
|
OSMNodeID osm_source_id;
|
|
|
|
OSMNodeID osm_target_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Impl.
|
|
|
|
|
|
|
|
inline NodeBasedEdge::NodeBasedEdge()
|
2016-05-12 12:50:10 -04:00
|
|
|
: source(SPECIAL_NODEID), target(SPECIAL_NODEID), name_id(0), weight(0), duration(0),
|
|
|
|
forward(false), backward(false), roundabout(false), circular(false), startpoint(true),
|
2017-02-14 06:59:16 -05:00
|
|
|
restricted(false), is_split(false), travel_mode(TRAVEL_MODE_INACCESSIBLE),
|
2016-05-12 12:50:10 -04:00
|
|
|
lane_description_id(INVALID_LANE_DESCRIPTIONID)
|
2016-01-11 10:55:22 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline NodeBasedEdge::NodeBasedEdge(NodeID source,
|
|
|
|
NodeID target,
|
|
|
|
NodeID name_id,
|
|
|
|
EdgeWeight weight,
|
2017-04-10 15:09:14 -04:00
|
|
|
EdgeDuration duration,
|
2016-01-11 10:55:22 -05:00
|
|
|
bool forward,
|
|
|
|
bool backward,
|
|
|
|
bool roundabout,
|
2016-11-24 07:29:17 -05:00
|
|
|
bool circular,
|
2016-01-11 10:55:22 -05:00
|
|
|
bool startpoint,
|
2017-02-14 06:59:16 -05:00
|
|
|
bool restricted,
|
2016-02-24 04:29:23 -05:00
|
|
|
bool is_split,
|
2017-02-14 06:59:16 -05:00
|
|
|
TravelMode travel_mode,
|
2017-06-27 18:01:05 -04:00
|
|
|
ClassData classes,
|
2016-06-21 04:41:08 -04:00
|
|
|
const LaneDescriptionID lane_description_id,
|
2016-06-24 10:06:45 -04:00
|
|
|
guidance::RoadClassification road_classification)
|
2016-05-12 12:50:10 -04:00
|
|
|
: source(source), target(target), name_id(name_id), weight(weight), duration(duration),
|
|
|
|
forward(forward), backward(backward), roundabout(roundabout), circular(circular),
|
2017-02-14 06:59:16 -05:00
|
|
|
startpoint(startpoint), restricted(restricted), is_split(is_split), travel_mode(travel_mode),
|
2017-06-27 18:01:05 -04:00
|
|
|
classes(classes), lane_description_id(lane_description_id),
|
|
|
|
road_classification(std::move(road_classification))
|
2016-01-11 10:55:22 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool NodeBasedEdge::operator<(const NodeBasedEdge &other) const
|
|
|
|
{
|
|
|
|
if (source == other.source)
|
|
|
|
{
|
|
|
|
if (target == other.target)
|
|
|
|
{
|
|
|
|
if (weight == other.weight)
|
|
|
|
{
|
|
|
|
return forward && backward && ((!other.forward) || (!other.backward));
|
|
|
|
}
|
|
|
|
return weight < other.weight;
|
|
|
|
}
|
|
|
|
return target < other.target;
|
|
|
|
}
|
|
|
|
return source < other.source;
|
|
|
|
}
|
|
|
|
|
2016-07-26 09:00:58 -04:00
|
|
|
inline NodeBasedEdgeWithOSM::NodeBasedEdgeWithOSM(OSMNodeID source,
|
|
|
|
OSMNodeID target,
|
|
|
|
NodeID name_id,
|
|
|
|
EdgeWeight weight,
|
2017-04-10 15:09:14 -04:00
|
|
|
EdgeDuration duration,
|
2016-07-26 09:00:58 -04:00
|
|
|
bool forward,
|
|
|
|
bool backward,
|
|
|
|
bool roundabout,
|
2016-11-24 07:29:17 -05:00
|
|
|
bool circular,
|
2016-07-26 09:00:58 -04:00
|
|
|
bool startpoint,
|
2017-02-14 06:59:16 -05:00
|
|
|
bool restricted,
|
2016-07-26 09:00:58 -04:00
|
|
|
bool is_split,
|
2017-02-14 06:59:16 -05:00
|
|
|
TravelMode travel_mode,
|
2017-06-27 18:01:05 -04:00
|
|
|
ClassData classes,
|
2016-07-26 09:00:58 -04:00
|
|
|
const LaneDescriptionID lane_description_id,
|
|
|
|
guidance::RoadClassification road_classification)
|
2016-01-11 10:55:22 -05:00
|
|
|
: NodeBasedEdge(SPECIAL_NODEID,
|
|
|
|
SPECIAL_NODEID,
|
|
|
|
name_id,
|
|
|
|
weight,
|
2016-05-12 12:50:10 -04:00
|
|
|
duration,
|
2016-01-11 10:55:22 -05:00
|
|
|
forward,
|
|
|
|
backward,
|
|
|
|
roundabout,
|
2016-11-24 07:29:17 -05:00
|
|
|
circular,
|
2016-01-11 10:55:22 -05:00
|
|
|
startpoint,
|
2017-02-14 06:59:16 -05:00
|
|
|
restricted,
|
2016-02-24 04:29:23 -05:00
|
|
|
is_split,
|
2017-02-14 06:59:16 -05:00
|
|
|
travel_mode,
|
2017-06-27 18:01:05 -04:00
|
|
|
classes,
|
2016-06-21 04:41:08 -04:00
|
|
|
lane_description_id,
|
2016-02-24 04:29:23 -05:00
|
|
|
std::move(road_classification)),
|
2016-01-18 10:54:30 -05:00
|
|
|
osm_source_id(std::move(source)), osm_target_id(std::move(target))
|
2016-01-11 10:55:22 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-05-12 12:50:10 -04:00
|
|
|
static_assert(sizeof(extractor::NodeBasedEdge) == 28,
|
|
|
|
"Size of extractor::NodeBasedEdge type is "
|
|
|
|
"bigger than expected. This will influence "
|
|
|
|
"memory consumption.");
|
|
|
|
|
2016-01-11 10:55:22 -05:00
|
|
|
} // ns extractor
|
|
|
|
} // ns osrm
|
|
|
|
|
|
|
|
#endif /* NODE_BASED_EDGE_HPP */
|