VTK  9.3.0
vtkMoleculeMapper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
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 VTK_ABI_NAMESPACE_BEGIN
32 class vtkActor;
33 class vtkGlyph3DMapper;
34 class vtkIdTypeArray;
35 class vtkMolecule;
36 class vtkPeriodicTable;
37 class vtkPolyData;
38 class vtkPolyDataMapper;
39 class vtkRenderer;
40 class vtkSelection;
41 class vtkSphereSource;
42 class vtkTrivialProducer;
43 
44 class VTKDOMAINSCHEMISTRY_EXPORT vtkMoleculeMapper : public vtkMapper
45 {
46 public:
48  vtkTypeMacro(vtkMoleculeMapper, vtkMapper);
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
58 
71 
84 
97 
113 
115 
118  vtkGetMacro(RenderAtoms, bool);
119  vtkSetMacro(RenderAtoms, bool);
120  vtkBooleanMacro(RenderAtoms, bool);
122 
124 
127  vtkGetMacro(RenderBonds, bool);
128  vtkSetMacro(RenderBonds, bool);
129  vtkBooleanMacro(RenderBonds, bool);
131 
133 
137  vtkGetMacro(RenderLattice, bool);
138  vtkSetMacro(RenderLattice, bool);
139  vtkBooleanMacro(RenderLattice, bool);
141 
142  enum
143  {
144  CovalentRadius = 0,
147  CustomArrayRadius
148  };
149 
151 
156  vtkGetMacro(AtomicRadiusType, int);
157  vtkSetMacro(AtomicRadiusType, int);
159  void SetAtomicRadiusTypeToCovalentRadius() { this->SetAtomicRadiusType(CovalentRadius); }
160  void SetAtomicRadiusTypeToVDWRadius() { this->SetAtomicRadiusType(VDWRadius); }
161  void SetAtomicRadiusTypeToUnitRadius() { this->SetAtomicRadiusType(UnitRadius); }
162  void SetAtomicRadiusTypeToCustomArrayRadius() { this->SetAtomicRadiusType(CustomArrayRadius); }
164 
166 
171  vtkGetMacro(AtomicRadiusScaleFactor, float);
172  vtkSetMacro(AtomicRadiusScaleFactor, float);
174 
176 
180  vtkGetMacro(UseMultiCylindersForBonds, bool);
181  vtkSetMacro(UseMultiCylindersForBonds, bool);
182  vtkBooleanMacro(UseMultiCylindersForBonds, bool);
184 
185  enum
186  {
187  SingleColor = 0,
188  DiscreteByAtom
189  };
190 
192 
202  vtkGetMacro(BondColorMode, int);
203  vtkSetClampMacro(BondColorMode, int, SingleColor, DiscreteByAtom);
204  void SetBondColorModeToSingleColor() { this->SetBondColorMode(SingleColor); }
205  void SetBondColorModeToDiscreteByAtom() { this->SetBondColorMode(DiscreteByAtom); }
208 
210 
219  vtkGetMacro(AtomColorMode, int);
220  vtkSetClampMacro(AtomColorMode, int, SingleColor, DiscreteByAtom);
222 
224 
228  vtkGetVector3Macro(AtomColor, unsigned char);
229  vtkSetVector3Macro(AtomColor, unsigned char);
231 
233 
237  vtkGetVector3Macro(BondColor, unsigned char);
238  vtkSetVector3Macro(BondColor, unsigned char);
240 
242 
245  vtkGetMacro(BondRadius, float);
246  vtkSetMacro(BondRadius, float);
248 
250 
254  vtkGetVector3Macro(LatticeColor, unsigned char);
255  vtkSetVector3Macro(LatticeColor, unsigned char);
257 
259 
264  vtkSelection* selection, vtkIdTypeArray* atomIds, vtkIdTypeArray* bondIds);
265  virtual void GetSelectedAtoms(vtkSelection* selection, vtkIdTypeArray* atomIds)
266  {
267  this->GetSelectedAtomsAndBonds(selection, atomIds, nullptr);
268  }
269  virtual void GetSelectedBonds(vtkSelection* selection, vtkIdTypeArray* bondIds)
270  {
271  this->GetSelectedAtomsAndBonds(selection, nullptr, bondIds);
272  }
274 
276 
279  void Render(vtkRenderer*, vtkActor*) override;
281  double* GetBounds() override;
282  void GetBounds(double bounds[6]) override { Superclass::GetBounds(bounds); }
284  bool GetSupportsSelection() override { return true; }
286 
288 
292  vtkGetStringMacro(AtomicRadiusArrayName);
293  vtkSetStringMacro(AtomicRadiusArrayName);
295 
300  virtual void SetMapScalars(bool map);
301 
305  vtkPeriodicTable* GetPeriodicTable() { return this->PeriodicTable; }
306 
307 protected:
309  ~vtkMoleculeMapper() override;
310 
312 
320  unsigned char AtomColor[3];
322 
324 
330  float BondRadius;
331  unsigned char BondColor[3];
333 
335 
339  void GlyphRender(vtkRenderer* ren, vtkActor* act);
340 
342 
350  virtual void UpdateGlyphPolyData();
351  virtual void UpdateAtomGlyphPolyData();
352  virtual void UpdateBondGlyphPolyData();
354 
356 
362 
363  unsigned char LatticeColor[3];
366  virtual void UpdateLatticePolyData();
367 
372 
373 private:
374  vtkMoleculeMapper(const vtkMoleculeMapper&) = delete;
375  void operator=(const vtkMoleculeMapper&) = delete;
376 };
377 
378 VTK_ABI_NAMESPACE_END
379 #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:50
vtkGlyph3D on the GPU.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:38
Store vtkAlgorithm input/output information.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:86
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:84
Access to information about the elements.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
abstract specification for renderers
Definition: vtkRenderer.h:71
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:59
create a polygonal sphere centered at the origin
Producer for stand-alone data objects.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447