VTK
vtkMolecule.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMolecule.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
71 #ifndef vtkMolecule_h
72 #define vtkMolecule_h
73 
74 #include "vtkCommonDataModelModule.h" // For export macro
75 #include "vtkUndirectedGraph.h"
76 
77 //BTX
78 #include "vtkAtom.h" // Simple proxy class dependent on vtkMolecule
79 #include "vtkBond.h" // Simple proxy class dependent on vtkMolecule
80 //ETX
81 #include "vtkVector.h" // Small templated vector convenience class
82 
83 class vtkPlane;
85 class vtkPoints;
87 
89 {
90 public:
91  static vtkMolecule *New();
93  void PrintSelf(ostream &os, vtkIndent indent);
94  virtual void Initialize();
95 
97  virtual int GetDataObjectType() {return VTK_MOLECULE;}
98 
99 //BTX
101 
104  {
105  return this->AppendAtom(0, vtkVector3f(0, 0, 0));
106  }
108 
111  vtkAtom AppendAtom(unsigned short atomicNumber, const vtkVector3f &pos);
112 
114 
116  vtkAtom AppendAtom(unsigned short atomicNumber, double x, double y, double z)
117  {
118  return this->AppendAtom(atomicNumber, vtkVector3f(x, y, z));
119  }
121 
123  vtkAtom GetAtom(vtkIdType atomId);
124 
126  vtkIdType GetNumberOfAtoms();
127 
129 
132  vtkBond AppendBond(vtkIdType atom1, vtkIdType atom2,
133  unsigned short order = 1);
134  vtkBond AppendBond(const vtkAtom &atom1, const vtkAtom &atom2,
135  unsigned short order = 1)
136  {
137  return this->AppendBond(atom1.Id, atom2.Id, order);
138  }
140 
142 
143  vtkBond GetBond(vtkIdType bondId);
144 //ETX
146 
148  vtkIdType GetNumberOfBonds();
149 
151  unsigned short GetAtomAtomicNumber(vtkIdType atomId);
152 
154 
155  void SetAtomAtomicNumber(vtkIdType atomId,
156  unsigned short atomicNum);
158 
160 
161  void SetAtomPosition(vtkIdType atomId, const vtkVector3f &pos);
162  void SetAtomPosition(vtkIdType atomId, double x, double y, double z);
164 
166 
167  vtkVector3f GetAtomPosition(vtkIdType atomId);
168  void GetAtomPosition(vtkIdType atomId, float pos[3]);
170 
172 
173  void SetBondOrder(vtkIdType bondId, unsigned short order);
174  unsigned short GetBondOrder(vtkIdType bondId);
176 
182  double GetBondLength(vtkIdType bondId);
183 
185 
186  vtkPoints * GetAtomicPositionArray();
187  vtkUnsignedShortArray * GetAtomicNumberArray();
189 
190 //BTX
192 
194  vtkGetObjectMacro(ElectronicData, vtkAbstractElectronicData);
195  virtual void SetElectronicData(vtkAbstractElectronicData*);
196 //ETX
198 
200  virtual void ShallowCopy(vtkDataObject *obj);
201 
203  virtual void DeepCopy(vtkDataObject *obj);
204 
206  virtual void ShallowCopyStructure(vtkMolecule *m);
207 
209  virtual void DeepCopyStructure(vtkMolecule *m);
210 
213  virtual void ShallowCopyAttributes(vtkMolecule *m);
214 
217  virtual void DeepCopyAttributes(vtkMolecule *m);
218 
220 
233  static bool GetPlaneFromBond(const vtkBond &bond, const vtkVector3f &normal,
234  vtkPlane *plane);
235  static bool GetPlaneFromBond(const vtkAtom &atom1, const vtkAtom &atom2,
236  const vtkVector3f &normal, vtkPlane *plane);
238 
239  protected:
240  vtkMolecule();
241  ~vtkMolecule();
242 
244  virtual void CopyStructureInternal(vtkMolecule *m, bool deep);
245 
247  virtual void CopyAttributesInternal(vtkMolecule *m, bool deep);
248 
250 
255  void SetBondListDirty() {this->BondListIsDirty = true;}
256  void UpdateBondList();
258 
259  friend class vtkAtom;
260  friend class vtkBond;
261 
263 
264 private:
265  vtkMolecule(const vtkMolecule&); // Not implemented.
266  void operator=(const vtkMolecule&); // Not implemented.
267 };
268 
269 #endif
virtual void ShallowCopy(vtkDataObject *obj)
vtkIdType Id
Definition: vtkAtom.h:66
class describing a molecule
Definition: vtkMolecule.h:88
virtual void DeepCopy(vtkDataObject *obj)
virtual int GetDataObjectType()
Definition: vtkMolecule.h:97
vtkBond AppendBond(const vtkAtom &atom1, const vtkAtom &atom2, unsigned short order=1)
Definition: vtkMolecule.h:134
An undirected graph.
void PrintSelf(ostream &os, vtkIndent indent)
int vtkIdType
Definition: vtkType.h:275
static vtkUndirectedGraph * New()
Provides access to and storage of chemical electronic data.
a simple class to control print indentation
Definition: vtkIndent.h:38
bool BondListIsDirty
Definition: vtkMolecule.h:254
perform various plane computations
Definition: vtkPlane.h:36
friend class vtkMolecule
Definition: vtkBond.h:67
void SetBondListDirty()
Definition: vtkMolecule.h:255
convenience proxy for vtkMolecule
Definition: vtkAtom.h:33
vtkAtom AppendAtom()
Definition: vtkMolecule.h:103
convenience proxy for vtkMolecule
Definition: vtkBond.h:32
#define VTK_MOLECULE
Definition: vtkType.h:99
vtkAtom AppendAtom(unsigned short atomicNumber, double x, double y, double z)
Definition: vtkMolecule.h:116
general representation of visualization data
Definition: vtkDataObject.h:64
#define VTKCOMMONDATAMODEL_EXPORT
virtual void Initialize()
represent and manipulate 3D points
Definition: vtkPoints.h:38
vtkAbstractElectronicData * ElectronicData
Definition: vtkMolecule.h:262
dynamic, self-adjusting array of unsigned short