[generator] retrieve socket:* OSM tags used by amenity:charging_station

Currently support the following socket types:
- type 1
- type 1 combo
- type 2 (wired or wo/ cable)
- type 2 combo
- chademo
- nacs

This commit also adds initial display of the socket types and power
the to Qt desktop app.

Signed-off-by: Séverin Lemaignan <severin@guakamole.org>
This commit is contained in:
Séverin Lemaignan
2025-09-10 00:08:16 +02:00
committed by skadge
parent de6953598b
commit f8d786958a
8 changed files with 330 additions and 2 deletions

View File

@@ -178,6 +178,57 @@ std::string_view MapObject::GetOpeningHours() const
return m_metadata.Get(MetadataID::FMD_OPEN_HOURS);
}
ChargeSocketDescriptors MapObject::GetChargeSockets() const
{
ChargeSocketDescriptors sockets;
auto s = std::string(m_metadata.Get(MetadataID::FMD_CHARGE_SOCKETS));
if (s.empty())
return sockets;
auto tokens = strings::Tokenize(s, ";");
for (auto token : tokens)
{
if (token.empty())
continue;
auto fields = strings::Tokenize(token, "|");
if (fields.size() < 3)
continue; // invalid entry, skip
ChargeSocketDescriptor desc;
desc.type = fields[0];
try
{
desc.count = std::stoi(std::string(fields[1]));
}
catch (...)
{
desc.count = 0;
}
if (fields.size() >= 3)
{
try
{
desc.power = std::stod(std::string(fields[2]));
}
catch (...)
{
desc.power = 0;
}
}
else
desc.power = 0;
sockets.push_back(desc);
}
return sockets;
}
feature::Internet MapObject::GetInternet() const
{
return feature::InternetFromString(m_metadata.Get(MetadataID::FMD_INTERNET));
@@ -242,6 +293,11 @@ int MapObject::GetStars() const
return count;
}
std::string MapObject::GetCapacity() const
{
return std::string(m_metadata.Get(MetadataID::FMD_CAPACITY));
}
bool MapObject::IsPointType() const
{
return m_geomType == feature::GeomType::Point;