[2260] | 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> |
---|
[2270] | 12 | #include <vtkAlgorithmOutput.h> |
---|
[2260] | 13 | #include <vtkContourFilter.h> |
---|
| 14 | #include <vtkLookupTable.h> |
---|
| 15 | #include <vtkDataSetMapper.h> |
---|
| 16 | #include <vtkActor.h> |
---|
| 17 | #include <vtkPlaneCollection.h> |
---|
| 18 | #include <vtkGaussianSplatter.h> |
---|
| 19 | #include <vtkExtractVOI.h> |
---|
| 20 | #include <vtkWarpScalar.h> |
---|
[2328] | 21 | #include <vtkAssembly.h> |
---|
[2260] | 22 | #include <vtkPolyData.h> |
---|
[2457] | 23 | #include <vtkPlane.h> |
---|
[2260] | 24 | |
---|
| 25 | #include <vector> |
---|
| 26 | |
---|
[2402] | 27 | #include "ColorMap.h" |
---|
[2328] | 28 | #include "RpVtkGraphicsObject.h" |
---|
[2260] | 29 | |
---|
| 30 | namespace Rappture { |
---|
| 31 | namespace VtkVis { |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * \brief Color-mapped plot of data set |
---|
| 35 | */ |
---|
[2328] | 36 | class HeightMap : public VtkGraphicsObject { |
---|
[2260] | 37 | public: |
---|
| 38 | enum Axis { |
---|
| 39 | X_AXIS, |
---|
| 40 | Y_AXIS, |
---|
| 41 | Z_AXIS |
---|
| 42 | }; |
---|
| 43 | |
---|
[2423] | 44 | HeightMap(int numContours, double heightScale = 1.0); |
---|
[2402] | 45 | |
---|
[2423] | 46 | HeightMap(const std::vector<double>& contours, double heightScale = 1.0); |
---|
[2402] | 47 | |
---|
[2260] | 48 | virtual ~HeightMap(); |
---|
| 49 | |
---|
[2328] | 50 | virtual const char *getClassName() const |
---|
| 51 | { |
---|
| 52 | return "HeightMap"; |
---|
| 53 | } |
---|
[2260] | 54 | |
---|
[2402] | 55 | virtual void setDataSet(DataSet *dataset, |
---|
| 56 | bool useCumulative, |
---|
| 57 | double scalarRange[2], |
---|
| 58 | double vectorMagnitudeRange[2], |
---|
| 59 | double vectorComponentRange[3][2]); |
---|
[2260] | 60 | |
---|
[2328] | 61 | virtual void setLighting(bool state); |
---|
[2260] | 62 | |
---|
[2328] | 63 | virtual void setEdgeVisibility(bool state); |
---|
| 64 | |
---|
| 65 | virtual void setEdgeColor(float color[3]); |
---|
| 66 | |
---|
| 67 | virtual void setEdgeWidth(float edgeWidth); |
---|
| 68 | |
---|
| 69 | virtual void setClippingPlanes(vtkPlaneCollection *planes); |
---|
| 70 | |
---|
[2260] | 71 | void selectVolumeSlice(Axis axis, double ratio); |
---|
| 72 | |
---|
| 73 | void setHeightScale(double scale); |
---|
| 74 | |
---|
[2523] | 75 | double getHeightScale() |
---|
| 76 | { |
---|
| 77 | return _warpScale; |
---|
| 78 | } |
---|
| 79 | |
---|
[2423] | 80 | void setNumContours(int numContours); |
---|
[2260] | 81 | |
---|
| 82 | void setContourList(const std::vector<double>& contours); |
---|
| 83 | |
---|
| 84 | int getNumContours() const; |
---|
| 85 | |
---|
| 86 | const std::vector<double>& getContourList() const; |
---|
| 87 | |
---|
[2402] | 88 | void setColorMap(ColorMap *colorMap); |
---|
[2260] | 89 | |
---|
[2402] | 90 | /** |
---|
| 91 | * \brief Return the ColorMap in use |
---|
| 92 | */ |
---|
| 93 | ColorMap *getColorMap() |
---|
| 94 | { |
---|
| 95 | return _colorMap; |
---|
| 96 | } |
---|
[2260] | 97 | |
---|
[2402] | 98 | void updateColorMap(); |
---|
| 99 | |
---|
| 100 | virtual void updateRanges(bool useCumulative, |
---|
| 101 | double scalarRange[2], |
---|
| 102 | double vectorMagnitudeRange[2], |
---|
| 103 | double vectorComponentRange[3][2]); |
---|
| 104 | |
---|
[2423] | 105 | void setContourLineVisibility(bool state); |
---|
[2260] | 106 | |
---|
[2423] | 107 | void setContourSurfaceVisibility(bool state); |
---|
| 108 | |
---|
[2260] | 109 | void setContourEdgeColor(float color[3]); |
---|
| 110 | |
---|
| 111 | void setContourEdgeWidth(float edgeWidth); |
---|
| 112 | |
---|
[2328] | 113 | private: |
---|
[2402] | 114 | HeightMap(); |
---|
| 115 | |
---|
[2328] | 116 | virtual void initProp(); |
---|
| 117 | virtual void update(); |
---|
[2260] | 118 | |
---|
[2270] | 119 | vtkAlgorithmOutput *initWarp(vtkAlgorithmOutput *input); |
---|
| 120 | vtkAlgorithmOutput *initWarp(vtkPolyData *input); |
---|
[2260] | 121 | |
---|
| 122 | int _numContours; |
---|
| 123 | std::vector<double> _contours; |
---|
[2402] | 124 | ColorMap *_colorMap; |
---|
[2260] | 125 | |
---|
| 126 | float _contourEdgeColor[3]; |
---|
| 127 | float _contourEdgeWidth; |
---|
| 128 | double _warpScale; |
---|
[2290] | 129 | double _dataScale; |
---|
| 130 | Axis _sliceAxis; |
---|
[2270] | 131 | bool _pipelineInitialized; |
---|
[2260] | 132 | |
---|
| 133 | vtkSmartPointer<vtkLookupTable> _lut; |
---|
| 134 | vtkSmartPointer<vtkDataSetMapper> _dsMapper; |
---|
| 135 | vtkSmartPointer<vtkContourFilter> _contourFilter; |
---|
| 136 | vtkSmartPointer<vtkPolyDataMapper> _contourMapper; |
---|
| 137 | vtkSmartPointer<vtkGaussianSplatter> _pointSplatter; |
---|
| 138 | vtkSmartPointer<vtkExtractVOI> _volumeSlicer; |
---|
[2457] | 139 | vtkSmartPointer<vtkPlane> _cutPlane; |
---|
[2260] | 140 | vtkSmartPointer<vtkWarpScalar> _warp; |
---|
| 141 | vtkSmartPointer<vtkActor> _dsActor; |
---|
| 142 | vtkSmartPointer<vtkActor> _contourActor; |
---|
| 143 | }; |
---|
| 144 | |
---|
| 145 | } |
---|
| 146 | } |
---|
| 147 | |
---|
| 148 | #endif |
---|