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