MCPcopy Create free account
hub / github.com/comaps/comaps / operator()

Method operator()

generator/statistics.cpp:51–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 explicit AccumulateStatistic(MapInfo & info) : m_info(info) {}
50
51 void operator()(FeatureType & f, uint32_t)
52 {
53 f.ParseAllBeforeGeometry();
54
55 FeatureType::InnerGeomStat const innerStats = f.GetInnerStats();
56
57 m_info.m_innerPoints.Add(innerStats.m_points);
58 m_info.m_innerFirstPoints.Add(innerStats.m_firstPoints);
59 m_info.m_innerStrips.Add(innerStats.m_strips);
60 m_info.m_innerSize.Add(innerStats.m_size);
61
62 // Get size stats and load the best geometry.
63 FeatureType::GeomStat const geom = f.GetOuterGeometryStats();
64 FeatureType::GeomStat const trg = f.GetOuterTrianglesStats();
65
66 uint32_t outerGeomSize = 0, outerTrgSize = 0;
67 for (size_t ind = 0; ind < DataHeader::kMaxScalesCount; ++ind)
68 {
69 auto const geomSize = geom.m_sizes[ind], geomElems = geom.m_elements[ind], trgSize = trg.m_sizes[ind],
70 trgElems = trg.m_elements[ind];
71 m_info.m_byLineGeom[ind].Add(geomSize, geomElems);
72 outerGeomSize += geomSize;
73 m_info.m_byAreaGeom[ind].Add(trgSize, trgElems);
74 outerTrgSize += trgSize;
75
76 if (ind > 0)
77 {
78 // If a feature has a more simplified version of current geometry.
79 if (geom.m_elements[ind - 1] > 0)
80 m_info.m_byLineGeomComparedS[ind].Add(geomSize, geomElems);
81 if (trg.m_elements[ind - 1] > 0)
82 m_info.m_byAreaGeomComparedS[ind].Add(trgSize, trgElems);
83 }
84
85 if (ind < DataHeader::kMaxScalesCount - 1)
86 {
87 // If a feature has a more detailed version of current geometry.
88 if (geom.m_elements[ind + 1] > 0)
89 {
90 m_info.m_byLineGeomComparedD[ind].Add(geomSize, geomElems);
91 // If feature's current geometry is very similar to a more detailed one
92 // (number of elements is <geomMinDiff less or <geomMinFactor times less).
93 if (geomElems + m_info.m_geomMinDiff > geom.m_elements[ind + 1] ||
94 geomElems * m_info.m_geomMinFactor > geom.m_elements[ind + 1])
95 m_info.m_byLineGeomDup[ind].Add(geomSize, geomElems);
96 }
97 if (trg.m_elements[ind + 1] > 0)
98 {
99 m_info.m_byAreaGeomComparedD[ind].Add(trgSize, trgElems);
100 if (trgElems + m_info.m_geomMinDiff > trg.m_elements[ind + 1] ||
101 trgElems * m_info.m_geomMinFactor > trg.m_elements[ind + 1])
102 m_info.m_byAreaGeomDup[ind].Add(trgSize, trgElems);
103 }
104 }
105 }
106
107 m_info.m_byPointsCount[CountType(geom.m_elements[DataHeader::kMaxScalesCount - 1])].Add(innerStats.m_points +
108 outerGeomSize);

Callers

nothing calls this directly

Calls 14

GetAreaIndexFunction · 0.85
GetInnerStatsMethod · 0.80
GetOuterGeometryStatsMethod · 0.80
CountLangsMethod · 0.80
AreaOnEarthFunction · 0.70
DistanceOnEarthFunction · 0.50
AddMethod · 0.45
GetGeomTypeMethod · 0.45
ForEachPointMethod · 0.45
ForEachTriangleMethod · 0.45

Tested by

no test coverage detected