source: trunk/packages/vizservers/vtkvis/RpContour2D.h @ 3177

Last change on this file since 3177 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

  • Property svn:eol-style set to native
File size: 2.6 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (C) 2004-2012  HUBzero Foundation, LLC
4 *
5 * Author: Leif Delgass <ldelgass@purdue.edu>
6 */
7
8#ifndef __RAPPTURE_VTKVIS_CONTOUR2D_H__
9#define __RAPPTURE_VTKVIS_CONTOUR2D_H__
10
11#include <vtkSmartPointer.h>
12#include <vtkContourFilter.h>
13#include <vtkPolyDataMapper.h>
14#include <vtkActor.h>
15#include <vtkPlaneCollection.h>
16#include <vtkLookupTable.h>
17
18#include <vector>
19
20#include "ColorMap.h"
21#include "RpVtkGraphicsObject.h"
22
23namespace Rappture {
24namespace VtkVis {
25
26/**
27 * \brief 2D Contour lines (isolines)
28 */
29class Contour2D : public VtkGraphicsObject {
30public:
31    enum ColorMode {
32        COLOR_BY_SCALAR,
33        COLOR_BY_VECTOR_MAGNITUDE,
34        COLOR_BY_VECTOR_X,
35        COLOR_BY_VECTOR_Y,
36        COLOR_BY_VECTOR_Z,
37        COLOR_CONSTANT
38    };
39
40    Contour2D(int numContours);
41
42    Contour2D(const std::vector<double>& contours);
43
44    virtual ~Contour2D();
45
46    virtual const char *getClassName() const
47    {
48        return "Contour2D";
49    }
50
51    virtual void setDataSet(DataSet *dataSet,
52                            Renderer *renderer);
53
54    virtual void setClippingPlanes(vtkPlaneCollection *planes);
55
56    void setContours(int numContours);
57
58    void setContourList(const std::vector<double>& contours);
59
60    int getNumContours() const;
61
62    const std::vector<double>& getContourList() const;
63
64    void setColorMode(ColorMode mode, DataSet::DataAttributeType type,
65                      const char *name, double range[2] = NULL);
66
67    void setColorMode(ColorMode mode,
68                      const char *name, double range[2] = NULL);
69
70    void setColorMode(ColorMode mode);
71
72    void setColorMap(ColorMap *colorMap);
73
74    /**
75     * \brief Return the ColorMap in use
76     */
77    ColorMap *getColorMap()
78    {
79        return _colorMap;
80    }
81
82    void updateColorMap();
83
84    virtual void updateRanges(Renderer *renderer);
85
86    virtual void setColor(float color[3])
87    {
88        VtkGraphicsObject::setColor(color);
89        VtkGraphicsObject::setEdgeColor(color);
90    }
91
92    virtual void setEdgeColor(float color[3])
93    {
94        setColor(color);
95    }
96
97private:
98    Contour2D();
99
100    virtual void update();
101
102    int _numContours;
103    std::vector<double> _contours;
104
105    ColorMap *_colorMap;
106    ColorMode _colorMode;
107    std::string _colorFieldName;
108    DataSet::DataAttributeType _colorFieldType;
109    double _colorFieldRange[2];
110    double _vectorMagnitudeRange[2];
111    double _vectorComponentRange[3][2];
112    Renderer *_renderer;
113
114    vtkSmartPointer<vtkLookupTable> _lut;
115    vtkSmartPointer<vtkContourFilter> _contourFilter;
116    vtkSmartPointer<vtkPolyDataMapper> _dsMapper;
117};
118
119}
120}
121
122#endif
Note: See TracBrowser for help on using the repository browser.