VTK-m  2.1
ColorLegendAnnotation.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_ColorLegendAnnotation_h
11 #define vtk_m_rendering_ColorLegendAnnotation_h
12 
14 
15 #include <vtkm/rendering/Camera.h>
16 #include <vtkm/rendering/Canvas.h>
17 #include <vtkm/rendering/Color.h>
20 
21 namespace vtkm
22 {
23 namespace rendering
24 {
25 
27 {
28 private:
31  std::vector<std::string> Labels;
32  std::vector<std::unique_ptr<TextAnnotationScreen>> Annot;
33  std::vector<vtkm::rendering::Color> ColorSwatchList;
34 
35 public:
38  ColorLegendAnnotation& operator=(const ColorLegendAnnotation&) = delete;
39 
40  void Clear();
41  void AddItem(const std::string& label, vtkm::rendering::Color color);
42 
43  void SetLabelColor(vtkm::rendering::Color c) { this->LabelColor = c; }
44 
46  {
47  this->FontScale = s;
48  for (auto& annot : this->Annot)
49  annot->SetScale(s);
50  }
51 
52  void Render(const vtkm::rendering::Camera&,
53  const vtkm::rendering::WorldAnnotator& annotator,
54  vtkm::rendering::Canvas& canvas);
55 };
56 }
57 } //namespace vtkm::rendering
58 
59 #endif // vtk_m_rendering_ColorLegendAnnotation_h
vtkm::rendering::ColorLegendAnnotation
Definition: ColorLegendAnnotation.h:26
vtkm::rendering::ColorLegendAnnotation::SetLabelFontScale
void SetLabelFontScale(vtkm::Float32 s)
Definition: ColorLegendAnnotation.h:45
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::ColorLegendAnnotation::Labels
std::vector< std::string > Labels
Definition: ColorLegendAnnotation.h:31
vtkm::rendering::ColorLegendAnnotation::LabelColor
vtkm::rendering::Color LabelColor
Definition: ColorLegendAnnotation.h:30
vtkm::rendering::ColorLegendAnnotation::FontScale
vtkm::Float32 FontScale
Definition: ColorLegendAnnotation.h:29
vtkm_rendering_export.h
vtkm::rendering::Canvas
Represents the image space that is the target of rendering.
Definition: Canvas.h:35
vtkm::rendering::ColorLegendAnnotation::SetLabelColor
void SetLabelColor(vtkm::rendering::Color c)
Definition: ColorLegendAnnotation.h:43
WorldAnnotator.h
TextAnnotationScreen.h
vtkm::rendering::WorldAnnotator
Definition: WorldAnnotator.h:27
vtkm::rendering::ColorLegendAnnotation::Annot
std::vector< std::unique_ptr< TextAnnotationScreen > > Annot
Definition: ColorLegendAnnotation.h:32
vtkm::Float32
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:157
Camera.h
Color.h
vtkm::rendering::Camera
Specifies the viewport for a rendering.
Definition: Camera.h:37
vtkm::rendering::ColorLegendAnnotation::ColorSwatchList
std::vector< vtkm::rendering::Color > ColorSwatchList
Definition: ColorLegendAnnotation.h:33
Canvas.h