VTK-m  2.0
AxisAnnotation3D.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_AxisAnnotation3D_h
11 #define vtk_m_rendering_AxisAnnotation3D_h
12 
13 #include <vtkm/rendering/vtkm_rendering_export.h>
14 
15 #include <vtkm/Range.h>
16 
17 #include <vtkm/cont/DataSet.h>
19 #include <vtkm/rendering/Camera.h>
20 #include <vtkm/rendering/Color.h>
21 #include <vtkm/rendering/Scene.h>
24 
25 #include <sstream>
26 
27 namespace vtkm
28 {
29 namespace rendering
30 {
31 
32 class VTKM_RENDERING_EXPORT AxisAnnotation3D : public AxisAnnotation
33 {
34 private:
35 protected:
36  vtkm::Float64 TickMajorSize, TickMajorOffset;
37  vtkm::Float64 TickMinorSize, TickMinorOffset;
38  int Axis;
46  std::vector<std::unique_ptr<TextAnnotationBillboard>> Labels;
48 
49 public:
51 
53 
54  AxisAnnotation3D(const AxisAnnotation3D&) = delete;
55 
56  AxisAnnotation3D& operator=(const AxisAnnotation3D&) = delete;
57 
58  VTKM_CONT
59  void SetMoreOrLessTickAdjustment(int offset) { this->MoreOrLessTickAdjustment = offset; }
60 
61  VTKM_CONT
62  void SetColor(vtkm::rendering::Color c) { this->Color = c; }
63 
64  VTKM_CONT
65  void SetAxis(int a) { this->Axis = a; }
66 
67  void SetTickInvert(bool x, bool y, bool z);
68 
72  VTKM_CONT
74  {
75  this->TickMajorSize = size;
76  this->TickMajorOffset = offset;
77  }
78  VTKM_CONT
80  {
81  this->TickMinorSize = size;
82  this->TickMinorOffset = offset;
83  }
84 
85  VTKM_CONT
86  void SetWorldPosition(const vtkm::Vec3f_64& point0, const vtkm::Vec3f_64& point1)
87  {
88  this->Point0 = point0;
89  this->Point1 = point1;
90  }
91 
92  VTKM_CONT
94  vtkm::Float64 y0,
95  vtkm::Float64 z0,
96  vtkm::Float64 x1,
97  vtkm::Float64 y1,
98  vtkm::Float64 z1)
99  {
100  this->SetWorldPosition(vtkm::make_Vec(x0, y0, z0), vtkm::make_Vec(x1, y1, z1));
101  }
102 
103  void SetLabelFontScale(vtkm::Float64 s);
104 
105  void SetLabelFontOffset(vtkm::Float32 off) { this->FontOffset = off; }
106 
107  void SetRange(const vtkm::Range& range) { this->Range = range; }
108 
110  {
111  this->SetRange(vtkm::Range(lower, upper));
112  }
113 
114  virtual void Render(const vtkm::rendering::Camera& camera,
115  const vtkm::rendering::WorldAnnotator& worldAnnotator,
116  vtkm::rendering::Canvas& canvas) override;
117 };
118 }
119 } //namespace vtkm::rendering
120 
121 #endif // vtk_m_rendering_AxisAnnotation3D_h
TextAnnotationBillboard.h
vtkm::rendering::AxisAnnotation3D
Definition: AxisAnnotation3D.h:32
vtkm::rendering::AxisAnnotation3D::Invert
vtkm::Vec3f_32 Invert
Definition: AxisAnnotation3D.h:39
vtkm::rendering::Color
It's a color!
Definition: Color.h:28
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::rendering::AxisAnnotation3D::Labels
std::vector< std::unique_ptr< TextAnnotationBillboard > > Labels
Definition: AxisAnnotation3D.h:46
vtkm::rendering::AxisAnnotation3D::Range
vtkm::Range Range
Definition: AxisAnnotation3D.h:41
vtkm::rendering::AxisAnnotation3D::TickMinorSize
vtkm::Float64 TickMinorSize
Definition: AxisAnnotation3D.h:37
vtkm::rendering::AxisAnnotation3D::SetAxis
VTKM_CONT void SetAxis(int a)
Definition: AxisAnnotation3D.h:65
vtkm::rendering::AxisAnnotation3D::Axis
int Axis
Definition: AxisAnnotation3D.h:38
vtkm::rendering::AxisAnnotation3D::SetColor
VTKM_CONT void SetColor(vtkm::rendering::Color c)
Definition: AxisAnnotation3D.h:62
vtkm::rendering::AxisAnnotation3D::MoreOrLessTickAdjustment
int MoreOrLessTickAdjustment
Definition: AxisAnnotation3D.h:47
vtkm::rendering::AxisAnnotation3D::SetMajorTickSize
VTKM_CONT void SetMajorTickSize(vtkm::Float64 size, vtkm::Float64 offset)
offset of 0 means the tick is inside the frame offset of 1 means the tick is outside the frame offset...
Definition: AxisAnnotation3D.h:73
vtkm::rendering::AxisAnnotation3D::SetWorldPosition
VTKM_CONT void SetWorldPosition(const vtkm::Vec3f_64 &point0, const vtkm::Vec3f_64 &point1)
Definition: AxisAnnotation3D.h:86
vtkm::rendering::AxisAnnotation3D::SetMinorTickSize
VTKM_CONT void SetMinorTickSize(vtkm::Float64 size, vtkm::Float64 offset)
Definition: AxisAnnotation3D.h:79
vtkm::rendering::AxisAnnotation3D::SetRange
void SetRange(vtkm::Float64 lower, vtkm::Float64 upper)
Definition: AxisAnnotation3D.h:109
Scene.h
vtkm::rendering::Canvas
Definition: Canvas.h:34
WorldAnnotator.h
Range.h
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::make_Vec
constexpr VTKM_EXEC_CONT 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:1212
vtkm::rendering::WorldAnnotator
Definition: WorldAnnotator.h:27
vtkm::rendering::AxisAnnotation3D::TickMajorSize
vtkm::Float64 TickMajorSize
Definition: AxisAnnotation3D.h:36
vtkm::Vec< vtkm::Float32, 3 >
vtkm::rendering::AxisAnnotation3D::SetRange
void SetRange(const vtkm::Range &range)
Definition: AxisAnnotation3D.h:107
vtkm::rendering::AxisAnnotation3D::SetLabelFontOffset
void SetLabelFontOffset(vtkm::Float32 off)
Definition: AxisAnnotation3D.h:105
vtkm::Float32
float Float32
Definition: Types.h:154
vtkm::rendering::AxisAnnotation3D::Color
vtkm::rendering::Color Color
Definition: AxisAnnotation3D.h:45
Camera.h
vtkm::Float64
double Float64
Definition: Types.h:155
AxisAnnotation.h
Color.h
vtkm::rendering::Camera
Definition: Camera.h:28
vtkm::rendering::AxisAnnotation3D::SetMoreOrLessTickAdjustment
VTKM_CONT void SetMoreOrLessTickAdjustment(int offset)
Definition: AxisAnnotation3D.h:59
vtkm::rendering::AxisAnnotation3D::SetWorldPosition
VTKM_CONT void SetWorldPosition(vtkm::Float64 x0, vtkm::Float64 y0, vtkm::Float64 z0, vtkm::Float64 x1, vtkm::Float64 y1, vtkm::Float64 z1)
Definition: AxisAnnotation3D.h:93
vtkm::rendering::AxisAnnotation3D::FontOffset
vtkm::Float32 FontOffset
Definition: AxisAnnotation3D.h:43
vtkm::rendering::AxisAnnotation
Definition: AxisAnnotation.h:24
vtkm::rendering::AxisAnnotation3D::Point1
vtkm::Vec3f_64 Point1
Definition: AxisAnnotation3D.h:40
vtkm::rendering::AxisAnnotation3D::FontScale
vtkm::Float64 FontScale
Definition: AxisAnnotation3D.h:42
DataSet.h
vtkm::rendering::AxisAnnotation3D::LineWidth
vtkm::Float32 LineWidth
Definition: AxisAnnotation3D.h:44
vtkm::Range
Represent a continuous scalar range of values.
Definition: Range.h:31