Vespucci  1.0.0
mapdata.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 MAPDATA_H
21 #define MAPDATA_H
22 
23 #include <QString>
24 #include "Math/VespucciMath.h"
25 #include "GUI/Display/mapplot.h"
26 #include "GUI/Display/mapviewer.h"
28 #include "GUI/mainwindow.h"
30 
31 using namespace std;
32 using namespace arma;
33 
34 class VespucciDataset;
35 class PlotViewer;
36 class MainWindow;
37 class VespucciWorkspace;
38 class MapPlot;
39 class MapViewer;
40 
44 class MapData
45 {
46 public:
47  MapData(QString name,
48  QString type,
49  QStringList data_keys,
50  uword data_column,
51  QSharedPointer<VespucciWorkspace> workspace);
52  ~MapData();
53  QString name();
54  QString type();
55 
56  void SetMapPlot(MapPlot *plot);
57 
58  void setGradient(const QCPColorGradient &gradient);
59  void SetColorScaleTickCount(int ticks);
60 
61  //Displays the map window
62  void ShowMapWindow(bool show);
63  void HideMapWindow();
64  bool MapWindowVisible();
65 
66  void CreateImage(QCPColorGradient color_scheme, bool interpolation, int tick_count);
67  void SetMapData(QCPColorMapData *map_data);
68 
69  void SetXDescription(QString description);
70  void SetYDescription(QString description);
71 
72  void setSize(int key_size, int value_size);
73  bool interpolate();
74  void setInterpolate(bool enabled);
75  void ShowColorScale(bool enabled);
76  void ShowAxes(bool enabled);
77 
78  void SetDataRange(QCPRange new_range);
79 
80  bool savePdf(const QString &fileName,
81  int width,
82  int height);
83 
84  bool savePng(const QString & fileName,
85  int width = 0,
86  int height = 0,
87  double scale = 1.0,
88  int quality = -1);
89 
90  bool saveJpg(const QString & fileName,
91  int width=0,
92  int height = 0,
93  double scale = 1.0,
94  int quality = -1);
95 
96  bool saveBmp(const QString & fileName,
97  int width = 0,
98  int height = 0,
99  double scale = 1.0);
100 
101  bool saveTiff(const QString & fileName,
102  int width = 0,
103  int height = 0,
104  double scale = 1.0,
105  int quality = 0);
106 
107  void DrawScaleBar(double width, double height, QString units, QColor color, QString position, QFont font);
108 
109  void RescaleMapWidget();
110  void LockMapDisplaySize(bool lock);
111  void ResetMapWidgetSize();
112 
113  void SetFonts(const QFont &font);
114 
115  QString global_gradient_key();
116 
117  double min();
118  double max();
119 
120  void SetName(QString name, QString type);
121  void SetGlobalGradient(QString name);
122  void UpdateGlobalGradient();
123 
124  QStringList keys();
125  MapPlot *map_qcp();
126 
127 
128 
129 private:
133  QString x_axis_description_; //equiv to member of VespucciDataset, passed to SpectraViewer constructor
134 
138  QString y_axis_description_; //equiv to member of VespucciDataset, passed to SpectraViewer constructor
139 
143  QSharedPointer<VespucciDataset> dataset_;
144 
148  MainWindow *main_window_;
149 
153  QString name_;
154 
158  QString type_;
159 
163  int source_index_;
164 
168  MapViewer *map_display_;
169 
173  MapPlot *map_qcp_;
174 
175  QSize initial_map_size_;
176 
177  QString global_gradient_key_;
178 
179  QSharedPointer<VespucciWorkspace> workspace_;
180 
181  uword data_column_;
182  QStringList data_keys_;
183 
184 
185 };
186 Q_DECLARE_METATYPE(QSharedPointer<MapData>)
187 #endif // MAPDATA_H
The MapData class Class for processed map data. Images are created from this data.
Definition: mapdata.h:44
VESPUCCI_EXPORT arma::uword max(arma::uword a, arma::uword b)
Vespucci::Math::max.
Definition: accessory.cpp:237
The VespucciDataset class This is the main class for dealing with hyperspectral data. This handles the import and export of spectra, and the creation of maps. Images are handled by the MapData class. This class is intended to be allocated on the heap inside of a smart pointer, there is no copy constructor.
VESPUCCI_EXPORT void position(arma::uword index, arma::uword n_rows, arma::uword n_cols, arma::uword &i, arma::uword &j)
Vespucci::Math::position Find row and column numbers for index.
Definition: accessory.cpp:469
The VespucciWorkspace class A class which contains all "global variables" (that aren&#39;t held in MainWi...
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
The MapViewer class Displays the image created by MapData.
Definition: mapviewer.h:45
VESPUCCI_EXPORT arma::uword min(arma::uword a, arma::uword b)
Vespucci::Math::min.
Definition: accessory.cpp:249
Holds the two-dimensional data of a QCPColorMap plottable.
Definition: qcustomplot.h:3047
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
The MainWindow class The main window of the program, this is where the user performs most operations...
Definition: mainwindow.h:58