Viskores  1.0
View.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_rendering_View_h
19 #define viskores_rendering_View_h
20 
22 
29 
30 #include <functional>
31 #include <memory>
32 
33 namespace viskores
34 {
35 namespace rendering
36 {
37 
39 class VISKORES_RENDERING_EXPORT View
40 {
41  struct InternalData;
42 
43 public:
44  View(const viskores::rendering::Scene& scene,
45  const viskores::rendering::Mapper& mapper,
46  const viskores::rendering::Canvas& canvas,
47  const viskores::rendering::Color& backgroundColor = viskores::rendering::Color(0, 0, 0, 1),
48  const viskores::rendering::Color& foregroundColor = viskores::rendering::Color(1, 1, 1, 1));
49 
50  View(const viskores::rendering::Scene& scene,
51  const viskores::rendering::Mapper& mapper,
52  const viskores::rendering::Canvas& canvas,
53  const viskores::rendering::Camera& camera,
54  const viskores::rendering::Color& backgroundColor = viskores::rendering::Color(0, 0, 0, 1),
55  const viskores::rendering::Color& foregroundColor = viskores::rendering::Color(1, 1, 1, 1));
56 
57  virtual ~View();
58 
61  const viskores::rendering::Scene& GetScene() const;
64  viskores::rendering::Scene& GetScene();
67  void SetScene(const viskores::rendering::Scene& scene);
68 
71  const viskores::rendering::Mapper& GetMapper() const;
74  viskores::rendering::Mapper& GetMapper();
75 
78  const viskores::rendering::Canvas& GetCanvas() const;
81  viskores::rendering::Canvas& GetCanvas();
82 
84  const viskores::rendering::WorldAnnotator& GetWorldAnnotator() const;
85 
88  const viskores::rendering::Camera& GetCamera() const;
91  viskores::rendering::Camera& GetCamera();
94  void SetCamera(const viskores::rendering::Camera& camera);
95 
98  const viskores::rendering::Color& GetBackgroundColor() const;
101  void SetBackgroundColor(const viskores::rendering::Color& color);
102 
108  void SetForegroundColor(const viskores::rendering::Color& color);
109 
111  bool GetWorldAnnotationsEnabled() const { return this->WorldAnnotationsEnabled; }
112 
114  void SetWorldAnnotationsEnabled(bool val) { this->WorldAnnotationsEnabled = val; }
115 
116  VISKORES_CONT void SetRenderAnnotationsEnabled(bool val) { this->RenderAnnotationsEnabled = val; }
117  VISKORES_CONT bool GetRenderAnnotationsEnabled() const { return this->RenderAnnotationsEnabled; }
118 
120  virtual void Paint() = 0;
121  virtual void RenderScreenAnnotations() = 0;
122  virtual void RenderWorldAnnotations() = 0;
123 
124  void RenderAnnotations();
125 
127  void SaveAs(const std::string& fileName) const;
128 
130  void SetAxisColor(viskores::rendering::Color c);
131 
133  void ClearTextAnnotations();
134 
136  void AddTextAnnotation(std::unique_ptr<viskores::rendering::TextAnnotation> ann);
137 
139  void ClearAdditionalAnnotations();
140 
142  void AddAdditionalAnnotation(std::function<void(void)> ann);
143 
144 protected:
145  void SetupForWorldSpace(bool viewportClip = true);
146 
147  void SetupForScreenSpace(bool viewportClip = false);
148 
149 
151  bool WorldAnnotationsEnabled = true;
152  bool RenderAnnotationsEnabled = true;
153 
154 private:
155  std::unique_ptr<InternalData> Internal;
156 };
157 
158 } // namespace viskores::rendering
159 } // namespace viskores
160 
161 #endif //viskores_rendering_View_h
viskores::rendering::View
The abstract class representing the view of a rendering scene.
Definition: View.h:39
Scene.h
viskores::rendering::Scene
A simple collection of things to render.
Definition: Scene.h:38
TextAnnotation.h
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores::rendering::View::GetWorldAnnotationsEnabled
bool GetWorldAnnotationsEnabled() const
Definition: View.h:111
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::rendering::View::SetRenderAnnotationsEnabled
void SetRenderAnnotationsEnabled(bool val)
Definition: View.h:116
viskores::rendering::Mapper
Converts data into commands to a rendering system.
Definition: Mapper.h:37
viskores::rendering::View::Internal
std::unique_ptr< InternalData > Internal
Definition: View.h:155
viskores::rendering::Color::white
static Color white
Definition: Color.h:152
viskores::rendering::Camera
Specifies the viewport for a rendering.
Definition: Camera.h:45
viskores::rendering::View::GetRenderAnnotationsEnabled
bool GetRenderAnnotationsEnabled() const
Definition: View.h:117
Camera.h
Color.h
viskores_rendering_export.h
Canvas.h
Mapper.h
viskores::rendering::WorldAnnotator
Definition: WorldAnnotator.h:35
viskores::rendering::View::SetWorldAnnotationsEnabled
void SetWorldAnnotationsEnabled(bool val)
Definition: View.h:114
viskores::rendering::Canvas
Represents the image space that is the target of rendering.
Definition: Canvas.h:43
viskores::rendering::Color
Representation of a color.
Definition: Color.h:37