From 70ed0b5761ed3c549f15fb5eb33f1bb956fcec15 Mon Sep 17 00:00:00 2001
From: rinkk <karsten.rink@ufz.de>
Date: Tue, 26 Feb 2019 15:38:06 +0100
Subject: [PATCH] fixed issue overwriting vector name

---
 Applications/DataExplorer/mainwindow.cpp | 4 ++--
 GeoLib/GEOObjects.cpp                    | 7 +++----
 GeoLib/GEOObjects.h                      | 6 +++---
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp
index 40301224b46..ea4f79a776a 100644
--- a/Applications/DataExplorer/mainwindow.cpp
+++ b/Applications/DataExplorer/mainwindow.cpp
@@ -1101,8 +1101,8 @@ void MainWindow::showMeshAnalysisDialog()
 
 void MainWindow::convertPointsToStations(std::string const& geo_name)
 {
-    std::string const stn_name = geo_name + "Stations";
-    int ret = _project.getGEOObjects().geoPointsToStation(geo_name, stn_name);
+    std::string stn_name = geo_name + " Stations";
+    int ret = _project.getGEOObjects().geoPointsToStations(geo_name, stn_name);
     if (ret == 1)
         OGSError::box("No points found to convert.");
 }
diff --git a/GeoLib/GEOObjects.cpp b/GeoLib/GEOObjects.cpp
index a0ec2474587..1ca37464f2e 100644
--- a/GeoLib/GEOObjects.cpp
+++ b/GeoLib/GEOObjects.cpp
@@ -587,8 +587,8 @@ void GEOObjects::markUnusedPoints(std::string const& geo_name,
     }
 }
 
-int GEOObjects::geoPointsToStation(std::string const& geo_name,
-                                    std::string const& stn_name,
+int GEOObjects::geoPointsToStations(std::string const& geo_name,
+                                    std::string& stn_name,
                                     bool const only_unused_pnts)
 {
     GeoLib::PointVec const* const pnt_obj(getPointVecObj(geo_name));
@@ -618,9 +618,8 @@ int GEOObjects::geoPointsToStation(std::string const& geo_name,
             name = "Station " + std::to_string(i);
         stations->push_back(new GeoLib::Station(pnts[i], name));
     }
-    std::string vec_name = geo_name + " stations";
     if (!stations->empty())
-        addStationVec(std::move(stations), vec_name);
+        addStationVec(std::move(stations), stn_name);
     else
     {
         WARN("No points found to convert.");
diff --git a/GeoLib/GEOObjects.h b/GeoLib/GEOObjects.h
index b378a914475..a3a9779bc83 100644
--- a/GeoLib/GEOObjects.h
+++ b/GeoLib/GEOObjects.h
@@ -254,9 +254,9 @@ public:
     // @param stn_name name of the new station vector
     // @param only_usused_pnts if true only points not in a line or surface are
     // transferred, otherwise all points
-    int geoPointsToStation(std::string const& geo_name,
-                           std::string const& stn_name,
-                           bool const only_unused_pnts = true);
+    int geoPointsToStations(std::string const& geo_name,
+                            std::string& stn_name,
+                            bool const only_unused_pnts = true);
 
     /// Returns the geo object for a geometric item of the given name and type for the associated geometry.
     const GeoLib::GeoObject* getGeoObject(const std::string &geo_name,
-- 
GitLab