OpenStructure
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
34 
35 typedef std::vector<SurfaceTriID> SurfaceTriIDList;
36 typedef std::vector<SurfaceVertexID> SurfaceVertexIDList;
37 
38 // molecular surface
40 public:
41  // creates invalid handle
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 
55 
56  // returns unique id
58 
59  // retrieve vertex based on id
61 
62  // assigns face based on id
64 
66 
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
Three dimensional vector class, using Real precision.
Definition: vec3.hh:48
Protein or molecule.
definition of EntityView
Definition: entity_view.hh:86
bool operator==(const SurfaceHandle &ref) const
SurfaceVertexIDList GetVertexIDList() const
bool operator!=(const SurfaceHandle &ref) const
SurfaceTri GetTri(SurfaceTriID id) const
SurfaceTriIDList GetTriIDList() const
void Attach(const EntityHandle &eh, Real cutoff)
SurfaceVertexID AddVertex(const SurfaceVertex &v)
SurfaceVertexList FindWithin(const geom::Vec3 &, Real dist) const
void Attach(const EntityView &ev, Real cutoff)
SurfaceVertex GetVertex(SurfaceVertexID id) const
SurfaceHandle(const impl::SurfaceImplP &p)
SurfaceTriID AddTri(SurfaceVertexID v0, SurfaceVertexID v1, SurfaceVertexID v2)
float Real
Definition: base.hh:44
#define DLLEXPORT_OST_MOL
bool DLLEXPORT_OST_GEOM operator==(const Line2 &l1, const Line2 &l2)
boost::shared_ptr< SurfaceImpl > SurfaceImplP
std::vector< SurfaceVertexID > SurfaceVertexIDList
std::vector< SurfaceHandle > SurfaceHandleList
std::vector< SurfaceTriID > SurfaceTriIDList
unsigned int SurfaceVertexID
Definition: surface_prop.hh:56
std::vector< SurfaceVertex > SurfaceVertexList
Definition: surface_prop.hh:65
DLLEXPORT_OST_MOL SurfaceHandle CreateSurface()
unsigned int SurfaceTriID
Definition: surface_prop.hh:63
DLLEXPORT_OST_MOL std::ostream & operator<<(std::ostream &os, const AtomBase &atom)
Definition: base.dox:1