OverlayColorLegendContinuousDomain.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 "CeeVisualization/ScalarMapperContinuousDomain.h"
18 #include "CeeCore/Str.h"
19 #include "CeeCore/Color3f.h"
20 
21 #include <vector>
22 
23 namespace cee {
24 namespace vis {
25 class Font;
26 
27 //==================================================================================================
28 //
29 // A color legend used to show a scalar range and the corresponding colors with uniform level sizes
30 //
31 //==================================================================================================
32 class CEE_VIS_EXPORT OverlayColorLegendContinuousDomain: public OverlayItem
33 {
34 public:
37 
38  void setupFromScalarMapper(const ScalarMapperContinuousDomain* scalarMapper);
39  void setupNiceNumbersTickMarks(unsigned int maxNumTickMarks, const ScalarMapperContinuousDomain* scalarMapper);
40  void setupNiceNumbersTickMarksLogarithmic(unsigned int maxNumTickMarks, const ScalarMapperContinuousDomain* scalarMapper);
41  void setTickValues(const std::vector<double>& tickValues, const ScalarMapperContinuousDomain* scalarMapper);
42 
43  virtual unsigned int width() const;
44  virtual unsigned int height() const;
45  void setSize(unsigned int width, unsigned int height);
46  void setWidthToFitText();
47 
48  virtual int priority() const;
49  virtual void setPriority(int priority);
50 
51  Font* titleFont();
52  void setTitleFont(Font* font);
53 
54  Font* tickMarkFont();
55  void setTickMarkFont(Font* font);
56 
57  unsigned int legendBarWidth() const;
58  void setLegendBarWidth(unsigned int widthInPixels);
59 
60  Str title() const;
61  void setTitle(const Str& title);
62 
63  Color3f textColor() const;
64  void setTextColor(const Color3f& color);
65 
66  char numericFormat() const;
67  void setNumericFormat(char format);
68 
69  int numericPrecision() const;
70  void setNumericPrecision(int precision);
71 
72  void setShowTickMarkLabels(bool show);
73  bool showTickMarkLabels() const;
74 
75  void setForceUniformTickMarkSpacing(bool forceUniformSpacing);
76  bool forceUniformTickMarkSpacing() const;
77 
78  void setTickMarksThroughLegendBar(bool drawOverLegendBar);
79  bool tickMarksThroughLegendBar() const;
80 
81  void setCustomLabels(const std::vector<Str>& labels, const std::vector<double>& relativePositions);
82  void clearCustomLabels();
83 
84 private:
85  virtual cvf::OverlayItem* internal_cvfOverlayItem();
86 
87 private:
88  CEE_PRIVATE_IMPL(OverlayColorLegendContinuousDomain);
89  CEE_DISALLOW_COPY_AND_ASSIGN(OverlayColorLegendContinuousDomain);
90 };
91 
92 } // namespace vis
93 } // namespace cee
Namespace cee contains all functionality and structures under the Core component. ...
Definition: AppComponent.cpp:26
A general unicode based string class.
Definition: Str.h:28
Abstract interface for overlay items.
Definition: OverlayItem.h:31
Base class for scalar mappers that implement normalizedValue / domainValue.
Definition: ScalarMapperContinuousDomain.h:38
Class for storing an RGB color triplet.
Definition: Color3f.h:25
The OverlayColorLegendContinuousDomain is capable of visualizing all scalar mappers that derives from...
Definition: OverlayColorLegendContinuousDomain.h:32
A font used for text drawing.
Definition: Font.h:30