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
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/CMakeLists.txt1
-rw-r--r--editor/editable_data_source.hpp7
-rw-r--r--editor/editable_feature_source.hpp13
-rw-r--r--editor/editor_tests/osm_editor_test.cpp5
-rw-r--r--editor/editor_tests/osm_editor_test.hpp5
5 files changed, 17 insertions, 14 deletions
diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt
index 3d502a887b..987054b5c7 100644
--- a/editor/CMakeLists.txt
+++ b/editor/CMakeLists.txt
@@ -6,7 +6,6 @@ set(
changeset_wrapper.hpp
config_loader.cpp
config_loader.hpp
- editable_data_source.hpp
editable_feature_source.cpp
editable_feature_source.hpp
editor_config.cpp
diff --git a/editor/editable_data_source.hpp b/editor/editable_data_source.hpp
deleted file mode 100644
index fdb0841d2b..0000000000
--- a/editor/editable_data_source.hpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#pragma once
-
-#include "editor/editable_feature_source.hpp"
-
-#include "indexer/data_source.hpp"
-
-using EditableDataSource = DataSourceImpl<EditableFeatureSource>;
diff --git a/editor/editable_feature_source.hpp b/editor/editable_feature_source.hpp
index 3dcb30e107..3dadf59801 100644
--- a/editor/editable_feature_source.hpp
+++ b/editor/editable_feature_source.hpp
@@ -8,6 +8,7 @@
#include <cstdint>
#include <functional>
+#include <memory>
class EditableFeatureSource final : public FeatureSource
{
@@ -21,4 +22,14 @@ public:
std::function<void(FeatureID const &)> const & fn) const override;
void ForEachInRectAndScale(m2::RectD const & rect, int scale,
std::function<void(FeatureType &)> const & fn) const override;
-}; // class EditableFeatureSource
+};
+
+class EditableFeatureSourceFactory : public FeatureSourceFactory
+{
+public:
+ // FeatureSourceFactory overrides:
+ std::unique_ptr<FeatureSource> operator()(MwmSet::MwmHandle const & handle) const override
+ {
+ return std::make_unique<EditableFeatureSource>(handle);
+ }
+};
diff --git a/editor/editor_tests/osm_editor_test.cpp b/editor/editor_tests/osm_editor_test.cpp
index c5224b6c6c..7886882c24 100644
--- a/editor/editor_tests/osm_editor_test.cpp
+++ b/editor/editor_tests/osm_editor_test.cpp
@@ -1,5 +1,6 @@
#include "testing/testing.hpp"
+#include "editor/editable_feature_source.hpp"
#include "editor/editor_storage.hpp"
#include "editor/editor_tests/osm_editor_test.hpp"
#include "editor/editor_tests_support/helpers.hpp"
@@ -53,7 +54,7 @@ public:
};
template <typename TFn>
-void ForEachCafeAtPoint(DataSourceBase & dataSource, m2::PointD const & mercator, TFn && fn)
+void ForEachCafeAtPoint(DataSource & dataSource, m2::PointD const & mercator, TFn && fn)
{
m2::RectD const rect = MercatorBounds::RectByCenterXYAndSizeInMeters(mercator, 0.2 /* rect width */);
@@ -136,7 +137,7 @@ namespace editor
{
namespace testing
{
-EditorTest::EditorTest()
+EditorTest::EditorTest() : m_dataSource(make_unique<EditableFeatureSourceFactory>())
{
try
{
diff --git a/editor/editor_tests/osm_editor_test.hpp b/editor/editor_tests/osm_editor_test.hpp
index a0c7829bd5..8382178e63 100644
--- a/editor/editor_tests/osm_editor_test.hpp
+++ b/editor/editor_tests/osm_editor_test.hpp
@@ -5,8 +5,7 @@
#include "generator/generator_tests_support/test_feature.hpp"
#include "generator/generator_tests_support/test_mwm_builder.hpp"
-#include "editor/editable_data_source.hpp"
-
+#include "indexer/data_source.hpp"
#include "indexer/mwm_set.hpp"
#include "storage/country_info_getter.hpp"
@@ -79,7 +78,7 @@ private:
void Cleanup(platform::LocalCountryFile const & map);
bool RemoveMwm(MwmSet::MwmId const & mwmId);
- EditableDataSource m_dataSource;
+ DataSource m_dataSource;
storage::CountryInfoGetterForTesting m_infoGetter;
vector<platform::LocalCountryFile> m_mwmFiles;
};