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

Add copyTags method to avoid redundancy

parent bc4e5df8
......@@ -107,15 +107,7 @@ GeoDataDocument *TinyPlanetProcessor::cutToTiles(unsigned int zoomLevel, unsigne
GeoDataPlacemark* newPlacemark = new GeoDataPlacemark();
newPlacemark->setGeometry(newMarbleWay);
newPlacemark->setVisualCategory(placemark->visualCategory());
OsmPlacemarkData osmData;
auto it = placemark->osmData().tagsBegin();
auto itEnd = placemark->osmData().tagsEnd();
while(it != itEnd) {
osmData.addTag(it.key(), it.value());
++it;
}
newPlacemark->setOsmData(osmData);
copyTags(*placemark, *newPlacemark);
tile->append(newPlacemark);
}
......@@ -141,15 +133,7 @@ GeoDataDocument *TinyPlanetProcessor::cutToTiles(unsigned int zoomLevel, unsigne
GeoDataPlacemark* newPlacemark = new GeoDataPlacemark();
newPlacemark->setGeometry(newMarbleWay);
newPlacemark->setVisualCategory(placemark->visualCategory());
OsmPlacemarkData osmData;
auto it = placemark->osmData().tagsBegin();
auto itEnd = placemark->osmData().tagsEnd();
while(it != itEnd) {
osmData.addTag(it.key(), it.value());
++it;
}
newPlacemark->setOsmData(osmData);
copyTags(*placemark, *newPlacemark);
tile->append(newPlacemark);
}
......@@ -163,3 +147,12 @@ GeoDataDocument *TinyPlanetProcessor::cutToTiles(unsigned int zoomLevel, unsigne
return tile;
}
void TinyPlanetProcessor::copyTags(const GeoDataPlacemark &source, GeoDataPlacemark &target) const
{
auto const originalPlacemarkData = source.osmData();
OsmPlacemarkData & osmData = target.osmData();
for (auto iter=originalPlacemarkData.tagsBegin(), end=originalPlacemarkData.tagsEnd(); iter != end; ++iter) {
osmData.addTag(iter.key(), iter.value());
}
}
......@@ -21,6 +21,9 @@ public:
virtual void process();
GeoDataDocument* cutToTiles(unsigned int zoomLevel, unsigned int tileX, unsigned int tileY);
private:
void copyTags(const GeoDataPlacemark &source, GeoDataPlacemark &target) const;
};
#endif // TINYPLANETPROCESSOR_H
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