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=========================================================================*/
33#ifndef vtkMoleculeMapper_h
34#define vtkMoleculeMapper_h
35
36#include "vtkDomainsChemistryModule.h" // For export macro
37#include "vtkMapper.h"
38#include "vtkNew.h" // For vtkNew
39
40class vtkActor;
42class vtkIdTypeArray;
43class vtkMolecule;
45class vtkPolyData;
47class vtkRenderer;
48class vtkSelection;
49class vtkSphereSource;
51
52class VTKDOMAINSCHEMISTRY_EXPORT vtkMoleculeMapper : public vtkMapper
53{
54public:
57 void PrintSelf(ostream& os, vtkIndent indent) override;
58
60
66
79
92
105
121
123
126 vtkGetMacro(RenderAtoms, bool);
127 vtkSetMacro(RenderAtoms, bool);
128 vtkBooleanMacro(RenderAtoms, bool);
130
132
135 vtkGetMacro(RenderBonds, bool);
136 vtkSetMacro(RenderBonds, bool);
137 vtkBooleanMacro(RenderBonds, bool);
139
141
145 vtkGetMacro(RenderLattice, bool);
146 vtkSetMacro(RenderLattice, bool);
147 vtkBooleanMacro(RenderLattice, bool);
149
150 enum
151 {
152 CovalentRadius = 0,
155 CustomArrayRadius
156 };
157
159
164 vtkGetMacro(AtomicRadiusType, int);
165 vtkSetMacro(AtomicRadiusType, int);
167 void SetAtomicRadiusTypeToCovalentRadius() { this->SetAtomicRadiusType(CovalentRadius); }
168 void SetAtomicRadiusTypeToVDWRadius() { this->SetAtomicRadiusType(VDWRadius); }
169 void SetAtomicRadiusTypeToUnitRadius() { this->SetAtomicRadiusType(UnitRadius); }
170 void SetAtomicRadiusTypeToCustomArrayRadius() { this->SetAtomicRadiusType(CustomArrayRadius); }
172
174
179 vtkGetMacro(AtomicRadiusScaleFactor, float);
180 vtkSetMacro(AtomicRadiusScaleFactor, float);
182
184
188 vtkGetMacro(UseMultiCylindersForBonds, bool);
189 vtkSetMacro(UseMultiCylindersForBonds, bool);
190 vtkBooleanMacro(UseMultiCylindersForBonds, bool);
192
193 enum
194 {
195 SingleColor = 0,
196 DiscreteByAtom
197 };
198
200
210 vtkGetMacro(BondColorMode, int);
211 vtkSetClampMacro(BondColorMode, int, SingleColor, DiscreteByAtom);
212 void SetBondColorModeToSingleColor() { this->SetBondColorMode(SingleColor); }
213 void SetBondColorModeToDiscreteByAtom() { this->SetBondColorMode(DiscreteByAtom); }
216
218
227 vtkGetMacro(AtomColorMode, int);
228 vtkSetClampMacro(AtomColorMode, int, SingleColor, DiscreteByAtom);
230
232
236 vtkGetVector3Macro(AtomColor, unsigned char);
237 vtkSetVector3Macro(AtomColor, unsigned char);
239
241
245 vtkGetVector3Macro(BondColor, unsigned char);
246 vtkSetVector3Macro(BondColor, unsigned char);
248
250
253 vtkGetMacro(BondRadius, float);
254 vtkSetMacro(BondRadius, float);
256
258
262 vtkGetVector3Macro(LatticeColor, unsigned char);
263 vtkSetVector3Macro(LatticeColor, unsigned char);
265
267
272 vtkSelection* selection, vtkIdTypeArray* atomIds, vtkIdTypeArray* bondIds);
273 virtual void GetSelectedAtoms(vtkSelection* selection, vtkIdTypeArray* atomIds)
274 {
275 this->GetSelectedAtomsAndBonds(selection, atomIds, nullptr);
276 }
277 virtual void GetSelectedBonds(vtkSelection* selection, vtkIdTypeArray* bondIds)
278 {
279 this->GetSelectedAtomsAndBonds(selection, nullptr, bondIds);
280 }
282
284
287 void Render(vtkRenderer*, vtkActor*) override;
289 double* GetBounds() override;
290 void GetBounds(double bounds[6]) override { vtkAbstractMapper3D::GetBounds(bounds); }
292 bool GetSupportsSelection() override { return true; }
294
296
300 vtkGetStringMacro(AtomicRadiusArrayName);
301 vtkSetStringMacro(AtomicRadiusArrayName);
303
308 virtual void SetMapScalars(bool map);
309
313 vtkPeriodicTable* GetPeriodicTable() { return this->PeriodicTable; }
314
315protected:
318
320
328 unsigned char AtomColor[3];
330
332
339 unsigned char BondColor[3];
341
343
348
350
358 virtual void UpdateGlyphPolyData();
362
364
370
371 unsigned char LatticeColor[3];
374 virtual void UpdateLatticePolyData();
375
380
381private:
382 vtkMoleculeMapper(const vtkMoleculeMapper&) = delete;
383 void operator=(const vtkMoleculeMapper&) = delete;
384};
385
386#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:55
vtkGlyph3D on the GPU.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:43
Store vtkAlgorithm input/output information.
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:91
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:92
Access to information about the elements.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:95
abstract specification for renderers
Definition: vtkRenderer.h:73
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:63
create a polygonal sphere centered at the origin
Producer for stand-alone data objects.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:45
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453