VTK  9.0.1
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:
47  vtkTypeMacro(vtkMoleculeMapper, vtkMapper);
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
57 
70 
83 
96 
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  {
143  CovalentRadius = 0,
146  CustomArrayRadius
147  };
148 
150 
155  vtkGetMacro(AtomicRadiusType, int);
156  vtkSetMacro(AtomicRadiusType, int);
158  void SetAtomicRadiusTypeToCovalentRadius() { this->SetAtomicRadiusType(CovalentRadius); }
159  void SetAtomicRadiusTypeToVDWRadius() { this->SetAtomicRadiusType(VDWRadius); }
160  void SetAtomicRadiusTypeToUnitRadius() { this->SetAtomicRadiusType(UnitRadius); }
161  void SetAtomicRadiusTypeToCustomArrayRadius() { this->SetAtomicRadiusType(CustomArrayRadius); }
163 
165 
170  vtkGetMacro(AtomicRadiusScaleFactor, float);
171  vtkSetMacro(AtomicRadiusScaleFactor, float);
173 
175 
179  vtkGetMacro(UseMultiCylindersForBonds, bool);
180  vtkSetMacro(UseMultiCylindersForBonds, bool);
181  vtkBooleanMacro(UseMultiCylindersForBonds, bool);
183 
184  enum
185  {
186  SingleColor = 0,
187  DiscreteByAtom
188  };
189 
191 
201  vtkGetMacro(BondColorMode, int);
202  vtkSetClampMacro(BondColorMode, int, SingleColor, DiscreteByAtom);
203  void SetBondColorModeToSingleColor() { this->SetBondColorMode(SingleColor); }
204  void SetBondColorModeToDiscreteByAtom() { this->SetBondColorMode(DiscreteByAtom); }
207 
209 
218  vtkGetMacro(AtomColorMode, int);
219  vtkSetClampMacro(AtomColorMode, int, SingleColor, DiscreteByAtom);
221 
223 
227  vtkGetVector3Macro(AtomColor, unsigned char);
228  vtkSetVector3Macro(AtomColor, unsigned char);
230 
232 
236  vtkGetVector3Macro(BondColor, unsigned char);
237  vtkSetVector3Macro(BondColor, unsigned char);
239 
241 
244  vtkGetMacro(BondRadius, float);
245  vtkSetMacro(BondRadius, float);
247 
249 
253  vtkGetVector3Macro(LatticeColor, unsigned char);
254  vtkSetVector3Macro(LatticeColor, unsigned char);
256 
258 
263  vtkSelection* selection, vtkIdTypeArray* atomIds, vtkIdTypeArray* bondIds);
264  virtual void GetSelectedAtoms(vtkSelection* selection, vtkIdTypeArray* atomIds)
265  {
266  this->GetSelectedAtomsAndBonds(selection, atomIds, nullptr);
267  }
268  virtual void GetSelectedBonds(vtkSelection* selection, vtkIdTypeArray* bondIds)
269  {
270  this->GetSelectedAtomsAndBonds(selection, nullptr, bondIds);
271  }
273 
275 
278  void Render(vtkRenderer*, vtkActor*) override;
280  double* GetBounds() override;
281  void GetBounds(double bounds[6]) override { vtkAbstractMapper3D::GetBounds(bounds); }
283  bool GetSupportsSelection() override { return true; }
285 
287 
291  vtkGetStringMacro(AtomicRadiusArrayName);
292  vtkSetStringMacro(AtomicRadiusArrayName);
294 
299  virtual void SetMapScalars(bool map);
300 
304  vtkPeriodicTable* GetPeriodicTable() { return this->PeriodicTable; }
305 
306 protected:
308  ~vtkMoleculeMapper() override;
309 
311 
319  unsigned char AtomColor[3];
321 
323 
329  float BondRadius;
330  unsigned char BondColor[3];
332 
334 
338  void GlyphRender(vtkRenderer* ren, vtkActor* act);
339 
341 
349  virtual void UpdateGlyphPolyData();
350  virtual void UpdateAtomGlyphPolyData();
351  virtual void UpdateBondGlyphPolyData();
353 
355 
361 
362  unsigned char LatticeColor[3];
365  virtual void UpdateLatticePolyData();
366 
371 
372 private:
373  vtkMoleculeMapper(const vtkMoleculeMapper&) = delete;
374  void operator=(const vtkMoleculeMapper&) = delete;
375 };
376 
377 #endif
virtual double * GetBounds()=0
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
vtkGlyph3D on the GPU.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:34
Store vtkAlgorithm input/output information.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:81
Mapper that draws vtkMolecule objects.
virtual void GetSelectedBonds(vtkSelection *selection, vtkIdTypeArray *bondIds)
virtual void GetSelectedAtoms(vtkSelection *selection, vtkIdTypeArray *atomIds)
virtual void SetMapScalars(bool map)
Helper method to set ScalarMode on both AtomGlyphMapper and BondGlyphMapper.
void SetBondColorModeToDiscreteByAtom()
void SetAtomicRadiusTypeToUnitRadius()
vtkNew< vtkGlyph3DMapper > AtomGlyphMapper
Internal mappers.
bool RenderAtoms
Customize atom rendering.
void SetAtomicRadiusTypeToVDWRadius()
void UseLiquoriceStickSettings()
Set ivars to default liquorice stick settings.
vtkNew< vtkPeriodicTable > PeriodicTable
Periodic table for lookups.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPeriodicTable * GetPeriodicTable()
Accessor to internal structure.
virtual void GetSelectedAtomsAndBonds(vtkSelection *selection, vtkIdTypeArray *atomIds, vtkIdTypeArray *bondIds)
Extract the ids atoms and/or bonds rendered by this molecule from a vtkSelection object.
~vtkMoleculeMapper() override
bool RenderBonds
Customize bond rendering.
void Render(vtkRenderer *, vtkActor *) override
Reimplemented from base class.
void SetAtomicRadiusTypeToCustomArrayRadius()
void SetAtomicRadiusTypeToCovalentRadius()
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
double * GetBounds() override
Return bounding box (array of six doubles) of data expressed as (xmin,xmax, ymin,ymax,...
virtual void UpdateAtomGlyphPolyData()
virtual void UpdateGlyphPolyData()
vtkNew< vtkPolyData > BondGlyphPolyData
vtkNew< vtkTrivialProducer > BondGlyphPointOutput
static vtkMoleculeMapper * New()
void UseFastSettings()
Set ivars to use fast settings that may be useful for rendering extremely large molecules where the o...
void SetBondColorModeToSingleColor()
const char * GetBondColorModeAsString()
vtkMolecule * GetInput()
bool GetSupportsSelection() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkNew< vtkGlyph3DMapper > BondGlyphMapper
void SetInputData(vtkMolecule *in)
Get/Set the input vtkMolecule.
virtual void UpdateLatticePolyData()
void UseBallAndStickSettings()
Set ivars to default ball-and-stick settings.
const char * GetAtomicRadiusTypeAsString()
void GlyphRender(vtkRenderer *ren, vtkActor *act)
Internal render methods.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
void UseVDWSpheresSettings()
Set ivars to default van der Waals spheres settings.
vtkNew< vtkTrivialProducer > AtomGlyphPointOutput
void GetBounds(double bounds[6]) override
Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
virtual void UpdateBondGlyphPolyData()
vtkNew< vtkPolyDataMapper > LatticeMapper
vtkNew< vtkPolyData > LatticePolyData
vtkNew< vtkPolyData > AtomGlyphPolyData
Cached variables and update methods.
class describing a molecule
Definition: vtkMolecule.h:92
Access to information about the elements.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
abstract specification for renderers
Definition: vtkRenderer.h:59
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:58
create a polygonal sphere centered at the origin
Producer for stand-alone data objects.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453