summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-04 19:20:33 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-10-04 19:49:05 (GMT)
commit5dc9ba8bf7bca2a5f699949a751394cb53d29b80 (patch)
tree43c521b4c2f36f100c64d8d21d7c83119dcabf63
parent55e24cdac3d0daf79389562975e718dc8801dace (diff)
Remove annotations tags (comment, note, fixme, todo, source, ...)
-rw-r--r--src/lib/marble/osm/OsmPlacemarkData.cpp10
-rw-r--r--src/lib/marble/osm/OsmPlacemarkData.h2
-rw-r--r--tools/vectorosm-tilecreator/TagsFilter.cpp29
-rw-r--r--tools/vectorosm-tilecreator/TagsFilter.h5
-rw-r--r--tools/vectorosm-tilecreator/main.cpp1
5 files changed, 47 insertions, 0 deletions
diff --git a/src/lib/marble/osm/OsmPlacemarkData.cpp b/src/lib/marble/osm/OsmPlacemarkData.cpp
index 01996ac..466b32d 100644
--- a/src/lib/marble/osm/OsmPlacemarkData.cpp
+++ b/src/lib/marble/osm/OsmPlacemarkData.cpp
@@ -186,6 +186,11 @@ void OsmPlacemarkData::changeNodeReference( const GeoDataCoordinates &oldKey, co
m_nodeReferences.remove( oldKey );
}
+QHash<GeoDataCoordinates, OsmPlacemarkData> &OsmPlacemarkData::nodeReferences()
+{
+ return m_nodeReferences;
+}
+
QHash< GeoDataCoordinates, OsmPlacemarkData >::const_iterator OsmPlacemarkData::nodeReferencesBegin() const
{
return m_nodeReferences.begin();
@@ -237,6 +242,11 @@ bool OsmPlacemarkData::containsMemberReference( int key ) const
return m_memberReferences.contains( key );
}
+QHash<int, OsmPlacemarkData> &OsmPlacemarkData::memberReferences()
+{
+ return m_memberReferences;
+}
+
QHash< int, OsmPlacemarkData >::const_iterator OsmPlacemarkData::memberReferencesBegin() const
{
return m_memberReferences.begin();
diff --git a/src/lib/marble/osm/OsmPlacemarkData.h b/src/lib/marble/osm/OsmPlacemarkData.h
index 8671516..23b3f8c 100644
--- a/src/lib/marble/osm/OsmPlacemarkData.h
+++ b/src/lib/marble/osm/OsmPlacemarkData.h
@@ -141,6 +141,7 @@ public:
/**
* @brief iterators for the reference hashes.
*/
+ QHash< GeoDataCoordinates, OsmPlacemarkData > & nodeReferences();
QHash< GeoDataCoordinates, OsmPlacemarkData >::const_iterator nodeReferencesBegin() const;
QHash< GeoDataCoordinates, OsmPlacemarkData >::const_iterator nodeReferencesEnd() const;
@@ -164,6 +165,7 @@ public:
void removeMemberReference( int key );
bool containsMemberReference( int key ) const;
+ QHash< int, OsmPlacemarkData > & memberReferences();
QHash< int, OsmPlacemarkData >::const_iterator memberReferencesBegin() const;
QHash< int, OsmPlacemarkData >::const_iterator memberReferencesEnd() const;
diff --git a/tools/vectorosm-tilecreator/TagsFilter.cpp b/tools/vectorosm-tilecreator/TagsFilter.cpp
index 7a03136..5b80f24 100644
--- a/tools/vectorosm-tilecreator/TagsFilter.cpp
+++ b/tools/vectorosm-tilecreator/TagsFilter.cpp
@@ -98,4 +98,33 @@ GeoDataDocument *TagsFilter::accepted()
return m_accepted;
}
+void TagsFilter::removeAnnotationTags(GeoDataDocument *document)
+{
+ foreach (auto placemark, document->placemarkList()) {
+ auto & osmData = placemark->osmData();
+ removeAnnotationTags(osmData);
+ for (auto & reference: osmData.nodeReferences()) {
+ removeAnnotationTags(reference);
+ }
+ for (auto & reference: osmData.memberReferences()) {
+ removeAnnotationTags(reference);
+ }
+ }
+}
+
+void TagsFilter::removeAnnotationTags(OsmPlacemarkData &osmData)
+{
+ osmData.removeTag(QLatin1String("comment"));
+ osmData.removeTag(QLatin1String("note"));
+ osmData.removeTag(QLatin1String("note:de"));
+ osmData.removeTag(QLatin1String("fixme"));
+ osmData.removeTag(QLatin1String("todo"));
+ osmData.removeTag(QLatin1String("source"));
+ osmData.removeTag(QLatin1String("source:geometry"));
+ osmData.removeTag(QLatin1String("source:name"));
+ osmData.removeTag(QLatin1String("source:addr"));
+ osmData.removeTag(QLatin1String("source:ref"));
+ osmData.removeTag(QLatin1String("source_ref"));
+}
+
}
diff --git a/tools/vectorosm-tilecreator/TagsFilter.h b/tools/vectorosm-tilecreator/TagsFilter.h
index 505a697..779aac3 100644
--- a/tools/vectorosm-tilecreator/TagsFilter.h
+++ b/tools/vectorosm-tilecreator/TagsFilter.h
@@ -13,6 +13,7 @@
#define MARBLE_TAGSFILTER_H
#include "BaseFilter.h"
+#include "OsmPlacemarkData.h"
#include <QMap>
#include <QString>
@@ -33,7 +34,11 @@ public:
GeoDataDocument* accepted();
+ static void removeAnnotationTags(GeoDataDocument* document);
+
private:
+ static void removeAnnotationTags(OsmPlacemarkData &osmData);
+
GeoDataDocument* m_accepted;
QVector<GeoDataPlacemark*> m_rejectedObjects;
};
diff --git a/tools/vectorosm-tilecreator/main.cpp b/tools/vectorosm-tilecreator/main.cpp
index e492301..e3e66c9 100644
--- a/tools/vectorosm-tilecreator/main.cpp
+++ b/tools/vectorosm-tilecreator/main.cpp
@@ -217,6 +217,7 @@ int main(int argc, char *argv[])
}
}
GeoDataDocument* tile1 = mapTiles.clip(zoomLevel, tileId.x(), tileId.y());
+ TagsFilter::removeAnnotationTags(tile1);
GeoDataDocument* tile2 = loader.clip(zoomLevel, tileId.x(), tileId.y());
GeoDataDocument* combined = mergeDocuments(tile1, tile2);
NodeReducer nodeReducer(combined, zoomLevel);