VTK-m  2.0
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 
13 #include <vtkm/rendering/vtkm_rendering_export.h>
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 
26 class VTKM_RENDERING_EXPORT ColorLegendAnnotation
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:
39  ColorLegendAnnotation& operator=(const ColorLegendAnnotation&) = delete;
40 
41  void Clear();
42  void AddItem(const std::string& label, vtkm::rendering::Color color);
43 
44  void SetLabelColor(vtkm::rendering::Color c) { this->LabelColor = c; }
45 
47  {
48  this->FontScale = s;
49  for (unsigned int i = 0; i < this->Annot.size(); i++)
50  this->Annot[i]->SetScale(s);
51  }
52 
53  virtual void Render(const vtkm::rendering::Camera&,
54  const vtkm::rendering::WorldAnnotator& annotator,
55  vtkm::rendering::Canvas& canvas);
56 };
57 }
58 } //namespace vtkm::rendering
59 
60 #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:46
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::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::Canvas
Definition: Canvas.h:34
vtkm::rendering::ColorLegendAnnotation::SetLabelColor
void SetLabelColor(vtkm::rendering::Color c)
Definition: ColorLegendAnnotation.h:44
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
Definition: Types.h:154
Camera.h
Color.h
vtkm::rendering::Camera
Definition: Camera.h:28
vtkm::rendering::ColorLegendAnnotation::ColorSwatchList
std::vector< vtkm::rendering::Color > ColorSwatchList
Definition: ColorLegendAnnotation.h:33
Canvas.h