Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef PROCESSSTATUS_H
00028 #define PROCESSSTATUS_H
00029
00030 #include <SciFigs.h>
00031
00032 #include "ui_ProcessStatus.h"
00033 #include "ModelThreadInfo.h"
00034
00035 class StatusThreadInfo
00036 {
00037 public:
00038 StatusThreadInfo() {
00039 nVisitedModels=0;
00040 nValidModels=0;
00041 nActiveModels=0;
00042 nr=0;
00043 nGiveUp=0;
00044 nRejected=0;
00045 deltaNModels=0;
00046 deltaNRejected=0;
00047 bestMisfit=1e99;
00048 lastVisitedIndex=0;
00049 lastValidIndex=0;
00050 line=0;
00051 }
00052
00053 int nVisitedModels;
00054 int nValidModels;
00055 int nActiveModels;
00056 int nr;
00057 int nGiveUp;
00058 int nRejected;
00059 int deltaNModels;
00060 int deltaNRejected;
00061 double bestMisfit;
00062 PlotLine2D * line;
00063 int lastValidIndex;
00064 int lastVisitedIndex;
00065 int deltaTime;
00066 QTime time;
00067 };
00068
00069 typedef QMap<InversionThread *, StatusThreadInfo *> StatusThreadMap;
00070
00071 class StatusThreadItem : public QAbstractItemModel
00072 {
00073 Q_OBJECT
00074 public:
00075 StatusThreadItem(StatusThreadMap * threads, QObject * parent=0);
00076 ~StatusThreadItem();
00077
00078 virtual int rowCount(const QModelIndex &parent=QModelIndex()) const;
00079 virtual int columnCount(const QModelIndex &parent=QModelIndex()) const;
00080 virtual QVariant data(const QModelIndex &index, int role) const;
00081 virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const;
00082 virtual QModelIndex parent (const QModelIndex & index) const;
00083 virtual QModelIndex index (int, int column, const QModelIndex & parent=QModelIndex()) const;
00084 public slots:
00085 void refresh();
00086 private:
00087 StatusThreadMap * _threads;
00088 };
00089
00090 class ProcessStatus : public QWidget, public Ui::ProcessStatus
00091 {
00092 Q_OBJECT
00093 public:
00094 ProcessStatus(QWidget* parent=0, Qt::WFlags fl=0);
00095 ~ProcessStatus();
00096
00097 void setCostMinMax();
00098 void clear();
00099 void clearThread(InversionThread * t);
00100 void removeThread(InversionThread * t);
00101 Legend& legend() {return _legend;}
00102 public slots:
00103 void synchronize();
00104 void changeLegend();
00105 protected:
00106 Legend _legend;
00107 StatusThreadMap _threads;
00108 bool _threadsInitialized;
00109 LineLayer * _curveLayer;
00110
00111 void updateMisfitCurve(InversionThread * t);
00112 void updatePens();
00113 };
00114
00115 class ProcessStatusDelegate : public QItemDelegate
00116 {
00117 Q_OBJECT
00118 public:
00119 ProcessStatusDelegate(ProcessStatus * parent) : QItemDelegate(parent) {}
00120
00121 virtual void paint (QPainter * painter, const QStyleOptionViewItem & option,
00122 const QModelIndex & index) const;
00123 virtual QSize sizeHint (const QStyleOptionViewItem & option, const QModelIndex & index) const;
00124 };
00125
00126 #endif // QTBPROCESSSTATUS_H