forked from organicmaps/organicmaps
Fixes according to code review.
This commit is contained in:
parent
5aaee9909f
commit
ce4870393d
8 changed files with 19 additions and 13 deletions
|
@ -291,7 +291,7 @@ namespace graphics
|
|||
entry.m_angle = pivotPt.m_angle;
|
||||
|
||||
// is path too bended to be shown at all?
|
||||
if (hasPrevElem && (ang::GetShortestDistance(prevElem.m_angle.val(), entry.m_angle.val()) > 0.5))
|
||||
if (hasPrevElem && fabs(ang::GetShortestDistance(prevElem.m_angle.val(), entry.m_angle.val())) > 0.5)
|
||||
break;
|
||||
|
||||
double const centerOffset = metrics.m_xOffset + metrics.m_width / 2.0;
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
typedef bitset<UPPER_STYLE_SCALE+1> visible_mask_t;
|
||||
typedef bitset<scales::UPPER_STYLE_SCALE+1> visible_mask_t;
|
||||
visible_mask_t GetVisibilityMask() const { return m_visibility; }
|
||||
void SetVisibilityMask(visible_mask_t mask) { m_visibility = mask; }
|
||||
void SetVisibilityOnScale(const bool isVisible, const int scale) { m_visibility[scale] = isVisible; }
|
||||
|
|
|
@ -3,13 +3,19 @@
|
|||
#include "../geometry/rect2d.hpp"
|
||||
#include "../geometry/point2d.hpp"
|
||||
|
||||
int const UPPER_STYLE_SCALE = 19;
|
||||
|
||||
namespace scales
|
||||
{
|
||||
int const UPPER_STYLE_SCALE = 19;
|
||||
|
||||
/// Upper scale for data generation and indexer buckets.
|
||||
inline int GetUpperScale() { return 17; }
|
||||
/// Upper scale according to drawing rules.
|
||||
inline int GetUpperStyleScale() { return UPPER_STYLE_SCALE; }
|
||||
/// Upper scales for World visible styles and indexer buckets.
|
||||
inline int GetUpperWorldScale() { return 9; }
|
||||
/// Upper scale for user comfort view (e.g. location zoom).
|
||||
inline int GetUpperComfortScale() { return UPPER_STYLE_SCALE - 2; }
|
||||
|
||||
double GetM2PFactor(int level);
|
||||
|
||||
|
|
|
@ -486,7 +486,7 @@ void Framework::ShowBookmark(Bookmark const & bm)
|
|||
|
||||
double scale = bm.GetScale();
|
||||
if (scale == -1.0)
|
||||
scale = scales::GetUpperStyleScale() - 2;
|
||||
scale = scales::GetUpperComfortScale();
|
||||
|
||||
ShowRectExVisibleScale(m_scales.GetRectForDrawScale(scale, bm.GetOrg()));
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace location
|
|||
switch (m_locationProcessMode)
|
||||
{
|
||||
case ELocationCenterAndScale:
|
||||
m_framework->ShowRectExVisibleScale(rect, scales::GetUpperStyleScale()-2);
|
||||
m_framework->ShowRectExVisibleScale(rect, scales::GetUpperComfortScale());
|
||||
|
||||
SetIsCentered(true);
|
||||
CheckCompassRotation();
|
||||
|
|
|
@ -419,7 +419,7 @@ void Navigator::ScaleToPoint(m2::PointD const & pt, double factor, double /*time
|
|||
ScaleImpl(pt, endPt, pt, startPt, factor > 1, false);
|
||||
}
|
||||
|
||||
bool Navigator::CheckMaxScale(ScreenBase const & screen) const
|
||||
bool Navigator::CheckMinScale(ScreenBase const & screen) const
|
||||
{
|
||||
m2::RectD const & r = screen.ClipRect();
|
||||
m2::RectD const & worldR = m_scales.GetWorldRect();
|
||||
|
@ -427,7 +427,7 @@ bool Navigator::CheckMaxScale(ScreenBase const & screen) const
|
|||
return (r.SizeX() <= worldR.SizeX() || r.SizeY() <= worldR.SizeY());
|
||||
}
|
||||
|
||||
bool Navigator::CheckMinScale(ScreenBase const & screen) const
|
||||
bool Navigator::CheckMaxScale(ScreenBase const & screen) const
|
||||
{
|
||||
return (m_scales.GetDrawTileScale(screen) <= scales::GetUpperStyleScale());
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ bool Navigator::CheckBorders(ScreenBase const & screen) const
|
|||
|
||||
bool Navigator::ScaleImpl(m2::PointD const & newPt1, m2::PointD const & newPt2,
|
||||
m2::PointD const & oldPt1, m2::PointD const & oldPt2,
|
||||
bool skipMaxScaleAndBordersCheck,
|
||||
bool skipMinScaleAndBordersCheck,
|
||||
bool doRotateScreen)
|
||||
{
|
||||
math::Matrix<double, 3, 3> newM = m_Screen.GtoPMatrix() * ScreenBase::CalcTransform(oldPt1, oldPt2, newPt1, newPt2);
|
||||
|
@ -453,12 +453,12 @@ bool Navigator::ScaleImpl(m2::PointD const & newPt1, m2::PointD const & newPt2,
|
|||
if (!doRotateScreen)
|
||||
tmp.Rotate(-(tmp.GetAngle() - oldAngle));
|
||||
|
||||
if (!skipMaxScaleAndBordersCheck && !CheckMaxScale(tmp))
|
||||
if (!skipMinScaleAndBordersCheck && !CheckMinScale(tmp))
|
||||
return false;
|
||||
|
||||
m2::RectD const & worldR = m_scales.GetWorldRect();
|
||||
|
||||
if (!skipMaxScaleAndBordersCheck && !CheckBorders(tmp))
|
||||
if (!skipMinScaleAndBordersCheck && !CheckBorders(tmp))
|
||||
{
|
||||
if (CanShrinkInto(tmp, worldR))
|
||||
tmp = ShrinkInto(tmp, worldR);
|
||||
|
@ -466,7 +466,7 @@ bool Navigator::ScaleImpl(m2::PointD const & newPt1, m2::PointD const & newPt2,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!CheckMinScale(tmp))
|
||||
if (!CheckMaxScale(tmp))
|
||||
return false;
|
||||
|
||||
// re-checking the borders, as we might violate them a bit (don't know why).
|
||||
|
|
|
@ -115,6 +115,6 @@ private:
|
|||
m2::PointD const & newPt2,
|
||||
m2::PointD const & oldPt1,
|
||||
m2::PointD const & oldPt2,
|
||||
bool skipMaxScaleAndBordersCheck,
|
||||
bool skipMinScaleAndBordersCheck,
|
||||
bool doRotateScreen);
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@ void ScalesProcessor::SetParams(int width, int height, double visualScale)
|
|||
|
||||
m2::RectD const & ScalesProcessor::GetWorldRect() const
|
||||
{
|
||||
static m2::RectD worldRect = MercatorBounds::FullRect();
|
||||
static m2::RectD const worldRect = MercatorBounds::FullRect();
|
||||
return worldRect;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue