Commit 3fb2586f authored by Bernhard Beschow's avatar Bernhard Beschow

OsmPresetLibrary::isAreaTag() was only used in OsmWay, so move it there

parent 47bf18b9
......@@ -20,6 +20,7 @@
#include <QApplication>
#include <QDate>
#include <QSet>
#include <QScreen>
namespace Marble {
......
......@@ -23,7 +23,6 @@ namespace Marble
QMap<OsmPresetLibrary::OsmTag, GeoDataFeature::GeoDataVisualCategory> OsmPresetLibrary::s_visualCategories;
QList<OsmPresetLibrary::OsmTag> OsmPresetLibrary::s_additionalOsmTags;
QSet<QString> OsmPresetLibrary::s_areaTags;
void OsmPresetLibrary::initializeOsmVisualCategories()
{
......@@ -517,81 +516,6 @@ QList<OsmPresetLibrary::OsmTag>::const_iterator OsmPresetLibrary::additionalTags
return s_additionalOsmTags.constEnd();
}
bool OsmPresetLibrary::isAreaTag(const QString &keyValue)
{
if (s_areaTags.isEmpty()) {
// All these tags can be found updated at
// http://wiki.openstreetmap.org/wiki/Map_Features#Landuse
s_areaTags.insert( "landuse=forest" );
s_areaTags.insert( "natural=water" );
s_areaTags.insert( "natural=wood" );
s_areaTags.insert( "natural=beach" );
s_areaTags.insert( "natural=wetland" );
s_areaTags.insert( "natural=glacier" );
s_areaTags.insert( "natural=scrub" );
s_areaTags.insert( "natural=cliff" );
s_areaTags.insert( "area=yes" );
s_areaTags.insert( "waterway=riverbank" );
foreach(const QString &value, buildingValues() ) {
s_areaTags.insert( QString("building=%1").arg(value) );
}
s_areaTags.insert( "man_made=bridge" );
s_areaTags.insert( "amenity=graveyard" );
s_areaTags.insert( "amenity=parking" );
s_areaTags.insert( "amenity=parking_space" );
s_areaTags.insert( "amenity=bicycle_parking" );
s_areaTags.insert( "amenity=college" );
s_areaTags.insert( "amenity=hospital" );
s_areaTags.insert( "amenity=school" );
s_areaTags.insert( "amenity=university" );
s_areaTags.insert( "leisure=common" );
s_areaTags.insert( "leisure=garden" );
s_areaTags.insert( "leisure=golf_course" );
s_areaTags.insert( "leisure=playground" );
s_areaTags.insert( "leisure=pitch" );
s_areaTags.insert( "leisure=park" );
s_areaTags.insert( "leisure=sports_centre" );
s_areaTags.insert( "leisure=stadium" );
s_areaTags.insert( "leisure=swimming_pool" );
s_areaTags.insert( "leisure=track" );
s_areaTags.insert( "military=danger_area" );
s_areaTags.insert( "landuse=allotments" );
s_areaTags.insert( "landuse=basin" );
s_areaTags.insert( "landuse=brownfield" );
s_areaTags.insert( "landuse=cemetery" );
s_areaTags.insert( "landuse=commercial" );
s_areaTags.insert( "landuse=construction" );
s_areaTags.insert( "landuse=farm" );
s_areaTags.insert( "landuse=farmland" );
s_areaTags.insert( "landuse=farmyard" );
s_areaTags.insert( "landuse=garages" );
s_areaTags.insert( "landuse=greenfield" );
s_areaTags.insert( "landuse=industrial" );
s_areaTags.insert( "landuse=landfill" );
s_areaTags.insert( "landuse=meadow" );
s_areaTags.insert( "landuse=military" );
s_areaTags.insert( "landuse=orchard" );
s_areaTags.insert( "landuse=quarry" );
s_areaTags.insert( "landuse=railway" );
s_areaTags.insert( "landuse=reservoir" );
s_areaTags.insert( "landuse=residential" );
s_areaTags.insert( "landuse=retail" );
s_areaTags.insert( "landuse=orchard" );
s_areaTags.insert( "landuse=vineyard" );
s_areaTags.insert( "landuse=grass" );
s_areaTags.insert( "marble_land=landmass" );
s_areaTags.insert( "settlement=yes" );
}
return s_areaTags.contains(keyValue);
}
QStringList OsmPresetLibrary::shopValues()
{
// from https://taginfo.openstreetmap.org/keys/building#values
......
......@@ -14,7 +14,6 @@
#include <QMap>
#include <QPair>
#include <QIcon>
#include <QSet>
#include "GeoDataFeature.h"
#include <GeoDataStyle.h>
......@@ -62,8 +61,6 @@ public:
static QList<OsmTag>::const_iterator additionalTagsBegin();
static QList<OsmTag>::const_iterator additionalTagsEnd();
static bool isAreaTag(const QString &keyValue);
static QStringList shopValues();
static QStringList buildingValues();
......@@ -82,8 +79,6 @@ private:
* @brief s_additionalOsmTags is a list of useful, popular osm tags that currently don't have a visual category associated with them
*/
static QList<OsmTag> s_additionalOsmTags;
static QSet<QString> s_areaTags;
};
......
......@@ -20,6 +20,7 @@
namespace Marble {
QSet<QString> OsmWay::s_areaTags;
void OsmWay::create(GeoDataDocument *document, const OsmNodes &nodes) const
{
......@@ -103,7 +104,7 @@ bool OsmWay::isArea() const
{
for (auto iter = m_osmData.tagsBegin(), end=m_osmData.tagsEnd(); iter != end; ++iter) {
QString const keyValue = QString("%1=%2").arg(iter.key()).arg(iter.value());
if (OsmPresetLibrary::isAreaTag(keyValue)) {
if (isAreaTag(keyValue)) {
return true;
}
}
......@@ -111,4 +112,79 @@ bool OsmWay::isArea() const
return false;
}
bool OsmWay::isAreaTag(const QString &keyValue)
{
if (s_areaTags.isEmpty()) {
// All these tags can be found updated at
// http://wiki.openstreetmap.org/wiki/Map_Features#Landuse
s_areaTags.insert( "landuse=forest" );
s_areaTags.insert( "natural=water" );
s_areaTags.insert( "natural=wood" );
s_areaTags.insert( "natural=beach" );
s_areaTags.insert( "natural=wetland" );
s_areaTags.insert( "natural=glacier" );
s_areaTags.insert( "natural=scrub" );
s_areaTags.insert( "natural=cliff" );
s_areaTags.insert( "area=yes" );
s_areaTags.insert( "waterway=riverbank" );
foreach(const QString &value, OsmPresetLibrary::buildingValues() ) {
s_areaTags.insert( QString("building=%1").arg(value) );
}
s_areaTags.insert( "man_made=bridge" );
s_areaTags.insert( "amenity=graveyard" );
s_areaTags.insert( "amenity=parking" );
s_areaTags.insert( "amenity=parking_space" );
s_areaTags.insert( "amenity=bicycle_parking" );
s_areaTags.insert( "amenity=college" );
s_areaTags.insert( "amenity=hospital" );
s_areaTags.insert( "amenity=school" );
s_areaTags.insert( "amenity=university" );
s_areaTags.insert( "leisure=common" );
s_areaTags.insert( "leisure=garden" );
s_areaTags.insert( "leisure=golf_course" );
s_areaTags.insert( "leisure=playground" );
s_areaTags.insert( "leisure=pitch" );
s_areaTags.insert( "leisure=park" );
s_areaTags.insert( "leisure=sports_centre" );
s_areaTags.insert( "leisure=stadium" );
s_areaTags.insert( "leisure=swimming_pool" );
s_areaTags.insert( "leisure=track" );
s_areaTags.insert( "military=danger_area" );
s_areaTags.insert( "landuse=allotments" );
s_areaTags.insert( "landuse=basin" );
s_areaTags.insert( "landuse=brownfield" );
s_areaTags.insert( "landuse=cemetery" );
s_areaTags.insert( "landuse=commercial" );
s_areaTags.insert( "landuse=construction" );
s_areaTags.insert( "landuse=farm" );
s_areaTags.insert( "landuse=farmland" );
s_areaTags.insert( "landuse=farmyard" );
s_areaTags.insert( "landuse=garages" );
s_areaTags.insert( "landuse=greenfield" );
s_areaTags.insert( "landuse=industrial" );
s_areaTags.insert( "landuse=landfill" );
s_areaTags.insert( "landuse=meadow" );
s_areaTags.insert( "landuse=military" );
s_areaTags.insert( "landuse=orchard" );
s_areaTags.insert( "landuse=quarry" );
s_areaTags.insert( "landuse=railway" );
s_areaTags.insert( "landuse=reservoir" );
s_areaTags.insert( "landuse=residential" );
s_areaTags.insert( "landuse=retail" );
s_areaTags.insert( "landuse=orchard" );
s_areaTags.insert( "landuse=vineyard" );
s_areaTags.insert( "landuse=grass" );
s_areaTags.insert( "marble_land=landmass" );
s_areaTags.insert( "settlement=yes" );
}
return s_areaTags.contains(keyValue);
}
}
......@@ -15,12 +15,14 @@
#include <osm/OsmPlacemarkData.h>
#include <GeoDataDocument.h>
#include <QSet>
#include <QString>
#include <QXmlStreamAttributes>
namespace Marble {
class OsmWay {
class OsmWay
{
public:
OsmPlacemarkData & osmData();
void addReference(qint64 id);
......@@ -33,9 +35,14 @@ public:
private:
bool isArea() const;
static bool isAreaTag(const QString &keyValue);
OsmPlacemarkData m_osmData;
QVector<qint64> m_references;
static QSet<QString> s_areaTags;
};
typedef QHash<qint64,OsmWay> OsmWays;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment