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:
authorvng <viktor.govako@gmail.com>2011-02-13 15:01:31 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:12:18 +0300
commitfbb107dbaf9b0a708b9513357d0c3d9cf13e190a (patch)
tree41b2f03f2efc0c62d9d211431ba7b1f713ad2910 /indexer/geometry_coding.cpp
parent2621e04c6ee7f4f17d43b929b3c66f4e7ef00a36 (diff)
Replace vector to buffer_vector where possible in feature's geometry Encoding\Decoding.
Diffstat (limited to 'indexer/geometry_coding.cpp')
-rw-r--r--indexer/geometry_coding.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/indexer/geometry_coding.cpp b/indexer/geometry_coding.cpp
index 361e17b20f..987315fc1b 100644
--- a/indexer/geometry_coding.cpp
+++ b/indexer/geometry_coding.cpp
@@ -69,23 +69,29 @@ namespace geo_coding
bool TestDecoding(InPointsT const & points,
m2::PointU const & basePoint,
m2::PointU const & maxPoint,
- DeltasT const & deltas,
- void (* fnDecode)(DeltasT const & deltas,
+ OutDeltasT const & deltas,
+ void (* fnDecode)(InDeltasT const & deltas,
m2::PointU const & basePoint,
m2::PointU const & maxPoint,
OutPointsT & points))
{
+ size_t const count = points.size();
+
vector<m2::PointU> decoded;
- decoded.reserve(points.size());
- fnDecode(deltas, basePoint, maxPoint, decoded);
- ASSERT_EQUAL(points, decoded, (basePoint, maxPoint));
+ decoded.resize(count);
+
+ OutPointsT decodedA(decoded);
+ fnDecode(make_read_adapter(deltas), basePoint, maxPoint, decodedA);
+
+ for (size_t i = 0; i < count; ++i)
+ ASSERT_EQUAL(points[i], decoded[i], ());
return true;
}
void EncodePolylinePrev1(InPointsT const & points,
m2::PointU const & basePoint,
- m2::PointU const & /*maxPoint*/,
- DeltasT & deltas)
+ m2::PointU const & maxPoint,
+ OutDeltasT & deltas)
{
size_t const count = points.size();
if (count > 0)
@@ -95,10 +101,10 @@ void EncodePolylinePrev1(InPointsT const & points,
deltas.push_back(EncodeDelta(points[i], points[i-1]));
}
- ASSERT(TestDecoding(points, basePoint, m2::PointU(), deltas, &DecodePolylinePrev1), ());
+ ASSERT(TestDecoding(points, basePoint, maxPoint, deltas, &DecodePolylinePrev1), ());
}
-void DecodePolylinePrev1(DeltasT const & deltas,
+void DecodePolylinePrev1(InDeltasT const & deltas,
m2::PointU const & basePoint,
m2::PointU const & /*maxPoint*/,
OutPointsT & points)
@@ -115,7 +121,7 @@ void DecodePolylinePrev1(DeltasT const & deltas,
void EncodePolylinePrev2(InPointsT const & points,
m2::PointU const & basePoint,
m2::PointU const & maxPoint,
- DeltasT & deltas)
+ OutDeltasT & deltas)
{
size_t const count = points.size();
if (count > 0)
@@ -133,7 +139,7 @@ void EncodePolylinePrev2(InPointsT const & points,
ASSERT(TestDecoding(points, basePoint, maxPoint, deltas, &DecodePolylinePrev2), ());
}
-void DecodePolylinePrev2(DeltasT const & deltas,
+void DecodePolylinePrev2(InDeltasT const & deltas,
m2::PointU const & basePoint,
m2::PointU const & maxPoint,
OutPointsT & points)
@@ -158,7 +164,7 @@ void DecodePolylinePrev2(DeltasT const & deltas,
void EncodePolylinePrev3(InPointsT const & points,
m2::PointU const & basePoint,
m2::PointU const & maxPoint,
- DeltasT & deltas)
+ OutDeltasT & deltas)
{
ASSERT_LESS_OR_EQUAL(basePoint.x, maxPoint.x, (basePoint, maxPoint));
ASSERT_LESS_OR_EQUAL(basePoint.y, maxPoint.y, (basePoint, maxPoint));
@@ -187,7 +193,7 @@ void EncodePolylinePrev3(InPointsT const & points,
ASSERT(TestDecoding(points, basePoint, maxPoint, deltas, &DecodePolylinePrev3), ());
}
-void DecodePolylinePrev3(DeltasT const & deltas,
+void DecodePolylinePrev3(InDeltasT const & deltas,
m2::PointU const & basePoint,
m2::PointU const & maxPoint,
OutPointsT & points)
@@ -222,7 +228,7 @@ void DecodePolylinePrev3(DeltasT const & deltas,
void EncodeTriangleStrip(InPointsT const & points,
m2::PointU const & basePoint,
m2::PointU const & maxPoint,
- DeltasT & deltas)
+ OutDeltasT & deltas)
{
size_t const count = points.size();
if (count > 0)
@@ -242,7 +248,7 @@ void EncodeTriangleStrip(InPointsT const & points,
}
}
-void DecodeTriangleStrip(DeltasT const & deltas,
+void DecodeTriangleStrip(InDeltasT const & deltas,
m2::PointU const & basePoint,
m2::PointU const & maxPoint,
OutPointsT & points)