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 =========================================================================*/
36 #ifndef vtkMoleculeMapper_h
37 #define vtkMoleculeMapper_h
38 
39 #include "vtkDomainsChemistryModule.h" // For export macro
40 #include "vtkMapper.h"
41 #include "vtkNew.h" // For vtkNew
42 
43 class vtkActor;
44 class vtkGlyph3DMapper;
45 class vtkIdTypeArray;
46 class vtkMolecule;
47 class vtkPeriodicTable;
48 class vtkPolyData;
49 class vtkPolyDataMapper;
50 class vtkRenderer;
51 class vtkSelection;
52 class vtkSphereSource;
53 class vtkTrivialProducer;
54 
55 class VTKDOMAINSCHEMISTRY_EXPORT vtkMoleculeMapper : public vtkMapper
56 {
57 public:
59  vtkTypeMacro(vtkMoleculeMapper, vtkMapper);
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
63 
69 
82 
95 
108 
124 
126 
129  vtkGetMacro(RenderAtoms, bool);
130  vtkSetMacro(RenderAtoms, bool);
131  vtkBooleanMacro(RenderAtoms, bool);
133 
135 
138  vtkGetMacro(RenderBonds, bool);
139  vtkSetMacro(RenderBonds, bool);
140  vtkBooleanMacro(RenderBonds, bool);
142 
144 
148  vtkGetMacro(RenderLattice, bool);
149  vtkSetMacro(RenderLattice, bool);
150  vtkBooleanMacro(RenderLattice, bool);
152 
153  enum
154  {
155  CovalentRadius = 0,
158  CustomArrayRadius
159  };
160 
162 
167  vtkGetMacro(AtomicRadiusType, int);
168  vtkSetMacro(AtomicRadiusType, int);
170  void SetAtomicRadiusTypeToCovalentRadius() { this->SetAtomicRadiusType(CovalentRadius); }
171  void SetAtomicRadiusTypeToVDWRadius() { this->SetAtomicRadiusType(VDWRadius); }
172  void SetAtomicRadiusTypeToUnitRadius() { this->SetAtomicRadiusType(UnitRadius); }
173  void SetAtomicRadiusTypeToCustomArrayRadius() { this->SetAtomicRadiusType(CustomArrayRadius); }
175 
177 
182  vtkGetMacro(AtomicRadiusScaleFactor, float);
183  vtkSetMacro(AtomicRadiusScaleFactor, float);
185 
187 
191  vtkGetMacro(UseMultiCylindersForBonds, bool);
192  vtkSetMacro(UseMultiCylindersForBonds, bool);
193  vtkBooleanMacro(UseMultiCylindersForBonds, bool);
195 
196  enum
197  {
198  SingleColor = 0,
199  DiscreteByAtom
200  };
201 
203 
213  vtkGetMacro(BondColorMode, int);
214  vtkSetClampMacro(BondColorMode, int, SingleColor, DiscreteByAtom);
215  void SetBondColorModeToSingleColor() { this->SetBondColorMode(SingleColor); }
216  void SetBondColorModeToDiscreteByAtom() { this->SetBondColorMode(DiscreteByAtom); }
219 
221 
230  vtkGetMacro(AtomColorMode, int);
231  vtkSetClampMacro(AtomColorMode, int, SingleColor, DiscreteByAtom);
233 
235 
239  vtkGetVector3Macro(AtomColor, unsigned char);
240  vtkSetVector3Macro(AtomColor, unsigned char);
242 
244 
248  vtkGetVector3Macro(BondColor, unsigned char);
249  vtkSetVector3Macro(BondColor, unsigned char);
251 
253 
256  vtkGetMacro(BondRadius, float);
257  vtkSetMacro(BondRadius, float);
259 
261 
265  vtkGetVector3Macro(LatticeColor, unsigned char);
266  vtkSetVector3Macro(LatticeColor, unsigned char);
268 
270 
275  vtkSelection* selection, vtkIdTypeArray* atomIds, vtkIdTypeArray* bondIds);
276  virtual void GetSelectedAtoms(vtkSelection* selection, vtkIdTypeArray* atomIds)
277  {
278  this->GetSelectedAtomsAndBonds(selection, atomIds, nullptr);
279  }
280  virtual void GetSelectedBonds(vtkSelection* selection, vtkIdTypeArray* bondIds)
281  {
282  this->GetSelectedAtomsAndBonds(selection, nullptr, bondIds);
283  }
285 
287 
290  void Render(vtkRenderer*, vtkActor*) override;
292  double* GetBounds() override;
293  void GetBounds(double bounds[6]) override { vtkAbstractMapper3D::GetBounds(bounds); }
295  bool GetSupportsSelection() override { return true; }
297 
299 
303  vtkGetStringMacro(AtomicRadiusArrayName);
304  vtkSetStringMacro(AtomicRadiusArrayName);
306 
311  virtual void SetMapScalars(bool map);
312 
316  vtkPeriodicTable* GetPeriodicTable() { return this->PeriodicTable; }
317 
318 protected:
320  ~vtkMoleculeMapper() override;
321 
323 
331  unsigned char AtomColor[3];
333 
335 
341  float BondRadius;
342  unsigned char BondColor[3];
344 
346 
350  void GlyphRender(vtkRenderer* ren, vtkActor* act);
351 
353 
361  virtual void UpdateGlyphPolyData();
362  virtual void UpdateAtomGlyphPolyData();
363  virtual void UpdateBondGlyphPolyData();
365 
367 
373 
374  unsigned char LatticeColor[3];
377  virtual void UpdateLatticePolyData();
378 
383 
384 private:
385  vtkMoleculeMapper(const vtkMoleculeMapper&) = delete;
386  void operator=(const vtkMoleculeMapper&) = delete;
387 };
388 
389 #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:61
vtkGlyph3D on the GPU.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:49
Store vtkAlgorithm input/output information.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:97
Mapper that draws vtkMolecule objects.
virtual void GetSelectedBonds(vtkSelection *selection, vtkIdTypeArray *bondIds)
Extract the ids atoms and/or bonds rendered by this molecule from a vtkSelection object.
virtual void GetSelectedAtoms(vtkSelection *selection, vtkIdTypeArray *atomIds)
Extract the ids atoms and/or bonds rendered by this molecule from a vtkSelection object.
virtual void SetMapScalars(bool map)
Helper method to set ScalarMode on both AtomGlyphMapper and BondGlyphMapper.
void SetBondColorModeToDiscreteByAtom()
Get/Set the method by which bonds are colored.
void SetAtomicRadiusTypeToUnitRadius()
Get/Set the type of radius used to generate the atoms.
bool GlyphDataInitialized
Cached variables and update methods.
vtkNew< vtkGlyph3DMapper > AtomGlyphMapper
Internal mappers.
bool RenderAtoms
Customize atom rendering.
void SetAtomicRadiusTypeToVDWRadius()
Get/Set the type of radius used to generate the atoms.
void UseLiquoriceStickSettings()
Set ivars to default liquorice stick settings.
vtkNew< vtkPeriodicTable > PeriodicTable
Periodic table for lookups.
float AtomicRadiusScaleFactor
Customize atom rendering.
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.
float BondRadius
Customize bond rendering.
~vtkMoleculeMapper() override
int AtomicRadiusType
Customize atom rendering.
bool RenderBonds
Customize bond rendering.
void Render(vtkRenderer *, vtkActor *) override
Reimplemented from base class.
void SetAtomicRadiusTypeToCustomArrayRadius()
Get/Set the type of radius used to generate the atoms.
void SetAtomicRadiusTypeToCovalentRadius()
Get/Set the type of radius used to generate the atoms.
char * AtomicRadiusArrayName
Customize atom rendering.
int FillInputPortInformation(int port, vtkInformation *info) override
Reimplemented from base class.
double * GetBounds() override
Reimplemented from base class.
virtual void UpdateAtomGlyphPolyData()
Cached variables and update methods.
int AtomColorMode
Customize atom rendering.
virtual void UpdateGlyphPolyData()
Cached variables and update methods.
vtkNew< vtkPolyData > BondGlyphPolyData
Cached variables and update methods.
vtkNew< vtkTrivialProducer > BondGlyphPointOutput
Cached variables and update methods.
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()
Get/Set the method by which bonds are colored.
const char * GetBondColorModeAsString()
Get/Set the method by which bonds are colored.
bool UseMultiCylindersForBonds
Customize bond rendering.
vtkMolecule * GetInput()
Get/Set the input vtkMolecule.
bool GetSupportsSelection() override
Reimplemented from base class.
vtkNew< vtkGlyph3DMapper > BondGlyphMapper
Internal mappers.
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()
Get/Set the type of radius used to generate the atoms.
void GlyphRender(vtkRenderer *ren, vtkActor *act)
Internal render methods.
int BondColorMode
Customize bond rendering.
void ReleaseGraphicsResources(vtkWindow *) override
Reimplemented from base class.
void UseVDWSpheresSettings()
Set ivars to default van der Waals spheres settings.
vtkNew< vtkTrivialProducer > AtomGlyphPointOutput
Cached variables and update methods.
void GetBounds(double bounds[6]) override
Reimplemented from base class.
virtual void UpdateBondGlyphPolyData()
Cached variables and update methods.
vtkNew< vtkPolyDataMapper > LatticeMapper
vtkNew< vtkPolyData > LatticePolyData
vtkNew< vtkPolyData > AtomGlyphPolyData
Cached variables and update methods.
class describing a molecule
Definition: vtkMolecule.h:95
Access to information about the elements.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:100
abstract specification for renderers
Definition: vtkRenderer.h:82
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:69
create a polygonal sphere centered at the origin
Producer for stand-alone data objects.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453