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:
-rw-r--r--indexer/data_header.cpp2
-rw-r--r--indexer/feature_loader.cpp23
-rw-r--r--indexer/feature_loader.hpp2
-rw-r--r--indexer/feature_loader_base.cpp18
-rw-r--r--indexer/feature_loader_base.hpp5
-rw-r--r--indexer/old/feature_loader_101.cpp21
-rw-r--r--indexer/old/feature_loader_101.hpp2
7 files changed, 29 insertions, 44 deletions
diff --git a/indexer/data_header.cpp b/indexer/data_header.cpp
index da77784838..52e94089d0 100644
--- a/indexer/data_header.cpp
+++ b/indexer/data_header.cpp
@@ -97,6 +97,8 @@ namespace feature
m_scales.resize(count);
src.Read(m_scales.data(), count);
+ m_type = country;
+
m_ver = v1;
}
}
diff --git a/indexer/feature_loader.cpp b/indexer/feature_loader.cpp
index 320fbea692..4fd1d502a8 100644
--- a/indexer/feature_loader.cpp
+++ b/indexer/feature_loader.cpp
@@ -259,23 +259,6 @@ uint32_t LoaderCurrent::ParseTriangles(int scale)
return sz;
}
-namespace
-{
- uint32_t const kInvalidOffset = uint32_t(-1);
-}
-
-void LoaderCurrent::ReadOffsets(ArrayByteSource & src, uint8_t mask, offsets_t & offsets) const
-{
- ASSERT ( offsets.empty(), () );
- ASSERT_GREATER ( mask, 0, () );
-
- while (mask > 0)
- {
- offsets.push_back((mask & 0x01) ? ReadVarUint<uint32_t>(src) : kInvalidOffset);
- mask = mask >> 1;
- }
-}
-
int LoaderCurrent::GetScaleIndex(int scale) const
{
int const count = m_Info.GetScalesCount();
@@ -312,13 +295,13 @@ int LoaderCurrent::GetScaleIndex(int scale, offsets_t const & offsets) const
case -1:
// Choose the best existing geometry for the last visible scale.
ind = count-1;
- while (ind >= 0 && offsets[ind] == kInvalidOffset) --ind;
+ while (ind >= 0 && offsets[ind] == s_InvalidOffset) --ind;
break;
case -2:
// Choose the worst existing geometry for the first visible scale.
ind = 0;
- while (ind < count && offsets[ind] == kInvalidOffset) ++ind;
+ while (ind < count && offsets[ind] == s_InvalidOffset) ++ind;
break;
default:
@@ -327,7 +310,7 @@ int LoaderCurrent::GetScaleIndex(int scale, offsets_t const & offsets) const
for (int i = 0; i < n; ++i)
{
if (scale <= m_Info.GetScale(i))
- return (offsets[i] != kInvalidOffset ? i : -1);
+ return (offsets[i] != s_InvalidOffset ? i : -1);
}
}
}
diff --git a/indexer/feature_loader.hpp b/indexer/feature_loader.hpp
index 5d0df0092a..59456adbc7 100644
--- a/indexer/feature_loader.hpp
+++ b/indexer/feature_loader.hpp
@@ -8,8 +8,6 @@ namespace feature
{
typedef LoaderBase BaseT;
- void ReadOffsets(ArrayByteSource & src, uint8_t mask, offsets_t & offsets) const;
-
/// Get the index for geometry serialization.
/// @param[in] scale:
/// -1 : index for the best geometry
diff --git a/indexer/feature_loader_base.cpp b/indexer/feature_loader_base.cpp
index 85e24eb46d..6ba671a608 100644
--- a/indexer/feature_loader_base.cpp
+++ b/indexer/feature_loader_base.cpp
@@ -80,4 +80,22 @@ uint32_t LoaderBase::CalcOffset(ArrayByteSource const & source) const
return static_cast<uint32_t>(source.PtrC() - DataPtr());
}
+void LoaderBase::ReadOffsets(ArrayByteSource & src, uint8_t mask, offsets_t & offsets) const
+{
+ ASSERT ( offsets.empty(), () );
+ ASSERT_GREATER ( mask, 0, () );
+
+ offsets.resize(m_Info.GetScalesCount(), s_InvalidOffset);
+ size_t ind = 0;
+
+ while (mask > 0)
+ {
+ if (mask & 0x01)
+ offsets[ind] = ReadVarUint<uint32_t>(src);
+
+ ++ind;
+ mask = mask >> 1;
+ }
+}
+
}
diff --git a/indexer/feature_loader_base.hpp b/indexer/feature_loader_base.hpp
index 8fccfdaa57..962e8d71be 100644
--- a/indexer/feature_loader_base.hpp
+++ b/indexer/feature_loader_base.hpp
@@ -94,7 +94,10 @@ namespace feature
uint32_t m_ptsSimpMask;
typedef buffer_vector<uint32_t, DataHeader::MAX_SCALES_COUNT> offsets_t;
-
offsets_t m_ptsOffsets, m_trgOffsets;
+
+ static uint32_t const s_InvalidOffset = uint32_t(-1);
+
+ void ReadOffsets(ArrayByteSource & src, uint8_t mask, offsets_t & offsets) const;
};
}
diff --git a/indexer/old/feature_loader_101.cpp b/indexer/old/feature_loader_101.cpp
index 4068683e7d..7fd8807582 100644
--- a/indexer/old/feature_loader_101.cpp
+++ b/indexer/old/feature_loader_101.cpp
@@ -118,11 +118,6 @@ void LoaderImpl::ParseCommon()
m_Header2Offset = CalcOffset(source);
}
-namespace
-{
- uint32_t const kInvalidOffset = uint32_t(-1);
-}
-
int LoaderImpl::GetScaleIndex(int scale) const
{
int const count = m_Info.GetScalesCount();
@@ -140,7 +135,7 @@ int LoaderImpl::GetScaleIndex(int scale, offsets_t const & offsets) const
{
// Choose the best geometry for the last visible scale.
int i = offsets.size()-1;
- while (i >= 0 && offsets[i] == kInvalidOffset) --i;
+ while (i >= 0 && offsets[i] == s_InvalidOffset) --i;
if (i >= 0)
return i;
else
@@ -151,7 +146,7 @@ int LoaderImpl::GetScaleIndex(int scale, offsets_t const & offsets) const
for (size_t i = 0; i < m_Info.GetScalesCount(); ++i)
if (scale <= m_Info.GetScale(i))
{
- if (offsets[i] != kInvalidOffset)
+ if (offsets[i] != s_InvalidOffset)
return i;
else
break;
@@ -357,17 +352,5 @@ uint32_t LoaderImpl::ParseTriangles(int scale)
return sz;
}
-void LoaderImpl::ReadOffsets(ArrayByteSource & src, uint8_t mask, offsets_t & offsets) const
-{
- ASSERT ( offsets.empty(), () );
- ASSERT_GREATER ( mask, 0, () );
-
- while (mask > 0)
- {
- offsets.push_back((mask & 0x01) ? ReadVarUint<uint32_t>(src) : kInvalidOffset);
- mask = mask >> 1;
- }
-}
-
}
}
diff --git a/indexer/old/feature_loader_101.hpp b/indexer/old/feature_loader_101.hpp
index 6b439d4a0e..2d4742daab 100644
--- a/indexer/old/feature_loader_101.hpp
+++ b/indexer/old/feature_loader_101.hpp
@@ -8,8 +8,6 @@ namespace old_101 { namespace feature
{
typedef ::feature::LoaderBase BaseT;
- void ReadOffsets(ArrayByteSource & src, uint8_t mask, offsets_t & offsets) const;
-
/// Get the index for geometry serialization.
/// @param[in] scale:
/// -1 : index for the best geometry