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 "vtkDomainsChemistryModule.h" // For export macro
30 #include "vtkMapper.h"
31 #include "vtkNew.h" // For vtkNew
32 
33 class vtkActor;
34 class vtkGlyph3DMapper;
35 class vtkIdTypeArray;
36 class vtkMolecule;
37 class vtkPeriodicTable;
38 class vtkPolyData;
39 class vtkRenderer;
40 class vtkSelection;
41 class vtkSphereSource;
42 class vtkTrivialProducer;
43 
45 {
46 public:
47  static vtkMoleculeMapper *New();
49  void PrintSelf(ostream& os, vtkIndent indent);
50 
52 
53  void SetInputData(vtkMolecule *in);
56 
62  void UseBallAndStickSettings();
63 
69  void UseVDWSpheresSettings();
70 
76  void UseLiquoriceStickSettings();
77 
85  void UseFastSettings();
86 
88 
89  vtkGetMacro(RenderAtoms, bool);
90  vtkSetMacro(RenderAtoms, bool);
91  vtkBooleanMacro(RenderAtoms, bool);
93 
95 
96  vtkGetMacro(RenderBonds, bool);
97  vtkSetMacro(RenderBonds, bool);
98  vtkBooleanMacro(RenderBonds, bool);
100 
101  enum {
102  CovalentRadius = 0,
104  UnitRadius
105  };
106 
108 
110  vtkGetMacro(AtomicRadiusType, int);
111  vtkSetMacro(AtomicRadiusType, int);
112  const char * GetAtomicRadiusTypeAsString();
114  {
115  this->SetAtomicRadiusType(CovalentRadius);
116  }
118  {
119  this->SetAtomicRadiusType(VDWRadius);
120  }
122  {
123  this->SetAtomicRadiusType(UnitRadius);
124  }
126 
128 
130  vtkGetMacro(AtomicRadiusScaleFactor, float);
131  vtkSetMacro(AtomicRadiusScaleFactor, float);
133 
135 
137  vtkGetMacro(UseMultiCylindersForBonds, bool);
138  vtkSetMacro(UseMultiCylindersForBonds, bool);
139  vtkBooleanMacro(UseMultiCylindersForBonds, bool);
141 
142  enum {
143  SingleColor = 0,
144  DiscreteByAtom
145  };
146 
148 
153  vtkGetMacro(BondColorMode, int);
154  vtkSetMacro(BondColorMode, int);
155  const char * GetBondColorModeAsString();
157  {
158  this->SetBondColorMode(SingleColor);
159  }
161  {
162  this->SetBondColorMode(DiscreteByAtom);
163  }
165 
167 
169  vtkGetVector3Macro(BondColor, unsigned char);
170  vtkSetVector3Macro(BondColor, unsigned char);
172 
174 
175  vtkGetMacro(BondRadius, float);
176  vtkSetMacro(BondRadius, float);
178 
180 
182  virtual void GetSelectedAtomsAndBonds(vtkSelection *selection,
183  vtkIdTypeArray *atomIds,
184  vtkIdTypeArray *bondIds);
185  virtual void GetSelectedAtoms(vtkSelection *selection,
186  vtkIdTypeArray *atomIds)
187  {
188  this->GetSelectedAtomsAndBonds(selection, atomIds, NULL);
189  }
190  virtual void GetSelectedBonds(vtkSelection *selection,
191  vtkIdTypeArray *bondIds)
192  {
193  this->GetSelectedAtomsAndBonds(selection, NULL, bondIds);
194  }
196 
198 
199  virtual void Render(vtkRenderer *, vtkActor *);
200  virtual void ReleaseGraphicsResources(vtkWindow *);
201  double * GetBounds();
202  void GetBounds(double bounds[6]) { vtkAbstractMapper3D::GetBounds(bounds); }
204  virtual bool GetSupportsSelection() {return true;}
206 
207 protected:
210 
212 
217 
219 
223  float BondRadius;
224  unsigned char BondColor[3];
226 
228  void GlyphRender(vtkRenderer *ren, vtkActor *act);
229 
231 
237  virtual void UpdateGlyphPolyData();
238  virtual void UpdateAtomGlyphPolyData();
239  virtual void UpdateBondGlyphPolyData();
241 
243 
247 
250 
251 private:
252  vtkMoleculeMapper(const vtkMoleculeMapper&); // Not implemented.
253  void operator=(const vtkMoleculeMapper&); // Not implemented.
254 };
255 
256 #endif
Access to information about the elements.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
vtkNew< vtkGlyph3DMapper > BondGlyphMapper
vtkNew< vtkPeriodicTable > PeriodicTable
virtual void ReleaseGraphicsResources(vtkWindow *)
Definition: vtkMapper.h:109
Store vtkAlgorithm input/output information.
class describing a molecule
Definition: vtkMolecule.h:88
void SetAtomicRadiusTypeToCovalentRadius()
virtual void GetSelectedBonds(vtkSelection *selection, vtkIdTypeArray *bondIds)
virtual bool GetSupportsSelection()
abstract specification for renderers
Definition: vtkRenderer.h:63
vtkNew< vtkPolyData > AtomGlyphPolyData
A node in a selection tree. Used to store selection results.
Definition: vtkSelection.h:44
dynamic, self-adjusting array of vtkIdType
vtkGlyph3D on the GPU.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
void SetAtomicRadiusTypeToVDWRadius()
Mapper that draws vtkMolecule objects.
void GetBounds(double bounds[6])
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
create a polygonal sphere centered at the origin
vtkNew< vtkPolyData > BondGlyphPolyData
Producer for stand-alone data objects.
#define VTKDOMAINSCHEMISTRY_EXPORT
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkNew< vtkTrivialProducer > AtomGlyphPointOutput
vtkNew< vtkGlyph3DMapper > AtomGlyphMapper
void SetAtomicRadiusTypeToUnitRadius()
void PrintSelf(ostream &os, vtkIndent indent)
virtual double * GetBounds()=0
virtual int FillInputPortInformation(int port, vtkInformation *info)
vtkNew< vtkTrivialProducer > BondGlyphPointOutput
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:89
void SetBondColorModeToDiscreteByAtom()
virtual void GetSelectedAtoms(vtkSelection *selection, vtkIdTypeArray *atomIds)
virtual double * GetBounds()
static vtkAlgorithm * New()
vtkDataSet * GetInput()
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
void SetBondColorModeToSingleColor()