(#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(); RimWellLogPlotTrace* wellLogPlotTrace = selectedWellLogPlotTrace();
if (wellLogPlotTrace) if (wellLogPlotTrace)
{ {
size_t curveIndex = wellLogPlotTrace->curveCount(); addCurve(wellLogPlotTrace);
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);
} }
} }
@ -112,3 +100,25 @@ RimWellLogPlotTrace* RicNewWellLogPlotCurveFeature::selectedWellLogPlotTrace()
caf::SelectionManager::instance()->objectsByType(&selection); caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL; 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; CAF_CMD_HEADER_INIT;
public:
static void addCurve(RimWellLogPlotTrace* plotTrace);
protected: protected:
// Overrides // Overrides
virtual bool isCommandEnabled(); virtual bool isCommandEnabled();

View File

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

View File

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