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:
authorMaxim Pimenov <m@maps.me>2018-04-09 20:40:11 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2018-04-11 14:27:47 +0300
commit0dc0baa25593b462517e0a8e603154dcd917cdc5 (patch)
tree93452601558bbb6260e55962ba5360ebda8699ee /indexer
parentb333719087bbe70c2e3d6ec03151b131670e2d26 (diff)
[coding] [geometry] Refactored geometry serialization.
This commit moves all the code related to geometry serialization from indexer/ and coding/ to a single place, namely coding/geometry_coding.{c,h}pp.
Diffstat (limited to 'indexer')
-rw-r--r--indexer/CMakeLists.txt7
-rw-r--r--indexer/centers_table.cpp16
-rw-r--r--indexer/centers_table.hpp8
-rw-r--r--indexer/cities_boundaries_serdes.hpp23
-rw-r--r--indexer/coding_params.cpp31
-rw-r--r--indexer/coding_params.hpp51
-rw-r--r--indexer/data_header.cpp6
-rw-r--r--indexer/data_header.hpp13
-rw-r--r--indexer/feature_loader.cpp16
-rw-r--r--indexer/feature_loader_base.hpp20
-rw-r--r--indexer/geometry_coding.cpp276
-rw-r--r--indexer/geometry_coding.hpp110
-rw-r--r--indexer/geometry_serialization.cpp273
-rw-r--r--indexer/geometry_serialization.hpp227
-rw-r--r--indexer/indexer_tests/CMakeLists.txt5
-rw-r--r--indexer/indexer_tests/centers_table_test.cpp8
-rw-r--r--indexer/indexer_tests/cities_boundaries_serdes_tests.cpp2
-rw-r--r--indexer/indexer_tests/geometry_coding_test.cpp186
-rw-r--r--indexer/indexer_tests/geometry_serialization_test.cpp69
-rw-r--r--indexer/indexer_tests/polyline_point_to_int64_test.cpp49
-rw-r--r--indexer/indexer_tests/test_polylines.cpp6
-rw-r--r--indexer/indexer_tests/test_polylines.hpp9
-rw-r--r--indexer/locality_object.cpp4
-rw-r--r--indexer/tesselator_decl.hpp26
24 files changed, 56 insertions, 1385 deletions
diff --git a/indexer/CMakeLists.txt b/indexer/CMakeLists.txt
index 109de339bb..099910e5f9 100644
--- a/indexer/CMakeLists.txt
+++ b/indexer/CMakeLists.txt
@@ -22,8 +22,6 @@ set(
classificator_loader.cpp
classificator_loader.hpp
classificator.hpp
- coding_params.cpp
- coding_params.hpp
cuisines.cpp
cuisines.hpp
data_factory.cpp
@@ -80,10 +78,6 @@ set(
ftypes_matcher.hpp
ftypes_sponsored.cpp
ftypes_sponsored.hpp
- geometry_coding.cpp
- geometry_coding.hpp
- geometry_serialization.cpp
- geometry_serialization.hpp
index_builder.cpp
index_builder.hpp
index_helpers.cpp
@@ -129,7 +123,6 @@ set(
string_slice.hpp
succinct_trie_builder.hpp
succinct_trie_reader.hpp
- tesselator_decl.hpp
tree_structure.hpp
trie_builder.hpp
trie_reader.hpp
diff --git a/indexer/centers_table.cpp b/indexer/centers_table.cpp
index 0b863e190d..3ffed0a8b2 100644
--- a/indexer/centers_table.cpp
+++ b/indexer/centers_table.cpp
@@ -1,10 +1,10 @@
#include "indexer/centers_table.hpp"
#include "indexer/feature_processor.hpp"
-#include "indexer/geometry_coding.hpp"
#include "coding/endianness.hpp"
#include "coding/file_container.hpp"
+#include "coding/geometry_coding.hpp"
#include "coding/memory_region.hpp"
#include "coding/pointd_to_pointu.hpp"
#include "coding/reader.hpp"
@@ -133,7 +133,7 @@ public:
static_assert(sizeof(Header) == 16, "Wrong header size.");
- CentersTableV0(Reader & reader, serial::CodingParams const & codingParams)
+ CentersTableV0(Reader & reader, serial::GeometryCodingParams const & codingParams)
: m_reader(reader), m_codingParams(codingParams)
{
}
@@ -165,12 +165,12 @@ public:
NonOwningReaderSource msource(mreader);
uint64_t delta = ReadVarUint<uint64_t>(msource);
- entry[0] = DecodeDelta(delta, m_codingParams.GetBasePoint());
+ entry[0] = coding::DecodeDelta(delta, m_codingParams.GetBasePoint());
for (size_t i = 1; i < kBlockSize && msource.Size() > 0; ++i)
{
delta = ReadVarUint<uint64_t>(msource);
- entry[i] = DecodeDelta(delta, entry[i - 1]);
+ entry[i] = coding::DecodeDelta(delta, entry[i - 1]);
}
}
@@ -213,7 +213,7 @@ private:
private:
Header m_header;
Reader & m_reader;
- serial::CodingParams const m_codingParams;
+ serial::GeometryCodingParams const m_codingParams;
unique_ptr<CopiedMemoryRegion> m_idsRegion;
unique_ptr<CopiedMemoryRegion> m_offsetsRegion;
@@ -248,7 +248,7 @@ bool CentersTable::Header::IsValid() const
// CentersTable ------------------------------------------------------------------------------------
unique_ptr<CentersTable> CentersTable::Load(Reader & reader,
- serial::CodingParams const & codingParams)
+ serial::GeometryCodingParams const & codingParams)
{
uint16_t const version = ReadPrimitiveFromPos<uint16_t>(reader, 0 /* pos */);
if (version != 0)
@@ -300,11 +300,11 @@ void CentersTableBuilder::Freeze(Writer & writer) const
{
offsets.push_back(static_cast<uint32_t>(deltas.size()));
- uint64_t delta = EncodeDelta(m_centers[i], m_codingParams.GetBasePoint());
+ uint64_t delta = coding::EncodeDelta(m_centers[i], m_codingParams.GetBasePoint());
WriteVarUint(writer, delta);
for (size_t j = i + 1; j < i + CentersTableV0::kBlockSize && j < m_centers.size(); ++j)
{
- delta = EncodeDelta(m_centers[j], m_centers[j - 1]);
+ delta = coding::EncodeDelta(m_centers[j], m_centers[j - 1]);
WriteVarUint(writer, delta);
}
}
diff --git a/indexer/centers_table.hpp b/indexer/centers_table.hpp
index ee223368b3..68e151c614 100644
--- a/indexer/centers_table.hpp
+++ b/indexer/centers_table.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "indexer/coding_params.hpp"
+#include "coding/geometry_coding.hpp"
#include "geometry/point2d.hpp"
@@ -53,7 +53,7 @@ public:
// Loads CentersTable instance. Note that |reader| must be alive
// until the destruction of loaded table. Returns nullptr if
// CentersTable can't be loaded.
- static unique_ptr<CentersTable> Load(Reader & reader, serial::CodingParams const & codingParams);
+ static unique_ptr<CentersTable> Load(Reader & reader, serial::GeometryCodingParams const & codingParams);
private:
virtual bool Init() = 0;
@@ -62,7 +62,7 @@ private:
class CentersTableBuilder
{
public:
- inline void SetCodingParams(serial::CodingParams const & codingParams)
+ inline void SetGeometryCodingParams(serial::GeometryCodingParams const & codingParams)
{
m_codingParams = codingParams;
}
@@ -71,7 +71,7 @@ public:
void Freeze(Writer & writer) const;
private:
- serial::CodingParams m_codingParams;
+ serial::GeometryCodingParams m_codingParams;
vector<m2::PointU> m_centers;
vector<uint32_t> m_ids;
diff --git a/indexer/cities_boundaries_serdes.hpp b/indexer/cities_boundaries_serdes.hpp
index e42eb6e36a..9e3456d49f 100644
--- a/indexer/cities_boundaries_serdes.hpp
+++ b/indexer/cities_boundaries_serdes.hpp
@@ -1,11 +1,10 @@
#pragma once
#include "indexer/city_boundary.hpp"
-#include "indexer/coding_params.hpp"
-#include "indexer/geometry_coding.hpp"
#include "coding/bit_streams.hpp"
#include "coding/elias_coder.hpp"
+#include "coding/geometry_coding.hpp"
#include "coding/pointd_to_pointu.hpp"
#include "coding/reader.hpp"
#include "coding/varint.hpp"
@@ -40,7 +39,7 @@ public:
struct Visitor
{
public:
- Visitor(Sink & sink, serial::CodingParams const & params)
+ Visitor(Sink & sink, serial::GeometryCodingParams const & params)
: m_sink(sink), m_params(params), m_last(params.GetBasePoint())
{
}
@@ -49,7 +48,7 @@ public:
void operator()(m2::PointU const & p)
{
- WriteVarUint(m_sink, ::EncodeDelta(p, m_last));
+ WriteVarUint(m_sink, coding::EncodeDelta(p, m_last));
m_last = p;
}
@@ -156,11 +155,11 @@ public:
}
Sink & m_sink;
- serial::CodingParams m_params;
+ serial::GeometryCodingParams m_params;
m2::PointU m_last;
};
- CitiesBoundariesEncoder(Sink & sink, serial::CodingParams const & params)
+ CitiesBoundariesEncoder(Sink & sink, serial::GeometryCodingParams const & params)
: m_sink(sink), m_visitor(sink, params)
{
}
@@ -200,7 +199,7 @@ public:
struct Visitor
{
public:
- Visitor(Source & source, serial::CodingParams const & params)
+ Visitor(Source & source, serial::GeometryCodingParams const & params)
: m_source(source), m_params(params), m_last(params.GetBasePoint())
{
}
@@ -214,7 +213,7 @@ public:
void operator()(m2::PointU & p)
{
- p = ::DecodeDelta(ReadVarUint<uint64_t>(m_source), m_last);
+ p = coding::DecodeDelta(ReadVarUint<uint64_t>(m_source), m_last);
m_last = p;
}
@@ -293,11 +292,11 @@ public:
}
Source & m_source;
- serial::CodingParams const m_params;
+ serial::GeometryCodingParams const m_params;
m2::PointU m_last;
};
- CitiesBoundariesDecoderV0(Source & source, serial::CodingParams const & params)
+ CitiesBoundariesDecoderV0(Source & source, serial::GeometryCodingParams const & params)
: m_source(source), m_visitor(source, params)
{
}
@@ -399,7 +398,7 @@ struct CitiesBoundariesSerDes
HeaderV0 const header;
visitor(header);
- serial::CodingParams const params(header.m_coordBits,
+ serial::GeometryCodingParams const params(header.m_coordBits,
m2::PointD(MercatorBounds::minX, MercatorBounds::minY));
CitiesBoundariesEncoder<Sink> encoder(sink, params);
encoder(boundaries);
@@ -423,7 +422,7 @@ struct CitiesBoundariesSerDes
auto const wy = MercatorBounds::maxY - MercatorBounds::minY;
precision = std::max(wx, wy) / pow(2, header.m_coordBits);
- serial::CodingParams const params(header.m_coordBits,
+ serial::GeometryCodingParams const params(header.m_coordBits,
m2::PointD(MercatorBounds::minX, MercatorBounds::minY));
CitiesBoundariesDecoderV0<Source> decoder(source, params);
decoder(boundaries);
diff --git a/indexer/coding_params.cpp b/indexer/coding_params.cpp
deleted file mode 100644
index f9d37783e1..0000000000
--- a/indexer/coding_params.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "indexer/coding_params.hpp"
-
-#include "coding/point_to_integer.hpp"
-#include "coding/pointd_to_pointu.hpp"
-
-namespace serial
-{
- CodingParams::CodingParams()
- : m_BasePointUint64(0), m_CoordBits(POINT_COORD_BITS)
- {
- m_BasePoint = Uint64ToPointUObsolete(m_BasePointUint64);
- }
-
- CodingParams::CodingParams(uint8_t coordBits, m2::PointD const & pt)
- : m_CoordBits(coordBits)
- {
- SetBasePoint(pt);
- }
-
- CodingParams::CodingParams(uint8_t coordBits, uint64_t basePointUint64)
- : m_BasePointUint64(basePointUint64), m_CoordBits(coordBits)
- {
- m_BasePoint = Uint64ToPointUObsolete(m_BasePointUint64);
- }
-
- void CodingParams::SetBasePoint(m2::PointD const & pt)
- {
- m_BasePoint = PointDToPointU(pt, m_CoordBits);
- m_BasePointUint64 = PointUToUint64Obsolete(m_BasePoint);
- }
-} // namespace serial
diff --git a/indexer/coding_params.hpp b/indexer/coding_params.hpp
deleted file mode 100644
index b836b6a09c..0000000000
--- a/indexer/coding_params.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#pragma once
-
-#include "geometry/point2d.hpp"
-
-#include "coding/varint.hpp"
-
-namespace serial
-{
- class CodingParams
- {
- public:
- /// @todo: Factor out?
- //@{
- CodingParams();
- CodingParams(uint8_t coordBits, m2::PointD const & pt);
- CodingParams(uint8_t coordBits, uint64_t basePointUint64);
- //@}
-
- /// @todo: Factor out.
- //@{
- inline m2::PointU GetBasePoint() const { return m_BasePoint; }
- inline uint64_t GetBasePointUint64() const { return m_BasePointUint64; }
- inline int64_t GetBasePointInt64() const
- {
- return static_cast<int64_t>(m_BasePointUint64);
- }
-
- void SetBasePoint(m2::PointD const & pt);
- //@}
-
- inline uint32_t GetCoordBits() const { return m_CoordBits; }
-
- template <typename WriterT> void Save(WriterT & writer) const
- {
- WriteVarUint(writer, GetCoordBits());
- WriteVarUint(writer, m_BasePointUint64);
- }
-
- template <typename SourceT> void Load(SourceT & src)
- {
- uint32_t const coordBits = ReadVarUint<uint32_t>(src);
- ASSERT_LESS(coordBits, 32, ());
- *this = CodingParams(coordBits, ReadVarUint<uint64_t>(src));
- }
-
- private:
- uint64_t m_BasePointUint64;
- m2::PointU m_BasePoint;
- uint8_t m_CoordBits;
- };
-} // namespace serial
diff --git a/indexer/data_header.cpp b/indexer/data_header.cpp
index 400fc001ab..030950ce63 100644
--- a/indexer/data_header.cpp
+++ b/indexer/data_header.cpp
@@ -25,9 +25,9 @@ namespace feature
Load(cont);
}
- serial::CodingParams DataHeader::GetCodingParams(int scaleIndex) const
+ serial::GeometryCodingParams DataHeader::GetGeometryCodingParams(int scaleIndex) const
{
- return serial::CodingParams(m_codingParams.GetCoordBits() -
+ return serial::GeometryCodingParams(m_codingParams.GetCoordBits() -
(m_scales.back() - m_scales[scaleIndex]) / 2,
m_codingParams.GetBasePointUint64());
}
@@ -144,7 +144,7 @@ namespace feature
{
ReaderSource<ModelReaderPtr> src(r);
int64_t const base = ReadPrimitiveFromSource<int64_t>(src);
- m_codingParams = serial::CodingParams(POINT_COORD_BITS, base);
+ m_codingParams = serial::GeometryCodingParams(POINT_COORD_BITS, base);
m_bounds.first = ReadVarInt<int64_t>(src) + base;
m_bounds.second = ReadVarInt<int64_t>(src) + base;
diff --git a/indexer/data_header.hpp b/indexer/data_header.hpp
index 42e751ded7..7bcd036399 100644
--- a/indexer/data_header.hpp
+++ b/indexer/data_header.hpp
@@ -1,16 +1,15 @@
#pragma once
-#include "indexer/coding_params.hpp"
-
#include "platform/mwm_version.hpp"
+#include "coding/geometry_coding.hpp"
+
#include "geometry/rect2d.hpp"
#include "base/buffer_vector.hpp"
#include "std/utility.hpp"
-
class FilesContainerR;
class FileWriter;
class ModelReaderPtr;
@@ -24,7 +23,7 @@ namespace feature
static const size_t MAX_SCALES_COUNT = 4;
private:
- serial::CodingParams m_codingParams;
+ serial::GeometryCodingParams m_codingParams;
pair<int64_t, int64_t> m_bounds;
@@ -36,15 +35,15 @@ namespace feature
explicit DataHeader(string const & fileName);
explicit DataHeader(FilesContainerR const & cont);
- inline void SetCodingParams(serial::CodingParams const & cp)
+ inline void SetGeometryCodingParams(serial::GeometryCodingParams const & cp)
{
m_codingParams = cp;
}
- inline serial::CodingParams const & GetDefCodingParams() const
+ inline serial::GeometryCodingParams const & GetDefGeometryCodingParams() const
{
return m_codingParams;
}
- serial::CodingParams GetCodingParams(int scaleIndex) const;
+ serial::GeometryCodingParams GetGeometryCodingParams(int scaleIndex) const;
m2::RectD const GetBounds() const;
void SetBounds(m2::RectD const & r);
diff --git a/indexer/feature_loader.cpp b/indexer/feature_loader.cpp
index c5ea2f5149..14beac5e6f 100644
--- a/indexer/feature_loader.cpp
+++ b/indexer/feature_loader.cpp
@@ -1,7 +1,7 @@
+#include "indexer/feature_loader.hpp"
+
#include "indexer/classificator.hpp"
#include "indexer/feature.hpp"
-#include "indexer/feature_loader.hpp"
-#include "indexer/geometry_serialization.hpp"
#include "indexer/scales.hpp"
#include "coding/byte_stream.hpp"
@@ -17,7 +17,6 @@
namespace feature
{
-
uint8_t LoaderCurrent::GetHeader()
{
return Header();
@@ -45,7 +44,7 @@ void LoaderCurrent::ParseCommon()
if (m_pF->GetFeatureType() == GEOM_POINT)
{
- m_pF->m_center = serial::LoadPoint(source, GetDefCodingParams());
+ m_pF->m_center = serial::LoadPoint(source, GetDefGeometryCodingParams());
m_pF->m_limitRect.Add(m_pF->m_center);
}
@@ -122,7 +121,7 @@ void LoaderCurrent::ParseHeader2()
ArrayByteSource src(bitSource.RoundPtr());
- serial::CodingParams const & cp = GetDefCodingParams();
+ serial::GeometryCodingParams const & cp = GetDefGeometryCodingParams();
if (typeMask == HEADER_GEOM_LINE)
{
@@ -186,7 +185,7 @@ uint32_t LoaderCurrent::ParseGeometry(int scale)
ReaderSource<FilesContainerR::TReader> src(m_Info.GetGeometryReader(ind));
src.Skip(m_ptsOffsets[ind]);
- serial::CodingParams cp = GetCodingParams(ind);
+ serial::GeometryCodingParams cp = GetGeometryCodingParams(ind);
cp.SetBasePoint(m_pF->m_points[0]);
serial::LoadOuterPath(src, cp, m_pF->m_points);
@@ -233,7 +232,7 @@ uint32_t LoaderCurrent::ParseTriangles(int scale)
{
ReaderSource<FilesContainerR::TReader> src(m_Info.GetTrianglesReader(ind));
src.Skip(m_trgOffsets[ind]);
- serial::LoadOuterTriangles(src, GetCodingParams(ind), m_pF->m_triangles);
+ serial::LoadOuterTriangles(src, GetGeometryCodingParams(ind), m_pF->m_triangles);
sz = static_cast<uint32_t>(src.Pos() - m_trgOffsets[ind]);
}
@@ -344,5 +343,4 @@ int LoaderCurrent::GetScaleIndex(int scale, offsets_t const & offsets) const
return -1;
}
}
-
-}
+} // namespace feature
diff --git a/indexer/feature_loader_base.hpp b/indexer/feature_loader_base.hpp
index cb2618c112..3b5d40b25a 100644
--- a/indexer/feature_loader_base.hpp
+++ b/indexer/feature_loader_base.hpp
@@ -1,12 +1,12 @@
#pragma once
-#include "indexer/coding_params.hpp"
+
#include "indexer/data_header.hpp"
#include "coding/file_container.hpp"
+#include "coding/geometry_coding.hpp"
#include "std/noncopyable.hpp"
-
class FeatureType;
class ArrayByteSource;
@@ -40,13 +40,13 @@ namespace feature
inline version::Format GetMWMFormat() const { return m_header.GetFormat(); }
- inline serial::CodingParams const & GetDefCodingParams() const
+ inline serial::GeometryCodingParams const & GetDefGeometryCodingParams() const
{
- return m_header.GetDefCodingParams();
+ return m_header.GetDefGeometryCodingParams();
}
- inline serial::CodingParams GetCodingParams(int scaleIndex) const
+ inline serial::GeometryCodingParams GetGeometryCodingParams(int scaleIndex) const
{
- return m_header.GetCodingParams(scaleIndex);
+ return m_header.GetGeometryCodingParams(scaleIndex);
}
inline int GetScalesCount() const { return static_cast<int>(m_header.GetScalesCount()); }
@@ -87,13 +87,13 @@ namespace feature
uint32_t CalcOffset(ArrayByteSource const & source) const;
- inline serial::CodingParams const & GetDefCodingParams() const
+ inline serial::GeometryCodingParams const & GetDefGeometryCodingParams() const
{
- return m_Info.GetDefCodingParams();
+ return m_Info.GetDefGeometryCodingParams();
}
- inline serial::CodingParams GetCodingParams(int scaleIndex) const
+ inline serial::GeometryCodingParams GetGeometryCodingParams(int scaleIndex) const
{
- return m_Info.GetCodingParams(scaleIndex);
+ return m_Info.GetGeometryCodingParams(scaleIndex);
}
uint8_t Header() const { return static_cast<uint8_t>(*DataPtr()); }
diff --git a/indexer/geometry_coding.cpp b/indexer/geometry_coding.cpp
deleted file mode 100644
index f3d68172c5..0000000000
--- a/indexer/geometry_coding.cpp
+++ /dev/null
@@ -1,276 +0,0 @@
-#include "indexer/geometry_coding.hpp"
-
-#include "base/assert.hpp"
-#include "base/stl_add.hpp"
-
-#include "std/complex.hpp"
-#include "std/vector.hpp"
-
-
-namespace
-{
- inline m2::PointU ClampPoint(m2::PointU const & maxPoint, m2::Point<double> const & point)
- {
- typedef m2::PointU::value_type uvalue_t;
- //return m2::PointU(my::clamp(static_cast<uvalue_t>(point.x), static_cast<uvalue_t>(0), maxPoint.x),
- // my::clamp(static_cast<uvalue_t>(point.y), static_cast<uvalue_t>(0), maxPoint.y));
-
- return m2::PointU(static_cast<uvalue_t>(my::clamp(point.x, 0.0, static_cast<double>(maxPoint.x))),
- static_cast<uvalue_t>(my::clamp(point.y, 0.0, static_cast<double>(maxPoint.y))));
- }
-}
-
-m2::PointU PredictPointInPolyline(m2::PointU const & maxPoint,
- m2::PointU const & p1,
- m2::PointU const & p2)
-{
- // return ClampPoint(maxPoint, m2::PointI64(p1) + m2::PointI64(p1) - m2::PointI64(p2));
- // return ClampPoint(maxPoint, m2::PointI64(p1) + (m2::PointI64(p1) - m2::PointI64(p2)) / 2);
- return ClampPoint(maxPoint, m2::PointD(p1) + (m2::PointD(p1) - m2::PointD(p2)) / 2.0);
-}
-
-m2::PointU PredictPointInPolyline(m2::PointU const & maxPoint,
- m2::PointU const & p1,
- m2::PointU const & p2,
- m2::PointU const & p3)
-{
- CHECK_NOT_EQUAL(p2, p3, ());
-
- complex<double> const c1(p1.x, p1.y);
- complex<double> const c2(p2.x, p2.y);
- complex<double> const c3(p3.x, p3.y);
- complex<double> const d = (c1 - c2) / (c2 - c3);
- complex<double> const c0 = c1 + (c1 - c2) * polar(0.5, 0.5 * arg(d));
-
- /*
- complex<double> const c1(p1.x, p1.y);
- complex<double> const c2(p2.x, p2.y);
- complex<double> const c3(p3.x, p3.y);
- complex<double> const d = (c1 - c2) / (c2 - c3);
- complex<double> const c01 = c1 + (c1 - c2) * polar(0.5, arg(d));
- complex<double> const c02 = c1 + (c1 - c2) * complex<double>(0.5, 0.0);
- complex<double> const c0 = (c01 + c02) * complex<double>(0.5, 0.0);
- */
-
- return ClampPoint(maxPoint, m2::PointD(c0.real(), c0.imag()));
-}
-
-m2::PointU PredictPointInTriangle(m2::PointU const & maxPoint,
- m2::PointU const & p1,
- m2::PointU const & p2,
- m2::PointU const & p3)
-{
- // parallelogram prediction
- return ClampPoint(maxPoint, p1 + p2 - p3);
-}
-
-
-namespace geo_coding
-{
- bool TestDecoding(InPointsT const & points,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- 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.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,
- OutDeltasT & deltas)
-{
- size_t const count = points.size();
- if (count > 0)
- {
- deltas.push_back(EncodeDelta(points[0], basePoint));
- for (size_t i = 1; i < count; ++i)
- deltas.push_back(EncodeDelta(points[i], points[i-1]));
- }
-
- ASSERT(TestDecoding(points, basePoint, maxPoint, deltas, &DecodePolylinePrev1), ());
-}
-
-void DecodePolylinePrev1(InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & /*maxPoint*/,
- OutPointsT & points)
-{
- size_t const count = deltas.size();
- if (count > 0)
- {
- points.push_back(DecodeDelta(deltas[0], basePoint));
- for (size_t i = 1; i < count; ++i)
- points.push_back(DecodeDelta(deltas[i], points.back()));
- }
-}
-
-void EncodePolylinePrev2(InPointsT const & points,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutDeltasT & deltas)
-{
- size_t const count = points.size();
- if (count > 0)
- {
- deltas.push_back(EncodeDelta(points[0], basePoint));
- if (count > 1)
- {
- deltas.push_back(EncodeDelta(points[1], points[0]));
- for (size_t i = 2; i < count; ++i)
- deltas.push_back(EncodeDelta(points[i],
- PredictPointInPolyline(maxPoint, points[i-1], points[i-2])));
- }
- }
-
- ASSERT(TestDecoding(points, basePoint, maxPoint, deltas, &DecodePolylinePrev2), ());
-}
-
-void DecodePolylinePrev2(InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutPointsT & points)
-{
- size_t const count = deltas.size();
- if (count > 0)
- {
- points.push_back(DecodeDelta(deltas[0], basePoint));
- if (count > 1)
- {
- points.push_back(DecodeDelta(deltas[1], points.back()));
- for (size_t i = 2; i < count; ++i)
- {
- size_t const n = points.size();
- points.push_back(DecodeDelta(deltas[i],
- PredictPointInPolyline(maxPoint, points[n-1], points[n-2])));
- }
- }
- }
-}
-
-void EncodePolylinePrev3(InPointsT const & points,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutDeltasT & deltas)
-{
- ASSERT_LESS_OR_EQUAL(basePoint.x, maxPoint.x, (basePoint, maxPoint));
- ASSERT_LESS_OR_EQUAL(basePoint.y, maxPoint.y, (basePoint, maxPoint));
-
- size_t const count = points.size();
- if (count > 0)
- {
- deltas.push_back(EncodeDelta(points[0], basePoint));
- if (count > 1)
- {
- deltas.push_back(EncodeDelta(points[1], points[0]));
- if (count > 2)
- {
- m2::PointU const prediction = PredictPointInPolyline(maxPoint, points[1], points[0]);
- deltas.push_back(EncodeDelta(points[2], prediction));
- for (size_t i = 3; i < count; ++i)
- {
- m2::PointU const prediction =
- PredictPointInPolyline(maxPoint, points[i-1], points[i-2], points[i-3]);
- deltas.push_back(EncodeDelta(points[i], prediction));
- }
- }
- }
- }
-
- ASSERT(TestDecoding(points, basePoint, maxPoint, deltas, &DecodePolylinePrev3), ());
-}
-
-void DecodePolylinePrev3(InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutPointsT & points)
-{
- ASSERT_LESS_OR_EQUAL(basePoint.x, maxPoint.x, (basePoint, maxPoint));
- ASSERT_LESS_OR_EQUAL(basePoint.y, maxPoint.y, (basePoint, maxPoint));
-
- size_t const count = deltas.size();
- if (count> 0)
- {
- points.push_back(DecodeDelta(deltas[0], basePoint));
- if (count > 1)
- {
- m2::PointU const pt0 = points.back();
- points.push_back(DecodeDelta(deltas[1], pt0));
- if (count > 2)
- {
- points.push_back(DecodeDelta(deltas[2],
- PredictPointInPolyline(maxPoint, points.back(), pt0)));
- for (size_t i = 3; i < count; ++i)
- {
- size_t const n = points.size();
- m2::PointU const prediction =
- PredictPointInPolyline(maxPoint, points[n-1], points[n-2], points[n-3]);
- points.push_back(DecodeDelta(deltas[i], prediction));
- }
- }
- }
- }
-}
-
-void EncodeTriangleStrip(InPointsT const & points,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutDeltasT & deltas)
-{
- size_t const count = points.size();
- if (count > 0)
- {
- ASSERT_GREATER(count, 2, ());
-
- deltas.push_back(EncodeDelta(points[0], basePoint));
- deltas.push_back(EncodeDelta(points[1], points[0]));
- deltas.push_back(EncodeDelta(points[2], points[1]));
-
- for (size_t i = 3; i < count; ++i)
- {
- m2::PointU const prediction =
- PredictPointInTriangle(maxPoint, points[i-1], points[i-2], points[i-3]);
- deltas.push_back(EncodeDelta(points[i], prediction));
- }
- }
-}
-
-void DecodeTriangleStrip(InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutPointsT & points)
-{
- size_t const count = deltas.size();
- if (count > 0)
- {
- ASSERT_GREATER(count, 2, ());
-
- points.push_back(DecodeDelta(deltas[0], basePoint));
- points.push_back(DecodeDelta(deltas[1], points.back()));
- points.push_back(DecodeDelta(deltas[2], points.back()));
-
- for (size_t i = 3; i < count; ++i)
- {
- size_t const n = points.size();
- m2::PointU const prediction =
- PredictPointInTriangle(maxPoint, points[n-1], points[n-2], points[n-3]);
- points.push_back(DecodeDelta(deltas[i], prediction));
- }
- }
-}
-
-}
diff --git a/indexer/geometry_coding.hpp b/indexer/geometry_coding.hpp
deleted file mode 100644
index 645938d205..0000000000
--- a/indexer/geometry_coding.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-#pragma once
-
-#include "geometry/point2d.hpp"
-
-#include "coding/varint.hpp"
-
-#include "base/base.hpp"
-#include "base/bits.hpp"
-#include "base/array_adapters.hpp"
-
-//@{
-inline uint64_t EncodeDelta(m2::PointU const & actual, m2::PointU const & prediction)
-{
- return bits::BitwiseMerge(
- bits::ZigZagEncode(static_cast<int32_t>(actual.x) - static_cast<int32_t>(prediction.x)),
- bits::ZigZagEncode(static_cast<int32_t>(actual.y) - static_cast<int32_t>(prediction.y)));
-}
-
-inline m2::PointU DecodeDelta(uint64_t delta, m2::PointU const & prediction)
-{
- uint32_t x, y;
- bits::BitwiseSplit(delta, x, y);
- return m2::PointU(prediction.x + bits::ZigZagDecode(x), prediction.y + bits::ZigZagDecode(y));
-}
-//@}
-
-
-/// Predict next point for polyline with given previous points (p1, p2).
-m2::PointU PredictPointInPolyline(m2::PointU const & maxPoint,
- m2::PointU const & p1,
- m2::PointU const & p2);
-
-/// Predict next point for polyline with given previous points (p1, p2, p3).
-m2::PointU PredictPointInPolyline(m2::PointU const & maxPoint,
- m2::PointU const & p1,
- m2::PointU const & p2,
- m2::PointU const & p3);
-
-/// Predict point for neighbour triangle with given
-/// previous triangle (p1, p2, p3) and common edge (p1, p2).
-m2::PointU PredictPointInTriangle(m2::PointU const & maxPoint,
- m2::PointU const & p1,
- m2::PointU const & p2,
- m2::PointU const & p3);
-
-/// Geometry Coding-Decoding functions.
-namespace geo_coding
-{
- typedef array_read<m2::PointU> InPointsT;
- typedef array_write<m2::PointU> OutPointsT;
-
- typedef array_read<uint64_t> InDeltasT;
- typedef array_write<uint64_t> OutDeltasT;
-
-void EncodePolylinePrev1(InPointsT const & points,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutDeltasT & deltas);
-
-void DecodePolylinePrev1(InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutPointsT & points);
-
-void EncodePolylinePrev2(InPointsT const & points,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutDeltasT & deltas);
-
-void DecodePolylinePrev2(InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutPointsT & points);
-
-void EncodePolylinePrev3(InPointsT const & points,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutDeltasT & deltas);
-
-void DecodePolylinePrev3(InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutPointsT & points);
-
-inline void EncodePolyline(InPointsT const & points,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutDeltasT & deltas)
-{
- EncodePolylinePrev2(points, basePoint, maxPoint, deltas);
-}
-
-inline void DecodePolyline(InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutPointsT & points)
-{
- DecodePolylinePrev2(deltas, basePoint, maxPoint, points);
-}
-
-void EncodeTriangleStrip(InPointsT const & points,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutDeltasT & deltas);
-
-void DecodeTriangleStrip(InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- OutPointsT & points);
-}
diff --git a/indexer/geometry_serialization.cpp b/indexer/geometry_serialization.cpp
deleted file mode 100644
index 7893a4c07f..0000000000
--- a/indexer/geometry_serialization.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-#include "indexer/geometry_serialization.hpp"
-
-#include "indexer/geometry_coding.hpp"
-
-#include "coding/pointd_to_pointu.hpp"
-
-#include "geometry/mercator.hpp"
-
-#include "std/algorithm.hpp"
-#include "std/bind.hpp"
-#include "std/iterator.hpp"
-#include "std/stack.hpp"
-
-
-namespace serial
-{
- namespace pts
- {
- inline m2::PointU D2U(m2::PointD const & p, uint32_t coordBits)
- {
- return PointDToPointU(p, coordBits);
- }
-
- inline m2::PointD U2D(m2::PointU const & p, uint32_t coordBits)
- {
- m2::PointD const pt = PointUToPointD(p, coordBits);
- ASSERT(MercatorBounds::minX <= pt.x && pt.y <= MercatorBounds::maxX,
- (p, pt, coordBits));
- ASSERT(MercatorBounds::minY <= pt.x && pt.y <= MercatorBounds::maxY,
- (p, pt, coordBits));
- return pt;
- }
-
- inline m2::PointU GetMaxPoint(CodingParams const & params)
- {
- return D2U(m2::PointD(MercatorBounds::maxX, MercatorBounds::maxY), params.GetCoordBits());
- }
-
- inline m2::PointU GetBasePoint(CodingParams const & params)
- {
- return params.GetBasePoint();
- }
-
- typedef buffer_vector<m2::PointU, 32> upoints_t;
- }
-
- void Encode(EncodeFunT fn, vector<m2::PointD> const & points,
- CodingParams const & params, DeltasT & deltas)
- {
- size_t const count = points.size();
-
- pts::upoints_t upoints;
- upoints.reserve(count);
-
- transform(points.begin(), points.end(), back_inserter(upoints),
- bind(&pts::D2U, _1, params.GetCoordBits()));
-
- ASSERT ( deltas.empty(), () );
- deltas.resize(count);
-
- geo_coding::OutDeltasT adapt(deltas);
- (*fn)(make_read_adapter(upoints), pts::GetBasePoint(params), pts::GetMaxPoint(params), adapt);
- }
-
- template <class TDecodeFun, class TOutPoints>
- void DecodeImpl(TDecodeFun fn, DeltasT const & deltas, CodingParams const & params,
- TOutPoints & points, size_t reserveF)
- {
- size_t const count = deltas.size() * reserveF;
-
- pts::upoints_t upoints;
- upoints.resize(count);
-
- geo_coding::OutPointsT adapt(upoints);
- (*fn)(make_read_adapter(deltas), pts::GetBasePoint(params), pts::GetMaxPoint(params), adapt);
-
- if (points.size() < 2)
- {
- // Do not call reserve when loading triangles - they are accumulated to one vector.
- points.reserve(count);
- }
-
- transform(upoints.begin(), upoints.begin() + adapt.size(), back_inserter(points),
- bind(&pts::U2D, _1, params.GetCoordBits()));
- }
-
- void Decode(DecodeFunT fn, DeltasT const & deltas, CodingParams const & params,
- OutPointsT & points, size_t reserveF)
- {
- DecodeImpl(fn, deltas, params, points, reserveF);
- }
-
- void Decode(DecodeFunT fn, DeltasT const & deltas, CodingParams const & params,
- vector<m2::PointD> & points, size_t reserveF)
- {
- DecodeImpl(fn, deltas, params, points, reserveF);
- }
-
- void const * LoadInner(DecodeFunT fn, void const * pBeg, size_t count,
- CodingParams const & params, OutPointsT & points)
- {
- DeltasT deltas;
- deltas.reserve(count);
- void const * ret = ReadVarUint64Array(static_cast<char const *>(pBeg), count,
- MakeBackInsertFunctor(deltas));
-
- Decode(fn, deltas, params, points);
- return ret;
- }
-
-
- TrianglesChainSaver::TrianglesChainSaver(CodingParams const & params)
- {
- m_base = pts::GetBasePoint(params);
- m_max = pts::GetMaxPoint(params);
- }
-
- namespace
- {
- struct edge_less_p0
- {
- typedef tesselator::Edge edge_t;
-
- bool operator() (edge_t const & e1, edge_t const & e2) const
- {
- return (e1.m_p[0] == e2.m_p[0]) ? (e1.m_side < e2.m_side) : (e1.m_p[0] < e2.m_p[0]);
- }
- bool operator() (edge_t const & e1, int e2) const
- {
- return e1.m_p[0] < e2;
- }
- bool operator() (int e1, edge_t const & e2) const
- {
- return e1 < e2.m_p[0];
- }
- };
- }
-
- void TrianglesChainSaver::operator() (TPoint arr[3], vector<TEdge> edges)
- {
- m_buffers.push_back(TBuffer());
- MemWriter<TBuffer> writer(m_buffers.back());
-
- WriteVarUint(writer, EncodeDelta(arr[0], m_base));
- WriteVarUint(writer, EncodeDelta(arr[1], arr[0]));
-
- TEdge curr = edges.front();
- curr.m_delta = EncodeDelta(arr[2], arr[1]);
-
- sort(edges.begin(), edges.end(), edge_less_p0());
-
- stack<TEdge> st;
- while (true)
- {
- CHECK_EQUAL ( curr.m_delta >> 62, 0, () );
- uint64_t delta = curr.m_delta << 2;
-
- // find next edges
- int const nextNode = curr.m_p[1];
- auto i = lower_bound(edges.begin(), edges.end(), nextNode, edge_less_p0());
- bool const found = (i != edges.end() && i->m_p[0] == nextNode);
- if (found)
- {
- // fill 2 tree-struct bites
- ASSERT_NOT_EQUAL(i->m_side, -1, ());
-
- uint64_t const one = 1;
-
- // first child
- delta |= (one << i->m_side);
-
- vector<TEdge>::iterator j = i+1;
- if (j != edges.end() && j->m_p[0] == nextNode)
- {
- // second child
- ASSERT_EQUAL(i->m_side, 0, ());
- ASSERT_EQUAL(j->m_side, 1, ());
-
- delta |= (one << j->m_side);
-
- // push to stack for further processing
- st.push(*j);
- }
-
- curr = *i;
- }
-
- // write delta for current element
- WriteVarUint(writer, delta);
-
- if (!found)
- {
- // end of chain - pop current from stack or exit
- if (st.empty())
- break;
- else
- {
- curr = st.top();
- st.pop();
- }
- }
- }
- }
-
- void DecodeTriangles(geo_coding::InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- geo_coding::OutPointsT & points)
- {
- size_t const count = deltas.size();
- ASSERT_GREATER ( count, 2, () );
-
- points.push_back(DecodeDelta(deltas[0], basePoint));
- points.push_back(DecodeDelta(deltas[1], points.back()));
- points.push_back(DecodeDelta(deltas[2] >> 2, points.back()));
-
- stack<size_t> st;
-
- size_t ind = 2;
- uint8_t treeBits = deltas[2] & 3;
-
- for (size_t i = 3; i < count;)
- {
- // points 0, 1 - is a common edge
- // point 2 - is an opposite point for new triangle to calculate prediction
- size_t trg[3];
-
- if (treeBits & 1)
- {
- // common edge is 1->2
- trg[0] = ind;
- trg[1] = ind-1;
- trg[2] = ind-2;
-
- // push to stack for further processing
- if (treeBits & 2)
- st.push(ind);
- }
- else if (treeBits & 2)
- {
- // common edge is 2->0
- trg[0] = ind-2;
- trg[1] = ind;
- trg[2] = ind-1;
- }
- else
- {
- // end of chain - pop current from stack
- ASSERT ( !st.empty(), () );
- ind = st.top();
- st.pop();
- treeBits = 2;
- continue;
- }
-
- // push points
- points.push_back(points[trg[0]]);
- points.push_back(points[trg[1]]);
- points.push_back(DecodeDelta(deltas[i] >> 2,
- PredictPointInTriangle(maxPoint,
- points[trg[0]],
- points[trg[1]],
- points[trg[2]])));
-
- // next step
- treeBits = deltas[i] & 3;
- ind = points.size() - 1;
- ++i;
- }
-
- ASSERT ( treeBits == 0 && st.empty(), () );
- }
-}
diff --git a/indexer/geometry_serialization.hpp b/indexer/geometry_serialization.hpp
deleted file mode 100644
index 218ef209a0..0000000000
--- a/indexer/geometry_serialization.hpp
+++ /dev/null
@@ -1,227 +0,0 @@
-#pragma once
-
-#include "indexer/geometry_coding.hpp"
-#include "indexer/tesselator_decl.hpp"
-#include "indexer/coding_params.hpp"
-
-#include "geometry/point2d.hpp"
-
-#include "coding/pointd_to_pointu.hpp"
-#include "coding/reader.hpp"
-#include "coding/varint.hpp"
-#include "coding/writer.hpp"
-
-#include "base/buffer_vector.hpp"
-#include "base/stl_add.hpp"
-
-#include "std/algorithm.hpp"
-#include "std/bind.hpp"
-#include "std/list.hpp"
-
-
-namespace serial
-{
- template <class TCont, class TSink>
- inline void WriteVarUintArray(TCont const & v, TSink & sink)
- {
- for (size_t i = 0; i != v.size(); ++i)
- WriteVarUint(sink, v[i]);
- }
-
- /// @name Encode and Decode function types.
- //@{
- typedef void (*EncodeFunT)(geo_coding::InPointsT const &,
- m2::PointU const &, m2::PointU const &,
- geo_coding::OutDeltasT &);
- typedef void (*DecodeFunT)(geo_coding::InDeltasT const &,
- m2::PointU const &, m2::PointU const &,
- geo_coding::OutPointsT &);
- //@}
-
- typedef buffer_vector<uint64_t, 32> DeltasT;
- typedef buffer_vector<m2::PointD, 32> OutPointsT;
-
- void Encode(EncodeFunT fn, vector<m2::PointD> const & points, CodingParams const & params,
- DeltasT & deltas);
-
- /// @name Overloads for different out container types.
- //@{
- void Decode(DecodeFunT fn, DeltasT const & deltas, CodingParams const & params,
- OutPointsT & points, size_t reserveF = 1);
- void Decode(DecodeFunT fn, DeltasT const & deltas, CodingParams const & params,
- vector<m2::PointD> & points, size_t reserveF = 1);
- //@}
-
- template <class TSink>
- void SavePoint(TSink & sink, m2::PointD const & pt, CodingParams const & cp)
- {
- WriteVarUint(sink, EncodeDelta(PointDToPointU(pt, cp.GetCoordBits()), cp.GetBasePoint()));
- }
-
- template <class TSource>
- m2::PointD LoadPoint(TSource & src, CodingParams const & cp)
- {
- m2::PointD const pt = PointUToPointD(DecodeDelta(ReadVarUint<uint64_t>(src), cp.GetBasePoint()),
- cp.GetCoordBits());
- return pt;
- }
-
- template <class TSink>
- void SaveInner(EncodeFunT fn, vector<m2::PointD> const & points,
- CodingParams const & params, TSink & sink)
- {
- DeltasT deltas;
- Encode(fn, points, params, deltas);
- WriteVarUintArray(deltas, sink);
- }
-
- template <class TSink>
- void WriteBufferToSink(vector<char> const & buffer, TSink & sink)
- {
- uint32_t const count = static_cast<uint32_t>(buffer.size());
- WriteVarUint(sink, count);
- sink.Write(&buffer[0], count);
- }
-
- template <class TSink>
- void SaveOuter(EncodeFunT fn, vector<m2::PointD> const & points,
- CodingParams const & params, TSink & sink)
- {
- DeltasT deltas;
- Encode(fn, points, params, deltas);
-
- vector<char> buffer;
- MemWriter<vector<char> > writer(buffer);
- WriteVarUintArray(deltas, writer);
-
- WriteBufferToSink(buffer, sink);
- }
-
- void const * LoadInner(DecodeFunT fn, void const * pBeg, size_t count,
- CodingParams const & params, OutPointsT & points);
-
- template <class TSource, class TPoints>
- void LoadOuter(DecodeFunT fn, TSource & src, CodingParams const & params,
- TPoints & points, size_t reserveF = 1)
- {
- uint32_t const count = ReadVarUint<uint32_t>(src);
- vector<char> buffer(count);
- char * p = &buffer[0];
- src.Read(p, count);
-
- DeltasT deltas;
- deltas.reserve(count / 2);
- ReadVarUint64Array(p, p + count, MakeBackInsertFunctor(deltas));
-
- Decode(fn, deltas, params, points, reserveF);
- }
-
-
- /// @name Paths.
- //@{
- template <class TSink>
- void SaveInnerPath(vector<m2::PointD> const & points, CodingParams const & params, TSink & sink)
- {
- SaveInner(&geo_coding::EncodePolyline, points, params, sink);
- }
- template <class TSink>
- void SaveOuterPath(vector<m2::PointD> const & points, CodingParams const & params, TSink & sink)
- {
- SaveOuter(&geo_coding::EncodePolyline, points, params, sink);
- }
-
- inline void const * LoadInnerPath(void const * pBeg, size_t count, CodingParams const & params,
- OutPointsT & points)
- {
- return LoadInner(&geo_coding::DecodePolyline, pBeg, count, params, points);
- }
-
- template <class TSource, class TPoints>
- void LoadOuterPath(TSource & src, CodingParams const & params, TPoints & points)
- {
- LoadOuter(&geo_coding::DecodePolyline, src, params, points);
- }
- //@}
-
- /// @name Triangles.
- //@{
- template <class TSink>
- void SaveInnerTriangles(vector<m2::PointD> const & points,
- CodingParams const & params, TSink & sink)
- {
- SaveInner(&geo_coding::EncodeTriangleStrip, points, params, sink);
- }
-
- inline void const * LoadInnerTriangles(void const * pBeg, size_t count,
- CodingParams const & params, OutPointsT & triangles)
- {
- CHECK_GREATER_OR_EQUAL(count, 2, ());
- triangles.clear();
- OutPointsT points;
- void const * res = LoadInner(&geo_coding::DecodeTriangleStrip, pBeg, count, params, points);
-
- triangles.reserve((count - 2) * 3);
- for (size_t i = 2; i < count; ++i)
- {
- triangles.push_back(points[i - 2]);
- triangles.push_back(points[i - 1]);
- triangles.push_back(points[i]);
- }
- return res;
- }
-
- class TrianglesChainSaver
- {
- using TPoint = m2::PointU;
- using TEdge = tesselator::Edge;
- using TBuffer = vector<char>;
-
- TPoint m_base;
- TPoint m_max;
-
- list<TBuffer> m_buffers;
-
- public:
- explicit TrianglesChainSaver(CodingParams const & params);
-
- TPoint GetBasePoint() const { return m_base; }
- TPoint GetMaxPoint() const { return m_max; }
-
- void operator() (TPoint arr[3], vector<TEdge> edges);
-
- size_t GetBufferSize() const
- {
- size_t sz = 0;
- for (auto const & i : m_buffers)
- sz += i.size();
- return sz;
- }
-
- template <class TSink> void Save(TSink & sink)
- {
- // Not necessary assumption that 3-bytes varuint
- // is enough for triangle chains count.
- size_t const count = m_buffers.size();
- CHECK_LESS_OR_EQUAL(count, 0x1FFFFF, ());
-
- WriteVarUint(sink, static_cast<uint32_t>(count));
-
- for_each(m_buffers.begin(), m_buffers.end(), bind(&WriteBufferToSink<TSink>, _1, ref(sink)));
- }
- };
-
- void DecodeTriangles(geo_coding::InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- geo_coding::OutPointsT & triangles);
-
- template <class TSource>
- void LoadOuterTriangles(TSource & src, CodingParams const & params, OutPointsT & triangles)
- {
- uint32_t const count = ReadVarUint<uint32_t>(src);
-
- for (uint32_t i = 0; i < count; ++i)
- LoadOuter(&DecodeTriangles, src, params, triangles, 3);
- }
- //@}
-}
diff --git a/indexer/indexer_tests/CMakeLists.txt b/indexer/indexer_tests/CMakeLists.txt
index 48e05d6b29..c84224d8bb 100644
--- a/indexer/indexer_tests/CMakeLists.txt
+++ b/indexer/indexer_tests/CMakeLists.txt
@@ -16,8 +16,6 @@ set(
feature_xml_test.cpp
features_offsets_table_test.cpp
features_vector_test.cpp
- geometry_coding_test.cpp
- geometry_serialization_test.cpp
index_builder_test.cpp
index_test.cpp
interval_index_test.cpp
@@ -25,7 +23,6 @@ set(
mwm_set_test.cpp
osm_editor_test.cpp
osm_editor_test.hpp
- polyline_point_to_int64_test.cpp
postcodes_matcher_tests.cpp
rank_table_test.cpp
scale_index_reading_tests.cpp
@@ -35,8 +32,6 @@ set(
string_slice_tests.cpp
succinct_trie_test.cpp
test_mwm_set.hpp
- test_polylines.cpp
- test_polylines.hpp
test_type.cpp
trie_test.cpp
ugc_types_test.cpp
diff --git a/indexer/indexer_tests/centers_table_test.cpp b/indexer/indexer_tests/centers_table_test.cpp
index 6874d26fa6..9a60075994 100644
--- a/indexer/indexer_tests/centers_table_test.cpp
+++ b/indexer/indexer_tests/centers_table_test.cpp
@@ -36,7 +36,7 @@ UNIT_CLASS_TEST(CentersTableTest, Smoke)
string const kMap = my::JoinFoldersToPath(GetPlatform().WritableDir(), "minsk-pass.mwm");
feature::DataHeader header(kMap);
- auto const codingParams = header.GetDefCodingParams();
+ auto const codingParams = header.GetDefGeometryCodingParams();
FeaturesVectorTest fv(kMap);
@@ -45,7 +45,7 @@ UNIT_CLASS_TEST(CentersTableTest, Smoke)
{
CentersTableBuilder builder;
- builder.SetCodingParams(codingParams);
+ builder.SetGeometryCodingParams(codingParams);
fv.GetVector().ForEach(
[&](FeatureType & ft, uint32_t id) { builder.Put(id, feature::GetCenter(ft)); });
@@ -74,13 +74,13 @@ UNIT_CLASS_TEST(CentersTableTest, Subset)
vector<pair<uint32_t, m2::PointD>> const features = {
{1, m2::PointD(0, 0)}, {5, m2::PointD(1, 1)}, {10, m2::PointD(2, 2)}};
- serial::CodingParams codingParams;
+ serial::GeometryCodingParams codingParams;
TBuffer buffer;
{
CentersTableBuilder builder;
- builder.SetCodingParams(codingParams);
+ builder.SetGeometryCodingParams(codingParams);
for (auto const & feature : features)
builder.Put(feature.first, feature.second);
diff --git a/indexer/indexer_tests/cities_boundaries_serdes_tests.cpp b/indexer/indexer_tests/cities_boundaries_serdes_tests.cpp
index 5347573735..743126f49d 100644
--- a/indexer/indexer_tests/cities_boundaries_serdes_tests.cpp
+++ b/indexer/indexer_tests/cities_boundaries_serdes_tests.cpp
@@ -2,8 +2,8 @@
#include "indexer/cities_boundaries_serdes.hpp"
#include "indexer/city_boundary.hpp"
-#include "indexer/coding_params.hpp"
+#include "coding/geometry_coding.hpp"
#include "coding/reader.hpp"
#include "coding/writer.hpp"
diff --git a/indexer/indexer_tests/geometry_coding_test.cpp b/indexer/indexer_tests/geometry_coding_test.cpp
deleted file mode 100644
index f454e67c37..0000000000
--- a/indexer/indexer_tests/geometry_coding_test.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-#include "testing/testing.hpp"
-
-#include "indexer/coding_params.hpp"
-#include "indexer/geometry_coding.hpp"
-#include "indexer/indexer_tests/test_polylines.hpp"
-
-#include "coding/byte_stream.hpp"
-#include "coding/pointd_to_pointu.hpp"
-#include "coding/varint.hpp"
-#include "coding/writer.hpp"
-
-#include "geometry/distance.hpp"
-#include "geometry/geometry_tests/large_polygon.hpp"
-#include "geometry/mercator.hpp"
-#include "geometry/simplification.hpp"
-
-#include "base/logging.hpp"
-
-using PU = m2::PointU;
-
-UNIT_TEST(EncodeDelta)
-{
- for (int x = -100; x <= 100; ++x)
- {
- for (int y = -100; y <= 100; ++y)
- {
- PU orig = PU(100 + x, 100 + y);
- PU pred = PU(100, 100);
- TEST_EQUAL(orig, DecodeDelta(EncodeDelta(orig, pred), pred), ());
- vector<char> data;
- PushBackByteSink<vector<char> > sink(data);
- WriteVarUint(sink, EncodeDelta(orig, pred));
- size_t expectedSize = 1;
- if (x >= 8 || x < -8 || y >= 4 || y < -4) expectedSize = 2;
- if (x >= 64 || x < -64 || y >= 64 || y < -64) expectedSize = 3;
- TEST_EQUAL(data.size(), expectedSize, (x, y));
- }
- }
-}
-
-UNIT_TEST(PredictPointsInPolyline2)
-{
- // Ci = Ci-1 + (Ci-1 + Ci-2) / 2
- TEST_EQUAL(PU(5, 5), PredictPointInPolyline(PU(8, 7), PU(4, 4), PU(1, 2)), ());
-}
-
-UNIT_TEST(PredictPointsInPolyline2_ClampMax)
-{
- // Ci = Ci-1 + (Ci-1 + Ci-2) / 2
- TEST_EQUAL(PU(4, 4), PredictPointInPolyline(PU(4, 4), PU(4, 4), PU(1, 2)), ());
- TEST_EQUAL(PU(5, 5), PredictPointInPolyline(PU(8, 7), PU(4, 4), PU(1, 2)), ());
- TEST_EQUAL(PU(5, 5), PredictPointInPolyline(PU(5, 5), PU(4, 4), PU(1, 2)), ());
-}
-
-UNIT_TEST(PredictPointsInPolyline2_Clamp0)
-{
- TEST_EQUAL(PU(4, 0), PredictPointInPolyline(PU(5, 5), PU(4, 1), PU(4, 4)), ());
-}
-
-/*
-UNIT_TEST(PredictPointsInPolyline3_Square)
-{
- TEST_EQUAL(PU(5, 1), PredictPointInPolyline(PU(6, 6), PU(5, 4), PU(2, 4), PU(2, 1)), ());
- TEST_EQUAL(PU(5, 3), PredictPointInPolyline(PU(6, 6), PU(4, 1), PU(2, 2), PU(3, 4)), ());
-}
-
-UNIT_TEST(PredictPointsInPolyline3_SquareClamp0)
-{
- TEST_EQUAL(PU(5, 1), PredictPointInPolyline(PU(6, 6), PU(5, 4), PU(2, 4), PU(2, 1)), ());
- TEST_EQUAL(PU(4, 0), PredictPointInPolyline(PU(6, 6), PU(2, 0), PU(3, 2), PU(5, 1)), ());
-}
-
-UNIT_TEST(PredictPointsInPolyline3_90deg)
-{
- TEST_EQUAL(PU(3, 2), PredictPointInPolyline(PU(8, 8), PU(3, 6), PU(1, 6), PU(1, 5)), ());
-}
-*/
-
-namespace
-{
-m2::PointU D2U(m2::PointD const & p) { return PointDToPointU(p, POINT_COORD_BITS); }
-
-m2::PointU GetMaxPoint() { return D2U(m2::PointD(MercatorBounds::maxX, MercatorBounds::maxY)); }
-
-void TestPolylineEncode(string testName,
- vector<m2::PointU> const & points,
- m2::PointU const & maxPoint,
- void (* fnEncode)(geo_coding::InPointsT const & points,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- geo_coding::OutDeltasT & deltas),
- void (* fnDecode)(geo_coding::InDeltasT const & deltas,
- m2::PointU const & basePoint,
- m2::PointU const & maxPoint,
- geo_coding::OutPointsT & points))
-{
- size_t const count = points.size();
- if (count == 0) return;
-
- m2::PointU const basePoint = serial::CodingParams().GetBasePoint();
-
- vector<uint64_t> deltas;
- deltas.resize(count);
-
- geo_coding::OutDeltasT deltasA(deltas);
- fnEncode(make_read_adapter(points), basePoint, maxPoint, deltasA);
-
- vector<m2::PointU> decodedPoints;
- decodedPoints.resize(count);
-
- geo_coding::OutPointsT decodedPointsA(decodedPoints);
- fnDecode(make_read_adapter(deltas), basePoint, maxPoint, decodedPointsA);
-
- TEST_EQUAL(points, decodedPoints, ());
-
- if (points.size() > 10)
- {
- vector<char> data;
- MemWriter<vector<char> > writer(data);
-
- for (size_t i = 0; i != deltas.size(); ++i)
- WriteVarUint(writer, deltas[i]);
-
- LOG(LINFO, (testName, points.size(), data.size()));
- }
-}
-
-vector<m2::PointU> SimplifyPoints(vector<m2::PointU> const & points, double eps)
-{
- vector<m2::PointU> simpPoints;
- typedef m2::DistanceToLineSquare<m2::PointD> DistanceF;
- DistanceF dist;
- SimplifyNearOptimal(20, points.begin(), points.end(), eps, dist,
- AccumulateSkipSmallTrg<DistanceF, m2::PointU>(dist, simpPoints, eps));
- return simpPoints;
-}
-
-void TestEncodePolyline(string name, m2::PointU maxPoint, vector<m2::PointU> const & points)
-{
- using namespace geo_coding;
-
- TestPolylineEncode(name + "1", points, maxPoint, &EncodePolylinePrev1, &DecodePolylinePrev1);
- TestPolylineEncode(name + "2", points, maxPoint, &EncodePolylinePrev2, &DecodePolylinePrev2);
- TestPolylineEncode(name + "3", points, maxPoint, &EncodePolylinePrev3, &DecodePolylinePrev3);
-}
-} // namespace
-
-UNIT_TEST(EncodePolyline)
-{
- size_t const kSizes [] = { 0, 1, 2, 3, 4, ARRAY_SIZE(LargePolygon::kLargePolygon) };
- m2::PointU const maxPoint(1000000000, 1000000000);
- for (size_t iSize = 0; iSize < ARRAY_SIZE(kSizes); ++iSize)
- {
- size_t const polygonSize = kSizes[iSize];
- vector<m2::PointU> points;
- points.reserve(polygonSize);
- for (size_t i = 0; i < polygonSize; ++i)
- points.push_back(m2::PointU(static_cast<uint32_t>(LargePolygon::kLargePolygon[i].x * 10000),
- static_cast<uint32_t>((LargePolygon::kLargePolygon[i].y + 200) * 10000)));
-
- TestEncodePolyline("Unsimp", maxPoint, points);
- TestEncodePolyline("1simp", maxPoint, SimplifyPoints(points, 1));
- TestEncodePolyline("2simp", maxPoint, SimplifyPoints(points, 2));
- TestEncodePolyline("4simp", maxPoint, SimplifyPoints(points, 4));
- TestEncodePolyline("10simp", maxPoint, SimplifyPoints(points, 10));
- TestEncodePolyline("100simp", maxPoint, SimplifyPoints(points, 100));
- TestEncodePolyline("500simp", maxPoint, SimplifyPoints(points, 500));
- TestEncodePolyline("1000simp", maxPoint, SimplifyPoints(points, 1000));
- TestEncodePolyline("2000simp", maxPoint, SimplifyPoints(points, 2000));
- TestEncodePolyline("4000simp", maxPoint, SimplifyPoints(points, 4000));
- }
-}
-
-// see 476c1d1d125f0c2deb8c commit for special decode test
-
-UNIT_TEST(DecodeEncodePolyline_DataSet1)
-{
- size_t const count = ARRAY_SIZE(index_test::arr1);
- vector<m2::PointU> points;
- points.reserve(count);
- for (size_t i = 0; i < count; ++i)
- points.push_back(D2U(index_test::arr1[i]));
-
- TestPolylineEncode("DataSet1", points, GetMaxPoint(),
- &geo_coding::EncodePolyline, &geo_coding::DecodePolyline);
-}
diff --git a/indexer/indexer_tests/geometry_serialization_test.cpp b/indexer/indexer_tests/geometry_serialization_test.cpp
deleted file mode 100644
index 87cbb60a96..0000000000
--- a/indexer/indexer_tests/geometry_serialization_test.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "testing/testing.hpp"
-
-#include "indexer/indexer_tests/test_polylines.hpp"
-
-#include "indexer/geometry_serialization.hpp"
-#include "indexer/coding_params.hpp"
-#include "geometry/mercator.hpp"
-
-#include "coding/reader.hpp"
-#include "coding/byte_stream.hpp"
-
-#include "base/logging.hpp"
-
-
-// Copy-Paste from feature_builder.cpp
-namespace
-{
- bool is_equal(double d1, double d2)
- {
- //return my::AlmostEqualULPs(d1, d2, 100000000);
- return (fabs(d1 - d2) < MercatorBounds::GetCellID2PointAbsEpsilon());
- }
-
- bool is_equal(m2::PointD const & p1, m2::PointD const & p2)
- {
- return p1.EqualDxDy(p2, MercatorBounds::GetCellID2PointAbsEpsilon());
- }
-
- bool is_equal(m2::RectD const & r1, m2::RectD const & r2)
- {
- return (is_equal(r1.minX(), r2.minX()) &&
- is_equal(r1.minY(), r2.minY()) &&
- is_equal(r1.maxX(), r2.maxX()) &&
- is_equal(r1.maxY(), r2.maxY()));
- }
-}
-
-
-UNIT_TEST(SaveLoadPolyline_DataSet1)
-{
- using namespace index_test;
-
- vector<m2::PointD> data1(arr1, arr1 + ARRAY_SIZE(arr1));
-
- vector<char> buffer;
- PushBackByteSink<vector<char> > w(buffer);
-
- serial::CodingParams cp;
- serial::SaveOuterPath(data1, cp, w);
-
- vector<m2::PointD> data2;
- ArrayByteSource r(&buffer[0]);
- serial::LoadOuterPath(r, cp, data2);
-
- TEST_EQUAL(data1.size(), data2.size(), ());
-
- m2::RectD r1, r2;
- for (size_t i = 0; i < data1.size(); ++i)
- {
- r1.Add(data1[i]);
- r2.Add(data2[i]);
-
- TEST(is_equal(data1[i], data2[i]), (data1[i], data2[i]));
- }
-
- //LOG(LINFO, (data2));
-
- TEST(is_equal(r1, r2), (r1, r2));
-}
diff --git a/indexer/indexer_tests/polyline_point_to_int64_test.cpp b/indexer/indexer_tests/polyline_point_to_int64_test.cpp
deleted file mode 100644
index e7665786d5..0000000000
--- a/indexer/indexer_tests/polyline_point_to_int64_test.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "testing/testing.hpp"
-
-#include "indexer/indexer_tests/test_polylines.hpp"
-
-#include "indexer/cell_id.hpp"
-
-#include "coding/point_to_integer.hpp"
-#include "coding/pointd_to_pointu.hpp"
-
-#include "base/logging.hpp"
-
-#include "std/cmath.hpp"
-#include "std/utility.hpp"
-
-namespace
-{
-double const g_eps = MercatorBounds::GetCellID2PointAbsEpsilon();
-uint32_t const g_coordBits = POINT_COORD_BITS;
-
-void CheckEqualPoints(m2::PointD const & p1, m2::PointD const & p2)
-{
- TEST(p1.EqualDxDy(p2, g_eps), (p1, p2));
-
- TEST_GREATER_OR_EQUAL(p1.x, -180.0, ());
- TEST_GREATER_OR_EQUAL(p1.y, -180.0, ());
- TEST_LESS_OR_EQUAL(p1.x, 180.0, ());
- TEST_LESS_OR_EQUAL(p1.y, 180.0, ());
-
- TEST_GREATER_OR_EQUAL(p2.x, -180.0, ());
- TEST_GREATER_OR_EQUAL(p2.y, -180.0, ());
- TEST_LESS_OR_EQUAL(p2.x, 180.0, ());
- TEST_LESS_OR_EQUAL(p2.y, 180.0, ());
-}
-}
-
-UNIT_TEST(PointToInt64Obsolete_DataSet1)
-{
- for (size_t i = 0; i < ARRAY_SIZE(index_test::arr1); ++i)
- {
- m2::PointD const pt(index_test::arr1[i].x, index_test::arr1[i].y);
- int64_t const id = PointToInt64Obsolete(pt, g_coordBits);
- m2::PointD const pt1 = Int64ToPointObsolete(id, g_coordBits);
-
- CheckEqualPoints(pt, pt1);
-
- int64_t const id1 = PointToInt64Obsolete(pt1, g_coordBits);
- TEST_EQUAL(id, id1, (pt, pt1));
- }
-}
diff --git a/indexer/indexer_tests/test_polylines.cpp b/indexer/indexer_tests/test_polylines.cpp
deleted file mode 100644
index 357553b178..0000000000
--- a/indexer/indexer_tests/test_polylines.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "indexer/indexer_tests/test_polylines.hpp"
-
-namespace index_test
-{
- P arr1[376] = { P(25.624035299999999182, 72.26346513007850092), P(25.624273200000001083, 72.263461698303601111), P(25.624488899999999347, 72.26341365347376211), P(25.624979400000000851, 72.263304218156179104), P(25.626030799999998777, 72.263025101705878228), P(25.629390999999998257, 72.261676817778678128), P(25.630162399999999678, 72.26138836631159279), P(25.631299500000000791, 72.260963603282490908), P(25.63236829999999955, 72.26051310574631259), P(25.63325580000000059, 72.260190152533994024), P(25.633720499999999021, 72.260019906865807116), P(25.634314799999998513, 72.259865485075735592), P(25.634578999999998672, 72.259830215951140531), P(25.635424199999999217, 72.259772832171691448), P(25.635776400000001018, 72.259834791404088605), P(25.638406499999998545, 72.260604806439260983), P(25.639231599999998679, 72.260931765228107793), P(25.639867699999999928, 72.261237563690428942), P(25.640699399999999031, 72.261850499331046649), P(25.643624299999999039, 72.264447578158552687), P(25.644772700000000754, 72.265904403664706024), P(25.645413800000000037, 72.267106341816230497), P(25.646751600000001758, 72.270404536824941033), P(25.64890219999999843, 72.275985791150915816), P(25.649064599999999103, 72.276404165523842948), P(25.650549500000000336, 72.279974564589863917), P(25.651433600000000723, 72.281545386607334081), P(25.652029899999998719, 72.282193025251160634), P(25.652814700000000414, 72.282915237415323872), P(25.654197199999998702, 72.283799562153532747), P(25.656540400000000801, 72.285055792411071707), P(25.658162999999998277, 72.286263412818769325), P(25.661959599999999426, 72.289916920742129491), P(25.663380199999998865, 72.291039561736027963), P(25.665810499999999195, 72.292780588759853799), P(25.6700361000000008, 72.29585629709197292), P(25.670962599999999298, 72.296655718166547899), P(25.672222699999998952, 72.297961211704517837), P(25.673103499999999855, 72.29896171301187735), P(25.674837499999998869, 72.300952077677095531), P(25.676358000000000459, 72.302732468128681376), P(25.678018200000000348, 72.304444228347662715), P(25.680309600000001069, 72.306619426588397914), P(25.682252600000001763, 72.308208994982337003), P(25.685880300000000886, 72.310749482551628375), P(25.6871223999999998, 72.311619291531712861), P(25.689502399999998516, 72.313337574126506979), P(25.689994200000001001, 72.313685586072296019), P(25.691337099999998372, 72.314639003020189989), P(25.694014100000000411, 72.316465930359882464), P(25.696650399999999337, 72.318133963117716689), P(25.697924300000000386, 72.31863598381848135), P(25.699229800000001234, 72.31891418618496914), P(25.700213699999999051, 72.319045273707061483), P(25.703616300000000194, 72.319271576784373678), P(25.707311499999999427, 72.319273484907995453), P(25.715181600000001083, 72.318046763400587906), P(25.72608460000000008, 72.315978426880036523), P(25.728649600000000675, 72.31539857900408208), P(25.730824299999998317, 72.315156452495600092), P(25.732753200000001215, 72.314945427265811873), P(25.736661200000000349, 72.315042353781024076), P(25.74480259999999987, 72.315568583243575063), P(25.747831600000001373, 72.315649864883624787), P(25.749809599999998966, 72.315866807206518274), P(25.752535200000000515, 72.316023647210727177), P(25.755610000000000781, 72.315910501039496694), P(25.760463999999998919, 72.315272459413776573), P(25.762314700000001011, 72.315021747344800929), P(25.763456399999999036, 72.314812630534717641), P(25.763716200000001066, 72.31478954377344337), P(25.771413500000001306, 72.314102668549878672), P(25.779617200000000565, 72.313375160856324442), P(25.784148800000000534, 72.313357035273327256), P(25.790238899999998523, 72.313577786126856495), P(25.793676300000001334, 72.313716876708198811), P(25.796280599999999339, 72.314048100429985766), P(25.798680499999999682, 72.31463614103191162), P(25.800190700000001698, 72.315239260045032665), P(25.803071100000000371, 72.316310615756250968), P(25.806439499999999754, 72.316835901112042961), P(25.809219599999998707, 72.316657116642062419), P(25.813906700000000427, 72.315918133153061831), P(25.817769800000000657, 72.31543750249576874), P(25.819804099999998925, 72.315482531661231747), P(25.823219200000000484, 72.315995217547779816), P(25.824360999999999677, 72.316092908788874638), P(25.825752500000000111, 72.316000750836963107), P(25.833053499999998337, 72.315183355397863352), P(25.835087900000001326, 72.314863574077250519), P(25.836477299999998536, 72.314986830897922232), P(25.838510800000001666, 72.315843910886087542), P(25.84021669999999915, 72.316586137240363996), P(25.845591399999999993, 72.318366369042564656), P(25.847287900000001315, 72.318912278071522337), P(25.852937300000000675, 72.321233538069833457), P(25.857534099999998745, 72.324114950429262194), P(25.858493899999999144, 72.324638770105451613), P(25.859516599999999187, 72.325101910243901671), P(25.860960299999998568, 72.325309341574609334), P(25.864481800000000078, 72.325170990340012622), P(25.866295099999998541, 72.325066225249685203), P(25.871619400000000155, 72.324758609934391984), P(25.873917800000000966, 72.324524655307570242), P(25.875719000000000136, 72.324229064532204347), P(25.882352300000000866, 72.322516991669758113), P(25.886094899999999797, 72.321551632301222412), P(25.891463999999999146, 72.320154280548763381), P(25.892594599999998906, 72.32000410941930113), P(25.893775399999999109, 72.320041127430243932), P(25.895055100000000436, 72.320205228136387632), P(25.901716900000000265, 72.321479884460799781), P(25.905201399999999268, 72.322148897878847151), P(25.906758400000001075, 72.322300409542663147), P(25.908453200000000294, 72.322276366107203671), P(25.910453700000001476, 72.322039939449879853), P(25.912611200000000622, 72.321379323121732341), P(25.914446699999999169, 72.320507670602822259), P(25.915890699999998503, 72.319578403757603269), P(25.916971199999998987, 72.318721085380474278), P(25.923277999999999821, 72.312682767056259081), P(25.924315100000001166, 72.311643903530907096), P(25.925479700000000349, 72.310661910829537646), P(25.926380200000000542, 72.31012846985993292), P(25.927288000000000778, 72.309673827336439444), P(25.929170299999999116, 72.308742039167825055), P(25.931695000000001272, 72.307558244187632113), P(25.935542200000000435, 72.305689970006980616), P(25.936291600000000557, 72.305420216334297834), P(25.937011699999999337, 72.3052109385934898), P(25.937444899999999137, 72.305171830245583919), P(25.938065999999999178, 72.305126426436075349), P(25.939194700000001603, 72.305346959512363014), P(25.941637199999998842, 72.306187700803491225), P(25.951531899999999098, 72.309363611414866568), P(25.958591599999998323, 72.311600021678131611), P(25.961859900000000323, 72.312588133461261464), P(25.9623209000000017, 72.312845323461488078), P(25.962808800000001241, 72.313126745396871797), P(25.963783500000001681, 72.313929806056449934), P(25.964454100000001091, 72.315054565005411291), P(25.966293799999998981, 72.319575350745964215), P(25.966609900000001687, 72.320173934482440359), P(25.966938999999999993, 72.320628647970096381), P(25.968776200000000642, 72.322731857094510133), P(25.969766299999999859, 72.323772036806516894), P(25.97039970000000153, 72.324406914991570261), P(25.971057800000000526, 72.324904784282267656), P(25.972805199999999815, 72.325716763759459127), P(25.973508700000000005, 72.326106631888762877), P(25.974174900000001287, 72.326699167072590058), P(25.974623600000001034, 72.327462886785923502), P(25.97499170000000035, 72.32822527930542833), P(25.975826399999998984, 72.329784823533856297), P(25.976481499999998448, 72.330935420885211329), P(25.977230399999999833, 72.332212952428704966), P(25.978115400000000079, 72.333512265445278899), P(25.9789551000000003, 72.33474671239962106), P(25.980276700000001, 72.336402410819303554), P(25.98169719999999927, 72.337880836033434662), P(25.983172299999999666, 72.33911288186702393), P(25.984414600000000917, 72.340068567971513858), P(25.985398499999998734, 72.340636603533639004), P(25.986058100000001048, 72.340908025445514795), P(25.987230000000000274, 72.341316496490946975), P(25.988157300000001015, 72.341676869267246275), P(25.991148400000000152, 72.342299318530393748), P(25.997876999999999015, 72.343701138883602653), P(25.999752600000000768, 72.344154484369809666), P(26.001479700000000861, 72.344723890629211382), P(26.003023999999999916, 72.345420432028205937), P(26.005314899999998346, 72.346859159309715892), P(26.007066099999999409, 72.348322733682408625), P(26.008686999999998335, 72.35014618535842601), P(26.012360000000001037, 72.354910262506038521), P(26.013286199999999582, 72.355943685106993257), P(26.013858500000001328, 72.35652369166834319), P(26.014633599999999802, 72.357135968669368253), P(26.015746700000001113, 72.357673410043958029), P(26.017126499999999822, 72.358212001250265644), P(26.020520199999999988, 72.359278695677289761), P(26.021437599999998724, 72.359644892510004865), P(26.022532699999999295, 72.360275718006846546), P(26.028545999999998628, 72.365263533617877556), P(26.029226600000001213, 72.365797602942478761), P(26.030111600000001459, 72.366317546512846093), P(26.032004199999999372, 72.367306080501194288), P(26.033209299999999331, 72.367834246590078351), P(26.034265699999998844, 72.368067397148493569), P(26.035592099999998794, 72.368224167962054594), P(26.03677019999999942, 72.368129074294643033), P(26.043432299999999202, 72.366408627750374194), P(26.045431499999999403, 72.365842856777021552), P(26.048415399999999664, 72.36504242213915461), P(26.052753299999999115, 72.363920454888528866), P(26.05556269999999941, 72.363008918012667436), P(26.060303699999998628, 72.360393712052541559), P(26.065962500000001256, 72.35698705139280662), P(26.067612400000001571, 72.356026924714299753), P(26.069255399999999412, 72.355021374242639354), P(26.070335599999999943, 72.354163985856629893), P(26.071483900000000489, 72.353231772141796796), P(26.073087300000000965, 72.351530224288538307), P(26.07495580000000146, 72.349052146600300262), P(26.077375199999998756, 72.345412414793742073), P(26.079008800000000434, 72.34322240936705839), P(26.080636800000000619, 72.341554327036718064), P(26.081818800000000635, 72.340620379333103074), P(26.083176200000000478, 72.339615440891947173), P(26.085581000000001239, 72.338285853103528211), P(26.092078799999999461, 72.335142167729841844), P(26.099516500000000008, 72.332061609286498083), P(26.102282500000001164, 72.330882175026999903), P(26.105014700000001682, 72.329521843521945357), P(26.108211900000000583, 72.327720133658942814), P(26.116759299999998234, 72.322424061632020198), P(26.118289900000000614, 72.321345929920937579), P(26.124188000000000187, 72.316306990481081129), P(26.126093300000000852, 72.314456217615472156), P(26.13131840000000139, 72.308768748722727082), P(26.133807300000000851, 72.305896196846916268), P(26.135103199999999646, 72.304208818196542552), P(26.13615610000000089, 72.3027141546473473), P(26.136958199999998698, 72.301545345164157652), P(26.137658200000000619, 72.300474224549915903), P(26.140487000000000251, 72.29551524417688313), P(26.146685800000000199, 72.285760107870132174), P(26.151274499999999534, 72.277504651282583836), P(26.151979099999998368, 72.276113553331668982), P(26.152562700000000717, 72.274582520714972134), P(26.152978600000000853, 72.272986691312326002), P(26.154697899999998612, 72.264608683472175699), P(26.155105599999998844, 72.263003939235275652), P(26.155811400000001044, 72.261258344309723611), P(26.156706599999999696, 72.259655777039213831), P(26.158511799999999425, 72.257073180827120495), P(26.163497199999998344, 72.251147710512896083), P(26.164152500000000146, 72.250452144382251163), P(26.165397099999999853, 72.249370018656591697), P(26.171159400000000517, 72.245101348184562084), P(26.171824600000000771, 72.244502288299599968), P(26.172791700000001214, 72.243464858038208831), P(26.173422299999998586, 72.24251111483852128), P(26.174280599999999453, 72.240982180618559028), P(26.174924399999998315, 72.239409446329290176), P(26.175138900000000319, 72.238550480576279256), P(26.177894599999998348, 72.222417606854094174), P(26.178249600000000896, 72.220799387733251251), P(26.178700899999999052, 72.219414415122045625), P(26.179689899999999625, 72.217234222262234766), P(26.182073200000001378, 72.213506738076645775), P(26.18310470000000123, 72.211533626956168064), P(26.183614800000000855, 72.210338776927230242), P(26.18428000000000111, 72.208417574177602205), P(26.185804499999999706, 72.203266316303412964), P(26.186153000000000901, 72.202346286216979365), P(26.186549599999999316, 72.201465316811109574), P(26.187059699999998941, 72.200685882789031211), P(26.187643699999998859, 72.200064170625580573), P(26.188815999999999207, 72.199110470754774838), P(26.189986799999999789, 72.198491439723213148), P(26.190943999999998226, 72.198205925482497491), P(26.192045499999998981, 72.198064597333782899), P(26.201502200000000187, 72.19749033573828001), P(26.204289599999999183, 72.197194731015855496), P(26.212046699999998367, 72.196023752898682346), P(26.217400099999998986, 72.195033541852339454), P(26.220660899999998605, 72.194099530393685882), P(26.223864100000000121, 72.193042117073559893), P(26.227025699999998665, 72.192404096537160285), P(26.229406099999998503, 72.192154413131575552), P(26.23379059999999896, 72.191934250652863625), P(26.241092200000000645, 72.191652763688111349), P(26.247795599999999894, 72.191305763109099303), P(26.259740499999999486, 72.190710990755292187), P(26.262441899999998896, 72.190662426481935654), P(26.26396259999999927, 72.190803739092231694), P(26.265582200000000768, 72.19108065172507338), P(26.271514700000000886, 72.192273445913514252), P(26.275603900000000124, 72.192994312937273094), P(26.278289999999998372, 72.193506828374651718), P(26.280647800000000558, 72.193799369593079973), P(26.284991699999999071, 72.194193426147350579), P(26.295021899999998283, 72.194996021158502231), P(26.296629599999999272, 72.195353135208762296), P(26.298219400000000689, 72.195936520796209379), P(26.299353599999999886, 72.196573622487093758), P(26.300700500000001369, 72.19746290844136638), P(26.301440499999998224, 72.198127833072547332), P(26.302059899999999715, 72.198747051231549676), P(26.302597999999999701, 72.199118470577644757), P(26.30326700000000173, 72.200164931796578571), P(26.304018299999999186, 72.201524555689601925), P(26.305375600000001413, 72.20513574950004454), P(26.306215500000000418, 72.206942181028665573), P(26.307179600000001329, 72.208595118825385839), P(26.307805599999998236, 72.209443034325843769), P(26.308593200000000678, 72.210334966852684602), P(26.309511400000001657, 72.211171854914510959), P(26.310345000000001647, 72.211829485157878139), P(26.313103999999999161, 72.213550746524816759), P(26.313808999999999116, 72.214105903186023738), P(26.315858999999999668, 72.21616368063173752), P(26.316473599999998356, 72.216713905276705532), P(26.317261800000000704, 72.217105619191144683), P(26.318279199999999207, 72.217451609641841515), P(26.31951039999999864, 72.217778930438797147), P(26.319995200000001034, 72.217883719155963718), P(26.322028199999998321, 72.21814340535271981), P(26.323134799999998279, 72.218219615725388394), P(26.324022500000001656, 72.218280774611798734), P(26.32581220000000144, 72.218525220186265301), P(26.327261700000001099, 72.218861882068196678), P(26.330273800000000506, 72.219715642811124212), P(26.337171999999998917, 72.221928497785057743), P(26.339137900000000769, 72.222394361231621929), P(26.341438799999998821, 72.222689314479467271), P(26.343669200000000785, 72.222811640430336411), P(26.346788899999999956, 72.222677310542948703), P(26.356923500000000615, 72.222042438730937874), P(26.359536099999999692, 72.2221015051835451), P(26.36183730000000125, 72.222299854521224916), P(26.366428899999998947, 72.222842507761527031), P(26.374883000000000521, 72.223912965077033732), P(26.380090800000001394, 72.224542709845593436), P(26.39073850000000121, 72.225869670908153353), P(26.393878699999998361, 72.226187124115313054), P(26.400813700000000495, 72.226887965488728582), P(26.405969100000000083, 72.227408932782296347), P(26.434136200000001082, 72.23031015029567925), P(26.437651200000001239, 72.230672215773722655), P(26.439650799999999009, 72.230860300030158783), P(26.442400500000001529, 72.230918230849241013), P(26.444426599999999894, 72.230815518016711962), P(26.454957100000001446, 72.229639190945519545), P(26.455386699999998257, 72.229609273288744475), P(26.470600499999999755, 72.227804710557407475), P(26.485397899999998828, 72.226080035891357056), P(26.487313600000000235, 72.226084418502168205), P(26.488673999999999609, 72.226209799401686951), P(26.489974300000000085, 72.226456941463752059), P(26.493316499999998825, 72.227405883949458598), P(26.497907399999999001, 72.228727947008763977), P(26.507186099999998419, 72.231355762593423719), P(26.521764000000001005, 72.235531322949142918), P(26.522283200000000392, 72.235663963313356817), P(26.52274799999999999, 72.235808991367022713), P(26.523495799999999178, 72.236006428221017472), P(26.537509100000001183, 72.239985971537208798), P(26.540924100000001573, 72.240959309764491536), P(26.544420699999999869, 72.241674408812258434), P(26.546888100000000321, 72.242183101965366632), P(26.5518616999999999, 72.242874580127462991), P(26.562219100000000083, 72.244128903051048951), P(26.564274399999998622, 72.244315309516480283), P(26.576127799999998302, 72.245028538203385438), P(26.58263820000000166, 72.244424904560787581), P(26.591367999999999228, 72.243389190867901561), P(26.598972199999998622, 72.242452221067154028), P(26.600826200000000199, 72.242522931717928714), P(26.603627199999998254, 72.242683603364909573), P(26.606756300000000692, 72.243241096929352807), P(26.612569100000001754, 72.244800578667096147), P(26.615042299999998932, 72.246052459623328446), P(26.621848599999999863, 72.249011664844303482), P(26.627471299999999843, 72.250195383365820589), P(26.641823800000000944, 72.252710806698729584), P(26.648778100000001245, 72.254338371527666141), P(26.655288500000001051, 72.25700169234383452), P(26.660515000000000185, 72.259171735257126556), P(26.662390800000000723, 72.25996099777080417), P(26.670629300000001649, 72.263625851730935779), P(26.671595899999999801, 72.264267979553508781), P(26.676856199999999575, 72.267335711577246116), P(26.677412499999999085, 72.267929636079472289), P(26.676856199999999575, 72.267335711577246116) };
-}
diff --git a/indexer/indexer_tests/test_polylines.hpp b/indexer/indexer_tests/test_polylines.hpp
deleted file mode 100644
index 77171d2a5a..0000000000
--- a/indexer/indexer_tests/test_polylines.hpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-
-#include "geometry/point2d.hpp"
-
-namespace index_test
-{
- typedef m2::PointD P;
- extern P arr1[376];
-}
diff --git a/indexer/locality_object.cpp b/indexer/locality_object.cpp
index 3ca1d9bb30..a4e21f50a1 100644
--- a/indexer/locality_object.cpp
+++ b/indexer/locality_object.cpp
@@ -1,16 +1,16 @@
#include "indexer/locality_object.hpp"
#include "indexer/feature_decl.hpp"
-#include "indexer/geometry_serialization.hpp"
#include "coding/byte_stream.hpp"
+#include "coding/geometry_coding.hpp"
namespace indexer
{
void LocalityObject::Deserialize(char const * data)
{
ArrayByteSource src(data);
- serial::CodingParams cp = {};
+ serial::GeometryCodingParams cp = {};
ReadPrimitiveFromSource(src, m_id);
uint8_t type;
ReadPrimitiveFromSource(src, type);
diff --git a/indexer/tesselator_decl.hpp b/indexer/tesselator_decl.hpp
deleted file mode 100644
index cc1353fcb4..0000000000
--- a/indexer/tesselator_decl.hpp
+++ /dev/null
@@ -1,26 +0,0 @@
-#pragma once
-
-#include "base/assert.hpp"
-
-namespace tesselator
-{
- // Edge of graph, builded from triangles list.
- struct Edge
- {
- int m_p[2]; // indexes of connected triangles (0 -> 1)
- uint64_t m_delta; // delta of 1 - triangle from 0 - triangle
-
- // intersected rib of 0 - triangle:
- // - -1 - uninitialized or root edge
- // - 0 - this edge intersects 1-2 rib;
- // - 1 - this edge intersects 2-0 rib;
- int8_t m_side;
-
- Edge(int from, int to, uint64_t delta, char side)
- : m_delta(delta), m_side(side)
- {
- m_p[0] = from;
- m_p[1] = to;
- }
- };
-}