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

This commit is contained in:
Pål Hagen 2015-08-28 11:32:25 +02:00
parent af9bbfdede
commit 0fdf5292d0
6 changed files with 132 additions and 0 deletions

View File

@ -44,6 +44,7 @@ ${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.h
${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}RicWellPathsImportSsihubFeature.h
${CEE_CURRENT_LIST_DIR}RicWellPathsImportFileFeature.h
@ -94,6 +95,7 @@ ${CEE_CURRENT_LIST_DIR}RicCreateGridCaseGroupFeature.cpp
${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}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 "RicNewWellLogPlotTraceFeature.h"
#include "RimWellLogPlot.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewWellLogPlotTraceFeature, "RicNewWellLogPlotTraceFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogPlotTraceFeature::isCommandEnabled()
{
return selectedWellLogPlot() != NULL;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotTraceFeature::onActionTriggered(bool isChecked)
{
RimWellLogPlot* wellLogPlot = selectedWellLogPlot();
if (wellLogPlot)
{
wellLogPlot->addTrace();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotTraceFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("New Trace");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RicNewWellLogPlotTraceFeature::selectedWellLogPlot()
{
std::vector<RimWellLogPlot*> 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 RimWellLogPlot;
//==================================================================================================
///
//==================================================================================================
class RicNewWellLogPlotTraceFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
private:
RimWellLogPlot* selectedWellLogPlot();
};

View File

@ -552,6 +552,7 @@ void RimProject::computeUtmAreaOfInterest()
#include "RimGeoMechView.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseFaultColors.h"
#include "RimWellLogPlot.h"
#include <QMenu>
@ -722,6 +723,10 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
{
commandIds << "RicDeleteItemFeature";
}
else if (dynamic_cast<RimWellLogPlot*>(uiItem))
{
commandIds << "RicNewWellLogPlotTraceFeature";
}
if (dynamic_cast<RimManagedViewCollection*>(uiItem))
{

View File

@ -24,6 +24,9 @@
#include "RiuWellLogPlot.h"
#include "RiuMainWindow.h"
#include "cafPdmUiTreeView.h"
CAF_PDM_SOURCE_INIT(RimWellLogPlot, "WellLogPlot");
//--------------------------------------------------------------------------------------------------
@ -92,3 +95,15 @@ caf::PdmFieldHandle* RimWellLogPlot::objectToggleField()
{
return &showWindow;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::addTrace()
{
RimWellLogPlotTrace* trace = new RimWellLogPlotTrace();
traces.push_back(trace);
RiuMainWindow::instance()->projectTreeView()->setExpanded(this, true);
updateConnectedEditors();
}

View File

@ -40,6 +40,8 @@ public:
RimWellLogPlot();
virtual ~RimWellLogPlot();
void addTrace();
caf::PdmField<bool> showWindow;
protected: