diff --git a/kml/pykmlib/bindings.cpp b/kml/pykmlib/bindings.cpp index 8d5b84f677..cf77b2c6c0 100644 --- a/kml/pykmlib/bindings.cpp +++ b/kml/pykmlib/bindings.cpp @@ -946,11 +946,12 @@ BOOST_PYTHON_MODULE(pykmlib) .def_readwrite("bookmarks", &FileData::m_bookmarksData) .def_readwrite("tracks", &FileData::m_tracksData) .def_readwrite("compilations", &FileData::m_compilationsData) - .def("set_bookmarks_min_zoom", &FileData::SetBookmarksMinZoom) .def("__eq__", &FileData::operator==) .def("__ne__", &FileData::operator!=) .def("__str__", &FileDataToString); + def("set_bookmarks_min_zoom", &SetBookmarksMinZoom); + def("get_supported_languages", GetSupportedLanguages); def("get_language_index", GetLanguageIndex); def("timestamp_to_int", &ToSecondsSinceEpoch); diff --git a/kml/pykmlib/bindings_test.py b/kml/pykmlib/bindings_test.py index d5d676637a..9298de468d 100644 --- a/kml/pykmlib/bindings_test.py +++ b/kml/pykmlib/bindings_test.py @@ -109,7 +109,8 @@ class PyKmlibAdsTest(unittest.TestCase): file_data.bookmarks.append(bookmark) file_data.tracks.append(track) file_data.compilations = compilations - file_data.set_bookmarks_min_zoom(1.0, 19) + + pykmlib.set_bookmarks_min_zoom(file_data, 1.0, 19) s = pykmlib.export_kml(file_data) imported_file_data = pykmlib.import_kml(s) diff --git a/kml/types.cpp b/kml/types.cpp index 15c157daf6..bed680ad44 100644 --- a/kml/types.cpp +++ b/kml/types.cpp @@ -8,7 +8,7 @@ namespace kml { -void FileData::SetBookmarksMinZoom(double countPerTile, int maxZoom) +void SetBookmarksMinZoom(FileData & fileData, double countPerTile, int maxZoom) { using ValueType = std::pair; auto const scoreLess = [](ValueType const & lhs, ValueType const & rhs) -> bool @@ -16,7 +16,7 @@ void FileData::SetBookmarksMinZoom(double countPerTile, int maxZoom) return lhs.second < rhs.second; }; MinZoomQuadtree minZoomQuadtree{scoreLess}; - for (auto & bm : m_bookmarksData) + for (auto & bm : fileData.m_bookmarksData) { auto const & properties = bm.m_properties; int score = 0; diff --git a/kml/types.hpp b/kml/types.hpp index 6950cb95cd..74ab822f20 100644 --- a/kml/types.hpp +++ b/kml/types.hpp @@ -464,8 +464,6 @@ struct FileData bool operator!=(FileData const & data) const { return !operator==(data); } - void SetBookmarksMinZoom(double countPerTile, int maxZoom); - // Device id (it will not be serialized in text files). std::string m_deviceId; // Server id. @@ -479,6 +477,8 @@ struct FileData // Compilation collection. std::vector m_compilationsData; }; + +void SetBookmarksMinZoom(FileData & fileData, double countPerTile, int maxZoom); inline std::string DebugPrint(BookmarkIcon icon) {