forked from organicmaps/organicmaps
Adding highway class Transported for ferry and trains which transports cars.
This commit is contained in:
parent
8a7e2ee86a
commit
df726efe29
3 changed files with 16 additions and 9 deletions
|
@ -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";
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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, ());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue