Add RimVfpTableData used to represent connection to file and data

Extract data management from RimVfpPlot. Use pointer from RimVfpPlot to RimVfpTableData.
This commit is contained in:
Magne Sjaastad
2024-05-13 08:54:40 +02:00
parent b8391e6f92
commit ff9b13163a
28 changed files with 1591 additions and 717 deletions

View File

@@ -23,6 +23,7 @@
#include "RimMainPlotCollection.h"
#include "VerticalFlowPerformance/RimVfpDataCollection.h"
#include "VerticalFlowPerformance/RimVfpDeck.h"
#include "VerticalFlowPerformance/RimVfpPlot.h"
#include "VerticalFlowPerformance/RimVfpPlotCollection.h"
@@ -38,15 +39,6 @@
CAF_CMD_SOURCE_INIT( RicImportVfpDataFeature, "RicImportVfpDataFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicImportVfpDataFeature::isCommandEnabled() const
{
auto plotColl = caf::firstAncestorOfTypeFromSelectedObject<RimVfpPlotCollection>();
return ( plotColl != nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -83,47 +75,17 @@ void RicImportVfpDataFeature::onActionTriggered( bool isChecked )
std::vector<RimVfpPlot*> vfpPlots;
std::vector<RimVfpDeck*> vfpDecks;
auto vfpDataColl = RimVfpDataCollection::instance();
for ( const auto& fileName : fileNames )
{
if ( fileName.contains( ".DATA" ) )
{
auto vfpDeck = vfpPlotColl->addDeck( fileName );
vfpDecks.push_back( vfpDeck );
}
else
{
auto vfpPlot = new RimVfpPlot();
vfpPlot->setFileName( fileName );
vfpPlotColl->addPlot( vfpPlot );
vfpPlots.push_back( vfpPlot );
}
auto vfpDataSource = vfpDataColl->appendTableDataObject( fileName );
auto firstPlot = vfpPlotColl->createAndAppendPlots( vfpDataSource );
vfpDataColl->updateAllRequiredEditors();
RiuPlotMainWindowTools::onObjectAppended( firstPlot, firstPlot );
}
vfpPlotColl->updateConnectedEditors();
for ( auto deck : vfpDecks )
{
deck->loadDataAndUpdate();
deck->updateConnectedEditors();
}
for ( auto plot : vfpPlots )
{
plot->loadDataAndUpdate();
}
RiuPlotMainWindowTools::showPlotMainWindow();
if ( !vfpPlots.empty() )
{
RiuPlotMainWindowTools::onObjectAppended( vfpPlots.front() );
}
if ( !vfpDecks.empty() )
{
RiuPlotMainWindowTools::onObjectAppended( vfpDecks.front() );
}
vfpPlotColl->updateAllRequiredEditors();
}
//--------------------------------------------------------------------------------------------------