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