-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathselectedpixelmodel.h
More file actions
81 lines (65 loc) · 1.74 KB
/
selectedpixelmodel.h
File metadata and controls
81 lines (65 loc) · 1.74 KB
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
//
// C++ Interface: selectedpixelmodel
//
// Description:
//
//
// Author: Nicholas Phillips <Nicholas.G.Phillips@nasa.gov>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef SELECTEDPIXELMODEL_H
#define SELECTEDPIXELMODEL_H
#include <vector>
#include <QStringList>
#include <QAbstractTableModel>
#include "enums.h"
#include "pixel.h"
class Skymap;
class SelectedPixel
{
public:
int i;
BasePixel *p;
QString label;
SelectedPixel(int j, BasePixel *pp) : i(j), p(pp) {};
};
/*==================================================================
@author Nicholas Phillips <Nicholas.G.Phillips@nasa.gov>
*/
class SelectedPixelModel : public QAbstractTableModel
{
public:
SelectedPixelModel(QObject *parent = 0);
// Overloaded methods to display content
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual QVariant headerData(const int i, Qt::Orientation o, int role = Qt::DisplayRole) const;
void set(Skymap *map);
void asStats(SelectedPixelModel *);
void asStats(Skymap *map);
void asStatus();
void hasField(Field f, bool b);
void loadField(Field f);
bool operator()(int i, BasePixel *pix);
int size() const { return pixs.size(); };
int pixnum(int i) const { return pixs[i].i; };
void clear();
void updateStats();
void writeListToFile (const QString &dst);
private:
typedef std::vector<SelectedPixel> PixList;
enum Modes { list, stats, status };
Modes mode;
int nrows;
int ncols;
PixList pixs;
QStringList headers;
std::vector<int> pidx;
SelectedPixelModel *data4stats;
QStringList statnames;
int n;
};
#endif