mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 07:03:25 -06:00
#1947 RFT/PLT Plot: Update curve auto name
This commit is contained in:
parent
02940992be
commit
21f07d186f
@ -91,6 +91,8 @@ RimEclipseResultCase::RimEclipseResultCase()
|
||||
|
||||
m_activeCellInfoIsReadFromFile = false;
|
||||
m_gridAndWellDataIsReadFromFile = false;
|
||||
|
||||
m_caseName = "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -203,8 +205,12 @@ bool RimEclipseResultCase::importGridAndResultMetaData(bool showTimeStepFilter)
|
||||
QStringList fileSplitOnDot = caseFileName().split(".");
|
||||
if (fileSplitOnDot.size() == 2)
|
||||
{
|
||||
QStringList fileSplitOnBackSlash = fileSplitOnDot[0].split("\\");
|
||||
m_caseName = fileSplitOnBackSlash.back();
|
||||
|
||||
QString rftFile = fileSplitOnDot[0] + ".RFT";
|
||||
std::string rftFileStdString = rftFile.toStdString();
|
||||
|
||||
if (std::ifstream(rftFileStdString.c_str()))
|
||||
{
|
||||
m_readerEclipseRft = new RifReaderEclipseRft(rftFileStdString);
|
||||
|
@ -65,6 +65,8 @@ public:
|
||||
|
||||
RifReaderEclipseRft* rftReader();
|
||||
|
||||
QString caseName() const { return m_caseName; }
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
@ -88,6 +90,7 @@ private:
|
||||
caf::PdmChildArrayField<RimFlowDiagSolution*> m_flowDiagSolutions;
|
||||
caf::PdmField<QString> m_sourSimFileName;
|
||||
|
||||
QString m_caseName;
|
||||
|
||||
// Obsolete field
|
||||
caf::PdmField<QString> caseDirectory;
|
||||
|
@ -139,8 +139,29 @@ RifEclipseRftAddress RimWellLogRftCurve::rftAddress() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogRftCurve::createCurveAutoName()
|
||||
{
|
||||
QString name = wellName() + ": " + wellLogChannelName();
|
||||
|
||||
QString name;
|
||||
if (m_eclipseResultCase)
|
||||
{
|
||||
name += m_eclipseResultCase->caseName();
|
||||
}
|
||||
if (wellName() != "")
|
||||
{
|
||||
name += ", ";
|
||||
name += wellName();
|
||||
}
|
||||
if (wellLogChannelName() != caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::text(RifEclipseRftAddress::NONE))
|
||||
{
|
||||
name += ", ";
|
||||
RifEclipseRftAddress::RftWellLogChannelName channelNameEnum = caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::fromText(wellLogChannelName());
|
||||
name += caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelName>::uiText(channelNameEnum);
|
||||
}
|
||||
if ( !m_timeStep().isNull())
|
||||
{
|
||||
QString dateFormat = "dd MMM yyyy";
|
||||
name += ", ";
|
||||
name += m_timeStep().toString(dateFormat);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -251,10 +272,11 @@ QList<caf::PdmOptionItemInfo> RimWellLogRftCurve::calculateValueOptions(const ca
|
||||
RifReaderEclipseRft* reader = rftReader();
|
||||
if (reader)
|
||||
{
|
||||
QString dateFormat = "dd MMM yyyy";
|
||||
std::vector<QDateTime> timeStamps = reader->availableTimeSteps(m_wellName, m_wellLogChannelName());
|
||||
for (const QDateTime& dt : timeStamps)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(dt.toString(), dt));
|
||||
options.push_back(caf::PdmOptionItemInfo(dt.toString(dateFormat), dt));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user