Viskores  1.0
TextAnnotation.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_TextAnnotation_h
19 #define viskores_rendering_TextAnnotation_h
20 
22 
26 
27 namespace viskores
28 {
29 namespace rendering
30 {
31 
32 class VISKORES_RENDERING_EXPORT TextAnnotation
33 {
34 public:
35  enum struct HorizontalAlignment
36  {
37  Left,
38  HCenter,
39  Right
40  };
41  enum struct VerticalAlignment
42  {
43  Bottom,
44  VCenter,
45  Top
46  };
47  static constexpr HorizontalAlignment Left = HorizontalAlignment::Left;
48  static constexpr HorizontalAlignment HCenter = HorizontalAlignment::HCenter;
49  static constexpr HorizontalAlignment Right = HorizontalAlignment::Right;
50  static constexpr VerticalAlignment Bottom = VerticalAlignment::Bottom;
51  static constexpr VerticalAlignment VCenter = VerticalAlignment::VCenter;
52  static constexpr VerticalAlignment Top = VerticalAlignment::Top;
53 
54 protected:
55  std::string Text;
59 
60 public:
61  TextAnnotation(const std::string& text,
62  const viskores::rendering::Color& color,
63  viskores::Float32 scalar);
64 
65  virtual ~TextAnnotation();
66 
67  void SetText(const std::string& text);
68 
69  const std::string& GetText() const;
70 
75  void SetRawAnchor(const viskores::Vec2f_32& anchor);
76 
77  void SetRawAnchor(viskores::Float32 h, viskores::Float32 v);
78 
79  void SetAlignment(HorizontalAlignment h, VerticalAlignment v);
80 
81  void SetScale(viskores::Float32 scale);
82 
83  virtual void Render(const viskores::rendering::Camera& camera,
84  const viskores::rendering::WorldAnnotator& worldAnnotator,
85  viskores::rendering::Canvas& canvas) const = 0;
86 };
87 }
88 } //namespace viskores::rendering
89 
90 #endif //viskores_rendering_TextAnnotation_h
viskores::rendering::TextAnnotation::HorizontalAlignment
HorizontalAlignment
Definition: TextAnnotation.h:35
viskores::rendering::TextAnnotation::VerticalAlignment
VerticalAlignment
Definition: TextAnnotation.h:41
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:165
WorldAnnotator.h
viskores::rendering::TextAnnotation::Scale
viskores::Float32 Scale
Definition: TextAnnotation.h:57
viskores::rendering::TextAnnotation::Anchor
viskores::Vec2f_32 Anchor
Definition: TextAnnotation.h:58
viskores::rendering::Camera
Specifies the viewport for a rendering.
Definition: Camera.h:45
viskores::rendering::TextAnnotation
Definition: TextAnnotation.h:32
Camera.h
viskores::rendering::TextAnnotation::Text
std::string Text
Definition: TextAnnotation.h:55
viskores_rendering_export.h
Canvas.h
viskores::rendering::WorldAnnotator
Definition: WorldAnnotator.h:35
viskores::rendering::TextAnnotation::TextColor
Color TextColor
Definition: TextAnnotation.h:56
viskores::Vec< viskores::Float32, 2 >
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