Merged in VFP-tables commit 874433680d65ec3ce2735c06f1212fb478e413b1.

This commit is contained in:
Ruben Thoms
2020-11-13 10:57:35 +01:00
committed by Magne Sjaastad
parent d1fc39a51c
commit 6636a29882
4 changed files with 122 additions and 0 deletions

View File

@@ -92,6 +92,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicExportStimPlanModelToFileFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicStackSelectedCurvesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicUnstackSelectedCurvesFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicThemeColorEditorFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewVfpPlotFeature.h
)
@@ -188,6 +189,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicExportStimPlanModelToFileFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicStackSelectedCurvesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicUnstackSelectedCurvesFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicThemeColorEditorFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewVfpPlotFeature.cpp
)

View File

@@ -0,0 +1,79 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// 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 "RicNewVfpPlotFeature.h"
#include "RiaApplication.h"
#include "RimMainPlotCollection.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimVfpPlot.h"
#include "RimVfpPlotCollection.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManagerTools.h"
#include <QAction>
#include <vector>
CAF_CMD_SOURCE_INIT( RicNewVfpPlotFeature, "RicNewVfpPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewVfpPlotFeature::isCommandEnabled()
{
RimVfpPlotCollection* plotColl = caf::firstAncestorOfTypeFromSelectedObject<RimVfpPlotCollection*>();
return ( plotColl != nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewVfpPlotFeature::onActionTriggered( bool isChecked )
{
RimProject* proj = RiaApplication::instance()->project();
RimVfpPlotCollection* vfpPlotColl = proj->mainPlotCollection()->vfpPlotCollection();
if ( vfpPlotColl )
{
RimVfpPlot* vfpPlot = new RimVfpPlot();
vfpPlotColl->addPlot( vfpPlot );
vfpPlotColl->updateConnectedEditors();
vfpPlot->loadDataAndUpdate();
RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::selectAsCurrentItem( vfpPlot );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewVfpPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New VFP Plot" );
// TODO: add icon
// actionToSetup->setIcon( QIcon( ":/VerticalFlowPerformancePlot16x16.png" ) );
}

View File

@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// 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 RicNewVfpPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
private:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
static QString selectedWellName();
};

View File

@@ -125,6 +125,7 @@
#include "RimSurfaceCollection.h"
#include "RimValveTemplate.h"
#include "RimValveTemplateCollection.h"
#include "RimVfpPlotCollection.h"
#include "RimViewController.h"
#include "RimViewLinker.h"
#include "RimViewLinkerCollection.h"
@@ -534,6 +535,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
{
menuBuilder << "RicNewPltPlotFeature";
}
else if ( dynamic_cast<RimVfpPlotCollection*>( firstUiItem ) )
{
menuBuilder << "RicNewVfpPlotFeature";
}
else if ( dynamic_cast<RimSummaryPlotCollection*>( firstUiItem ) )
{
menuBuilder << "RicPasteSummaryPlotFeature";