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 "vtkUndirectedGraph.h"
75 
76 //BTX
77 #include "vtkAtom.h" // Simple proxy class dependent on vtkMolecule
78 #include "vtkBond.h" // Simple proxy class dependent on vtkMolecule
79 //ETX
80 #include "vtkVector.h" // Small templated vector convenience class
81 
82 class vtkPlane;
84 class vtkPoints;
86 
88 {
89 public:
90  static vtkMolecule *New();
92  void PrintSelf(ostream &os, vtkIndent indent);
93  virtual void Initialize();
94 
95 //BTX
97 
99  vtkAtom AppendAtom()
100  {
101  return this->AppendAtom(0, vtkVector3f(0, 0, 0));
102  }
104 
107  vtkAtom AppendAtom(unsigned short atomicNumber, const vtkVector3f &pos);
108 
110 
112  vtkAtom AppendAtom(unsigned short atomicNumber, double x, double y, double z)
113  {
114  return this->AppendAtom(atomicNumber, vtkVector3f(x, y, z));
115  }
117 
119  vtkAtom GetAtom(vtkIdType atomId);
120 
122  vtkIdType GetNumberOfAtoms();
123 
125 
128  vtkBond AppendBond(vtkIdType atom1, vtkIdType atom2,
129  unsigned short order = 1);
130  vtkBond AppendBond(const vtkAtom &atom1, const vtkAtom &atom2,
131  unsigned short order = 1)
132  {
133  return this->AppendBond(atom1.Id, atom2.Id, order);
134  }
136 
138 
139  vtkBond GetBond(vtkIdType bondId);
140 //ETX
142 
144  vtkIdType GetNumberOfBonds();
145 
147  unsigned short GetAtomAtomicNumber(vtkIdType atomId);
148 
150 
151  void SetAtomAtomicNumber(vtkIdType atomId,
152  unsigned short atomicNum);
154 
156 
157  void SetAtomPosition(vtkIdType atomId, const vtkVector3f &pos);
158  void SetAtomPosition(vtkIdType atomId, double x, double y, double z);
160 
162 
163  vtkVector3f GetAtomPosition(vtkIdType atomId);
164  void GetAtomPosition(vtkIdType atomId, float pos[3]);
166 
168 
169  void SetBondOrder(vtkIdType bondId, unsigned short order);
170  unsigned short GetBondOrder(vtkIdType bondId);
172 
178  double GetBondLength(vtkIdType bondId);
179 
181 
182  vtkPoints * GetAtomicPositionArray();
183  vtkUnsignedShortArray * GetAtomicNumberArray();
185 
186 //BTX
188 
190  vtkGetObjectMacro(ElectronicData, vtkAbstractElectronicData);
191  virtual void SetElectronicData(vtkAbstractElectronicData*);
192 //ETX
194 
196  virtual void ShallowCopy(vtkDataObject *obj);
197 
199  virtual void DeepCopy(vtkDataObject *obj);
200 
202  virtual void ShallowCopyStructure(vtkMolecule *m);
203 
205  virtual void DeepCopyStructure(vtkMolecule *m);
206 
209  virtual void ShallowCopyAttributes(vtkMolecule *m);
210 
213  virtual void DeepCopyAttributes(vtkMolecule *m);
214 
216 
229  static bool GetPlaneFromBond(const vtkBond &bond, const vtkVector3f &normal,
230  vtkPlane *plane);
231  static bool GetPlaneFromBond(const vtkAtom &atom1, const vtkAtom &atom2,
232  const vtkVector3f &normal, vtkPlane *plane);
234 
235  protected:
236  vtkMolecule();
237  ~vtkMolecule();
238 
240  virtual void CopyStructureInternal(vtkMolecule *m, bool deep);
241 
243  virtual void CopyAttributesInternal(vtkMolecule *m, bool deep);
244 
246 
251  void SetBondListDirty() {this->BondListIsDirty = true;}
252  void UpdateBondList();
254 
255  friend class vtkAtom;
256  friend class vtkBond;
257 
259 
260 private:
261  vtkMolecule(const vtkMolecule&); // Not implemented.
262  void operator=(const vtkMolecule&); // Not implemented.
263 };
264 
265 #endif