Added command feature for addition of a new curve to a well log plot trace

This commit is contained in:
Pål Hagen
2015-08-28 11:45:18 +02:00
parent 0fdf5292d0
commit 7081e140fd
6 changed files with 133 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.h
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotCurveFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
@@ -96,6 +97,7 @@ ${CEE_CURRENT_LIST_DIR}RicNewStatisticsCaseFeature.cpp
${CEE_CURRENT_LIST_DIR}RicComputeStatisticsFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotTraceFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotCurveFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathsImportSsihubFeature.cpp
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.cpp

View File

@@ -0,0 +1,67 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicNewWellLogPlotCurveFeature.h"
#include "RimWellLogPlotTrace.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewWellLogPlotCurveFeature, "RicNewWellLogPlotCurveFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogPlotCurveFeature::isCommandEnabled()
{
return selectedWellLogPlotTrace() != NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotCurveFeature::onActionTriggered(bool isChecked)
{
RimWellLogPlotTrace* wellLogPlotTrace = selectedWellLogPlotTrace();
if (wellLogPlotTrace)
{
wellLogPlotTrace->addCurve();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotCurveFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("New Curve");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotTrace* RicNewWellLogPlotCurveFeature::selectedWellLogPlotTrace()
{
std::vector<RimWellLogPlotTrace*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
}

View File

@@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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
#include "cafCmdFeature.h"
class RimWellLogPlotTrace;
//==================================================================================================
///
//==================================================================================================
class RicNewWellLogPlotCurveFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
private:
RimWellLogPlotTrace* selectedWellLogPlotTrace();
};

View File

@@ -553,6 +553,7 @@ void RimProject::computeUtmAreaOfInterest()
#include "RimEclipseCellColors.h"
#include "RimEclipseFaultColors.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotTrace.h"
#include <QMenu>
@@ -727,6 +728,10 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
{
commandIds << "RicNewWellLogPlotTraceFeature";
}
else if (dynamic_cast<RimWellLogPlotTrace*>(uiItem))
{
commandIds << "RicNewWellLogPlotCurveFeature";
}
if (dynamic_cast<RimManagedViewCollection*>(uiItem))
{

View File

@@ -21,6 +21,9 @@
#include "RimWellLogPlotCurve.h"
#include "RiuMainWindow.h"
#include "cafPdmUiTreeView.h"
CAF_PDM_SOURCE_INIT(RimWellLogPlotTrace, "WellLogPlotTrace");
@@ -59,3 +62,16 @@ caf::PdmFieldHandle* RimWellLogPlotTrace::objectToggleField()
{
return &show;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotTrace::addCurve()
{
RimWellLogPlotCurve* curve = new RimWellLogPlotCurve();
curves.push_back(curve);
RiuMainWindow::instance()->projectTreeView()->setExpanded(this, true);
updateConnectedEditors();
}

View File

@@ -36,6 +36,8 @@ public:
RimWellLogPlotTrace();
virtual ~RimWellLogPlotTrace();
void addCurve();
protected:
// Overridden PDM methods