added hitTest and roughHitTest to OverlayElement.

This commit is contained in:
rachytski 2012-05-25 23:44:51 +04:00 committed by Alex Zolotarev
parent 6e40c5c9d6
commit 18fbed10e6
2 changed files with 18 additions and 0 deletions

View file

@ -139,4 +139,20 @@ namespace yg
}
return m_roughBoundRect;
}
bool OverlayElement::hitTest(m2::PointD const & pt) const
{
vector<m2::AnyRectD> const & rects = boundRects();
for (vector<m2::AnyRectD>::const_iterator it = rects.begin(); it != rects.end(); ++it)
if (it->IsPointInside(pt))
return true;
return false;
}
bool OverlayElement::roughHitTest(m2::PointD const & pt) const
{
return roughBoundRect().IsPointInside(pt);
}
}

View file

@ -78,6 +78,8 @@ namespace yg
void setIsVisible(bool flag);
m2::RectD const & roughBoundRect() const;
bool hitTest(m2::PointD const & pt) const;
bool roughHitTest(m2::PointD const & pt) const;
virtual void offset(m2::PointD const & offs);
};