Some changes after Colleagues comments

This commit is contained in:
Vladimir Byko-Ianko 2015-01-29 15:31:45 +03:00 committed by Alex Zolotarev
parent fcd1a96880
commit 868359ba1f
3 changed files with 23 additions and 22 deletions

View file

@ -264,7 +264,7 @@ void BookmarkManager::DrawItems(shared_ptr<PaintEvent> const & e) const
double const visualScale = m_framework.GetVisualScale();
location::RouteMatchingInfo const & matchingInfo = m_framework.GetLocationState()->GetRouteMatchingInfo();
auto trackUpdateFn = [&matrix, &limitRect, this, drawScale, visualScale, &matchingInfo](Track const * track)
auto trackUpdateFn = [&](Track const * track)
{
ASSERT(track, ());
if (limitRect.IsIntersect(track->GetLimitRect()))
@ -273,7 +273,7 @@ void BookmarkManager::DrawItems(shared_ptr<PaintEvent> const & e) const
track->DeleteDisplayList();
};
auto dlUpdateFn = [&matrix, &trackUpdateFn] (BookmarkCategory const * cat)
auto dlUpdateFn = [&trackUpdateFn] (BookmarkCategory const * cat)
{
if (cat->IsVisible())
{

View file

@ -31,7 +31,6 @@ namespace location
size_t m_indexInRoute;
bool m_isPositionMatched;
RouteMatchingInfo(RouteMatchingInfo const &) = delete;
public:
RouteMatchingInfo() : m_matchedPosition(0., 0.), m_indexInRoute(0), m_isPositionMatched(false) {}
void SetRouteMatchingInfo(m2::PointD const & matchedPosition, size_t indexInRoute)
@ -41,7 +40,7 @@ namespace location
m_isPositionMatched = true;
}
void ResetRouteMatchingInfo() { m_isPositionMatched = false; }
bool hasRouteMatchingInfo() const { return m_isPositionMatched; }
bool HasRouteMatchingInfo() const { return m_isPositionMatched; }
size_t GetIndexInRoute() const { return m_indexInRoute; }
m2::PointD GetPosition() const { return m_matchedPosition; }
};

View file

@ -9,11 +9,24 @@
#include "../indexer/scales.hpp"
pair<m2::PointD, m2::PointD> shiftArrow(pair<m2::PointD, m2::PointD> const & arrowDirection)
namespace
{
return pair<m2::PointD, m2::PointD>(arrowDirection.first - (arrowDirection.second - arrowDirection.first),
arrowDirection.first);
pair<m2::PointD, m2::PointD> shiftArrow(pair<m2::PointD, m2::PointD> const & arrowDirection)
{
return pair<m2::PointD, m2::PointD>(arrowDirection.first - (arrowDirection.second - arrowDirection.first),
arrowDirection.first);
}
void drawArrowTriangle(graphics::Screen * dlScreen, pair<m2::PointD, m2::PointD> const & arrowDirection,
double arrowWidth, double arrowLength, graphics::Color arrowColor, double arrowDepth)
{
ASSERT(dlScreen, ());
m2::PointD p1, p2, p3;
m2::ArrowPoints(arrowDirection.first, arrowDirection.second, arrowWidth, arrowLength, p1, p2, p3);
vector<m2::PointF> arrow = {p1, p2, p3};
dlScreen->drawConvexPolygon(&arrow[0], arrow.size(), arrowColor, arrowDepth);
}
}
bool clipArrowBodyAndGetArrowDirection(vector<m2::PointD> & ptsTurn, pair<m2::PointD, m2::PointD> & arrowDirection,
@ -113,17 +126,6 @@ bool clipArrowBodyAndGetArrowDirection(vector<m2::PointD> & ptsTurn, pair<m2::Po
return true;
}
void drawArrowTriangle(graphics::Screen * dlScreen, pair<m2::PointD, m2::PointD> const & arrowDirection,
double arrowWidth, double arrowLength, graphics::Color arrowColor, double arrowDepth)
{
ASSERT(dlScreen, ());
m2::PointD p1, p2, p3;
m2::ArrowPoints(arrowDirection.first, arrowDirection.second, arrowWidth, arrowLength, p1, p2, p3);
vector<m2::PointF> arrow = {p1, p2, p3};
dlScreen->drawConvexPolygon(&arrow[0], arrow.size(), arrowColor, arrowDepth);
}
void RouteTrack::CreateDisplayListArrows(graphics::Screen * dlScreen, MatrixT const & matrix, double visualScale) const
{
double const beforeTurn = 13. * visualScale;
@ -175,7 +177,7 @@ void RouteTrack::CreateDisplayList(graphics::Screen * dlScreen, MatrixT const &
PolylineD const & fullPoly = GetPolyline();
size_t const formerIndex = m_relevantMatchedInfo.GetIndexInRoute();
if (matchingInfo.hasRouteMatchingInfo())
if (matchingInfo.HasRouteMatchingInfo())
m_relevantMatchedInfo = matchingInfo;
size_t const currentIndex = m_relevantMatchedInfo.GetIndexInRoute();
@ -189,7 +191,7 @@ void RouteTrack::CreateDisplayList(graphics::Screen * dlScreen, MatrixT const &
auto const curSegIter = fullPoly.Begin() + currentIndex;
//the most part of the route and symbols
if (currentIndex == 0 || formerIndex != currentIndex ||
if (formerIndex != currentIndex ||
!HasDisplayList() || isScaleChanged)
{
DeleteDisplayList();
@ -220,7 +222,7 @@ void RouteTrack::CreateDisplayList(graphics::Screen * dlScreen, MatrixT const &
//closest route segment
m_closestSegmentDL = dlScreen->createDisplayList();
dlScreen->setDisplayList(m_closestSegmentDL);
PolylineD closestPoly(m_relevantMatchedInfo.hasRouteMatchingInfo() ?
PolylineD closestPoly(m_relevantMatchedInfo.HasRouteMatchingInfo() ?
vector<m2::PointD>({m_relevantMatchedInfo.GetPosition(), fullPoly.GetPoint(currentIndex + 1)}) :
vector<m2::PointD>({fullPoly.GetPoint(currentIndex), fullPoly.GetPoint(currentIndex + 1)}));
PointContainerT pts;