[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

@@ -9,6 +9,23 @@ struct MetadataTagProcessorImpl
{
MetadataTagProcessorImpl(FeatureBuilderParams & params) : m_params(params) {}
/** Parse OSM attributes for socket types and add them to m_chargeSockets.
*
* Examples of (k,v) pairs:
* ("socket:type2_combo", "2")
* ("socket:type2_combo:output", "150 kW")
* ("socket:chademo", "1")
* ("socket:chademo:output", "50") // assumes kW
*/
void AggregateChargeSocket(std::string const & k, std::string const & v);
/** Output the list of all sockets for a given charging station in the format
* <type>|<nb>|[<power>];...
*
* For instance:
* "type2_combo|2|150;chademo|1|50;type2|2|"
*/
std::string StringifyChargeSockets() const;
std::string ValidateAndFormat_maxspeed(std::string const & v) const;
static std::string ValidateAndFormat_stars(std::string const & v);
std::string ValidateAndFormat_operator(std::string const & v) const;
@@ -45,6 +62,21 @@ struct MetadataTagProcessorImpl
static std::string ValidateAndFormat_outdoor_seating(std::string v);
protected:
// struct to store the representation of a charging station socket
struct ChargeSocketDescriptor
{
std::string type; // https://wiki.openstreetmap.org/wiki/Key:socket:*
// e.g. "type1"
std::string count; // number of sockets or 'y' if OSM tag was set to 'yes'.
// ("" if unknown)
std::string output_kW; // optional power output, in kW ("" if unknown)
};
typedef std::vector<ChargeSocketDescriptor> ChargeSocketDescriptors;
// stores information about charge sockets in charging stations.
// Incrementally completed in AggregateChargeSocket
ChargeSocketDescriptors m_chargeSockets;
FeatureBuilderParams & m_params;
};