Cleaned away dummy data and moved curve creation logic to the command feature

This commit is contained in:
Jacob Støren
2015-09-01 09:06:02 +02:00
parent 3a7959ff13
commit 57d195d9d8
5 changed files with 16 additions and 28 deletions

View File

@@ -69,6 +69,9 @@ void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
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);
m_depthValues = depthValues;
m_values = values;
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_plot->replot();
}

View File

@@ -41,7 +41,7 @@ public:
virtual ~RimWellLogPlotCurve();
void setPlot(RiuWellLogTracePlot* plot);
void plot(const std::vector<double>& m_depthValues, const std::vector<double>& m_values);
protected:
@@ -50,13 +50,10 @@ protected:
private:
virtual caf::PdmFieldHandle* objectToggleField();
void updatePlot();
private:
caf::PdmField<bool> show;
RiuWellLogTracePlot* m_plot;
QwtPlotCurve* m_plotCurve;
std::vector<double> m_depthValues;
std::vector<double> m_values;
};

View File

@@ -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);
RimWellLogPlotCurve* curve = new RimWellLogPlotCurve();
curves.push_back(curve);
curve->setPlot(m_viewer);
curve->setUiName(QString("Curve %1").arg(curves.size()));
curve->plot(depthValues, values);
updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
}

View File

@@ -42,7 +42,7 @@ public:
virtual ~RimWellLogPlotTrace();
void setViewer(RiuWellLogTracePlot* viewer);
void addCurve(const std::vector<double>& depthValues, const std::vector<double>& values);
void addCurve(RimWellLogPlotCurve* curve);
RiuWellLogTracePlot* viewer();