From aff28e7abfb25f9f953b6be6dfe37157dfd97a37 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Wed, 23 Feb 2011 21:10:47 +0100 Subject: [PATCH] Added some logging when merging coastlines --- indexer/indexer_tool/world_map_generator.hpp | 26 ++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/indexer/indexer_tool/world_map_generator.hpp b/indexer/indexer_tool/world_map_generator.hpp index 2d8d271104..fefd0815ea 100644 --- a/indexer/indexer_tool/world_map_generator.hpp +++ b/indexer/indexer_tool/world_map_generator.hpp @@ -4,6 +4,7 @@ #include "../../defines.hpp" +#include "../../indexer/classificator.hpp" #include "../../indexer/feature.hpp" #include "../../indexer/feature_merger.hpp" #include "../../indexer/feature_visibility.hpp" @@ -13,6 +14,7 @@ #include "../../std/list.hpp" #include "../../std/vector.hpp" #include "../../std/functional.hpp" +#include "../../std/iostream.hpp" #include #include @@ -34,6 +36,9 @@ class WorldMapGenerator int m_maxWorldScale; bool m_mergeCoastlines; + size_t m_mergedCounter; + size_t m_areasCounter; + typedef boost::unordered_map FeaturesContainerT; typedef map, FeaturesContainerT> TypesContainerT; TypesContainerT m_features; @@ -51,10 +56,12 @@ private: CHECK(found != base, ()); base->second.AppendFeature(found->second); features.erase(found); + ++m_mergedCounter; if (base->second.FirstPoint() == base->second.LastPoint()) { // @TODO create area feature (*m_worldBucket)(base->second); features.erase(base); + ++m_areasCounter; } return true; } @@ -71,12 +78,14 @@ private: { fbm.AppendFeature(found->second); container.erase(found); + ++m_mergedCounter; } if (fbm.FirstPoint() == fbm.LastPoint()) { // @TODO create area feature (*m_worldBucket)(fbm); + ++m_areasCounter; return; } pair result = container.insert(make_pair(fbm.FirstPoint(), fbm)); @@ -89,10 +98,19 @@ private: } } + struct FeatureTypePrinter + { + void operator()(uint32_t type) const + { + cout << classif().GetFullObjectName(type) << "."; + } + }; + public: WorldMapGenerator(int maxWorldScale, bool mergeCoastlines, typename FeatureOutT::InitDataType featureOutInitData) - : m_maxWorldScale(maxWorldScale), m_mergeCoastlines(mergeCoastlines) + : m_maxWorldScale(maxWorldScale), m_mergeCoastlines(mergeCoastlines), + m_mergedCounter(0), m_areasCounter(0) { if (maxWorldScale >= 0) m_worldBucket.reset(new FeatureOutT(WORLD_FILE_NAME, featureOutInitData)); @@ -107,6 +125,7 @@ public: // try to merge all merged features with each other for (TypesContainerT::iterator it = m_features.begin(); it != m_features.end(); ++it) { + LOG(LINFO, (it->second.size())); while (ReMergeFeatures(it->second)) {} // emit all merged features @@ -117,8 +136,8 @@ public: if (m_mergeCoastlines) { LOG(LINFO, ("Final merging of coastlines ended")); + LOG(LINFO, ("Merged features:", m_mergedCounter, "new areas created:", m_areasCounter)); } - } bool operator()(FeatureBuilder1 const & fb) @@ -130,6 +149,9 @@ public: CHECK_GREATER(minScale, -1, ("Non-drawable feature found!?")); if (m_maxWorldScale >= minScale) { + FeatureTypePrinter typePrinter; + fBase.ForEachTypeRef(typePrinter); + cout << endl; if (m_mergeCoastlines) { // we're merging only linear features,