osrm-backend/include/extractor/internal_extractor_edge.hpp

149 lines
4.7 KiB
C++
Raw Normal View History

#ifndef INTERNAL_EXTRACTOR_EDGE_HPP
#define INTERNAL_EXTRACTOR_EDGE_HPP
#include "extractor/node_based_edge.hpp"
2016-05-27 15:05:04 -04:00
#include "extractor/travel_mode.hpp"
#include "util/typedefs.hpp"
#include <boost/assert.hpp>
#include "extractor/guidance/road_classification.hpp"
2016-12-06 10:14:25 -05:00
#include "extractor/guidance/turn_lane_types.hpp"
2016-01-02 11:13:44 -05:00
#include "osrm/coordinate.hpp"
#include <utility>
2014-11-24 11:57:01 -05:00
2016-01-05 10:51:13 -05:00
namespace osrm
{
namespace extractor
{
2014-05-09 10:17:31 -04:00
struct InternalExtractorEdge
{
// specify the type of the weight data
2016-01-05 06:04:04 -05:00
enum class WeightType : char
{
INVALID,
SPEED,
EDGE_DURATION,
WAY_DURATION,
};
struct WeightData
{
2016-01-05 06:04:04 -05:00
WeightData() : duration(0.0), type(WeightType::INVALID) {}
2016-05-27 15:05:04 -04:00
union {
double duration;
double speed;
};
WeightType type;
};
explicit InternalExtractorEdge()
2016-01-05 06:04:04 -05:00
: result(MIN_OSM_NODEID,
MIN_OSM_NODEID,
0,
0,
false, // forward
false, // backward
false, // roundabout
false, // circular
true, // can be startpoint
2016-01-05 06:04:04 -05:00
TRAVEL_MODE_INACCESSIBLE,
2016-02-24 04:29:23 -05:00
false,
guidance::TurnLaneType::empty,
guidance::RoadClassification())
2014-05-09 10:17:31 -04:00
{
}
explicit InternalExtractorEdge(OSMNodeID source,
OSMNodeID target,
NodeID name_id,
WeightData weight_data,
bool forward,
bool backward,
bool roundabout,
bool circular,
bool startpoint,
TravelMode travel_mode,
2016-02-24 04:29:23 -05:00
bool is_split,
LaneDescriptionID lane_description,
guidance::RoadClassification road_classification)
: result(source,
target,
name_id,
0,
forward,
backward,
roundabout,
circular,
startpoint,
travel_mode,
2016-02-24 04:29:23 -05:00
is_split,
lane_description,
2016-02-24 04:29:23 -05:00
std::move(road_classification)),
weight_data(std::move(weight_data))
{
}
// data that will be written to disk
NodeBasedEdgeWithOSM result;
// intermediate edge weight
WeightData weight_data;
// coordinate of the source node
util::Coordinate source_coordinate;
// necessary static util functions for stxxl's sorting
static InternalExtractorEdge min_osm_value()
2014-05-09 10:17:31 -04:00
{
2016-05-27 15:05:04 -04:00
return InternalExtractorEdge(MIN_OSM_NODEID,
MIN_OSM_NODEID,
0,
WeightData(),
false, // forward
false, // backward
false, // roundabout
false, // circular
true, // can be startpoint
2016-05-27 15:05:04 -04:00
TRAVEL_MODE_INACCESSIBLE,
false,
INVALID_LANE_DESCRIPTIONID,
guidance::RoadClassification());
}
static InternalExtractorEdge max_osm_value()
2014-05-09 10:17:31 -04:00
{
2016-05-27 15:05:04 -04:00
return InternalExtractorEdge(MAX_OSM_NODEID,
MAX_OSM_NODEID,
SPECIAL_NODEID,
2016-05-27 15:05:04 -04:00
WeightData(),
false, // forward
false, // backward
false, // roundabout
false, // circular
true, // can be startpoint
2016-05-27 15:05:04 -04:00
TRAVEL_MODE_INACCESSIBLE,
false,
INVALID_LANE_DESCRIPTIONID,
guidance::RoadClassification());
}
static InternalExtractorEdge min_internal_value()
{
auto v = min_osm_value();
v.result.source = 0;
v.result.target = 0;
return v;
}
static InternalExtractorEdge max_internal_value()
{
auto v = max_osm_value();
v.result.source = std::numeric_limits<NodeID>::max();
v.result.target = std::numeric_limits<NodeID>::max();
return v;
}
};
2016-01-05 10:51:13 -05:00
}
}
#endif // INTERNAL_EXTRACTOR_EDGE_HPP