Vespucci  1.0.0
mapplot.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright (C) 2014-2016 Wright State University - All Rights Reserved
3  Daniel P. Foose - Maintainer/Lead Developer
4 
5  This file is part of Vespucci.
6 
7  Vespucci is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  Vespucci is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Vespucci. If not, see <http://www.gnu.org/licenses/>.
19 *******************************************************************************/
20 #ifndef MAPPLOT_H
21 #define MAPPLOT_H
22 
23 #include "qcustomplot.h"
25 #include "Global/global.h"
26 using namespace arma;
27 typedef std::vector<double> stdvec;
28 typedef QVector<double> qvec;
29 
33 class MapPlot : public QCustomPlot
34 {
35  Q_OBJECT
36 
37 public:
38  MapPlot(QWidget *parent = 0);
39  void SetMapData(const vec &x, const vec &y, const vec &z);
40  void SetColorScale(QCPColorScale *scale);
41  void SetGradient(QCPColorGradient gradient);
42  void SetGlobalColorGradient(Vespucci::GlobalGradient gradient);
43  void CenterCrosshairs();
44  uword GetCrosshairPosition(double &x, double &y, double &z);
45  uword GetCrosshairPosition();
46  double min() const;
47  double max() const;
48  void rescaleDataRange(bool onlyVisibleMaps = false);
49  void setDataRange(const QCPRange &dataRange);
50  void ColorScaleVisible(bool visible);
51  void CrossHairsVisible(bool visible);
52  void SetFonts(const QFont &font);
53  void SetColorScaleLabel(const QString &label_text);
54  QString ColorScaleLabel() const;
55  void SetColorScaleTickCount(int ticks);
56  void SetColorScaleTicks(double min, double max, size_t count);
57  void SetClusterTicks(size_t count);
58  void setInterpolate(bool interpolate);
59  bool interpolate() const;
60  int keySize();
61  int valueSize();
62  QCPRange keyRange();
63  QCPRange valueRange();
64  void ShowCrosshairs(bool show);
65  void MoveVerticalCrosshair(int units);
66  void MoveHorizontalCrosshair(int units);
67  void SaveImage(QString filename);
68  void CenterAtZero();
69 signals:
70  void SpectrumRequested(size_t index);
71  void SpectrumHoldRequested(size_t index);
72  void CoordinatesChanged(double x, double y, double z);
73 private:
74  QCPColorMap *color_map_;
75  QCPItemStraightLine *horizontal_crosshair_;
76  QCPItemStraightLine *vertical_crosshair_;
77  QCPColorScale *color_scale_;
78  vec x_;
79  vec y_;
80  vec z_;
81  double x_step_;
82  double y_step_;
83  QPair<int, int> rect_position_;
84  QPair<int, int> color_scale_position_;
85 };
86 
87 #endif // MAPPLOT_H
VESPUCCI_EXPORT arma::uword max(arma::uword a, arma::uword b)
Vespucci::Math::max.
Definition: accessory.cpp:237
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: qcustomplot.h:1685
QVector< double > qvec
Definition: mapplot.h:28
A straight line that spans infinitely in both directions.
Definition: qcustomplot.h:3287
The MapPlot class A subclass of QCustomPlot for handling a specfic kind of color map. Provides a wrapper for a QCPColorScale and a QCPColorMap which are child widgets.
Definition: mapplot.h:33
A color scale for use with color coding data such as QCPColorMap.
Definition: qcustomplot.h:2436
VESPUCCI_EXPORT arma::uword min(arma::uword a, arma::uword b)
Vespucci::Math::min.
Definition: accessory.cpp:249
std::vector< double > stdvec
Definition: mapplot.h:27
A plottable representing a two-dimensional color map in a plot.
Definition: qcustomplot.h:3096
Defines a color gradient for use with e.g. QCPColorMap.
Definition: qcustomplot.h:1905
Represents the range an axis is encompassing.
Definition: qcustomplot.h:481