From e6102cebc82a3afc6042f6ec80a9f142fd98e71d Mon Sep 17 00:00:00 2001 From: MapsWithMe OSM User Date: Fri, 12 Apr 2013 13:28:25 +0200 Subject: [generator] Added -fail_on_coasts flag which will stop generation if coasts are not merged --- generator/feature_generator.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'generator/feature_generator.cpp') 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 > emitter(m_coastsHolder.get(), m_countries.get()); feature::ForEachFromDatRawFormat(m_srcCoastsFile, emitter); } + + return true; } inline void GetNames(vector & 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) -- cgit v1.2.3