mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3277 Implement stepping for Common Data Source and rename Plot Source Stepping for summary plots.
* The name for the UI groups is now "Data Source" for both types of data source stepping.
This commit is contained in:
parent
ac8a11c813
commit
d81b85c54c
@ -116,6 +116,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotNameConfig.h
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurveNameConfig.h
|
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurveNameConfig.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurveNameConfig.h
|
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurveNameConfig.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurveNameConfig.h
|
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurveNameConfig.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimDataSourceSteppingTools.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveCommonDataSource.h
|
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveCommonDataSource.h
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -237,6 +238,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimWellLogPlotNameConfig.cpp
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurveNameConfig.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimWellLogExtractionCurveNameConfig.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurveNameConfig.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurveNameConfig.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurveNameConfig.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurveNameConfig.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RimDataSourceSteppingTools.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveCommonDataSource.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RimWellLogCurveCommonDataSource.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
#include "RimDataSourceSteppingTools.h"
|
||||||
|
|
||||||
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimDataSourceSteppingTools::modifyCurrentIndex(caf::PdmValueField* valueField, const QList<caf::PdmOptionItemInfo>& options, int indexOffset)
|
||||||
|
{
|
||||||
|
if (valueField && !options.isEmpty())
|
||||||
|
{
|
||||||
|
QVariant currentValue = valueField->toQVariant();
|
||||||
|
caf::PdmPointer<caf::PdmObjectHandle> currentHandle = currentValue.value<caf::PdmPointer<caf::PdmObjectHandle>>();
|
||||||
|
int currentIndex = -1;
|
||||||
|
for (int i = 0; i < options.size(); i++)
|
||||||
|
{
|
||||||
|
QVariant optionValue = options[i].value();
|
||||||
|
// First try pointer variety. They are not supported by QVariant::operator==
|
||||||
|
caf::PdmPointer<caf::PdmObjectHandle> optionHandle = optionValue.value<caf::PdmPointer<caf::PdmObjectHandle>>();
|
||||||
|
if (optionHandle)
|
||||||
|
{
|
||||||
|
if (currentHandle == optionHandle)
|
||||||
|
{
|
||||||
|
currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentValue == optionValue)
|
||||||
|
{
|
||||||
|
currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentIndex == -1)
|
||||||
|
{
|
||||||
|
currentIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nextIndex = currentIndex + indexOffset;
|
||||||
|
if (nextIndex < options.size() && nextIndex > -1)
|
||||||
|
{
|
||||||
|
QVariant newValue = options[nextIndex].value();
|
||||||
|
valueField->setFromQVariant(newValue);
|
||||||
|
valueField->uiCapability()->notifyFieldChanged(currentValue, newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2016 Statoil ASA
|
||||||
|
//
|
||||||
|
// ResInsight is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include "cafPdmField.h"
|
||||||
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
|
//==================================================================================================
|
||||||
|
///
|
||||||
|
//==================================================================================================
|
||||||
|
class RimDataSourceSteppingTools
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void modifyCurrentIndex(caf::PdmValueField* valueField, const QList<caf::PdmOptionItemInfo>& options, int indexOffset);
|
||||||
|
};
|
@ -19,6 +19,7 @@
|
|||||||
#include "RimWellLogCurveCommonDataSource.h"
|
#include "RimWellLogCurveCommonDataSource.h"
|
||||||
|
|
||||||
#include "RimCase.h"
|
#include "RimCase.h"
|
||||||
|
#include "RimDataSourceSteppingTools.h"
|
||||||
#include "RimEclipseCase.h"
|
#include "RimEclipseCase.h"
|
||||||
#include "RimOilField.h"
|
#include "RimOilField.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
@ -34,6 +35,7 @@
|
|||||||
#include "RiaSimWellBranchTools.h"
|
#include "RiaSimWellBranchTools.h"
|
||||||
|
|
||||||
#include "cafPdmUiCheckBoxTristateEditor.h"
|
#include "cafPdmUiCheckBoxTristateEditor.h"
|
||||||
|
#include "cafPdmUiComboBoxEditor.h"
|
||||||
|
|
||||||
CAF_PDM_SOURCE_INIT(RimWellLogCurveCommonDataSource, "ChangeDataSourceFeatureUi");
|
CAF_PDM_SOURCE_INIT(RimWellLogCurveCommonDataSource, "ChangeDataSourceFeatureUi");
|
||||||
|
|
||||||
@ -363,6 +365,68 @@ void RimWellLogCurveCommonDataSource::updateCurves(std::vector<RimWellLogCurve*>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogCurveCommonDataSource::applyPrevCase()
|
||||||
|
{
|
||||||
|
modifyCurrentIndex(&m_case, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogCurveCommonDataSource::applyNextCase()
|
||||||
|
{
|
||||||
|
modifyCurrentIndex(&m_case, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogCurveCommonDataSource::applyPrevWell()
|
||||||
|
{
|
||||||
|
if (m_trajectoryType() == RimWellLogExtractionCurve::WELL_PATH)
|
||||||
|
{
|
||||||
|
modifyCurrentIndex(&m_wellPath, -1);
|
||||||
|
}
|
||||||
|
else if (m_trajectoryType() == RimWellLogExtractionCurve::SIMULATION_WELL)
|
||||||
|
{
|
||||||
|
modifyCurrentIndex(&m_simWellName, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogCurveCommonDataSource::applyNextWell()
|
||||||
|
{
|
||||||
|
if (m_trajectoryType() == RimWellLogExtractionCurve::WELL_PATH)
|
||||||
|
{
|
||||||
|
modifyCurrentIndex(&m_wellPath, 1);
|
||||||
|
}
|
||||||
|
else if (m_trajectoryType() == RimWellLogExtractionCurve::SIMULATION_WELL)
|
||||||
|
{
|
||||||
|
modifyCurrentIndex(&m_simWellName, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogCurveCommonDataSource::applyPrevTimeStep()
|
||||||
|
{
|
||||||
|
modifyCurrentIndex(&m_timeStep, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogCurveCommonDataSource::applyNextTimeStep()
|
||||||
|
{
|
||||||
|
modifyCurrentIndex(&m_timeStep, 1);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -545,3 +609,54 @@ void RimWellLogCurveCommonDataSource::defineUiOrdering(QString uiConfigName, caf
|
|||||||
group->add(&m_timeStep);
|
group->add(&m_timeStep);
|
||||||
uiOrdering.skipRemainingFields(true);
|
uiOrdering.skipRemainingFields(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogCurveCommonDataSource::defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||||
|
QString uiConfigName,
|
||||||
|
caf::PdmUiEditorAttribute* attribute)
|
||||||
|
{
|
||||||
|
caf::PdmUiComboBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>(attribute);
|
||||||
|
if (myAttr)
|
||||||
|
{
|
||||||
|
if (field == &m_case ||
|
||||||
|
field == &m_simWellName ||
|
||||||
|
field == &m_wellPath ||
|
||||||
|
field == &m_timeStep)
|
||||||
|
{
|
||||||
|
myAttr->showPreviousAndNextButtons = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString modifierText;
|
||||||
|
|
||||||
|
if (field == &m_case)
|
||||||
|
{
|
||||||
|
modifierText = ("(Shift+");
|
||||||
|
}
|
||||||
|
else if (field == &m_wellPath || field == &m_simWellName)
|
||||||
|
{
|
||||||
|
modifierText = ("(Ctrl+");
|
||||||
|
}
|
||||||
|
else if (field == &m_timeStep)
|
||||||
|
{
|
||||||
|
modifierText = ("(");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!modifierText.isEmpty())
|
||||||
|
{
|
||||||
|
myAttr->nextButtonText = "Next " + modifierText + "PgDown)";
|
||||||
|
myAttr->prevButtonText = "Previous " + modifierText + "PgUp)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogCurveCommonDataSource::modifyCurrentIndex(caf::PdmValueField* field, int indexOffset)
|
||||||
|
{
|
||||||
|
bool useOptionsOnly;
|
||||||
|
QList<caf::PdmOptionItemInfo> options = calculateValueOptions(field, &useOptionsOnly);
|
||||||
|
RimDataSourceSteppingTools::modifyCurrentIndex(field, options, indexOffset);
|
||||||
|
}
|
||||||
|
@ -60,13 +60,26 @@ public:
|
|||||||
void updateDefaultOptions(const std::vector<RimWellLogCurve*>& curves);
|
void updateDefaultOptions(const std::vector<RimWellLogCurve*>& curves);
|
||||||
void updateDefaultOptions();
|
void updateDefaultOptions();
|
||||||
void updateCurves(std::vector<RimWellLogCurve*>& curves);
|
void updateCurves(std::vector<RimWellLogCurve*>& curves);
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
|
||||||
|
void applyPrevCase();
|
||||||
|
void applyNextCase();
|
||||||
|
|
||||||
|
void applyPrevWell();
|
||||||
|
void applyNextWell();
|
||||||
|
|
||||||
|
void applyPrevTimeStep();
|
||||||
|
void applyNextTimeStep();
|
||||||
protected:
|
protected:
|
||||||
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField,
|
||||||
|
const QVariant& oldValue,
|
||||||
|
const QVariant& newValue) override;
|
||||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||||
bool* useOptionsOnly) override;
|
bool* useOptionsOnly) override;
|
||||||
|
|
||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
|
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field,
|
||||||
|
QString uiConfigName,
|
||||||
|
caf::PdmUiEditorAttribute* attribute) override;
|
||||||
|
void modifyCurrentIndex(caf::PdmValueField* field, int indexOffset);
|
||||||
private:
|
private:
|
||||||
caf::PdmPtrField<RimCase*> m_case;
|
caf::PdmPtrField<RimCase*> m_case;
|
||||||
caf::PdmField<int> m_trajectoryType;
|
caf::PdmField<int> m_trajectoryType;
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#include "cafPdmUiComboBoxEditor.h"
|
#include "cafPdmUiComboBoxEditor.h"
|
||||||
#include "cvfAssert.h"
|
#include "cvfAssert.h"
|
||||||
|
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define RI_LOGPLOT_MINDEPTH_DEFAULT 0.0
|
#define RI_LOGPLOT_MINDEPTH_DEFAULT 0.0
|
||||||
@ -705,6 +707,49 @@ void RimWellLogPlot::updateHolder()
|
|||||||
this->updatePlotTitle();
|
this->updatePlotTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogPlot::handleKeyPressEvent(QKeyEvent* keyEvent)
|
||||||
|
{
|
||||||
|
if (keyEvent->key() == Qt::Key_PageUp)
|
||||||
|
{
|
||||||
|
if (keyEvent->modifiers() & Qt::ShiftModifier)
|
||||||
|
{
|
||||||
|
m_commonDataSource->applyPrevCase();
|
||||||
|
keyEvent->accept();
|
||||||
|
}
|
||||||
|
else if (keyEvent->modifiers() & Qt::ControlModifier)
|
||||||
|
{
|
||||||
|
m_commonDataSource->applyPrevWell();
|
||||||
|
keyEvent->accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_commonDataSource->applyPrevTimeStep();
|
||||||
|
keyEvent->accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (keyEvent->key() == Qt::Key_PageDown)
|
||||||
|
{
|
||||||
|
if (keyEvent->modifiers() & Qt::ShiftModifier)
|
||||||
|
{
|
||||||
|
m_commonDataSource->applyNextCase();
|
||||||
|
keyEvent->accept();
|
||||||
|
}
|
||||||
|
else if (keyEvent->modifiers() & Qt::ControlModifier)
|
||||||
|
{
|
||||||
|
m_commonDataSource->applyNextWell();
|
||||||
|
keyEvent->accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_commonDataSource->applyNextTimeStep();
|
||||||
|
keyEvent->accept();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -36,7 +36,7 @@ class RiuWellLogPlot;
|
|||||||
class RimWellLogTrack;
|
class RimWellLogTrack;
|
||||||
class RimWellRftPlot;
|
class RimWellRftPlot;
|
||||||
class RimWellPltPlot;
|
class RimWellPltPlot;
|
||||||
|
class QKeyEvent;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -125,6 +125,8 @@ public:
|
|||||||
virtual QString createAutoName() const override;
|
virtual QString createAutoName() const override;
|
||||||
void updateHolder() override;
|
void updateHolder() override;
|
||||||
|
|
||||||
|
void handleKeyPressEvent(QKeyEvent* keyEvent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
|
@ -365,7 +365,7 @@ void RimSummaryCurveCollection::defineUiOrdering(QString uiConfigName, caf::PdmU
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto group = uiOrdering.addNewGroup("Plot Source Stepping");
|
auto group = uiOrdering.addNewGroup("Data Source");
|
||||||
|
|
||||||
m_ySourceStepping()->uiOrdering(uiConfigName, *group);
|
m_ySourceStepping()->uiOrdering(uiConfigName, *group);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "RifSummaryReaderInterface.h"
|
#include "RifSummaryReaderInterface.h"
|
||||||
|
|
||||||
|
#include "RimDataSourceSteppingTools.h"
|
||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
#include "RimSummaryCaseMainCollection.h"
|
#include "RimSummaryCaseMainCollection.h"
|
||||||
@ -75,33 +76,7 @@ void RimSummaryPlotSourceStepping::setSourceSteppingType(SourceSteppingType sour
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlotSourceStepping::applyNextCase()
|
void RimSummaryPlotSourceStepping::applyNextCase()
|
||||||
{
|
{
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
modifyCurrentIndex(&m_summaryCase, 1);
|
||||||
|
|
||||||
auto summaryCases = proj->allSummaryCases();
|
|
||||||
if (summaryCases.size() < 1) return;
|
|
||||||
|
|
||||||
auto currentCase = std::find(summaryCases.begin(), summaryCases.end(), m_summaryCase());
|
|
||||||
|
|
||||||
if (currentCase != summaryCases.end())
|
|
||||||
{
|
|
||||||
currentCase++;
|
|
||||||
if (currentCase != summaryCases.end())
|
|
||||||
{
|
|
||||||
m_summaryCase = *currentCase;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_summaryCase = summaryCases[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldChangedByUi(&m_summaryCase, QVariant(), QVariant());
|
|
||||||
m_summaryCase.uiCapability()->updateConnectedEditors();
|
|
||||||
|
|
||||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
|
||||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
|
||||||
|
|
||||||
curveCollection->updateConnectedEditors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -109,30 +84,7 @@ void RimSummaryPlotSourceStepping::applyNextCase()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlotSourceStepping::applyPrevCase()
|
void RimSummaryPlotSourceStepping::applyPrevCase()
|
||||||
{
|
{
|
||||||
RimProject* proj = RiaApplication::instance()->project();
|
modifyCurrentIndex(&m_summaryCase, -1);
|
||||||
|
|
||||||
auto summaryCases = proj->allSummaryCases();
|
|
||||||
if (summaryCases.size() < 1) return;
|
|
||||||
|
|
||||||
auto currentCase = std::find(summaryCases.begin(), summaryCases.end(), m_summaryCase());
|
|
||||||
|
|
||||||
if (currentCase != summaryCases.end() && currentCase != summaryCases.begin())
|
|
||||||
{
|
|
||||||
currentCase--;
|
|
||||||
m_summaryCase = *currentCase;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_summaryCase = summaryCases[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldChangedByUi(&m_summaryCase, QVariant(), QVariant());
|
|
||||||
m_summaryCase.uiCapability()->updateConnectedEditors();
|
|
||||||
|
|
||||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
|
||||||
this->firstAncestorOrThisOfTypeAsserted(curveCollection);
|
|
||||||
|
|
||||||
curveCollection->updateConnectedEditors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -694,44 +646,9 @@ RiaSummaryCurveAnalyzer* RimSummaryPlotSourceStepping::analyzerForReader(RifSumm
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlotSourceStepping::modifyCurrentIndex(caf::PdmValueField* valueField, int indexOffset)
|
void RimSummaryPlotSourceStepping::modifyCurrentIndex(caf::PdmValueField* valueField, int indexOffset)
|
||||||
{
|
{
|
||||||
if (valueField)
|
bool useOptionsOnly;
|
||||||
{
|
QList<caf::PdmOptionItemInfo> options = calculateValueOptions(valueField, &useOptionsOnly);
|
||||||
bool useOptionsOnly = true;
|
RimDataSourceSteppingTools::modifyCurrentIndex(valueField, options, indexOffset);
|
||||||
|
|
||||||
QList<caf::PdmOptionItemInfo> options = calculateValueOptions(valueField, nullptr);
|
|
||||||
if (options.isEmpty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto uiVariant = valueField->uiCapability()->toUiBasedQVariant();
|
|
||||||
|
|
||||||
int currentIndex = -1;
|
|
||||||
for (int i = 0; i < options.size(); i++)
|
|
||||||
{
|
|
||||||
if (uiVariant == options[i].optionUiText())
|
|
||||||
{
|
|
||||||
currentIndex = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentIndex == -1)
|
|
||||||
{
|
|
||||||
currentIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int nextIndex = currentIndex + indexOffset;
|
|
||||||
if (nextIndex < options.size() && nextIndex > -1)
|
|
||||||
{
|
|
||||||
auto optionValue = options[nextIndex].value();
|
|
||||||
|
|
||||||
QVariant currentValue = valueField->toQVariant();
|
|
||||||
|
|
||||||
valueField->setFromQVariant(optionValue);
|
|
||||||
|
|
||||||
valueField->uiCapability()->notifyFieldChanged(currentValue, optionValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -399,8 +399,13 @@ void RiuSummaryQwtPlot::setCommonPlotBehaviour(QwtPlot* plot)
|
|||||||
plot->setAxisTitle(QwtPlot::yLeft, axisTitle);
|
plot->setAxisTitle(QwtPlot::yLeft, axisTitle);
|
||||||
plot->setAxisTitle(QwtPlot::yRight, axisTitle);
|
plot->setAxisTitle(QwtPlot::yRight, axisTitle);
|
||||||
|
|
||||||
// Enable mousetracking and event filter
|
// Set a focus policy to allow it taking key press events.
|
||||||
|
// This is not strictly necessary since this widget inherit QwtPlot
|
||||||
|
// which already has a focus policy.
|
||||||
|
// However, for completeness we still do it here.
|
||||||
|
plot->setFocusPolicy(Qt::WheelFocus);
|
||||||
|
|
||||||
|
// Enable mousetracking and event filter
|
||||||
plot->canvas()->setMouseTracking(true);
|
plot->canvas()->setMouseTracking(true);
|
||||||
plot->canvas()->installEventFilter(plot);
|
plot->canvas()->installEventFilter(plot);
|
||||||
plot->plotLayout()->setAlignCanvasToScales(true);
|
plot->plotLayout()->setAlignCanvasToScales(true);
|
||||||
|
@ -73,6 +73,7 @@ RiuWellLogPlot::RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent)
|
|||||||
|
|
||||||
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||||
|
|
||||||
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
connect(m_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotSetMinDepth(int)));
|
connect(m_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotSetMinDepth(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,6 +234,14 @@ QSize RiuWellLogPlot::sizeHint() const
|
|||||||
return QSize(1, 1);
|
return QSize(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RiuWellLogPlot::keyPressEvent(QKeyEvent* keyEvent)
|
||||||
|
{
|
||||||
|
m_plotDefinition->handleKeyPressEvent(keyEvent);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -70,6 +70,9 @@ protected:
|
|||||||
virtual void contextMenuEvent(QContextMenuEvent *) override;
|
virtual void contextMenuEvent(QContextMenuEvent *) override;
|
||||||
virtual QSize sizeHint() const override;
|
virtual QSize sizeHint() const override;
|
||||||
|
|
||||||
|
|
||||||
|
virtual void keyPressEvent(QKeyEvent* keyEvent) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateScrollBar(double minDepth, double maxDepth);
|
void updateScrollBar(double minDepth, double maxDepth);
|
||||||
std::map<int, int> calculateTrackWidthsToMatchFrame(int frameWidth) const;
|
std::map<int, int> calculateTrackWidthsToMatchFrame(int frameWidth) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user