AxisAnnotation3D.h 3.91 KB
Newer Older
Jeremy Meredith's avatar
Jeremy Meredith committed
1
2
3
4
5
6
7
8
//============================================================================
//  Copyright (c) Kitware, Inc.
//  All rights reserved.
//  See LICENSE.txt for details.
//  This software is distributed WITHOUT ANY WARRANTY; without even
//  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
//  PURPOSE.  See the above copyright notice for more information.
//
Kenneth Moreland's avatar
Kenneth Moreland committed
9
//  Copyright 2016 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
Jeremy Meredith's avatar
Jeremy Meredith committed
10
11
12
//  Copyright 2016 UT-Battelle, LLC.
//  Copyright 2016 Los Alamos National Security.
//
Kenneth Moreland's avatar
Kenneth Moreland committed
13
//  Under the terms of Contract DE-NA0003525 with NTESS,
Jeremy Meredith's avatar
Jeremy Meredith committed
14
15
16
17
18
19
20
21
22
//  the U.S. Government retains certain rights in this software.
//
//  Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
//  Laboratory (LANL), the U.S. Government retains certain rights in
//  this software.
//============================================================================
#ifndef vtk_m_rendering_AxisAnnotation3D_h
#define vtk_m_rendering_AxisAnnotation3D_h

23
24
25
#include <vtkm/rendering/vtkm_rendering_export.h>

#include <vtkm/Range.h>
Mark Kim's avatar
Mark Kim committed
26

Jeremy Meredith's avatar
Jeremy Meredith committed
27
#include <vtkm/cont/DataSet.h>
28
#include <vtkm/rendering/AxisAnnotation.h>
29
#include <vtkm/rendering/Camera.h>
Jeremy Meredith's avatar
Jeremy Meredith committed
30
31
#include <vtkm/rendering/Color.h>
#include <vtkm/rendering/Scene.h>
32
#include <vtkm/rendering/TextAnnotationBillboard.h>
33
#include <vtkm/rendering/WorldAnnotator.h>
Jeremy Meredith's avatar
Jeremy Meredith committed
34

Kenneth Moreland's avatar
Kenneth Moreland committed
35
36
#include <sstream>

37
38
39
40
namespace vtkm
{
namespace rendering
{
Jeremy Meredith's avatar
Jeremy Meredith committed
41

42
class VTKM_RENDERING_EXPORT AxisAnnotation3D : public AxisAnnotation
Jeremy Meredith's avatar
Jeremy Meredith committed
43
44
45
{
private:
protected:
46
47
  vtkm::Float64 TickMajorSize, TickMajorOffset;
  vtkm::Float64 TickMinorSize, TickMinorOffset;
48
49
50
  int Axis;
  vtkm::Vec<vtkm::Float32, 3> Invert;
  vtkm::Vec<vtkm::Float64, 3> Point0, Point1;
51
52
53
54
55
  vtkm::Range Range;
  vtkm::Float64 FontScale;
  vtkm::Float32 FontOffset;
  vtkm::Float32 LineWidth;
  vtkm::rendering::Color Color;
56
  std::vector<TextAnnotationBillboard*> Labels;
57
58
  int MoreOrLessTickAdjustment;

59
public:
60
61
  AxisAnnotation3D();

62
  ~AxisAnnotation3D();
63

64
65
66
  AxisAnnotation3D(const AxisAnnotation3D&) = delete;
  AxisAnnotation3D& operator=(const AxisAnnotation3D&) = delete;

67
  VTKM_CONT
68
  void SetMoreOrLessTickAdjustment(int offset) { this->MoreOrLessTickAdjustment = offset; }
69

70
  VTKM_CONT
71
  void SetColor(vtkm::rendering::Color c) { this->Color = c; }
72

73
  VTKM_CONT
74
  void SetAxis(int a) { this->Axis = a; }
75
76
77
78
79
80

  void SetTickInvert(bool x, bool y, bool z);

  /// offset of 0 means the tick is inside the frame
  /// offset of 1 means the tick is outside the frame
  /// offset of 0.5 means the tick is centered on the frame
81
  VTKM_CONT
82
  void SetMajorTickSize(vtkm::Float64 size, vtkm::Float64 offset)
Jeremy Meredith's avatar
Jeremy Meredith committed
83
  {
84
85
    this->TickMajorSize = size;
    this->TickMajorOffset = offset;
Jeremy Meredith's avatar
Jeremy Meredith committed
86
  }
87
  VTKM_CONT
88
  void SetMinorTickSize(vtkm::Float64 size, vtkm::Float64 offset)
Jeremy Meredith's avatar
Jeremy Meredith committed
89
  {
90
91
    this->TickMinorSize = size;
    this->TickMinorOffset = offset;
Jeremy Meredith's avatar
Jeremy Meredith committed
92
93
  }

94
  VTKM_CONT
95
96
  void SetWorldPosition(const vtkm::Vec<vtkm::Float64, 3>& point0,
                        const vtkm::Vec<vtkm::Float64, 3>& point1)
97
98
99
  {
    this->Point0 = point0;
    this->Point1 = point1;
Jeremy Meredith's avatar
Jeremy Meredith committed
100
  }
101

102
  VTKM_CONT
103
104
105
106
107
108
  void SetWorldPosition(vtkm::Float64 x0,
                        vtkm::Float64 y0,
                        vtkm::Float64 z0,
                        vtkm::Float64 x1,
                        vtkm::Float64 y1,
                        vtkm::Float64 z1)
Jeremy Meredith's avatar
Jeremy Meredith committed
109
  {
110
    this->SetWorldPosition(vtkm::make_Vec(x0, y0, z0), vtkm::make_Vec(x1, y1, z1));
111
  }
112
113
114

  void SetLabelFontScale(vtkm::Float64 s);

115
  void SetLabelFontOffset(vtkm::Float32 off) { this->FontOffset = off; }
116

117
  void SetRange(const vtkm::Range& range) { this->Range = range; }
118
119

  void SetRange(vtkm::Float64 lower, vtkm::Float64 upper)
Jeremy Meredith's avatar
Jeremy Meredith committed
120
  {
121
    this->SetRange(vtkm::Range(lower, upper));
Jeremy Meredith's avatar
Jeremy Meredith committed
122
  }
123

124
125
  virtual void Render(const vtkm::rendering::Camera& camera,
                      const vtkm::rendering::WorldAnnotator& worldAnnotator,
126
                      vtkm::rendering::Canvas& canvas) override;
Jeremy Meredith's avatar
Jeremy Meredith committed
127
};
128
129
}
} //namespace vtkm::rendering
Jeremy Meredith's avatar
Jeremy Meredith committed
130
131

#endif // vtk_m_rendering_AxisAnnotation3D_h