MCPcopy Create free account
hub / github.com/comaps/comaps / PrintDiff

Method PrintDiff

tools/poly_borders/borders_data.cpp:230–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230void BordersData::PrintDiff()
231{
232 using Info = std::tuple<double, std::string, size_t, size_t>;
233
234 std::set<Info> info;
235
236 size_t allNumberBeforeCount = 0;
237 size_t maxMwmNameLength = 0;
238 for (size_t i = 0; i < m_bordersPolygons.size(); ++i)
239 {
240 auto const & mwmName = m_indexToPolyFileName[i];
241
242 auto const all = static_cast<int32_t>(m_bordersPolygons[i].m_points.size());
243 auto const allBefore = static_cast<int32_t>(m_prevCopy[i].m_points.size());
244
245 CHECK_GREATER_OR_EQUAL(allBefore, all, ());
246 m_removedPointsCount += allBefore - all;
247 allNumberBeforeCount += allBefore;
248
249 double area = 0.0;
250 double constexpr kAreaEpsMetersSqr = 1e-4;
251 if (m_additionalAreaMetersSqr[i] >= kAreaEpsMetersSqr)
252 area = m_additionalAreaMetersSqr[i];
253
254 maxMwmNameLength = std::max(maxMwmNameLength, mwmName.size());
255 info.emplace(area, mwmName, allBefore, all);
256 }
257
258 for (auto const & [area, name, allBefore, all] : info)
259 {
260 size_t diff = allBefore - all;
261 PrintWithSpaces(name, maxMwmNameLength + 1);
262 PrintWithSpaces("-" + std::to_string(diff) + " points", 17);
263
264 std::cout << " total changed area: " << area << " m^2" << std::endl;
265 }
266
267 CHECK_NOT_EQUAL(allNumberBeforeCount, 0, ("Empty input?"));
268 std::cout << "Number of removed points: " << m_removedPointsCount << std::endl
269 << "Removed duplicate point: " << m_duplicatedPointsCount << std::endl
270 << "Total removed points: " << m_removedPointsCount + m_duplicatedPointsCount << std::endl;
271 std::cout << "Points number before processing: " << allNumberBeforeCount << ", remove( "
272 << static_cast<double>(m_removedPointsCount + m_duplicatedPointsCount) / allNumberBeforeCount * 100.0
273 << "% )" << std::endl;
274}
275
276void BordersData::RemoveEmptySpaceBetweenBorders()
277{

Callers 1

mainFunction · 0.80

Calls 4

to_stringFunction · 0.85
PrintWithSpacesFunction · 0.70
sizeMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected