00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_ENTITY_VIEW_HN
00020 #define OST_ENTITY_VIEW_HN
00021
00022
00023
00024 #include <ost/mol/module_config.hh>
00025
00026 #include <ost/mol/residue_prop.hh>
00027 #include <ost/mol/entity_base.hh>
00028 #include <ost/mol/view_type_fw.hh>
00029 #include <ost/mol/impl/entity_impl_fw.hh>
00030 #include <ost/mol/entity_visitor_fw.hh>
00031 #include <ost/mol/handle_type_fw.hh>
00032 #include <ost/mol/query.hh>
00033 #include <ost/mol/property_id.hh>
00034 #include <ost/geom/geom.hh>
00035
00036 #ifdef _MSC_VER
00037 # ifdef FindAtom
00038 # undef FindAtom
00039 # endif
00040 # ifdef AddAtom
00041 # undef AddAtom
00042 # endif
00043 #endif
00044
00045 namespace ost { namespace mol {
00046
00086 class DLLEXPORT_OST_MOL EntityView: public EntityBase {
00087 friend class AtomView;
00088 friend class ResidueView;
00089 public:
00090 EntityView();
00095 explicit EntityView(const EntityHandle& entity,
00096 ViewAddFlags flags=0);
00097
00099
00100
00101
00102
00103
00104
00105
00106 operator bool() const { return this->IsValid(); }
00109 bool IsValid() const { return data_.get()!=0; }
00111
00112 Real GetMass() const;
00113
00115 geom::Vec3 GetCenterOfMass() const;
00116
00121 geom::Vec3 GetCenterOfAtoms() const;
00122
00123 geom::AlignedCuboid GetBounds() const;
00124
00125 public:
00127
00128
00129 EntityView(const EntityViewDataPtr& data,
00130 const impl::EntityImplPtr impl);
00131
00133 const EntityViewDataPtr& ViewData() const;
00135 EntityViewDataPtr& ViewData();
00137 public:
00141 EntityView Copy() const;
00151 ChainView AddChain(const ChainHandle& chain_handle,
00152 ViewAddFlags flags=0);
00153
00163 ChainView AddChain(const ChainView& chain_view,
00164 ViewAddFlags flags=0);
00165
00174 ResidueView AddResidue(const ResidueHandle& residue_handle,
00175 ViewAddFlags flags=0);
00183 ResidueView AddResidue(const ResidueView& residue_view,
00184 ViewAddFlags flags=0);
00194 AtomView AddAtom(const AtomHandle& atom_handle,
00195 ViewAddFlags flags=0);
00196
00197 AtomView AddAtom(const AtomView& atom_view,
00198 ViewAddFlags flags=0);
00201 EntityView Select(const String& query_string, QueryFlags flags=0) const;
00202
00205 EntityView Select(const Query& query, QueryFlags flags=0) const;
00206
00208 bool AddBond(const BondHandle& bond_handle);
00209
00211 int GetAtomCount() const;
00212
00214 int GetResidueCount() const;
00215
00217 int GetChainCount() const;
00218
00220 ChainView FindChain(const String& chain_name) const;
00221
00225 ResidueView FindResidue(const ResidueHandle& residue) const;
00226
00227 ResidueView FindResidue(const String& chain, const ResNum& num) const;
00228
00233 ResidueView ViewForHandle(const ResidueHandle& residue) const;
00237 AtomView FindAtom(const AtomHandle& atom) const;
00238 AtomView ViewForHandle(const AtomHandle& atom) const;
00239
00244 AtomView FindAtom(const String& chain_name, const ResNum& num,
00245 const String& atom_name) const;
00249
00250 ChainView FindChain(const ChainHandle& chain) const;
00255 ChainView ViewForHandle(const ChainHandle& chain) const;
00258 bool IsChainIncluded(const ChainHandle& chain) const;
00259
00261 void RemoveAtom(AtomView view);
00262
00264 void RemoveResidue(ResidueView view);
00265
00267 void RemoveChain(ChainView view);
00268
00271 void AddAllInclusiveBonds();
00272
00273 const BondHandleList& GetBondList() const;
00274
00276 AtomViewList FindWithin(const geom::Vec3& center, Real radius) const;
00277
00279 int GetBondCount() const;
00280
00281 const ChainViewList& GetChainList() const;
00282
00284 ResidueViewList GetResidueList() const;
00285
00287 AtomViewList GetAtomList() const;
00288
00290 void Apply(EntityVisitor& visitor);
00291
00293 void Apply(EntityViewVisitor& visitor);
00294
00296 EntityHandle GetHandle() const;
00297
00299 std::pair<Real,Real> GetMinMax(const String& prop,
00300 Prop::Level hint=Prop::UNSPECIFIED) const;
00301
00303 Real GetAngle(const AtomHandle& a1, const AtomHandle& a2,
00304 const AtomHandle& a3) const;
00305
00307 Real GetAngle(const AtomView& a1, const AtomView& a2,
00308 const AtomView& a3) const;
00309
00312 EntityView ExtendViewToResidues() const;
00313
00318 EntityView ExtendViewToSurrounding(Real gap) const;
00319
00322 String Dump() const;
00326 EntityView CreateFullView() const;
00328 EntityView CreateEmptyView() const;
00329
00331 bool HasAtoms() const;
00332 #ifdef _MSC_VER
00333
00334 AtomView AddXAtom(const AtomHandle& ah, ViewAddFlags flags=0);
00335 AtomView FindXAtom(const AtomHandle& ah);
00336 #endif
00337 void RemoveBond(const BondHandle& bond);
00338 protected:
00340 void AddAtomInternal(const AtomView& av);
00341 void RemoveAtomInternal(const AtomView& av);
00342
00343 private:
00344
00345
00346 EntityViewDataPtr data_;
00347 };
00348
00349 typedef std::pair<EntityView, EntityView> EntityViewPair;
00350
00351 }}
00352
00353 #endif // OST_ENTITY_VIEW_HH
00354