From f0c5d6ad66ae5f5d2a8f292300064e927ffff05d Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Thu, 10 Jul 2014 23:31:19 +0200 Subject: [PATCH] Code style fixes --- generator/feature_builder.cpp | 144 ++++++++++++++--------------- generator/feature_builder.hpp | 50 +++++----- generator/feature_merger.cpp | 12 +-- generator/feature_merger.hpp | 8 +- generator/statistics.cpp | 8 +- indexer/feature.cpp | 50 +++++----- indexer/feature.hpp | 56 +++++------ indexer/feature_loader.cpp | 46 ++++----- indexer/old/feature_loader_101.cpp | 46 ++++----- 9 files changed, 210 insertions(+), 210 deletions(-) diff --git a/generator/feature_builder.cpp b/generator/feature_builder.cpp index b152408fb0..bd7bacf8ec 100644 --- a/generator/feature_builder.cpp +++ b/generator/feature_builder.cpp @@ -23,7 +23,7 @@ using namespace feature; FeatureBuilder1::FeatureBuilder1() : m_coastCell(-1) { - m_Polygons.push_back(points_t()); + m_polygons.push_back(points_t()); } bool FeatureBuilder1::IsGeometryClosed() const @@ -46,21 +46,21 @@ m2::PointD FeatureBuilder1::GetGeometryCenter() const void FeatureBuilder1::SetCenter(m2::PointD const & p) { - m_Center = p; - m_Params.SetGeomType(GEOM_POINT); - m_LimitRect.Add(p); + m_center = p; + m_params.SetGeomType(GEOM_POINT); + m_limitRect.Add(p); } void FeatureBuilder1::AddPoint(m2::PointD const & p) { - m_Polygons.front().push_back(p); - m_LimitRect.Add(p); + m_polygons.front().push_back(p); + m_limitRect.Add(p); } void FeatureBuilder1::SetAreaAddHoles(list const & holes) { - m_Params.SetGeomType(GEOM_AREA); - m_Polygons.resize(1); + m_params.SetGeomType(GEOM_AREA); + m_polygons.resize(1); if (holes.empty()) return; @@ -78,7 +78,7 @@ void FeatureBuilder1::SetAreaAddHoles(list const & holes) break; if (j == count) - m_Polygons.push_back(*i); + m_polygons.push_back(*i); } } @@ -89,26 +89,26 @@ void FeatureBuilder1::AddPolygon(vector & poly) if (poly.front() != poly.back()) poly.push_back(poly.front()); - CalcRect(poly, m_LimitRect); + CalcRect(poly, m_limitRect); - if (!m_Polygons.back().empty()) - m_Polygons.push_back(points_t()); + if (!m_polygons.back().empty()) + m_polygons.push_back(points_t()); - m_Polygons.back().swap(poly); + m_polygons.back().swap(poly); } bool FeatureBuilder1::RemoveInvalidTypes() { - if (!m_Params.FinishAddingTypes()) + if (!m_params.FinishAddingTypes()) return false; - return feature::RemoveNoDrawableTypes(m_Params.m_Types, - static_cast(m_Params.GetGeomType())); + return feature::RemoveNoDrawableTypes(m_params.m_Types, + static_cast(m_params.GetGeomType())); } bool FeatureBuilder1::FormatFullAddress(string & res) const { - return m_Params.FormatFullAddress(m_LimitRect.Center(), res); + return m_params.FormatFullAddress(m_limitRect.Center(), res); } FeatureBase FeatureBuilder1::GetFeatureBase() const @@ -116,11 +116,11 @@ FeatureBase FeatureBuilder1::GetFeatureBase() const CHECK ( CheckValid(), (*this) ); FeatureBase f; - f.SetHeader(m_Params.GetHeader()); + f.SetHeader(m_params.GetHeader()); - f.m_Params = m_Params; - memcpy(f.m_Types, &m_Params.m_Types[0], sizeof(uint32_t) * m_Params.m_Types.size()); - f.m_LimitRect = m_LimitRect; + f.m_params = m_params; + memcpy(f.m_types, &m_params.m_Types[0], sizeof(uint32_t) * m_params.m_Types.size()); + f.m_limitRect = m_limitRect; f.m_bTypesParsed = f.m_bCommonParsed = true; @@ -163,27 +163,27 @@ namespace bool FeatureBuilder1::PreSerialize() { - if (!m_Params.IsValid()) + if (!m_params.IsValid()) return false; /// @todo Do not use flats info. Maybe in future. - m_Params.flats.clear(); + m_params.flats.clear(); - switch (m_Params.GetGeomType()) + switch (m_params.GetGeomType()) { case GEOM_POINT: // Store house number like HEADER_GEOM_POINT_EX. - if (!m_Params.house.IsEmpty()) + if (!m_params.house.IsEmpty()) { - m_Params.SetGeomTypePointEx(); - m_Params.rank = 0; + m_params.SetGeomTypePointEx(); + m_params.rank = 0; } // Store ref's in name field (used in "highway-motorway_junction"). - if (m_Params.name.IsEmpty() && !m_Params.ref.empty()) - m_Params.name.AddString(StringUtf8Multilang::DEFAULT_CODE, m_Params.ref); + if (m_params.name.IsEmpty() && !m_params.ref.empty()) + m_params.name.AddString(StringUtf8Multilang::DEFAULT_CODE, m_params.ref); - m_Params.ref.clear(); + m_params.ref.clear(); break; case GEOM_LINE: @@ -191,17 +191,17 @@ bool FeatureBuilder1::PreSerialize() static feature::TypeSetChecker checkHighway("highway"); // We need refs for road's numbers. - if (!checkHighway.IsEqualV(m_Params.m_Types)) - m_Params.ref.clear(); + if (!checkHighway.IsEqualV(m_params.m_Types)) + m_params.ref.clear(); - m_Params.rank = 0; - m_Params.house.Clear(); + m_params.rank = 0; + m_params.house.Clear(); break; } case GEOM_AREA: - m_Params.rank = 0; - m_Params.ref.clear(); + m_params.rank = 0; + m_params.ref.clear(); break; default: @@ -220,7 +220,7 @@ bool FeatureBuilder1::PreSerialize() void FeatureBuilder1::RemoveUselessNames() { int64_t dummy; - if (!m_Params.name.IsEmpty() && !GetCoastCell(dummy)) + if (!m_params.name.IsEmpty() && !GetCoastCell(dummy)) { using namespace feature; @@ -232,7 +232,7 @@ void FeatureBuilder1::RemoveUselessNames() { pair const range = GetDrawableScaleRangeForRules(types, RULE_ANY_TEXT); if (range.first == -1) - m_Params.name.Clear(); + m_params.name.Clear(); } } } @@ -240,38 +240,38 @@ void FeatureBuilder1::RemoveUselessNames() void FeatureBuilder1::RemoveNameIfInvisible(int minS, int maxS) { int64_t dummy; - if (!m_Params.name.IsEmpty() && !GetCoastCell(dummy)) + if (!m_params.name.IsEmpty() && !GetCoastCell(dummy)) { pair const range = GetDrawableScaleRangeForRules(GetFeatureBase(), RULE_ANY_TEXT); if (range.first > maxS || range.second < minS) - m_Params.name.Clear(); + m_params.name.Clear(); } } bool FeatureBuilder1::operator == (FeatureBuilder1 const & fb) const { - if (!(m_Params == fb.m_Params)) return false; + if (!(m_params == fb.m_params)) return false; if (m_coastCell != fb.m_coastCell) return false; - if (m_Params.GetGeomType() == GEOM_POINT && - !is_equal(m_Center, fb.m_Center)) + if (m_params.GetGeomType() == GEOM_POINT && + !is_equal(m_center, fb.m_center)) { return false; } - if (!is_equal(m_LimitRect, fb.m_LimitRect)) + if (!is_equal(m_limitRect, fb.m_limitRect)) { //LOG(LERROR, ("Different rects: ", m_LimitRect, fb.m_LimitRect)); return false; } - if (m_Polygons.size() != fb.m_Polygons.size()) + if (m_polygons.size() != fb.m_polygons.size()) return false; - list::const_iterator i = m_Polygons.begin(); - list::const_iterator j = fb.m_Polygons.begin(); - for (; i != m_Polygons.end(); ++i, ++j) + list::const_iterator i = m_polygons.begin(); + list::const_iterator j = fb.m_polygons.begin(); + for (; i != m_polygons.end(); ++i, ++j) if (!is_equal(*i, *j)) { //LOG(LERROR, ("Different points: ", *i, *j)); @@ -283,9 +283,9 @@ bool FeatureBuilder1::operator == (FeatureBuilder1 const & fb) const bool FeatureBuilder1::CheckValid() const { - CHECK(m_Params.CheckValid(), (*this)); + CHECK(m_params.CheckValid(), (*this)); - EGeomType const type = m_Params.GetGeomType(); + EGeomType const type = m_params.GetGeomType(); points_t const & poly = GetGeometry(); @@ -294,7 +294,7 @@ bool FeatureBuilder1::CheckValid() const if (type == GEOM_AREA) { - for (list::const_iterator i = m_Polygons.begin(); i != m_Polygons.end(); ++i) + for (list::const_iterator i = m_polygons.begin(); i != m_polygons.end(); ++i) CHECK(i->size() >= 3, (*this)); } @@ -305,10 +305,10 @@ void FeatureBuilder1::SerializeBase(buffer_t & data, serial::CodingParams const { PushBackByteSink sink(data); - m_Params.Write(sink); + m_params.Write(sink); - if (m_Params.GetGeomType() == GEOM_POINT) - serial::SavePoint(sink, m_Center, params); + if (m_params.GetGeomType() == GEOM_POINT) + serial::SavePoint(sink, m_center, params); } void FeatureBuilder1::Serialize(buffer_t & data) const @@ -323,11 +323,11 @@ void FeatureBuilder1::Serialize(buffer_t & data) const PushBackByteSink sink(data); - if (m_Params.GetGeomType() != GEOM_POINT) + if (m_params.GetGeomType() != GEOM_POINT) { - WriteVarUint(sink, static_cast(m_Polygons.size())); + WriteVarUint(sink, static_cast(m_polygons.size())); - for (list::const_iterator i = m_Polygons.begin(); i != m_Polygons.end(); ++i) + for (list::const_iterator i = m_polygons.begin(); i != m_polygons.end(); ++i) serial::SaveOuterPath(*i, cp, sink); } @@ -347,27 +347,27 @@ void FeatureBuilder1::Deserialize(buffer_t & data) serial::CodingParams cp; ArrayByteSource source(&data[0]); - m_Params.Read(source); + m_params.Read(source); - m_LimitRect.MakeEmpty(); + m_limitRect.MakeEmpty(); - EGeomType const type = m_Params.GetGeomType(); + EGeomType const type = m_params.GetGeomType(); if (type == GEOM_POINT) { - m_Center = serial::LoadPoint(source, cp); - m_LimitRect.Add(m_Center); + m_center = serial::LoadPoint(source, cp); + m_limitRect.Add(m_center); return; } - m_Polygons.clear(); + m_polygons.clear(); uint32_t const count = ReadVarUint(source); ASSERT_GREATER ( count, 0, (*this) ); for (uint32_t i = 0; i < count; ++i) { - m_Polygons.push_back(points_t()); - serial::LoadOuterPath(source, cp, m_Polygons.back()); - CalcRect(m_Polygons.back(), m_LimitRect); + m_polygons.push_back(points_t()); + serial::LoadOuterPath(source, cp, m_polygons.back()); + CalcRect(m_polygons.back(), m_limitRect); } m_coastCell = ReadVarInt(source); @@ -400,8 +400,8 @@ void FeatureBuilder1::SetCoastCell(int64_t iCell, string const & strCell) { m_coastCell = iCell; - ASSERT ( m_Params.name.IsEmpty(), () ); - m_Params.name.AddString(0, strCell); + ASSERT ( m_params.name.IsEmpty(), () ); + m_params.name.AddString(0, strCell); } string DebugPrint(FeatureBuilder1 const & f) @@ -410,13 +410,13 @@ string DebugPrint(FeatureBuilder1 const & f) switch (f.GetGeomType()) { - case GEOM_POINT: out << DebugPrint(f.m_Center); break; + case GEOM_POINT: out << DebugPrint(f.m_center); break; case GEOM_LINE: out << "line with " << f.GetPointsCount() << " points"; break; case GEOM_AREA: out << "area with " << f.GetPointsCount() << " points"; break; default: out << "ERROR: unknown geometry type"; break; } - return (out.str() + " " + DebugPrint(f.m_LimitRect) + " " + DebugPrint(f.m_Params)); + return (out.str() + " " + DebugPrint(f.m_limitRect) + " " + DebugPrint(f.m_params)); } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -440,7 +440,7 @@ bool FeatureBuilder2::IsDrawableInRange(int lowS, int highS) const bool FeatureBuilder2::PreSerialize(buffers_holder_t const & data) { // make flags actual before header serialization - EGeomType const geoType = m_Params.GetGeomType(); + EGeomType const geoType = m_params.GetGeomType(); if (geoType == GEOM_LINE) { if (data.m_ptsMask == 0 && data.m_innerPts.empty()) @@ -510,7 +510,7 @@ void FeatureBuilder2::Serialize(buffers_holder_t & data, serial::CodingParams co BitSink< PushBackByteSink > bitSink(sink); - uint8_t const h = m_Params.GetTypeMask(); + uint8_t const h = m_params.GetTypeMask(); if (h == HEADER_GEOM_LINE) { diff --git a/generator/feature_builder.hpp b/generator/feature_builder.hpp index 9c150b862a..892db5d88e 100644 --- a/generator/feature_builder.hpp +++ b/generator/feature_builder.hpp @@ -29,8 +29,8 @@ public: void AddPoint(m2::PointD const & p); /// Set that feature is linear type. - void SetLinear() { m_Params.SetGeomType(feature::GEOM_LINE); } - void SetArea() { m_Params.SetGeomType(feature::GEOM_AREA); } + void SetLinear() { m_params.SetGeomType(feature::GEOM_LINE); } + void SetArea() { m_params.SetGeomType(feature::GEOM_AREA); } /// Set that feature is area and get ownership of holes. void SetAreaAddHoles(list > const & holes); @@ -38,12 +38,12 @@ public: void AddPolygon(vector & poly); //@} - inline feature::EGeomType GetGeomType() const { return m_Params.GetGeomType(); } + inline feature::EGeomType GetGeomType() const { return m_params.GetGeomType(); } - inline void AddType(uint32_t type) { m_Params.AddType(type); } - inline bool HasType(uint32_t t) const { return m_Params.IsTypeExist(t); } - inline bool PopExactType(uint32_t type) { return m_Params.PopExactType(type); } - inline void SetType(uint32_t type) { m_Params.SetType(type); } + inline void AddType(uint32_t type) { m_params.AddType(type); } + inline bool HasType(uint32_t t) const { return m_params.IsTypeExist(t); } + inline bool PopExactType(uint32_t type) { return m_params.PopExactType(type); } + inline void SetType(uint32_t type) { m_params.SetType(type); } /// Check classificator types for their compatibility with feature geometry type. /// Need to call when using any classificator types manipulating. @@ -56,9 +56,9 @@ public: template bool RemoveTypesIf(FnT fn) { - m_Params.m_Types.erase(remove_if(m_Params.m_Types.begin(), m_Params.m_Types.end(), fn), - m_Params.m_Types.end()); - return m_Params.m_Types.empty(); + m_params.m_Types.erase(remove_if(m_params.m_Types.begin(), m_params.m_Types.end(), fn), + m_params.m_Types.end()); + return m_params.m_Types.empty(); } typedef vector buffer_t; @@ -73,7 +73,7 @@ public: /// @name Selectors. //@{ - inline m2::RectD GetLimitRect() const { return m_LimitRect; } + inline m2::RectD GetLimitRect() const { return m_limitRect; } bool FormatFullAddress(string & res) const; @@ -84,7 +84,7 @@ public: m2::PointD GetGeometryCenter() const; inline size_t GetPointsCount() const { return GetGeometry().size(); } - inline size_t GetPolygonsCount() const { return m_Polygons.size(); } + inline size_t GetPolygonsCount() const { return m_polygons.size(); } //@} /// @name Iterate through polygons points. @@ -104,11 +104,11 @@ public: template void ForEachGeometryPointEx(ToDo & toDo) const { - if (m_Params.GetGeomType() == feature::GEOM_POINT) - toDo(m_Center); + if (m_params.GetGeomType() == feature::GEOM_POINT) + toDo(m_center); else { - for (list::const_iterator i = m_Polygons.begin(); i != m_Polygons.end(); ++i) + for (list::const_iterator i = m_polygons.begin(); i != m_polygons.end(); ++i) { for (points_t::const_iterator j = i->begin(); j != i->end(); ++j) if (!toDo(*j)) @@ -130,7 +130,7 @@ public: /// @note This function overrides all previous assigned types. /// Set all the parameters, except geometry type (it's set by other functions). - inline void SetParams(FeatureParams const & params) { m_Params.SetParams(params); } + inline void SetParams(FeatureParams const & params) { m_params.SetParams(params); } /// For OSM debugging, store original OSM id void AddOsmId(string const & type, uint64_t osmId); @@ -152,7 +152,7 @@ public: inline string GetName(int8_t lang = StringUtf8Multilang::DEFAULT_CODE) const { string s; - m_Params.name.GetString(lang, s); + m_params.name.GetString(lang, s); return s; } @@ -167,22 +167,22 @@ protected: /// Used for feature debugging vector m_osmIds; - FeatureParams m_Params; + FeatureParams m_params; - m2::RectD m_LimitRect; + m2::RectD m_limitRect; /// Can be one of the following: /// - point in point-feature /// - origin point of text [future] in line-feature /// - origin point of text or symbol in area-feature - m2::PointD m_Center; // Check HEADER_HAS_POINT + m2::PointD m_center; // Check HEADER_HAS_POINT typedef vector points_t; - inline points_t const & GetGeometry() const { return m_Polygons.front(); } + inline points_t const & GetGeometry() const { return m_polygons.front(); } /// List of geometry polygons. - list m_Polygons; // Check HEADER_IS_AREA + list m_polygons; // Check HEADER_IS_AREA int64_t m_coastCell; }; @@ -216,12 +216,12 @@ public: buffers_holder_t() : m_ptsMask(0), m_trgMask(0), m_ptsSimpMask(0) {} }; - bool IsLine() const { return (m_Params.GetTypeMask() == feature::HEADER_GEOM_LINE); } - bool IsArea() const { return (m_Params.GetTypeMask() == feature::HEADER_GEOM_AREA); } + bool IsLine() const { return (m_params.GetTypeMask() == feature::HEADER_GEOM_LINE); } + bool IsArea() const { return (m_params.GetTypeMask() == feature::HEADER_GEOM_AREA); } bool IsDrawableInRange(int lowS, int highS) const; points_t const & GetOuterPoly() const { return GetGeometry(); } - list const & GetPolygons() const { return m_Polygons; } + list const & GetPolygons() const { return m_polygons; } /// @name Overwrite from base_type. //@{ diff --git a/generator/feature_merger.cpp b/generator/feature_merger.cpp index e9c853cab8..a8b2744136 100644 --- a/generator/feature_merger.cpp +++ b/generator/feature_merger.cpp @@ -9,7 +9,7 @@ MergedFeatureBuilder1::MergedFeatureBuilder1(FeatureBuilder1 const & fb) : FeatureBuilder1(fb), m_isRound(false) { - m_Params.FinishAddingTypes(); + m_params.FinishAddingTypes(); } void MergedFeatureBuilder1::SetRound() @@ -24,7 +24,7 @@ void MergedFeatureBuilder1::AppendFeature(MergedFeatureBuilder1 const & fb, bool // Also merge Osm IDs for debugging m_osmIds.insert(m_osmIds.end(), fb.m_osmIds.begin(), fb.m_osmIds.end()); - points_t & thisG = m_Polygons.front(); + points_t & thisG = m_polygons.front(); points_t const & fbG = fb.GetGeometry(); if (fb.m_isRound) @@ -50,12 +50,12 @@ void MergedFeatureBuilder1::AppendFeature(MergedFeatureBuilder1 const & fb, bool if (toBack) { thisG.insert(thisG.end(), fbG.begin() + 1, fbG.end()); - CalcRect(fbG.begin() + 1, fbG.end(), m_LimitRect); + CalcRect(fbG.begin() + 1, fbG.end(), m_limitRect); } else { thisG.insert(thisG.begin(), fbG.begin(), fbG.end() - 1); - CalcRect(fbG.begin(), fbG.end() - 1, m_LimitRect); + CalcRect(fbG.begin(), fbG.end() - 1, m_limitRect); } } else @@ -63,12 +63,12 @@ void MergedFeatureBuilder1::AppendFeature(MergedFeatureBuilder1 const & fb, bool if (toBack) { thisG.insert(thisG.end(), fbG.rbegin() + 1, fbG.rend()); - CalcRect(fbG.rbegin() + 1, fbG.rend(), m_LimitRect); + CalcRect(fbG.rbegin() + 1, fbG.rend(), m_limitRect); } else { thisG.insert(thisG.begin(), fbG.rbegin(), fbG.rend() - 1); - CalcRect(fbG.rbegin(), fbG.rend() - 1, m_LimitRect); + CalcRect(fbG.rbegin(), fbG.rend() - 1, m_limitRect); } } } diff --git a/generator/feature_merger.hpp b/generator/feature_merger.hpp index 7ad2436e38..048eec80c7 100644 --- a/generator/feature_merger.hpp +++ b/generator/feature_merger.hpp @@ -20,7 +20,7 @@ public: void SetRound(); bool IsRound() const { return m_isRound; } - void ZeroParams() { m_Params.MakeZero(); } + void ZeroParams() { m_params.MakeZero(); } void AppendFeature(MergedFeatureBuilder1 const & fb, bool fromBegin, bool toBack); @@ -31,12 +31,12 @@ public: inline m2::PointD FirstPoint() const { return GetGeometry().front(); } inline m2::PointD LastPoint() const { return GetGeometry().back(); } - inline bool PopAnyType(uint32_t & type) { return m_Params.PopAnyType(type); } + inline bool PopAnyType(uint32_t & type) { return m_params.PopAnyType(type); } template void ForEachChangeTypes(ToDo toDo) { - for_each(m_Params.m_Types.begin(), m_Params.m_Types.end(), toDo); - m_Params.FinishAddingTypes(); + for_each(m_params.m_Types.begin(), m_params.m_Types.end(), toDo); + m_params.FinishAddingTypes(); } template void ForEachMiddlePoints(ToDo toDo) const diff --git a/generator/statistics.cpp b/generator/statistics.cpp index ddd9684625..4ba7dfffba 100644 --- a/generator/statistics.cpp +++ b/generator/statistics.cpp @@ -82,9 +82,9 @@ namespace stats FeatureType::inner_geom_stat_t const innerStats = f.GetInnerStatistic(); - m_info.m_inner[0].Add(innerStats.m_Points); - m_info.m_inner[1].Add(innerStats.m_Strips); - m_info.m_inner[2].Add(innerStats.m_Size); + m_info.m_inner[0].Add(innerStats.m_points); + m_info.m_inner[1].Add(innerStats.m_strips); + m_info.m_inner[2].Add(innerStats.m_size); // get geometry size for the best geometry FeatureType::geom_stat_t const geom = f.GetGeometrySize(FeatureType::BEST_GEOMETRY); @@ -93,7 +93,7 @@ namespace stats m_info.AddToSet(geom.m_count, geom.m_size, m_info.m_byPointsCount); m_info.AddToSet(trg.m_count / 3, trg.m_size, m_info.m_byTrgCount); - uint32_t const allSize = innerStats.m_Size + geom.m_size + trg.m_size; + uint32_t const allSize = innerStats.m_size + geom.m_size + trg.m_size; m_info.AddToSet(f.GetFeatureType(), allSize, m_info.m_byGeomType); diff --git a/indexer/feature.cpp b/indexer/feature.cpp index dbefd0dee8..831ac97592 100644 --- a/indexer/feature.cpp +++ b/indexer/feature.cpp @@ -21,9 +21,9 @@ void FeatureBase::Deserialize(feature::LoaderBase * pLoader, BufferT buffer) m_pLoader = pLoader; m_pLoader->Init(buffer); - m_LimitRect = m2::RectD::GetEmptyRect(); + m_limitRect = m2::RectD::GetEmptyRect(); m_bTypesParsed = m_bCommonParsed = false; - m_Header = m_pLoader->GetHeader(); + m_header = m_pLoader->GetHeader(); } void FeatureBase::ParseTypes() const @@ -63,12 +63,12 @@ string FeatureBase::DebugString() const string res("FEATURE: "); for (size_t i = 0; i < GetTypesCount(); ++i) - res += "Type:" + DebugPrint(m_Types[i]) + " "; + res += "Type:" + DebugPrint(m_types[i]) + " "; - res += m_Params.DebugString(); + res += m_params.DebugString(); if (GetFeatureType() == GEOM_POINT) - res += "Center:" + DebugPrint(m_Center) + " "; + res += "Center:" + DebugPrint(m_center) + " "; return res; } @@ -86,7 +86,7 @@ void FeatureType::Deserialize(feature::LoaderBase * pLoader, BufferT buffer) m_bHeader2Parsed = m_bPointsParsed = m_bTrianglesParsed = false; - m_InnerStats.MakeZero(); + m_innerStats.MakeZero(); } void FeatureType::ParseHeader2() const @@ -143,10 +143,10 @@ string FeatureType::DebugString(int scale) const string s = base_type::DebugString(); s += "Points:"; - Points2String(s, m_Points); + Points2String(s, m_points); s += "Triangles:"; - Points2String(s, m_Triangles); + Points2String(s, m_triangles); return s; } @@ -157,8 +157,8 @@ bool FeatureType::IsEmptyGeometry(int scale) const switch (GetFeatureType()) { - case GEOM_AREA: return m_Triangles.empty(); - case GEOM_LINE: return m_Points.empty(); + case GEOM_AREA: return m_triangles.empty(); + case GEOM_LINE: return m_points.empty(); default: return false; } } @@ -167,15 +167,15 @@ m2::RectD FeatureType::GetLimitRect(int scale) const { ParseAll(scale); - if (m_Triangles.empty() && m_Points.empty() && (GetFeatureType() != GEOM_POINT)) + if (m_triangles.empty() && m_points.empty() && (GetFeatureType() != GEOM_POINT)) { // This function is called during indexing, when we need // to check visibility according to feature sizes. // So, if no geometry for this scale, assume that rect has zero dimensions. - m_LimitRect = m2::RectD(0, 0, 0, 0); + m_limitRect = m2::RectD(0, 0, 0, 0); } - return m_LimitRect; + return m_limitRect; } void FeatureType::ParseAll(int scale) const @@ -187,19 +187,19 @@ void FeatureType::ParseAll(int scale) const FeatureType::geom_stat_t FeatureType::GetGeometrySize(int scale) const { uint32_t sz = ParseGeometry(scale); - if (sz == 0 && !m_Points.empty()) - sz = m_InnerStats.m_Points; + if (sz == 0 && !m_points.empty()) + sz = m_innerStats.m_points; - return geom_stat_t(sz, m_Points.size()); + return geom_stat_t(sz, m_points.size()); } FeatureType::geom_stat_t FeatureType::GetTrianglesSize(int scale) const { uint32_t sz = ParseTriangles(scale); - if (sz == 0 && !m_Triangles.empty()) - sz = m_InnerStats.m_Strips; + if (sz == 0 && !m_triangles.empty()) + sz = m_innerStats.m_strips; - return geom_stat_t(sz, m_Triangles.size()); + return geom_stat_t(sz, m_triangles.size()); } struct BestMatchedLangNames @@ -282,7 +282,7 @@ void FeatureType::GetReadableName(string & name) const string FeatureType::GetHouseNumber() const { ParseCommon(); - return m_Params.house.Get(); + return m_params.house.Get(); } bool FeatureType::GetName(int8_t lang, string & name) const @@ -291,13 +291,13 @@ bool FeatureType::GetName(int8_t lang, string & name) const return false; ParseCommon(); - return m_Params.name.GetString(lang, name); + return m_params.name.GetString(lang, name); } uint8_t FeatureType::GetRank() const { ParseCommon(); - return m_Params.rank; + return m_params.rank; } uint32_t FeatureType::GetPopulation() const @@ -309,7 +309,7 @@ uint32_t FeatureType::GetPopulation() const string FeatureType::GetRoadNumber() const { ParseCommon(); - return m_Params.ref; + return m_params.ref; } namespace @@ -396,8 +396,8 @@ void FeatureType::SwapGeometry(FeatureType & r) ASSERT_EQUAL(m_bTrianglesParsed, r.m_bTrianglesParsed, ()); if (m_bPointsParsed) - m_Points.swap(r.m_Points); + m_points.swap(r.m_points); if (m_bTrianglesParsed) - m_Triangles.swap(r.m_Triangles); + m_triangles.swap(r.m_triangles); } diff --git a/indexer/feature.hpp b/indexer/feature.hpp index 7d8dce79c2..89396f6f9b 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -52,7 +52,7 @@ public: return 0; ParseCommon(); - return m_Params.layer; + return m_params.layer; } inline bool HasName() const @@ -86,21 +86,21 @@ public: return false; ParseCommon(); - m_Params.name.ForEachRef(functor); + m_params.name.ForEachRef(functor); return true; } inline m2::RectD GetLimitRect() const { - ASSERT ( m_LimitRect.IsValid(), () ); - return m_LimitRect; + ASSERT ( m_limitRect.IsValid(), () ); + return m_limitRect; } inline m2::PointD GetCenter() const { ASSERT_EQUAL ( GetFeatureType(), feature::GEOM_POINT, () ); ParseCommon(); - return m_Center; + return m_center; } template @@ -110,32 +110,32 @@ public: uint32_t const count = GetTypesCount(); for (size_t i = 0; i < count; ++i) - f(m_Types[i]); + f(m_types[i]); } protected: /// @name Need for FeatureBuilder. //@{ friend class FeatureBuilder1; - inline void SetHeader(uint8_t h) { m_Header = h; } + inline void SetHeader(uint8_t h) { m_header = h; } //@} string DebugString() const; - inline uint8_t Header() const { return m_Header; } + inline uint8_t Header() const { return m_header; } protected: feature::LoaderBase * m_pLoader; - uint8_t m_Header; + uint8_t m_header; - mutable uint32_t m_Types[m_maxTypesCount]; + mutable uint32_t m_types[m_maxTypesCount]; - mutable FeatureParamsBase m_Params; + mutable FeatureParamsBase m_params; - mutable m2::PointD m_Center; + mutable m2::PointD m_center; - mutable m2::RectD m_LimitRect; + mutable m2::RectD m_limitRect; mutable bool m_bTypesParsed, m_bCommonParsed; @@ -177,29 +177,29 @@ public: { ParseGeometry(scale); - if (m_Points.empty()) + if (m_points.empty()) { // it's a point feature if (GetFeatureType() == feature::GEOM_POINT) - f(CoordPointT(m_Center.x, m_Center.y)); + f(CoordPointT(m_center.x, m_center.y)); } else { - for (size_t i = 0; i < m_Points.size(); ++i) - f(CoordPointT(m_Points[i].x, m_Points[i].y)); + for (size_t i = 0; i < m_points.size(); ++i) + f(CoordPointT(m_points[i].x, m_points[i].y)); } } inline size_t GetPointsCount() const { ASSERT(m_bPointsParsed, ()); - return m_Points.size(); + return m_points.size(); } inline m2::PointD const & GetPoint(size_t i) const { - ASSERT_LESS(i, m_Points.size(), ()); + ASSERT_LESS(i, m_points.size(), ()); ASSERT(m_bPointsParsed, ()); - return m_Points[i]; + return m_points[i]; } template @@ -213,9 +213,9 @@ public: { ParseTriangles(scale); - for (size_t i = 0; i < m_Triangles.size();) + for (size_t i = 0; i < m_triangles.size();) { - f(m_Triangles[i], m_Triangles[i+1], m_Triangles[i+2]); + f(m_triangles[i], m_triangles[i+1], m_triangles[i+2]); i += 3; } } @@ -223,7 +223,7 @@ public: template void ForEachTriangleExRef(FunctorT & f, int scale) const { - f.StartPrimitive(m_Triangles.size()); + f.StartPrimitive(m_triangles.size()); ForEachTriangleRef(f, scale); f.EndPrimitive(); } @@ -262,15 +262,15 @@ public: struct inner_geom_stat_t { - uint32_t m_Points, m_Strips, m_Size; + uint32_t m_points, m_strips, m_size; void MakeZero() { - m_Points = m_Strips = m_Size = 0; + m_points = m_strips = m_size = 0; } }; - inner_geom_stat_t GetInnerStatistic() const { return m_InnerStats; } + inner_geom_stat_t GetInnerStatistic() const { return m_innerStats; } struct geom_stat_t { @@ -298,11 +298,11 @@ private: static const size_t static_buffer = 32; typedef buffer_vector points_t; - mutable points_t m_Points, m_Triangles; + mutable points_t m_points, m_triangles; mutable bool m_bHeader2Parsed, m_bPointsParsed, m_bTrianglesParsed; - mutable inner_geom_stat_t m_InnerStats; + mutable inner_geom_stat_t m_innerStats; friend class feature::LoaderCurrent; friend class old_101::feature::LoaderImpl; diff --git a/indexer/feature_loader.cpp b/indexer/feature_loader.cpp index b14a997b7d..4d1ccd491f 100644 --- a/indexer/feature_loader.cpp +++ b/indexer/feature_loader.cpp @@ -27,7 +27,7 @@ void LoaderCurrent::ParseTypes() size_t const count = m_pF->GetTypesCount(); for (size_t i = 0; i < count; ++i) - m_pF->m_Types[i] = c.GetTypeForIndex(ReadVarUint(source)); + m_pF->m_types[i] = c.GetTypeForIndex(ReadVarUint(source)); m_CommonOffset = CalcOffset(source); } @@ -37,12 +37,12 @@ void LoaderCurrent::ParseCommon() ArrayByteSource source(DataPtr() + m_CommonOffset); uint8_t const h = Header(); - m_pF->m_Params.Read(source, h); + m_pF->m_params.Read(source, h); if (m_pF->GetFeatureType() == GEOM_POINT) { - m_pF->m_Center = serial::LoadPoint(source, GetDefCodingParams()); - m_pF->m_LimitRect.Add(m_pF->m_Center); + m_pF->m_center = serial::LoadPoint(source, GetDefCodingParams()); + m_pF->m_limitRect.Add(m_pF->m_center); } m_Header2Offset = CalcOffset(source); @@ -135,13 +135,13 @@ void LoaderCurrent::ParseHeader2() char const * start = src.PtrC(); - src = ArrayByteSource(serial::LoadInnerPath(start, ptsCount, cp, m_pF->m_Points)); + src = ArrayByteSource(serial::LoadInnerPath(start, ptsCount, cp, m_pF->m_points)); - m_pF->m_InnerStats.m_Points = src.PtrC() - start; + m_pF->m_innerStats.m_points = src.PtrC() - start; } else { - m_pF->m_Points.push_back(serial::LoadPoint(src, cp)); + m_pF->m_points.push_back(serial::LoadPoint(src, cp)); ReadOffsets(src, ptsMask, m_ptsOffsets); } @@ -157,20 +157,20 @@ void LoaderCurrent::ParseHeader2() FeatureType::points_t points; src = ArrayByteSource(serial::LoadInnerTriangles(start, trgCount, cp, points)); - m_pF->m_InnerStats.m_Strips = src.PtrC() - start; + m_pF->m_innerStats.m_strips = src.PtrC() - start; for (uint8_t i = 2; i < trgCount; ++i) { - m_pF->m_Triangles.push_back(points[i-2]); - m_pF->m_Triangles.push_back(points[i-1]); - m_pF->m_Triangles.push_back(points[i]); + m_pF->m_triangles.push_back(points[i-2]); + m_pF->m_triangles.push_back(points[i-1]); + m_pF->m_triangles.push_back(points[i]); } } else ReadOffsets(src, trgMask, m_trgOffsets); } - m_pF->m_InnerStats.m_Size = src.PtrC() - DataPtr(); + m_pF->m_innerStats.m_size = src.PtrC() - DataPtr(); } uint32_t LoaderCurrent::ParseGeometry(int scale) @@ -178,7 +178,7 @@ uint32_t LoaderCurrent::ParseGeometry(int scale) uint32_t sz = 0; if ((Header() & HEADER_GEOTYPE_MASK) == HEADER_GEOM_LINE) { - size_t const count = m_pF->m_Points.size(); + size_t const count = m_pF->m_points.size(); if (count < 2) { ASSERT_EQUAL ( count, 1, () ); @@ -191,8 +191,8 @@ uint32_t LoaderCurrent::ParseGeometry(int scale) src.Skip(m_ptsOffsets[ind]); serial::CodingParams cp = GetCodingParams(ind); - cp.SetBasePoint(m_pF->m_Points[0]); - serial::LoadOuterPath(src, cp, m_pF->m_Points); + cp.SetBasePoint(m_pF->m_points[0]); + serial::LoadOuterPath(src, cp, m_pF->m_points); sz = static_cast(src.Pos() - m_ptsOffsets[ind]); } @@ -207,19 +207,19 @@ uint32_t LoaderCurrent::ParseGeometry(int scale) int const scaleIndex = GetScaleIndex(scale); ASSERT_LESS ( scaleIndex, m_Info.GetScalesCount(), () ); - points.push_back(m_pF->m_Points.front()); + points.push_back(m_pF->m_points.front()); for (int i = 1; i < count-1; ++i) { // check for point visibility in needed scaleIndex if (((m_ptsSimpMask >> (2*(i-1))) & 0x3) <= scaleIndex) - points.push_back(m_pF->m_Points[i]); + points.push_back(m_pF->m_points[i]); } - points.push_back(m_pF->m_Points.back()); + points.push_back(m_pF->m_points.back()); - m_pF->m_Points.swap(points); + m_pF->m_points.swap(points); } - CalcRect(m_pF->m_Points, m_pF->m_LimitRect); + CalcRect(m_pF->m_points, m_pF->m_limitRect); } return sz; @@ -230,20 +230,20 @@ uint32_t LoaderCurrent::ParseTriangles(int scale) uint32_t sz = 0; if ((Header() & HEADER_GEOTYPE_MASK) == HEADER_GEOM_AREA) { - if (m_pF->m_Triangles.empty()) + if (m_pF->m_triangles.empty()) { uint32_t const ind = GetScaleIndex(scale, m_trgOffsets); if (ind != -1) { ReaderSource src(m_Info.GetTrianglesReader(ind)); src.Skip(m_trgOffsets[ind]); - serial::LoadOuterTriangles(src, GetCodingParams(ind), m_pF->m_Triangles); + serial::LoadOuterTriangles(src, GetCodingParams(ind), m_pF->m_triangles); sz = static_cast(src.Pos() - m_trgOffsets[ind]); } } - CalcRect(m_pF->m_Triangles, m_pF->m_LimitRect); + CalcRect(m_pF->m_triangles, m_pF->m_limitRect); } return sz; diff --git a/indexer/old/feature_loader_101.cpp b/indexer/old/feature_loader_101.cpp index d1c585e0ff..12735fab82 100644 --- a/indexer/old/feature_loader_101.cpp +++ b/indexer/old/feature_loader_101.cpp @@ -149,7 +149,7 @@ void LoaderImpl::ParseTypes() size_t const count = m_pF->GetTypesCount(); for (size_t i = 0; i < count; ++i) - m_pF->m_Types[i] = typeC.Convert(ReadVarUint(source)); + m_pF->m_types[i] = typeC.Convert(ReadVarUint(source)); m_CommonOffset = CalcOffset(source); } @@ -161,14 +161,14 @@ void LoaderImpl::ParseCommon() uint8_t const h = Header(); if (h & HEADER_HAS_LAYER) - m_pF->m_Params.layer = ReadVarInt(source); + m_pF->m_params.layer = ReadVarInt(source); if (h & HEADER_HAS_NAME) { string name; name.resize(ReadVarUint(source) + 1); source.Read(&name[0], name.size()); - m_pF->m_Params.name.AddString(StringUtf8Multilang::DEFAULT_CODE, name); + m_pF->m_params.name.AddString(StringUtf8Multilang::DEFAULT_CODE, name); } if (h & HEADER_HAS_POINT) @@ -176,8 +176,8 @@ void LoaderImpl::ParseCommon() CoordPointT const center = Int64ToPoint( ReadVarInt(source) + GetDefCodingParams().GetBasePointInt64(), POINT_COORD_BITS); - m_pF->m_Center = m2::PointD(center.first, center.second); - m_pF->m_LimitRect.Add(m_pF->m_Center); + m_pF->m_center = m2::PointD(center.first, center.second); + m_pF->m_limitRect.Add(m_pF->m_center); } m_Header2Offset = CalcOffset(source); @@ -310,9 +310,9 @@ void LoaderImpl::ParseHeader2() char const * start = src.PtrC(); src = ArrayByteSource(serial::LoadInnerPath( - start, ptsCount, GetDefCodingParams(), m_pF->m_Points)); + start, ptsCount, GetDefCodingParams(), m_pF->m_points)); - m_pF->m_InnerStats.m_Points = src.PtrC() - start; + m_pF->m_innerStats.m_points = src.PtrC() - start; } else ReadOffsets(src, ptsMask, m_ptsOffsets); @@ -330,20 +330,20 @@ void LoaderImpl::ParseHeader2() src = ArrayByteSource(serial::LoadInnerTriangles( start, trgCount, GetDefCodingParams(), points)); - m_pF->m_InnerStats.m_Strips = src.PtrC() - start; + m_pF->m_innerStats.m_strips = src.PtrC() - start; for (uint8_t i = 2; i < trgCount; ++i) { - m_pF->m_Triangles.push_back(points[i-2]); - m_pF->m_Triangles.push_back(points[i-1]); - m_pF->m_Triangles.push_back(points[i]); + m_pF->m_triangles.push_back(points[i-2]); + m_pF->m_triangles.push_back(points[i-1]); + m_pF->m_triangles.push_back(points[i]); } } else ReadOffsets(src, trgMask, m_trgOffsets); } - m_pF->m_InnerStats.m_Size = src.PtrC() - DataPtr(); + m_pF->m_innerStats.m_size = src.PtrC() - DataPtr(); } uint32_t LoaderImpl::ParseGeometry(int scale) @@ -351,7 +351,7 @@ uint32_t LoaderImpl::ParseGeometry(int scale) uint32_t sz = 0; if (Header() & HEADER_IS_LINE) { - if (m_pF->m_Points.empty()) + if (m_pF->m_points.empty()) { // outer geometry int const ind = GetScaleIndex(scale, m_ptsOffsets); @@ -359,7 +359,7 @@ uint32_t LoaderImpl::ParseGeometry(int scale) { ReaderSource src(m_Info.GetGeometryReader(ind)); src.Skip(m_ptsOffsets[ind]); - serial::LoadOuterPath(src, GetDefCodingParams(), m_pF->m_Points); + serial::LoadOuterPath(src, GetDefCodingParams(), m_pF->m_points); sz = static_cast(src.Pos() - m_ptsOffsets[ind]); } @@ -368,26 +368,26 @@ uint32_t LoaderImpl::ParseGeometry(int scale) { // filter inner geometry - size_t const count = m_pF->m_Points.size(); + size_t const count = m_pF->m_points.size(); FeatureType::points_t points; points.reserve(count); int const scaleIndex = GetScaleIndex(scale); ASSERT_LESS ( scaleIndex, m_Info.GetScalesCount(), () ); - points.push_back(m_pF->m_Points.front()); + points.push_back(m_pF->m_points.front()); for (size_t i = 1; i < count-1; ++i) { // check for point visibility in needed scaleIndex if (((m_ptsSimpMask >> (2*(i-1))) & 0x3) <= scaleIndex) - points.push_back(m_pF->m_Points[i]); + points.push_back(m_pF->m_points[i]); } - points.push_back(m_pF->m_Points.back()); + points.push_back(m_pF->m_points.back()); - m_pF->m_Points.swap(points); + m_pF->m_points.swap(points); } - ::feature::CalcRect(m_pF->m_Points, m_pF->m_LimitRect); + ::feature::CalcRect(m_pF->m_points, m_pF->m_limitRect); } return sz; @@ -398,20 +398,20 @@ uint32_t LoaderImpl::ParseTriangles(int scale) uint32_t sz = 0; if (Header() & HEADER_IS_AREA) { - if (m_pF->m_Triangles.empty()) + if (m_pF->m_triangles.empty()) { uint32_t const ind = GetScaleIndex(scale, m_trgOffsets); if (ind != -1) { ReaderSource src(m_Info.GetTrianglesReader(ind)); src.Skip(m_trgOffsets[ind]); - serial::LoadOuterTriangles(src, GetDefCodingParams(), m_pF->m_Triangles); + serial::LoadOuterTriangles(src, GetDefCodingParams(), m_pF->m_triangles); sz = static_cast(src.Pos() - m_trgOffsets[ind]); } } - ::feature::CalcRect(m_pF->m_Triangles, m_pF->m_LimitRect); + ::feature::CalcRect(m_pF->m_triangles, m_pF->m_limitRect); } return sz;