Move special cases for charing stations with implicit car tagging to generator

Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
Yannik Bloscheck
2026-01-16 18:00:47 +01:00
parent 942575af60
commit 1fae6a11d9
6 changed files with 28 additions and 56 deletions

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