From 2d7908f048e3ffc7899a1eae1225c57176fbeab9 Mon Sep 17 00:00:00 2001 From: vng Date: Mon, 15 Aug 2011 17:14:56 +0300 Subject: [PATCH] Add types mapping to feature serialization\deserialization. --- indexer/feature.cpp | 7 ++++++- indexer/feature_data.hpp | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/indexer/feature.cpp b/indexer/feature.cpp index ea35b90d38..680051f84c 100644 --- a/indexer/feature.cpp +++ b/indexer/feature.cpp @@ -473,9 +473,14 @@ void FeatureBase::ParseTypes() const { ASSERT(!m_bTypesParsed, ()); + Classificator & c = classif(); + ArrayByteSource source(DataPtr() + m_TypesOffset); for (size_t i = 0; i < GetTypesCount(); ++i) - m_Types[i] = ReadVarUint(source); + { + m_Types[i] = c.IndexForType(ReadVarUint(source)); + //m_Types[i] = ReadVarUint(source); + } m_bTypesParsed = true; m_CommonOffset = CalcOffset(source); diff --git a/indexer/feature_data.hpp b/indexer/feature_data.hpp index 5a23c2a6a8..194b2410ec 100644 --- a/indexer/feature_data.hpp +++ b/indexer/feature_data.hpp @@ -1,4 +1,5 @@ #pragma once +#include "classificator.hpp" #include "../coding/multilang_utf8_string.hpp" #include "../coding/value_opt_string.hpp" @@ -176,8 +177,10 @@ public: WriteToSink(sink, header); + Classificator & c = classif(); + for (size_t i = 0; i < m_Types.size(); ++i) - WriteVarUint(sink, m_Types[i]); + WriteVarUint(sink, c.TypeForIndex(m_Types[i])); FeatureParamsBase::Write(sink, header, GetGeomType()); }