mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8849 Data Sources : Add append curves to plot based on selection
This commit is contained in:
parent
5d9f7b165c
commit
b030e617c6
@ -6,6 +6,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForObjectsFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForObjectsFeature.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForObjectsFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCE_GROUP_SOURCE_FILES
|
set(SOURCE_GROUP_SOURCE_FILES
|
||||||
@ -16,6 +17,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForObjectsFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForObjectsFeature.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForObjectsFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||||
|
@ -0,0 +1,95 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2022 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 "RicAppendSummaryCurvesForObjectsFeature.h"
|
||||||
|
|
||||||
|
#include "RiaGuiApplication.h"
|
||||||
|
#include "RicAppendSummaryPlotsForObjectsFeature.h"
|
||||||
|
|
||||||
|
#include "RimSummaryMultiPlot.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT( RicAppendSummaryCurvesForObjectsFeature, "RicAppendSummaryCurvesForObjectsFeature" );
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicAppendSummaryCurvesForObjectsFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
return !RicAppendSummaryPlotsForObjectsFeature::selectedCollections().empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicAppendSummaryCurvesForObjectsFeature::onActionTriggered( bool isChecked )
|
||||||
|
{
|
||||||
|
// - Select a set of objects in Data Source (wells, groups, regions, ..)
|
||||||
|
// - Use context menu to activate action
|
||||||
|
// - For each plots, append curves using handleDroppedObjects() on RimSummaryPlot
|
||||||
|
|
||||||
|
auto sumAddressCollections = RicAppendSummaryPlotsForObjectsFeature::selectedCollections();
|
||||||
|
if ( sumAddressCollections.empty() ) return;
|
||||||
|
|
||||||
|
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||||
|
|
||||||
|
auto summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( app->activePlotWindow() );
|
||||||
|
if ( !summaryMultiPlot ) return;
|
||||||
|
|
||||||
|
RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( sumAddressCollections, summaryMultiPlot );
|
||||||
|
|
||||||
|
auto selectionType = sumAddressCollections.front()->contentType();
|
||||||
|
auto sourcePlots = summaryMultiPlot->summaryPlots();
|
||||||
|
auto plotsForOneInstance =
|
||||||
|
RicAppendSummaryPlotsForObjectsFeature::plotsForOneInstanceOfObjectType( sourcePlots, selectionType );
|
||||||
|
|
||||||
|
std::vector<caf::PdmObjectHandle*> pdmObjects;
|
||||||
|
for ( auto summaryAdrCollection : sumAddressCollections )
|
||||||
|
{
|
||||||
|
pdmObjects.push_back( summaryAdrCollection );
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( auto plot : sourcePlots )
|
||||||
|
{
|
||||||
|
plot->handleDroppedObjects( pdmObjects );
|
||||||
|
}
|
||||||
|
|
||||||
|
summaryMultiPlot->loadDataAndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicAppendSummaryCurvesForObjectsFeature::setupActionLook( QAction* actionToSetup )
|
||||||
|
{
|
||||||
|
QString objectType = "Objects";
|
||||||
|
|
||||||
|
auto addresses = RicAppendSummaryPlotsForObjectsFeature::selectedCollections();
|
||||||
|
|
||||||
|
if ( !addresses.empty() )
|
||||||
|
{
|
||||||
|
auto firstAdr = addresses.front();
|
||||||
|
objectType = caf::AppEnum<RimSummaryAddressCollection::CollectionContentType>::uiText( firstAdr->contentType() );
|
||||||
|
}
|
||||||
|
|
||||||
|
auto text = QString( "Append Curves For " ) + objectType;
|
||||||
|
actionToSetup->setText( text );
|
||||||
|
actionToSetup->setIcon( QIcon( ":/SummaryCurve16x16.png" ) );
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2022 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 RicAppendSummaryCurvesForObjectsFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isCommandEnabled() override;
|
||||||
|
void onActionTriggered( bool isChecked ) override;
|
||||||
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
};
|
@ -106,18 +106,7 @@ void RicAppendSummaryPlotsForObjectsFeature::setupActionLook( QAction* actionToS
|
|||||||
if ( !addresses.empty() )
|
if ( !addresses.empty() )
|
||||||
{
|
{
|
||||||
auto firstAdr = addresses.front();
|
auto firstAdr = addresses.front();
|
||||||
if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL )
|
objectType = caf::AppEnum<RimSummaryAddressCollection::CollectionContentType>::uiText( firstAdr->contentType() );
|
||||||
{
|
|
||||||
objectType = "Wells";
|
|
||||||
}
|
|
||||||
else if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP )
|
|
||||||
{
|
|
||||||
objectType = "Groups";
|
|
||||||
}
|
|
||||||
else if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION )
|
|
||||||
{
|
|
||||||
objectType = "Regions";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto text = QString( "Append Plots For " ) + objectType;
|
auto text = QString( "Append Plots For " ) + objectType;
|
||||||
@ -136,9 +125,7 @@ std::vector<RimSummaryAddressCollection*> RicAppendSummaryPlotsForObjectsFeature
|
|||||||
if ( sumAddressCollections.size() == 1 )
|
if ( sumAddressCollections.size() == 1 )
|
||||||
{
|
{
|
||||||
auto coll = sumAddressCollections[0];
|
auto coll = sumAddressCollections[0];
|
||||||
if ( coll->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_FOLDER ||
|
if ( coll->isFolder() )
|
||||||
coll->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP_FOLDER ||
|
|
||||||
coll->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION_FOLDER )
|
|
||||||
{
|
{
|
||||||
// If a folder is selected, return all sub items in folder
|
// If a folder is selected, return all sub items in folder
|
||||||
auto childObjects = coll->subFolders();
|
auto childObjects = coll->subFolders();
|
||||||
|
@ -37,21 +37,22 @@ class RicAppendSummaryPlotsForObjectsFeature : public caf::CmdFeature
|
|||||||
{
|
{
|
||||||
CAF_CMD_HEADER_INIT;
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static std::vector<RimSummaryAddressCollection*> selectedCollections();
|
||||||
|
static std::vector<RimSummaryPlot*>
|
||||||
|
plotsForOneInstanceOfObjectType( const std::vector<RimSummaryPlot*>& sourcePlots,
|
||||||
|
RimSummaryAddressCollection::CollectionContentType objectType );
|
||||||
|
static bool isSelectionCompatibleWithPlot( const std::vector<RimSummaryAddressCollection*>& selection,
|
||||||
|
RimSummaryMultiPlot* summaryMultiPlot );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool isCommandEnabled() override;
|
bool isCommandEnabled() override;
|
||||||
void onActionTriggered( bool isChecked ) override;
|
void onActionTriggered( bool isChecked ) override;
|
||||||
void setupActionLook( QAction* actionToSetup ) override;
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<RimSummaryAddressCollection*> selectedCollections();
|
|
||||||
|
|
||||||
static bool isSelectionCompatibleWithPlot( const std::vector<RimSummaryAddressCollection*>& selection,
|
|
||||||
RimSummaryMultiPlot* summaryMultiPlot );
|
|
||||||
|
|
||||||
RifEclipseSummaryAddress modifyAddress( const RifEclipseSummaryAddress& sourceAddress,
|
RifEclipseSummaryAddress modifyAddress( const RifEclipseSummaryAddress& sourceAddress,
|
||||||
RimSummaryAddressCollection* summaryAddressCollection );
|
RimSummaryAddressCollection* summaryAddressCollection );
|
||||||
|
|
||||||
static std::vector<RimSummaryPlot*>
|
|
||||||
plotsForOneInstanceOfObjectType( const std::vector<RimSummaryPlot*>& sourcePlots,
|
|
||||||
RimSummaryAddressCollection::CollectionContentType objectType );
|
|
||||||
};
|
};
|
||||||
|
@ -1113,6 +1113,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
|
|
||||||
menuBuilder << "RicNewMultiPlotFeature";
|
menuBuilder << "RicNewMultiPlotFeature";
|
||||||
menuBuilder << "RicAppendSummaryPlotsForObjectsFeature";
|
menuBuilder << "RicAppendSummaryPlotsForObjectsFeature";
|
||||||
|
menuBuilder << "RicAppendSummaryCurvesForObjectsFeature";
|
||||||
|
|
||||||
// Work in progress -- End
|
// Work in progress -- End
|
||||||
|
|
||||||
|
@ -292,6 +292,20 @@ bool RimSummaryAddressCollection::isEnsemble() const
|
|||||||
return m_ensembleId >= 0;
|
return m_ensembleId >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimSummaryAddressCollection::isFolder() const
|
||||||
|
{
|
||||||
|
if ( contentType() == CollectionContentType::WELL_FOLDER || contentType() == CollectionContentType::GROUP_FOLDER ||
|
||||||
|
contentType() == CollectionContentType::REGION_FOLDER || contentType() == CollectionContentType::BLOCK_FOLDER )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -58,6 +58,7 @@ public:
|
|||||||
|
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
bool isEnsemble() const;
|
bool isEnsemble() const;
|
||||||
|
bool isFolder() const;
|
||||||
|
|
||||||
bool canBeDragged() const;
|
bool canBeDragged() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user