mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#436) Added property fields. Handling project file read/write,
This commit is contained in:
parent
f1e11780ce
commit
c88bdfd823
@ -30,6 +30,9 @@
|
||||
#include "RimProject.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RigWellLogFile.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
@ -37,6 +40,7 @@
|
||||
#include "RiuWellLogTracePlot.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafPdmUiTreeView.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -61,7 +65,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellLog*> selection = selectedWellLogs();
|
||||
if (selection.size() < 1) return;
|
||||
|
||||
|
||||
RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot();
|
||||
|
||||
RimWellLogPlotTrace* plotTrace = new RimWellLogPlotTrace();
|
||||
@ -69,10 +73,15 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
caf::PdmUiItem* uiItem = NULL;
|
||||
|
||||
for (size_t wlIdx = 0; wlIdx < selection.size(); wlIdx++)
|
||||
{
|
||||
RimWellLog* wellLog = selection[wlIdx];
|
||||
|
||||
RimWellPath* wellPath;
|
||||
wellLog->firstAnchestorOrThisOfType(wellPath);
|
||||
|
||||
RimWellLasFileInfo* lasFileInfo;
|
||||
wellLog->firstAnchestorOrThisOfType(lasFileInfo);
|
||||
if (lasFileInfo)
|
||||
@ -85,18 +94,28 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIdx);
|
||||
curve->setColor(curveColor);
|
||||
curve->setDescription(wellLog->name());
|
||||
|
||||
RigWellLogFile* wellLogFile = lasFileInfo->wellLogFile();
|
||||
|
||||
curve->setCurveData(wellLogFile->values(wellLog->name()), wellLogFile->depthValues());
|
||||
curve->setWellPath(wellPath);
|
||||
curve->setWellLogChannelName(wellLog->name());
|
||||
|
||||
curve->updatePlotData();
|
||||
|
||||
if (wlIdx == selection.size() - 1)
|
||||
{
|
||||
uiItem = curve;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plot->updateAvailableDepthRange();
|
||||
plot->setVisibleDepthRangeFromContents();
|
||||
plotTrace->viewer()->replot();
|
||||
|
||||
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||
|
||||
if (uiItem)
|
||||
{
|
||||
RiuMainWindow::instance()->projectTreeView()->selectAsCurrentItem(uiItem);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -45,7 +45,7 @@ protected:
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
std::vector<RimWellLog*> selectedWellLogs();
|
||||
std::vector<RimWellLog*> selectedWellLogs();
|
||||
};
|
||||
|
||||
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
|
||||
RigWellLogFile* wellLogFile() { return m_wellLogFile.p(); }
|
||||
|
||||
const caf::PdmChildArrayField<RimWellLog*>* lasFileLogs() const { return &m_lasFileLogs; }
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimWellLog*> m_lasFileLogs;
|
||||
|
||||
|
@ -19,6 +19,21 @@
|
||||
|
||||
#include "RimWellLogFileCurve.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellLog.h"
|
||||
#include "RimWellLasFileInfo.h"
|
||||
#include "RimWellLogPlotTrace.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiuWellLogTracePlot.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
|
||||
#include "qwt_plot_curve.h"
|
||||
|
||||
|
||||
@ -30,6 +45,15 @@ CAF_PDM_SOURCE_INIT(RimWellLogFileCurve, "WellLogFileCurve");
|
||||
RimWellLogFileCurve::RimWellLogFileCurve()
|
||||
{
|
||||
CAF_PDM_InitObject("Well Log File Curve", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellPath, "CurveWellPath", "Well Path", "", "", "");
|
||||
m_wellPath.uiCapability()->setUiChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_wellLogChannnelName, "CurveWellLogChannel", "Well Log Channel", "", "", "");
|
||||
|
||||
m_userName.uiCapability()->setUiHidden(true);
|
||||
|
||||
m_wellPath = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -45,12 +69,143 @@ RimWellLogFileCurve::~RimWellLogFileCurve()
|
||||
void RimWellLogFileCurve::updatePlotData()
|
||||
{
|
||||
RimWellLogPlotCurve::updatePlotData();
|
||||
|
||||
if (m_showCurve)
|
||||
{
|
||||
if (m_wellPath)
|
||||
{
|
||||
RimWellLasFileInfo* logFileInfo = m_wellPath->m_lasFileInfo;
|
||||
if (logFileInfo)
|
||||
{
|
||||
RigWellLogFile* wellLogFile = logFileInfo->wellLogFile();
|
||||
m_plotCurve->setSamples(wellLogFile->values(m_wellLogChannnelName).data(), wellLogFile->depthValues().data(), (int) wellLogFile->depthValues().size());
|
||||
m_plotCurve->setTitle(m_wellLogChannnelName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotCurve->setSamples(NULL, NULL, 0);
|
||||
m_plotCurve->setTitle("None");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::setCurveData(const std::vector<double>& values, const std::vector<double>& depthValues)
|
||||
void RimWellLogFileCurve::setWellPath(RimWellPath* wellPath)
|
||||
{
|
||||
m_plotCurve->setSamples(values.data(), depthValues.data(), (int) depthValues.size());
|
||||
m_wellPath = wellPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::setWellLogChannelName(const QString& name)
|
||||
{
|
||||
m_wellLogChannnelName = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
RimWellLogPlotCurve::fieldChangedByUi(changedField, oldValue, newValue);
|
||||
|
||||
if (changedField == &m_wellPath)
|
||||
{
|
||||
this->updatePlotData();
|
||||
|
||||
RimWellLogPlot* wellLoglot;
|
||||
firstAnchestorOrThisOfType(wellLoglot);
|
||||
if (wellLoglot)
|
||||
{
|
||||
wellLoglot->updateAvailableDepthRange();
|
||||
wellLoglot->setVisibleDepthRangeFromContents();
|
||||
}
|
||||
}
|
||||
else if (changedField == &m_wellLogChannnelName)
|
||||
{
|
||||
this->updatePlotData();
|
||||
|
||||
RimWellLogPlot* wellLoglot;
|
||||
firstAnchestorOrThisOfType(wellLoglot);
|
||||
if (wellLoglot)
|
||||
{
|
||||
if (!wellLoglot->hasAvailableDepthRange())
|
||||
{
|
||||
wellLoglot->updateAvailableDepthRange();
|
||||
wellLoglot->setVisibleDepthRangeFromContents();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_plot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
uiOrdering.add(&m_wellPath);
|
||||
uiOrdering.add(&m_wellLogChannnelName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||
{
|
||||
uiTreeOrdering.setForgetRemainingFields(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimWellLogFileCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> optionList;
|
||||
|
||||
if (fieldNeedingOptions == &m_wellPath)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
if (proj->activeOilField()->wellPathCollection())
|
||||
{
|
||||
caf::PdmChildArrayField<RimWellPath*>& wellPaths = proj->activeOilField()->wellPathCollection()->wellPaths;
|
||||
|
||||
for (size_t i = 0; i < wellPaths.size(); i++)
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(wellPaths[i]->name(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(wellPaths[i]))));
|
||||
}
|
||||
|
||||
if (optionList.size() > 0)
|
||||
{
|
||||
optionList.push_front(caf::PdmOptionItemInfo("None", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(NULL))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fieldNeedingOptions == &m_wellLogChannnelName)
|
||||
{
|
||||
if (m_wellPath())
|
||||
{
|
||||
RimWellLasFileInfo* lasFileInfo = m_wellPath->m_lasFileInfo();
|
||||
if (lasFileInfo)
|
||||
{
|
||||
const caf::PdmChildArrayField<RimWellLog*>* fileLogs = lasFileInfo->lasFileLogs();
|
||||
|
||||
for (size_t i = 0; i < fileLogs->size(); i++)
|
||||
{
|
||||
QString wellLogChannelName = (*fileLogs)[i]->name();
|
||||
optionList.push_back(caf::PdmOptionItemInfo(wellLogChannelName, wellLogChannelName));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return optionList;
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,14 @@
|
||||
|
||||
#include "RimWellLogPlotCurve.h"
|
||||
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimWellPath;
|
||||
class RimWellLog;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -37,7 +43,18 @@ public:
|
||||
|
||||
virtual void updatePlotData();
|
||||
|
||||
void setCurveData(const std::vector<double>& values, const std::vector<double>& depthValues);
|
||||
void setWellPath(RimWellPath* wellPath);
|
||||
void setWellLogChannelName(const QString& name);
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "");
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly);
|
||||
|
||||
protected:
|
||||
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
||||
caf::PdmField<QString> m_wellLogChannnelName;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user