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_HEIGHTMAP_H__ |
---|
9 | #define __RAPPTURE_VTKVIS_HEIGHTMAP_H__ |
---|
10 | |
---|
11 | #include <vtkSmartPointer.h> |
---|
12 | #include <vtkAlgorithmOutput.h> |
---|
13 | #include <vtkContourFilter.h> |
---|
14 | #include <vtkProbeFilter.h> |
---|
15 | #include <vtkLookupTable.h> |
---|
16 | #include <vtkDataSetMapper.h> |
---|
17 | #include <vtkActor.h> |
---|
18 | #include <vtkPlaneCollection.h> |
---|
19 | #include <vtkGaussianSplatter.h> |
---|
20 | #include <vtkExtractVOI.h> |
---|
21 | #include <vtkWarpScalar.h> |
---|
22 | #include <vtkPropAssembly.h> |
---|
23 | #include <vtkPolyData.h> |
---|
24 | |
---|
25 | #include <vector> |
---|
26 | |
---|
27 | #include "RpVtkDataSet.h" |
---|
28 | |
---|
29 | namespace Rappture { |
---|
30 | namespace VtkVis { |
---|
31 | |
---|
32 | /** |
---|
33 | * \brief Color-mapped plot of data set |
---|
34 | */ |
---|
35 | class HeightMap { |
---|
36 | public: |
---|
37 | enum Axis { |
---|
38 | X_AXIS, |
---|
39 | Y_AXIS, |
---|
40 | Z_AXIS |
---|
41 | }; |
---|
42 | |
---|
43 | HeightMap(); |
---|
44 | virtual ~HeightMap(); |
---|
45 | |
---|
46 | void setDataSet(DataSet *dataset); |
---|
47 | |
---|
48 | DataSet *getDataSet(); |
---|
49 | |
---|
50 | vtkProp *getProp(); |
---|
51 | |
---|
52 | void selectVolumeSlice(Axis axis, double ratio); |
---|
53 | |
---|
54 | void setHeightScale(double scale); |
---|
55 | |
---|
56 | void setContours(int numContours); |
---|
57 | |
---|
58 | void setContours(int numContours, double range[2]); |
---|
59 | |
---|
60 | void setContourList(const std::vector<double>& contours); |
---|
61 | |
---|
62 | int getNumContours() const; |
---|
63 | |
---|
64 | const std::vector<double>& getContourList() const; |
---|
65 | |
---|
66 | void setLookupTable(vtkLookupTable *lut); |
---|
67 | |
---|
68 | vtkLookupTable *getLookupTable(); |
---|
69 | |
---|
70 | void setVisibility(bool state); |
---|
71 | |
---|
72 | bool getVisibility(); |
---|
73 | |
---|
74 | void setOpacity(double opacity); |
---|
75 | |
---|
76 | void setEdgeVisibility(bool state); |
---|
77 | |
---|
78 | void setEdgeColor(float color[3]); |
---|
79 | |
---|
80 | void setEdgeWidth(float edgeWidth); |
---|
81 | |
---|
82 | void setContourVisibility(bool state); |
---|
83 | |
---|
84 | void setContourEdgeColor(float color[3]); |
---|
85 | |
---|
86 | void setContourEdgeWidth(float edgeWidth); |
---|
87 | |
---|
88 | void setClippingPlanes(vtkPlaneCollection *planes); |
---|
89 | |
---|
90 | void setLighting(bool state); |
---|
91 | |
---|
92 | private: |
---|
93 | vtkAlgorithmOutput *initWarp(vtkAlgorithmOutput *input); |
---|
94 | vtkAlgorithmOutput *initWarp(vtkPolyData *input); |
---|
95 | void initProp(); |
---|
96 | void update(); |
---|
97 | |
---|
98 | DataSet * _dataSet; |
---|
99 | |
---|
100 | int _numContours; |
---|
101 | std::vector<double> _contours; |
---|
102 | double _dataRange[2]; |
---|
103 | |
---|
104 | float _edgeColor[3]; |
---|
105 | float _contourEdgeColor[3]; |
---|
106 | float _edgeWidth; |
---|
107 | float _contourEdgeWidth; |
---|
108 | double _opacity; |
---|
109 | double _warpScale; |
---|
110 | double _dataScale; |
---|
111 | Axis _sliceAxis; |
---|
112 | bool _pipelineInitialized; |
---|
113 | |
---|
114 | vtkSmartPointer<vtkLookupTable> _lut; |
---|
115 | vtkSmartPointer<vtkDataSetMapper> _dsMapper; |
---|
116 | vtkSmartPointer<vtkContourFilter> _contourFilter; |
---|
117 | vtkSmartPointer<vtkPolyDataMapper> _contourMapper; |
---|
118 | vtkSmartPointer<vtkGaussianSplatter> _pointSplatter; |
---|
119 | vtkSmartPointer<vtkProbeFilter> _probeFilter; |
---|
120 | vtkSmartPointer<vtkExtractVOI> _volumeSlicer; |
---|
121 | vtkSmartPointer<vtkWarpScalar> _warp; |
---|
122 | vtkSmartPointer<vtkActor> _dsActor; |
---|
123 | vtkSmartPointer<vtkActor> _contourActor; |
---|
124 | vtkSmartPointer<vtkPropAssembly> _props; |
---|
125 | }; |
---|
126 | |
---|
127 | } |
---|
128 | } |
---|
129 | |
---|
130 | #endif |
---|