Format all C++ and Java code via clang-format

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-17 14:32:37 +07:00
parent 9f0290c0ec
commit bfffa1fff4
2169 changed files with 56441 additions and 64188 deletions

View File

@@ -8,8 +8,7 @@
using namespace feature;
MergedFeatureBuilder::MergedFeatureBuilder(FeatureBuilder const & fb)
: FeatureBuilder(fb), m_isRound(false)
MergedFeatureBuilder::MergedFeatureBuilder(FeatureBuilder const & fb) : FeatureBuilder(fb), m_isRound(false)
{
m_params.FinishAddingTypes();
}
@@ -60,18 +59,15 @@ void MergedFeatureBuilder::AppendFeature(MergedFeatureBuilder const & fb, bool f
CalcRect(fbG.begin(), fbG.end() - 1, m_limitRect);
}
}
else if (toBack)
{
thisG.insert(thisG.end(), fbG.rbegin() + 1, fbG.rend());
CalcRect(fbG.rbegin() + 1, fbG.rend(), m_limitRect);
}
else
{
if (toBack)
{
thisG.insert(thisG.end(), fbG.rbegin() + 1, fbG.rend());
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);
}
thisG.insert(thisG.begin(), fbG.rbegin(), fbG.rend() - 1);
CalcRect(fbG.rbegin(), fbG.rend() - 1, m_limitRect);
}
}
@@ -100,7 +96,7 @@ std::pair<m2::PointD, bool> MergedFeatureBuilder::GetKeyPoint(size_t i) const
i -= sz;
// 4. return last point
ASSERT_EQUAL ( i, 0, () );
ASSERT_EQUAL(i, 0, ());
return std::make_pair(LastPoint(), true);
}
@@ -115,27 +111,23 @@ double MergedFeatureBuilder::GetSquaredLength() const
double sqLen = 0.0;
for (size_t i = 1; i < poly.size(); ++i)
sqLen += poly[i-1].SquaredLength(poly[i]);
sqLen += poly[i - 1].SquaredLength(poly[i]);
return sqLen;
}
FeatureMergeProcessor::Key FeatureMergeProcessor::GetKey(m2::PointD const & p)
{
return PointToInt64Obsolete(p, m_coordBits);
}
FeatureMergeProcessor::FeatureMergeProcessor(uint32_t coordBits)
: m_coordBits(coordBits)
FeatureMergeProcessor::FeatureMergeProcessor(uint32_t coordBits) : m_coordBits(coordBits) {}
void FeatureMergeProcessor::operator()(FeatureBuilder const & fb)
{
this->operator()(new MergedFeatureBuilder(fb));
}
void FeatureMergeProcessor::operator() (FeatureBuilder const & fb)
{
this->operator() (new MergedFeatureBuilder(fb));
}
void FeatureMergeProcessor::operator() (MergedFeatureBuilder * p)
void FeatureMergeProcessor::operator()(MergedFeatureBuilder * p)
{
Key const k1 = GetKey(p->FirstPoint());
Key const k2 = GetKey(p->LastPoint());
@@ -166,7 +158,8 @@ void FeatureMergeProcessor::Remove(Key key, MergedFeatureBuilder const * p)
{
MergedFeatureBuilders & v = i->second;
v.erase(remove(v.begin(), v.end(), p), v.end());
if (v.empty()) m_map.erase(i);
if (v.empty())
m_map.erase(i);
}
}
@@ -180,7 +173,7 @@ void FeatureMergeProcessor::Remove(MergedFeatureBuilder const * p)
Remove(k2, p);
else
{
ASSERT ( p->IsRound(), () );
ASSERT(p->IsRound(), ());
p->ForEachMiddlePoints(std::bind(&FeatureMergeProcessor::Remove1, this, std::placeholders::_1, p));
}
@@ -276,7 +269,8 @@ void FeatureMergeProcessor::DoMerge(FeatureEmitterIFace & emitter)
}
// Delete if the feature was removed from map.
if (isRemoved) delete p;
if (isRemoved)
delete p;
}
if (m_last.NotEmpty())
@@ -292,7 +286,8 @@ uint32_t FeatureTypesProcessor::GetType(char const * arr[], size_t n)
void FeatureTypesProcessor::CorrectType(uint32_t & t) const
{
if (m_dontNormalize.count(t) > 0) return;
if (m_dontNormalize.count(t) > 0)
return;
// 1. get normalized type:
// highway-motorway-bridge => highway-motorway
@@ -309,7 +304,7 @@ void FeatureTypesProcessor::SetMappingTypes(char const * arr1[2], char const * a
m_mapping[GetType(arr1, 2)] = GetType(arr2, 2);
}
MergedFeatureBuilder * FeatureTypesProcessor::operator() (FeatureBuilder const & fb)
MergedFeatureBuilder * FeatureTypesProcessor::operator()(FeatureBuilder const & fb)
{
MergedFeatureBuilder * p = new MergedFeatureBuilder(fb);
@@ -340,22 +335,13 @@ protected:
public:
int m_lowScale, m_upScale;
TypeCheckBase(int lowScale, int upScale)
: m_lowScale(lowScale), m_upScale(upScale)
{
}
TypeCheckBase(int lowScale, int upScale) : m_lowScale(lowScale), m_upScale(upScale) {}
using RangeT = std::pair<int, int>;
static RangeT GetScaleRange(uint32_t type)
{
return feature::GetDrawableScaleRange(type);
}
static RangeT GetScaleRange(uint32_t type) { return feature::GetDrawableScaleRange(type); }
static bool IsEmptyRange(RangeT const & range) { return range.first == -1; }
bool IsBadRange(RangeT const & range) const
{
return (range.first > m_upScale || range.second < m_lowScale);
}
bool IsBadRange(RangeT const & range) const { return (range.first > m_upScale || range.second < m_lowScale); }
};
class TypeCheckWorld : public TypeCheckBase
@@ -363,12 +349,10 @@ class TypeCheckWorld : public TypeCheckBase
public:
bool m_isRegion = false;
TypeCheckWorld() : TypeCheckBase(0, scales::GetUpperWorldScale())
{
}
TypeCheckWorld() : TypeCheckBase(0, scales::GetUpperWorldScale()) {}
/// @return true If |type| should be removed.
bool operator() (uint32_t type)
bool operator()(uint32_t type)
{
// Keep place=region types in World.mwm for search, even when they are not visible.
if (type == GetRegionType())
@@ -385,12 +369,10 @@ public:
class TypeCheckCountry : public TypeCheckBase
{
public:
TypeCheckCountry() : TypeCheckBase(scales::GetUpperWorldScale() + 1, scales::GetUpperStyleScale())
{
}
TypeCheckCountry() : TypeCheckBase(scales::GetUpperWorldScale() + 1, scales::GetUpperStyleScale()) {}
/// @return true If |type| should be removed.
bool operator() (uint32_t type) const
bool operator()(uint32_t type) const
{
// Do not keep place=region in countries.
if (type == GetRegionType())
@@ -427,4 +409,4 @@ bool PreprocessForCountryMap(FeatureBuilder & fb)
{
return !fb.RemoveTypesIf(TypeCheckCountry());
}
} // namespace feature
} // namespace feature