Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drape/overlay_handle.cpp19
-rw-r--r--drape/overlay_handle.hpp9
-rw-r--r--drape_frontend/path_symbol_shape.cpp8
-rw-r--r--drape_frontend/path_text_shape.cpp6
-rw-r--r--drape_head/testing_engine.cpp6
5 files changed, 23 insertions, 25 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
diff --git a/drape/overlay_handle.hpp b/drape/overlay_handle.hpp
index 841c77f0ba..164ec5a53d 100644
--- a/drape/overlay_handle.hpp
+++ b/drape/overlay_handle.hpp
@@ -19,6 +19,8 @@ namespace dp
class OverlayHandle
{
public:
+ typedef vector<m2::RectF> Rects;
+
OverlayHandle(FeatureID const & id,
dp::Anchor anchor,
double priority);
@@ -33,9 +35,9 @@ public:
virtual void Update(ScreenBase const & /*screen*/) {}
virtual m2::RectD GetPixelRect(ScreenBase const & screen) const = 0;
- virtual vector<m2::RectF> & GetPixelShape(ScreenBase const & screen) = 0;
+ virtual void GetPixelShape(ScreenBase const & screen, Rects & rects) const = 0;
- bool IsIntersect(ScreenBase const & screen, OverlayHandle & h);
+ bool IsIntersect(ScreenBase const & screen, OverlayHandle const & h) const;
uint16_t * IndexStorage(uint16_t size);
size_t GetIndexCount() const;
@@ -88,12 +90,11 @@ public:
double priority);
virtual m2::RectD GetPixelRect(ScreenBase const & screen) const;
- virtual vector<m2::RectF> & GetPixelShape(ScreenBase const & screen);
+ virtual void GetPixelShape(ScreenBase const & screen, Rects & rects) const;
private:
m2::PointD m_gbPivot;
m2::PointD m_pxHalfSize;
- vector<m2::RectF> m_bbox;
};
} // namespace dp
diff --git a/drape_frontend/path_symbol_shape.cpp b/drape_frontend/path_symbol_shape.cpp
index bd4313ed7e..6c9598f601 100644
--- a/drape_frontend/path_symbol_shape.cpp
+++ b/drape_frontend/path_symbol_shape.cpp
@@ -26,8 +26,7 @@ public:
: OverlayHandle(FeatureID(), dp::Center, 0.0f),
m_params(params), m_spline(spl), m_scaleFactor(1.0f),
m_positions(maxCount * VertexPerQuad), m_maxCount(maxCount),
- m_symbolHalfWidth(hw), m_symbolHalfHeight(hh),
- m_bbox(1, m2::RectF(0, 0, 0, 0))
+ m_symbolHalfWidth(hw), m_symbolHalfHeight(hh)
{
SetIsVisible(true);
}
@@ -59,9 +58,9 @@ public:
}
}
- vector<m2::RectF> & GetPixelShape(ScreenBase const & screen)
+ void GetPixelShape(ScreenBase const & screen, Rects & rects) const
{
- return m_bbox;
+ rects.push_back(m2::RectF(0, 0, 0, 0));
}
virtual m2::RectD GetPixelRect(ScreenBase const & screen) const
@@ -86,7 +85,6 @@ private:
int const m_maxCount;
float m_symbolHalfWidth;
float m_symbolHalfHeight;
- vector<m2::RectF> m_bbox;
};
PathSymbolShape::PathSymbolShape(m2::SharedSpline const & spline,
diff --git a/drape_frontend/path_text_shape.cpp b/drape_frontend/path_text_shape.cpp
index f4e7dc6a30..f9832f0df3 100644
--- a/drape_frontend/path_text_shape.cpp
+++ b/drape_frontend/path_text_shape.cpp
@@ -87,9 +87,9 @@ namespace
}
- vector<m2::RectF> & GetPixelShape(ScreenBase const & screen)
+ void GetPixelShape(ScreenBase const & screen, Rects & rects) const
{
- return m_bboxes;
+ rects = m_bboxes;
}
void GetAttributeMutation(dp::RefPointer<dp::AttributeBufferMutator> mutator, ScreenBase const & screen) const
@@ -125,7 +125,7 @@ namespace
m2::SharedSpline m_spline;
m2::Spline::iterator m_begin;
m2::Spline::iterator m_end;
- mutable vector<m2::RectF> m_bboxes;
+ mutable Rects m_bboxes;
df::SharedTextLayout m_layout;
float m_scalePtoG;
diff --git a/drape_head/testing_engine.cpp b/drape_head/testing_engine.cpp
index 54786c66db..f004ed43ba 100644
--- a/drape_head/testing_engine.cpp
+++ b/drape_head/testing_engine.cpp
@@ -131,11 +131,10 @@ public:
}
virtual m2::RectD GetPixelRect(ScreenBase const & screen) const { return m2::RectD(); }
- vector<m2::RectF> & GetPixelShape(ScreenBase const & screen)
+ void 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()));
}
virtual void GetAttributeMutation(dp::RefPointer<dp::AttributeBufferMutator> mutator, ScreenBase const & screen) const
@@ -158,7 +157,6 @@ public:
private:
vector<m2::PointF> m_vectors;
- vector<m2::RectF> m_bbox;
};
class SquareShape : public MapShape