File indexing completed on 2024-05-12 15:29:54

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2015 Stanciu Marius-Valeriu <stanciumarius94@gmail.com>
0004 //
0005 
0006 #ifndef MARBLE_OSMTAGEDITORWIDGETPRIVATE_H
0007 #define MARBLE_OSMTAGEDITORWIDGETPRIVATE_H
0008 
0009 #include "ui_OsmTagEditorWidget.h"
0010 
0011 #include <QPair>
0012 
0013 namespace Marble
0014 {
0015 
0016 class GeoDataPlacemark;
0017 class OsmPlacemarkData;
0018 class OsmTagEditorWidget;
0019 
0020 class OsmTagEditorWidgetPrivate : public Ui::OsmTagEditorWidgetPrivate
0021 {
0022 public:
0023     typedef QPair<QString, QString> OsmTag;
0024     OsmTagEditorWidgetPrivate();
0025     ~OsmTagEditorWidgetPrivate();
0026     void populatePresetTagsList();
0027     void populateCurrentTagsList();
0028 
0029 private:
0030     friend class OsmTagEditorWidget;
0031     static QTreeWidgetItem *tagWidgetItem(const OsmTag &tag);
0032 
0033     /**
0034      * @brief recommendedTags builds a list of tags that are recommended by osm standards
0035      * taking the placemark's type and osmData in consideration.
0036      */
0037     QList<OsmTag> recommendedTags() const;
0038 
0039     /**
0040      * @brief generateTagFilter this is where the filter criteria for the recommended tags list
0041      * are set.
0042      */
0043     QStringList generateTagFilter() const;
0044 
0045     /**
0046      * @brief containsAny convenience function that determines whether the placemark contains
0047      * any of the given parameter tags
0048      */
0049     static bool containsAny(const OsmPlacemarkData &osmData, const QStringList &tags);
0050 
0051     /**
0052      * @brief addPattern convenience function that takes a list of OsmTags
0053      * and adds their keys to the filter, if the placemark doesn't already have them
0054      */
0055     static void addPattern(QStringList &filter, const OsmPlacemarkData &osmData, const QStringList &pattern);
0056 
0057     /**
0058      * @brief returns a list of useful, popular osm tags that currently don't have a visual category associated with them
0059      */
0060     static QVector<OsmTag> createAdditionalOsmTags();
0061 
0062     GeoDataPlacemark *m_placemark;
0063     static const QString m_customTagAdderText;
0064 };
0065 
0066 }
0067 
0068 #endif