Commit 5dc9ba8b authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Remove annotations tags (comment, note, fixme, todo, source, ...)

parent 55e24cda
......@@ -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();
......
......@@ -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;
......
......@@ -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"));
}
}
......@@ -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;
};
......
......@@ -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);
......
Supports Markdown
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