Go to the documentation of this file.00001 #ifndef _PLOT_MATRIX_H_
00002 #define _PLOT_MATRIX_H_
00003
00004 #include <qframe.h>
00005 #include <qwt_plot.h>
00006 #include <QGridLayout>
00007 #include "plotwidget.h"
00008
00009 class PlotMatrix: public QFrame
00010 {
00011 Q_OBJECT
00012
00013 public:
00014 PlotMatrix(QString name, PlotDataMap &datamap, QWidget * parent = NULL );
00015 virtual ~PlotMatrix();
00016
00017 void addRow();
00018 void addColumn();
00019 void removeColumn(unsigned column_to_delete);
00020 void removeRow(unsigned row_to_delete);
00021
00022 void removeEmpty();
00023
00024 unsigned rowsCount() const;
00025 unsigned colsCount() const;
00026 unsigned plotCount() const;
00027
00028 bool isRowEmpty(unsigned row ) const;
00029 bool isColumnEmpty(unsigned row ) const;
00030
00031 PlotWidget* plotAt( unsigned row, unsigned column );
00032 const PlotWidget* plotAt( unsigned row, unsigned column ) const;
00033
00034 PlotWidget* plotAt( unsigned index );
00035 const PlotWidget* plotAt( unsigned index ) const;
00036
00037 void setAxisScale(QwtPlot::Axis axisId, unsigned row, unsigned col,
00038 double min, double max, double step = 0 );
00039
00040 QDomElement xmlSaveState(QDomDocument &doc) const;
00041
00042 bool xmlLoadState(QDomElement &plotmatrix_element );
00043
00044 void updateLayout();
00045
00046 void replot();
00047
00048 void setHorizontalLink(bool linked);
00049
00050 void setName(const QString &new_name) ;
00051
00052 const QString& name() const;
00053
00054 QGridLayout* gridLayout();
00055
00056 public slots:
00057 void maximumZoomOutHorizontal();
00058
00059 void maximumZoomOutVertical();
00060
00061 void maximumZoomOut();
00062
00063
00064 private slots:
00065
00066 void on_singlePlotScaleChanged(PlotWidget* modified_plot, QRectF range);
00067
00068 private:
00069 void alignAxes(unsigned rowOrColumn, QwtPlot::Axis axisId );
00070 void alignScaleBorder( unsigned rowOrColumn, QwtPlot::Axis axisId );
00071 PlotWidget *addPlotWidget( unsigned row, unsigned col);
00072 void swapPlots( unsigned rowA, unsigned colA, unsigned rowB, unsigned colB);
00073
00074 QGridLayout *_layout;
00075 unsigned _num_rows;
00076 unsigned _num_cols;
00077 bool _horizontal_link;
00078
00079 PlotDataMap& _mapped_data;
00080
00081
00082 QString _name;
00083
00084 signals:
00085 void plotAdded(PlotWidget*);
00086 void undoableChange();
00087
00088 };
00089
00090 #endif