OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
residue_view.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_RESIDUE_VIEW_HH
20 #define OST_RESIDUE_VIEW_HH
21 
22 #include <ost/mol/query.hh>
23 #include <ost/mol/module_config.hh>
24 #include <ost/geom/geom.hh>
25 #include <ost/mol/residue_base.hh>
26 #include <ost/mol/view_type_fw.hh>
30 
31 namespace ost { namespace mol {
32 
40 
41  friend class ChainView;
42 
43 public:
45  ResidueView();
46 
52  ResidueView(const ChainView& chain,
53  const ResidueHandle& residue);
54 
55 public:
56 
58 
59  operator bool() const { return this->IsValid(); }
68  bool IsValid() const { return data_.get()!=0; }
70 
72 
73  ResidueView(const ResidueViewDataPtr& data,
77  const impl::ResidueImplPtr& impl);
78 
80  const ResidueViewDataPtr& ViewData() const {
81  return data_;
82  }
85  return data_;
86  }
88 public:
90 
91  AtomView AddAtom(const AtomView& atom_view,
102  ViewAddFlags flags=0);
103 
113  AtomView AddAtom(const AtomHandle& atom_handle,
114  ViewAddFlags flags=0);
116 
118  AtomView FindAtom(const String& atom_name) const;
119 
121  AtomView ViewForHandle(const AtomHandle& handle) const;
122  AtomView FindAtom(const AtomHandle& handle) const;
123 
125  bool IsAtomIncluded(const AtomHandle& handle) const;
126 
130  void RemoveAtom(AtomView view);
131 
136  void RemoveAtoms();
137 
139  void Apply(EntityVisitor& visitor);
140  void Apply(EntityViewVisitor& visitor);
141 
143  int GetAtomCount() const;
144 
146  const AtomViewList& GetAtomList() const;
147 
149  ResidueHandle GetHandle() const;
150 
152  EntityView GetEntity() const;
153 
155  int GetIndex() const;
157  ChainView GetChain() const;
158 
160  double GetMass() const;
161 
163  geom::Vec3 GetCenterOfMass() const;
164 
169  geom::Vec3 GetCenterOfAtoms() const;
170 
172  geom::AlignedCuboid GetBounds() const;
173 
176  EntityView Select(const Query& q, QueryFlags flags=0) const;
177 
180  EntityView Select(const String& query_string, QueryFlags flags=0) const;
181 
182  bool operator==(const ResidueView& rhs) const;
183 
184  bool operator!=(const ResidueView& rhs) const;
185 
186  bool HasAtoms() const;
187 protected:
190  void SetIndex(int index);
191 
192 private:
193  ResidueViewDataPtr data_;
194 };
195 
196 }} // ns
197 
198 #endif // OST_RESIDUE_VIEW_HH
199 
bool IsValid() const
check validity of handle
Definition: residue_view.hh:68
ResidueViewDataPtr & ViewData()
Get internal view data.
Definition: residue_view.hh:84
std::string String
Definition: base.hh:54
Handle to atom datatype.
Definition: atom_handle.hh:37
const ResidueViewDataPtr & ViewData() const
Get internal view data.
Definition: residue_view.hh:80
axis-aligned cuboid
boost::shared_ptr< ResidueImpl > ResidueImplPtr
bool DLLEXPORT_OST_GEOM operator==(const Line2 &l1, const Line2 &l2)
DLLEXPORT_OST_IMG_BASE bool operator!=(const ImageHandle &lhs, const ConstImageHandle &rhs)
EntityVisitor interface.
Selection Query.
Definition: query.hh:74
void RemoveAtoms(ost::mol::EntityHandle &ent, ost::conop::CompoundLibPtr lib, bool rm_unk_atoms, bool rm_non_std, bool rm_hyd_atoms, bool rm_oxt_atoms, bool rm_zero_occ_atoms, bool colored=true)
uint QueryFlags
Definition: query.hh:69
definition of ChainView
Definition: chain_view.hh:37
int ViewAddFlags
Definition: view_type_fw.hh:71
Three dimensional vector class, using Real precision.
Definition: vec3.hh:42
#define DLLEXPORT_OST_MOL
std::vector< AtomView > AtomViewList
Definition: view_type_fw.hh:31
definition of AtomView
Definition: atom_view.hh:34
EntityViewVisitor interface.
boost::shared_ptr< ResidueViewData > ResidueViewDataPtr
Definition: view_type_fw.hh:34
definition of EntityView
Definition: entity_view.hh:86
base class for ResidueHandle and ResidueView
Definition: residue_base.hh:65