mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -16,8 +16,8 @@ double const kSinTurn = sin(kValidPathSplineTurn);
|
||||
double const kRoundStep = 23;
|
||||
int const kMaxStepsCount = 7;
|
||||
|
||||
bool RoundCorner(m2::PointD const & p1, m2::PointD const & p2, m2::PointD const & p3,
|
||||
int leftStepsCount, std::vector<m2::PointD> & roundedCorner)
|
||||
bool RoundCorner(m2::PointD const & p1, m2::PointD const & p2, m2::PointD const & p3, int leftStepsCount,
|
||||
std::vector<m2::PointD> & roundedCorner)
|
||||
{
|
||||
roundedCorner.clear();
|
||||
|
||||
@@ -37,8 +37,8 @@ bool RoundCorner(m2::PointD const & p1, m2::PointD const & p2, m2::PointD const
|
||||
roundedCorner.push_back(p1);
|
||||
return false;
|
||||
}
|
||||
m2::PointD const np1 = p2 - dir1 * std::min(kRoundStep * vs,
|
||||
p1p2Length - p1p2Length / std::max(leftStepsCount - 1, 2));
|
||||
m2::PointD const np1 =
|
||||
p2 - dir1 * std::min(kRoundStep * vs, p1p2Length - p1p2Length / std::max(leftStepsCount - 1, 2));
|
||||
p1p2Length = (p2 - np1).Length();
|
||||
double const cosCorner = m2::DotProduct(-dir1, dir2);
|
||||
double const sinCorner = fabs(m2::CrossProduct(-dir1, dir2));
|
||||
@@ -69,8 +69,7 @@ void ReplaceLastCorner(std::vector<m2::PointD> const & roundedCorner, m2::Spline
|
||||
}
|
||||
} // namespace
|
||||
|
||||
bool IsValidSplineTurn(m2::PointD const & normalizedDir1,
|
||||
m2::PointD const & normalizedDir2)
|
||||
bool IsValidSplineTurn(m2::PointD const & normalizedDir1, m2::PointD const & normalizedDir2)
|
||||
{
|
||||
double const dotProduct = m2::DotProduct(normalizedDir1, normalizedDir2);
|
||||
double const kEps = 1e-5;
|
||||
@@ -94,8 +93,8 @@ void AddPointAndRound(m2::SplineEx & spline, m2::PointD const & pt)
|
||||
int leftStepsCount = static_cast<int>(acos(dotProduct) / kValidPathSplineTurn);
|
||||
std::vector<m2::PointD> roundedCorner;
|
||||
while (leftStepsCount > 0 && leftStepsCount <= kMaxStepsCount &&
|
||||
RoundCorner(spline.GetPath()[spline.GetSize() - 2],
|
||||
spline.GetPath().back(), pt, leftStepsCount--, roundedCorner))
|
||||
RoundCorner(spline.GetPath()[spline.GetSize() - 2], spline.GetPath().back(), pt, leftStepsCount--,
|
||||
roundedCorner))
|
||||
{
|
||||
ReplaceLastCorner(roundedCorner, spline);
|
||||
}
|
||||
@@ -104,17 +103,15 @@ void AddPointAndRound(m2::SplineEx & spline, m2::PointD const & pt)
|
||||
spline.AddPoint(pt);
|
||||
}
|
||||
|
||||
PathTextContext::PathTextContext(m2::SharedSpline const & spline)
|
||||
: m_globalSpline(spline)
|
||||
{}
|
||||
PathTextContext::PathTextContext(m2::SharedSpline const & spline) : m_globalSpline(spline) {}
|
||||
|
||||
void PathTextContext::SetLayout(drape_ptr<PathTextLayout> && layout, double baseGtoPScale)
|
||||
{
|
||||
m_layout = std::move(layout);
|
||||
m_globalOffsets.clear();
|
||||
m_globalPivots.clear();
|
||||
PathTextLayout::CalculatePositions(m_globalSpline->GetLength(), baseGtoPScale,
|
||||
m_layout->GetPixelLength(), m_globalOffsets);
|
||||
PathTextLayout::CalculatePositions(m_globalSpline->GetLength(), baseGtoPScale, m_layout->GetPixelLength(),
|
||||
m_globalOffsets);
|
||||
m_globalPivots.reserve(m_globalOffsets.size());
|
||||
for (auto const offset : m_globalOffsets)
|
||||
m_globalPivots.push_back(m_globalSpline->GetPoint(offset).m_pos);
|
||||
@@ -135,8 +132,7 @@ std::vector<double> const & PathTextContext::GetOffsets() const
|
||||
return m_globalOffsets;
|
||||
}
|
||||
|
||||
bool PathTextContext::GetPivot(size_t textIndex, m2::PointD & pivot,
|
||||
m2::Spline::iterator & centerPointIter) const
|
||||
bool PathTextContext::GetPivot(size_t textIndex, m2::PointD & pivot, m2::Spline::iterator & centerPointIter) const
|
||||
{
|
||||
if (textIndex >= m_centerGlobalPivots.size())
|
||||
return false;
|
||||
@@ -251,12 +247,11 @@ end:
|
||||
return resSpline ? resSpline->GetPoint(resStep) : m2::Spline::iterator();
|
||||
}
|
||||
|
||||
|
||||
PathTextHandle::PathTextHandle(dp::OverlayID const & id, std::shared_ptr<PathTextContext> const & context,
|
||||
float depth, uint32_t textIndex, uint64_t priority,
|
||||
ref_ptr<dp::TextureManager> textureManager, int minVisibleScale, bool isBillboard)
|
||||
: TextHandle(id, context->GetLayout()->GetGlyphs(), dp::Center, priority,
|
||||
textureManager, minVisibleScale, isBillboard)
|
||||
PathTextHandle::PathTextHandle(dp::OverlayID const & id, std::shared_ptr<PathTextContext> const & context, float depth,
|
||||
uint32_t textIndex, uint64_t priority, ref_ptr<dp::TextureManager> textureManager,
|
||||
int minVisibleScale, bool isBillboard)
|
||||
: TextHandle(id, context->GetLayout()->GetGlyphs(), dp::Center, priority, textureManager, minVisibleScale,
|
||||
isBillboard)
|
||||
, m_context(context)
|
||||
, m_textIndex(textIndex)
|
||||
, m_depth(depth)
|
||||
|
||||
Reference in New Issue
Block a user