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_DATASET_H__ |
---|
9 | #define __RAPPTURE_VTKVIS_DATASET_H__ |
---|
10 | |
---|
11 | #include <vtkSmartPointer.h> |
---|
12 | #include <vtkDataSet.h> |
---|
13 | #include <vtkDataSetReader.h> |
---|
14 | |
---|
15 | #include <string> |
---|
16 | #include <vector> |
---|
17 | |
---|
18 | namespace Rappture { |
---|
19 | namespace VtkVis { |
---|
20 | |
---|
21 | /** |
---|
22 | * \brief VTK DataSet wrapper |
---|
23 | */ |
---|
24 | class DataSet { |
---|
25 | public: |
---|
26 | DataSet(const std::string& name); |
---|
27 | virtual ~DataSet(); |
---|
28 | |
---|
29 | bool setDataFile(const char *filename); |
---|
30 | |
---|
31 | bool setData(char *data, int nbytes); |
---|
32 | |
---|
33 | bool setData(vtkDataSetReader *reader); |
---|
34 | |
---|
35 | bool setData(vtkDataSet *ds); |
---|
36 | |
---|
37 | vtkDataSet *copyData(vtkDataSet *ds); |
---|
38 | |
---|
39 | bool is2D() const; |
---|
40 | |
---|
41 | const std::string& getName() const; |
---|
42 | |
---|
43 | vtkDataSet *getVtkDataSet(); |
---|
44 | |
---|
45 | const char *getVtkType() const; |
---|
46 | |
---|
47 | bool setActiveScalars(const char *name); |
---|
48 | |
---|
49 | bool setActiveVectors(const char *name); |
---|
50 | |
---|
51 | void getDataRange(double minmax[2]) const; |
---|
52 | |
---|
53 | void getDataRange(double minmax[2], const char *fieldName) const; |
---|
54 | |
---|
55 | void getVectorMagnitudeRange(double minmax[2]) const; |
---|
56 | |
---|
57 | void getVectorComponentRange(double minmax[2], int component) const; |
---|
58 | |
---|
59 | void getBounds(double bounds[6]) const; |
---|
60 | |
---|
61 | double getDataValue(double x, double y, double z) const; |
---|
62 | |
---|
63 | void setVisibility(bool state); |
---|
64 | |
---|
65 | bool getVisibility() const; |
---|
66 | |
---|
67 | private: |
---|
68 | DataSet(); |
---|
69 | |
---|
70 | std::string _name; |
---|
71 | vtkSmartPointer<vtkDataSet> _dataSet; |
---|
72 | bool _visible; |
---|
73 | }; |
---|
74 | |
---|
75 | } |
---|
76 | } |
---|
77 | |
---|
78 | #endif |
---|