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 VTKVIS_PSEUDOCOLOR_H |
---|
9 | #define VTKVIS_PSEUDOCOLOR_H |
---|
10 | |
---|
11 | #include <vtkSmartPointer.h> |
---|
12 | #include <vtkLookupTable.h> |
---|
13 | #include <vtkPolyDataMapper.h> |
---|
14 | #include <vtkActor.h> |
---|
15 | #include <vtkPlaneCollection.h> |
---|
16 | #include <vtkGaussianSplatter.h> |
---|
17 | |
---|
18 | #include "ColorMap.h" |
---|
19 | #include "GraphicsObject.h" |
---|
20 | |
---|
21 | namespace VtkVis { |
---|
22 | |
---|
23 | /** |
---|
24 | * \brief Color-mapped plot of data set |
---|
25 | */ |
---|
26 | class PseudoColor : public GraphicsObject { |
---|
27 | public: |
---|
28 | enum CloudStyle { |
---|
29 | CLOUD_MESH, |
---|
30 | CLOUD_POINTS, |
---|
31 | CLOUD_SPLAT |
---|
32 | }; |
---|
33 | enum ColorMode { |
---|
34 | COLOR_BY_SCALAR, |
---|
35 | COLOR_BY_VECTOR_MAGNITUDE, |
---|
36 | COLOR_BY_VECTOR_X, |
---|
37 | COLOR_BY_VECTOR_Y, |
---|
38 | COLOR_BY_VECTOR_Z, |
---|
39 | COLOR_CONSTANT |
---|
40 | }; |
---|
41 | |
---|
42 | PseudoColor(); |
---|
43 | virtual ~PseudoColor(); |
---|
44 | |
---|
45 | virtual const char *getClassName() const |
---|
46 | { |
---|
47 | return "PseudoColor"; |
---|
48 | } |
---|
49 | |
---|
50 | virtual void setDataSet(DataSet *dataSet, |
---|
51 | Renderer *renderer); |
---|
52 | |
---|
53 | virtual void setClippingPlanes(vtkPlaneCollection *planes); |
---|
54 | |
---|
55 | void setCloudStyle(CloudStyle style); |
---|
56 | |
---|
57 | void setInterpolateBeforeMapping(bool state); |
---|
58 | |
---|
59 | void setColorMode(ColorMode mode, DataSet::DataAttributeType type, |
---|
60 | const char *name, double range[2] = NULL); |
---|
61 | |
---|
62 | void setColorMode(ColorMode mode, |
---|
63 | const char *name, double range[2] = NULL); |
---|
64 | |
---|
65 | void setColorMode(ColorMode mode); |
---|
66 | |
---|
67 | void setColorMap(ColorMap *colorMap); |
---|
68 | |
---|
69 | /** |
---|
70 | * \brief Return the ColorMap in use |
---|
71 | */ |
---|
72 | ColorMap *getColorMap() |
---|
73 | { |
---|
74 | return _colorMap; |
---|
75 | } |
---|
76 | |
---|
77 | void updateColorMap(); |
---|
78 | |
---|
79 | virtual void updateRanges(Renderer *renderer); |
---|
80 | |
---|
81 | private: |
---|
82 | virtual void update(); |
---|
83 | |
---|
84 | ColorMap *_colorMap; |
---|
85 | ColorMode _colorMode; |
---|
86 | std::string _colorFieldName; |
---|
87 | DataSet::DataAttributeType _colorFieldType; |
---|
88 | double _colorFieldRange[2]; |
---|
89 | double _vectorMagnitudeRange[2]; |
---|
90 | double _vectorComponentRange[3][2]; |
---|
91 | Renderer *_renderer; |
---|
92 | |
---|
93 | CloudStyle _cloudStyle; |
---|
94 | vtkSmartPointer<vtkLookupTable> _lut; |
---|
95 | vtkSmartPointer<vtkPolyDataMapper> _mapper; |
---|
96 | vtkSmartPointer<vtkGaussianSplatter> _splatter; |
---|
97 | }; |
---|
98 | |
---|
99 | } |
---|
100 | |
---|
101 | #endif |
---|