source: branches/vtkvis_threaded/RpMolecule.h @ 2495

Last change on this file since 2495 was 2402, checked in by ldelgass, 13 years ago
  • Let graphics objects handle DataSet? cumulative range changes, track vectors as well as scalars, also supply cumulative ranges in setDataSet()
  • Be more consistent about naming enums and commands for vectors
  • Add constructor arguments to some graphics objects to speed initialization (eliminates some pipeline changes)
  • Apply a scale factor to glyphs based on cell sizes
  • Add line glyph shape
  • Don't delete ColorMaps? in use
  • Update graphics objects when a ColorMap? is edited
  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (C) 2011, Purdue Research Foundation
4 *
5 * Author: Leif Delgass <ldelgass@purdue.edu>
6 */
7
8#ifndef __RAPPTURE_VTKVIS_MOLECULE_H__
9#define __RAPPTURE_VTKVIS_MOLECULE_H__
10
11#include <vtkSmartPointer.h>
12#include <vtkLookupTable.h>
13#include <vtkPolyDataMapper.h>
14#include <vtkActor.h>
15#include <vtkAssembly.h>
16#include <vtkGlyph3D.h>
17
18#include "ColorMap.h"
19#include "RpVtkGraphicsObject.h"
20
21namespace Rappture {
22namespace VtkVis {
23
24/**
25 * \brief Ball and stick Molecule
26 *
27 * The data format for this class is based on the VisIt Molecule
28 * plot.  It consists of a vtkPolyData with atom coordinates as
29 * points and vertices and bonds as lines.  A scalar array named
30 * "element" can be included as point data to specify atomic
31 * numbers to use in coloring (via the "elementDefault" ColorMap)
32 * and scaling atoms.  If the scalar array is not named
33 * "element," it will be color-mapped as a standard scalar field.
34 */
35class Molecule : public VtkGraphicsObject {
36public:
37    enum AtomScaling {
38        NO_ATOM_SCALING,
39        VAN_DER_WAALS_RADIUS,
40        COVALENT_RADIUS,
41        ATOMIC_RADIUS
42    };
43
44    Molecule();
45    virtual ~Molecule();
46
47    virtual const char *getClassName() const
48    {
49        return "Molecule";
50    }
51
52    virtual void setClippingPlanes(vtkPlaneCollection *planes);
53
54    void setColorMap(ColorMap *colorMap);
55
56    /**
57     * \brief Return the ColorMap in use
58     */
59    ColorMap *getColorMap()
60    {
61        return _colorMap;
62    }
63
64    void updateColorMap();
65
66    virtual void updateRanges(bool useCumulative,
67                              double scalarRange[2],
68                              double vectorMagnitudeRange[2],
69                              double vectorComponentRange[3][2]);
70
71    void setAtomScaling(AtomScaling state);
72
73    void setAtomVisibility(bool state);
74
75    void setBondVisibility(bool state);
76
77    static ColorMap *createElementColorMap();
78
79private:
80    virtual void initProp();
81    virtual void update();
82
83    static void addRadiusArray(vtkDataSet *dataSet, AtomScaling scaling);
84
85    AtomScaling _atomScaling;
86    ColorMap *_colorMap;
87
88    vtkSmartPointer<vtkLookupTable> _lut;
89    vtkSmartPointer<vtkActor> _atomProp;
90    vtkSmartPointer<vtkActor> _bondProp;
91    vtkSmartPointer<vtkGlyph3D> _glypher;
92    vtkSmartPointer<vtkPolyDataMapper> _atomMapper;
93    vtkSmartPointer<vtkPolyDataMapper> _bondMapper;
94};
95
96}
97}
98
99#endif
Note: See TracBrowser for help on using the repository browser.