diff options
author | Alex Zolotarev <alex@maps.me> | 2015-12-21 01:45:06 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:04:00 +0300 |
commit | 832bc08ab4d2b1c8422a9f00566469c971c26709 (patch) | |
tree | f202569be2d6871c75462c75e324fba0779ca02d /indexer/index.hpp | |
parent | f56b9b156c5b0f081f6bc798baa493f7859cc488 (diff) |
[editor] Changed interface and internal storage for faster access and easier serialization. Introduced additional information about edits.
Diffstat (limited to 'indexer/index.hpp')
-rw-r--r-- | indexer/index.hpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/indexer/index.hpp b/indexer/index.hpp index ce87856c0f..5bbb35766d 100644 --- a/indexer/index.hpp +++ b/indexer/index.hpp @@ -134,19 +134,21 @@ private: index.ForEachInIntervalAndScale( [&](uint32_t index) { - FeatureID const fid(mwmID, index); - if (m_editor.IsFeatureDeleted(fid)) - return; FeatureType feature; - if (m_editor.GetEditedFeature(fid, feature)) + switch (m_editor.GetFeatureStatus(mwmID, index)) { + case osm::Editor::EDeleted: return; + case osm::Editor::EModified: + VERIFY(m_editor.GetEditedFeature(mwmID, index, feature), ()); m_f(feature); return; + case osm::Editor::ECreated: CHECK(false, ("Created features index should be generated.")); + case osm::Editor::EUntouched: break; } if (checkUnique(index)) { fv.GetByIndex(index, feature); - feature.SetID(fid); + feature.SetID(FeatureID(mwmID, index)); m_f(feature); } }, @@ -195,9 +197,8 @@ private: { index.ForEachInIntervalAndScale([&] (uint32_t index) { - FeatureID const fid(mwmID, index); - if (!m_editor.IsFeatureDeleted(fid) && checkUnique(index)) - m_f(fid); + if (osm::Editor::EDeleted != m_editor.GetFeatureStatus(mwmID, index) && checkUnique(index)) + m_f(FeatureID(mwmID, index)); }, i.first, i.second, scale); } } @@ -244,9 +245,14 @@ public: FeaturesVector const featureReader(pValue->m_cont, pValue->GetHeader(), pValue->m_table); do { - ASSERT(!editor.IsFeatureDeleted(*fidIter), ("Deleted feature was cached. Please review your code.")); + osm::Editor::FeatureStatus const fts = editor.GetFeatureStatus(id, fidIter->m_index); + ASSERT_NOT_EQUAL(osm::Editor::EDeleted, fts, ("Deleted feature was cached. Please review your code.")); FeatureType featureType; - if (!editor.GetEditedFeature(*fidIter, featureType)) + if (fts == osm::Editor::EModified) + { + VERIFY(editor.GetEditedFeature(id, fidIter->m_index, featureType), ()); + } + else { featureReader.GetByIndex(fidIter->m_index, featureType); featureType.SetID(*fidIter); |