2014-11-28 09:00:48 -05:00
|
|
|
#ifndef EXTRACTION_WAY_HPP
|
|
|
|
#define EXTRACTION_WAY_HPP
|
2014-01-09 10:13:35 -05:00
|
|
|
|
2018-01-05 08:33:53 -05:00
|
|
|
#include "extractor/road_classification.hpp"
|
2016-07-26 09:00:58 -04:00
|
|
|
#include "extractor/travel_mode.hpp"
|
2016-05-13 13:18:00 -04:00
|
|
|
#include "util/guidance/turn_lanes.hpp"
|
2016-06-15 08:38:24 -04:00
|
|
|
#include "util/typedefs.hpp"
|
2014-01-09 10:13:35 -05:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2022-12-11 04:10:26 -05:00
|
|
|
namespace osrm::extractor
|
2016-01-05 10:51:13 -05:00
|
|
|
{
|
2016-11-20 10:06:14 -05:00
|
|
|
namespace detail
|
|
|
|
{
|
2016-11-15 05:21:26 -05:00
|
|
|
inline void maybeSetString(std::string &str, const char *value)
|
|
|
|
{
|
|
|
|
if (value == nullptr)
|
|
|
|
{
|
|
|
|
str.clear();
|
|
|
|
}
|
|
|
|
else
|
2016-11-20 10:06:14 -05:00
|
|
|
{
|
2016-11-15 05:21:26 -05:00
|
|
|
str = std::string(value);
|
2016-11-20 10:06:14 -05:00
|
|
|
}
|
|
|
|
}
|
2020-11-26 10:21:39 -05:00
|
|
|
} // namespace detail
|
2016-01-05 10:51:13 -05:00
|
|
|
|
2015-04-08 12:53:10 -04:00
|
|
|
/**
|
|
|
|
* This struct is the direct result of the call to ```way_function```
|
|
|
|
* in the lua based profile.
|
|
|
|
*
|
|
|
|
* It is split into multiple edge segments in the ExtractorCallback.
|
|
|
|
*/
|
2014-05-09 10:17:31 -04:00
|
|
|
struct ExtractionWay
|
|
|
|
{
|
2014-11-19 04:53:28 -05:00
|
|
|
ExtractionWay() { clear(); }
|
2014-01-09 10:13:35 -05:00
|
|
|
|
2014-11-19 04:53:28 -05:00
|
|
|
void clear()
|
2014-05-09 10:17:31 -04:00
|
|
|
{
|
2014-08-18 09:38:07 -04:00
|
|
|
forward_speed = -1;
|
2014-01-09 10:13:35 -05:00
|
|
|
backward_speed = -1;
|
2016-05-12 12:50:10 -04:00
|
|
|
forward_rate = -1;
|
|
|
|
backward_rate = -1;
|
2014-01-09 10:13:35 -05:00
|
|
|
duration = -1;
|
2016-05-12 12:50:10 -04:00
|
|
|
weight = -1;
|
2014-08-26 11:02:05 -04:00
|
|
|
name.clear();
|
2017-10-13 12:05:04 -04:00
|
|
|
forward_ref.clear();
|
|
|
|
backward_ref.clear();
|
2016-05-25 21:35:38 -04:00
|
|
|
pronunciation.clear();
|
2016-05-26 18:47:46 -04:00
|
|
|
destinations.clear();
|
2017-06-29 16:12:25 -04:00
|
|
|
exits.clear();
|
2016-05-13 13:18:00 -04:00
|
|
|
turn_lanes_forward.clear();
|
|
|
|
turn_lanes_backward.clear();
|
2018-01-05 08:33:53 -05:00
|
|
|
road_classification = RoadClassification();
|
|
|
|
forward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
|
|
|
|
backward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
|
2017-08-21 07:41:27 -04:00
|
|
|
roundabout = false;
|
|
|
|
circular = false;
|
|
|
|
is_startpoint = true;
|
2017-02-14 06:59:16 -05:00
|
|
|
forward_restricted = false;
|
2017-08-21 07:41:27 -04:00
|
|
|
backward_restricted = false;
|
2017-08-07 17:39:34 -04:00
|
|
|
is_left_hand_driving = false;
|
2018-01-24 15:39:55 -05:00
|
|
|
highway_turn_classification = 0;
|
|
|
|
access_turn_classification = 0;
|
2014-08-16 05:02:37 -04:00
|
|
|
}
|
|
|
|
|
2016-11-20 10:06:14 -05:00
|
|
|
// wrappers to allow assigning nil (nullptr) to string values
|
2016-11-15 05:21:26 -05:00
|
|
|
void SetName(const char *value) { detail::maybeSetString(name, value); }
|
|
|
|
const char *GetName() const { return name.c_str(); }
|
2017-10-13 12:05:04 -04:00
|
|
|
void SetForwardRef(const char *value) { detail::maybeSetString(forward_ref, value); }
|
|
|
|
const char *GetForwardRef() const { return forward_ref.c_str(); }
|
|
|
|
void SetBackwardRef(const char *value) { detail::maybeSetString(backward_ref, value); }
|
|
|
|
const char *GetBackwardRef() const { return backward_ref.c_str(); }
|
2016-11-15 05:21:26 -05:00
|
|
|
void SetDestinations(const char *value) { detail::maybeSetString(destinations, value); }
|
|
|
|
const char *GetDestinations() const { return destinations.c_str(); }
|
2017-06-29 16:12:25 -04:00
|
|
|
void SetExits(const char *value) { detail::maybeSetString(exits, value); }
|
|
|
|
const char *GetExits() const { return exits.c_str(); }
|
2016-11-15 05:21:26 -05:00
|
|
|
void SetPronunciation(const char *value) { detail::maybeSetString(pronunciation, value); }
|
|
|
|
const char *GetPronunciation() const { return pronunciation.c_str(); }
|
|
|
|
void SetTurnLanesForward(const char *value)
|
|
|
|
{
|
|
|
|
detail::maybeSetString(turn_lanes_forward, value);
|
|
|
|
}
|
|
|
|
const char *GetTurnLanesForward() const { return turn_lanes_forward.c_str(); }
|
|
|
|
void SetTurnLanesBackward(const char *value)
|
|
|
|
{
|
|
|
|
detail::maybeSetString(turn_lanes_backward, value);
|
|
|
|
}
|
|
|
|
const char *GetTurnLanesBackward() const { return turn_lanes_backward.c_str(); }
|
2016-11-20 10:06:14 -05:00
|
|
|
|
2017-06-27 18:01:05 -04:00
|
|
|
// markers for determining user-defined classes for each way
|
|
|
|
std::unordered_map<std::string, bool> forward_classes;
|
|
|
|
std::unordered_map<std::string, bool> backward_classes;
|
|
|
|
|
2016-05-12 12:50:10 -04:00
|
|
|
// speed in km/h
|
2014-08-18 09:38:07 -04:00
|
|
|
double forward_speed;
|
2014-01-09 10:13:35 -05:00
|
|
|
double backward_speed;
|
2016-05-12 12:50:10 -04:00
|
|
|
// weight per meter
|
|
|
|
double forward_rate;
|
|
|
|
double backward_rate;
|
|
|
|
// duration of the whole way in both directions
|
2014-01-09 10:13:35 -05:00
|
|
|
double duration;
|
2016-05-12 12:50:10 -04:00
|
|
|
// weight of the whole way in both directions
|
|
|
|
double weight;
|
2014-01-09 10:13:35 -05:00
|
|
|
std::string name;
|
2017-10-13 12:05:04 -04:00
|
|
|
std::string forward_ref;
|
|
|
|
std::string backward_ref;
|
2016-05-25 21:35:38 -04:00
|
|
|
std::string pronunciation;
|
2016-05-26 18:47:46 -04:00
|
|
|
std::string destinations;
|
2017-06-29 16:12:25 -04:00
|
|
|
std::string exits;
|
2016-05-13 13:18:00 -04:00
|
|
|
std::string turn_lanes_forward;
|
|
|
|
std::string turn_lanes_backward;
|
2018-01-05 08:33:53 -05:00
|
|
|
RoadClassification road_classification;
|
|
|
|
TravelMode forward_travel_mode : 4;
|
|
|
|
TravelMode backward_travel_mode : 4;
|
2017-08-21 07:41:27 -04:00
|
|
|
|
|
|
|
// Boolean flags
|
2017-03-29 06:36:54 -04:00
|
|
|
bool roundabout : 1;
|
|
|
|
bool circular : 1;
|
|
|
|
bool is_startpoint : 1;
|
|
|
|
bool forward_restricted : 1;
|
|
|
|
bool backward_restricted : 1;
|
2017-08-07 17:39:34 -04:00
|
|
|
bool is_left_hand_driving : 1;
|
2017-08-21 07:41:27 -04:00
|
|
|
bool : 2;
|
2018-01-24 15:39:55 -05:00
|
|
|
|
|
|
|
// user classifications for turn penalties
|
|
|
|
std::uint8_t highway_turn_classification : 4;
|
|
|
|
std::uint8_t access_turn_classification : 4;
|
2014-01-09 10:13:35 -05:00
|
|
|
};
|
2022-12-20 12:00:11 -05:00
|
|
|
} // namespace osrm::extractor
|
2016-01-05 10:51:13 -05:00
|
|
|
|
2014-11-28 09:00:48 -05:00
|
|
|
#endif // EXTRACTION_WAY_HPP
|