forked from organicmaps/organicmaps-tmp
[generator] Save operator for payment terminal, money exchange, post office, car sharing, car rental, bicycle rental.
This commit is contained in:
parent
b4588b780b
commit
1e4b4bef3b
4 changed files with 105 additions and 13 deletions
|
@ -75,8 +75,10 @@ UNIT_TEST(Metadata_ValidateAndFormat_stars)
|
|||
|
||||
UNIT_CLASS_TEST(TestWithClassificator, Metadata_ValidateAndFormat_operator)
|
||||
{
|
||||
uint32_t const type_atm = classif().GetTypeByPath({ "amenity", "atm" });
|
||||
uint32_t const type_fuel = classif().GetTypeByPath({ "amenity", "fuel" });
|
||||
uint32_t const typeAtm = classif().GetTypeByPath({"amenity", "atm"});
|
||||
uint32_t const typeFuel = classif().GetTypeByPath({"amenity", "fuel"});
|
||||
uint32_t const typeCarSharing = classif().GetTypeByPath({"amenity", "car_sharing"});
|
||||
uint32_t const typeCarRental = classif().GetTypeByPath({"amenity", "car_rantal"});
|
||||
|
||||
FeatureBuilderParams params;
|
||||
MetadataTagProcessor p(params);
|
||||
|
@ -86,18 +88,18 @@ UNIT_CLASS_TEST(TestWithClassificator, Metadata_ValidateAndFormat_operator)
|
|||
p("operator", "Some");
|
||||
TEST(md.Empty(), ());
|
||||
|
||||
params.SetType(type_atm);
|
||||
params.SetType(typeAtm);
|
||||
p("operator", "Some");
|
||||
TEST_EQUAL(md.Get(Metadata::FMD_OPERATOR), "Some", ());
|
||||
md.Drop(Metadata::FMD_OPERATOR);
|
||||
|
||||
params.SetType(type_fuel);
|
||||
params.SetType(typeFuel);
|
||||
p("operator", "Some");
|
||||
TEST_EQUAL(md.Get(Metadata::FMD_OPERATOR), "Some", ());
|
||||
md.Drop(Metadata::FMD_OPERATOR);
|
||||
|
||||
params.SetType(type_atm);
|
||||
params.AddType(type_fuel);
|
||||
params.SetType(typeCarSharing);
|
||||
params.AddType(typeCarRental);
|
||||
p("operator", "Some");
|
||||
TEST_EQUAL(md.Get(Metadata::FMD_OPERATOR), "Some", ());
|
||||
md.Drop(Metadata::FMD_OPERATOR);
|
||||
|
|
|
@ -95,15 +95,21 @@ string MetadataTagProcessorImpl::ValidateAndFormat_stars(string const & v) const
|
|||
|
||||
string MetadataTagProcessorImpl::ValidateAndFormat_operator(string const & v) const
|
||||
{
|
||||
auto const & isATM = ftypes::IsATMChecker::Instance();
|
||||
auto const & isFuelStation = ftypes::IsFuelStationChecker::Instance();
|
||||
auto const & isRecyclingCentre = ftypes::IsRecyclingCentreChecker::Instance();
|
||||
|
||||
auto const & t = m_params.m_types;
|
||||
if (!isATM(t) && !isFuelStation(t) && !isRecyclingCentre(t))
|
||||
return string();
|
||||
if (ftypes::IsATMChecker::Instance()(t) ||
|
||||
ftypes::IsPaymentTerminalChecker::Instance()(t) ||
|
||||
ftypes::IsMoneyExchangeChecker::Instance()(t) ||
|
||||
ftypes::IsFuelStationChecker::Instance()(t) ||
|
||||
ftypes::IsRecyclingCentreChecker::Instance()(t) ||
|
||||
ftypes::IsPostOfficeChecker::Instance()(t) ||
|
||||
ftypes::IsCarSharingChecker::Instance()(t) ||
|
||||
ftypes::IsCarRentalChecker::Instance()(t) ||
|
||||
ftypes::IsBicycleRentalChecker::Instance()(t))
|
||||
{
|
||||
return v;
|
||||
}
|
||||
|
||||
return v;
|
||||
return {};
|
||||
}
|
||||
|
||||
string MetadataTagProcessorImpl::ValidateAndFormat_url(string const & v) const
|
||||
|
|
|
@ -190,6 +190,18 @@ IsATMChecker::IsATMChecker()
|
|||
m_types.push_back(c.GetTypeByPath({"amenity", "atm"}));
|
||||
}
|
||||
|
||||
IsPaymentTerminalChecker::IsPaymentTerminalChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "payment_terminal"}));
|
||||
}
|
||||
|
||||
IsMoneyExchangeChecker::IsMoneyExchangeChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "bureau_de_change"}));
|
||||
}
|
||||
|
||||
IsSpeedCamChecker::IsSpeedCamChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
|
@ -202,12 +214,36 @@ IsPostBoxChecker::IsPostBoxChecker()
|
|||
m_types.push_back(c.GetTypeByPath({"amenity", "post_box"}));
|
||||
}
|
||||
|
||||
IsPostOfficeChecker::IsPostOfficeChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "post_office"}));
|
||||
}
|
||||
|
||||
IsFuelStationChecker::IsFuelStationChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "fuel"}));
|
||||
}
|
||||
|
||||
IsCarSharingChecker::IsCarSharingChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "car_sharing"}));
|
||||
}
|
||||
|
||||
IsCarRentalChecker::IsCarRentalChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "car_rental"}));
|
||||
}
|
||||
|
||||
IsBicycleRentalChecker::IsBicycleRentalChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "bicycle_rental"}));
|
||||
}
|
||||
|
||||
IsRecyclingCentreChecker::IsRecyclingCentreChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
|
|
|
@ -62,6 +62,22 @@ public:
|
|||
DECLARE_CHECKER_INSTANCE(IsATMChecker);
|
||||
};
|
||||
|
||||
class IsPaymentTerminalChecker : public BaseChecker
|
||||
{
|
||||
IsPaymentTerminalChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsPaymentTerminalChecker);
|
||||
};
|
||||
|
||||
class IsMoneyExchangeChecker : public BaseChecker
|
||||
{
|
||||
IsMoneyExchangeChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsMoneyExchangeChecker);
|
||||
};
|
||||
|
||||
class IsSpeedCamChecker : public BaseChecker
|
||||
{
|
||||
IsSpeedCamChecker();
|
||||
|
@ -77,6 +93,14 @@ public:
|
|||
DECLARE_CHECKER_INSTANCE(IsPostBoxChecker);
|
||||
};
|
||||
|
||||
class IsPostOfficeChecker : public BaseChecker
|
||||
{
|
||||
IsPostOfficeChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsPostOfficeChecker);
|
||||
};
|
||||
|
||||
class IsFuelStationChecker : public BaseChecker
|
||||
{
|
||||
IsFuelStationChecker();
|
||||
|
@ -84,6 +108,30 @@ public:
|
|||
DECLARE_CHECKER_INSTANCE(IsFuelStationChecker);
|
||||
};
|
||||
|
||||
class IsCarSharingChecker : public BaseChecker
|
||||
{
|
||||
IsCarSharingChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsCarSharingChecker);
|
||||
};
|
||||
|
||||
class IsCarRentalChecker : public BaseChecker
|
||||
{
|
||||
IsCarRentalChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsCarRentalChecker);
|
||||
};
|
||||
|
||||
class IsBicycleRentalChecker : public BaseChecker
|
||||
{
|
||||
IsBicycleRentalChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsBicycleRentalChecker);
|
||||
};
|
||||
|
||||
class IsRecyclingCentreChecker : public BaseChecker
|
||||
{
|
||||
IsRecyclingCentreChecker();
|
||||
|
|
Loading…
Add table
Reference in a new issue