Visualization Library 2.0.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  unsigned int id() const { return mId; }
74  void setId(unsigned int id) { mId = id; }
75 
76  void setBondType(EBondType type) { mType = type; }
77  EBondType bondType() const { return mType; }
78 
79  void setAtom1( Atom* atom ) { mAtom1 = atom; }
80  Atom* atom1() const { return mAtom1; }
81 
82  void setAtom2( Atom* atom ) { mAtom2 = atom; }
83  Atom* atom2() const { return mAtom2; }
84 
85  void setVisible(bool visible) { mVisible = visible; }
86  bool visible() const { return mVisible; }
87 
88  void setColor(const fvec4& color) { mColor = color; }
89  const fvec4& color() const { return mColor; }
90 
91  void setUseAtomColors(bool use_atom_color) { mUseAtomColors = use_atom_color; }
92  bool useAtomColors() const { return mUseAtomColors; }
93 
94  float radius() const { return mRadius; }
95  void setRadius(float radius) { mRadius = radius; }
96 
97  protected:
99  float mRadius;
102  EBondType mType;
103  unsigned int mId;
104  bool mVisible;
106  };
107 }
108 
109 #endif
bool visible() const
Definition: Bond.hpp:86
void setVisible(bool visible)
Definition: Bond.hpp:85
void setAtom1(Atom *atom)
Definition: Bond.hpp:79
void setBondType(EBondType type)
Definition: Bond.hpp:76
void setId(unsigned int id)
Definition: Bond.hpp:74
Atom * mAtom1
Definition: Bond.hpp:100
unsigned int mId
Definition: Bond.hpp:103
bool useAtomColors() const
Definition: Bond.hpp:92
Atom * atom2() const
Definition: Bond.hpp:83
Atom * mAtom2
Definition: Bond.hpp:101
Atom * atom1() const
Definition: Bond.hpp:80
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
fvec4 mColor
Definition: Bond.hpp:98
void setColor(const fvec4 &color)
Definition: Bond.hpp:88
Visualization Library main namespace.
Bond(const Bond &other)
Definition: Bond.hpp:71
void setUseAtomColors(bool use_atom_color)
Definition: Bond.hpp:91
EBondType bondType() const
Definition: Bond.hpp:77
The base class for all the reference counted objects.
Definition: Object.hpp:158
void setAtom2(Atom *atom)
Definition: Bond.hpp:82
void setRadius(float radius)
Definition: Bond.hpp:95
#define NULL
Definition: OpenGLDefs.hpp:81
bool mUseAtomColors
Definition: Bond.hpp:105
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:73
float mRadius
Definition: Bond.hpp:99
The Atom class represents an atom to be used with the Molecule class.
Definition: Atom.hpp:51
EBondType mType
Definition: Bond.hpp:102
bool mVisible
Definition: Bond.hpp:104
const fvec4 & color() const
Definition: Bond.hpp:89
Bond()
Definition: Bond.hpp:67
float radius() const
Definition: Bond.hpp:94