OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
surface_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-2020 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_SURFACE_HANDLE_HL
20 #define OST_SURFACE_HANDLE_HL
21 
22 #include <vector>
23 
24 #include <ost/mol/surface_prop.hh>
26 
27 namespace ost { namespace mol {
28 
29 class SurfaceHandle;
30 class EntityView;
31 
32 // Create a non-managed surface
33 DLLEXPORT_OST_MOL SurfaceHandle CreateSurface();
34 
35 typedef std::vector<SurfaceTriID> SurfaceTriIDList;
36 typedef std::vector<SurfaceVertexID> SurfaceVertexIDList;
37 
38 // molecular surface
40 public:
41  // creates invalid handle
42  SurfaceHandle();
43 
44  // internally used ctor
46 
47  // associate each vertex with the closest atom from the given entity,
48  // but only if an atom is actually within 'cutoff' distance
49  void Attach(const EntityHandle& eh, Real cutoff);
50 
51  // dito for view
52  void Attach(const EntityView& ev, Real cutoff);
53 
54  SurfaceVertexList FindWithin(const geom::Vec3&, Real dist) const;
55 
56  // returns unique id
57  SurfaceVertexID AddVertex(const SurfaceVertex& v);
58 
59  // retrieve vertex based on id
60  SurfaceVertex GetVertex(SurfaceVertexID id) const;
61 
62  // assigns face based on id
64 
65  SurfaceTri GetTri(SurfaceTriID id) const;
66 
67  SurfaceVertexIDList GetVertexIDList() const;
68  SurfaceTriIDList GetTriIDList() const;
69 
70  // flip normals
71  void Invert();
72 
73  bool IsValid() const {return static_cast<bool>(impl_);}
74 
75  bool operator==(const SurfaceHandle& ref) const { return impl_==ref.impl_; }
76 
77  bool operator!=(const SurfaceHandle& ref) const { return !this->operator==(ref); }
78 
79 private:
80  impl::SurfaceImplP impl_;
81 
82 };
83 
84 DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os,
85  const SurfaceHandle& surf);
86 
87 typedef std::vector<SurfaceHandle> SurfaceHandleList;
88 
89 }} // ns
90 
91 #endif
std::vector< SurfaceVertex > SurfaceVertexList
Definition: surface_prop.hh:65
boost::shared_ptr< SurfaceImpl > SurfaceImplP
Mat2 DLLEXPORT_OST_GEOM Invert(const Mat2 &m)
Matrix inversion.
float Real
Definition: base.hh:44
Protein or molecule.
DLLEXPORT_OST_MOL SurfaceHandle CreateSurface()
bool DLLEXPORT_OST_GEOM operator==(const Line2 &l1, const Line2 &l2)
DLLEXPORT_OST_MOL std::ostream & operator<<(std::ostream &os, const AtomBase &atom)
bool operator!=(const SurfaceHandle &ref) const
std::vector< SurfaceVertexID > SurfaceVertexIDList
unsigned int SurfaceVertexID
Definition: surface_prop.hh:56
Three dimensional vector class, using Real precision.
Definition: vec3.hh:43
#define DLLEXPORT_OST_MOL
std::vector< SurfaceHandle > SurfaceHandleList
bool operator==(const SurfaceHandle &ref) const
definition of EntityView
Definition: entity_view.hh:86
std::vector< SurfaceTriID > SurfaceTriIDList
unsigned int SurfaceTriID
Definition: surface_prop.hh:63