OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
editor_base.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_EDITOR_BASE_HS
20 #define OST_EDITOR_BASE_HS
21 /*
22  Author: Marco Biasini
23  */
24 
25 #include <ost/mol/module_config.hh>
26 
27 #include <ost/geom/geom.hh>
28 
29 #include "entity_handle.hh"
30 #include "residue_prop.hh"
31 #include "editor_type_fw.hh"
32 
33 namespace ost { namespace mol {
34 
47 public:
58  ChainHandle InsertChain(const String& chain_name);
59 
75  ResidueHandle AppendResidue(ChainHandle chain, const ResidueKey& k);
76 
77  ResidueHandle AppendResidue(ChainHandle chain, const ResidueKey& k,
78  const ResNum& num);
94  ResidueHandle InsertResidueBefore(ChainHandle chain, int index,
95  const ResNum& num,
96  const ResidueKey& k);
102  ResidueHandle InsertResidueAfter(ChainHandle chain, int index,
103  const ResNum& num,
104  const ResidueKey& k);
105 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118  AtomHandle InsertAtom(ResidueHandle residue, const String& name,
119  const geom::Vec3& pos, const String& ele="",
120  Real occupancy=1.0, Real b_factor=0.0,
121  bool is_hetatm=false);
122 
125  AtomHandle InsertAltAtom(ResidueHandle residue, const String& name,
126  const String& alt_group, const geom::Vec3& pos,
127  const String& ele="", Real occ=1.0,
128  Real b_factor=0.0);
139  void AddAltAtomPos(const String& group, const AtomHandle& atom,
140  const geom::Vec3& position, Real occ=1.0,
141  Real b_factor=0.0);
142  //\}
143 
148  BondHandle Connect(const AtomHandle& first, const AtomHandle& second);
149  BondHandle Connect(const AtomHandle& first, const AtomHandle& second,
150  unsigned char bond_order);
151  BondHandle Connect(const AtomHandle& first, const AtomHandle& second,
152  Real len, Real theta, Real phi);
153  BondHandle Connect(const AtomHandle& first, const AtomHandle& second,
154  Real len, Real theta, Real phi,
155  unsigned char bond_order);
156 
157  void RenameResidue(ResidueHandle res, const String& new_name);
158 
159  void SetResidueNumber(ResidueHandle res, const ResNum& num);
160 
161  void RenameChain(ChainHandle chain, const String& new_name);
162 
167  void SetChainType(ChainHandle chain, const ChainType type);
168 
173  void SetChainDescription(ChainHandle chain, const String desc);
174 
178  void DeleteAllAtoms(ResidueHandle res);
179 
187  void DeleteAtom(const AtomHandle& atom);
188 
190  TorsionHandle AddTorsion(const String& name, const AtomHandle& a1,
191  const AtomHandle& a2, const AtomHandle& a3,
192  const AtomHandle& a4);
196  void DeleteChain(const ChainHandle& chain);
197 
203  void DeleteResidue(const ResidueHandle& residue_handle);
204 
206  void ReorderResidues(const ChainHandle& chain);
207 
209  void ReorderAllResidues();
210 
220  void RenumberAllResidues(int start, bool keep_spacing);
221 
223  EditMode GetMode() const {return mode_;}
224 
226  EntityHandle GetEntity() const {return ent_;}
227 
229  void RenameAtom(AtomHandle atom, const String& new_name);
230 protected:
231  EditorBase(const EntityHandle& ent, EditMode mode);
232  void UpdateTrace();
235 };
236 
237 }} //ns
238 
239 #endif