Files
comaps/generator/final_processor_coastline.cpp
Konstantin Pastbin bfffa1fff4 Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
2025-08-17 14:32:37 +07:00

47 lines
1.5 KiB
C++

#include "generator/final_processor_coastline.hpp"
#include "generator/feature_builder.hpp"
#include "generator/feature_generator.hpp"
namespace generator
{
using namespace feature;
CoastlineFinalProcessor::CoastlineFinalProcessor(std::string const & filename, size_t threadsCount)
: FinalProcessorIntermediateMwmInterface(FinalProcessorPriority::WorldCoasts)
, m_filename(filename)
, m_threadsCount(threadsCount)
{}
void CoastlineFinalProcessor::SetCoastlinesFilenames(std::string const & geomFilename,
std::string const & rawGeomFilename)
{
m_coastlineGeomFilename = geomFilename;
m_coastlineRawGeomFilename = rawGeomFilename;
}
void CoastlineFinalProcessor::Process()
{
ForEachFeatureRawFormat<serialization_policy::MaxAccuracy>(
m_filename, [this](FeatureBuilder const & fb, uint64_t) { m_generator.Process(fb); });
FeaturesAndRawGeometryCollector collector(m_coastlineGeomFilename, m_coastlineRawGeomFilename);
// Check and stop if some coasts were not merged.
CHECK(m_generator.Finish(), ());
LOG(LINFO, ("Generating coastline polygons."));
size_t totalFeatures = 0;
size_t totalPoints = 0;
size_t totalPolygons = 0;
for (auto const & fb : m_generator.GetFeatures(m_threadsCount))
{
collector.Collect(fb);
++totalFeatures;
totalPoints += fb.GetPointsCount();
totalPolygons += fb.GetPolygonsCount();
}
LOG(LINFO, ("Total features:", totalFeatures, "total polygons:", totalPolygons, "total points:", totalPoints));
}
} // namespace generator