source: branches/blt4/packages/vizservers/vtkvis/RpMolecule.h @ 2742

Last change on this file since 2742 was 2681, checked in by gah, 13 years ago
File size: 2.2 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(Renderer *renderer);
67
68    void setAtomScaling(AtomScaling state);
69
70    void setAtomVisibility(bool state);
71
72    void setBondVisibility(bool state);
73
74    static ColorMap *createElementColorMap();
75
76private:
77    virtual void initProp();
78    virtual void update();
79
80    static void addRadiusArray(vtkDataSet *dataSet, AtomScaling scaling);
81
82    AtomScaling _atomScaling;
83    ColorMap *_colorMap;
84
85    vtkSmartPointer<vtkLookupTable> _lut;
86    vtkSmartPointer<vtkActor> _atomProp;
87    vtkSmartPointer<vtkActor> _bondProp;
88    vtkSmartPointer<vtkGlyph3D> _glypher;
89    vtkSmartPointer<vtkPolyDataMapper> _atomMapper;
90    vtkSmartPointer<vtkPolyDataMapper> _bondMapper;
91};
92
93}
94}
95
96#endif
Note: See TracBrowser for help on using the repository browser.