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:
authorSergey Yershov <yershov@corp.mail.ru>2014-12-15 17:21:55 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:35:25 +0300
commitb240aa5839ae1295e76899a90eebfc671af3570e (patch)
tree4e41bd4a417d95637d44b60eb2e889ff72beb518 /indexer/feature_loader.cpp
parentebf94896845e189fc9fbab187eb88b2f2b233324 (diff)
Making mwm with additional info section
Diffstat (limited to 'indexer/feature_loader.cpp')
-rw-r--r--indexer/feature_loader.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/indexer/feature_loader.cpp b/indexer/feature_loader.cpp
index 4d1ccd491f..b88c63f80a 100644
--- a/indexer/feature_loader.cpp
+++ b/indexer/feature_loader.cpp
@@ -9,7 +9,10 @@
#include "../geometry/pointu_to_uint64.hpp"
#include "../coding/byte_stream.hpp"
+#include "../coding/dd_vector.hpp"
+#include "../base/logging.hpp"
+#include "../defines.hpp"
namespace feature
{
@@ -96,7 +99,7 @@ namespace
void LoaderCurrent::ParseHeader2()
{
- uint8_t ptsCount, ptsMask, trgCount, trgMask;
+ uint8_t ptsCount = 0, ptsMask = 0, trgCount = 0, trgMask = 0;
BitSource bitSource(DataPtr() + m_Header2Offset);
@@ -249,6 +252,38 @@ uint32_t LoaderCurrent::ParseTriangles(int scale)
return sz;
}
+void LoaderCurrent::ParseAdditionalInfo()
+{
+ try
+ {
+ typedef pair<uint32_t, uint32_t> IdxElementT;
+ DDVector<IdxElementT, FilesContainerR::ReaderT> idx(m_Info.GetAdditionalInfoIndexReader());
+
+ auto it = lower_bound(idx.begin(), idx.end()
+ , make_pair(uint32_t(m_pF->m_id.m_offset), uint32_t(0))
+ , [](IdxElementT const & v1, IdxElementT const & v2) { return v1.first < v2.first; }
+ );
+
+ if (it != idx.end() && m_pF->m_id.m_offset == it->first)
+ {
+ uint8_t header[2] = {0};
+ char buffer[numeric_limits<uint8_t>::max()] = {0};
+ ReaderSource<FilesContainerR::ReaderT> reader(m_Info.GetAdditionalInfoReader());
+ reader.Skip(it->second);
+ do
+ {
+ reader.Read(header, sizeof(header));
+ reader.Read(buffer, header[1]);
+ m_pF->m_additional_info[uint8_t(header[0] & 0x7F)].assign(buffer, header[1]);
+ } while (!(header[0] & 0x80));
+ }
+ }
+ catch(Reader::OpenException & e)
+ {
+ // now ignore exception because not all mwm have needed sections
+ }
+}
+
int LoaderCurrent::GetScaleIndex(int scale) const
{
int const count = m_Info.GetScalesCount();