Added collection class for well log plots

This commit is contained in:
Pål Hagen
2015-08-28 10:42:57 +02:00
parent 75a34e605f
commit af9bbfdede
9 changed files with 163 additions and 42 deletions

View File

@@ -19,9 +19,11 @@
#include "RicNewWellLogPlotFeature.h"
#include "RimProject.h"
#include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h"
#include "cafSelectionManager.h"
#include "RiaApplication.h"
#include <QAction>
@@ -33,7 +35,7 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogPlotFeature, "RicNewWellLogPlotFeature");
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogPlotFeature::isCommandEnabled()
{
return selectedMainPlotCollection() != NULL;
return wellLogPlotCollection() != NULL;
}
//--------------------------------------------------------------------------------------------------
@@ -41,10 +43,10 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
{
RimMainPlotCollection* mainPlotCollection = selectedMainPlotCollection();
if (mainPlotCollection)
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
if (wellLogPlotColl)
{
mainPlotCollection->addWellLogPlot();
wellLogPlotColl->addWellLogPlot();
}
}
@@ -59,9 +61,10 @@ void RicNewWellLogPlotFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMainPlotCollection* RicNewWellLogPlotFeature::selectedMainPlotCollection()
RimWellLogPlotCollection* RicNewWellLogPlotFeature::wellLogPlotCollection()
{
std::vector<RimMainPlotCollection*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
RimProject* project = RiaApplication::instance()->project();
RimMainPlotCollection* mainPlotCollection = project ? project->mainPlotCollection() : NULL;
return mainPlotCollection ? mainPlotCollection->wellLogPlotCollection() : NULL;
}

View File

@@ -21,7 +21,7 @@
#include "cafCmdFeature.h"
class RimMainPlotCollection;
class RimWellLogPlotCollection;
//==================================================================================================
///
@@ -37,6 +37,5 @@ protected:
virtual void setupActionLook( QAction* actionToSetup );
private:
RimMainPlotCollection* selectedMainPlotCollection();
RimWellLogPlotCollection* wellLogPlotCollection();
};