diff --git a/generator/feature_builder.cpp b/generator/feature_builder.cpp index a6bc14f6f8..d7f5508527 100644 --- a/generator/feature_builder.cpp +++ b/generator/feature_builder.cpp @@ -33,22 +33,22 @@ using namespace std; FeatureBuilder1::FeatureBuilder1() : m_coastCell(-1) { - m_polygons.push_back(TPointSeq()); + m_polygons.push_back(PointSeq()); } bool FeatureBuilder1::IsGeometryClosed() const { - TPointSeq const & poly = GetOuterGeometry(); + PointSeq const & poly = GetOuterGeometry(); return (poly.size() > 2 && poly.front() == poly.back()); } m2::PointD FeatureBuilder1::GetGeometryCenter() const { - //TODO(govako): Check requirements in this assert + //TODO(vng): Check requirements in this assert //ASSERT ( IsGeometryClosed(), () ); m2::PointD ret(0.0, 0.0); - TPointSeq const & poly = GetOuterGeometry(); + PointSeq const & poly = GetOuterGeometry(); size_t const count = poly.size(); for (size_t i = 0; i < count; ++i) ret += poly[i]; @@ -112,17 +112,17 @@ void FeatureBuilder1::SetLinear(bool reverseGeometry) } } -void FeatureBuilder1::SetAreaAddHoles(FeatureBuilder1::TGeometry const & holes) +void FeatureBuilder1::SetAreaAddHoles(FeatureBuilder1::Geometry const & holes) { m_params.SetGeomType(GEOM_AREA); m_polygons.resize(1); if (holes.empty()) return; - TPointSeq const & poly = GetOuterGeometry(); + PointSeq const & poly = GetOuterGeometry(); m2::Region rgn(poly.begin(), poly.end()); - for (TPointSeq const & points : holes) + for (PointSeq const & points : holes) { ASSERT ( !points.empty(), (*this) ); @@ -149,7 +149,7 @@ void FeatureBuilder1::AddPolygon(vector & poly) CalcRect(poly, m_limitRect); if (!m_polygons.back().empty()) - m_polygons.push_back(TPointSeq()); + m_polygons.push_back(PointSeq()); m_polygons.back().swap(poly); } @@ -157,7 +157,7 @@ void FeatureBuilder1::AddPolygon(vector & poly) void FeatureBuilder1::ResetGeometry() { m_polygons.clear(); - m_polygons.push_back(TPointSeq()); + m_polygons.push_back(PointSeq()); m_limitRect.MakeEmpty(); } @@ -353,16 +353,16 @@ bool FeatureBuilder1::CheckValid() const CHECK(GetOuterGeometry().size() >= 2, (*this)); if (type == GEOM_AREA) - for (TPointSeq const & points : m_polygons) + for (PointSeq const & points : m_polygons) CHECK(points.size() >= 3, (*this)); return true; } -void FeatureBuilder1::SerializeBase(TBuffer & data, serial::GeometryCodingParams const & params, +void FeatureBuilder1::SerializeBase(Buffer & data, serial::GeometryCodingParams const & params, bool saveAddInfo) const { - PushBackByteSink sink(data); + PushBackByteSink sink(data); m_params.Write(sink, saveAddInfo); @@ -370,7 +370,7 @@ void FeatureBuilder1::SerializeBase(TBuffer & data, serial::GeometryCodingParams serial::SavePoint(sink, m_center, params); } -void FeatureBuilder1::Serialize(TBuffer & data) const +void FeatureBuilder1::Serialize(Buffer & data) const { CHECK ( CheckValid(), (*this) ); @@ -380,13 +380,13 @@ void FeatureBuilder1::Serialize(TBuffer & data) const SerializeBase(data, cp, true /* store additional info from FeatureParams */); - PushBackByteSink sink(data); + PushBackByteSink sink(data); if (m_params.GetGeomType() != GEOM_POINT) { WriteVarUint(sink, static_cast(m_polygons.size())); - for (TPointSeq const & points : m_polygons) + for (PointSeq const & points : m_polygons) serial::SaveOuterPath(points, cp, sink); WriteVarInt(sink, m_coastCell); @@ -397,7 +397,7 @@ void FeatureBuilder1::Serialize(TBuffer & data) const // check for correct serialization #ifdef DEBUG - TBuffer tmp(data); + Buffer tmp(data); FeatureBuilder1 fb; fb.Deserialize(tmp); ASSERT ( fb == *this, ("Source feature: ", *this, "Deserialized feature: ", fb) ); @@ -405,11 +405,11 @@ void FeatureBuilder1::Serialize(TBuffer & data) const } void FeatureBuilder1::SerializeBorder(serial::GeometryCodingParams const & params, - TBuffer & data) const + Buffer & data) const { data.clear(); - PushBackByteSink sink(data); + PushBackByteSink sink(data); WriteToSink(sink, GetMostGenericOsmId().GetEncodedId()); CHECK_GREATER(m_polygons.size(), 0, ()); @@ -430,7 +430,7 @@ void FeatureBuilder1::SerializeBorder(serial::GeometryCodingParams const & param } } -void FeatureBuilder1::Deserialize(TBuffer & data) +void FeatureBuilder1::Deserialize(Buffer & data) { serial::GeometryCodingParams cp; @@ -453,7 +453,7 @@ void FeatureBuilder1::Deserialize(TBuffer & data) for (uint32_t i = 0; i < count; ++i) { - m_polygons.push_back(TPointSeq()); + m_polygons.push_back(PointSeq()); serial::LoadOuterPath(source, cp, m_polygons.back()); CalcRect(m_polygons.back(), m_limitRect); } @@ -605,7 +605,7 @@ bool FeatureBuilder2::PreSerialize(SupportingData const & data) } // we don't need empty features without geometry - return TBase::PreSerialize(); + return Base::PreSerialize(); } bool FeatureBuilder2::IsLocalityObject() const @@ -619,7 +619,7 @@ void FeatureBuilder2::SerializeLocalityObject(serial::GeometryCodingParams const { data.m_buffer.clear(); - PushBackByteSink sink(data.m_buffer); + PushBackByteSink sink(data.m_buffer); WriteToSink(sink, GetMostGenericOsmId().GetEncodedId()); auto const type = m_params.GetGeomType(); @@ -649,7 +649,7 @@ void FeatureBuilder2::Serialize(SupportingData & data, // header data serialization SerializeBase(data.m_buffer, params, false /* don't store additional info from FeatureParams*/); - PushBackByteSink sink(data.m_buffer); + PushBackByteSink sink(data.m_buffer); uint8_t const ptsCount = base::asserted_cast(data.m_innerPts.size()); uint8_t trgCount = base::asserted_cast(data.m_innerTrg.size()); @@ -662,7 +662,7 @@ void FeatureBuilder2::Serialize(SupportingData & data, EGeomType const type = m_params.GetGeomType(); { - BitWriter> bitSink(sink); + BitWriter> bitSink(sink); if (type == GEOM_LINE) { diff --git a/generator/feature_builder.hpp b/generator/feature_builder.hpp index 4f4ddbcbe4..9b9f64be20 100644 --- a/generator/feature_builder.hpp +++ b/generator/feature_builder.hpp @@ -24,10 +24,10 @@ class FeatureBuilder1 friend std::string DebugPrint(FeatureBuilder1 const & f); public: - using TPointSeq = std::vector; - using TGeometry = std::list; + using PointSeq = std::vector; + using Geometry = std::list; - using TBuffer = std::vector; + using Buffer = std::vector; FeatureBuilder1(); @@ -51,11 +51,11 @@ public: void SetLinear(bool reverseGeometry = false); /// Set that feature is area and get ownership of holes. - void SetAreaAddHoles(TGeometry const & holes); - inline void SetArea() { m_params.SetGeomType(feature::GEOM_AREA); } + void SetAreaAddHoles(Geometry const & holes); + void SetArea() { m_params.SetGeomType(feature::GEOM_AREA); } - inline bool IsLine() const { return (GetGeomType() == feature::GEOM_LINE); } - inline bool IsArea() const { return (GetGeomType() == feature::GEOM_AREA); } + bool IsLine() const { return (GetGeomType() == feature::GEOM_LINE); } + bool IsArea() const { return (GetGeomType() == feature::GEOM_AREA); } void AddPolygon(std::vector & poly); @@ -63,18 +63,18 @@ public: //@} - inline feature::Metadata const & GetMetadata() const { return m_params.GetMetadata(); } - inline feature::Metadata & GetMetadataForTesting() { return m_params.GetMetadata(); } - inline TGeometry const & GetGeometry() const { return m_polygons; } - inline TPointSeq const & GetOuterGeometry() const { return m_polygons.front(); } - inline feature::EGeomType GetGeomType() const { return m_params.GetGeomType(); } + feature::Metadata const & GetMetadata() const { return m_params.GetMetadata(); } + feature::Metadata & GetMetadataForTesting() { return m_params.GetMetadata(); } + Geometry const & GetGeometry() const { return m_polygons; } + PointSeq const & GetOuterGeometry() const { return m_polygons.front(); } + 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 uint32_t FindType(uint32_t comp, uint8_t level) const { return m_params.FindType(comp, level); } - inline FeatureParams::TTypes const & GetTypes() const { return m_params.m_Types; } + void AddType(uint32_t type) { m_params.AddType(type); } + bool HasType(uint32_t t) const { return m_params.IsTypeExist(t); } + bool PopExactType(uint32_t type) { return m_params.PopExactType(type); } + void SetType(uint32_t type) { m_params.SetType(type); } + uint32_t FindType(uint32_t comp, uint8_t level) const { return m_params.FindType(comp, level); } + FeatureParams::Types const & GetTypes() const { return m_params.m_Types; } /// Check classificator types for their compatibility with feature geometry type. /// Need to call when using any classificator types manipulating. @@ -94,17 +94,17 @@ public: /// @name Serialization. //@{ - void Serialize(TBuffer & data) const; - void SerializeBase(TBuffer & data, serial::GeometryCodingParams const & params, + void Serialize(Buffer & data) const; + void SerializeBase(Buffer & data, serial::GeometryCodingParams const & params, bool saveAddInfo) const; - void SerializeBorder(serial::GeometryCodingParams const & params, TBuffer & data) const; + void SerializeBorder(serial::GeometryCodingParams const & params, Buffer & data) const; - void Deserialize(TBuffer & data); + void Deserialize(Buffer & data); //@} /// @name Selectors. //@{ - inline m2::RectD GetLimitRect() const { return m_limitRect; } + m2::RectD GetLimitRect() const { return m_limitRect; } bool FormatFullAddress(std::string & res) const; @@ -116,8 +116,8 @@ public: m2::PointD GetKeyPoint() const; size_t GetPointsCount() const; - inline size_t GetPolygonsCount() const { return m_polygons.size(); } - inline size_t GetTypesCount() const { return m_params.m_Types.size(); } + size_t GetPolygonsCount() const { return m_polygons.size(); } + size_t GetTypesCount() const { return m_params.m_Types.size(); } //@} /// @name Iterate through polygons points. @@ -141,7 +141,7 @@ public: toDo(m_center); else { - for (TPointSeq const & points : m_polygons) + for (PointSeq const & points : m_polygons) { for (auto const & pt : points) if (!toDo(pt)) @@ -163,9 +163,9 @@ 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); } + void SetParams(FeatureParams const & params) { m_params.SetParams(params); } - inline FeatureParams const & GetParams() const { return m_params; } + FeatureParams const & GetParams() const { return m_params; } /// @name For OSM debugging and osm objects replacement, store original OSM id //@{ @@ -186,7 +186,7 @@ public: bool IsDrawableInRange(int lowScale, int highScale) const; void SetCoastCell(int64_t iCell) { m_coastCell = iCell; } - inline bool IsCoastCell() const { return (m_coastCell != -1); } + bool IsCoastCell() const { return (m_coastCell != -1); } bool AddName(std::string const & lang, std::string const & name); std::string GetName(int8_t lang = StringUtf8Multilang::kDefaultCode) const; @@ -217,7 +217,7 @@ protected: m2::PointD m_center; // Check HEADER_HAS_POINT /// List of geometry polygons. - TGeometry m_polygons; // Check HEADER_IS_AREA + Geometry m_polygons; // Check HEADER_IS_AREA /// Not used in GEOM_POINTs int64_t m_coastCell; @@ -226,10 +226,10 @@ protected: /// Used for serialization of features during final pass. class FeatureBuilder2 : public FeatureBuilder1 { - using TBase = FeatureBuilder1; - using TOffsets = std::vector; + using Base = FeatureBuilder1; + using Offsets = std::vector; - static void SerializeOffsets(uint32_t mask, TOffsets const & offsets, TBuffer & buffer); + static void SerializeOffsets(uint32_t mask, Offsets const & offsets, Buffer & buffer); /// For debugging friend std::string DebugPrint(FeatureBuilder2 const & f); @@ -239,19 +239,19 @@ public: { /// @name input //@{ - TOffsets m_ptsOffset; - TOffsets m_trgOffset; + Offsets m_ptsOffset; + Offsets m_trgOffset; uint8_t m_ptsMask; uint8_t m_trgMask; uint32_t m_ptsSimpMask; - TPointSeq m_innerPts; - TPointSeq m_innerTrg; + PointSeq m_innerPts; + PointSeq m_innerTrg; //@} /// @name output - TBase::TBuffer m_buffer; + Base::Buffer m_buffer; SupportingData() : m_ptsMask(0), m_trgMask(0), m_ptsSimpMask(0) {} }; @@ -275,7 +275,7 @@ namespace feature void ReadFromSourceRowFormat(TSource & src, FeatureBuilder1 & fb) { uint32_t const sz = ReadVarUint(src); - typename FeatureBuilder1::TBuffer buffer(sz); + typename FeatureBuilder1::Buffer buffer(sz); src.Read(&buffer[0], sz); fb.Deserialize(buffer); } diff --git a/generator/feature_generator.cpp b/generator/feature_generator.cpp index 4e6614845d..af9737aacf 100644 --- a/generator/feature_generator.cpp +++ b/generator/feature_generator.cpp @@ -106,7 +106,7 @@ uint32_t FeaturesCollector::WriteFeatureBase(std::vector const & bytes, Fe uint32_t FeaturesCollector::operator()(FeatureBuilder1 const & fb) { - FeatureBuilder1::TBuffer bytes; + FeatureBuilder1::Buffer bytes; fb.Serialize(bytes); uint32_t const featureId = WriteFeatureBase(bytes, fb); CHECK_LESS(0, m_featureID, ()); @@ -130,7 +130,7 @@ FeaturesAndRawGeometryCollector::~FeaturesAndRawGeometryCollector() uint32_t FeaturesAndRawGeometryCollector::operator()(FeatureBuilder1 const & fb) { uint32_t const featureId = FeaturesCollector::operator()(fb); - FeatureBuilder1::TGeometry const & geom = fb.GetGeometry(); + FeatureBuilder1::Geometry const & geom = fb.GetGeometry(); if (geom.empty()) return featureId; @@ -138,12 +138,12 @@ uint32_t FeaturesAndRawGeometryCollector::operator()(FeatureBuilder1 const & fb) uint64_t numGeometries = geom.size(); m_rawGeometryFileStream.Write(&numGeometries, sizeof(numGeometries)); - for (FeatureBuilder1::TPointSeq const & points : geom) + for (FeatureBuilder1::PointSeq const & points : geom) { uint64_t numPoints = points.size(); m_rawGeometryFileStream.Write(&numPoints, sizeof(numPoints)); m_rawGeometryFileStream.Write(points.data(), - sizeof(FeatureBuilder1::TPointSeq::value_type) * points.size()); + sizeof(FeatureBuilder1::PointSeq::value_type) * points.size()); } return featureId; } diff --git a/generator/feature_merger.cpp b/generator/feature_merger.cpp index 0c6369b97f..2855af89d2 100644 --- a/generator/feature_merger.cpp +++ b/generator/feature_merger.cpp @@ -24,8 +24,8 @@ 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()); - TPointSeq & thisG = m_polygons.front(); - TPointSeq const & fbG = fb.GetOuterGeometry(); + PointSeq & thisG = m_polygons.front(); + PointSeq const & fbG = fb.GetOuterGeometry(); if (fb.m_isRound) { @@ -106,7 +106,7 @@ size_t MergedFeatureBuilder1::GetKeyPointsCount() const double MergedFeatureBuilder1::GetPriority() const { - TPointSeq const & poly = GetOuterGeometry(); + PointSeq const & poly = GetOuterGeometry(); double pr = 0.0; for (size_t i = 1; i < poly.size(); ++i) diff --git a/generator/feature_merger.hpp b/generator/feature_merger.hpp index 0075aa8037..e9743d1250 100644 --- a/generator/feature_merger.hpp +++ b/generator/feature_merger.hpp @@ -11,7 +11,7 @@ class MergedFeatureBuilder1 : public FeatureBuilder1 { bool m_isRound; - TPointSeq m_roundBounds[2]; + PointSeq m_roundBounds[2]; public: MergedFeatureBuilder1() : m_isRound(false) {} @@ -41,7 +41,7 @@ public: template void ForEachMiddlePoints(ToDo toDo) const { - TPointSeq const & poly = GetOuterGeometry(); + PointSeq const & poly = GetOuterGeometry(); for (size_t i = 1; i < poly.size()-1; ++i) toDo(poly[i]); } diff --git a/generator/generator_tests/feature_builder_test.cpp b/generator/generator_tests/feature_builder_test.cpp index b4d55998e2..d180fb905c 100644 --- a/generator/generator_tests/feature_builder_test.cpp +++ b/generator/generator_tests/feature_builder_test.cpp @@ -47,7 +47,7 @@ UNIT_TEST(FBuilder_ManyTypes) TEST(fb1.RemoveInvalidTypes(), ()); TEST(fb1.CheckValid(), ()); - FeatureBuilder1::TBuffer buffer; + FeatureBuilder1::Buffer buffer; TEST(fb1.PreSerialize(), ()); fb1.Serialize(buffer); @@ -83,7 +83,7 @@ UNIT_TEST(FBuilder_LineTypes) TEST(fb1.RemoveInvalidTypes(), ()); TEST(fb1.CheckValid(), ()); - FeatureBuilder1::TBuffer buffer; + FeatureBuilder1::Buffer buffer; TEST(fb1.PreSerialize(), ()); fb1.Serialize(buffer); @@ -112,7 +112,7 @@ UNIT_TEST(FBuilder_Waterfall) TEST(fb1.RemoveInvalidTypes(), ()); TEST(fb1.CheckValid(), ()); - FeatureBuilder1::TBuffer buffer; + FeatureBuilder1::Buffer buffer; TEST(fb1.PreSerialize(), ()); fb1.Serialize(buffer); diff --git a/generator/locality_sorter.cpp b/generator/locality_sorter.cpp index 2f2eecb6d4..8be340628e 100644 --- a/generator/locality_sorter.cpp +++ b/generator/locality_sorter.cpp @@ -47,7 +47,7 @@ public: { if (fb.IsArea()) { - FeatureBuilder1::TBuffer buffer; + FeatureBuilder1::Buffer buffer; fb.SerializeBorder(serial::GeometryCodingParams(), buffer); WriteFeatureBase(buffer, fb); } diff --git a/generator/osm2type.cpp b/generator/osm2type.cpp index eceec6e34b..7614bce95c 100644 --- a/generator/osm2type.cpp +++ b/generator/osm2type.cpp @@ -620,7 +620,7 @@ namespace ftype bool noOneway = false; // Get a copy of source types, because we will modify params in the loop; - FeatureParams::TTypes const vTypes = params.m_Types; + FeatureParams::Types const vTypes = params.m_Types; for (size_t i = 0; i < vTypes.size(); ++i) { if (!highwayDone && types.IsHighway(vTypes[i])) diff --git a/generator/osm_translator.hpp b/generator/osm_translator.hpp index 5797e4fe0a..aca9a8bc2b 100644 --- a/generator/osm_translator.hpp +++ b/generator/osm_translator.hpp @@ -249,19 +249,19 @@ class OsmToFeatureTranslator class HolesAccumulator { AreaWayMerger m_merger; - FeatureBuilder1::TGeometry m_holes; + FeatureBuilder1::Geometry m_holes; public: HolesAccumulator(OsmToFeatureTranslator * pMain) : m_merger(pMain->m_holder) {} void operator() (uint64_t id) { m_merger.AddWay(id); } - FeatureBuilder1::TGeometry & GetHoles() + FeatureBuilder1::Geometry & GetHoles() { ASSERT(m_holes.empty(), ("Can call only once")); - m_merger.ForEachArea(false, [this](FeatureBuilder1::TPointSeq & v, std::vector const &) + m_merger.ForEachArea(false, [this](FeatureBuilder1::PointSeq & v, std::vector const &) { - m_holes.push_back(FeatureBuilder1::TPointSeq()); + m_holes.push_back(FeatureBuilder1::PointSeq()); m_holes.back().swap(v); }); return m_holes; @@ -299,7 +299,7 @@ class OsmToFeatureTranslator m_holes(id); } - FeatureBuilder1::TGeometry & GetHoles() { return m_holes.GetHoles(); } + FeatureBuilder1::Geometry & GetHoles() { return m_holes.GetHoles(); } }; bool ParseType(OsmElement * p, FeatureParams & params) @@ -519,7 +519,7 @@ public: } auto const & holesGeometry = holes.GetHoles(); - outer.ForEachArea(true, [&] (FeatureBuilder1::TPointSeq const & pts, std::vector const & ids) + outer.ForEachArea(true, [&] (FeatureBuilder1::PointSeq const & pts, std::vector const & ids) { FeatureBuilder1 ft; diff --git a/generator/world_map_generator.hpp b/generator/world_map_generator.hpp index 1ac1b4aca7..add15ecc33 100644 --- a/generator/world_map_generator.hpp +++ b/generator/world_map_generator.hpp @@ -102,7 +102,7 @@ public: double constexpr kExtension = 0.01; ProcessState state = ProcessState::Initial; - FeatureBuilder1::TPointSeq points; + FeatureBuilder1::PointSeq points; for (size_t i = 0; i < line.size(); ++i) { diff --git a/indexer/feature_data.hpp b/indexer/feature_data.hpp index 360a92d886..8f9931da8a 100644 --- a/indexer/feature_data.hpp +++ b/indexer/feature_data.hpp @@ -217,8 +217,8 @@ class FeatureParams : public FeatureParamsBase feature::AddressData m_addrTags; public: - using TTypes = vector; - TTypes m_Types; + using Types = vector; + Types m_Types; bool m_reverseGeometry;