From 450a9eb71c84cb0a5c4b0cb21f6154c89b51b6f2 Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Fri, 1 Oct 2010 10:34:46 +0200
Subject: [PATCH] added RenameAtom method to EditorBase

---
 modules/mol/base/src/editor_base.cc | 8 +++++++-
 modules/mol/base/src/editor_base.hh | 3 +++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/mol/base/src/editor_base.cc b/modules/mol/base/src/editor_base.cc
index 410e1b03b..022109e06 100644
--- a/modules/mol/base/src/editor_base.cc
+++ b/modules/mol/base/src/editor_base.cc
@@ -22,7 +22,7 @@
 #include "impl/entity_impl.hh"
 #include "impl/chain_impl.hh"
 #include "impl/residue_impl.hh"
-
+#include "impl/atom_impl.hh"
 #include "mol.hh"
 
 /*
@@ -125,6 +125,12 @@ void EditorBase::DeleteResidue(const ResidueHandle& residue_handle)
   residue_handle.GetChain().Impl()->DeleteResidue(residue_handle.Impl());
 }
 
+void EditorBase::RenameAtom(AtomHandle atom, const String& new_name)
+{
+  CheckHandleValidity(atom);
+  atom.Impl()->SetName(new_name);
+}
+
 BondHandle EditorBase::Connect(const AtomHandle& first,
                                  const AtomHandle& second) {
   CheckHandleValidity(first);
diff --git a/modules/mol/base/src/editor_base.hh b/modules/mol/base/src/editor_base.hh
index 110c6b668..4a1ab915a 100644
--- a/modules/mol/base/src/editor_base.hh
+++ b/modules/mol/base/src/editor_base.hh
@@ -187,6 +187,9 @@ public:
     
   /// \brief Get edit mode of editor
   EditMode GetMode() const;
+  
+  /// \brief change the name of the atom to the new name  
+  void RenameAtom(AtomHandle atom, const String& new_name);
 protected:
   EditorBase(const EntityHandle& ent, EditMode mode);
   void UpdateTrace();
-- 
GitLab