review fixes

This commit is contained in:
ExMix 2015-05-12 18:28:45 +03:00 committed by r.kuznetsov
parent edb5770567
commit 550a0a4b05
7 changed files with 17 additions and 38 deletions

View file

@ -190,9 +190,18 @@ TStatus Framework::GetCountryStatus(TIndex const & idx) const
}
/// @param[in] mask Active pointers bits : 0x0 - no, 0x1 - (x1, y1), 0x2 - (x2, y2), 0x3 - (x1, y1)(x2, y2).
namespace
{
int const MASK_NO_TOUCHES = 0x0;
int const MASK_FIRST_TOUCH = 0x1;
int const MASK_SECOND_TOUCH = 0x2;
int const MASK_BOTH_TOUCHES = 0x3;
} // namespace
void Framework::Touch(int action, int mask, double x1, double y1, double x2, double y2)
{
if (mask == 0)
if (mask == MASK_NO_TOUCHES)
return;
MultiTouchAction eventType = static_cast<MultiTouchAction>(action);
@ -216,7 +225,7 @@ void Framework::Touch(int action, int mask, double x1, double y1, double x2, dou
return;
}
if (mask == 0x2)
if (mask == MASK_SECOND_TOUCH)
{
x1 = x2;
y1 = y2;
@ -224,7 +233,7 @@ void Framework::Touch(int action, int mask, double x1, double y1, double x2, dou
event.m_touches[0].m_location = m2::PointD(x1, y1);
event.m_touches[0].m_id = 0;
if (mask == 0x3)
if (mask == MASK_BOTH_TOUCHES)
{
event.m_touches[1].m_location = m2::PointD(x2, y2);
event.m_touches[1].m_id = 1;

View file

@ -263,9 +263,6 @@ struct UnicodeBlock
int GetFontOffset(int idx) const
{
if (m_fontsWeight.empty())
return -1;
ASSERT(!m_fontsWeight.empty(), ());
int maxWight = 0;
int upperBoundWeight = numeric_limits<int>::max();

View file

@ -51,11 +51,6 @@ void TileTree::EndRequesting()
SimplifyTree();
}
void TileTree::GetTilesCollection(TTilesCollection & tiles, int const zoomLevel) const
{
FillTilesCollection(m_root, tiles, zoomLevel);
}
void TileTree::ClipByRect(m2::RectD const & rect)
{
ClipNode(m_root, rect);
@ -202,17 +197,6 @@ void TileTree::AbortTiles(TNodePtr const & node, int const zoomLevel)
}
}
void TileTree::FillTilesCollection(TNodePtr const & node, TTilesCollection & tiles, int const zoomLevel) const
{
for (TNodePtr const & childNode : node->m_children)
{
if (childNode->m_tileStatus != TileStatus::Unknown && childNode->m_tileKey.m_zoomLevel == zoomLevel)
tiles.insert(childNode->m_tileKey);
FillTilesCollection(childNode, tiles, zoomLevel);
}
}
void TileTree::ClipNode(TNodePtr const & node, m2::RectD const & rect)
{
for (auto it = node->m_children.begin(); it != node->m_children.end();)

View file

@ -49,9 +49,6 @@ public:
/// This method processes a message about finishing reading tiles on BR.
void FinishTiles(TTilesCollection const & tiles, int const zoomLevel);
/// It returns actual tile collection to send to BR.
void GetTilesCollection(TTilesCollection & tiles, int const zoomLevel) const;
private:
struct Node;
using TNodePtr = unique_ptr<Node>;
@ -66,8 +63,6 @@ private:
void ClipByRect(m2::RectD const & rect);
void FillTilesCollection(TNodePtr const & node, TTilesCollection & tiles, int const zoomLevel) const;
void ClipNode(TNodePtr const & node, m2::RectD const & rect);
void CheckDeferredTiles(TNodePtr const & node);

View file

@ -97,7 +97,7 @@ ScreenBase const & UserEventStream::ProcessEvents(bool & modelViewChange, bool &
}
}
if (m_state == STATE_TAP_DETECTION && m_validPointersCount == 1)
if (m_state == STATE_TAP_DETECTION && m_validTouchesCount == 1)
DetectLongTap(m_touches[0]);
return m_navigator.Screen();
@ -109,11 +109,6 @@ void UserEventStream::SetTapListener(TTapDetectedFn const & tapCallback, TSingle
m_filterFn = filterFn;
}
void UserEventStream::Clear()
{
m_events.clear();
}
void UserEventStream::SetCenter(m2::PointD const & center, int zoom)
{
m2::RectD rect = df::GetRectForDrawScale(zoom, center);
@ -299,7 +294,7 @@ void UserEventStream::TouchUp(array<Touch, 2> const & touches)
void UserEventStream::UpdateTouches(array<Touch, 2> const & touches, size_t validCount)
{
m_touches = touches;
m_validPointersCount = validCount;
m_validTouchesCount = validCount;
#ifdef DEBUG
if (validCount > 0)
ASSERT(m_touches[0].m_id != -1, ());

View file

@ -20,7 +20,7 @@ namespace df
struct Touch
{
m2::PointF m_location = m2::PointF::Zero();
int m_id = -1; // if id == -1 than touch invalid
int m_id = -1; // if id == -1 then touch invalid
};
struct TouchEvent
@ -157,7 +157,6 @@ public:
#endif
private:
void Clear();
void SetCenter(m2::PointD const & center, int zoom);
void SetRect(m2::RectD rect, int zoom, bool applyRotation);
void SetRect(m2::AnyRectD const & rect);
@ -208,7 +207,7 @@ private:
} m_state;
array<Touch, 2> m_touches;
size_t m_validPointersCount;
size_t m_validTouchesCount;
#ifdef DEBUG
TTestBridge m_testFn;

View file

@ -727,7 +727,7 @@ namespace
double ScaleModeToFactor(Framework::EScaleMode mode)
{
double factors[] = { 2.0, 1.5, 0.5, 0.67};
double factors[] = { 2.0, 1.5, 0.5, 0.67 };
return factors[mode];
}