(#429) Adding a curve when creating a new well log plot or plot trace

This commit is contained in:
Pål Hagen 2015-09-08 09:17:40 +02:00
parent c1d2a32f6e
commit 1d1d148cc9
4 changed files with 43 additions and 23 deletions

View File

@ -79,19 +79,7 @@ void RicNewWellLogPlotCurveFeature::onActionTriggered(bool isChecked)
RimWellLogPlotTrace* wellLogPlotTrace = selectedWellLogPlotTrace();
if (wellLogPlotTrace)
{
size_t curveIndex = wellLogPlotTrace->curveCount();
RimWellLogPlotCurve* curve = new RimWellLogExtractionCurve();
wellLogPlotTrace->addCurve(curve);
QColor curveColorQt = sg_curveColorFromIndex(curveIndex);
cvf::Color3f curveColor(curveColorQt.redF(), curveColorQt.greenF(), curveColorQt.blueF());
curve->setColor(curveColor);
curve->setDescription(QString("Curve %1").arg(wellLogPlotTrace->curveCount()));
wellLogPlotTrace->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
addCurve(wellLogPlotTrace);
}
}
@ -112,3 +100,25 @@ RimWellLogPlotTrace* RicNewWellLogPlotCurveFeature::selectedWellLogPlotTrace()
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotCurveFeature::addCurve(RimWellLogPlotTrace* plotTrace)
{
CVF_ASSERT(plotTrace);
size_t curveIndex = plotTrace->curveCount();
RimWellLogPlotCurve* curve = new RimWellLogExtractionCurve();
plotTrace->addCurve(curve);
QColor curveColorQt = sg_curveColorFromIndex(curveIndex);
cvf::Color3f curveColor(curveColorQt.redF(), curveColorQt.greenF(), curveColorQt.blueF());
curve->setColor(curveColor);
curve->setDescription(QString("Curve %1").arg(plotTrace->curveCount()));
plotTrace->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(curve);
}

View File

@ -30,6 +30,10 @@ class RicNewWellLogPlotCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
static void addCurve(RimWellLogPlotTrace* plotTrace);
protected:
// Overrides
virtual bool isCommandEnabled();

View File

@ -24,6 +24,8 @@
#include "RimWellLogPlotCollection.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrace.h"
#include "RimWellLogPlotCurve.h"
#include "RicNewWellLogPlotCurveFeature.h"
#include "RiaApplication.h"
#include "RiuMainWindow.h"
@ -54,14 +56,15 @@ void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
RimWellLogPlot* plot = new RimWellLogPlot();
wellLogPlotColl->wellLogPlots().push_back(plot);
RimWellLogPlotTrace* plotrace = new RimWellLogPlotTrace();
plot->addTrace(plotrace);
RimWellLogPlotTrace* plotTrace = new RimWellLogPlotTrace();
plot->addTrace(plotTrace);
plot->setDescription(QString("Well Log Plot %1").arg(wellLogPlotCollection()->wellLogPlots.size()));
plot->loadDataAndUpdate();
RiaApplication::instance()->project()->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(plot);
RicNewWellLogPlotCurveFeature::addCurve(plotTrace);
}
//--------------------------------------------------------------------------------------------------

View File

@ -20,12 +20,15 @@
#include "RicNewWellLogPlotTraceFeature.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrace.h"
#include "RiuMainWindow.h"
#include "RicNewWellLogPlotCurveFeature.h"
#include "cafSelectionManager.h"
#include <QAction>
#include "RimWellLogPlotTrace.h"
#include "RiuMainWindow.h"
CAF_CMD_SOURCE_INIT(RicNewWellLogPlotTraceFeature, "RicNewWellLogPlotTraceFeature");
@ -46,12 +49,12 @@ void RicNewWellLogPlotTraceFeature::onActionTriggered(bool isChecked)
RimWellLogPlot* wellLogPlot = selectedWellLogPlot();
if (wellLogPlot)
{
RimWellLogPlotTrace* trace = new RimWellLogPlotTrace;
wellLogPlot->addTrace(trace);
trace->setUiName(QString("Trace %1").arg(wellLogPlot->traceCount()));
RimWellLogPlotTrace* plotTrace = new RimWellLogPlotTrace;
wellLogPlot->addTrace(plotTrace);
plotTrace->setUiName(QString("Trace %1").arg(wellLogPlot->traceCount()));
wellLogPlot->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(trace);
RicNewWellLogPlotCurveFeature::addCurve(plotTrace);
}
}