mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#436) Moved well log plot creation code to common base class
This commit is contained in:
parent
e81a1c69c0
commit
3da11d2f6d
@ -48,7 +48,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotCurveFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicAddWellLogToPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellLogPlotCurveFeatureImpl.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeatureImpl.h
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
|
||||
@ -109,6 +109,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotCurveFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicAddWellLogToPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellLogPlotCurveFeatureImpl.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeatureImpl.cpp
|
||||
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp
|
||||
|
@ -108,53 +108,4 @@ std::vector<RimWellLog*> RicAddWellLogToPlotFeature::selectedWellLogs()
|
||||
return selection;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMainPlotCollection* RicAddWellLogToPlotFeature::mainPlotCollection()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
|
||||
if (!mainPlotColl)
|
||||
{
|
||||
project->recreateMainPlotCollection();
|
||||
}
|
||||
|
||||
return project->mainPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlotCollection* RicAddWellLogToPlotFeature::wellLogPlotCollection()
|
||||
{
|
||||
RimMainPlotCollection* mainPlotColl = mainPlotCollection();
|
||||
CVF_ASSERT(mainPlotColl);
|
||||
|
||||
RimWellLogPlotCollection* wellLogPlotColl = mainPlotColl->wellLogPlotCollection();
|
||||
if (!wellLogPlotColl)
|
||||
{
|
||||
mainPlotColl->recreateWellLogPlotCollection();
|
||||
}
|
||||
|
||||
return mainPlotColl->wellLogPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot* RicAddWellLogToPlotFeature::createWellLogPlot()
|
||||
{
|
||||
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
|
||||
CVF_ASSERT(wellLogPlotColl);
|
||||
|
||||
RimWellLogPlot* plot = new RimWellLogPlot();
|
||||
wellLogPlotColl->wellLogPlots().push_back(plot);
|
||||
|
||||
return plot;
|
||||
}
|
||||
|
||||
} // end namespace caf
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
#include "RicWellLogPlotCurveFeatureImpl.h"
|
||||
#include "RicNewWellLogPlotFeatureImpl.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -35,7 +36,7 @@ namespace caf
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicAddWellLogToPlotFeature : public CmdFeature, RicWellLogPlotCurveFeatureImpl
|
||||
class RicAddWellLogToPlotFeature : public CmdFeature, RicWellLogPlotCurveFeatureImpl, RicNewWellLogPlotFeatureImpl
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
protected:
|
||||
@ -47,9 +48,6 @@ protected:
|
||||
|
||||
private:
|
||||
std::vector<RimWellLog*> selectedWellLogs();
|
||||
RimMainPlotCollection* mainPlotCollection();
|
||||
RimWellLogPlotCollection* wellLogPlotCollection();
|
||||
RimWellLogPlot* createWellLogPlot();
|
||||
};
|
||||
|
||||
|
||||
|
@ -20,15 +20,10 @@
|
||||
#include "RicNewWellLogPlotFeature.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogPlotTrace.h"
|
||||
#include "RimWellLogPlotCurve.h"
|
||||
#include "RicNewWellLogPlotCurveFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -50,18 +45,12 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
|
||||
CVF_ASSERT(wellLogPlotColl);
|
||||
|
||||
RimWellLogPlot* plot = new RimWellLogPlot();
|
||||
wellLogPlotColl->wellLogPlots().push_back(plot);
|
||||
RimWellLogPlot* plot = createWellLogPlot();
|
||||
|
||||
RimWellLogPlotTrace* plotTrace = new RimWellLogPlotTrace();
|
||||
plot->addTrace(plotTrace);
|
||||
|
||||
plot->setDescription(QString("Well Log Plot %1").arg(wellLogPlotCollection()->wellLogPlots.size()));
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
plot->updateConnectedEditors();
|
||||
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||
|
||||
@ -75,37 +64,3 @@ void RicNewWellLogPlotFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("New Well Log Plot");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMainPlotCollection* RicNewWellLogPlotFeature::mainPlotCollection()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
|
||||
if (!mainPlotColl)
|
||||
{
|
||||
project->recreateMainPlotCollection();
|
||||
}
|
||||
|
||||
return project->mainPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlotCollection* RicNewWellLogPlotFeature::wellLogPlotCollection()
|
||||
{
|
||||
RimMainPlotCollection* mainPlotColl = mainPlotCollection();
|
||||
CVF_ASSERT(mainPlotColl);
|
||||
|
||||
RimWellLogPlotCollection* wellLogPlotColl = mainPlotColl->wellLogPlotCollection();
|
||||
if (!wellLogPlotColl)
|
||||
{
|
||||
mainPlotColl->recreateWellLogPlotCollection();
|
||||
}
|
||||
|
||||
return mainPlotColl->wellLogPlotCollection();
|
||||
}
|
||||
|
@ -20,14 +20,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimMainPlotCollection;
|
||||
class RimWellLogPlotCollection;
|
||||
#include "RicNewWellLogPlotFeatureImpl.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewWellLogPlotFeature : public caf::CmdFeature
|
||||
class RicNewWellLogPlotFeature : public caf::CmdFeature, RicNewWellLogPlotFeatureImpl
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
@ -36,8 +34,4 @@ protected:
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
RimMainPlotCollection* mainPlotCollection();
|
||||
RimWellLogPlotCollection* wellLogPlotCollection();
|
||||
};
|
||||
|
80
ApplicationCode/Commands/RicNewWellLogPlotFeatureImpl.cpp
Normal file
80
ApplicationCode/Commands/RicNewWellLogPlotFeatureImpl.cpp
Normal file
@ -0,0 +1,80 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicNewWellLogPlotFeatureImpl.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMainPlotCollection* RicNewWellLogPlotFeatureImpl::mainPlotCollection()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
RimMainPlotCollection* mainPlotColl = project->mainPlotCollection();
|
||||
if (!mainPlotColl)
|
||||
{
|
||||
project->recreateMainPlotCollection();
|
||||
}
|
||||
|
||||
return project->mainPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlotCollection* RicNewWellLogPlotFeatureImpl::wellLogPlotCollection()
|
||||
{
|
||||
RimMainPlotCollection* mainPlotColl = mainPlotCollection();
|
||||
CVF_ASSERT(mainPlotColl);
|
||||
|
||||
RimWellLogPlotCollection* wellLogPlotColl = mainPlotColl->wellLogPlotCollection();
|
||||
if (!wellLogPlotColl)
|
||||
{
|
||||
mainPlotColl->recreateWellLogPlotCollection();
|
||||
}
|
||||
|
||||
return mainPlotColl->wellLogPlotCollection();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot()
|
||||
{
|
||||
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
|
||||
CVF_ASSERT(wellLogPlotColl);
|
||||
|
||||
RimWellLogPlot* plot = new RimWellLogPlot();
|
||||
wellLogPlotColl->wellLogPlots().push_back(plot);
|
||||
|
||||
plot->setDescription(QString("Well Log Plot %1").arg(wellLogPlotCollection()->wellLogPlots.size()));
|
||||
|
||||
return plot;
|
||||
}
|
36
ApplicationCode/Commands/RicNewWellLogPlotFeatureImpl.h
Normal file
36
ApplicationCode/Commands/RicNewWellLogPlotFeatureImpl.h
Normal file
@ -0,0 +1,36 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
class RimMainPlotCollection;
|
||||
class RimWellLogPlotCollection;
|
||||
class RimWellLogPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicNewWellLogPlotFeatureImpl
|
||||
{
|
||||
|
||||
protected:
|
||||
RimMainPlotCollection* mainPlotCollection();
|
||||
RimWellLogPlotCollection* wellLogPlotCollection();
|
||||
RimWellLogPlot* createWellLogPlot();
|
||||
};
|
Loading…
Reference in New Issue
Block a user