From 851a39d12343c2635e505d6adb1143c6b893a908 Mon Sep 17 00:00:00 2001 From: rinkk <karsten.rink@ufz.de> Date: Thu, 23 Jun 2016 13:45:07 +0200 Subject: [PATCH] fixed issue for point names got lost when merging or saving geometries --- GeoLib/PointVec.cpp | 6 ++++++ GeoLib/PointVec.h | 2 ++ GeoLib/TemplateVec.h | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/GeoLib/PointVec.cpp b/GeoLib/PointVec.cpp index 169a4eb713f..a7d9d7f5e2b 100644 --- a/GeoLib/PointVec.cpp +++ b/GeoLib/PointVec.cpp @@ -243,4 +243,10 @@ std::string const& PointVec::getItemNameByID(std::size_t id) const return _id_to_name_map[id]; } +void PointVec::setNameForElement(std::size_t id, std::string const& name) +{ + TemplateVec::setNameForElement(id, name); + _id_to_name_map[id] = name; +} + } // end namespace diff --git a/GeoLib/PointVec.h b/GeoLib/PointVec.h index fa359ebe397..510114f5952 100644 --- a/GeoLib/PointVec.h +++ b/GeoLib/PointVec.h @@ -101,6 +101,8 @@ public: std::string const& getItemNameByID(std::size_t id) const; + void setNameForElement(std::size_t id, std::string const& name) override; + private: /** * After the point set is modified (for example by makePntsUnique()) the mapping has to be corrected. diff --git a/GeoLib/TemplateVec.h b/GeoLib/TemplateVec.h index 6e9e98a7ddd..11f50cb835e 100644 --- a/GeoLib/TemplateVec.h +++ b/GeoLib/TemplateVec.h @@ -195,7 +195,7 @@ public: } /// Sets the given name for the element of the given ID. - void setNameForElement(std::size_t id, std::string const& name) + virtual void setNameForElement(std::size_t id, std::string const& name) { // Erase id if found in map. auto it = findFirstElementByID(id); -- GitLab