Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Bond.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef Bond_INCLUDE_ONCE
33 #define Bond_INCLUDE_ONCE
34 
35 #include <vlCore/Object.hpp>
36 
37 namespace vl
38 {
39  class Atom;
40 
42  typedef enum
43  {
52  } EBondType;
53 
62  class Bond: public Object
63  {
65 
66  public:
67  Bond(): mColor( 1.0f,1.0f,1.0f,1.0f ), mRadius(0.10f), mAtom1(NULL), mAtom2(NULL), mType(BT_Single), mId(0), mVisible(true), mUseAtomColors(true)
68  {
69  VL_DEBUG_SET_OBJECT_NAME()
70  }
71  Bond(const Bond& other): Object(other) { *this = other; }
72 
73  Bond& operator=(const Bond& other) = default;
74 
75  unsigned int id() const { return mId; }
76  void setId(unsigned int id) { mId = id; }
77 
78  void setBondType(EBondType type) { mType = type; }
79  EBondType bondType() const { return mType; }
80 
81  void setAtom1( Atom* atom ) { mAtom1 = atom; }
82  Atom* atom1() const { return mAtom1; }
83 
84  void setAtom2( Atom* atom ) { mAtom2 = atom; }
85  Atom* atom2() const { return mAtom2; }
86 
87  void setVisible(bool visible) { mVisible = visible; }
88  bool visible() const { return mVisible; }
89 
90  void setColor(const fvec4& color) { mColor = color; }
91  const fvec4& color() const { return mColor; }
92 
93  void setUseAtomColors(bool use_atom_color) { mUseAtomColors = use_atom_color; }
94  bool useAtomColors() const { return mUseAtomColors; }
95 
96  float radius() const { return mRadius; }
97  void setRadius(float radius) { mRadius = radius; }
98 
99  protected:
101  float mRadius;
104  EBondType mType;
105  unsigned int mId;
106  bool mVisible;
108  };
109 }
110 
111 #endif
bool visible() const
Definition: Bond.hpp:88
void setVisible(bool visible)
Definition: Bond.hpp:87
void setAtom1(Atom *atom)
Definition: Bond.hpp:81
void setBondType(EBondType type)
Definition: Bond.hpp:78
void setId(unsigned int id)
Definition: Bond.hpp:76
Atom * mAtom1
Definition: Bond.hpp:102
unsigned int mId
Definition: Bond.hpp:105
bool useAtomColors() const
Definition: Bond.hpp:94
Atom * atom2() const
Definition: Bond.hpp:85
Atom * mAtom2
Definition: Bond.hpp:103
Atom * atom1() const
Definition: Bond.hpp:82
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
fvec4 mColor
Definition: Bond.hpp:100
void setColor(const fvec4 &color)
Definition: Bond.hpp:90
Visualization Library main namespace.
Bond(const Bond &other)
Definition: Bond.hpp:71
void setUseAtomColors(bool use_atom_color)
Definition: Bond.hpp:93
EBondType bondType() const
Definition: Bond.hpp:79
The base class for all the reference counted objects.
Definition: Object.hpp:158
void setAtom2(Atom *atom)
Definition: Bond.hpp:84
void setRadius(float radius)
Definition: Bond.hpp:97
#define NULL
Definition: OpenGLDefs.hpp:81
bool mUseAtomColors
Definition: Bond.hpp:107
EBondType
Bond types.
Definition: Bond.hpp:42
The Bond class represents a bond to be used with the Molecule class.
Definition: Bond.hpp:62
unsigned int id() const
Definition: Bond.hpp:75
float mRadius
Definition: Bond.hpp:101
The Atom class represents an atom to be used with the Molecule class.
Definition: Atom.hpp:51
EBondType mType
Definition: Bond.hpp:104
bool mVisible
Definition: Bond.hpp:106
const fvec4 & color() const
Definition: Bond.hpp:91
Bond & operator=(const Bond &other)=default
Bond()
Definition: Bond.hpp:67
float radius() const
Definition: Bond.hpp:96