(#436) Using static methods in "feature impl" class, for clarity

This commit is contained in:
Pål Hagen 2015-09-15 18:21:38 +02:00
parent a79bce6ea4
commit 9a2ec02bcc
8 changed files with 19 additions and 16 deletions

View File

@ -19,6 +19,9 @@
#include "RicAddWellLogToPlotFeature.h" #include "RicAddWellLogToPlotFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RimWellLasFileInfo.h" #include "RimWellLasFileInfo.h"
#include "RimWellLog.h" #include "RimWellLog.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
@ -59,7 +62,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
std::vector<RimWellLog*> selection = selectedWellLogs(); std::vector<RimWellLog*> selection = selectedWellLogs();
if (selection.size() < 1) return; if (selection.size() < 1) return;
RimWellLogPlot* plot = createWellLogPlot(); RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot();
RimWellLogPlotTrace* plotTrace = new RimWellLogPlotTrace(); RimWellLogPlotTrace* plotTrace = new RimWellLogPlotTrace();
plot->addTrace(plotTrace); plot->addTrace(plotTrace);
@ -79,7 +82,7 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
RimWellLogFileCurve* curve = new RimWellLogFileCurve; RimWellLogFileCurve* curve = new RimWellLogFileCurve;
plotTrace->addCurve(curve); plotTrace->addCurve(curve);
cvf::Color3f curveColor = curveColorFromIndex(curveIdx); cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIdx);
curve->setColor(curveColor); curve->setColor(curveColor);
curve->setDescription(wellLog->name()); curve->setDescription(wellLog->name());

View File

@ -20,8 +20,6 @@
#pragma once #pragma once
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include <vector> #include <vector>
@ -36,7 +34,7 @@ namespace caf
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class RicAddWellLogToPlotFeature : public CmdFeature, RicWellLogPlotCurveFeatureImpl, RicNewWellLogPlotFeatureImpl class RicAddWellLogToPlotFeature : public CmdFeature
{ {
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;
protected: protected:

View File

@ -19,6 +19,8 @@
#include "RicNewWellLogPlotCurveFeature.h" #include "RicNewWellLogPlotCurveFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RimWellLogPlotTrace.h" #include "RimWellLogPlotTrace.h"
#include "RimWellLogExtractionCurve.h" #include "RimWellLogExtractionCurve.h"
@ -83,7 +85,7 @@ void RicNewWellLogPlotCurveFeature::addCurve(RimWellLogPlotTrace* plotTrace)
RimWellLogPlotCurve* curve = new RimWellLogExtractionCurve(); RimWellLogPlotCurve* curve = new RimWellLogExtractionCurve();
plotTrace->addCurve(curve); plotTrace->addCurve(curve);
cvf::Color3f curveColor = curveColorFromIndex(curveIndex); cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIndex);
curve->setColor(curveColor); curve->setColor(curveColor);
curve->setDescription(QString("Curve %1").arg(plotTrace->curveCount())); curve->setDescription(QString("Curve %1").arg(plotTrace->curveCount()));

View File

@ -20,14 +20,13 @@
#pragma once #pragma once
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
class RimWellLogPlotTrace; class RimWellLogPlotTrace;
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class RicNewWellLogPlotCurveFeature : public caf::CmdFeature, RicWellLogPlotCurveFeatureImpl class RicNewWellLogPlotCurveFeature : public caf::CmdFeature
{ {
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;

View File

@ -19,6 +19,8 @@
#include "RicNewWellLogPlotFeature.h" #include "RicNewWellLogPlotFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellLogPlotTrace.h" #include "RimWellLogPlotTrace.h"
@ -45,7 +47,7 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked) void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
{ {
RimWellLogPlot* plot = createWellLogPlot(); RimWellLogPlot* plot = RicNewWellLogPlotFeatureImpl::createWellLogPlot();
RimWellLogPlotTrace* plotTrace = new RimWellLogPlotTrace(); RimWellLogPlotTrace* plotTrace = new RimWellLogPlotTrace();
plot->addTrace(plotTrace); plot->addTrace(plotTrace);

View File

@ -20,12 +20,11 @@
#pragma once #pragma once
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
#include "RicNewWellLogPlotFeatureImpl.h"
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class RicNewWellLogPlotFeature : public caf::CmdFeature, RicNewWellLogPlotFeatureImpl class RicNewWellLogPlotFeature : public caf::CmdFeature
{ {
CAF_CMD_HEADER_INIT; CAF_CMD_HEADER_INIT;

View File

@ -28,9 +28,9 @@ class RimWellLogPlot;
//================================================================================================== //==================================================================================================
class RicNewWellLogPlotFeatureImpl class RicNewWellLogPlotFeatureImpl
{ {
public:
protected: static RimMainPlotCollection* mainPlotCollection();
RimMainPlotCollection* mainPlotCollection(); static RimWellLogPlotCollection* wellLogPlotCollection();
RimWellLogPlotCollection* wellLogPlotCollection(); static RimWellLogPlot* createWellLogPlot();
RimWellLogPlot* createWellLogPlot();
}; };

View File

@ -27,6 +27,6 @@
class RicWellLogPlotCurveFeatureImpl class RicWellLogPlotCurveFeatureImpl
{ {
protected: public:
static cvf::Color3f curveColorFromIndex(size_t curveIndex); static cvf::Color3f curveColorFromIndex(size_t curveIndex);
}; };