VTK-m  2.1
WorldAnnotator.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_WorldAnnotator_h
11 #define vtk_m_rendering_WorldAnnotator_h
12 
14 
15 #include <vtkm/Types.h>
16 #include <vtkm/rendering/Canvas.h>
17 #include <vtkm/rendering/Color.h>
19 
20 namespace vtkm
21 {
22 namespace rendering
23 {
24 
25 class Canvas;
26 
28 {
29 public:
30  explicit WorldAnnotator(const vtkm::rendering::Canvas* canvas);
31 
32  void AddLine(const vtkm::Vec3f_64& point0,
33  const vtkm::Vec3f_64& point1,
34  vtkm::Float32 lineWidth,
35  const vtkm::rendering::Color& color,
36  bool inFront = false) const;
37 
38  VTKM_CONT
40  vtkm::Float64 y0,
41  vtkm::Float64 z0,
42  vtkm::Float64 x1,
43  vtkm::Float64 y1,
44  vtkm::Float64 z1,
45  vtkm::Float32 lineWidth,
46  const vtkm::rendering::Color& color,
47  bool inFront = false) const
48  {
49  this->AddLine(
50  vtkm::make_Vec(x0, y0, z0), vtkm::make_Vec(x1, y1, z1), lineWidth, color, inFront);
51  }
52 
53  VTKM_CONT
54  void BeginLineRenderingBatch() const;
55 
56  VTKM_CONT
57  void EndLineRenderingBatch() const;
58 
59  void AddText(const vtkm::Vec3f_32& origin,
60  const vtkm::Vec3f_32& right,
61  const vtkm::Vec3f_32& up,
62  vtkm::Float32 scale,
63  const vtkm::Vec2f_32& anchor,
64  const vtkm::rendering::Color& color,
65  const std::string& text,
66  vtkm::Float32 depth = 0.f) const;
67 
68  VTKM_CONT
69  void AddText(vtkm::Float32 originX,
70  vtkm::Float32 originY,
71  vtkm::Float32 originZ,
72  vtkm::Float32 rightX,
73  vtkm::Float32 rightY,
74  vtkm::Float32 rightZ,
75  vtkm::Float32 upX,
76  vtkm::Float32 upY,
77  vtkm::Float32 upZ,
78  vtkm::Float32 scale,
79  vtkm::Float32 anchorX,
80  vtkm::Float32 anchorY,
81  const vtkm::rendering::Color& color,
82  const std::string& text) const
83  {
84  this->AddText(vtkm::make_Vec(originX, originY, originZ),
85  vtkm::make_Vec(rightX, rightY, rightZ),
86  vtkm::make_Vec(upX, upY, upZ),
87  scale,
88  vtkm::make_Vec(anchorX, anchorY),
89  color,
90  text);
91  }
92 
93 private:
96 };
97 }
98 } //namespace vtkm::rendering
99 
100 #endif // vtk_m_rendering_WorldAnnotator_h
vtkm::rendering::WorldAnnotator::LineBatcher
vtkm::rendering::LineRendererBatcher LineBatcher
Definition: WorldAnnotator.h:95
vtkm::rendering::WorldAnnotator::AddText
void AddText(vtkm::Float32 originX, vtkm::Float32 originY, vtkm::Float32 originZ, vtkm::Float32 rightX, vtkm::Float32 rightY, vtkm::Float32 rightZ, vtkm::Float32 upX, vtkm::Float32 upY, vtkm::Float32 upZ, vtkm::Float32 scale, vtkm::Float32 anchorX, vtkm::Float32 anchorY, const vtkm::rendering::Color &color, const std::string &text) const
Definition: WorldAnnotator.h:69
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
Types.h
vtkm::make_Vec
constexpr vtkm::Vec< T, vtkm::IdComponent(sizeof...(Ts)+1)> make_Vec(T value0, Ts &&... args)
Initializes and returns a Vec containing all the arguments.
Definition: Types.h:1250
vtkm::rendering::WorldAnnotator::Canvas
const vtkm::rendering::Canvas * Canvas
Definition: WorldAnnotator.h:94
vtkm_rendering_export.h
vtkm::rendering::LineRendererBatcher
Definition: LineRendererBatcher.h:26
vtkm::rendering::Canvas
Represents the image space that is the target of rendering.
Definition: Canvas.h:35
vtkm::rendering::WorldAnnotator::AddLine
void AddLine(vtkm::Float64 x0, vtkm::Float64 y0, vtkm::Float64 z0, vtkm::Float64 x1, vtkm::Float64 y1, vtkm::Float64 z1, vtkm::Float32 lineWidth, const vtkm::rendering::Color &color, bool inFront=false) const
Definition: WorldAnnotator.h:39
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
LineRendererBatcher.h
vtkm::rendering::WorldAnnotator
Definition: WorldAnnotator.h:27
vtkm::Vec< vtkm::Float64, 3 >
vtkm::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:157
vtkm::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:161
Color.h
Canvas.h