File indexing completed on 2024-04-28 04:41:15

0001 /*
0002     SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef LINEINFO_H
0008 #define LINEINFO_H
0009 
0010 #include <osm/datatypes.h>
0011 #include <wikidata/entities.h>
0012 
0013 #include <QColor>
0014 #include <QString>
0015 
0016 struct LineInfo
0017 {
0018     Q_GADGET
0019 public:
0020 
0021     LineInfo();
0022     ~LineInfo();
0023 
0024     enum Mode { // ordered by accuracy in OSM data, ie. higher value -> higher probability of being the correctly detected mode
0025         Unknown,
0026         Train, // any kind of rail service
0027         LongDistance,
0028         LocalTrain,
0029         RapidTransit,
0030         Tram,
0031         Subway,
0032     };
0033     Q_ENUM(Mode)
0034 
0035     static bool isUseful(const LineInfo &info);
0036     static Mode determineMode(const OSM::Relation &rel);
0037     static LineInfo fromRelation(const OSM::Relation &rel);
0038     static void merge(LineInfo &lhs, const LineInfo &rhs);
0039 
0040     OSM::Id relId;
0041     OSM::BoundingBox bbox;
0042     QString name;
0043     QColor color;
0044     Mode mode = Unknown;
0045     QStringList lineLogos;
0046     QStringList productLogos;
0047     Wikidata::Q wdId;
0048     std::vector<Wikidata::Q> wdProducts;
0049 };
0050 
0051 QDebug operator<<(QDebug debug, const LineInfo &info);
0052 
0053 #endif // LINEINFO_H