2014-11-28 09:00:48 -05:00
|
|
|
#ifndef EXTRACTION_WAY_HPP
|
|
|
|
#define EXTRACTION_WAY_HPP
|
2014-01-09 10:13:35 -05:00
|
|
|
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "extractor/travel_mode.hpp"
|
|
|
|
#include "util/typedefs.hpp"
|
2014-01-09 10:13:35 -05:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
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;
|
|
|
|
duration = -1;
|
|
|
|
roundabout = false;
|
2015-12-11 17:11:04 -05:00
|
|
|
is_startpoint = true;
|
2014-08-26 11:02:05 -04:00
|
|
|
is_access_restricted = false;
|
|
|
|
name.clear();
|
2014-08-27 10:22:18 -04:00
|
|
|
forward_travel_mode = TRAVEL_MODE_DEFAULT;
|
|
|
|
backward_travel_mode = TRAVEL_MODE_DEFAULT;
|
2014-01-09 10:13:35 -05:00
|
|
|
}
|
|
|
|
|
2014-05-09 10:17:31 -04:00
|
|
|
enum Directions
|
2015-01-22 06:19:11 -05:00
|
|
|
{
|
|
|
|
notSure = 0,
|
|
|
|
oneway,
|
|
|
|
bidirectional,
|
|
|
|
opposite
|
|
|
|
};
|
2014-08-26 11:02:05 -04:00
|
|
|
|
2014-08-20 05:37:47 -04:00
|
|
|
// These accessor methods exists to support the depreciated "way.direction" access
|
2014-08-26 11:02:05 -04:00
|
|
|
// in LUA. Since the direction attribute was removed from ExtractionWay, the
|
2014-08-20 05:37:47 -04:00
|
|
|
// accessors translate to/from the mode attributes.
|
2014-08-29 03:44:53 -04:00
|
|
|
void set_direction(const Directions m)
|
2014-08-16 05:02:37 -04:00
|
|
|
{
|
2014-08-19 10:38:53 -04:00
|
|
|
if (Directions::oneway == m)
|
2014-08-16 05:02:37 -04:00
|
|
|
{
|
2014-08-18 09:38:07 -04:00
|
|
|
forward_travel_mode = TRAVEL_MODE_DEFAULT;
|
2014-08-18 09:11:24 -04:00
|
|
|
backward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
|
2014-08-16 05:02:37 -04:00
|
|
|
}
|
2014-08-19 10:38:53 -04:00
|
|
|
else if (Directions::opposite == m)
|
2014-08-16 05:02:37 -04:00
|
|
|
{
|
2015-01-22 06:19:11 -05:00
|
|
|
forward_travel_mode = TRAVEL_MODE_INACCESSIBLE;
|
|
|
|
backward_travel_mode = TRAVEL_MODE_DEFAULT;
|
2014-08-16 05:02:37 -04:00
|
|
|
}
|
2014-08-19 10:38:53 -04:00
|
|
|
else if (Directions::bidirectional == m)
|
2014-08-16 05:02:37 -04:00
|
|
|
{
|
2015-01-22 06:19:11 -05:00
|
|
|
forward_travel_mode = TRAVEL_MODE_DEFAULT;
|
|
|
|
backward_travel_mode = TRAVEL_MODE_DEFAULT;
|
2014-08-16 05:02:37 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-02 11:34:21 -05:00
|
|
|
Directions get_direction() const
|
2014-08-16 05:02:37 -04:00
|
|
|
{
|
2015-01-22 06:19:11 -05:00
|
|
|
if (TRAVEL_MODE_INACCESSIBLE != forward_travel_mode &&
|
|
|
|
TRAVEL_MODE_INACCESSIBLE != backward_travel_mode)
|
2014-08-16 05:02:37 -04:00
|
|
|
{
|
|
|
|
return Directions::bidirectional;
|
|
|
|
}
|
2014-08-19 10:38:53 -04:00
|
|
|
else if (TRAVEL_MODE_INACCESSIBLE != forward_travel_mode)
|
2014-08-16 05:02:37 -04:00
|
|
|
{
|
|
|
|
return Directions::oneway;
|
|
|
|
}
|
2014-08-19 10:38:53 -04:00
|
|
|
else if (TRAVEL_MODE_INACCESSIBLE != backward_travel_mode)
|
2014-08-16 05:02:37 -04:00
|
|
|
{
|
|
|
|
return Directions::opposite;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return Directions::notSure;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-20 05:37:47 -04:00
|
|
|
// These accessors exists because it's not possible to take the address of a bitfield,
|
|
|
|
// and LUA therefore cannot read/write the mode attributes directly.
|
2014-08-29 03:44:53 -04:00
|
|
|
void set_forward_mode(const TravelMode m) { forward_travel_mode = m; }
|
2015-01-02 11:34:21 -05:00
|
|
|
TravelMode get_forward_mode() const { return forward_travel_mode; }
|
2014-08-29 03:44:53 -04:00
|
|
|
void set_backward_mode(const TravelMode m) { backward_travel_mode = m; }
|
2015-01-02 11:34:21 -05:00
|
|
|
TravelMode get_backward_mode() const { return backward_travel_mode; }
|
2014-08-11 08:07:00 -04:00
|
|
|
|
2014-08-18 09:38:07 -04:00
|
|
|
double forward_speed;
|
2014-01-09 10:13:35 -05:00
|
|
|
double backward_speed;
|
|
|
|
double duration;
|
|
|
|
std::string name;
|
|
|
|
bool roundabout;
|
2014-08-26 11:02:05 -04:00
|
|
|
bool is_access_restricted;
|
2015-12-11 17:11:04 -05:00
|
|
|
bool is_startpoint;
|
2014-08-18 09:38:07 -04:00
|
|
|
TravelMode forward_travel_mode : 4;
|
2014-08-11 08:07:00 -04:00
|
|
|
TravelMode backward_travel_mode : 4;
|
2014-01-09 10:13:35 -05:00
|
|
|
};
|
|
|
|
|
2014-11-28 09:00:48 -05:00
|
|
|
#endif // EXTRACTION_WAY_HPP
|