1 //============================================================================
2 //  Copyright (c) Kitware, Inc.
3 //  All rights reserved.
4 //  See LICENSE.txt for details.
5 //  This software is distributed WITHOUT ANY WARRANTY; without even
6 //  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
7 //  PURPOSE.  See the above copyright notice for more information.
8 //
9 //  Copyright 2016 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
10 //  Copyright 2016 UT-Battelle, LLC.
11 //  Copyright 2016 Los Alamos National Security.
12 //
13 //  Under the terms of Contract DE-NA0003525 with NTESS,
14 //  the U.S. Government retains certain rights in this software.
15 //
16 //  Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
17 //  Laboratory (LANL), the U.S. Government retains certain rights in
18 //  this software.
19 //============================================================================
20 #ifndef vtk_m_rendering_WorldAnnotator_h
21 #define vtk_m_rendering_WorldAnnotator_h
22 
23 #include <vtkm/rendering/vtkm_rendering_export.h>
24 
25 #include <vtkm/Types.h>
26 #include <vtkm/rendering/Canvas.h>
27 #include <vtkm/rendering/Color.h>
28 
29 namespace vtkm
30 {
31 namespace rendering
32 {
33 
34 class Canvas;
35 
36 class VTKM_RENDERING_EXPORT WorldAnnotator
37 {
38 public:
39   WorldAnnotator(const vtkm::rendering::Canvas* canvas);
40 
41   virtual ~WorldAnnotator();
42 
43   virtual void AddLine(const vtkm::Vec<vtkm::Float64, 3>& point0,
44                        const vtkm::Vec<vtkm::Float64, 3>& point1,
45                        vtkm::Float32 lineWidth,
46                        const vtkm::rendering::Color& color,
47                        bool inFront = false) const;
48 
49   VTKM_CONT
50   void AddLine(vtkm::Float64 x0,
51                vtkm::Float64 y0,
52                vtkm::Float64 z0,
53                vtkm::Float64 x1,
54                vtkm::Float64 y1,
55                vtkm::Float64 z1,
56                vtkm::Float32 lineWidth,
57                const vtkm::rendering::Color& color,
58                bool inFront = false) const
59   {
60     this->AddLine(
61       vtkm::make_Vec(x0, y0, z0), vtkm::make_Vec(x1, y1, z1), lineWidth, color, inFront);
62   }
63 
64   virtual void AddText(const vtkm::Vec<vtkm::Float32, 3>& origin,
65                        const vtkm::Vec<vtkm::Float32, 3>& right,
66                        const vtkm::Vec<vtkm::Float32, 3>& up,
67                        vtkm::Float32 scale,
68                        const vtkm::Vec<vtkm::Float32, 2>& anchor,
69                        const vtkm::rendering::Color& color,
70                        const std::string& text,
71                        const vtkm::Float32 depth = 0.f) const;
72 
73   VTKM_CONT
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)74   void AddText(vtkm::Float32 originX,
75                vtkm::Float32 originY,
76                vtkm::Float32 originZ,
77                vtkm::Float32 rightX,
78                vtkm::Float32 rightY,
79                vtkm::Float32 rightZ,
80                vtkm::Float32 upX,
81                vtkm::Float32 upY,
82                vtkm::Float32 upZ,
83                vtkm::Float32 scale,
84                vtkm::Float32 anchorX,
85                vtkm::Float32 anchorY,
86                const vtkm::rendering::Color& color,
87                const std::string& text) const
88   {
89     this->AddText(vtkm::make_Vec(originX, originY, originZ),
90                   vtkm::make_Vec(rightX, rightY, rightZ),
91                   vtkm::make_Vec(upX, upY, upZ),
92                   scale,
93                   vtkm::make_Vec(anchorX, anchorY),
94                   color,
95                   text);
96   }
97 
98 private:
99   const vtkm::rendering::Canvas* Canvas;
100 };
101 }
102 } //namespace vtkm::rendering
103 
104 #endif // vtk_m_rendering_WorldAnnotator_h
105