-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathScalarSourceModel.h
More file actions
121 lines (98 loc) · 3.12 KB
/
ScalarSourceModel.h
File metadata and controls
121 lines (98 loc) · 3.12 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
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
#pragma once
#include "Dataset.h"
#include <QAbstractListModel>
using namespace mv;
/**
* Scalar source model class
*
* Model which defines the source(s) to size scalars (by constant or by dataset)
*
* @author Thomas Kroes
*/
class ScalarSourceModel : public QAbstractListModel
{
protected:
/** (Default) constructor */
ScalarSourceModel(QObject* parent = nullptr);
public:
/** Default scalar options */
enum DefaultRow {
Constant, /** Scale by constant */
Selection, /** Scale by selected */
DatasetStart /** Start row of the dataset(s) */
};
public:
/**
* Get the number of row
* @param parent Parent model index
* @return Number of rows in the model
*/
int rowCount(const QModelIndex& parent = QModelIndex()) const;
/**
* Get the row index of a dataset
* @param parent Parent model index
* @return Row index of the dataset
*/
int rowIndex(const Dataset<DatasetImpl>& dataset) const;
/**
* Get the number of columns
* @param parent Parent model index
* @return Number of columns in the model
*/
int columnCount(const QModelIndex& parent = QModelIndex()) const;
/**
* Get data
* @param index Model index to query
* @param role Data role
* @return Data
*/
QVariant data(const QModelIndex& index, int role) const;
/**
* Add a dataset
* @param dataset Smart pointer to dataset
*/
void addDataset(const Dataset<DatasetImpl>& dataset);
/**
* Determines whether a given dataset is already loaded
* @param dataset Smart pointer to dataset
* @return whether the dataset is already loaded
*/
bool hasDataset(const Dataset<DatasetImpl>& dataset) const;
/**
* Remove a dataset
* @param dataset Smart pointer to dataset
*/
void removeDataset(const Dataset<DatasetImpl>& dataset);
/** Remove all datasets from the model */
void removeAllDatasets();
/**
* Get datasets
* @return Vector of smart pointers to datasets
*/
const Datasets& getDatasets() const;
/**
* Get dataset at the specified row index
* @param rowIndex Index of the row
* @return Smart pointer to dataset
*/
Dataset<DatasetImpl> getDataset(const std::int32_t& rowIndex) const;
/**
* Set datasets (resets the model)
* @param datasets Vector of smart pointers to datasets
*/
void setDatasets(const Datasets& datasets);
/** Get whether to show the full path name in the GUI */
bool getShowFullPathName() const;
/**
* Set whether to show the full path name in the GUI
* @param showFullPathName Whether to show the full path name in the GUI
*/
void setShowFullPathName(const bool& showFullPathName);
/** Updates the model from the datasets */
void updateData();
protected:
Datasets _datasets; /** Datasets used to size the scatter plot points with */
bool _showFullPathName; /** Whether to show the full path name in the GUI */
friend class ScalarAction;
friend class ScalarSourceAction;
};