mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2071 LAS file. User can set date when LAS file date is invalid or missing
This commit is contained in:
parent
073225e954
commit
593633cd6e
@ -615,7 +615,7 @@ std::map<QDateTime, std::set<RifWellRftAddress> > RimWellPltPlot::timeStepsFromW
|
||||
{
|
||||
std::map<QDateTime, std::set<RifWellRftAddress> > timeStepsMap;
|
||||
|
||||
QDateTime timeStep = RiaDateStringParser::parseDateString(wellLogFile->date());
|
||||
QDateTime timeStep = wellLogFile->date();
|
||||
|
||||
if (timeStepsMap.count(timeStep) == 0)
|
||||
{
|
||||
@ -779,7 +779,7 @@ std::pair<RifWellRftAddress, QDateTime> RimWellPltPlot::curveDefFromCurve(const
|
||||
|
||||
if (wellLogFile != nullptr)
|
||||
{
|
||||
const QDateTime date = RiaDateStringParser::parseDateString(wellLogFile->date());
|
||||
const QDateTime date = wellLogFile->date();
|
||||
|
||||
if (date.isValid())
|
||||
{
|
||||
|
@ -583,7 +583,7 @@ std::map<QDateTime, std::set<RifWellRftAddress> > RimWellRftPlot::timeStepsFromW
|
||||
{
|
||||
std::map<QDateTime, std::set<RifWellRftAddress> > timeStepsMap;
|
||||
|
||||
QDateTime timeStep = RiaDateStringParser::parseDateString(wellLogFile->date());
|
||||
QDateTime timeStep = wellLogFile->date();
|
||||
|
||||
if (timeStepsMap.count(timeStep) == 0)
|
||||
{
|
||||
@ -745,7 +745,7 @@ std::pair<RifWellRftAddress, QDateTime> RimWellRftPlot::curveDefFromCurve(const
|
||||
|
||||
if (wellLogFile != nullptr)
|
||||
{
|
||||
const QDateTime date = RiaDateStringParser::parseDateString(wellLogFile->date());
|
||||
const QDateTime date = wellLogFile->date();
|
||||
|
||||
if (date.isValid())
|
||||
{
|
||||
|
@ -29,10 +29,11 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include "cafPdmUiDateEditor.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RimWellLogFile, "WellLogFile");
|
||||
@ -59,16 +60,8 @@ RimWellLogFile::RimWellLogFile()
|
||||
m_wellName.uiCapability()->setUiHidden(true);
|
||||
m_wellName.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_uiDate, "ui_Date", "Date", "", "", "");
|
||||
m_uiDate.registerGetMethod(this, &RimWellLogFile::formatDate);
|
||||
m_uiDate.uiCapability()->setUiHidden(false);
|
||||
m_uiDate.uiCapability()->setUiReadOnly(true);
|
||||
m_uiDate.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_date, "Date", "Date", "", "", "");
|
||||
m_date.uiCapability()->setUiReadOnly(true);
|
||||
m_date.uiCapability()->setUiHidden(true);
|
||||
m_date.xmlCapability()->disableIO();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_fileName, "FileName", "Filename", "", "", "");
|
||||
m_fileName.uiCapability()->setUiReadOnly(true);
|
||||
@ -158,7 +151,13 @@ bool RimWellLogFile::readFile(QString* errorMessage)
|
||||
}
|
||||
|
||||
m_wellName = m_wellLogDataFile->wellName();
|
||||
m_date = m_wellLogDataFile->date();
|
||||
|
||||
QDateTime date = RiaDateStringParser::parseDateString(m_wellLogDataFile->date());
|
||||
m_lasFileHasValidDate = date.isValid();
|
||||
if (m_lasFileHasValidDate)
|
||||
{
|
||||
m_date = date;
|
||||
}
|
||||
|
||||
m_wellLogChannelNames.deleteAllChildObjects();
|
||||
|
||||
@ -194,7 +193,7 @@ QString RimWellLogFile::wellName() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogFile::date() const
|
||||
QDateTime RimWellLogFile::date() const
|
||||
{
|
||||
return m_date;
|
||||
}
|
||||
@ -212,15 +211,32 @@ std::vector<RimWellLogFileChannel*> RimWellLogFile::wellLogChannels() const
|
||||
return channels;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogFile::hasFlowData() const
|
||||
{
|
||||
return RimWellPltPlot::hasFlowData(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFile::setupBeforeSave()
|
||||
{
|
||||
m_wellFlowCondition.xmlCapability()->setIOWritable(hasFlowData());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFile::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_fileName);
|
||||
uiOrdering.add(&m_uiDate);
|
||||
uiOrdering.add(&m_date);
|
||||
m_date.uiCapability()->setUiReadOnly(m_lasFileHasValidDate);
|
||||
|
||||
if (RimWellPltPlot::hasFlowData(this))
|
||||
if (hasFlowData())
|
||||
{
|
||||
uiOrdering.add(&m_wellFlowCondition);
|
||||
}
|
||||
@ -231,14 +247,26 @@ void RimWellLogFile::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellLogFile::formatDate() const
|
||||
QList<caf::PdmOptionItemInfo> RimWellLogFile::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QDateTime timeStep = RiaDateStringParser::parseDateString(m_date());
|
||||
if (timeStep.isValid())
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (fieldNeedingOptions == &m_date)
|
||||
{
|
||||
const QString dateFormatString = RimTools::createTimeFormatStringFromDates({ timeStep });
|
||||
auto ddd = timeStep.toString(dateFormatString);
|
||||
return timeStep.toString(dateFormatString);
|
||||
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFile::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute)
|
||||
{
|
||||
caf::PdmUiDateEditorAttribute* attrib = dynamic_cast<caf::PdmUiDateEditorAttribute*> (attribute);
|
||||
if (attrib != nullptr)
|
||||
{
|
||||
attrib->dateFormat = RimTools::dateFormatString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -27,6 +27,9 @@
|
||||
|
||||
#include "cvfBase.h"
|
||||
|
||||
#include <QDateTime>
|
||||
|
||||
|
||||
class RimWellLogFileChannel;
|
||||
|
||||
class QString;
|
||||
@ -57,18 +60,22 @@ public:
|
||||
bool readFile(QString* errorMessage);
|
||||
|
||||
QString wellName() const;
|
||||
QString date() const;
|
||||
QDateTime date() const;
|
||||
|
||||
RigWellLogFile* wellLogFile() { return m_wellLogDataFile.p(); }
|
||||
std::vector<RimWellLogFileChannel*> wellLogChannels() const;
|
||||
|
||||
bool hasFlowData() const;
|
||||
|
||||
private:
|
||||
virtual void setupBeforeSave() override;
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute) override;
|
||||
|
||||
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_name; }
|
||||
|
||||
QString formatDate() const;
|
||||
|
||||
caf::PdmChildArrayField<RimWellLogFileChannel*> m_wellLogChannelNames;
|
||||
|
||||
private:
|
||||
@ -76,7 +83,7 @@ private:
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<QString> m_fileName;
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmField<QString> m_date;
|
||||
caf::PdmProxyValueField<QString> m_uiDate;
|
||||
caf::PdmField<QDateTime> m_date;
|
||||
bool m_lasFileHasValidDate;
|
||||
caf::PdmField<caf::AppEnum<WellFlowCondition>> m_wellFlowCondition;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user