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_SPHERE_H |
---|
9 | #define VTKVIS_SPHERE_H |
---|
10 | |
---|
11 | #include <vtkSmartPointer.h> |
---|
12 | #include <vtkPolyDataMapper.h> |
---|
13 | #include <vtkActor.h> |
---|
14 | #include <vtkSphereSource.h> |
---|
15 | |
---|
16 | #include "Shape.h" |
---|
17 | #include "DataSet.h" |
---|
18 | |
---|
19 | namespace VtkVis { |
---|
20 | |
---|
21 | /** |
---|
22 | * \brief VTK PolyData sphere |
---|
23 | * |
---|
24 | * This class creates a mesh sphere |
---|
25 | */ |
---|
26 | class Sphere : public Shape |
---|
27 | { |
---|
28 | public: |
---|
29 | Sphere(); |
---|
30 | virtual ~Sphere(); |
---|
31 | |
---|
32 | virtual const char *getClassName() const |
---|
33 | { |
---|
34 | return "Sphere"; |
---|
35 | } |
---|
36 | |
---|
37 | void setThetaResolution(int res) |
---|
38 | { |
---|
39 | if (_sphere != NULL) |
---|
40 | _sphere->SetThetaResolution(res); |
---|
41 | } |
---|
42 | |
---|
43 | void setPhiResolution(int res) |
---|
44 | { |
---|
45 | if (_sphere != NULL) |
---|
46 | _sphere->SetPhiResolution(res); |
---|
47 | } |
---|
48 | |
---|
49 | void setStartTheta(double val) |
---|
50 | { |
---|
51 | if (_sphere != NULL) |
---|
52 | _sphere->SetStartTheta(val); |
---|
53 | } |
---|
54 | |
---|
55 | void setEndTheta(double val) |
---|
56 | { |
---|
57 | if (_sphere != NULL) |
---|
58 | _sphere->SetEndTheta(val); |
---|
59 | } |
---|
60 | |
---|
61 | void setStartPhi(double val) |
---|
62 | { |
---|
63 | if (_sphere != NULL) |
---|
64 | _sphere->SetStartPhi(val); |
---|
65 | } |
---|
66 | |
---|
67 | void setEndPhi(double val) |
---|
68 | { |
---|
69 | if (_sphere != NULL) |
---|
70 | _sphere->SetEndPhi(val); |
---|
71 | } |
---|
72 | |
---|
73 | void setLatLongTessellation(bool val) |
---|
74 | { |
---|
75 | if (_sphere != NULL) |
---|
76 | _sphere->SetLatLongTessellation((val ? 1 : 0)); |
---|
77 | } |
---|
78 | |
---|
79 | void setCenter(double center[3]) |
---|
80 | { |
---|
81 | if (_sphere != NULL) |
---|
82 | _sphere->SetCenter(center); |
---|
83 | } |
---|
84 | |
---|
85 | void setRadius(double radius) |
---|
86 | { |
---|
87 | if (_sphere != NULL) |
---|
88 | _sphere->SetRadius(radius); |
---|
89 | } |
---|
90 | |
---|
91 | void flipNormals(bool state); |
---|
92 | |
---|
93 | private: |
---|
94 | virtual void update(); |
---|
95 | |
---|
96 | vtkSmartPointer<vtkSphereSource> _sphere; |
---|
97 | }; |
---|
98 | |
---|
99 | } |
---|
100 | |
---|
101 | #endif |
---|