forked from organicmaps/organicmaps
Renaming tag bicycle_bidir to bidir_bicycle and other review fixes.
This commit is contained in:
parent
97a2bab208
commit
a35256f8e7
9 changed files with 32 additions and 40 deletions
|
@ -363,7 +363,7 @@ world +
|
|||
wayside_shrine -
|
||||
{}
|
||||
hwtag +
|
||||
bicycle_bidir -
|
||||
bidir_bicycle -
|
||||
lit -
|
||||
nobicycle -
|
||||
nofoot -
|
||||
|
|
|
@ -1113,7 +1113,7 @@ sponsored
|
|||
sponsored|booking
|
||||
hwtag|nobicycle
|
||||
hwtag|yesbicycle
|
||||
hwtag|bicycle_bidir
|
||||
hwtag|bidir_bicycle
|
||||
psurface|paved_good
|
||||
psurface|paved_bad
|
||||
psurface|unpaved_good
|
||||
|
|
|
@ -507,7 +507,7 @@ UNIT_TEST(OsmType_Hwtag)
|
|||
{
|
||||
char const * tags[][2] = {
|
||||
{"hwtag", "oneway"}, {"hwtag", "private"}, {"hwtag", "lit"}, {"hwtag", "nofoot"}, {"hwtag", "yesfoot"},
|
||||
{"hwtag", "yesbicycle"}, {"hwtag", "bicycle_bidir"}
|
||||
{"hwtag", "yesbicycle"}, {"hwtag", "bidir_bicycle"}
|
||||
};
|
||||
|
||||
{
|
||||
|
|
|
@ -228,7 +228,7 @@ namespace ftype
|
|||
{
|
||||
{"building", "address"}, {"hwtag", "oneway"}, {"hwtag", "private"},
|
||||
{"hwtag", "lit"}, {"hwtag", "nofoot"}, {"hwtag", "yesfoot"},
|
||||
{"hwtag", "nobicycle"}, {"hwtag", "yesbicycle"}, {"hwtag", "bicycle_bidir"},
|
||||
{"hwtag", "nobicycle"}, {"hwtag", "yesbicycle"}, {"hwtag", "bidir_bicycle"},
|
||||
{"psurface", "paved_good"}, {"psurface", "paved_bad"},
|
||||
{"psurface", "unpaved_good"}, {"psurface", "unpaved_bad"},
|
||||
};
|
||||
|
|
|
@ -605,7 +605,7 @@ void BicycleModel::Init()
|
|||
|
||||
m_yesBicycleType = classif().GetTypeByPath(hwtagYesbicycle);
|
||||
m_noBicycleType = classif().GetTypeByPath({"hwtag", "nobicycle"});
|
||||
m_bicycleBidirType = classif().GetTypeByPath({"hwtag", "bicycle_bidir"});
|
||||
m_bidirBicycleType = classif().GetTypeByPath({"hwtag", "bidir_bicycle"});
|
||||
|
||||
initializer_list<char const *> arr[] = {
|
||||
hwtagYesbicycle, {"route", "ferry"}, {"man_made", "pier"},
|
||||
|
@ -614,28 +614,28 @@ void BicycleModel::Init()
|
|||
SetAdditionalRoadTypes(classif(), arr, ARRAY_SIZE(arr));
|
||||
}
|
||||
|
||||
VehicleModel::Restriction BicycleModel::IsNoBicycle(feature::TypesHolder const & types) const
|
||||
VehicleModel::Restriction BicycleModel::IsBicycleAllowed(feature::TypesHolder const & types) const
|
||||
{
|
||||
return types.Has(m_noBicycleType) ? Restriction::Yes : Restriction::Unknown;
|
||||
}
|
||||
|
||||
VehicleModel::Restriction BicycleModel::IsYesBicycle(feature::TypesHolder const & types) const
|
||||
{
|
||||
return types.Has(m_yesBicycleType) ? Restriction::Yes : Restriction::Unknown;
|
||||
if (types.Has(m_yesBicycleType))
|
||||
return Restriction::Yes;
|
||||
if (types.Has(m_noBicycleType))
|
||||
return Restriction::No;
|
||||
return Restriction::Unknown;
|
||||
}
|
||||
|
||||
VehicleModel::Restriction BicycleModel::IsBicycleBidir(feature::TypesHolder const & types) const
|
||||
{
|
||||
return types.Has(m_bicycleBidirType) ? Restriction::Yes : Restriction::Unknown;
|
||||
return types.Has(m_bidirBicycleType) ? Restriction::Yes : Restriction::Unknown;
|
||||
}
|
||||
|
||||
double BicycleModel::GetSpeed(FeatureType const & f) const
|
||||
{
|
||||
feature::TypesHolder const types(f);
|
||||
|
||||
if (IsYesBicycle(types) == Restriction::Yes)
|
||||
Restriction const restriction = IsBicycleAllowed(types);
|
||||
if (restriction == Restriction::Yes)
|
||||
return VehicleModel::GetMaxSpeed();
|
||||
if (IsNoBicycle(types) == Restriction::Unknown && HasRoadType(types))
|
||||
if (restriction != Restriction::No && HasRoadType(types))
|
||||
return VehicleModel::GetMinTypeSpeed(types);
|
||||
|
||||
return 0.0;
|
||||
|
@ -658,7 +658,7 @@ bool BicycleModel::IsRoad(FeatureType const & f) const
|
|||
|
||||
feature::TypesHolder const types(f);
|
||||
|
||||
if (IsNoBicycle(types) == Restriction::Yes)
|
||||
if (IsBicycleAllowed(types) == Restriction::No)
|
||||
return false;
|
||||
return VehicleModel::HasRoadType(types);
|
||||
}
|
||||
|
|
|
@ -21,19 +21,14 @@ public:
|
|||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
/// @return Restriction::Yes if road is prohibited for bicycle.
|
||||
Restriction IsNoBicycle(feature::TypesHolder const & types) const;
|
||||
|
||||
/// @return Restriction::Yes if road is allowed for bicycle.
|
||||
Restriction IsYesBicycle(feature::TypesHolder const & types) const;
|
||||
Restriction IsBicycleAllowed(feature::TypesHolder const & types) const;
|
||||
|
||||
/// @return Restriction::Yes if it is allowed to ride bicycle in two directions.
|
||||
Restriction IsBicycleBidir(feature::TypesHolder const & types) const;
|
||||
|
||||
uint32_t m_noBicycleType = 0;
|
||||
uint32_t m_yesBicycleType = 0;
|
||||
uint32_t m_bicycleBidirType = 0;
|
||||
uint32_t m_bidirBicycleType = 0;
|
||||
};
|
||||
|
||||
class BicycleModelFactory : public IVehicleModelFactory
|
||||
|
|
|
@ -633,23 +633,23 @@ void PedestrianModel::Init()
|
|||
SetAdditionalRoadTypes(classif(), arr, ARRAY_SIZE(arr));
|
||||
}
|
||||
|
||||
VehicleModel::Restriction PedestrianModel::IsNoFoot(feature::TypesHolder const & types) const
|
||||
VehicleModel::Restriction PedestrianModel::IsPedestrianAllowed(feature::TypesHolder const & types) const
|
||||
{
|
||||
return types.Has(m_noFootType) ? Restriction::Yes : Restriction::Unknown;
|
||||
}
|
||||
|
||||
VehicleModel::Restriction PedestrianModel::IsYesFoot(feature::TypesHolder const & types) const
|
||||
{
|
||||
return types.Has(m_yesFootType) ? Restriction::Yes : Restriction::Unknown;
|
||||
if (types.Has(m_yesFootType))
|
||||
return Restriction::Yes;
|
||||
if (types.Has(m_noFootType))
|
||||
return Restriction::No;
|
||||
return Restriction::Unknown;
|
||||
}
|
||||
|
||||
double PedestrianModel::GetSpeed(FeatureType const & f) const
|
||||
{
|
||||
feature::TypesHolder const types(f);
|
||||
|
||||
if (IsYesFoot(types) == Restriction::Yes)
|
||||
Restriction const restriction = IsPedestrianAllowed(types);
|
||||
if (restriction == Restriction::Yes)
|
||||
return VehicleModel::GetMaxSpeed();
|
||||
if (IsNoFoot(types) == Restriction::Unknown && HasRoadType(types))
|
||||
if (restriction != Restriction::No && HasRoadType(types))
|
||||
return VehicleModel::GetMinTypeSpeed(types);
|
||||
|
||||
return 0.0;
|
||||
|
@ -662,8 +662,9 @@ bool PedestrianModel::IsRoad(FeatureType const & f) const
|
|||
|
||||
feature::TypesHolder const types(f);
|
||||
|
||||
if (IsNoFoot(types) == Restriction::Yes)
|
||||
if (IsPedestrianAllowed(types) == Restriction::No)
|
||||
return false;
|
||||
|
||||
return VehicleModel::HasRoadType(types);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,12 +21,7 @@ public:
|
|||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
/// @return Restriction::Yes if road is prohibited for pedestrian.
|
||||
Restriction IsNoFoot(feature::TypesHolder const & types) const;
|
||||
|
||||
/// @return Restriction::Yes if road is allowed for pedestrian.
|
||||
Restriction IsYesFoot(feature::TypesHolder const & types) const;
|
||||
Restriction IsPedestrianAllowed(feature::TypesHolder const & types) const;
|
||||
|
||||
uint32_t m_noFootType = 0;
|
||||
uint32_t m_yesFootType = 0;
|
||||
|
|
|
@ -82,8 +82,9 @@ public:
|
|||
protected:
|
||||
enum class Restriction
|
||||
{
|
||||
Unknown,
|
||||
No,
|
||||
Yes,
|
||||
Unknown,
|
||||
};
|
||||
|
||||
/// Used in derived class constructors only. Not for public use.
|
||||
|
|
Loading…
Add table
Reference in a new issue