Compare commits

..

1 Commits

Author SHA1 Message Date
Yannik Bloscheck
1fae6a11d9 Move special cases for charing stations with implicit car tagging to generator
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
2026-01-17 00:33:46 +01:00
6 changed files with 28 additions and 56 deletions

View File

@@ -419,6 +419,7 @@ highway|primary_link|bridge;[highway=primary_link][bridge?];;name;int_name;310;
man_made|tower|communication;[man_made=tower][tower:type=communication];;name;int_name;311;
sport|equestrian;312;
tourism|information|office;[tourism=information][information=office];;name;int_name;313;
# This is needed in the generator to work around charing stations, which are only implicitly marked as for cars, but this type never will actually make it into the map data
amenity|charging_station|carless;[amenity=charging_station][motorcar=not],[amenity=charging_station][motorcar=no];;name;int_name;314;
aeroway|gate;315;
# TODO: railway=preserved is deprecated in OSM, recommended mapping is railway:preserved=yes + railway=*
Can't render this file because it contains an unexpected character in line 7 and column 16.

View File

@@ -270,6 +270,10 @@ public:
ShuttleTrain,
DisusedBusiness,
Building,
ChargingStation,
SmallChargingStation,
MotorcarChargingStation,
CarelessChargingStation,
Count
};
@@ -311,6 +315,10 @@ public:
{ShuttleTrain, {"route", "shuttle_train"}},
{DisusedBusiness, {"disusedbusiness"}},
{Building, {"building"}},
{ChargingStation, {"amenity", "charging_station"}},
{SmallChargingStation, {"amenity", "charging_station", "small"}},
{MotorcarChargingStation, {"amenity", "charging_station", "motorcar"}},
{CarelessChargingStation, {"amenity", "charging_station", "carless"}},
};
m_types.resize(static_cast<size_t>(Count));
@@ -1338,6 +1346,25 @@ void PostprocessElement(OsmElement * p, FeatureBuilderParams & params)
railwayDone = true;
}
}
// This is needed in the generator to work around charing stations, which are only implicitly marked as for cars
if (params.IsTypeExist(types.Get(CachedTypes::ChargingStation)))
{
uint32_t const motorcarChargingStation = types.Get(CachedTypes::MotorcarChargingStation);
uint32_t const carelessChargingStation = types.Get(CachedTypes::CarelessChargingStation);
if (!params.IsTypeExist(motorcarChargingStation) && !params.IsTypeExist(carelessChargingStation))
params.AddType(motorcarChargingStation);
if (params.IsTypeExist(carelessChargingStation))
{
params.PopExactType(carelessChargingStation);
uint32_t const smallChargingStation = types.Get(CachedTypes::SmallChargingStation);
if (params.IsTypeExist(smallChargingStation))
params.PopExactType(smallChargingStation);
}
}
}
} // namespace

View File

@@ -409,13 +409,6 @@ void FeatureParams::SetRwSubwayType(char const * cityName)
FeatureParams::TypesResult FeatureParams::FinishAddingTypesEx()
{
auto const & cl = classif();
auto charingStation = cl.GetTypeByPath({"amenity", "charging_station"});
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;

View File

@@ -753,24 +753,6 @@ IsDirectionalChecker::IsDirectionalChecker() : ftypes::BaseChecker(1 /* level */
m_types.push_back(c.GetTypeByPath({"lateral"}));
}
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();

View File

@@ -519,30 +519,6 @@ public:
DECLARE_CHECKER_INSTANCE(IsDirectionalChecker);
};
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();

View File

@@ -123,19 +123,12 @@ std::string MapObject::GetLocalizedAllTypes(bool withMainType) const
auto const & subtypes = ftypes::Subtypes::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;