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 =========================================================================*/
27 #ifndef vtkMoleculeMapper_h
28 #define vtkMoleculeMapper_h
29 
30 #include "vtkDomainsChemistryModule.h" // For export macro
31 #include "vtkMapper.h"
32 #include "vtkNew.h" // For vtkNew
33 
34 class vtkActor;
35 class vtkGlyph3DMapper;
36 class vtkIdTypeArray;
37 class vtkMolecule;
38 class vtkPeriodicTable;
39 class vtkPolyData;
40 class vtkPolyDataMapper;
41 class vtkRenderer;
42 class vtkSelection;
43 class vtkSphereSource;
44 class vtkTrivialProducer;
45 
46 class VTKDOMAINSCHEMISTRY_EXPORT vtkMoleculeMapper : public vtkMapper
47 {
48 public:
49  static vtkMoleculeMapper *New();
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
54 
57  void SetInputData(vtkMolecule *in);
60 
72  void UseBallAndStickSettings();
73 
85  void UseVDWSpheresSettings();
86 
98  void UseLiquoriceStickSettings();
99 
114  void UseFastSettings();
115 
117 
120  vtkGetMacro(RenderAtoms, bool);
121  vtkSetMacro(RenderAtoms, bool);
122  vtkBooleanMacro(RenderAtoms, bool);
124 
126 
129  vtkGetMacro(RenderBonds, bool);
130  vtkSetMacro(RenderBonds, bool);
131  vtkBooleanMacro(RenderBonds, bool);
133 
135 
139  vtkGetMacro(RenderLattice, bool)
140  vtkSetMacro(RenderLattice, bool)
141  vtkBooleanMacro(RenderLattice, bool)
143 
144  enum {
145  CovalentRadius = 0,
148  CustomArrayRadius
149  };
150 
152 
157  vtkGetMacro(AtomicRadiusType, int);
158  vtkSetMacro(AtomicRadiusType, int);
159  const char * GetAtomicRadiusTypeAsString();
161  {
162  this->SetAtomicRadiusType(CovalentRadius);
163  }
165  {
166  this->SetAtomicRadiusType(VDWRadius);
167  }
169  {
170  this->SetAtomicRadiusType(UnitRadius);
171  }
173  {
174  this->SetAtomicRadiusType(CustomArrayRadius);
175  }
177 
179 
184  vtkGetMacro(AtomicRadiusScaleFactor, float);
185  vtkSetMacro(AtomicRadiusScaleFactor, float);
187 
189 
193  vtkGetMacro(UseMultiCylindersForBonds, bool);
194  vtkSetMacro(UseMultiCylindersForBonds, bool);
195  vtkBooleanMacro(UseMultiCylindersForBonds, bool);
197 
198  enum {
199  SingleColor = 0,
200  DiscreteByAtom
201  };
202 
204 
214  vtkGetMacro(BondColorMode, int);
215  vtkSetMacro(BondColorMode, int);
216  const char * GetBondColorModeAsString();
218  {
219  this->SetBondColorMode(SingleColor);
220  }
222  {
223  this->SetBondColorMode(DiscreteByAtom);
224  }
226 
228 
232  vtkGetVector3Macro(BondColor, unsigned char);
233  vtkSetVector3Macro(BondColor, unsigned char);
235 
237 
240  vtkGetMacro(BondRadius, float);
241  vtkSetMacro(BondRadius, float);
243 
245 
249  vtkGetVector3Macro(LatticeColor, unsigned char)
250  vtkSetVector3Macro(LatticeColor, unsigned char)
252 
254 
258  virtual void GetSelectedAtomsAndBonds(vtkSelection *selection,
259  vtkIdTypeArray *atomIds,
260  vtkIdTypeArray *bondIds);
261  virtual void GetSelectedAtoms(vtkSelection *selection,
262  vtkIdTypeArray *atomIds)
263  {
264  this->GetSelectedAtomsAndBonds(selection, atomIds, nullptr);
265  }
266  virtual void GetSelectedBonds(vtkSelection *selection,
267  vtkIdTypeArray *bondIds)
268  {
269  this->GetSelectedAtomsAndBonds(selection, nullptr, bondIds);
270  }
272 
274 
277  void Render(vtkRenderer *, vtkActor *) override;
278  void ReleaseGraphicsResources(vtkWindow *) override;
279  double * GetBounds() override;
280  void GetBounds(double bounds[6]) override { vtkAbstractMapper3D::GetBounds(bounds); }
281  int FillInputPortInformation(int port, vtkInformation* info) override;
282  bool GetSupportsSelection() override {return true;}
284 
286 
290  vtkGetStringMacro(AtomicRadiusArrayName);
291  vtkSetStringMacro(AtomicRadiusArrayName);
293 
294 protected:
296  ~vtkMoleculeMapper() override;
297 
299 
307 
309 
315  float BondRadius;
316  unsigned char BondColor[3];
318 
320 
324  void GlyphRender(vtkRenderer *ren, vtkActor *act);
325 
327 
335  virtual void UpdateGlyphPolyData();
336  virtual void UpdateAtomGlyphPolyData();
337  virtual void UpdateBondGlyphPolyData();
339 
341 
347 
348  unsigned char LatticeColor[3];
351  virtual void UpdateLatticePolyData();
352 
357 
358 private:
359  vtkMoleculeMapper(const vtkMoleculeMapper&) = delete;
360  void operator=(const vtkMoleculeMapper&) = delete;
361 };
362 
363 #endif
Access to information about the elements.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
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:94
char * AtomicRadiusArrayName
Customize atom rendering.
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:63
vtkNew< vtkPolyData > AtomGlyphPolyData
Cached variables and update methods.
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:63
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:85
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:37
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:39
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, zmin,zmax).
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:86
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, zmin,zmax).
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:114
void GetBounds(double bounds[6]) override
Reimplemented from base class.