OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
entity_handle.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_ENTITY_HANDLE_HH
20 #define OST_ENTITY_HANDLE_HH
21 
22 #include <ost/mol/module_config.hh>
23 
24 #include "impl/entity_impl_fw.hh"
25 #include "entity_visitor_fw.hh"
26 #include "query.hh"
27 #include "entity_observer_fw.hh"
28 #include "residue_prop.hh"
29 #include "entity_view.hh"
30 #include "chain_handle.hh"
31 #include "handle_type_fw.hh"
32 #include "iterator_fw.hh"
33 
34 
35 #include "editor_type_fw.hh"
36 
37 namespace ost { namespace mol {
38 
41 DLLEXPORT_OST_MOL EntityHandle CreateEntity();
42 
56 public:
57  friend class XCSEditor;
58  friend class ICSEditor;
59 
62 
64  EntityHandle();
65 
66 
68 
69 
70 
71  EntityHandle Copy() const;
72 
73 
74 
76 
77 
78 
79 
80 
81  geom::Vec3 GetCenterOfAtoms() const;
82 
84  Real GetMass() const;
85 
87  geom::Vec3 GetCenterOfMass() const;
88 
89  geom::AlignedCuboid GetBounds() const;
91 
94  void Swap(EntityHandle& eh);
95 
98  void DeepSwap(EntityHandle& eh);
99 
101 
102 
103  void AttachObserver(const EntityObserverPtr&);
104 
105 
107  void DetachObserver(const EntityObserverPtr&);
109 
110 
112  void Apply(EntityVisitor& v);
113 
114 
122  TorsionHandle FindTorsion(const AtomHandle& a1, const AtomHandle& a2,
123  const AtomHandle& a3, const AtomHandle& a4) const;
124 
126  ChainHandleList GetChainList() const;
127 
133  ResidueHandleIter ResiduesBegin() const;
134 
146  ResidueHandleIter ResiduesEnd() const;
147 
149  ChainHandleIter ChainsBegin() const;
150 
152  ChainHandleIter ChainsEnd() const;
153 
155  AtomHandleIter AtomsBegin() const;
156 
158  AtomHandleIter AtomsEnd() const;
159 
161 
162 
163 
164 
165 
166 
167 
168  ChainHandle FindChain(const String& name) const;
169 
185  ResidueHandle FindResidue(const String& chain_name,
186  const ResNum& number) const;
187 
195  AtomHandle FindAtom(const String& chain_name,
196  const ResNum& number,
197  const String& atom_name) const;
199 
201  AtomHandleList FindWithin(const geom::Vec3& pos, Real radius) const;
202 
206  void SetDefaultQueryFlags(QueryFlags flags);
207 
209  QueryFlags GetDefaultQueryFlags() const;
210 
214  EntityView Select(const Query& q) const;
215 
219  EntityView Select(const String& query_string) const;
220 
223  EntityView Select(const Query& q, QueryFlags flags) const;
224 
227  EntityView Select(const String& query_string, QueryFlags flags) const;
228 
230  EntityView CreateFullView() const;
231 
233  EntityView CreateEmptyView() const;
234 
240  int GetAtomCount() const;
241 
247  int GetResidueCount() const;
248 
250  int GetChainCount() const;
251 
253  int GetBondCount() const;
254 
256  mol::BondHandleList GetBondList() const;
257 
258 
260  Real GetAngle(const AtomHandle& a1, const AtomHandle& a2,
261  const AtomHandle& a3) const;
262 
264  Real GetAngle(const AtomView& a1, const AtomView& a2,
265  const AtomView& a3) const;
266 
268  geom::Mat4 GetTransformationMatrix() const;
270  geom::Mat4 GetInvTransformationMatrix() const;
272  bool IsTransformationIdentity() const;
273 
275  geom::Transform GetTransform() const;
277  void SetTransform(const geom::Transform& t);
279  bool HasTransform() const;
281  void ClearTransform();
282 
285  ResidueHandleList GetResidueList() const;
286 
289  AtomHandleList GetAtomList() const;
290 
292  geom::Vec3List GetAtomPosList(bool ordered_by_index = false) const;
293 
297  XCSEditor EditXCS(EditMode mode=UNBUFFERED_EDIT) const;
298 
302  ICSEditor EditICS(EditMode mode=UNBUFFERED_EDIT) const;
303 
307  EntityHandle GetHandle() const;
308  bool operator==(const EntityHandle& ref) const;
309  bool operator!=(const EntityHandle& ref) const;
310 };
311 
312 }}
313 
314 #endif // OST_ENTITY_HANDLE_HH
315