Add support for dropping folders in summary plots and multi summary plots

This commit is contained in:
jonjenssen 2022-05-25 21:48:01 +02:00 committed by jonjenssen
parent 53af120f39
commit ff57252812
3 changed files with 32 additions and 6 deletions

View File

@ -357,7 +357,7 @@ bool RimSummaryAddressCollection::canBeDragged() const
ok = ok && ( m_contentType == CollectionContentType::WELL || m_contentType == CollectionContentType::GROUP ||
m_contentType == CollectionContentType::REGION );
return ok;
return ok || isFolder();
}
//--------------------------------------------------------------------------------------------------

View File

@ -217,7 +217,20 @@ void RimSummaryMultiPlot::handleDroppedObjects( const std::vector<caf::PdmObject
if ( address ) addresses.push_back( address );
auto adrColl = dynamic_cast<RimSummaryAddressCollection*>( o );
if ( adrColl ) addressCollections.push_back( adrColl );
if ( adrColl )
{
if ( objects.size() == 1 )
{
if ( adrColl->isFolder() )
{
// If a folder is selected, return all sub items in folder
auto childObjects = adrColl->subFolders();
addressCollections.insert( addressCollections.end(), childObjects.begin(), childObjects.end() );
}
}
else
addressCollections.push_back( adrColl );
}
auto summaryCase = dynamic_cast<RimSummaryCase*>( o );
if ( summaryCase ) cases.push_back( summaryCase );

View File

@ -2123,6 +2123,18 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
auto addressCollection = dynamic_cast<RimSummaryAddressCollection*>( obj );
if ( addressCollection )
{
if ( addressCollection->isFolder() )
{
for ( auto coll : addressCollection->subFolders() )
{
auto [curveCount, curvesCreated] = handleAddressCollectionDrop( coll );
accumulatedCurveCount += curveCount;
curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() );
}
continue;
}
else
{
auto [curveCount, curvesCreated] = handleAddressCollectionDrop( addressCollection );
accumulatedCurveCount += curveCount;
@ -2130,6 +2142,7 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
continue;
}
}
}
if ( accumulatedCurveCount > 0 )
{