Summary : Fixed mixup of two different enums

This commit is contained in:
Magne Sjaastad 2016-11-24 09:13:20 +01:00
parent 46c3c1d296
commit bfb0cecaca
4 changed files with 31 additions and 20 deletions

View File

@ -118,7 +118,7 @@ void RimSummaryPlotYAxisFormater::applyYAxisPropertiesToPlot(RiuSummaryQwtPlot*
QString axisTitle = m_axisProperties->customTitle;
if (m_axisProperties->isAutoTitle) axisTitle = autoAxisTitle();
QwtText axisTitleY = qwtPlot->axisTitle(m_axisProperties->axis());
QwtText axisTitleY = qwtPlot->axisTitle(m_axisProperties->qwtPlotAxisType());
QFont axisTitleYFont = axisTitleY.font();
axisTitleYFont.setBold(true);
@ -137,28 +137,28 @@ void RimSummaryPlotYAxisFormater::applyYAxisPropertiesToPlot(RiuSummaryQwtPlot*
break;
}
qwtPlot->setAxisTitle(m_axisProperties->axis(), axisTitleY);
qwtPlot->setAxisTitle(m_axisProperties->qwtPlotAxisType(), axisTitleY);
}
{
QFont yAxisFont = qwtPlot->axisFont(m_axisProperties->axis());
QFont yAxisFont = qwtPlot->axisFont(m_axisProperties->qwtPlotAxisType());
yAxisFont.setBold(false);
yAxisFont.setPixelSize(m_axisProperties->fontSize);
qwtPlot->setAxisFont(m_axisProperties->axis(), yAxisFont);
qwtPlot->setAxisFont(m_axisProperties->qwtPlotAxisType(), yAxisFont);
}
{
if (m_axisProperties->numberFormat == RimSummaryYAxisProperties::NUMBER_FORMAT_AUTO)
{
qwtPlot->setAxisScaleDraw(m_axisProperties->axis(), new QwtScaleDraw);
qwtPlot->setAxisScaleDraw(m_axisProperties->qwtPlotAxisType(), new QwtScaleDraw);
}
else if (m_axisProperties->numberFormat == RimSummaryYAxisProperties::NUMBER_FORMAT_DECIMAL)
{
qwtPlot->setAxisScaleDraw(m_axisProperties->axis(), new DecimalScaleDraw);
qwtPlot->setAxisScaleDraw(m_axisProperties->qwtPlotAxisType(), new DecimalScaleDraw);
}
else if (m_axisProperties->numberFormat == RimSummaryYAxisProperties::NUMBER_FORMAT_SCIENTIFIC)
{
qwtPlot->setAxisScaleDraw(m_axisProperties->axis(), new ScientificScaleDraw());
qwtPlot->setAxisScaleDraw(m_axisProperties->qwtPlotAxisType(), new ScientificScaleDraw());
}
}
@ -166,21 +166,21 @@ void RimSummaryPlotYAxisFormater::applyYAxisPropertiesToPlot(RiuSummaryQwtPlot*
{
if (m_axisProperties->isLogarithmicScaleEnabled)
{
QwtLogScaleEngine* currentScaleEngine = dynamic_cast<QwtLogScaleEngine*>(qwtPlot->axisScaleEngine(m_axisProperties->axis()));
QwtLogScaleEngine* currentScaleEngine = dynamic_cast<QwtLogScaleEngine*>(qwtPlot->axisScaleEngine(m_axisProperties->qwtPlotAxisType()));
if (!currentScaleEngine)
{
qwtPlot->setAxisScaleEngine(m_axisProperties->axis(), new QwtLogScaleEngine);
qwtPlot->setAxisMaxMinor(m_axisProperties->axis(), 5);
qwtPlot->setAxisScaleEngine(m_axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine);
qwtPlot->setAxisMaxMinor(m_axisProperties->qwtPlotAxisType(), 5);
}
}
else
{
QwtLinearScaleEngine* currentScaleEngine = dynamic_cast<QwtLinearScaleEngine*>(qwtPlot->axisScaleEngine(m_axisProperties->axis()));
QwtLinearScaleEngine* currentScaleEngine = dynamic_cast<QwtLinearScaleEngine*>(qwtPlot->axisScaleEngine(m_axisProperties->qwtPlotAxisType()));
if (!currentScaleEngine)
{
qwtPlot->setAxisScaleEngine(m_axisProperties->axis(), new QwtLinearScaleEngine);
qwtPlot->setAxisMaxMinor(m_axisProperties->axis(), 3);
qwtPlot->setAxisScaleEngine(m_axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine);
qwtPlot->setAxisMaxMinor(m_axisProperties->qwtPlotAxisType(), 3);
}
}
}
@ -195,7 +195,7 @@ QString RimSummaryPlotYAxisFormater::autoAxisTitle() const
for ( RimSummaryCurve* rimCurve : m_singleCurves )
{
if ( rimCurve->isCurveVisible() && rimCurve->yAxis() == this->m_axisProperties->axis() )
if ( rimCurve->isCurveVisible() && rimCurve->yAxis() == this->m_axisProperties->plotAxisType() )
{
unitToQuantityNameMap[rimCurve->unitName()].insert(rimCurve->summaryAddress().quantityName());
}
@ -209,7 +209,7 @@ QString RimSummaryPlotYAxisFormater::autoAxisTitle() const
for ( RimSummaryCurve* rimCurve : curveFilterCurves )
{
if ( rimCurve->isCurveVisible() && rimCurve->yAxis() == this->m_axisProperties->axis() )
if ( rimCurve->isCurveVisible() && rimCurve->yAxis() == this->m_axisProperties->plotAxisType() )
{
unitToQuantityNameMap[rimCurve->unitName()].insert(rimCurve->summaryAddress().quantityName());
}

View File

@ -434,7 +434,7 @@ void RimSummaryPlot::zoomAll()
RimSummaryPlotYAxisRangeCalculator calc(m_leftYAxisProperties, curves);
calc.computeYRange(&min, &max);
m_qwtPlot->setAxisScale(m_leftYAxisProperties->axis(), min, max);
m_qwtPlot->setAxisScale(m_leftYAxisProperties->qwtPlotAxisType(), min, max);
}
else
{
@ -449,7 +449,7 @@ void RimSummaryPlot::zoomAll()
RimSummaryPlotYAxisRangeCalculator calc(m_rightYAxisProperties, curves);
calc.computeYRange(&min, &max);
m_qwtPlot->setAxisScale(m_rightYAxisProperties->axis(), min, max);
m_qwtPlot->setAxisScale(m_rightYAxisProperties->qwtPlotAxisType(), min, max);
}
else
{

View File

@ -127,11 +127,21 @@ void RimSummaryYAxisProperties::setNameAndAxis(const QString& name, QwtPlot::Axi
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtPlot::Axis RimSummaryYAxisProperties::axis() const
QwtPlot::Axis RimSummaryYAxisProperties::qwtPlotAxisType() const
{
return m_axis;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimDefines::PlotAxis RimSummaryYAxisProperties::plotAxisType() const
{
if (m_axis == QwtPlot::yRight) return RimDefines::PLOT_AXIS_RIGHT;
return RimDefines::PLOT_AXIS_LEFT;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -55,8 +55,9 @@ public:
public:
RimSummaryYAxisProperties();
void setNameAndAxis(const QString& name, QwtPlot::Axis axis);
QwtPlot::Axis axis() const;
void setNameAndAxis(const QString& name, QwtPlot::Axis axis);
QwtPlot::Axis qwtPlotAxisType() const;
RimDefines::PlotAxis plotAxisType() const;
caf::PdmField<bool> isAutoTitle;
caf::PdmField<QString> customTitle;