Working Correlation Plot prototype

This commit is contained in:
Gaute Lindkvist
2020-04-17 09:31:42 +02:00
parent 82ed7bbc81
commit 60419f0985
24 changed files with 1125 additions and 13 deletions

View File

@@ -0,0 +1,18 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewCorrelationPlotFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicNewCorrelationPlotFeature.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "CommandFeature\\CorrelationPlotCommands" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@@ -0,0 +1,81 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicNewCorrelationPlotFeature.h"
#include "RimCorrelationPlot.h"
#include "RimCorrelationPlotCollection.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicNewCorrelationPlotFeature, "RicNewCorrelationPlotFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewCorrelationPlotFeature::isCommandEnabled()
{
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
if ( selObj )
{
selObj->firstAncestorOrThisOfType( correlationPlotColl );
}
if ( correlationPlotColl ) return true;
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewCorrelationPlotFeature::onActionTriggered( bool isChecked )
{
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
if ( selObj )
{
selObj->firstAncestorOrThisOfType( correlationPlotColl );
}
if ( !correlationPlotColl ) return;
auto newPlot = correlationPlotColl->createCorrelationPlot();
newPlot->loadDataAndUpdate();
correlationPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::setExpanded( newPlot );
RiuPlotMainWindowTools::selectAsCurrentItem( newPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewCorrelationPlotFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "New Correlation Plot" );
actionToSetup->setIcon( QIcon( ":/AnalysisPlot16x16.png" ) );
}

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 RicNewCorrelationPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@@ -24,10 +24,12 @@
#include "Rim2dIntersectionViewCollection.h"
#include "Rim3dView.h"
#include "RimAnalysisPlot.h"
#include "RimAnnotationCollection.h"
#include "RimAnnotationInViewCollection.h"
#include "RimCase.h"
#include "RimCellRangeFilterCollection.h"
#include "RimCorrelationPlot.h"
#include "RimEclipsePropertyFilterCollection.h"
#include "RimEclipseView.h"
#include "RimEnsembleCurveFilterCollection.h"
@@ -53,7 +55,6 @@
#include "RiuPlotMainWindow.h"
#include "RimAnalysisPlot.h"
#include "cafNotificationCenter.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmDocument.h"
@@ -348,6 +349,15 @@ void RicDeleteItemExec::redo()
analysisPlot->loadDataAndUpdate();
}
}
{
RimCorrelationPlot* corrPlot;
parentObj->firstAncestorOrThisOfType( corrPlot );
if ( corrPlot )
{
corrPlot->loadDataAndUpdate();
}
}
}
}

View File

@@ -21,9 +21,11 @@
#include "RicDeleteItemExec.h"
#include "RicDeleteItemExecData.h"
#include "RimAnalysisPlot.h"
#include "RimAsciiDataCurve.h"
#include "RimBoxIntersection.h"
#include "RimCellRangeFilter.h"
#include "RimCorrelationPlot.h"
#include "RimDerivedEnsembleCaseCollection.h"
#include "RimEclipseInputProperty.h"
#include "RimEclipsePropertyFilter.h"
@@ -75,7 +77,6 @@
#include "cafPdmReferenceHelper.h"
#include "cafSelectionManager.h"
#include "RimAnalysisPlot.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicDeleteItemFeature, "RicDeleteItemFeature" );
@@ -154,6 +155,7 @@ bool isDeletable( caf::PdmUiItem* uiItem )
if ( dynamic_cast<RimGridCrossPlotDataSet*>( uiItem ) ) return true;
if ( dynamic_cast<RimAnalysisPlot*>( uiItem ) ) return true;
if ( dynamic_cast<RimCorrelationPlot*>( uiItem ) ) return true;
if ( dynamic_cast<RimPlotDataFilterItem*>( uiItem ) ) return true;
if ( dynamic_cast<RimMultiPlot*>( uiItem ) ) return true;