mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-17 16:34:50 +00:00
[generator] Move special cases for charging stations with implicit car tagging to generator
Signed-off-by: Yannik Bloscheck <git@yannikbloscheck.com> Co-authored-by: Yannik Bloscheck <git@yannikbloscheck.com> Co-committed-by: Yannik Bloscheck <git@yannikbloscheck.com>
This commit is contained in:
@@ -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.
|
@@ -270,6 +270,10 @@ public:
|
||||
ShuttleTrain,
|
||||
DisusedBusiness,
|
||||
Building,
|
||||
ChargingStation,
|
||||
SmallChargingStation,
|
||||
MotorcarChargingStation,
|
||||
CarlessChargingStation,
|
||||
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"}},
|
||||
{CarlessChargingStation, {"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 carlessChargingStation = types.Get(CachedTypes::CarlessChargingStation);
|
||||
|
||||
if (!params.IsTypeExist(motorcarChargingStation) && !params.IsTypeExist(carlessChargingStation))
|
||||
params.AddType(motorcarChargingStation);
|
||||
|
||||
if (params.IsTypeExist(carlessChargingStation))
|
||||
{
|
||||
params.PopExactType(carlessChargingStation);
|
||||
|
||||
uint32_t const smallChargingStation = types.Get(CachedTypes::SmallChargingStation);
|
||||
if (params.IsTypeExist(smallChargingStation))
|
||||
params.PopExactType(smallChargingStation);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -746,24 +746,6 @@ IsPublicTransportStopChecker::IsPublicTransportStopChecker()
|
||||
m_types.push_back(c.GetTypeByPath({"railway", "tram_stop"}));
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -511,30 +511,6 @@ public:
|
||||
DECLARE_CHECKER_INSTANCE(IsPublicTransportStopChecker);
|
||||
};
|
||||
|
||||
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();
|
||||
|
||||
@@ -122,19 +122,12 @@ std::string MapObject::GetLocalizedAllTypes(bool withMainType) const
|
||||
auto const & isPoi = ftypes::IsPoiChecker::Instance();
|
||||
auto const & subtypes = ftypes::Subtypes::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;
|
||||
|
||||
Reference in New Issue
Block a user