71
75
* \param name window name
72
76
* \param f window flags
74
Matrix(ScriptingEnv *env, int r, int c, const QString& label, QWidget* parent=0, const QString& name = QString(), Qt::WFlags f=0);
75
Matrix(ScriptingEnv *env, const QImage& image, const QString& label, QWidget* parent=0, const QString& name = QString(), Qt::WFlags f=0);
78
Matrix(ScriptingEnv *env, int r, int c, const QString& label, ApplicationWindow* parent, const QString& name = QString(), Qt::WFlags f=0);
79
Matrix(ScriptingEnv *env, const QImage& image, const QString& label, ApplicationWindow* parent, const QString& name = QString(), Qt::WFlags f=0);
82
enum Operation{Transpose, Invert, FlipHorizontally, FlipVertically, RotateClockwise,
83
RotateCounterClockwise, FFT, Clear, Calculate, MuParserCalculate, SetImage, ImportAscii};
77
84
enum HeaderViewType{ColumnRow, XY};
78
85
enum ViewType{TableView, ImageView};
79
86
enum ColorMapType{GrayScale, Rainbow, Custom};
88
NewColumns, //!< add file as new columns to the current matrix
89
NewRows, //!< add file as new rows to the current matrix
90
Overwrite //!< replace content of current matrix with the imported file
81
void setViewType(ViewType);
93
void setViewType(ViewType, bool renderImage = true);
82
94
ViewType viewType(){return d_view_type;};
84
96
HeaderViewType headerViewType(){return d_header_view_type;};
85
97
void setHeaderViewType(HeaderViewType type);
88
void setImage(const QImage& image);
100
void displayImage(const QImage& image);
89
101
void importImage(const QString& fn);
90
102
void exportRasterImage(const QString& fileName, int quality = 100);
91
103
void exportSVG(const QString& fileName);
92
104
void exportToFile(const QString& fileName);
93
105
void exportVector(const QString& fileName, int res = 0, bool color = true, bool keepAspect = true, QPrinter::PageSize pageSize = QPrinter::Custom);
95
MatrixModel * matrixModel(){return d_matrix_model;};
107
MatrixModel * matrixModel(){return d_matrix_model;};
108
QUndoStack *undoStack(){return d_undo_stack;};
96
110
QItemSelectionModel * selectionModel(){return d_table_view->selectionModel();};
98
112
//! Return the number of rows
100
void setNumRows(int rows);
113
int numRows(){return d_matrix_model->rowCount();};
114
void setNumRows(int rows){d_matrix_model->setRowCount(rows);};
102
116
//! Return the number of columns
104
void setNumCols(int cols);
117
int numCols(){return d_matrix_model->columnCount();};
118
void setNumCols(int cols){d_matrix_model->setColumnCount(cols);};
108
* \brief Event filter
110
* Currently only reacts to events of the
113
bool eventFilter(QObject *object, QEvent *e);
114
//! Context menu event handler
115
void contextMenuEvent(QContextMenuEvent *e);
116
121
//! Custom event handler
118
123
* Currently handles SCRIPTING_CHANGE_EVENT only.
139
141
void setColorMap(const QStringList& lst);
141
143
void setGrayScale();
142
void setRainbowColorMap();
144
void setRainbowColorMap();
145
//! Calculate the volume integral
147
//! Calculate the determinant of the matrix
148
double determinant();
149
//! Transpose the matrix
151
//! Invert the matrix
154
//! Calculate matrix values using the #formula_str.
155
bool calculate(int startRow = 0, int endRow = -1, int startCol = 0, int endCol = -1, bool forceMuParser = true);
156
//! Calculate matrix values using the #formula_str (optimization for muParser).
157
bool muParserCalculate(int startRow = 0, int endRow = -1, int startCol = 0, int endCol = -1);
159
bool exportASCII(const QString& fname, const QString& separator, bool exportSelection);
160
void importASCII(const QString &fname, const QString &sep, int ignoredLines, bool stripSpaces,
161
bool simplifySpaces, const QString& commentString, ImportMode importAs = Overwrite,
162
const QLocale& l = QLocale(), int endLineChar = 0, int maxRows = -1);
145
165
void exportPDF(const QString& fileName);
309
324
ViewType d_view_type;
310
325
//! Keeps track of the header view type;
311
326
HeaderViewType d_header_view_type;
313
QwtLinearColorMap d_color_map;
327
//! The color map used to display images.
328
QwtLinearColorMap d_color_map;
329
//! The color map type.
314
330
ColorMapType d_color_map_type;
316
331
//! Column width in pixels;
317
332
int d_column_width;
319
QShortcut *d_select_all_shortcut;
333
QShortcut *d_select_all_shortcut;
334
//! Undo/Redo commands stack
335
QUndoStack *d_undo_stack;
336
//! Pointer to a data buffer used for matrix operations.