diff options
author | Maxim Pimenov <m@maps.me> | 2018-04-28 19:32:00 +0300 |
---|---|---|
committer | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2018-05-08 15:21:30 +0300 |
commit | e400ad6c46526cac178ed7522523881fae436361 (patch) | |
tree | df0533f5e7ea2fe4829969a745cecaf3e9e78193 /qt | |
parent | 6313aed770cd2e530891bb7fdf894091b19150d0 (diff) |
[geometry] Made the constructor of Point<T> from Point<U> explicit.
Sometimes we want a non-trivial transformation when converting
from one representation of a point to another. An example
is PointDToPointU which uses the fact that its argument is
usually a point from the Mercator plane. The wrong usage
is easier to catch when implicit conversion between different point
types is prohibited.
An example of wrong usage that is prevented by this commit:
// A function defined in another file.
m2::PointU GetPoint()
{
m2::PointD pt;
[...]
return PointDToPointU(p2, kDefaultBits);
}
// Here we have forgotten that the result of GetPoint() is already converted.
m2::PointU ptu = PointDToPointU(GetPoint(), kDefaultBits);
Diffstat (limited to 'qt')
-rw-r--r-- | qt/qt_common/map_widget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/qt/qt_common/map_widget.cpp b/qt/qt_common/map_widget.cpp index 0ddc9d60c6..5004280d82 100644 --- a/qt/qt_common/map_widget.cpp +++ b/qt/qt_common/map_widget.cpp @@ -169,7 +169,7 @@ df::TouchEvent MapWidget::GetTouchEvent(QMouseEvent * e, df::TouchEvent::ETouchT df::Touch MapWidget::GetSymmetrical(df::Touch const & touch) const { m2::PointD const pixelCenter = m_framework.GetPixelCenter(); - m2::PointD const symmetricalLocation = pixelCenter + (pixelCenter - touch.m_location); + m2::PointD const symmetricalLocation = pixelCenter + pixelCenter - m2::PointD(touch.m_location); df::Touch result; result.m_id = touch.m_id + 1; |