VTK  9.1.0
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=========================================================================*/
43#ifndef vtkMoleculeMapper_h
44#define vtkMoleculeMapper_h
45
46#include "vtkDomainsChemistryModule.h" // For export macro
47#include "vtkMapper.h"
48#include "vtkNew.h" // For vtkNew
49
50class vtkActor;
52class vtkIdTypeArray;
53class vtkMolecule;
55class vtkPolyData;
57class vtkRenderer;
58class vtkSelection;
59class vtkSphereSource;
61
62class VTKDOMAINSCHEMISTRY_EXPORT vtkMoleculeMapper : public vtkMapper
63{
64public:
67 void PrintSelf(ostream& os, vtkIndent indent) override;
68
70
76
89
102
115
131
133
136 vtkGetMacro(RenderAtoms, bool);
137 vtkSetMacro(RenderAtoms, bool);
138 vtkBooleanMacro(RenderAtoms, bool);
140
142
145 vtkGetMacro(RenderBonds, bool);
146 vtkSetMacro(RenderBonds, bool);
147 vtkBooleanMacro(RenderBonds, bool);
149
151
155 vtkGetMacro(RenderLattice, bool);
156 vtkSetMacro(RenderLattice, bool);
157 vtkBooleanMacro(RenderLattice, bool);
159
160 enum
161 {
162 CovalentRadius = 0,
165 CustomArrayRadius
166 };
167
169
174 vtkGetMacro(AtomicRadiusType, int);
175 vtkSetMacro(AtomicRadiusType, int);
177 void SetAtomicRadiusTypeToCovalentRadius() { this->SetAtomicRadiusType(CovalentRadius); }
178 void SetAtomicRadiusTypeToVDWRadius() { this->SetAtomicRadiusType(VDWRadius); }
179 void SetAtomicRadiusTypeToUnitRadius() { this->SetAtomicRadiusType(UnitRadius); }
180 void SetAtomicRadiusTypeToCustomArrayRadius() { this->SetAtomicRadiusType(CustomArrayRadius); }
182
184
189 vtkGetMacro(AtomicRadiusScaleFactor, float);
190 vtkSetMacro(AtomicRadiusScaleFactor, float);
192
194
198 vtkGetMacro(UseMultiCylindersForBonds, bool);
199 vtkSetMacro(UseMultiCylindersForBonds, bool);
200 vtkBooleanMacro(UseMultiCylindersForBonds, bool);
202
203 enum
204 {
205 SingleColor = 0,
206 DiscreteByAtom
207 };
208
210
220 vtkGetMacro(BondColorMode, int);
221 vtkSetClampMacro(BondColorMode, int, SingleColor, DiscreteByAtom);
222 void SetBondColorModeToSingleColor() { this->SetBondColorMode(SingleColor); }
223 void SetBondColorModeToDiscreteByAtom() { this->SetBondColorMode(DiscreteByAtom); }
226
228
237 vtkGetMacro(AtomColorMode, int);
238 vtkSetClampMacro(AtomColorMode, int, SingleColor, DiscreteByAtom);
240
242
246 vtkGetVector3Macro(AtomColor, unsigned char);
247 vtkSetVector3Macro(AtomColor, unsigned char);
249
251
255 vtkGetVector3Macro(BondColor, unsigned char);
256 vtkSetVector3Macro(BondColor, unsigned char);
258
260
263 vtkGetMacro(BondRadius, float);
264 vtkSetMacro(BondRadius, float);
266
268
272 vtkGetVector3Macro(LatticeColor, unsigned char);
273 vtkSetVector3Macro(LatticeColor, unsigned char);
275
277
282 vtkSelection* selection, vtkIdTypeArray* atomIds, vtkIdTypeArray* bondIds);
283 virtual void GetSelectedAtoms(vtkSelection* selection, vtkIdTypeArray* atomIds)
284 {
285 this->GetSelectedAtomsAndBonds(selection, atomIds, nullptr);
286 }
287 virtual void GetSelectedBonds(vtkSelection* selection, vtkIdTypeArray* bondIds)
288 {
289 this->GetSelectedAtomsAndBonds(selection, nullptr, bondIds);
290 }
292
294
297 void Render(vtkRenderer*, vtkActor*) override;
299 double* GetBounds() override;
300 void GetBounds(double bounds[6]) override { vtkAbstractMapper3D::GetBounds(bounds); }
301 int FillInputPortInformation(int port, vtkInformation* info) override;
302 bool GetSupportsSelection() override { return true; }
304
306
310 vtkGetStringMacro(AtomicRadiusArrayName);
311 vtkSetStringMacro(AtomicRadiusArrayName);
313
318 virtual void SetMapScalars(bool map);
319
323 vtkPeriodicTable* GetPeriodicTable() { return this->PeriodicTable; }
324
325protected:
328
330
338 unsigned char AtomColor[3];
340
342
349 unsigned char BondColor[3];
351
353
358
360
368 virtual void UpdateGlyphPolyData();
372
374
380
381 unsigned char LatticeColor[3];
384 virtual void UpdateLatticePolyData();
385
390
391private:
392 vtkMoleculeMapper(const vtkMoleculeMapper&) = delete;
393 void operator=(const vtkMoleculeMapper&) = delete;
394};
395
396#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:155
vtkGlyph3D on the GPU.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:113
Store vtkAlgorithm input/output information.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:171
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.
const char * GetBondColorModeAsString()
Get/Set the method by which bonds are colored.
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.
vtkPeriodicTable * GetPeriodicTable()
Accessor to internal structure.
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.
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.
static vtkMoleculeMapper * New()
virtual void UpdateAtomGlyphPolyData()
Cached variables and update methods.
int AtomColorMode
Customize atom rendering.
double * GetBounds() override
Reimplemented from base class.
virtual void UpdateGlyphPolyData()
Cached variables and update methods.
vtkNew< vtkPolyData > BondGlyphPolyData
Cached variables and update methods.
vtkNew< vtkTrivialProducer > BondGlyphPointOutput
Cached variables and update methods.
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.
bool UseMultiCylindersForBonds
Customize bond rendering.
bool GetSupportsSelection() override
Reimplemented from base class.
const char * GetAtomicRadiusTypeAsString()
Get/Set the type of radius used to generate the atoms.
vtkNew< vtkGlyph3DMapper > BondGlyphMapper
Internal mappers.
vtkMolecule * GetInput()
Get/Set the input vtkMolecule.
void SetInputData(vtkMolecule *in)
Get/Set the input vtkMolecule.
virtual void UpdateLatticePolyData()
void UseBallAndStickSettings()
Set ivars to default ball-and-stick settings.
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:111
Allocate and hold a VTK object.
Definition: vtkNew.h:165
Access to information about the elements.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
abstract specification for renderers
Definition: vtkRenderer.h:182
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:163
create a polygonal sphere centered at the origin
Producer for stand-alone data objects.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39