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