(#396) Adding a trace when creating a new well log plot

Did some refactoring - moved creation code to command feature.
This commit is contained in:
Pål Hagen 2015-09-03 09:46:26 +02:00
parent 2288130f6a
commit bcab7f2248
3 changed files with 11 additions and 23 deletions

View File

@ -22,8 +22,11 @@
#include "RimProject.h" #include "RimProject.h"
#include "RimMainPlotCollection.h" #include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h" #include "RimWellLogPlotCollection.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrace.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RiuMainWindow.h"
#include <QAction> #include <QAction>
@ -46,7 +49,14 @@ void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection(); RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
if (wellLogPlotColl) if (wellLogPlotColl)
{ {
wellLogPlotColl->addWellLogPlot(); RimWellLogPlot* plot = new RimWellLogPlot();
RimWellLogPlotTrace* plotrace = new RimWellLogPlotTrace();
plot->addTrace(plotrace);
wellLogPlotColl->wellLogPlots().push_back(plot);
RiaApplication::instance()->project()->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(plot);
} }
} }

View File

@ -20,11 +20,6 @@
#include "RimWellLogPlotCollection.h" #include "RimWellLogPlotCollection.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimProject.h"
#include "RiuMainWindow.h"
#include "RiaApplication.h"
#include "cafPdmUiTreeView.h" #include "cafPdmUiTreeView.h"
@ -48,15 +43,3 @@ RimWellLogPlotCollection::~RimWellLogPlotCollection()
{ {
wellLogPlots.deleteAllChildObjects(); wellLogPlots.deleteAllChildObjects();
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::addWellLogPlot()
{
RimWellLogPlot* plot = new RimWellLogPlot();
wellLogPlots.push_back(plot);
RiaApplication::instance()->project()->updateConnectedEditors();
RiuMainWindow::instance()->setCurrentObjectInTreeView(plot);
}

View File

@ -38,9 +38,4 @@ public:
virtual ~RimWellLogPlotCollection(); virtual ~RimWellLogPlotCollection();
caf::PdmChildArrayField<RimWellLogPlot*> wellLogPlots; caf::PdmChildArrayField<RimWellLogPlot*> wellLogPlots;
void addWellLogPlot();
private:
caf::PdmField<bool> show;
}; };