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_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 | |
---|
17 | #include <vector> |
---|
18 | |
---|
19 | #include "RpVtkDataSet.h" |
---|
20 | |
---|
21 | namespace Rappture { |
---|
22 | namespace VtkVis { |
---|
23 | |
---|
24 | /** |
---|
25 | * \brief 2D Contour lines (isolines) |
---|
26 | */ |
---|
27 | class Contour2D { |
---|
28 | public: |
---|
29 | Contour2D(); |
---|
30 | virtual ~Contour2D(); |
---|
31 | |
---|
32 | void setDataSet(DataSet *dataset); |
---|
33 | |
---|
34 | DataSet *getDataSet(); |
---|
35 | |
---|
36 | vtkActor *getActor(); |
---|
37 | |
---|
38 | void setContours(int numContours); |
---|
39 | |
---|
40 | void setContours(int numContours, double range[2]); |
---|
41 | |
---|
42 | void setContourList(const std::vector<double>& contours); |
---|
43 | |
---|
44 | int getNumContours() const; |
---|
45 | |
---|
46 | const std::vector<double>& getContourList() const; |
---|
47 | |
---|
48 | void setVisibility(bool state); |
---|
49 | |
---|
50 | bool getVisibility() const; |
---|
51 | |
---|
52 | void setOpacity(double opacity); |
---|
53 | |
---|
54 | void setEdgeColor(float color[3]); |
---|
55 | |
---|
56 | void setEdgeWidth(float edgeWidth); |
---|
57 | |
---|
58 | void setClippingPlanes(vtkPlaneCollection *planes); |
---|
59 | |
---|
60 | void setLighting(bool state); |
---|
61 | |
---|
62 | private: |
---|
63 | void initActor(); |
---|
64 | void update(); |
---|
65 | |
---|
66 | DataSet *_dataSet; |
---|
67 | |
---|
68 | int _numContours; |
---|
69 | std::vector<double> _contours; |
---|
70 | double _dataRange[2]; |
---|
71 | |
---|
72 | float _edgeColor[3]; |
---|
73 | float _edgeWidth; |
---|
74 | double _opacity; |
---|
75 | vtkSmartPointer<vtkContourFilter> _contourFilter; |
---|
76 | vtkSmartPointer<vtkPolyDataMapper> _contourMapper; |
---|
77 | vtkSmartPointer<vtkActor> _contourActor; |
---|
78 | }; |
---|
79 | |
---|
80 | } |
---|
81 | } |
---|
82 | |
---|
83 | #endif |
---|