Add types mapping to feature serialization\deserialization.

This commit is contained in:
vng 2011-08-15 17:14:56 +03:00 committed by Alex Zolotarev
parent e7101c28c1
commit 2d7908f048
2 changed files with 10 additions and 2 deletions

View file

@ -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<uint32_t>(source);
{
m_Types[i] = c.IndexForType(ReadVarUint<uint32_t>(source));
//m_Types[i] = ReadVarUint<uint32_t>(source);
}
m_bTypesParsed = true;
m_CommonOffset = CalcOffset(source);

View file

@ -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());
}