diff options
Diffstat (limited to 'indexer/data_header.cpp')
-rw-r--r-- | indexer/data_header.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/indexer/data_header.cpp b/indexer/data_header.cpp index 32903af338..47e2161f4a 100644 --- a/indexer/data_header.cpp +++ b/indexer/data_header.cpp @@ -16,8 +16,9 @@ namespace feature { serial::CodingParams DataHeader::GetCodingParams(int scaleIndex) const - { - return serial::CodingParams(m_codingParams.GetCoordBits() - (m_scales[3] - m_scales[scaleIndex]) / 2, + { + return serial::CodingParams(m_codingParams.GetCoordBits() - + (m_scales.back() - m_scales[scaleIndex]) / 2, m_codingParams.GetBasePointUint64()); } @@ -31,12 +32,6 @@ namespace feature m_bounds = RectToInt64(r, m_codingParams.GetCoordBits()); } - void DataHeader::SetScales(int * arr) - { - for (size_t i = 0; i < m_scales.size(); ++i) - m_scales[i] = static_cast<uint8_t>(arr[i]); - } - pair<int, int> DataHeader::GetScaleRange() const { using namespace scales; @@ -64,6 +59,7 @@ namespace feature WriteVarInt(w, m_bounds.first); WriteVarInt(w, m_bounds.second); + WriteVarUint(w, m_scales.size()); w.Write(m_scales.data(), m_scales.size()); WriteVarInt(w, static_cast<int32_t>(m_type)); @@ -77,7 +73,9 @@ namespace feature m_bounds.first = ReadVarInt<int64_t>(src); m_bounds.second = ReadVarInt<int64_t>(src); - src.Read(m_scales.data(), m_scales.size()); + uint32_t const count = ReadVarUint<uint32_t>(src); + m_scales.resize(count); + src.Read(m_scales.data(), count); m_type = static_cast<MapType>(ReadVarInt<int32_t>(src)); @@ -93,6 +91,7 @@ namespace feature m_bounds.first = ReadVarInt<int64_t>(src) + base; m_bounds.second = ReadVarInt<int64_t>(src) + base; + m_scales.resize(4); src.Read(m_scales.data(), m_scales.size()); m_ver = v1; |