diff options
author | tatiana-kondakova <tatiana.kondakova@gmail.com> | 2018-01-29 13:02:24 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2018-02-01 18:13:38 +0300 |
commit | e2db212ab16e5af127981d778834548a7dbe56b8 (patch) | |
tree | 8a4d43017f93a393505ceaac077df7ffb43bfe61 /indexer/locality_object.cpp | |
parent | 78d0770c040289e6a0e96792c8a933418d7ebbad (diff) |
Add LocalityIndexBuilder
Diffstat (limited to 'indexer/locality_object.cpp')
-rw-r--r-- | indexer/locality_object.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/indexer/locality_object.cpp b/indexer/locality_object.cpp new file mode 100644 index 0000000000..c348d31315 --- /dev/null +++ b/indexer/locality_object.cpp @@ -0,0 +1,34 @@ +#include "indexer/locality_object.hpp" + +#include "indexer/feature_decl.hpp" +#include "indexer/geometry_serialization.hpp" + +#include "coding/byte_stream.hpp" + +namespace indexer +{ +void LocalityObject::Deserialize(char const * data) +{ + ArrayByteSource src(data); + serial::CodingParams cp = {}; + ReadPrimitiveFromSource(src, m_id); + uint8_t type; + ReadPrimitiveFromSource(src, type); + + if (type == feature::GEOM_POINT) + { + m_points.push_back(serial::LoadPoint(src, cp)); + return; + } + + ASSERT_EQUAL(type, feature::GEOM_AREA, ("Only supported types are GEOM_POINT and GEOM_AREA.")); + uint8_t trgCount; + ReadPrimitiveFromSource(src, trgCount); + if (trgCount > 0) + { + trgCount += 2; + char const * start = static_cast<char const *>(src.PtrC()); + serial::LoadInnerTriangles(start, trgCount, cp, m_triangles); + } +} +} // namespace indexer |