mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#396) Save/Restore of WellLog plots partly in place.
Cleaned up ownership in WellLog plot classes initAfterRead() is implemented moved code related to command features from the WellLog classes Still plots are not redrawn/reloaded when opening a project file.
This commit is contained in:
parent
30e2495849
commit
2a8533bad0
@ -50,7 +50,7 @@ void RicNewWellLogPlotCurveFeature::onActionTriggered(bool isChecked)
|
|||||||
RimWellLogPlotCurve* curve = new RimWellLogExtractionCurve();
|
RimWellLogPlotCurve* curve = new RimWellLogExtractionCurve();
|
||||||
wellLogPlotTrace->addCurve(curve);
|
wellLogPlotTrace->addCurve(curve);
|
||||||
|
|
||||||
curve->setUiName(QString("Curve %1").arg(wellLogPlotTrace->curves.size()));
|
curve->setDescription(QString("Curve %1").arg(wellLogPlotTrace->curveCount()));
|
||||||
|
|
||||||
wellLogPlotTrace->updateConnectedEditors();
|
wellLogPlotTrace->updateConnectedEditors();
|
||||||
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
|
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include "RimWellLogPlotTrace.h"
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicNewWellLogPlotTraceFeature, "RicNewWellLogPlotTraceFeature");
|
CAF_CMD_SOURCE_INIT(RicNewWellLogPlotTraceFeature, "RicNewWellLogPlotTraceFeature");
|
||||||
@ -44,7 +46,12 @@ void RicNewWellLogPlotTraceFeature::onActionTriggered(bool isChecked)
|
|||||||
RimWellLogPlot* wellLogPlot = selectedWellLogPlot();
|
RimWellLogPlot* wellLogPlot = selectedWellLogPlot();
|
||||||
if (wellLogPlot)
|
if (wellLogPlot)
|
||||||
{
|
{
|
||||||
wellLogPlot->addTrace();
|
RimWellLogPlotTrace* trace = new RimWellLogPlotTrace;
|
||||||
|
wellLogPlot->addTrace(trace);
|
||||||
|
trace->setUiName(QString("Trace %1").arg(wellLogPlot->traceCount()));
|
||||||
|
|
||||||
|
wellLogPlot->updateConnectedEditors();
|
||||||
|
RiuMainWindow::instance()->setCurrentObjectInTreeView(trace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,18 +139,10 @@ caf::PdmFieldHandle* RimWellLogPlot::objectToggleField()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogPlot::addTrace()
|
void RimWellLogPlot::addTrace(RimWellLogPlotTrace* trace)
|
||||||
{
|
{
|
||||||
RimWellLogPlotTrace* trace = new RimWellLogPlotTrace();
|
|
||||||
traces.push_back(trace);
|
traces.push_back(trace);
|
||||||
|
m_viewer->insertTracePlot(trace->viewer());
|
||||||
trace->setUiName(QString("Trace %1").arg(traces.size()));
|
|
||||||
|
|
||||||
RiuWellLogTracePlot* viewer = m_viewer->createTracePlot();
|
|
||||||
trace->setViewer(viewer);
|
|
||||||
|
|
||||||
updateConnectedEditors();
|
|
||||||
RiuMainWindow::instance()->setCurrentObjectInTreeView(trace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -259,7 +251,10 @@ void RimWellLogPlot::visibleDepthRange(double* minimumDepth, double* maximumDept
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogPlot::initAfterRead()
|
void RimWellLogPlot::initAfterRead()
|
||||||
{
|
{
|
||||||
|
for (size_t tIdx = 0; tIdx < traces.size(); ++tIdx)
|
||||||
|
{
|
||||||
|
m_viewer->insertTracePlot(traces[tIdx]->viewer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -40,11 +40,8 @@ public:
|
|||||||
RimWellLogPlot();
|
RimWellLogPlot();
|
||||||
virtual ~RimWellLogPlot();
|
virtual ~RimWellLogPlot();
|
||||||
|
|
||||||
caf::PdmChildArrayField<RimWellLogPlotTrace*> traces;
|
void addTrace(RimWellLogPlotTrace* trace);
|
||||||
caf::PdmField<bool> showWindow;
|
size_t traceCount() { return traces.size();}
|
||||||
caf::PdmField< std::vector<int> > windowGeometry;
|
|
||||||
|
|
||||||
void addTrace();
|
|
||||||
|
|
||||||
RiuWellLogPlot* viewer();
|
RiuWellLogPlot* viewer();
|
||||||
|
|
||||||
@ -74,6 +71,11 @@ private:
|
|||||||
private:
|
private:
|
||||||
QPointer<RiuWellLogPlot> m_viewer;
|
QPointer<RiuWellLogPlot> m_viewer;
|
||||||
|
|
||||||
|
caf::PdmField<bool> showWindow;
|
||||||
|
caf::PdmField< std::vector<int> > windowGeometry;
|
||||||
|
|
||||||
|
caf::PdmChildArrayField<RimWellLogPlotTrace*> traces;
|
||||||
|
|
||||||
caf::PdmField<double> m_minimumVisibleDepth;
|
caf::PdmField<double> m_minimumVisibleDepth;
|
||||||
caf::PdmField<double> m_maximumVisibleDepth;
|
caf::PdmField<double> m_maximumVisibleDepth;
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ class RimWellLogPlotCurve : public caf::PdmObject
|
|||||||
public:
|
public:
|
||||||
RimWellLogPlotCurve();
|
RimWellLogPlotCurve();
|
||||||
virtual ~RimWellLogPlotCurve();
|
virtual ~RimWellLogPlotCurve();
|
||||||
|
void setDescription(QString description) {m_userName = description;}
|
||||||
|
|
||||||
void setPlot(RiuWellLogTracePlot* plot);
|
void setPlot(RiuWellLogTracePlot* plot);
|
||||||
bool depthRange(double* minimumDepth, double* maximumDepth);
|
bool depthRange(double* minimumDepth, double* maximumDepth);
|
||||||
|
@ -46,7 +46,7 @@ RimWellLogPlotTrace::RimWellLogPlotTrace()
|
|||||||
CAF_PDM_InitFieldNoDefault(&curves, "Curves", "", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&curves, "Curves", "", "", "", "");
|
||||||
curves.uiCapability()->setUiHidden(true);
|
curves.uiCapability()->setUiHidden(true);
|
||||||
|
|
||||||
m_viewer = NULL;
|
m_viewer = new RiuWellLogTracePlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -64,7 +64,7 @@ void RimWellLogPlotTrace::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
|||||||
{
|
{
|
||||||
if (changedField == &show)
|
if (changedField == &show)
|
||||||
{
|
{
|
||||||
m_viewer->setVisible(newValue == true);
|
m_viewer->setVisible(show());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,20 +87,6 @@ void RimWellLogPlotTrace::addCurve(RimWellLogPlotCurve* curve)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
///
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
|
||||||
void RimWellLogPlotTrace::setViewer(RiuWellLogTracePlot* viewer)
|
|
||||||
{
|
|
||||||
if (m_viewer)
|
|
||||||
{
|
|
||||||
delete m_viewer;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_viewer = viewer;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -154,3 +140,14 @@ bool RimWellLogPlotTrace::availableDepthRange(double* minimumDepth, double* maxi
|
|||||||
|
|
||||||
return rangeUpdated;
|
return rangeUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimWellLogPlotTrace::initAfterRead()
|
||||||
|
{
|
||||||
|
for(size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
|
||||||
|
{
|
||||||
|
curves[cIdx]->setPlot(this->m_viewer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -41,23 +41,23 @@ public:
|
|||||||
RimWellLogPlotTrace();
|
RimWellLogPlotTrace();
|
||||||
virtual ~RimWellLogPlotTrace();
|
virtual ~RimWellLogPlotTrace();
|
||||||
|
|
||||||
void setViewer(RiuWellLogTracePlot* viewer);
|
|
||||||
void addCurve(RimWellLogPlotCurve* curve);
|
void addCurve(RimWellLogPlotCurve* curve);
|
||||||
|
size_t curveCount() { return curves.size(); }
|
||||||
|
|
||||||
bool availableDepthRange(double* minimumDepth, double* maximumDepth);
|
bool availableDepthRange(double* minimumDepth, double* maximumDepth);
|
||||||
|
|
||||||
RiuWellLogTracePlot* viewer();
|
RiuWellLogTracePlot* viewer();
|
||||||
|
|
||||||
caf::PdmChildArrayField<RimWellLogPlotCurve*> curves;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Overridden PDM methods
|
// Overridden PDM methods
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||||
|
virtual void initAfterRead();
|
||||||
private:
|
|
||||||
virtual caf::PdmFieldHandle* objectToggleField();
|
virtual caf::PdmFieldHandle* objectToggleField();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> show;
|
caf::PdmField<bool> show;
|
||||||
|
caf::PdmChildArrayField<RimWellLogPlotCurve*> curves;
|
||||||
|
|
||||||
QPointer<RiuWellLogTracePlot> m_viewer;
|
QPointer<RiuWellLogTracePlot> m_viewer;
|
||||||
};
|
};
|
||||||
|
@ -66,15 +66,13 @@ RiuWellLogPlot::~RiuWellLogPlot()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuWellLogTracePlot* RiuWellLogPlot::createTracePlot()
|
void RiuWellLogPlot::insertTracePlot(RiuWellLogTracePlot* tracePlot)
|
||||||
{
|
{
|
||||||
RiuWellLogTracePlot* tracePlot = new RiuWellLogTracePlot(this);
|
|
||||||
|
|
||||||
// Insert the plot to the left of the scroll bar
|
// Insert the plot to the left of the scroll bar
|
||||||
m_layout->insertWidget(m_layout->count() - 1, tracePlot);
|
m_layout->insertWidget(m_layout->count() - 1, tracePlot);
|
||||||
m_tracePlots.append(tracePlot);
|
m_tracePlots.append(tracePlot);
|
||||||
|
|
||||||
return tracePlot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent = NULL);
|
RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent = NULL);
|
||||||
virtual ~RiuWellLogPlot();
|
virtual ~RiuWellLogPlot();
|
||||||
|
|
||||||
RiuWellLogTracePlot* createTracePlot();
|
void insertTracePlot(RiuWellLogTracePlot* tracePlot);
|
||||||
|
|
||||||
void setDepthRange(double minDepth, double maxDepth);
|
void setDepthRange(double minDepth, double maxDepth);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user