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:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2017-10-04 18:14:16 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2017-10-17 15:16:05 +0300
commitc34018bfb2e1d86594a391ee1229d4a97316028f (patch)
tree5d20b90cedac74a3cd8384a34d612522ef35cb4b /geometry
parent2d7cffde9f708378e5c755c125ed0ceeff8c3a1e (diff)
Refactored route rendering
Diffstat (limited to 'geometry')
-rw-r--r--geometry/polyline2d.hpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/geometry/polyline2d.hpp b/geometry/polyline2d.hpp
index 4472b218c8..11b3442b0b 100644
--- a/geometry/polyline2d.hpp
+++ b/geometry/polyline2d.hpp
@@ -128,7 +128,23 @@ public:
return vector<Point<T>>();
return reversed ? vector<Point<T>>{m_points[segmentIndex + 1], m_points[segmentIndex]} :
- vector<Point<T>>{m_points[segmentIndex], m_points[segmentIndex + 1]};
+ vector<Point<T>>{m_points[segmentIndex], m_points[segmentIndex + 1]};
+ }
+
+ vector<Point<T>> ExtractSegment(size_t startPointIndex, size_t endPointIndex) const
+ {
+ if (startPointIndex > endPointIndex ||
+ startPointIndex + 1 > m_points.size() ||
+ endPointIndex + 1 > m_points.size())
+ {
+ return vector<Point<T>>();
+ }
+
+ vector<Point<T>> result;
+ result.reserve(endPointIndex - startPointIndex + 1);
+ for (size_t i = startPointIndex; i <= endPointIndex; ++i)
+ result.push_back(m_points[i]);
+ return result;
}
vector<Point<T> > const & GetPoints() const { return m_points; }