mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 22:53:43 +00:00
[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:
committed by
skadge
parent
de6953598b
commit
f8d786958a
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user