From c7a1a42985fbba4f3ddac5d72e56e0307b105e0a Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Wed, 16 Jun 2021 14:35:24 +0200
Subject: [PATCH] [GL] Make markUnusedPoints a free function.

---
 GeoLib/GEOObjects.cpp | 17 ++++++++++++-----
 GeoLib/GEOObjects.h   |  3 ---
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/GeoLib/GEOObjects.cpp b/GeoLib/GEOObjects.cpp
index ed604b9a56e..09a105553b8 100644
--- a/GeoLib/GEOObjects.cpp
+++ b/GeoLib/GEOObjects.cpp
@@ -23,6 +23,10 @@
 
 namespace GeoLib
 {
+void markUnusedPoints(GEOObjects const& geo_objects,
+                      std::string const& geo_name,
+                      std::vector<bool>& transfer_pnts);
+
 GEOObjects::GEOObjects() = default;
 
 GEOObjects::~GEOObjects()
@@ -651,10 +655,12 @@ void GEOObjects::renameGeometry(std::string const& old_name,
     }
 }
 
-void GEOObjects::markUnusedPoints(std::string const& geo_name,
-                                  std::vector<bool>& transfer_pnts) const
+void markUnusedPoints(GEOObjects const& geo_objects,
+                      std::string const& geo_name,
+                      std::vector<bool>& transfer_pnts)
 {
-    GeoLib::PolylineVec const* const ply_obj(getPolylineVecObj(geo_name));
+    GeoLib::PolylineVec const* const ply_obj(
+        geo_objects.getPolylineVecObj(geo_name));
     if (ply_obj)
     {
         std::vector<GeoLib::Polyline*> const& lines(*ply_obj->getVector());
@@ -668,7 +674,8 @@ void GEOObjects::markUnusedPoints(std::string const& geo_name,
         }
     }
 
-    GeoLib::SurfaceVec const* const sfc_obj(getSurfaceVecObj(geo_name));
+    GeoLib::SurfaceVec const* const sfc_obj(
+        geo_objects.getSurfaceVecObj(geo_name));
     if (sfc_obj)
     {
         std::vector<GeoLib::Surface*> const& surfaces = *sfc_obj->getVector();
@@ -706,7 +713,7 @@ int GEOObjects::geoPointsToStations(std::string const& geo_name,
     std::vector<bool> transfer_pnts(n_pnts, true);
     if (only_unused_pnts)
     {
-        markUnusedPoints(geo_name, transfer_pnts);
+        markUnusedPoints(*this, geo_name, transfer_pnts);
     }
 
     auto stations = std::make_unique<std::vector<GeoLib::Point*>>();
diff --git a/GeoLib/GEOObjects.h b/GeoLib/GEOObjects.h
index e8a6098e956..3e42d9cce68 100644
--- a/GeoLib/GEOObjects.h
+++ b/GeoLib/GEOObjects.h
@@ -371,8 +371,5 @@ private:
     void mergeSurfaces(std::vector<std::string> const& geo_names,
                        std::string const& merged_geo_name,
                        std::vector<std::size_t> const& pnt_offsets);
-
-    void markUnusedPoints(std::string const& geo_name,
-                          std::vector<bool>& transfer_pnts) const;
 };
 }  // namespace GeoLib
-- 
GitLab