Skip to content
Snippets Groups Projects
Commit 9451035f authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

FitComparisonWidget is switched to new ColorMap usage.

parent 4b3be944
No related branches found
No related tags found
No related merge requests found
......@@ -205,7 +205,7 @@ void ApplicationModels::createTestSample()
void ApplicationModels::createTestJob()
{
SimulationOptionsItem *optionsItem = m_documentModel->getSimulationOptionsItem();
optionsItem->setRunPolicy(Constants::JOB_RUN_IN_BACKGROUND);
// optionsItem->setRunPolicy(Constants::JOB_RUN_IN_BACKGROUND);
JobItem *jobItem = m_jobModel->addJob(
m_sampleModel->multiLayerItem(),
......
......@@ -22,7 +22,7 @@
namespace {
const int default_label_height = 20;
const int default_text_size = 12;
const int default_text_size = 11;
}
StatusLabel::StatusLabel(QWidget *parent)
......
......@@ -15,35 +15,51 @@
// ************************************************************************** //
#include "FitComparisonWidget.h"
#include "ColorMapPlot.h"
#include "ColorMap.h"
#include "JobItem.h"
#include "RealDataItem.h"
#include "SessionModel.h"
#include "IntensityDataItem.h"
#include "IntensityDataFunctions.h"
#include "FitFlowWidget.h"
#include "ColorMapLabel.h"
#include <QGridLayout>
#include <QVBoxLayout>
#include <QVBoxLayout>
#include <QLabel>
#include <QDebug>
FitComparisonWidget::FitComparisonWidget(QWidget *parent)
: SessionItemWidget(parent)
, m_realDataPlot(new ColorMapPlot)
, m_simulatedDataPlot(new ColorMapPlot)
, m_relativeDiffPlot(new ColorMapPlot)
, m_realDataPlot(new ColorMap)
, m_simulatedDataPlot(new ColorMap)
, m_relativeDiffPlot(new ColorMap)
, m_fitFlowWidget(new FitFlowWidget)
, m_statusLabel(new ColorMapLabel(0, this))
, m_realDataItem(0)
, m_simulatedDataItem(0)
, m_relativeDiffItem(0)
, m_tempIntensityDataModel(new SessionModel("TempIntensityDataModel", this))
{
QVBoxLayout *vlayout = new QVBoxLayout;
vlayout->setMargin(0);
vlayout->setSpacing(0);
QGridLayout *gridLayout = new QGridLayout;
gridLayout->setMargin(0);
gridLayout->setSpacing(0);
setStyleSheet("background-color:white;");
gridLayout->addWidget(m_realDataPlot, 0, 0);
gridLayout->addWidget(m_simulatedDataPlot, 0, 1);
gridLayout->addWidget(m_relativeDiffPlot, 1, 0);
gridLayout->addWidget(m_fitFlowWidget, 1, 1);
vlayout->addLayout(gridLayout);
vlayout->addWidget(m_statusLabel);
setLayout(vlayout);
setLayout(gridLayout);
}
FitComparisonWidget::~FitComparisonWidget()
......@@ -72,6 +88,11 @@ void FitComparisonWidget::setJobItem(JobItem *jobItem)
m_realDataPlot->setItem(m_realDataItem);
m_simulatedDataPlot->setItem(m_simulatedDataItem);
m_relativeDiffPlot->setItem(m_relativeDiffItem);
m_statusLabel->reset();
m_statusLabel->addColorMap(m_realDataPlot);
m_statusLabel->addColorMap(m_simulatedDataPlot);
m_statusLabel->addColorMap(m_relativeDiffPlot);
}
//! Sets tracking of simulated data item.
......
......@@ -20,7 +20,10 @@
#include "SessionItemWidget.h"
class IntensityDataItem;
class ColorMapPlot;
class ColorMap;
class SessionModel;
class FitFlowWidget;
class ColorMapLabel;
//! The FitComparisonWidget class plots realdata, simulated data and relative difference map
//! during the course of the fit.
......@@ -41,18 +44,20 @@ protected:
private:
void setSimulatedDataItem(IntensityDataItem *simulatedDataItem);
class IntensityDataItem *createRelativeDifferenceItem();
IntensityDataItem *createRelativeDifferenceItem();
void calculateRelativeDifference();
ColorMapPlot *m_realDataPlot;
ColorMapPlot *m_simulatedDataPlot;
ColorMapPlot *m_relativeDiffPlot;
ColorMap *m_realDataPlot;
ColorMap *m_simulatedDataPlot;
ColorMap *m_relativeDiffPlot;
FitFlowWidget *m_fitFlowWidget;
ColorMapLabel *m_statusLabel;
IntensityDataItem *m_realDataItem;
IntensityDataItem *m_simulatedDataItem;
IntensityDataItem *m_relativeDiffItem;
class SessionModel *m_tempIntensityDataModel;
SessionModel *m_tempIntensityDataModel;
};
#endif
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file GUI/coregui/Views/FitWidgets/FitFlowWidget.cpp
//! @brief Implement class FitFlowWidget
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov
//! @authors Walter Van Herck, Joachim Wuttke
//
// ************************************************************************** //
#include "FitFlowWidget.h"
#include <QVBoxLayout>
FitFlowWidget::FitFlowWidget(QWidget *parent)
: QFrame(parent)
{
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
QVBoxLayout *layout = new QVBoxLayout;
layout->setSpacing(0);
layout->setMargin(0);
setStyleSheet("background-color:white;");
setLayout(layout);
}
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file GUI/coregui/Views/FitWidgets/FitFlowWidget.h
//! @brief Declares class FitFlowWidget
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov
//! @authors Walter Van Herck, Joachim Wuttke
//
// ************************************************************************** //
#ifndef FITFLOWWIDGET_H
#define FITFLOWWIDGET_H
#include "WinDllMacros.h"
#include <QFrame>
//! The FitFlowWidget class is intended for showing chi2 .vs interation count dependency.
//! The main goal is to fill vacant place in FitComparisonWidget.
class BA_CORE_API_ FitFlowWidget : public QFrame
{
Q_OBJECT
public:
explicit FitFlowWidget(QWidget *parent = 0);
};
#endif
......@@ -39,7 +39,7 @@ ColorMapCanvas::ColorMapCanvas(QWidget *parent)
setLayout(layout);
m_statusLabel->setLabelEnabled(true);
m_statusLabel->setLabelEnabled(false);
}
......
......@@ -17,10 +17,15 @@
#include "ColorMapLabel.h"
#include "ColorMap.h"
//namespace {
//const int min_size = 0;
//}
ColorMapLabel::ColorMapLabel(ColorMap *colorMap, QWidget *parent)
: StatusLabel(parent)
{
addColorMap(colorMap);
if(colorMap)
addColorMap(colorMap);
}
void ColorMapLabel::addColorMap(ColorMap *colorMap)
......@@ -43,11 +48,27 @@ void ColorMapLabel::setLabelEnabled(bool flag)
setEnabled(flag);
}
//! Disconnects all color maps from the label.
void ColorMapLabel::reset()
{
foreach(ColorMap *colorMap, m_colorMaps)
setColorMapLabelEnabled(colorMap, false);
m_colorMaps.clear();
}
void ColorMapLabel::onColorMapStatusString(const QString &text)
{
setText(text);
}
//void ColorMapLabel::resizeEvent(QResizeEvent *event)
//{
// qDebug() << "ColorMapLabel::resizeEvent(QResizeEvent *event)" << event->size();
//}
//! Enables/disables showing of label for given color map.
void ColorMapLabel::setColorMapLabelEnabled(ColorMap *colorMap, bool flag)
......
......@@ -21,6 +21,7 @@
#include <QList>
class ColorMap;
class QResizeEvent;
//! The ColorMapLabel class shows status string as reported by ColorMap in a frame.
//! Can work with more than one ColorMap. Provides automatic adjustment of font size,
......@@ -37,10 +38,14 @@ public:
void setLabelEnabled(bool flag);
void reset();
public slots:
void onColorMapStatusString(const QString &text);
//protected:
// void resizeEvent(QResizeEvent *event);
private:
void setColorMapLabelEnabled(ColorMap *colorMap, bool flag);
void setConnected(ColorMap *colorMap, bool flag);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment