osrm-backend/include/extractor/guidance/classification_data.hpp

79 lines
2.0 KiB
C++
Raw Normal View History

2016-03-01 16:30:31 -05:00
#ifndef OSRM_EXTRACTOR_CLASSIFICATION_DATA_HPP_
#define OSRM_EXTRACTOR_CLASSIFICATION_DATA_HPP_
#include <cstdint>
2016-02-24 04:29:23 -05:00
#include <string>
// Forward Declaration to allow usage of external osmium::Way
namespace osmium
{
class Way;
}
namespace osrm
{
2016-03-01 16:30:31 -05:00
namespace extractor
2016-02-24 04:29:23 -05:00
{
namespace guidance
{
enum class FunctionalRoadClass : std::uint8_t
2016-02-24 04:29:23 -05:00
{
2016-03-01 16:30:31 -05:00
UNKNOWN = 0,
2016-02-24 04:29:23 -05:00
MOTORWAY,
MOTORWAY_LINK,
TRUNK,
TRUNK_LINK,
PRIMARY,
PRIMARY_LINK,
SECONDARY,
SECONDARY_LINK,
TERTIARY,
TERTIARY_LINK,
UNCLASSIFIED,
RESIDENTIAL,
SERVICE,
LIVING_STREET,
2016-03-01 16:30:31 -05:00
LOW_PRIORITY_ROAD // a road simply included for connectivity. Should be avoided at all cost
2016-02-24 04:29:23 -05:00
};
FunctionalRoadClass functionalRoadClassFromTag(std::string const &tag);
2016-02-24 04:29:23 -05:00
inline bool isRampClass(const FunctionalRoadClass road_class)
{
// Primary Roads and down are usually too small to announce their links as ramps
2016-03-01 16:30:31 -05:00
return road_class == FunctionalRoadClass::MOTORWAY_LINK ||
road_class == FunctionalRoadClass::TRUNK_LINK;
2016-02-24 04:29:23 -05:00
}
// Links are usually smaller than ramps, but are sometimes tagged
// as MOTORWAY_LINK if they exit/enter a motorway/trunk road.
inline bool isLinkClass(const FunctionalRoadClass road_class)
{
return road_class == FunctionalRoadClass::MOTORWAY_LINK ||
road_class == FunctionalRoadClass::TRUNK_LINK ||
road_class == FunctionalRoadClass::PRIMARY_LINK ||
road_class == FunctionalRoadClass::SECONDARY_LINK ||
road_class == FunctionalRoadClass::TERTIARY_LINK;
}
2016-02-24 04:29:23 -05:00
// TODO augment this with all data required for guidance generation
struct RoadClassificationData
{
2016-03-01 16:30:31 -05:00
FunctionalRoadClass road_class = FunctionalRoadClass::UNKNOWN;
2016-02-24 04:29:23 -05:00
void augment(const osmium::Way &way);
};
2016-03-01 16:30:31 -05:00
inline bool operator==(const RoadClassificationData lhs, const RoadClassificationData rhs)
2016-02-26 11:33:18 -05:00
{
2016-03-01 16:30:31 -05:00
return lhs.road_class == rhs.road_class;
2016-02-26 11:33:18 -05:00
}
2016-02-24 04:29:23 -05:00
} // namespace guidance
2016-03-01 16:30:31 -05:00
} // namespace extractor
2016-02-24 04:29:23 -05:00
} // namespace osrm
2016-03-01 16:30:31 -05:00
#endif // OSRM_EXTRACTOR_CLASSIFICATION_DATA_HPP_