VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMolecule.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00071 #ifndef __vtkMolecule_h 00072 #define __vtkMolecule_h 00073 00074 #include "vtkUndirectedGraph.h" 00075 00076 //BTX 00077 #include "vtkAtom.h" // Simple proxy class dependent on vtkMolecule 00078 #include "vtkBond.h" // Simple proxy class dependent on vtkMolecule 00079 //ETX 00080 #include "vtkVector.h" // Small templated vector convenience class 00081 00082 class vtkPlane; 00083 class vtkAbstractElectronicData; 00084 class vtkPoints; 00085 class vtkUnsignedShortArray; 00086 00087 class VTK_FILTERING_EXPORT vtkMolecule : public vtkUndirectedGraph 00088 { 00089 public: 00090 static vtkMolecule *New(); 00091 vtkTypeMacro(vtkMolecule,vtkUndirectedGraph); 00092 void PrintSelf(ostream &os, vtkIndent indent); 00093 virtual void Initialize(); 00094 00095 //BTX 00097 00099 vtkAtom AppendAtom() 00100 { 00101 return this->AppendAtom(0, vtkVector3f(0, 0, 0)); 00102 } 00104 00107 vtkAtom AppendAtom(unsigned short atomicNumber, const vtkVector3f &pos); 00108 00110 00112 vtkAtom AppendAtom(unsigned short atomicNumber, double x, double y, double z) 00113 { 00114 return this->AppendAtom(atomicNumber, vtkVector3f(x, y, z)); 00115 } 00117 00119 vtkAtom GetAtom(vtkIdType atomId); 00120 00122 vtkIdType GetNumberOfAtoms(); 00123 00125 00128 vtkBond AppendBond(vtkIdType atom1, vtkIdType atom2, 00129 unsigned short order = 1); 00130 vtkBond AppendBond(const vtkAtom &atom1, const vtkAtom &atom2, 00131 unsigned short order = 1) 00132 { 00133 return this->AppendBond(atom1.Id, atom2.Id, order); 00134 } 00136 00138 00139 vtkBond GetBond(vtkIdType bondId); 00140 //ETX 00142 00144 vtkIdType GetNumberOfBonds(); 00145 00147 unsigned short GetAtomAtomicNumber(vtkIdType atomId); 00148 00150 00151 void SetAtomAtomicNumber(vtkIdType atomId, 00152 unsigned short atomicNum); 00154 00156 00157 void SetAtomPosition(vtkIdType atomId, const vtkVector3f &pos); 00158 void SetAtomPosition(vtkIdType atomId, double x, double y, double z); 00160 00162 00163 vtkVector3f GetAtomPosition(vtkIdType atomId); 00164 void GetAtomPosition(vtkIdType atomId, float pos[3]); 00166 00168 00169 void SetBondOrder(vtkIdType bondId, unsigned short order); 00170 unsigned short GetBondOrder(vtkIdType bondId); 00172 00178 double GetBondLength(vtkIdType bondId); 00179 00181 00182 vtkPoints * GetAtomicPositionArray(); 00183 vtkUnsignedShortArray * GetAtomicNumberArray(); 00185 00186 //BTX 00188 00190 vtkGetObjectMacro(ElectronicData, vtkAbstractElectronicData); 00191 virtual void SetElectronicData(vtkAbstractElectronicData*); 00192 //ETX 00194 00196 virtual void ShallowCopy(vtkDataObject *obj); 00197 00199 virtual void DeepCopy(vtkDataObject *obj); 00200 00202 virtual void ShallowCopyStructure(vtkMolecule *m); 00203 00205 virtual void DeepCopyStructure(vtkMolecule *m); 00206 00209 virtual void ShallowCopyAttributes(vtkMolecule *m); 00210 00213 virtual void DeepCopyAttributes(vtkMolecule *m); 00214 00216 00229 static bool GetPlaneFromBond(const vtkBond &bond, const vtkVector3f &normal, 00230 vtkPlane *plane); 00231 static bool GetPlaneFromBond(const vtkAtom &atom1, const vtkAtom &atom2, 00232 const vtkVector3f &normal, vtkPlane *plane); 00234 00235 protected: 00236 vtkMolecule(); 00237 ~vtkMolecule(); 00238 00240 virtual void CopyStructureInternal(vtkMolecule *m, bool deep); 00241 00243 virtual void CopyAttributesInternal(vtkMolecule *m, bool deep); 00244 00246 00250 bool BondListIsDirty; 00251 void SetBondListDirty() {this->BondListIsDirty = true;} 00252 void UpdateBondList(); 00254 00255 friend class vtkAtom; 00256 friend class vtkBond; 00257 00258 vtkAbstractElectronicData *ElectronicData; 00259 00260 private: 00261 vtkMolecule(const vtkMolecule&); // Not implemented. 00262 void operator=(const vtkMolecule&); // Not implemented. 00263 }; 00264 00265 #endif