OpenMS
Loading...
Searching...
No Matches
AxisPainter.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11// OpenMS_GUI config
12#include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13
14#include <vector>
17
18#include <QPaintEvent>
19#include <QPainter>
20
21
22namespace OpenMS
23{
29 class OPENMS_GUI_DLLAPI AxisPainter
30 {
31public:
33 typedef std::vector<std::vector<double> > GridVector;
34
37 {
41 RIGHT
42 };
43
45 static void paint(QPainter * painter, QPaintEvent * e, const double & min, const double & max, const GridVector & grid,
46 const Int width, const Int height, const Alignment alignment, const UInt margin,
47 const bool show_legend, const String& legend, const bool shorten_number,
48 const bool is_log, const bool is_inverse_orientation);
49private:
52
54 static void getShortenedNumber_(QString& short_num, double number);
55
57 static double scale_(double x, bool is_log);
58 };
59}
Draws a coordinate axis. It has only static methods, that's why the constructor is private.
Definition AxisPainter.h:30
std::vector< std::vector< double > > GridVector
Typedef for the grid vector.
Definition AxisPainter.h:33
static void paint(QPainter *painter, QPaintEvent *e, const double &min, const double &max, const GridVector &grid, const Int width, const Int height, const Alignment alignment, const UInt margin, const bool show_legend, const String &legend, const bool shorten_number, const bool is_log, const bool is_inverse_orientation)
Draws an axis.
AxisPainter()
Constructor: only static methods.
static void getShortenedNumber_(QString &short_num, double number)
sets short_num to a shortened string representation ("123.4 k/M/G") of number
Alignment
Where the axis is placed.
Definition AxisPainter.h:37
@ TOP
Definition AxisPainter.h:38
@ BOTTOM
Definition AxisPainter.h:39
@ LEFT
Definition AxisPainter.h:40
static double scale_(double x, bool is_log)
Round to 8 significant digits after comma (and apply log scaling)
A more convenient string class.
Definition String.h:34
int Int
Signed integer type.
Definition Types.h:72
unsigned int UInt
Unsigned integer type.
Definition Types.h:64
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19