mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 16:32:12 -05:00
Cleaned away dummy data and moved curve creation logic to the command feature
This commit is contained in:
1 parent
3a7959ff13
commit
57d195d9d8
5 files changed
+16
-28
No files matched your search
@@ -26,6 +26,8 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
#include "RimWellLogPlotCurve.h"
|
||||||
|
|
||||||
CAF_CMD_SOURCE_INIT(RicNewWellLogPlotCurveFeature, "RicNewWellLogPlotCurveFeature");
|
CAF_CMD_SOURCE_INIT(RicNewWellLogPlotCurveFeature, "RicNewWellLogPlotCurveFeature");
|
||||||
|
|
||||||
@@ -45,17 +47,13 @@ void RicNewWellLogPlotCurveFeature::onActionTriggered(bool isChecked)
|
|||||||
RimWellLogPlotTrace* wellLogPlotTrace = selectedWellLogPlotTrace();
|
RimWellLogPlotTrace* wellLogPlotTrace = selectedWellLogPlotTrace();
|
||||||
if (wellLogPlotTrace)
|
if (wellLogPlotTrace)
|
||||||
{
|
{
|
||||||
// TODO: replace dummy values with values extracted from model or read from well log files
|
RimWellLogPlotCurve* curve = new RimWellLogPlotCurve();
|
||||||
std::vector<double> depthValues, values;
|
wellLogPlotTrace->addCurve(curve);
|
||||||
depthValues.push_back(0);
|
|
||||||
depthValues.push_back(250);
|
|
||||||
depthValues.push_back(1000);
|
|
||||||
|
|
||||||
values.push_back(wellLogPlotTrace->curves.size() + 1);
|
curve->setUiName(QString("Curve %1").arg(wellLogPlotTrace->curves.size()));
|
||||||
values.push_back(wellLogPlotTrace->curves.size() + 0.5);
|
|
||||||
values.push_back(wellLogPlotTrace->curves.size() + 1);
|
|
||||||
|
|
||||||
wellLogPlotTrace->addCurve(depthValues, values);
|
wellLogPlotTrace->updateConnectedEditors();
|
||||||
|
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
|||||||
|
|
||||||
m_plot->replot();
|
m_plot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -82,15 +85,13 @@ caf::PdmFieldHandle* RimWellLogPlotCurve::objectToggleField()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogPlotCurve::plot(const std::vector<double>& depthValues, const std::vector<double>& values)
|
void RimWellLogPlotCurve::updatePlot()
|
||||||
{
|
{
|
||||||
CVF_ASSERT(m_plot);
|
CVF_ASSERT(m_plot);
|
||||||
|
|
||||||
m_depthValues = depthValues;
|
|
||||||
m_values = values;
|
|
||||||
|
|
||||||
m_plotCurve->setTitle(this->uiName());
|
m_plotCurve->setTitle(this->uiName());
|
||||||
m_plotCurve->setSamples(values.data(), depthValues.data(), (int) depthValues.size());
|
//m_plotCurve->setSamples(values.data(), depthValues.data(), (int) depthValues.size());
|
||||||
m_plotCurve->attach(m_plot);
|
m_plotCurve->attach(m_plot);
|
||||||
m_plot->replot();
|
m_plot->replot();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
virtual ~RimWellLogPlotCurve();
|
virtual ~RimWellLogPlotCurve();
|
||||||
|
|
||||||
void setPlot(RiuWellLogTracePlot* plot);
|
void setPlot(RiuWellLogTracePlot* plot);
|
||||||
void plot(const std::vector<double>& m_depthValues, const std::vector<double>& m_values);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -50,13 +50,10 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
virtual caf::PdmFieldHandle* objectToggleField();
|
virtual caf::PdmFieldHandle* objectToggleField();
|
||||||
|
void updatePlot();
|
||||||
private:
|
private:
|
||||||
caf::PdmField<bool> show;
|
caf::PdmField<bool> show;
|
||||||
|
|
||||||
RiuWellLogTracePlot* m_plot;
|
RiuWellLogTracePlot* m_plot;
|
||||||
QwtPlotCurve* m_plotCurve;
|
QwtPlotCurve* m_plotCurve;
|
||||||
|
|
||||||
std::vector<double> m_depthValues;
|
|
||||||
std::vector<double> m_values;
|
|
||||||
};
|
};
|
||||||
@@ -77,19 +77,11 @@ caf::PdmFieldHandle* RimWellLogPlotTrace::objectToggleField()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimWellLogPlotTrace::addCurve(const std::vector<double>& depthValues, const std::vector<double>& values)
|
void RimWellLogPlotTrace::addCurve(RimWellLogPlotCurve* curve)
|
||||||
{
|
{
|
||||||
CVF_ASSERT(m_viewer);
|
CVF_ASSERT(m_viewer);
|
||||||
|
|
||||||
RimWellLogPlotCurve* curve = new RimWellLogPlotCurve();
|
|
||||||
curves.push_back(curve);
|
curves.push_back(curve);
|
||||||
|
|
||||||
curve->setPlot(m_viewer);
|
curve->setPlot(m_viewer);
|
||||||
curve->setUiName(QString("Curve %1").arg(curves.size()));
|
|
||||||
curve->plot(depthValues, values);
|
|
||||||
|
|
||||||
updateConnectedEditors();
|
|
||||||
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
virtual ~RimWellLogPlotTrace();
|
virtual ~RimWellLogPlotTrace();
|
||||||
|
|
||||||
void setViewer(RiuWellLogTracePlot* viewer);
|
void setViewer(RiuWellLogTracePlot* viewer);
|
||||||
void addCurve(const std::vector<double>& depthValues, const std::vector<double>& values);
|
void addCurve(RimWellLogPlotCurve* curve);
|
||||||
|
|
||||||
RiuWellLogTracePlot* viewer();
|
RiuWellLogTracePlot* viewer();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user