diff options
author | VladiMihaylenko <vxmihaylenko@gmail.com> | 2017-10-09 15:07:19 +0300 |
---|---|---|
committer | Yuri Gorshenin <mipt.vi002@gmail.com> | 2017-10-11 20:00:06 +0300 |
commit | 74a6ad640fa7a8c74f8c8919e73f5dab6e9b3533 (patch) | |
tree | c4aae92006642dba53466aab0047770efc02dd0c /indexer/index.cpp | |
parent | 7b292e4e96f3c0be493a5ffdadec2ee5723a07d3 (diff) |
Review fixes
Diffstat (limited to 'indexer/index.cpp')
-rw-r--r-- | indexer/index.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/indexer/index.cpp b/indexer/index.cpp index 5f642f40f3..4ae66e8892 100644 --- a/indexer/index.cpp +++ b/indexer/index.cpp @@ -15,6 +15,7 @@ using platform::LocalCountryFile; ////////////////////////////////////////////////////////////////////////////////// // MwmValue implementation ////////////////////////////////////////////////////////////////////////////////// +using namespace std; MwmValue::MwmValue(LocalCountryFile const & localFile) : m_cont(platform::GetCountryReader(localFile, MapOptions::Map)), m_file(localFile) @@ -112,6 +113,29 @@ bool Index::FeaturesLoaderGuard::IsWorld() const return m_handle.GetValue<MwmValue>()->GetHeader().GetType() == feature::DataHeader::world; } +unique_ptr<FeatureType> Index::FeaturesLoaderGuard::GetOriginalFeatureByIndex(uint32_t index) const +{ + auto feature = make_unique<FeatureType>(); + if (!GetOriginalFeatureByIndex(index, *feature)) + return unique_ptr<FeatureType>(); + + return feature; +} + +unique_ptr<FeatureType> Index::FeaturesLoaderGuard::GetOriginalOrEditedFeatureByIndex(uint32_t index) const +{ + auto feature = make_unique<FeatureType>(); + if (!m_handle.IsAlive()) + return feature; + + MwmId const & id = m_handle.GetId(); + ASSERT_NOT_EQUAL(m_editor.GetFeatureStatus(id, index), osm::Editor::FeatureStatus::Created, ()); + if (!GetFeatureByIndex(index, *feature)) + return unique_ptr<FeatureType>(); + + return feature; +} + bool Index::FeaturesLoaderGuard::GetFeatureByIndex(uint32_t index, FeatureType & ft) const { if (!m_handle.IsAlive()) |