diff options
author | MapsWithMe OSM User <admin@mapswithme.com> | 2013-04-12 15:28:25 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:52:59 +0300 |
commit | e6102cebc82a3afc6042f6ec80a9f142fd98e71d (patch) | |
tree | 28b4bf0f9d9af1b29fd75a18a9876ffdc21a167d /generator/feature_generator.cpp | |
parent | bc752c729ca3187a3932f363927dea34f69c737a (diff) |
[generator] Added -fail_on_coasts flag which will stop generation if coasts are not merged
Diffstat (limited to 'generator/feature_generator.cpp')
-rw-r--r-- | generator/feature_generator.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/generator/feature_generator.cpp b/generator/feature_generator.cpp index 4e23c671ac..2f7fb54a8d 100644 --- a/generator/feature_generator.cpp +++ b/generator/feature_generator.cpp @@ -334,15 +334,17 @@ public: (*m_countries)(fb); } } - - void Finish() + /// @return false if coasts are not merged and FLAG_fail_on_coasts is set + bool Finish() { if (m_world) m_world->DoMerge(); if (m_coasts) { - m_coasts->Finish(); + // Check and stop if some coasts were not merged + if (!m_coasts->Finish()) + return false; size_t const count = m_coasts->GetCellsCount(); LOG(LINFO, ("Generating coastline polygons", count)); @@ -363,6 +365,8 @@ public: Polygonizer<FeaturesCollector> > emitter(m_coastsHolder.get(), m_countries.get()); feature::ForEachFromDatRawFormat(m_srcCoastsFile, emitter); } + + return true; } inline void GetNames(vector<string> & names) const @@ -392,7 +396,9 @@ bool GenerateImpl(GenerateInfo & info) bucketer, holder, info.m_makeCoasts ? classif().GetCoastType() : 0); ParseXMLFromStdIn(parser); - bucketer.Finish(); + // Stop if coasts are not merged and FLAG_fail_on_coasts is set + if (!bucketer.Finish()) + return false; bucketer.GetNames(info.m_bucketNames); } catch (Reader::Exception const & e) |