Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
AxisWidget.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2017.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg$
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_VISUAL_AXISWIDGET_H
36 #define OPENMS_VISUAL_AXISWIDGET_H
37 
38 // OpenMS_GUI config
39 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
40 
41 // QT
42 #include <QtGui/QWidget>
43 class QPaintEvent;
44 
45 // OpenMS
46 #include <OpenMS/CONCEPT/Types.h>
50 
51 namespace OpenMS
52 {
64  class OPENMS_GUI_DLLAPI AxisWidget :
65  public QWidget
66  {
67  Q_OBJECT
68 
69 public:
71 
72  typedef std::vector<std::vector<double> > GridVector;
74 
76  AxisWidget(AxisPainter::Alignment alignment, const char * legend = "", QWidget * parent = 0);
77 
79  virtual ~AxisWidget();
80 
82  void setMargin(UInt size);
83 
85  UInt margin();
86 
88  void showLegend(bool show_legend);
89 
91  bool isLegendShown() const;
92 
94  void setLegend(const String & legend);
95 
97  const String & getLegend();
98 
100  const GridVector & gridLines();
101 
103  void setLogScale(bool is_log);
104 
106  bool isLogScale();
107 
109  void setInverseOrientation(bool inverse_orientation);
110 
112  bool hasInverseOrientation();
113 
115  void setAllowShortNumbers(bool short_nums);
116 
118  double getAxisMinimum() const;
119 
121  double getAxisMaximum() const;
122 
124  void paint(QPainter * painter, QPaintEvent * e);
125 
126 public slots:
127 
129  void setAxisBounds(double min, double max);
130 
132  void setTickLevel(UInt level);
133 
134 protected:
136  GridVector grid_line_;
137 
139  bool is_log_;
140 
143 
146 
149 
152 
154  double min_;
155 
157  double max_;
158 
161 
164 
167 
169  void paintEvent(QPaintEvent *);
170  };
171 } // namespace OpenMS
172 
173 #endif
A more convenient string class.
Definition: String.h:57
bool is_log_
format of axis scale (linear or logarithmic)
Definition: AxisWidget.h:139
Widget that represents an axis of a graph.
Definition: AxisWidget.h:64
Alignment
Where the axis is placed.
Definition: AxisPainter.h:62
std::vector< std::vector< double > > GridVector
Type definitions.
Definition: AxisWidget.h:73
String legend_
text/unit on axis
Definition: AxisWidget.h:160
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
UInt margin_
margin of axis
Definition: AxisWidget.h:151
UInt tick_level_
maximum number of tick levels (default=2)
Definition: AxisWidget.h:163
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
double max_
maximum value on the axis
Definition: AxisWidget.h:157
GridVector grid_line_
Vector that defines the position of the ticks/gridlines and the shown values on axis.
Definition: AxisWidget.h:136
bool show_legend_
display of legend enabled or not
Definition: AxisWidget.h:142
bool is_inverse_orientation_
true if axis label are displayed in inverse order (left to right or bottom to top) ...
Definition: AxisWidget.h:148
bool allow_short_numbers_
true if k/M/G units can be used
Definition: AxisWidget.h:166
double min_
minimum value on the axis
Definition: AxisWidget.h:154
AxisPainter::Alignment alignment_
Position of the axis (right, left, top, down as defined in ALIGNMENT_ENUM)
Definition: AxisWidget.h:145

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:21:59 using doxygen 1.8.13