#1947 RFT/PLT Plot: Add uiordering and change Address from std to qt variables

This commit is contained in:
Unknown 2017-10-05 13:49:49 +02:00 committed by Rebecca Cox
parent b8cef666e0
commit 9c3b199e7e
5 changed files with 92 additions and 24 deletions

View File

@ -18,6 +18,31 @@
#include "RifEclipseRftAddress.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseRftAddress::RifEclipseRftAddress(std::string wellName, time_t timeStep, std::string wellLogChannelName)
{
m_timeStep.setTimeSpec(Qt::TimeSpec::UTC);
m_timeStep.setTime_t(timeStep);
m_wellName = QString(wellName.c_str());
m_wellLogChannelName = QString(wellLogChannelName.c_str());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RifEclipseRftAddress::RifEclipseRftAddress(QString wellName, QDateTime timeStep, QString wellLogChannelName) :
m_wellName(wellName), m_wellLogChannelName(wellLogChannelName)
{
timeStep.setTimeSpec(Qt::TimeSpec::UTC);
m_timeStep.setTimeSpec(Qt::TimeSpec::UTC);
m_timeStep = timeStep;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -41,3 +66,4 @@ bool operator<(const RifEclipseRftAddress& first, const RifEclipseRftAddress& se
return false;
}

View File

@ -20,6 +20,7 @@
#pragma once
#include <string>
#include <QDateTime>
//==================================================================================================
///
@ -28,17 +29,17 @@
class RifEclipseRftAddress
{
public:
RifEclipseRftAddress(std::string wellName, time_t timeStep, std::string wellLogChannelName) :
m_wellName(wellName), m_timeStep(timeStep), m_wellLogChannelName(wellLogChannelName) {}
RifEclipseRftAddress(QString wellName, QDateTime timeStep, QString wellLogChannelName);
RifEclipseRftAddress(std::string wellName, time_t timeStep, std::string wellLogChannelName);
const std::string& wellName() const { return m_wellName; }
time_t timeStep() const { return m_timeStep; }
const std::string& wellLogChannelName() const { return m_wellLogChannelName; }
const QString& wellName() const { return m_wellName; }
QDateTime timeStep() const { return m_timeStep; }
const QString& wellLogChannelName() const { return m_wellLogChannelName; }
private:
std::string m_wellName;
time_t m_timeStep;
std::string m_wellLogChannelName;
QString m_wellName;
QDateTime m_timeStep;
QString m_wellLogChannelName;
};
bool operator==(const RifEclipseRftAddress& first, const RifEclipseRftAddress& second);

View File

@ -22,6 +22,8 @@
#include "ert/ecl/ecl_rft_file.h"
#include <QString>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -134,7 +136,7 @@ void RifReaderEclipseRft::values(const RifEclipseRftAddress& rftAddress, std::ve
ecl_rft_node_type* node = ecl_rft_file_iget_node(m_ecl_rft_file, index);
std::string wellLogChannelName = rftAddress.wellLogChannelName();
QString wellLogChannelName = rftAddress.wellLogChannelName();
if (wellLogChannelName == "DEPTH")
{

View File

@ -37,6 +37,8 @@
#include "cafPdmObject.h"
#include "cvfAssert.h"
#include <QString>
CAF_PDM_SOURCE_INIT(RimWellLogRftCurve, "WellLogRftCurve");
@ -80,14 +82,6 @@ QString RimWellLogRftCurve::wellLogChannelName() const
return m_wellLogChannelName;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RimWellLogRftCurve::currentTimeStep() const
{
return m_timeStep;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -104,6 +98,16 @@ RimEclipseResultCase* RimWellLogRftCurve::eclipseResultCase() const
return m_eclipseResultCase;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurve::setRftAddress(RifEclipseRftAddress address)
{
m_timeStep = address.timeStep();
m_wellName = address.wellName();
m_wellLogChannelName = address.wellLogChannelName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -150,6 +154,26 @@ void RimWellLogRftCurve::onLoadDataAndUpdate(bool updateParentPlot)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
RimPlotCurve::updateOptionSensitivity();
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data");
curveDataGroup->add(&m_wellName);
curveDataGroup->add(&m_wellLogChannelName);
curveDataGroup->add(&m_timeStep);
caf::PdmUiGroup* appearanceGroup = uiOrdering.addNewGroup("Appearance");
RimPlotCurve::appearanceUiOrdering(*appearanceGroup);
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name");
nameGroup->add(&m_showLegend);
RimPlotCurve::curveNameUiOrdering(*nameGroup);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -167,6 +191,20 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions(const ca
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
if (fieldNeedingOptions == &m_wellLogChannelName)
{
RimTools::caseOptionItems(&options);
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
if (fieldNeedingOptions == &m_timeStep)
{
RimTools::caseOptionItems(&options);
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
}
return options;
}
@ -212,7 +250,7 @@ std::vector<double> RimWellLogRftCurve::xValues() const
if (!reader) return values;
RifEclipseRftAddress address(m_wellName().toStdString(), m_timeStep, m_wellLogChannelName().toStdString());
RifEclipseRftAddress address(m_wellName(), m_timeStep, m_wellLogChannelName());
reader->values(address, &values);
@ -229,7 +267,7 @@ std::vector<double> RimWellLogRftCurve::depthValues() const
if (!reader) return values;
RifEclipseRftAddress address(m_wellName().toStdString(), m_timeStep, "DEPTH");
RifEclipseRftAddress address(m_wellName(), m_timeStep, "DEPTH");
reader->values(address, &values);

View File

@ -46,19 +46,20 @@ public:
virtual QString wellName() const override;
virtual QString wellLogChannelName() const override;
int currentTimeStep() const;
void setEclipseResultCase(RimEclipseResultCase* eclipseResultCase);
RimEclipseResultCase* eclipseResultCase() const;
void setRftAddress(RifEclipseRftAddress address);
protected:
// Overrides from RimWellLogPlotCurve
virtual QString createCurveAutoName() override;
virtual void onLoadDataAndUpdate(bool updateParentPlot) override;
// Pdm overrrides
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
private:
RifReaderEclipseRft* rftReader() const;
@ -70,7 +71,7 @@ private:
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
caf::PdmPtrField<RimEclipseResultCase*> m_eclipseResultCase;
caf::PdmField<time_t> m_timeStep;
caf::PdmField<QDateTime> m_timeStep;
caf::PdmField<QString> m_wellName;
caf::PdmField<QString> m_wellLogChannelName;
};