From bcab7f2248a677e3bc42e276f793c1fc82675e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Hagen?= Date: Thu, 3 Sep 2015 09:46:26 +0200 Subject: [PATCH] (#396) Adding a trace when creating a new well log plot Did some refactoring - moved creation code to command feature. --- .../Commands/RicNewWellLogPlotFeature.cpp | 12 +++++++++++- .../RimWellLogPlotCollection.cpp | 17 ----------------- .../ProjectDataModel/RimWellLogPlotCollection.h | 5 ----- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/ApplicationCode/Commands/RicNewWellLogPlotFeature.cpp b/ApplicationCode/Commands/RicNewWellLogPlotFeature.cpp index c7863d0d55..81e47f6472 100644 --- a/ApplicationCode/Commands/RicNewWellLogPlotFeature.cpp +++ b/ApplicationCode/Commands/RicNewWellLogPlotFeature.cpp @@ -22,8 +22,11 @@ #include "RimProject.h" #include "RimMainPlotCollection.h" #include "RimWellLogPlotCollection.h" +#include "RimWellLogPlot.h" +#include "RimWellLogPlotTrace.h" #include "RiaApplication.h" +#include "RiuMainWindow.h" #include @@ -46,7 +49,14 @@ void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked) RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection(); 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); } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCollection.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlotCollection.cpp index c5e01642e8..b992858268 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotCollection.cpp @@ -20,11 +20,6 @@ #include "RimWellLogPlotCollection.h" #include "RimWellLogPlot.h" -#include "RimProject.h" - -#include "RiuMainWindow.h" - -#include "RiaApplication.h" #include "cafPdmUiTreeView.h" @@ -48,15 +43,3 @@ RimWellLogPlotCollection::~RimWellLogPlotCollection() { wellLogPlots.deleteAllChildObjects(); } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimWellLogPlotCollection::addWellLogPlot() -{ - RimWellLogPlot* plot = new RimWellLogPlot(); - wellLogPlots.push_back(plot); - - RiaApplication::instance()->project()->updateConnectedEditors(); - RiuMainWindow::instance()->setCurrentObjectInTreeView(plot); -} diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCollection.h b/ApplicationCode/ProjectDataModel/RimWellLogPlotCollection.h index bb1db4240e..2c605712fe 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotCollection.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotCollection.h @@ -38,9 +38,4 @@ public: virtual ~RimWellLogPlotCollection(); caf::PdmChildArrayField wellLogPlots; - - void addWellLogPlot(); - -private: - caf::PdmField show; };