-
Notifications
You must be signed in to change notification settings - Fork 8
/
subplot.h
122 lines (102 loc) · 3.23 KB
/
subplot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* CLASS
* Copyright (c) 2010-2013 Meteorology and Air Quality section, Wageningen University and Research centre
* Copyright (c) 2011-2013 Jordi Vila-Guerau de Arellano
* Copyright (c) 2011-2013 Chiel van Heerwaarden
* Copyright (c) 2011-2013 Bart van Stratum
* Copyright (c) 2011-2013 Kees van den Dries
*
* This file is part of CLASS
*
* CLASS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* CLASS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with CLASS. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SUBPLOT_H
#define SUBPLOT_H
#include "mainwindow.h"
#include <QWidget>
#include "QPaintEvent"
#include "QPainter"
#include "QGraphicsScene"
#include <iostream>
#include <cmath>
#include <QFileDialog>
#include <QPaintDevice>
#include <QFont>
#include <QPen>
#include <QPointF>
#include <QRubberBand>
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
#include <QtGui/QWidget>
#include "QPrinter"
#else
#include <QtWidgets/QWidget>
#include <QtPrintSupport/QPrinter>
#endif
class plotarea : public QWidget
{
Q_OBJECT
public:
plotarea(QMap<int, modelrun> *, QList<int> *, QWidget *parent = 0);
QMap<int, outputvar> xdatalist, ydatalist;
QList<QColor> colors;
QList<int> assignedcolors;
QString saveImageName;
QString xlabel, ylabel;
QList<int> *selectedruns;
int saveImageMode;
int plotinterval;
int lines;
int legend_width, legend_height;
int legend_x, legend_y;
int legend_x_offset, legend_y_offset;
// Positions of legend elements
int v_offset, line_xs, line_xe, line_y, label_x, label_y;
// Mouse functions:
int x_press, x_release, y_press, y_release;
double x_current, y_current;
bool mousepressed, mousereleased;
bool legendmoved, legendmoves;
double graphminx, graphmaxx, graphminy, graphmaxy;
double xmin, xmax, ymin, ymax;
double xmin_auto, xmax_auto;
double yscale, xscale;
bool autoaxis;
bool scatterplot;
bool MacOS;
// Function to translate real coordinates (x,y) to widget coordinates
double transfx(double x, double xscale, double xmin, int mode);
double transfy(double y, double yscale, double ymin, int mode);
signals:
void axischanged();
void zoombymouse();
void cursormoved();
public slots:
void saveImage();
protected:
void paintEvent(QPaintEvent *event);
QMap<int, modelrun> *runlist;
double PNGscale, PNGfontscale;
void mousePressEvent( QMouseEvent * );
void mouseReleaseEvent( QMouseEvent * );
void mouseMoveEvent(QMouseEvent *);
private:
int defaulttopmargin, defaultbottommargin, defaultleftmargin, defaultrightmargin;
int topmargin, bottommargin, leftmargin, rightmargin;
double nicenumber(double, bool);
int plotwidget_width, plotwidget_height;
int profinterval;
QPoint origin_rubberband;
QRubberBand *rubberBand;
bool drawrubberband;
double hscale_png,vscale_png;
};
#endif // SUBPLOT_H