VTK  9.2.6
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();
50  vtkTypeMacro(vtkMoleculeMapper, vtkMapper);
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  {
146  CovalentRadius = 0,
149  CustomArrayRadius
150  };
151 
153 
158  vtkGetMacro(AtomicRadiusType, int);
159  vtkSetMacro(AtomicRadiusType, int);
160  const char* GetAtomicRadiusTypeAsString();
161  void SetAtomicRadiusTypeToCovalentRadius() { this->SetAtomicRadiusType(CovalentRadius); }
162  void SetAtomicRadiusTypeToVDWRadius() { this->SetAtomicRadiusType(VDWRadius); }
163  void SetAtomicRadiusTypeToUnitRadius() { this->SetAtomicRadiusType(UnitRadius); }
164  void SetAtomicRadiusTypeToCustomArrayRadius() { this->SetAtomicRadiusType(CustomArrayRadius); }
166 
168 
173  vtkGetMacro(AtomicRadiusScaleFactor, float);
174  vtkSetMacro(AtomicRadiusScaleFactor, float);
176 
178 
182  vtkGetMacro(UseMultiCylindersForBonds, bool);
183  vtkSetMacro(UseMultiCylindersForBonds, bool);
184  vtkBooleanMacro(UseMultiCylindersForBonds, bool);
186 
187  enum
188  {
189  SingleColor = 0,
190  DiscreteByAtom
191  };
192 
194 
204  vtkGetMacro(BondColorMode, int);
205  vtkSetClampMacro(BondColorMode, int, SingleColor, DiscreteByAtom);
206  void SetBondColorModeToSingleColor() { this->SetBondColorMode(SingleColor); }
207  void SetBondColorModeToDiscreteByAtom() { this->SetBondColorMode(DiscreteByAtom); }
208  const char* GetBondColorModeAsString();
210 
212 
221  vtkGetMacro(AtomColorMode, int);
222  vtkSetClampMacro(AtomColorMode, int, SingleColor, DiscreteByAtom);
224 
226 
230  vtkGetVector3Macro(AtomColor, unsigned char);
231  vtkSetVector3Macro(AtomColor, unsigned char);
233 
235 
239  vtkGetVector3Macro(BondColor, unsigned char);
240  vtkSetVector3Macro(BondColor, unsigned char);
242 
244 
247  vtkGetMacro(BondRadius, float);
248  vtkSetMacro(BondRadius, float);
250 
252 
256  vtkGetVector3Macro(LatticeColor, unsigned char);
257  vtkSetVector3Macro(LatticeColor, unsigned char);
259 
261 
265  virtual void GetSelectedAtomsAndBonds(
266  vtkSelection* selection, vtkIdTypeArray* atomIds, vtkIdTypeArray* bondIds);
267  virtual void GetSelectedAtoms(vtkSelection* selection, vtkIdTypeArray* atomIds)
268  {
269  this->GetSelectedAtomsAndBonds(selection, atomIds, nullptr);
270  }
271  virtual void GetSelectedBonds(vtkSelection* selection, vtkIdTypeArray* bondIds)
272  {
273  this->GetSelectedAtomsAndBonds(selection, nullptr, bondIds);
274  }
276 
278 
281  void Render(vtkRenderer*, vtkActor*) override;
282  void ReleaseGraphicsResources(vtkWindow*) override;
283  double* GetBounds() override;
284  void GetBounds(double bounds[6]) override { vtkAbstractMapper3D::GetBounds(bounds); }
285  int FillInputPortInformation(int port, vtkInformation* info) override;
286  bool GetSupportsSelection() override { return true; }
288 
290 
294  vtkGetStringMacro(AtomicRadiusArrayName);
295  vtkSetStringMacro(AtomicRadiusArrayName);
297 
302  virtual void SetMapScalars(bool map);
303 
307  vtkPeriodicTable* GetPeriodicTable() { return this->PeriodicTable; }
308 
309 protected:
311  ~vtkMoleculeMapper() override;
312 
314 
322  unsigned char AtomColor[3];
324 
326 
332  float BondRadius;
333  unsigned char BondColor[3];
335 
337 
341  void GlyphRender(vtkRenderer* ren, vtkActor* act);
342 
344 
352  virtual void UpdateGlyphPolyData();
353  virtual void UpdateAtomGlyphPolyData();
354  virtual void UpdateBondGlyphPolyData();
356 
358 
364 
365  unsigned char LatticeColor[3];
368  virtual void UpdateLatticePolyData();
369 
374 
375 private:
376  vtkMoleculeMapper(const vtkMoleculeMapper&) = delete;
377  void operator=(const vtkMoleculeMapper&) = delete;
378 };
379 
380 #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:72
vtkNew< vtkPolyData > AtomGlyphPolyData
Cached variables and update methods.
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:59
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:90
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.
int AtomColorMode
Customize atom rendering.
Mapper that draws vtkMolecule objects.
int AtomicRadiusType
Customize atom rendering.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
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:87
vtkPeriodicTable * GetPeriodicTable()
Accessor to internal structure.
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:115
void GetBounds(double bounds[6]) override
Reimplemented from base class.