mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add support for summary cross plot curves in summary plots
This commit is contained in:
@@ -45,7 +45,7 @@ CAF_CMD_SOURCE_INIT( RicNewSummaryCrossPlotCurveFeature, "RicNewSummaryCrossPlot
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSummaryCrossPlotCurveFeature::isCommandEnabled() const
|
||||
{
|
||||
return ( selectedCrossPlot() );
|
||||
return ( selectedSummaryPlot() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -55,24 +55,29 @@ void RicNewSummaryCrossPlotCurveFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
|
||||
RimSummaryCrossPlot* plot = selectedCrossPlot();
|
||||
auto plot = selectedSummaryPlot();
|
||||
if ( plot )
|
||||
{
|
||||
RimSummaryCurve* newCurve = new RimSummaryCurve();
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plot->curveCount() );
|
||||
newCurve->setColor( curveColor );
|
||||
|
||||
plot->addCurveAndUpdate( newCurve );
|
||||
|
||||
RimSummaryCase* defaultCase = nullptr;
|
||||
if ( project->activeOilField()->summaryCaseMainCollection()->summaryCaseCount() > 0 )
|
||||
{
|
||||
defaultCase = project->activeOilField()->summaryCaseMainCollection()->summaryCase( 0 );
|
||||
newCurve->setSummaryCaseY( defaultCase );
|
||||
newCurve->setSummaryAddressY( RifEclipseSummaryAddress::fieldAddress( "FOPT" ) );
|
||||
|
||||
newCurve->loadDataAndUpdate( true );
|
||||
newCurve->setAxisTypeX( RiaDefines::HorizontalAxisType::SUMMARY_VECTOR );
|
||||
newCurve->setSummaryCaseX( defaultCase );
|
||||
newCurve->setSummaryAddressX( RifEclipseSummaryAddress::fieldAddress( "FGOR" ) );
|
||||
}
|
||||
|
||||
plot->addCurveAndUpdate( newCurve );
|
||||
|
||||
newCurve->loadDataAndUpdate( true );
|
||||
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
RiuPlotMainWindowTools::onObjectAppended( newCurve );
|
||||
@@ -91,15 +96,8 @@ void RicNewSummaryCrossPlotCurveFeature::setupActionLook( QAction* actionToSetup
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCrossPlot* RicNewSummaryCrossPlotCurveFeature::selectedCrossPlot() const
|
||||
RimSummaryPlot* RicNewSummaryCrossPlotCurveFeature::selectedSummaryPlot() const
|
||||
{
|
||||
RimSummaryCrossPlot* crossPlot = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
crossPlot = RiaSummaryTools::parentCrossPlot( selObj );
|
||||
}
|
||||
|
||||
return crossPlot;
|
||||
return RiaSummaryTools::parentSummaryPlot( selObj );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user