[2100] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
| 2 | /* |
---|
[3177] | 3 | * Copyright (C) 2004-2012 HUBzero Foundation, LLC |
---|
[2100] | 4 | * |
---|
| 5 | * Author: Leif Delgass <ldelgass@purdue.edu> |
---|
| 6 | */ |
---|
| 7 | |
---|
[3615] | 8 | #ifndef VTKVIS_PSEUDOCOLOR_H |
---|
| 9 | #define VTKVIS_PSEUDOCOLOR_H |
---|
[2100] | 10 | |
---|
| 11 | #include <vtkSmartPointer.h> |
---|
| 12 | #include <vtkLookupTable.h> |
---|
[3680] | 13 | #include <vtkPolyDataMapper.h> |
---|
[2100] | 14 | #include <vtkActor.h> |
---|
| 15 | #include <vtkPlaneCollection.h> |
---|
[3680] | 16 | #include <vtkGaussianSplatter.h> |
---|
[2100] | 17 | |
---|
[2402] | 18 | #include "ColorMap.h" |
---|
[3621] | 19 | #include "GraphicsObject.h" |
---|
[2100] | 20 | |
---|
| 21 | namespace VtkVis { |
---|
| 22 | |
---|
| 23 | /** |
---|
| 24 | * \brief Color-mapped plot of data set |
---|
| 25 | */ |
---|
[3621] | 26 | class PseudoColor : public GraphicsObject { |
---|
[2100] | 27 | public: |
---|
[3680] | 28 | enum CloudStyle { |
---|
| 29 | CLOUD_MESH, |
---|
| 30 | CLOUD_POINTS, |
---|
| 31 | CLOUD_SPLAT |
---|
| 32 | }; |
---|
[2492] | 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 | |
---|
[2100] | 42 | PseudoColor(); |
---|
| 43 | virtual ~PseudoColor(); |
---|
| 44 | |
---|
[2328] | 45 | virtual const char *getClassName() const |
---|
| 46 | { |
---|
| 47 | return "PseudoColor"; |
---|
| 48 | } |
---|
[2100] | 49 | |
---|
[2492] | 50 | virtual void setDataSet(DataSet *dataSet, |
---|
[2612] | 51 | Renderer *renderer); |
---|
[2492] | 52 | |
---|
[2328] | 53 | virtual void setClippingPlanes(vtkPlaneCollection *planes); |
---|
[2137] | 54 | |
---|
[3680] | 55 | void setCloudStyle(CloudStyle style); |
---|
| 56 | |
---|
[3330] | 57 | void setInterpolateBeforeMapping(bool state); |
---|
| 58 | |
---|
[2612] | 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 | |
---|
[2492] | 65 | void setColorMode(ColorMode mode); |
---|
| 66 | |
---|
[2402] | 67 | void setColorMap(ColorMap *colorMap); |
---|
[2100] | 68 | |
---|
[2402] | 69 | /** |
---|
| 70 | * \brief Return the ColorMap in use |
---|
| 71 | */ |
---|
| 72 | ColorMap *getColorMap() |
---|
| 73 | { |
---|
| 74 | return _colorMap; |
---|
| 75 | } |
---|
[2100] | 76 | |
---|
[2402] | 77 | void updateColorMap(); |
---|
| 78 | |
---|
[2612] | 79 | virtual void updateRanges(Renderer *renderer); |
---|
[2402] | 80 | |
---|
[2100] | 81 | private: |
---|
[2328] | 82 | virtual void update(); |
---|
[2100] | 83 | |
---|
[2612] | 84 | ColorMap *_colorMap; |
---|
[2492] | 85 | ColorMode _colorMode; |
---|
[2612] | 86 | std::string _colorFieldName; |
---|
| 87 | DataSet::DataAttributeType _colorFieldType; |
---|
| 88 | double _colorFieldRange[2]; |
---|
[2492] | 89 | double _vectorMagnitudeRange[2]; |
---|
| 90 | double _vectorComponentRange[3][2]; |
---|
[2612] | 91 | Renderer *_renderer; |
---|
[2402] | 92 | |
---|
[3680] | 93 | CloudStyle _cloudStyle; |
---|
[2100] | 94 | vtkSmartPointer<vtkLookupTable> _lut; |
---|
[3680] | 95 | vtkSmartPointer<vtkPolyDataMapper> _mapper; |
---|
| 96 | vtkSmartPointer<vtkGaussianSplatter> _splatter; |
---|
[2100] | 97 | }; |
---|
| 98 | |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | #endif |
---|