VTK
vtkMoleculeMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMoleculeMapper.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 =========================================================================*/
26 #ifndef __vtkMoleculeMapper_h
27 #define __vtkMoleculeMapper_h
28 
29 #include "vtkMapper.h"
30 #include "vtkNew.h" // For vtkNew
31 
32 class vtkActor;
33 class vtkGlyph3DMapper;
34 class vtkIdTypeArray;
35 class vtkMolecule;
36 class vtkPeriodicTable;
37 class vtkPolyData;
38 class vtkRenderer;
39 class vtkSelection;
40 class vtkSphereSource;
41 class vtkTrivialProducer;
42 
44 {
45 public:
46  static vtkMoleculeMapper *New();
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
51 
52  void SetInput(vtkMolecule *in);
55 
61  void UseBallAndStickSettings();
62 
68  void UseVDWSpheresSettings();
69 
75  void UseLiquoriceStickSettings();
76 
84  void UseFastSettings();
85 
87 
88  vtkGetMacro(RenderAtoms, bool);
89  vtkSetMacro(RenderAtoms, bool);
90  vtkBooleanMacro(RenderAtoms, bool);
92 
94 
95  vtkGetMacro(RenderBonds, bool);
96  vtkSetMacro(RenderBonds, bool);
97  vtkBooleanMacro(RenderBonds, bool);
99 
100  enum {
101  CovalentRadius = 0,
103  UnitRadius
104  };
105 
107 
109  vtkGetMacro(AtomicRadiusType, int);
110  vtkSetMacro(AtomicRadiusType, int);
111  const char * GetAtomicRadiusTypeAsString();
112  void SetAtomicRadiusTypeToCovalentRadius()
113  {
114  this->SetAtomicRadiusType(CovalentRadius);
115  }
116  void SetAtomicRadiusTypeToVDWRadius()
117  {
118  this->SetAtomicRadiusType(VDWRadius);
119  }
120  void SetAtomicRadiusTypeToUnitRadius()
121  {
122  this->SetAtomicRadiusType(UnitRadius);
123  }
125 
127 
129  vtkGetMacro(AtomicRadiusScaleFactor, float);
130  vtkSetMacro(AtomicRadiusScaleFactor, float);
132 
134 
136  vtkGetMacro(UseMultiCylindersForBonds, bool);
137  vtkSetMacro(UseMultiCylindersForBonds, bool);
138  vtkBooleanMacro(UseMultiCylindersForBonds, bool);
140 
141  enum {
142  SingleColor = 0,
143  DiscreteByAtom
144  };
145 
147 
152  vtkGetMacro(BondColorMode, int);
153  vtkSetMacro(BondColorMode, int);
154  const char * GetBondColorModeAsString();
155  void SetBondColorModeToSingleColor()
156  {
157  this->SetBondColorMode(SingleColor);
158  }
159  void SetBondColorModeToDiscreteByAtom()
160  {
161  this->SetBondColorMode(DiscreteByAtom);
162  }
164 
166 
168  vtkGetVector3Macro(BondColor, unsigned char);
169  vtkSetVector3Macro(BondColor, unsigned char);
171 
173 
174  vtkGetMacro(BondRadius, float);
175  vtkSetMacro(BondRadius, float);
177 
179 
181  virtual void GetSelectedAtomsAndBonds(vtkSelection *selection,
182  vtkIdTypeArray *atomIds,
183  vtkIdTypeArray *bondIds);
184  virtual void GetSelectedAtoms(vtkSelection *selection,
185  vtkIdTypeArray *atomIds)
186  {
187  this->GetSelectedAtomsAndBonds(selection, atomIds, NULL);
188  }
189  virtual void GetSelectedBonds(vtkSelection *selection,
190  vtkIdTypeArray *bondIds)
191  {
192  this->GetSelectedAtomsAndBonds(selection, NULL, bondIds);
193  }
195 
197 
198  virtual void Render(vtkRenderer *, vtkActor *);
199  virtual void ReleaseGraphicsResources(vtkWindow *);
200  double * GetBounds();
201  void GetBounds(double bounds[6]) { vtkAbstractMapper3D::GetBounds(bounds); }
203  virtual bool GetSupportsSelection() {return true;}
205 
206 protected:
209 
211 
216 
218 
222  float BondRadius;
223  unsigned char BondColor[3];
225 
227  void GlyphRender(vtkRenderer *ren, vtkActor *act);
228 
230 
236  void UpdateGlyphPolyData();
237  void UpdateAtomGlyphPolyData();
238  void UpdateBondGlyphPolyData();
240 
242 
246 
249 
250 private:
251  vtkMoleculeMapper(const vtkMoleculeMapper&); // Not implemented.
252  void operator=(const vtkMoleculeMapper&); // Not implemented.
253 };
254 
255 #endif