mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-05 04:03:46 +00:00
[styles] Optimize displaying of charging stations, handle implicit motorcars tagging and add motorcycles
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
@@ -191,9 +191,21 @@ void TypesHolder::SortBySpec()
|
||||
auto const getPriority = [&cl](uint32_t type) { return cl.GetObject(type)->GetMaxOverlaysPriority(); };
|
||||
|
||||
auto const & checker = UselessTypesChecker::Instance();
|
||||
auto const & isChargingStationChecker = ftypes::IsCharingStationChecker::Instance();
|
||||
auto const & isChargingStationSmallChecker = ftypes::IsCharingStationSmallChecker::Instance();
|
||||
|
||||
std::stable_sort(begin(), end(), [&checker, &getPriority](uint32_t t1, uint32_t t2)
|
||||
std::stable_sort(begin(), end(), [&checker, &getPriority, &isChargingStationChecker, &isChargingStationSmallChecker](uint32_t t1, uint32_t t2)
|
||||
{
|
||||
if (isChargingStationSmallChecker(t1) && !isChargingStationSmallChecker(t2))
|
||||
return false;
|
||||
else if (isChargingStationSmallChecker(t1) && !isChargingStationSmallChecker(t2))
|
||||
return true;
|
||||
|
||||
if (isChargingStationChecker(t1) && !isChargingStationChecker(t2))
|
||||
return true;
|
||||
else if (isChargingStationChecker(t2) && !isChargingStationChecker(t1))
|
||||
return false;
|
||||
|
||||
int const p1 = getPriority(t1);
|
||||
int const p2 = getPriority(t2);
|
||||
if (p1 != p2)
|
||||
@@ -403,6 +415,13 @@ void FeatureParams::SetRwSubwayType(char const * cityName)
|
||||
|
||||
FeatureParams::TypesResult FeatureParams::FinishAddingTypesEx()
|
||||
{
|
||||
auto const & cl = classif();
|
||||
auto charingStation = cl.GetTypeByPath({"amenity", "charging_station", "general"});
|
||||
auto motorcarCharingStation = cl.GetTypeByPath({"amenity", "charging_station", "motorcar"});
|
||||
auto carelessCharingStation = cl.GetTypeByPath({"amenity", "charging_station", "carless"});
|
||||
if (IsTypeExist(charingStation) && !IsTypeExist(motorcarCharingStation) && !IsTypeExist(carelessCharingStation))
|
||||
AddType(motorcarCharingStation);
|
||||
|
||||
base::SortUnique(m_types);
|
||||
|
||||
TypesResult res = TYPES_GOOD;
|
||||
|
||||
@@ -753,6 +753,30 @@ IsDirectionalChecker::IsDirectionalChecker() : ftypes::BaseChecker(1 /* level */
|
||||
m_types.push_back(c.GetTypeByPath({"lateral"}));
|
||||
}
|
||||
|
||||
IsCharingStationChecker::IsCharingStationChecker() : ftypes::BaseChecker(3 /* level */)
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "charging_station", "general"}));
|
||||
}
|
||||
|
||||
IsCharingStationCarChecker::IsCharingStationCarChecker() : ftypes::BaseChecker(3 /* level */)
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "charging_station", "motorcar"}));
|
||||
}
|
||||
|
||||
IsCharingStationCarlessChecker::IsCharingStationCarlessChecker() : ftypes::BaseChecker(3 /* level */)
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "charging_station", "carless"}));
|
||||
}
|
||||
|
||||
IsCharingStationSmallChecker::IsCharingStationSmallChecker() : ftypes::BaseChecker(3 /* level */)
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
m_types.push_back(c.GetTypeByPath({"amenity", "charging_station", "small"}));
|
||||
}
|
||||
|
||||
IsTaxiChecker::IsTaxiChecker()
|
||||
{
|
||||
Classificator const & c = classif();
|
||||
|
||||
@@ -519,6 +519,38 @@ public:
|
||||
DECLARE_CHECKER_INSTANCE(IsDirectionalChecker);
|
||||
};
|
||||
|
||||
class IsCharingStationChecker : public ftypes::BaseChecker
|
||||
{
|
||||
IsCharingStationChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsCharingStationChecker);
|
||||
};
|
||||
|
||||
class IsCharingStationCarChecker : public ftypes::BaseChecker
|
||||
{
|
||||
IsCharingStationCarChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsCharingStationCarChecker);
|
||||
};
|
||||
|
||||
class IsCharingStationCarlessChecker : public ftypes::BaseChecker
|
||||
{
|
||||
IsCharingStationCarlessChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsCharingStationCarlessChecker);
|
||||
};
|
||||
|
||||
class IsCharingStationSmallChecker : public ftypes::BaseChecker
|
||||
{
|
||||
IsCharingStationSmallChecker();
|
||||
|
||||
public:
|
||||
DECLARE_CHECKER_INSTANCE(IsCharingStationSmallChecker);
|
||||
};
|
||||
|
||||
class IsTaxiChecker : public BaseChecker
|
||||
{
|
||||
IsTaxiChecker();
|
||||
|
||||
@@ -121,12 +121,19 @@ std::string MapObject::GetLocalizedAllTypes(bool withMainType) const
|
||||
auto const & isPoi = ftypes::IsPoiChecker::Instance();
|
||||
auto const & isDirectional = ftypes::IsDirectionalChecker::Instance();
|
||||
auto const & amenityChecker = ftypes::IsAmenityChecker::Instance();
|
||||
auto const & charingStationCarChecker = ftypes::IsCharingStationCarChecker::Instance();
|
||||
auto const & charingStationCarlessChecker = ftypes::IsCharingStationCarlessChecker::Instance();
|
||||
auto const & charingStationSmallChecker = ftypes::IsCharingStationSmallChecker::Instance();
|
||||
|
||||
std::ostringstream oss;
|
||||
bool isMainType = true;
|
||||
bool isFirst = true;
|
||||
for (auto const type : copy)
|
||||
{
|
||||
// Ignore some charing stations
|
||||
if (charingStationCarlessChecker(type) || ((charingStationCarChecker(type) || charingStationSmallChecker(type)) && charingStationCarlessChecker(copy)))
|
||||
continue;
|
||||
|
||||
if (isMainType && !withMainType)
|
||||
{
|
||||
isMainType = false;
|
||||
|
||||
@@ -86,7 +86,9 @@ std::map<std::string, BookmarkMatchInfo> const kFeatureTypeToBookmarkMatchInfo =
|
||||
{"amenity-bureau_de_change", {kml::BookmarkIcon::Exchange, BookmarkBaseType::Exchange}},
|
||||
|
||||
{"amenity-charging_station", {kml::BookmarkIcon::ChargingStation, BookmarkBaseType::Gas}},
|
||||
{"amenity-charging_station-general", {kml::BookmarkIcon::ChargingStation, BookmarkBaseType::Gas}},
|
||||
{"amenity-charging_station-bicycle", {kml::BookmarkIcon::ChargingStation, BookmarkBaseType::Gas}},
|
||||
{"amenity-charging_station-motorcycle", {kml::BookmarkIcon::ChargingStation, BookmarkBaseType::Gas}},
|
||||
{"amenity-charging_station-motorcar", {kml::BookmarkIcon::ChargingStation, BookmarkBaseType::Gas}},
|
||||
{"amenity-fuel", {kml::BookmarkIcon::Gas, BookmarkBaseType::Gas}},
|
||||
|
||||
|
||||
@@ -228,7 +228,9 @@ private:
|
||||
{{"shop", "money_lender"}, SearchMarkType::Bank},
|
||||
{{"amenity", "fuel"}, SearchMarkType::Fuel},
|
||||
{{"amenity", "charging_station"}, SearchMarkType::ChargingStation},
|
||||
{{"amenity", "charging_station", "general"}, SearchMarkType::ChargingStation},
|
||||
{{"amenity", "charging_station", "bicycle"}, SearchMarkType::ChargingStation},
|
||||
{{"amenity", "charging_station", "motorcycle"}, SearchMarkType::ChargingStation},
|
||||
{{"amenity", "charging_station", "motorcar"}, SearchMarkType::ChargingStation},
|
||||
{{"shop", "alcohol"}, SearchMarkType::ShopAlcohol},
|
||||
{{"shop", "beverages"}, SearchMarkType::ShopAlcohol},
|
||||
|
||||
Reference in New Issue
Block a user