VTK-m  2.2
TextAnnotation.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_rendering_TextAnnotation_h
11 #define vtk_m_rendering_TextAnnotation_h
12 
14 
15 #include <vtkm/rendering/Camera.h>
16 #include <vtkm/rendering/Canvas.h>
18 
19 namespace vtkm
20 {
21 namespace rendering
22 {
23 
25 {
26 public:
27  enum struct HorizontalAlignment
28  {
29  Left,
30  HCenter,
31  Right
32  };
33  enum struct VerticalAlignment
34  {
35  Bottom,
36  VCenter,
37  Top
38  };
39  static constexpr HorizontalAlignment Left = HorizontalAlignment::Left;
40  static constexpr HorizontalAlignment HCenter = HorizontalAlignment::HCenter;
41  static constexpr HorizontalAlignment Right = HorizontalAlignment::Right;
42  static constexpr VerticalAlignment Bottom = VerticalAlignment::Bottom;
43  static constexpr VerticalAlignment VCenter = VerticalAlignment::VCenter;
44  static constexpr VerticalAlignment Top = VerticalAlignment::Top;
45 
46 protected:
47  std::string Text;
51 
52 public:
53  TextAnnotation(const std::string& text,
54  const vtkm::rendering::Color& color,
55  vtkm::Float32 scalar);
56 
57  virtual ~TextAnnotation();
58 
59  void SetText(const std::string& text);
60 
61  const std::string& GetText() const;
62 
67  void SetRawAnchor(const vtkm::Vec2f_32& anchor);
68 
69  void SetRawAnchor(vtkm::Float32 h, vtkm::Float32 v);
70 
71  void SetAlignment(HorizontalAlignment h, VerticalAlignment v);
72 
73  void SetScale(vtkm::Float32 scale);
74 
75  virtual void Render(const vtkm::rendering::Camera& camera,
76  const vtkm::rendering::WorldAnnotator& worldAnnotator,
77  vtkm::rendering::Canvas& canvas) const = 0;
78 };
79 }
80 } //namespace vtkm::rendering
81 
82 #endif //vtk_m_rendering_TextAnnotation_h
vtkm::rendering::TextAnnotation::TextColor
Color TextColor
Definition: TextAnnotation.h:48
vtkm::rendering::TextAnnotation::Scale
vtkm::Float32 Scale
Definition: TextAnnotation.h:49
vtkm::rendering::Color
Representation of a color.
Definition: Color.h:29
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_RENDERING_EXPORT
#define VTKM_RENDERING_EXPORT
Definition: vtkm_rendering_export.h:44
vtkm::rendering::TextAnnotation
Definition: TextAnnotation.h:24
vtkm_rendering_export.h
vtkm::rendering::Canvas
Represents the image space that is the target of rendering.
Definition: Canvas.h:35
vtkm::rendering::TextAnnotation::Text
std::string Text
Definition: TextAnnotation.h:47
WorldAnnotator.h
vtkm::rendering::WorldAnnotator
Definition: WorldAnnotator.h:27
vtkm::rendering::TextAnnotation::VerticalAlignment
VerticalAlignment
Definition: TextAnnotation.h:33
vtkm::Vec< vtkm::Float32, 2 >
vtkm::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:157
vtkm::rendering::TextAnnotation::Anchor
vtkm::Vec2f_32 Anchor
Definition: TextAnnotation.h:50
Camera.h
vtkm::rendering::Camera
Specifies the viewport for a rendering.
Definition: Camera.h:37
Canvas.h
vtkm::rendering::TextAnnotation::HorizontalAlignment
HorizontalAlignment
Definition: TextAnnotation.h:27