diff options
author | Roman Sorokin <sorok-roma@yandex.ru> | 2014-08-20 19:05:55 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:25:19 +0300 |
commit | 36e822e9d72a6757c8056f22e35b6df43aa941db (patch) | |
tree | 23260b143cf708eac55b698ef48bbecfaa6792d7 /drape/overlay_handle.cpp | |
parent | d67ba2de4a16237517eb76fbf6a0acd07eb8fb56 (diff) |
Changed interface of GetPixelShape
Diffstat (limited to 'drape/overlay_handle.cpp')
-rw-r--r-- | drape/overlay_handle.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drape/overlay_handle.cpp b/drape/overlay_handle.cpp index f0be332c7c..d14a8e6125 100644 --- a/drape/overlay_handle.cpp +++ b/drape/overlay_handle.cpp @@ -44,13 +44,16 @@ void OverlayHandle::SetIsVisible(bool isVisible) m_isVisible = isVisible; } -bool OverlayHandle::IsIntersect(ScreenBase const & screen, OverlayHandle & h) +bool OverlayHandle::IsIntersect(ScreenBase const & screen, const OverlayHandle & h) const { - vector<m2::RectF> const & ar1 = GetPixelShape(screen); - vector<m2::RectF> const & ar2 = h.GetPixelShape(screen); + Rects ar1; + Rects ar2; - for (int i = 0; i < ar1.size(); ++i) - for (int j = 0; j < ar2.size(); ++j) + GetPixelShape(screen, ar1); + h.GetPixelShape(screen, ar2); + + for (size_t i = 0; i < ar1.size(); ++i) + for (size_t j = 0; j < ar2.size(); ++j) if (ar1[i].IsIntersect(ar2[j])) return true; @@ -116,7 +119,6 @@ SquareHandle::SquareHandle(FeatureID const & id, dp::Anchor anchor, : base_t(id, anchor, priority) , m_gbPivot(gbPivot) , m_pxHalfSize(pxSize.x / 2.0, pxSize.y / 2.0) - , m_bbox(1) { } @@ -140,11 +142,10 @@ m2::RectD SquareHandle::GetPixelRect(ScreenBase const & screen) const return result; } -vector<m2::RectF> & SquareHandle::GetPixelShape(ScreenBase const & screen) +void SquareHandle::GetPixelShape(ScreenBase const & screen, Rects & rects) const { m2::RectD rd = GetPixelRect(screen); - m_bbox[0] = m2::RectF(rd.minX(), rd.minY(), rd.maxX(), rd.maxY()); - return m_bbox; + rects.push_back(m2::RectF(rd.minX(), rd.minY(), rd.maxX(), rd.maxY())); } } // namespace dp |