mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#869) Datastructures for right y-axis
This commit is contained in:
@@ -280,6 +280,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicNewSummaryCurveFilterFeature";
|
||||
commandIds << "RicNewSummaryCurveFeature";
|
||||
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteItemFeature";
|
||||
}
|
||||
@@ -287,6 +288,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicNewSummaryCurveFilterFeature";
|
||||
commandIds << "RicNewSummaryCurveFeature";
|
||||
commandIds << "RicSummaryCurveSwitchAxisFeature";
|
||||
commandIds << "Separator";
|
||||
commandIds << "RicDeleteItemFeature";
|
||||
}
|
||||
|
||||
@@ -253,15 +253,7 @@ void RimSummaryCurveFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedF
|
||||
}
|
||||
else if (changedField == &m_plotAxis)
|
||||
{
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->setPlotAxis(m_plotAxis());
|
||||
curve->updateQwtPlotAxis();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
plot->updateLeftAndRightYAxis();
|
||||
}
|
||||
updatePlotAxisForCurves();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,6 +377,22 @@ void RimSummaryCurveFilter::defineEditorAttribute(const caf::PdmFieldHandle* fie
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveFilter::updatePlotAxisForCurves()
|
||||
{
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->setPlotAxis(m_plotAxis());
|
||||
curve->updateQwtPlotAxis();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
plot->updateLeftAndRightYAxis();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -515,6 +523,25 @@ RimDefines::PlotAxis RimSummaryCurveFilter::associatedPlotAxis() const
|
||||
return m_plotAxis();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurveFilter::setPlotAxis(RimDefines::PlotAxis plotAxis)
|
||||
{
|
||||
m_plotAxis = plotAxis;
|
||||
updateConnectedEditors();
|
||||
|
||||
for (RimSummaryCurve* curve : m_curves)
|
||||
{
|
||||
curve->setPlotAxis(m_plotAxis());
|
||||
curve->updateQwtPlotAxis();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType(plot);
|
||||
plot->updateLeftAndRightYAxis();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -72,6 +72,7 @@ public:
|
||||
void updateCaseNameHasChanged();
|
||||
|
||||
RimDefines::PlotAxis associatedPlotAxis() const;
|
||||
void setPlotAxis(RimDefines::PlotAxis plotAxis);
|
||||
|
||||
private:
|
||||
void syncCurvesFromUiSelection();
|
||||
@@ -90,7 +91,9 @@ private:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
|
||||
void updatePlotAxisForCurves();
|
||||
|
||||
private:
|
||||
QPointer<QwtPlot> m_parentQwtPlot;
|
||||
|
||||
// Fields
|
||||
@@ -117,6 +120,5 @@ private:
|
||||
caf::PdmField< AppearanceTypeAppEnum > m_wellAppearanceType;
|
||||
caf::PdmField< AppearanceTypeAppEnum > m_groupAppearanceType;
|
||||
caf::PdmField< AppearanceTypeAppEnum > m_regionAppearanceType;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -145,8 +145,10 @@ void RimSummaryCurvesCalculator::applyPropertiesToPlot(RiuSummaryQwtPlot* m_qwtP
|
||||
{
|
||||
m_qwtPlot->setAxisScaleDraw(m_axisProperties->axis(), new ScientificScaleDraw());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
if (m_axisProperties->isLogarithmicScaleEnabled)
|
||||
{
|
||||
@@ -155,6 +157,8 @@ void RimSummaryCurvesCalculator::applyPropertiesToPlot(RiuSummaryQwtPlot* m_qwtP
|
||||
{
|
||||
m_qwtPlot->setAxisScaleEngine(m_axisProperties->axis(), new QwtLogScaleEngine);
|
||||
}
|
||||
|
||||
m_qwtPlot->setAxisMaxMinor(m_axisProperties->axis(), 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -163,9 +167,15 @@ void RimSummaryCurvesCalculator::applyPropertiesToPlot(RiuSummaryQwtPlot* m_qwtP
|
||||
{
|
||||
m_qwtPlot->setAxisScaleEngine(m_axisProperties->axis(), new QwtLinearScaleEngine);
|
||||
}
|
||||
|
||||
m_qwtPlot->setAxisMaxMinor(m_axisProperties->axis(), 3);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
m_qwtPlot->setAxisScale(m_axisProperties->axis(), m_axisProperties->visibleRangeMin, m_axisProperties->visibleRangeMax);
|
||||
|
||||
/*
|
||||
{
|
||||
if (m_axisProperties->isAutoScaleEnabled)
|
||||
{
|
||||
@@ -181,6 +191,7 @@ void RimSummaryCurvesCalculator::applyPropertiesToPlot(RiuSummaryQwtPlot* m_qwtP
|
||||
m_qwtPlot->setAxisScale(m_axisProperties->axis(), m_axisProperties->visibleRangeMin, m_axisProperties->visibleRangeMax);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -244,7 +255,7 @@ void RimSummaryCurvesCalculator::computeYRange(double* min, double* max) const
|
||||
maxValue = RimDefines::maximumDefaultValuePlot();
|
||||
}
|
||||
|
||||
if (m_axisProperties->isAutoScaleEnabled && m_axisProperties->isLogarithmicScaleEnabled)
|
||||
if (m_axisProperties->isLogarithmicScaleEnabled)
|
||||
{
|
||||
// For logarithmic auto scaling, compute positive curve value closest to zero and use
|
||||
// this value as the plot visible minimum
|
||||
|
||||
@@ -227,6 +227,10 @@ void RimSummaryPlot::setZoomWindow(const QRectF& zoomWindow)
|
||||
window.push_back(zoomWindow.height());
|
||||
|
||||
m_visibleWindow = window;
|
||||
|
||||
m_leftYAxisProperties->visibleRangeMax = zoomWindow.bottom();
|
||||
m_leftYAxisProperties->visibleRangeMin = zoomWindow.top();
|
||||
m_leftYAxisProperties->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ RimSummaryYAxisProperties::RimSummaryYAxisProperties()
|
||||
CAF_PDM_InitFieldNoDefault(&customTitle, "CustomTitle", "Title", "", "", "");
|
||||
CAF_PDM_InitField(&fontSize, "FontSize", 11, "Font Size", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&isAutoScaleEnabled, "AutoScale", true, "Auto Scale", "", "", "");
|
||||
CAF_PDM_InitField(&visibleRangeMin, "VisibleRangeMin", RimDefines::minimumDefaultValuePlot(), "Min", "", "", "");
|
||||
CAF_PDM_InitField(&visibleRangeMax, "VisibleRangeMax", RimDefines::maximumDefaultValuePlot(), "Max", "", "", "");
|
||||
CAF_PDM_InitField(&visibleRangeMin, "VisibleRangeMin", RimDefines::minimumDefaultValuePlot(), "Min", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&numberFormat, "NumberFormat", "Number Format", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale", "", "", "");
|
||||
isLogarithmicScaleEnabled.uiCapability()->setUiHidden(true);
|
||||
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
@@ -119,8 +119,7 @@ QwtPlot::Axis RimSummaryYAxisProperties::axis() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryYAxisProperties::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &isAutoTitle ||
|
||||
changedField == &isAutoScaleEnabled)
|
||||
if (changedField == &isAutoTitle)
|
||||
{
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
@@ -136,9 +135,6 @@ void RimSummaryYAxisProperties::fieldChangedByUi(const caf::PdmFieldHandle* chan
|
||||
void RimSummaryYAxisProperties::updateOptionSensitivity()
|
||||
{
|
||||
customTitle.uiCapability()->setUiReadOnly(isAutoTitle);
|
||||
|
||||
visibleRangeMin.uiCapability()->setUiReadOnly(isAutoScaleEnabled);
|
||||
visibleRangeMax.uiCapability()->setUiReadOnly(isAutoScaleEnabled);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -54,7 +54,6 @@ public:
|
||||
caf::PdmField<QString> customTitle;
|
||||
caf::PdmField<int> fontSize;
|
||||
|
||||
caf::PdmField<bool> isAutoScaleEnabled;
|
||||
caf::PdmField<double> visibleRangeMin;
|
||||
caf::PdmField<double> visibleRangeMax;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user