mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Rename ApplicationCode to ApplicationLibCode
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotDataSetFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSwapGridCrossPlotDataSetAxesFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicPasteGridCrossPlotDataSetFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateSaturationPressurePlotsFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSaturationPressureUi.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateGridCrossPlotDataSetFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSwapGridCrossPlotDataSetAxesFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicPasteGridCrossPlotDataSetFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicCreateSaturationPressurePlotsFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicSaturationPressureUi.cpp
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND COMMAND_CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
source_group( "CommandFeature\\GridCrossPlot" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )
|
||||
@@ -0,0 +1,63 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RicCreateGridCrossPlotDataSetFeature.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotDataSet.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreateGridCrossPlotDataSetFeature, "RicCreateGridCrossPlotDataSetFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateGridCrossPlotDataSetFeature::isCommandEnabled()
|
||||
{
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateGridCrossPlotDataSetFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimGridCrossPlot* crossPlot = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>();
|
||||
|
||||
RimGridCrossPlotDataSet* dataSet = crossPlot->createDataSet();
|
||||
dataSet->loadDataAndUpdate( true );
|
||||
|
||||
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( dataSet );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateGridCrossPlotDataSetFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Create Data Set" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellLogCurve16x16.png" ) );
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 RicCreateGridCrossPlotDataSetFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RicCreateGridCrossPlotFeature.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCollection.h"
|
||||
#include "RimGridCrossPlotDataSet.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreateGridCrossPlotFeature, "RicCreateGridCrossPlotFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateGridCrossPlotFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateGridCrossPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
RimGridCrossPlotCollection* collection =
|
||||
caf::SelectionManager::instance()->selectedItemAncestorOfType<RimGridCrossPlotCollection>();
|
||||
if ( !collection )
|
||||
{
|
||||
collection = project->mainPlotCollection()->gridCrossPlotCollection();
|
||||
}
|
||||
RimGridCrossPlot* plot = collection->createGridCrossPlot();
|
||||
RimGridCrossPlotDataSet* dataSet = plot->createDataSet();
|
||||
|
||||
auto contextViewer = dynamic_cast<RiuViewer*>( caf::CmdFeatureManager::instance()->currentContextMenuTargetWidget() );
|
||||
if ( contextViewer != nullptr )
|
||||
{
|
||||
// Command is triggered from viewer
|
||||
dataSet->setCellFilterView( RiaApplication::instance()->activeMainOrComparisonGridView() );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Triggered from context menu: get the selected view
|
||||
// TODO: get the filter from somewhere
|
||||
}
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
plot->zoomAll();
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
collection->updateAllRequiredEditors();
|
||||
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( dataSet );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateGridCrossPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
auto contextViewer = dynamic_cast<RiuViewer*>( caf::CmdFeatureManager::instance()->currentContextMenuTargetWidget() );
|
||||
if ( contextViewer != nullptr )
|
||||
{
|
||||
// Command is triggered from viewer
|
||||
actionToSetup->setText( "Create Grid Cross Plot from 3d View" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Command triggered from project tree or file menu
|
||||
actionToSetup->setText( "Create Grid Cross Plot" );
|
||||
}
|
||||
|
||||
actionToSetup->setIcon( QIcon( ":/SummaryXPlotsLight16x16.png" ) );
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreateGridCrossPlotFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -0,0 +1,213 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RicCreateSaturationPressurePlotsFeature.h"
|
||||
#include "RicSaturationPressureUi.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPorosityModel.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigEclipseResultAddress.h"
|
||||
#include "RigEquil.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
#include "RimMainPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSaturationPressurePlot.h"
|
||||
#include "RimSaturationPressurePlotCollection.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicCreateSaturationPressurePlotsFeature, "RicCreateSaturationPressurePlotsFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSaturationPressurePlot*>
|
||||
RicCreateSaturationPressurePlotsFeature::createPlots( RimEclipseResultCase* eclipseResultCase, int timeStep )
|
||||
{
|
||||
std::vector<RimSaturationPressurePlot*> plots;
|
||||
|
||||
if ( !eclipseResultCase )
|
||||
{
|
||||
RiaLogging::error( "CreateSaturationPressurePlots:: No case specified" );
|
||||
return plots;
|
||||
}
|
||||
|
||||
RimProject* project = RimProject::current();
|
||||
|
||||
RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection();
|
||||
|
||||
if ( eclipseResultCase && eclipseResultCase->ensureReservoirCaseIsOpen() )
|
||||
{
|
||||
eclipseResultCase->ensureDeckIsParsedForEquilData();
|
||||
|
||||
RigEclipseCaseData* eclipseCaseData = eclipseResultCase->eclipseCaseData();
|
||||
|
||||
if ( eclipseCaseData->equilData().empty() )
|
||||
{
|
||||
RiaLogging::error( "CreateSaturationPressurePlots:: No EQUIL data available" );
|
||||
return plots;
|
||||
}
|
||||
|
||||
if ( eclipseCaseData && eclipseCaseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL ) )
|
||||
{
|
||||
RigCaseCellResultsData* resultData = eclipseCaseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL );
|
||||
|
||||
if ( !resultData->hasResultEntry(
|
||||
RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "PRESSURE" ) ) )
|
||||
{
|
||||
RiaLogging::error( "CreateSaturationPressurePlots : PRESSURE is not available " );
|
||||
return plots;
|
||||
}
|
||||
|
||||
if ( !resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "PDEW" ) ) )
|
||||
{
|
||||
RiaLogging::error( "CreateSaturationPressurePlots : PDEW is not available " );
|
||||
return plots;
|
||||
}
|
||||
|
||||
if ( !resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "PBUB" ) ) )
|
||||
{
|
||||
RiaLogging::error( "CreateSaturationPressurePlots : PBUB is not available " );
|
||||
return plots;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plots = collection->createSaturationPressurePlots( eclipseResultCase, timeStep );
|
||||
for ( auto plot : plots )
|
||||
{
|
||||
plot->loadDataAndUpdate();
|
||||
plot->zoomAll();
|
||||
plot->updateConnectedEditors();
|
||||
}
|
||||
|
||||
return plots;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateSaturationPressurePlotsFeature::isCommandEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateSaturationPressurePlotsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
|
||||
RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection();
|
||||
|
||||
std::vector<RimEclipseResultCase*> eclipseCases;
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
std::vector<RimCase*> cases;
|
||||
app->project()->allCases( cases );
|
||||
for ( auto* rimCase : cases )
|
||||
{
|
||||
auto erc = dynamic_cast<RimEclipseResultCase*>( rimCase );
|
||||
if ( erc )
|
||||
{
|
||||
eclipseCases.push_back( erc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RimEclipseResultCase* eclipseResultCase = nullptr;
|
||||
int timeStep = 0;
|
||||
|
||||
if ( !eclipseCases.empty() )
|
||||
{
|
||||
if ( eclipseCases.size() == 1 )
|
||||
{
|
||||
eclipseResultCase = eclipseCases[0];
|
||||
}
|
||||
|
||||
if ( !eclipseResultCase || eclipseResultCase->timeStepDates().size() > 1 )
|
||||
{
|
||||
RicSaturationPressureUi saturationPressureUi;
|
||||
saturationPressureUi.setSelectedCase( eclipseCases[0] );
|
||||
|
||||
RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog( plotwindow,
|
||||
&saturationPressureUi,
|
||||
"Select Case to create Pressure Saturation plots",
|
||||
"" );
|
||||
|
||||
if ( propertyDialog.exec() == QDialog::Accepted )
|
||||
{
|
||||
eclipseResultCase = dynamic_cast<RimEclipseResultCase*>( saturationPressureUi.selectedCase() );
|
||||
timeStep = saturationPressureUi.selectedTimeStep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
caf::PdmObject* objectToSelect = nullptr;
|
||||
|
||||
std::vector<RimSaturationPressurePlot*> plots = createPlots( eclipseResultCase, timeStep );
|
||||
if ( plots.empty() )
|
||||
{
|
||||
QString text = "No plots generated.\n\n";
|
||||
text += "Data required to generate saturation/pressure plots:\n";
|
||||
text += " - EQUIL property defining at least one region\n";
|
||||
text += " - EQLNUM property defining at least one region\n";
|
||||
text += " - Dynamic properties PRESSURE, PBUB and PDEW\n\n";
|
||||
text += "Make sure to add 'PBPD' to the RPTRST keyword in the SOLUTION selection. ";
|
||||
text += "If this is a two phase run (Oil/water or Gas/Water) or if both VAPOIL ";
|
||||
text += "and DISGAS are disabled, saturation pressure are not valid.\n\n";
|
||||
text += "See error log for more details.";
|
||||
|
||||
RiaLogging::errorInMessageBox( nullptr, "Saturation Pressure Plots", text );
|
||||
}
|
||||
else
|
||||
{
|
||||
objectToSelect = plots.front();
|
||||
}
|
||||
|
||||
collection->updateAllRequiredEditors();
|
||||
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
|
||||
if ( objectToSelect )
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateSaturationPressurePlotsFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Create Saturation Pressure Plots" );
|
||||
actionToSetup->setIcon( QIcon( ":/SummaryXPlotsLight16x16.png" ) );
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 RimEclipseResultCase;
|
||||
class RimSaturationPressurePlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicCreateSaturationPressurePlotsFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static std::vector<RimSaturationPressurePlot*> createPlots( RimEclipseResultCase* eclipseCase, int timeStep );
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 "RicPasteGridCrossPlotDataSetFeature.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotDataSet.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h"
|
||||
|
||||
#include "cafPdmObjectGroup.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicPasteGridCrossPlotDataSetFeature, "RicPasteGridCrossPlotDataSetFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicPasteGridCrossPlotDataSetFeature::isCommandEnabled()
|
||||
{
|
||||
auto curvesOnClipboard = gridCrossPlotDataSetsOnClipboard();
|
||||
if ( curvesOnClipboard.empty() ) return false;
|
||||
|
||||
return caf::SelectionManager::instance()->selectedItemAncestorOfType<RimGridCrossPlot>() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPasteGridCrossPlotDataSetFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimGridCrossPlot* crossPlot = caf::SelectionManager::instance()->selectedItemAncestorOfType<RimGridCrossPlot>();
|
||||
|
||||
if ( crossPlot )
|
||||
{
|
||||
auto curvesOnClipboard = gridCrossPlotDataSetsOnClipboard();
|
||||
if ( !curvesOnClipboard.empty() )
|
||||
{
|
||||
RimGridCrossPlotDataSet* objectToSelect = nullptr;
|
||||
|
||||
for ( RimGridCrossPlotDataSet* dataSet : gridCrossPlotDataSetsOnClipboard() )
|
||||
{
|
||||
RimGridCrossPlotDataSet* newDataSet = dynamic_cast<RimGridCrossPlotDataSet*>(
|
||||
dataSet->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
crossPlot->addDataSet( newDataSet );
|
||||
newDataSet->resolveReferencesRecursively();
|
||||
newDataSet->initAfterReadRecursively();
|
||||
|
||||
objectToSelect = newDataSet;
|
||||
}
|
||||
|
||||
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
crossPlot->updateAllRequiredEditors();
|
||||
crossPlot->loadDataAndUpdate();
|
||||
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPasteGridCrossPlotDataSetFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "Paste Data Set" );
|
||||
RicPasteFeatureImpl::setIconAndShortcuts( actionToSetup );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmPointer<RimGridCrossPlotDataSet>> RicPasteGridCrossPlotDataSetFeature::gridCrossPlotDataSetsOnClipboard()
|
||||
{
|
||||
caf::PdmObjectGroup objectGroup;
|
||||
RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup );
|
||||
|
||||
std::vector<caf::PdmPointer<RimGridCrossPlotDataSet>> typedObjects;
|
||||
objectGroup.objectsByType( &typedObjects );
|
||||
|
||||
return typedObjects;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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"
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
class RimGridCrossPlotDataSet;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicPasteGridCrossPlotDataSetFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
static std::vector<caf::PdmPointer<RimGridCrossPlotDataSet>> gridCrossPlotDataSetsOnClipboard();
|
||||
};
|
||||
@@ -0,0 +1,80 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil 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 "RicSaturationPressureUi.h"
|
||||
|
||||
#include "RimTools.h"
|
||||
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicSaturationPressureUi, "RicSaturationPressureUi" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicSaturationPressureUi::RicSaturationPressureUi()
|
||||
{
|
||||
CAF_PDM_InitObject( "RicSaturationPressureUi", "", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_caseToApply, "CaseToApply", "Case to Apply", "", "", "" );
|
||||
CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSaturationPressureUi::setSelectedCase( RimEclipseCase* eclipseCase )
|
||||
{
|
||||
m_caseToApply = eclipseCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RicSaturationPressureUi::selectedCase() const
|
||||
{
|
||||
return m_caseToApply();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RicSaturationPressureUi::selectedTimeStep() const
|
||||
{
|
||||
return m_timeStep();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo>
|
||||
RicSaturationPressureUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if ( fieldNeedingOptions == &m_caseToApply )
|
||||
{
|
||||
RimTools::caseOptionItems( &options );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_timeStep )
|
||||
{
|
||||
RimTools::timeStepsForCase( m_caseToApply, &options );
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2017- Statoil 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 "RimEclipseCase.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicSaturationPressureUi : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicSaturationPressureUi();
|
||||
|
||||
void setSelectedCase( RimEclipseCase* eclipseCase );
|
||||
RimEclipseCase* selectedCase() const;
|
||||
int selectedTimeStep() const;
|
||||
|
||||
protected:
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimEclipseCase*> m_caseToApply;
|
||||
caf::PdmField<int> m_timeStep;
|
||||
};
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "RicSwapGridCrossPlotDataSetAxesFeature.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotDataSet.h"
|
||||
|
||||
#include <cafSelectionManager.h>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicSwapGridCrossPlotDataSetAxesFeature, "RicSwapGridCrossPlotDataSetAxesFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSwapGridCrossPlotDataSetAxesFeature::isCommandEnabled()
|
||||
{
|
||||
if ( caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotDataSet>() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ( caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>() )
|
||||
{
|
||||
auto plot = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>();
|
||||
if ( !plot->dataSets().empty() ) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSwapGridCrossPlotDataSetAxesFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
if ( caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotDataSet>() )
|
||||
{
|
||||
auto dataSet = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotDataSet>();
|
||||
dataSet->swapAxisProperties( true );
|
||||
}
|
||||
else if ( caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>() )
|
||||
{
|
||||
auto plot = caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlot>();
|
||||
plot->swapAxes();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSwapGridCrossPlotDataSetAxesFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
if ( caf::SelectionManager::instance()->selectedItemOfType<RimGridCrossPlotDataSet>() )
|
||||
{
|
||||
actionToSetup->setText( "Swap Axis Properties" );
|
||||
}
|
||||
else
|
||||
{
|
||||
actionToSetup->setText( "Swap Axis Properties for all Data Sets in Plot" );
|
||||
}
|
||||
actionToSetup->setIcon( QIcon( ":/Swap.png" ) );
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- 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 RicSwapGridCrossPlotDataSetAxesFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() override;
|
||||
void onActionTriggered( bool isChecked ) override;
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
};
|
||||
Reference in New Issue
Block a user