Adding highway class Transported for ferry and trains which transports cars.

This commit is contained in:
Vladimir Byko-Ianko 2018-02-21 15:38:20 +03:00 committed by mpimenov
parent 8a7e2ee86a
commit df726efe29
3 changed files with 16 additions and 9 deletions

View file

@ -24,13 +24,14 @@ public:
HighwayClasses()
{
auto const & c = classif();
m_map[c.GetTypeByPath({"route", "ferry"})] = ftypes::HighwayClass::Transported;
m_map[c.GetTypeByPath({"route", "shuttle_train"})] = ftypes::HighwayClass::Transported;
m_map[c.GetTypeByPath({"railway", "rail"})] = ftypes::HighwayClass::Transported;
m_map[c.GetTypeByPath({"highway", "motorway"})] = ftypes::HighwayClass::Trunk;
m_map[c.GetTypeByPath({"highway", "motorway_link"})] = ftypes::HighwayClass::Trunk;
m_map[c.GetTypeByPath({"highway", "trunk"})] = ftypes::HighwayClass::Trunk;
m_map[c.GetTypeByPath({"highway", "trunk_link"})] = ftypes::HighwayClass::Trunk;
m_map[c.GetTypeByPath({"route", "ferry"})] = ftypes::HighwayClass::Trunk;
m_map[c.GetTypeByPath({"route", "shuttle_train"})] = ftypes::HighwayClass::Trunk;
m_map[c.GetTypeByPath({"railway", "rail"})] = ftypes::HighwayClass::Trunk;
m_map[c.GetTypeByPath({"highway", "primary"})] = ftypes::HighwayClass::Primary;
m_map[c.GetTypeByPath({"highway", "primary_link"})] = ftypes::HighwayClass::Primary;
@ -72,6 +73,7 @@ char const * HighwayClassToString(ftypes::HighwayClass const cls)
{
case ftypes::HighwayClass::Undefined: return "Undefined";
case ftypes::HighwayClass::Error: return "Error";
case ftypes::HighwayClass::Transported: return "Transported";
case ftypes::HighwayClass::Trunk: return "Trunk";
case ftypes::HighwayClass::Primary: return "Primary";
case ftypes::HighwayClass::Secondary: return "Secondary";

View file

@ -263,6 +263,7 @@ enum class HighwayClass
{
Undefined = 0, // There has not been any attempt of calculating HighwayClass.
Error, // There was an attempt of calculating HighwayClass but it was not successful.
Transported, // Vehicles are transported by a train or a ferry.
Trunk,
Primary,
Secondary,

View file

@ -148,14 +148,18 @@ UNIT_TEST(GetHighwayClassTest)
Classificator const & c = classif();
feature::TypesHolder types1;
types1.Add(c.GetTypeByPath({"highway", "motorway_link", "tunnel"}));
TEST_EQUAL(ftypes::GetHighwayClass(types1), ftypes::HighwayClass::Trunk, ());
types1.Add(c.GetTypeByPath({"route", "shuttle_train"}));
TEST_EQUAL(ftypes::GetHighwayClass(types1), ftypes::HighwayClass::Transported, ());
feature::TypesHolder types2;
types2.Add(c.GetTypeByPath({"highway", "unclassified"}));
TEST_EQUAL(ftypes::GetHighwayClass(types2), ftypes::HighwayClass::LivingStreet, ());
types2.Add(c.GetTypeByPath({"highway", "motorway_link", "tunnel"}));
TEST_EQUAL(ftypes::GetHighwayClass(types2), ftypes::HighwayClass::Trunk, ());
feature::TypesHolder types3;
types3.Add(c.GetTypeByPath({"highway"}));
TEST_EQUAL(ftypes::GetHighwayClass(types3), ftypes::HighwayClass::Error, ());
types3.Add(c.GetTypeByPath({"highway", "unclassified"}));
TEST_EQUAL(ftypes::GetHighwayClass(types3), ftypes::HighwayClass::LivingStreet, ());
feature::TypesHolder types4;
types4.Add(c.GetTypeByPath({"highway"}));
TEST_EQUAL(ftypes::GetHighwayClass(types4), ftypes::HighwayClass::Error, ());
}