Commit 375548e9 authored by Wuttke, Joachim's avatar Wuttke, Joachim

more explicit fct name (OnePeakSettings::peakRange

parent 4305488f
......@@ -28,7 +28,7 @@ namespace {
Mapped getPeak(int jP, const Cluster& cluster, int iGamma)
{
const OnePeakSettings& settings = gSession->peaksSettings.at(jP);
const Range& fitrange = settings.range();
const Range& fitrange = settings.peakRange();
const Metadata* metadata = &cluster.avgMetadata();
const Range gRange = gSession->gammaSelection.slice2range(cluster.rangeGma(), iGamma);
deg alpha, beta;
......
......@@ -53,7 +53,7 @@ Curve computeCurveMinusBg(const Dfgram* parent)
Mapped computeRawOutcome(int jP, const Dfgram* parent)
{
OnePeakSettings& peak = gSession->peaksSettings.at(jP);
const Curve peakCurve = parent->getCurveMinusBg().intersect(peak.range());
const Curve peakCurve = parent->getCurveMinusBg().intersect(peak.peakRange());
return analyseRawPeak(peakCurve);
}
......@@ -61,7 +61,7 @@ Fitted computePeakFit(int jP, const Dfgram* parent)
{
OnePeakSettings& peak = gSession->peaksSettings.at(jP);
return PeakFunction::fromFit(
peak.functionName(), parent->getCurveMinusBg().intersect(peak.range()),
peak.functionName(), parent->getCurveMinusBg().intersect(peak.peakRange()),
parent->getRawOutcome(jP));
}
......@@ -72,7 +72,7 @@ Curve computePeakAsCurve(int jP, const Dfgram* parent)
const Fitted& fun = parent->getPeakFit(jP);
if (!fun.success())
return {};
const Range& rge = peak.range();
const Range& rge = peak.peakRange();
Curve ret;
for (int i = 0; i < curveMinusBg.size(); ++i) {
double x = curveMinusBg.x(i);
......
......@@ -28,12 +28,12 @@ void AllPeaksSettings::add(const Range& range)
peaksSettings_.erase(
std::remove_if(
peaksSettings_.begin(), peaksSettings_.end(),
[=](const OnePeakSettings& p) { return p.range().intersects(range); }),
[=](const OnePeakSettings& p) { return p.peakRange().intersects(range); }),
peaksSettings_.end());
doAdd({range, OnePeakSettings::functionNames.at(gSession->params.defaultPeakFunction.val())});
// not elegant: find the newly added range
for (int i = 0; i < size(); ++i) {
if (at(i).range().intersects(range)) {
if (at(i).peakRange().intersects(range)) {
selected_ = i;
return;
}
......@@ -62,7 +62,7 @@ void AllPeaksSettings::removeSelected()
bool AllPeaksSettings::selectByValue(double x)
{
for (int i = 0; i < size(); ++i) {
if (at(i).range().contains(x)) {
if (at(i).peakRange().contains(x)) {
selected_ = i;
return true;
}
......@@ -90,6 +90,6 @@ void AllPeaksSettings::sort()
std::sort(
peaksSettings_.begin(), peaksSettings_.end(),
[](const OnePeakSettings& p1, const OnePeakSettings& p2) {
return p1.range().min < p2.range().min;
return p1.peakRange().min < p2.peakRange().min;
});
}
......@@ -26,13 +26,13 @@ class OnePeakSettings {
public:
OnePeakSettings() = delete;
OnePeakSettings(const OnePeakSettings&) = default; // needed by sort
OnePeakSettings(const Range& range, const QString& functionName);
OnePeakSettings(const Range& peakRange, const QString& functionName);
void setPeakFunction(const QString&);
void setPeakMin(double val);
void setPeakMax(double val);
const Range& range() const { return range_; }
const Range& peakRange() const { return range_; }
const QString& functionName() const { return functionName_; }
const QStringList& fitParAsciiNames() const { return fitParAsciiNames_; }
const QStringList& fitParNiceNames() const { return fitParNiceNames_; }
......
......@@ -71,17 +71,17 @@ QVariant PeaksModel::data(const QModelIndex& index, int role) const
case COL_ID: return QString::number(row + 1);
case COL_TYPE: return peak.functionName();
case COL_RANGE:
if (!peak.range().isValid())
if (!peak.peakRange().isValid())
return "undefined";
else if (peak.range().isEmpty())
else if (peak.peakRange().isEmpty())
return "empty";
return peak.range().to_s();
return peak.peakRange().to_s();
default: return {};
}
}
case Qt::ForegroundRole: {
const auto& dfgramRange = gSession->currentOrAvgeDfgram()->curve.rgeX();
const bool isBadRange = peak.range().isEmpty() || !dfgramRange.contains(peak.range());
const bool isBadRange = peak.peakRange().isEmpty() || !dfgramRange.contains(peak.peakRange());
if (isBadRange && index.column() == COL_RANGE)
return QColor(Qt::red);
return QColor(Qt::black);
......@@ -155,7 +155,7 @@ void PeakfitOutcomeView::refresh()
const Dfgram* dfgram = gSession->currentOrAvgeDfgram();
ASSERT(dfgram); // the entire tab should be disabled if there is no active cluster
if (!dfgram->curve.rgeX().contains(peak->range()))
if (!dfgram->curve.rgeX().contains(peak->peakRange()))
return enable(false, false, false);
int jP = gSession->peaksSettings.selectedIndex();
......@@ -245,7 +245,7 @@ ControlsPeakfits::ControlsPeakfits() : QcrWidget {"ControlsPeakfits"}
"peak",
[]() -> const Range* {
const OnePeakSettings* p = gSession->peaksSettings.selectedPeak();
return p ? &p->range() : nullptr;
return p ? &p->peakRange() : nullptr;
},
[](double val, bool namelyMax) {
OnePeakSettings* p = gSession->peaksSettings.selectedPeak();
......
......@@ -244,7 +244,7 @@ void PlotDfgram::renderAll()
: colors::baseStd);
for (int jP = 0; jP < gSession->peaksSettings.size(); ++jP)
addBgItem(
gSession->peaksSettings.at(jP).range(),
gSession->peaksSettings.at(jP).peakRange(),
showPeakHighlight && jP == gSession->peaksSettings.selectedIndex() ? colors::peakEdit
: colors::peakStd);
......@@ -263,7 +263,7 @@ void PlotDfgram::renderAll()
// calculate peaks
std::vector<Curve> fitCurves;
for (int jP = 0; jP < gSession->peaksSettings.size(); ++jP)
if (curveMinusBg.rgeX().contains(gSession->peaksSettings.at(jP).range()))
if (curveMinusBg.rgeX().contains(gSession->peaksSettings.at(jP).peakRange()))
fitCurves.push_back(dfgram->getPeakAsCurve(jP));
const Range& tthRange = dfgram->curve.rgeX();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment