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 =========================================================================*/
24 #ifndef vtkMoleculeMapper_h
25 #define vtkMoleculeMapper_h
26 
27 #include "vtkDomainsChemistryModule.h" // For export macro
28 #include "vtkMapper.h"
29 #include "vtkNew.h" // For vtkNew
30 
31 class vtkActor;
32 class vtkGlyph3DMapper;
33 class vtkIdTypeArray;
34 class vtkMolecule;
35 class vtkPeriodicTable;
36 class vtkPolyData;
37 class vtkPolyDataMapper;
38 class vtkRenderer;
39 class vtkSelection;
40 class vtkSphereSource;
41 class vtkTrivialProducer;
42 
43 class VTKDOMAINSCHEMISTRY_EXPORT vtkMoleculeMapper : public vtkMapper
44 {
45 public:
46  static vtkMoleculeMapper *New();
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
54  void SetInputData(vtkMolecule *in);
57 
69  void UseBallAndStickSettings();
70 
82  void UseVDWSpheresSettings();
83 
95  void UseLiquoriceStickSettings();
96 
111  void UseFastSettings();
112 
114 
117  vtkGetMacro(RenderAtoms, bool);
118  vtkSetMacro(RenderAtoms, bool);
119  vtkBooleanMacro(RenderAtoms, bool);
121 
123 
126  vtkGetMacro(RenderBonds, bool);
127  vtkSetMacro(RenderBonds, bool);
128  vtkBooleanMacro(RenderBonds, bool);
130 
132 
136  vtkGetMacro(RenderLattice, bool)
137  vtkSetMacro(RenderLattice, bool)
138  vtkBooleanMacro(RenderLattice, bool)
140 
141  enum {
142  CovalentRadius = 0,
145  CustomArrayRadius
146  };
147 
149 
154  vtkGetMacro(AtomicRadiusType, int);
155  vtkSetMacro(AtomicRadiusType, int);
156  const char * GetAtomicRadiusTypeAsString();
158  {
159  this->SetAtomicRadiusType(CovalentRadius);
160  }
162  {
163  this->SetAtomicRadiusType(VDWRadius);
164  }
166  {
167  this->SetAtomicRadiusType(UnitRadius);
168  }
170  {
171  this->SetAtomicRadiusType(CustomArrayRadius);
172  }
174 
176 
181  vtkGetMacro(AtomicRadiusScaleFactor, float);
182  vtkSetMacro(AtomicRadiusScaleFactor, float);
184 
186 
190  vtkGetMacro(UseMultiCylindersForBonds, bool);
191  vtkSetMacro(UseMultiCylindersForBonds, bool);
192  vtkBooleanMacro(UseMultiCylindersForBonds, bool);
194 
195  enum {
196  SingleColor = 0,
197  DiscreteByAtom
198  };
199 
201 
211  vtkGetMacro(BondColorMode, int);
212  vtkSetMacro(BondColorMode, int);
213  const char * GetBondColorModeAsString();
215  {
216  this->SetBondColorMode(SingleColor);
217  }
219  {
220  this->SetBondColorMode(DiscreteByAtom);
221  }
223 
225 
229  vtkGetVector3Macro(BondColor, unsigned char);
230  vtkSetVector3Macro(BondColor, unsigned char);
232 
234 
237  vtkGetMacro(BondRadius, float);
238  vtkSetMacro(BondRadius, float);
240 
242 
246  vtkGetVector3Macro(LatticeColor, unsigned char)
247  vtkSetVector3Macro(LatticeColor, unsigned char)
249 
251 
255  virtual void GetSelectedAtomsAndBonds(vtkSelection *selection,
256  vtkIdTypeArray *atomIds,
257  vtkIdTypeArray *bondIds);
258  virtual void GetSelectedAtoms(vtkSelection *selection,
259  vtkIdTypeArray *atomIds)
260  {
261  this->GetSelectedAtomsAndBonds(selection, atomIds, nullptr);
262  }
263  virtual void GetSelectedBonds(vtkSelection *selection,
264  vtkIdTypeArray *bondIds)
265  {
266  this->GetSelectedAtomsAndBonds(selection, nullptr, bondIds);
267  }
269 
271 
274  void Render(vtkRenderer *, vtkActor *) override;
275  void ReleaseGraphicsResources(vtkWindow *) override;
276  double * GetBounds() override;
277  void GetBounds(double bounds[6]) override { vtkAbstractMapper3D::GetBounds(bounds); }
278  int FillInputPortInformation(int port, vtkInformation* info) override;
279  bool GetSupportsSelection() override {return true;}
281 
282 protected:
284  ~vtkMoleculeMapper() override;
285 
287 
294 
296 
302  float BondRadius;
303  unsigned char BondColor[3];
305 
307 
311  void GlyphRender(vtkRenderer *ren, vtkActor *act);
312 
314 
322  virtual void UpdateGlyphPolyData();
323  virtual void UpdateAtomGlyphPolyData();
324  virtual void UpdateBondGlyphPolyData();
326 
328 
334 
335  unsigned char LatticeColor[3];
338  virtual void UpdateLatticePolyData();
339 
344 
345 private:
346  vtkMoleculeMapper(const vtkMoleculeMapper&) = delete;
347  void operator=(const vtkMoleculeMapper&) = delete;
348 };
349 
350 #endif
Access to information about the elements.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:45
vtkNew< vtkGlyph3DMapper > BondGlyphMapper
Internal mappers.
bool RenderBonds
Customize bond rendering.
vtkNew< vtkPeriodicTable > PeriodicTable
Periodic table for lookups.
bool GetSupportsSelection() override
Reimplemented from base class.
Store vtkAlgorithm input/output information.
class describing a molecule
Definition: vtkMolecule.h:87
float AtomicRadiusScaleFactor
Customize atom rendering.
bool GlyphDataInitialized
Cached variables and update methods.
void SetAtomicRadiusTypeToCovalentRadius()
Get/Set the type of radius used to generate the atoms.
bool UseMultiCylindersForBonds
Customize bond rendering.
virtual void GetSelectedBonds(vtkSelection *selection, vtkIdTypeArray *bondIds)
Extract the ids atoms and/or bonds rendered by this molecule from a vtkSelection object.
vtkNew< vtkPolyData > LatticePolyData
abstract specification for renderers
Definition: vtkRenderer.h:57
vtkNew< vtkPolyData > AtomGlyphPolyData
Cached variables and update methods.
A node in a selection tree.
Definition: vtkSelection.h:37
dynamic, self-adjusting array of vtkIdType
bool RenderAtoms
Customize atom rendering.
vtkGlyph3D on the GPU.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
void SetAtomicRadiusTypeToVDWRadius()
Get/Set the type of radius used to generate the atoms.
void SetAtomicRadiusTypeToCustomArrayRadius()
Get/Set the type of radius used to generate the atoms.
Mapper that draws vtkMolecule objects.
int AtomicRadiusType
Customize atom rendering.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
create a polygonal sphere centered at the origin
vtkNew< vtkPolyData > BondGlyphPolyData
Cached variables and update methods.
Producer for stand-alone data objects.
vtkNew< vtkPolyDataMapper > LatticeMapper
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkNew< vtkTrivialProducer > AtomGlyphPointOutput
Cached variables and update methods.
vtkNew< vtkGlyph3DMapper > AtomGlyphMapper
Internal mappers.
void SetAtomicRadiusTypeToUnitRadius()
Get/Set the type of radius used to generate the atoms.
virtual double * GetBounds()=0
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
vtkNew< vtkTrivialProducer > BondGlyphPointOutput
Cached variables and update methods.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:77
map vtkPolyData to graphics primitives
void SetBondColorModeToDiscreteByAtom()
Get/Set the method by which bonds are colored.
float BondRadius
Customize bond rendering.
virtual void GetSelectedAtoms(vtkSelection *selection, vtkIdTypeArray *atomIds)
Extract the ids atoms and/or bonds rendered by this molecule from a vtkSelection object.
static vtkAlgorithm * New()
int BondColorMode
Customize bond rendering.
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
vtkDataSet * GetInput()
Get the input as a vtkDataSet.
virtual void Render(vtkRenderer *ren, vtkActor *a)=0
Method initiates the mapping process.
void SetBondColorModeToSingleColor()
Get/Set the method by which bonds are colored.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
Definition: vtkMapper.h:105
void GetBounds(double bounds[6]) override
Reimplemented from base class.