OverlayCategoryLegend.h
1 //##################################################################################################
2 //
3 // Ceetron Desktop Components
4 // Component: Visualization
5 //
6 // --------------------------------------------------------------------------------------------
7 // Copyright (C) 2014, Ceetron AS
8 // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Ceetron AS. The contents of this file may
9 // not be disclosed to third parties, copied or duplicated in any form, in whole or in part,
10 // without the prior written permission of Ceetron AS.
11 //##################################################################################################
12 
13 #pragma once
14 
15 #include "CeeVisualization/Base.h"
16 #include "CeeVisualization/OverlayItem.h"
17 #include "CeeCore/Str.h"
18 #include "CeeCore/Color3f.h"
19 #include "CeeVisualization/Font.h"
20 
21 namespace cee {
22 namespace vis {
23 
24 
25 //==================================================================================================
26 //
27 // A color legend used to indicate the interpretation of the colors in the model
28 //
29 //==================================================================================================
30 class CEE_VIS_EXPORT OverlayCategoryLegend: public OverlayItem
31 {
32 public:
35  {
36  LEFT,
38  TOP,
40  FOLLOW_LAYOUT
41  };
42 
44  enum Direction
45  {
47  VERTICAL
48  };
49 
50 public:
52  OverlayCategoryLegend(Font* titleFont, Font* categoryFont);
53  virtual ~OverlayCategoryLegend();
54 
55  virtual unsigned int width() const;
56  virtual unsigned int height() const;
57 
58  virtual int priority() const;
59  virtual void setPriority(int priority);
60 
61  void setSize(unsigned int width, unsigned int height);
62  void setWidthToFitText();
63 
64  size_t categoryCount() const;
65  Str categoryText(size_t index) const;
66  Color3f categoryColor(size_t index) const;
67  void addCategory(const Str& text, Color3f color);
68  void removeAllCategories();
69 
70  Str title() const;
71  void setTitle(const Str& title);
72 
73  Color3f textColor() const;
74  void setTextColor(const Color3f& color);
75 
76  TickMarksPosition tickMarksPosition() const;
77  void setTickMarksPosition(TickMarksPosition position);
78 
79  Direction direction() const;
80  void setDirection(Direction direction);
81 
82 private:
83  virtual cvf::OverlayItem* internal_cvfOverlayItem();
84 
85 private:
86  CEE_PRIVATE_IMPL(OverlayCategoryLegend);
87  CEE_DISALLOW_COPY_AND_ASSIGN(OverlayCategoryLegend);
88 };
89 
90 } // namespace vis
91 } // namespace cee
Namespace cee contains all functionality and structures under the Core component. ...
Definition: AppComponent.cpp:26
Draw tick marks below the color legend.
Definition: OverlayCategoryLegend.h:39
A general unicode based string class.
Definition: Str.h:28
Abstract interface for overlay items.
Definition: OverlayItem.h:31
Direction
Direction of color legend bar.
Definition: OverlayCategoryLegend.h:44
TickMarksPosition
Position of the legend tick marks.
Definition: OverlayCategoryLegend.h:34
Draw tick marks on the left side of the color legend.
Definition: OverlayCategoryLegend.h:36
Class for storing an RGB color triplet.
Definition: Color3f.h:25
Draw horizontal color legend bar.
Definition: OverlayCategoryLegend.h:46
Draw tick marks on the right side of the color legend.
Definition: OverlayCategoryLegend.h:37
Draw tick marks above the color legend.
Definition: OverlayCategoryLegend.h:38
A font used for text drawing.
Definition: Font.h:30
A color legend used to indicate the interpretation of the colors in the model.
Definition: OverlayCategoryLegend.h:30