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:
@@ -139,18 +139,10 @@ caf::PdmFieldHandle* RimWellLogPlot::objectToggleField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::addTrace()
|
||||
void RimWellLogPlot::addTrace(RimWellLogPlotTrace* trace)
|
||||
{
|
||||
RimWellLogPlotTrace* trace = new RimWellLogPlotTrace();
|
||||
traces.push_back(trace);
|
||||
|
||||
trace->setUiName(QString("Trace %1").arg(traces.size()));
|
||||
|
||||
RiuWellLogTracePlot* viewer = m_viewer->createTracePlot();
|
||||
trace->setViewer(viewer);
|
||||
|
||||
updateConnectedEditors();
|
||||
RiuMainWindow::instance()->setCurrentObjectInTreeView(trace);
|
||||
m_viewer->insertTracePlot(trace->viewer());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -259,7 +251,10 @@ void RimWellLogPlot::visibleDepthRange(double* minimumDepth, double* maximumDept
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlot::initAfterRead()
|
||||
{
|
||||
|
||||
for (size_t tIdx = 0; tIdx < traces.size(); ++tIdx)
|
||||
{
|
||||
m_viewer->insertTracePlot(traces[tIdx]->viewer());
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -40,11 +40,8 @@ public:
|
||||
RimWellLogPlot();
|
||||
virtual ~RimWellLogPlot();
|
||||
|
||||
caf::PdmChildArrayField<RimWellLogPlotTrace*> traces;
|
||||
caf::PdmField<bool> showWindow;
|
||||
caf::PdmField< std::vector<int> > windowGeometry;
|
||||
|
||||
void addTrace();
|
||||
void addTrace(RimWellLogPlotTrace* trace);
|
||||
size_t traceCount() { return traces.size();}
|
||||
|
||||
RiuWellLogPlot* viewer();
|
||||
|
||||
@@ -74,6 +71,11 @@ private:
|
||||
private:
|
||||
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_maximumVisibleDepth;
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ class RimWellLogPlotCurve : public caf::PdmObject
|
||||
public:
|
||||
RimWellLogPlotCurve();
|
||||
virtual ~RimWellLogPlotCurve();
|
||||
void setDescription(QString description) {m_userName = description;}
|
||||
|
||||
void setPlot(RiuWellLogTracePlot* plot);
|
||||
bool depthRange(double* minimumDepth, double* maximumDepth);
|
||||
|
||||
@@ -46,7 +46,7 @@ RimWellLogPlotTrace::RimWellLogPlotTrace()
|
||||
CAF_PDM_InitFieldNoDefault(&curves, "Curves", "", "", "", "");
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotTrace::initAfterRead()
|
||||
{
|
||||
for(size_t cIdx = 0; cIdx < curves.size(); ++cIdx)
|
||||
{
|
||||
curves[cIdx]->setPlot(this->m_viewer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,23 +41,23 @@ public:
|
||||
RimWellLogPlotTrace();
|
||||
virtual ~RimWellLogPlotTrace();
|
||||
|
||||
void setViewer(RiuWellLogTracePlot* viewer);
|
||||
void addCurve(RimWellLogPlotCurve* curve);
|
||||
size_t curveCount() { return curves.size(); }
|
||||
|
||||
bool availableDepthRange(double* minimumDepth, double* maximumDepth);
|
||||
|
||||
RiuWellLogTracePlot* viewer();
|
||||
|
||||
caf::PdmChildArrayField<RimWellLogPlotCurve*> curves;
|
||||
|
||||
protected:
|
||||
|
||||
// Overridden PDM methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
||||
private:
|
||||
virtual void initAfterRead();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> show;
|
||||
caf::PdmChildArrayField<RimWellLogPlotCurve*> curves;
|
||||
|
||||
QPointer<RiuWellLogTracePlot> m_viewer;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user