mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
Refactors selection handling for improved code clarity
Modernize the interface to selection system. Create and return data instead of populating incoming parameters.
This commit is contained in:
1 parent
380f559f0d
commit
ae8446073b
136 files changed
+357
-870
No files matched your search
@@ -1520,10 +1520,7 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences*
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<caf::PdmUiItem*> uiEditorsToUpdate;
|
||||
caf::SelectionManager::instance()->selectedItems( uiEditorsToUpdate );
|
||||
|
||||
for ( caf::PdmUiItem* uiItem : uiEditorsToUpdate )
|
||||
for ( caf::PdmUiItem* uiItem : caf::SelectionManager::instance()->selectedItems() )
|
||||
{
|
||||
uiItem->updateConnectedEditors();
|
||||
}
|
||||
|
||||
@@ -486,10 +486,7 @@ std::vector<QString> RicSummaryPlotTemplateTools::selectDefaultPlotTemplates( st
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCase*> RicSummaryPlotTemplateTools::selectedSummaryCases()
|
||||
{
|
||||
std::vector<RimSummaryCase*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
return objects;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -497,10 +494,7 @@ std::vector<RimSummaryCase*> RicSummaryPlotTemplateTools::selectedSummaryCases()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryEnsemble*> RicSummaryPlotTemplateTools::selectedSummaryEnsembles()
|
||||
{
|
||||
std::vector<RimSummaryEnsemble*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
return objects;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimSummaryEnsemble>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -508,10 +502,7 @@ std::vector<RimSummaryEnsemble*> RicSummaryPlotTemplateTools::selectedSummaryEns
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryAddressCollection*> RicSummaryPlotTemplateTools::selectedSummaryAddressCollections()
|
||||
{
|
||||
std::vector<RimSummaryAddressCollection*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
return objects;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimSummaryAddressCollection>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -61,19 +61,17 @@ void RicOpenInTextEditorFeature::openFileInTextEditor( const QString& filePath,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicOpenInTextEditorFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
|
||||
QString filePath;
|
||||
|
||||
if ( !uiItems.empty() )
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( !selectedItems.empty() )
|
||||
{
|
||||
if ( auto templateFileItem = dynamic_cast<RimPlotTemplateFileItem*>( uiItems.front() ) )
|
||||
if ( auto templateFileItem = dynamic_cast<RimPlotTemplateFileItem*>( selectedItems.front() ) )
|
||||
{
|
||||
filePath = templateFileItem->absoluteFilePath();
|
||||
}
|
||||
|
||||
if ( auto pressureDepthData = dynamic_cast<RimPressureDepthData*>( uiItems.front() ) )
|
||||
if ( auto pressureDepthData = dynamic_cast<RimPressureDepthData*>( selectedItems.front() ) )
|
||||
{
|
||||
filePath = pressureDepthData->filePath();
|
||||
}
|
||||
|
||||
@@ -126,13 +126,12 @@ void RicNewFishbonesSubsFeature::createFishbones( const RimFishbonesDefines::Ric
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> allSelectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( allSelectedItems );
|
||||
if ( allSelectedItems.size() != 1u ) return nullptr;
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( selectedItems.size() != 1u ) return nullptr;
|
||||
|
||||
RimFishbonesCollection* objToFind = nullptr;
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = allSelectedItems.front();
|
||||
caf::PdmUiItem* pdmUiItem = selectedItems.front();
|
||||
|
||||
auto* objHandle = dynamic_cast<caf::PdmObjectHandle*>( pdmUiItem );
|
||||
if ( objHandle )
|
||||
@@ -142,8 +141,7 @@ RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection(
|
||||
|
||||
if ( objToFind == nullptr )
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPaths );
|
||||
auto wellPaths = caf::SelectionManager::instance()->objectsByType<RimWellPath>();
|
||||
if ( !wellPaths.empty() )
|
||||
{
|
||||
return wellPaths[0]->fishbonesCollection();
|
||||
|
||||
@@ -84,8 +84,7 @@ void RicNewPerforationIntervalFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPerforationCollection* RicNewPerforationIntervalFeature::selectedPerforationCollection()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( selectedItems.size() != 1u ) return nullptr;
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = selectedItems.front();
|
||||
|
||||
@@ -18,11 +18,10 @@ CAF_CMD_SOURCE_INIT( RicNewValveFeature, "RicNewValveFeature" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewValveFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> allSelectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( allSelectedItems );
|
||||
if ( allSelectedItems.size() != 1u ) return false;
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( selectedItems.size() != 1u ) return false;
|
||||
|
||||
const RimPerforationInterval* perfInterval = dynamic_cast<RimPerforationInterval*>( allSelectedItems.front() );
|
||||
const RimPerforationInterval* perfInterval = dynamic_cast<RimPerforationInterval*>( selectedItems.front() );
|
||||
return perfInterval != nullptr;
|
||||
}
|
||||
|
||||
|
||||
+1
-9
@@ -124,13 +124,5 @@ void RicWellPathImportPerforationIntervalsFeature::setupActionLook( QAction* act
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathCollection* RicWellPathImportPerforationIntervalsFeature::selectedWellPathCollection()
|
||||
{
|
||||
std::vector<RimWellPathCollection*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
if ( objects.size() == 1 )
|
||||
{
|
||||
return objects[0];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimWellPathCollection>();
|
||||
}
|
||||
+5
-9
@@ -40,9 +40,9 @@ CAF_CMD_SOURCE_INIT( RicExportCompletionsForVisibleWellPathsFeature, "RicExportC
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportCompletionsForVisibleWellPathsFeature::isCommandEnabled() const
|
||||
{
|
||||
bool foundWellPathCollection = false;
|
||||
std::vector<caf::PdmObject*> selectedObjects;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
|
||||
bool foundWellPathCollection = false;
|
||||
|
||||
const auto selectedObjects = caf::SelectionManager::instance()->objectsByType<caf::PdmObject>();
|
||||
for ( caf::PdmObject* object : selectedObjects )
|
||||
{
|
||||
RimWellPathCollection* wellPathCollection = object->firstAncestorOrThisOfType<RimWellPathCollection>();
|
||||
@@ -97,14 +97,10 @@ std::vector<RimWellPath*> RicExportCompletionsForVisibleWellPathsFeature::visibl
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<RimWellPathCollection*> wellPathCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPathCollections );
|
||||
|
||||
auto wellPathCollections = caf::SelectionManager::instance()->objectsByType<RimWellPathCollection>();
|
||||
if ( wellPathCollections.empty() )
|
||||
{
|
||||
std::vector<RimWellPath*> selectedWellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedWellPaths );
|
||||
|
||||
const auto selectedWellPaths = caf::SelectionManager::instance()->objectsByType<RimWellPath>();
|
||||
if ( !selectedWellPaths.empty() )
|
||||
{
|
||||
RimWellPathCollection* parent = selectedWellPaths[0]->firstAncestorOrThisOfType<RimWellPathCollection>();
|
||||
|
||||
+1
-4
@@ -222,8 +222,5 @@ void RicWellPathExportCompletionDataFeature::setupActionLook( QAction* actionToS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellPath*> RicWellPathExportCompletionDataFeature::selectedWellPaths()
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPaths );
|
||||
|
||||
return wellPaths;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimWellPath>();
|
||||
}
|
||||
@@ -39,8 +39,7 @@ CAF_CMD_SOURCE_INIT( RicAppendIntersectionFeature, "RicAppendIntersectionFeature
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAppendIntersectionFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType( &collection );
|
||||
const auto collection = caf::SelectionManager::instance()->objectsByType<caf::PdmObjectHandle>();
|
||||
CVF_ASSERT( collection.size() == 1 );
|
||||
|
||||
RimIntersectionCollection* intersectionCollection = collection[0]->firstAncestorOrThisOfType<RimIntersectionCollection>();
|
||||
|
||||
+1
-2
@@ -37,8 +37,7 @@ CAF_CMD_SOURCE_INIT( RicAppendSeparateIntersectionResultFeature, "RicAppendSepar
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicAppendSeparateIntersectionResultFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType( &collection );
|
||||
const auto collection = caf::SelectionManager::instance()->objectsByType<caf::PdmObjectHandle>();
|
||||
CVF_ASSERT( collection.size() == 1 );
|
||||
|
||||
RimIntersectionResultsDefinitionCollection* intersectionResCollection =
|
||||
|
||||
+3
-4
@@ -188,10 +188,9 @@ std::vector<RimBoxIntersection*> selectedIntersectionBoxes()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
SelectionComposition selectionComposition()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> allSelectedObjects;
|
||||
caf::SelectionManager::instance()->selectedItems( allSelectedObjects );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
|
||||
RimCase* gridCase = commonGridCase( allSelectedObjects );
|
||||
RimCase* gridCase = commonGridCase( selectedItems );
|
||||
if ( gridCase && gridCase->gridViews().size() > 1 )
|
||||
{
|
||||
RimIntersectionCollection* selColl = selectedIntersectionCollection();
|
||||
@@ -200,7 +199,7 @@ SelectionComposition selectionComposition()
|
||||
|
||||
if ( selColl )
|
||||
{
|
||||
if ( allSelectedObjects.size() == 1 ) return SEL_COLLECTION;
|
||||
if ( selectedItems.size() == 1 ) return SEL_COLLECTION;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+1
-4
@@ -38,10 +38,7 @@ CAF_CMD_SOURCE_INIT( RicNewSimWellIntersectionFeature, "RicNewSimWellIntersectio
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSimWellIntersectionFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSimWellInView*> simWells;
|
||||
caf::SelectionManager::instance()->objectsByType( &simWells );
|
||||
|
||||
for ( auto simWell : simWells )
|
||||
for ( auto simWell : caf::SelectionManager::instance()->objectsByType<RimSimWellInView>() )
|
||||
{
|
||||
RimEclipseView* eclView = simWell->firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
|
||||
|
||||
|
||||
+5
-8
@@ -50,14 +50,11 @@ void RicNewWellPathIntersectionFeature::onActionTriggered( bool isChecked )
|
||||
RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
if ( !activeView ) return;
|
||||
|
||||
std::vector<RimWellPath*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType( &collection );
|
||||
CVF_ASSERT( collection.size() == 1 );
|
||||
|
||||
RimWellPath* wellPath = collection[0];
|
||||
|
||||
RicNewWellPathIntersectionFeatureCmd* cmd = new RicNewWellPathIntersectionFeatureCmd( activeView->intersectionCollection(), wellPath );
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd );
|
||||
if ( auto wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>() )
|
||||
{
|
||||
RicNewWellPathIntersectionFeatureCmd* cmd = new RicNewWellPathIntersectionFeatureCmd( activeView->intersectionCollection(), wellPath );
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
+1
-4
@@ -39,8 +39,5 @@ bool RicEclipseWellFeatureImpl::isAnyWellSelected()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSimWellInView*> RicEclipseWellFeatureImpl::selectedWells()
|
||||
{
|
||||
std::vector<RimSimWellInView*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
return selection;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimSimWellInView>();
|
||||
}
|
||||
+4
-12
@@ -40,9 +40,7 @@ CAF_CMD_SOURCE_INIT( RicApplyPropertyFilterAsCellResultFeature, "RicApplyPropert
|
||||
bool RicApplyPropertyFilterAsCellResultFeature::isCommandEnabled() const
|
||||
{
|
||||
{
|
||||
std::vector<RimEclipsePropertyFilter*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<RimEclipsePropertyFilter>();
|
||||
if ( objects.size() == 1 )
|
||||
{
|
||||
return true;
|
||||
@@ -50,9 +48,7 @@ bool RicApplyPropertyFilterAsCellResultFeature::isCommandEnabled() const
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilter*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<RimGeoMechPropertyFilter>();
|
||||
if ( objects.size() == 1 )
|
||||
{
|
||||
return true;
|
||||
@@ -68,9 +64,7 @@ bool RicApplyPropertyFilterAsCellResultFeature::isCommandEnabled() const
|
||||
void RicApplyPropertyFilterAsCellResultFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
{
|
||||
std::vector<RimEclipsePropertyFilter*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<RimEclipsePropertyFilter>();
|
||||
if ( objects.size() == 1 )
|
||||
{
|
||||
RimEclipsePropertyFilter* propertyFilter = objects[0];
|
||||
@@ -89,9 +83,7 @@ void RicApplyPropertyFilterAsCellResultFeature::onActionTriggered( bool isChecke
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilter*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<RimGeoMechPropertyFilter>();
|
||||
if ( objects.size() == 1 )
|
||||
{
|
||||
RimGeoMechPropertyFilter* propertyFilter = objects[0];
|
||||
|
||||
@@ -80,8 +80,5 @@ void RicComputeStatisticsFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipseStatisticsCase*> RicComputeStatisticsFeature::selectedCases()
|
||||
{
|
||||
std::vector<RimEclipseStatisticsCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
return selection;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimEclipseStatisticsCase>();
|
||||
}
|
||||
@@ -36,11 +36,8 @@ CAF_CMD_SOURCE_INIT( RicEclipseCaseNewGroupFeature, "RicEclipseCaseNewGroupFeatu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipseCaseNewGroupFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimCase*> caseSelection;
|
||||
caf::SelectionManager::instance()->objectsByType( &caseSelection );
|
||||
|
||||
std::vector<RimEclipseCaseCollection*> caseCollSelection;
|
||||
caf::SelectionManager::instance()->objectsByType( &caseCollSelection );
|
||||
const auto caseSelection = caf::SelectionManager::instance()->objectsByType<RimCase>();
|
||||
const auto caseCollSelection = caf::SelectionManager::instance()->objectsByType<RimEclipseCaseCollection>();
|
||||
|
||||
return !caseSelection.empty() || !caseCollSelection.empty();
|
||||
}
|
||||
|
||||
@@ -40,10 +40,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipsePropertyFilter*> RicEclipsePropertyFilterFeatureImpl::selectedPropertyFilters()
|
||||
{
|
||||
std::vector<RimEclipsePropertyFilter*> propertyFilters;
|
||||
caf::SelectionManager::instance()->objectsByType( &propertyFilters );
|
||||
|
||||
return propertyFilters;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimEclipsePropertyFilter>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -51,10 +48,7 @@ std::vector<RimEclipsePropertyFilter*> RicEclipsePropertyFilterFeatureImpl::sele
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEclipsePropertyFilterCollection*> RicEclipsePropertyFilterFeatureImpl::selectedPropertyFilterCollections()
|
||||
{
|
||||
std::vector<RimEclipsePropertyFilterCollection*> propertyFilterCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &propertyFilterCollections );
|
||||
|
||||
return propertyFilterCollections;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimEclipsePropertyFilterCollection>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -70,17 +70,13 @@ void RicNewStatisticsCaseFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmUiItem* RicNewStatisticsCaseFeature::selectedValidUIItem()
|
||||
{
|
||||
std::vector<RimEclipseStatisticsCaseCollection*> statisticsCaseCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &statisticsCaseCollections );
|
||||
|
||||
const auto statisticsCaseCollections = caf::SelectionManager::instance()->objectsByType<RimEclipseStatisticsCaseCollection>();
|
||||
if ( !statisticsCaseCollections.empty() )
|
||||
{
|
||||
return statisticsCaseCollections[0];
|
||||
}
|
||||
|
||||
std::vector<RimCaseCollection*> caseCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &caseCollections );
|
||||
|
||||
const auto caseCollections = caf::SelectionManager::instance()->objectsByType<RimCaseCollection>();
|
||||
if ( !caseCollections.empty() )
|
||||
{
|
||||
if ( RimIdenticalGridCaseGroup::isStatisticsCaseCollection( caseCollections[0] ) )
|
||||
|
||||
@@ -134,13 +134,5 @@ void RicExportCarfin::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RicExportCarfin::selectedCase()
|
||||
{
|
||||
std::vector<RimEclipseCase*> selectedObjects;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
|
||||
|
||||
if ( selectedObjects.size() == 1 )
|
||||
{
|
||||
return selectedObjects[0];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCase>();
|
||||
}
|
||||
@@ -46,11 +46,7 @@ CAF_CMD_SOURCE_INIT( RicExportFaultsFeature, "RicExportFaultsFeature" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportFaultsFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimFaultInView*> selectedFaults;
|
||||
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFaults );
|
||||
|
||||
return ( !selectedFaults.empty() );
|
||||
return ( !caf::SelectionManager::instance()->objectsByType<RimFaultInView>().empty() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -60,10 +56,7 @@ void RicExportFaultsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
disableModelChangeContribution();
|
||||
|
||||
std::vector<RimFaultInView*> selectedFaults;
|
||||
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFaults );
|
||||
|
||||
const auto selectedFaults = caf::SelectionManager::instance()->objectsByType<RimFaultInView>();
|
||||
if ( selectedFaults.empty() ) return;
|
||||
|
||||
QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallbackToProjectFolder( "FAULTS" );
|
||||
|
||||
@@ -152,8 +152,5 @@ void RicSaveEclipseInputPropertyFeature::setupActionLook( QAction* actionToSetup
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseInputProperty* RicSaveEclipseInputPropertyFeature::selectedInputProperty() const
|
||||
{
|
||||
std::vector<RimEclipseInputProperty*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
return !selection.empty() ? selection[0] : nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseInputProperty>();
|
||||
}
|
||||
+2
-18
@@ -44,15 +44,7 @@ bool RicSaveEclipseResultAsInputPropertyFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RicSaveEclipseResultAsInputPropertyFeature::selectedEclipseView() const
|
||||
{
|
||||
std::vector<RimEclipseView*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if ( !selection.empty() )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseView>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -60,15 +52,7 @@ RimEclipseView* RicSaveEclipseResultAsInputPropertyFeature::selectedEclipseView(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCellColors* RicSaveEclipseResultAsInputPropertyFeature::selectedEclipseCellColors() const
|
||||
{
|
||||
std::vector<RimEclipseCellColors*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if ( !selection.empty() )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCellColors>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -54,10 +54,7 @@ CAF_CMD_SOURCE_INIT( RicPlotProductionRateFeature, "RicPlotProductionRateFeature
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicPlotProductionRateFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimSimWellInView*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType( &collection );
|
||||
|
||||
for ( RimSimWellInView* well : collection )
|
||||
for ( RimSimWellInView* well : caf::SelectionManager::instance()->objectsByType<RimSimWellInView>() )
|
||||
{
|
||||
auto summaryCase = RimSimWellInViewTools::summaryCaseForWell( well );
|
||||
if ( summaryCase )
|
||||
@@ -80,12 +77,9 @@ void RicPlotProductionRateFeature::onActionTriggered( bool isChecked )
|
||||
RimSummaryCaseMainCollection* sumCaseColl = project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr;
|
||||
if ( !sumCaseColl ) return;
|
||||
|
||||
std::vector<RimSimWellInView*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType( &collection );
|
||||
|
||||
RimSummaryPlot* summaryPlotToSelect = nullptr;
|
||||
|
||||
for ( RimSimWellInView* well : collection )
|
||||
for ( RimSimWellInView* well : caf::SelectionManager::instance()->objectsByType<RimSimWellInView>() )
|
||||
{
|
||||
auto summaryCase = RimSimWellInViewTools::summaryCaseForWell( well );
|
||||
if ( !summaryCase ) continue;
|
||||
|
||||
@@ -40,12 +40,9 @@ CAF_CMD_SOURCE_INIT( RicShowContributingWellsFeature, "RicShowContributingWellsF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowContributingWellsFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimSimWellInView*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType( &collection );
|
||||
if ( collection.size() == 1 )
|
||||
if ( auto well = caf::SelectionManager::instance()->selectedItemOfType<RimSimWellInView>() )
|
||||
{
|
||||
RimSimWellInView* well = collection[0];
|
||||
RimEclipseView* eclipseView = well->firstAncestorOrThisOfType<RimEclipseView>();
|
||||
RimEclipseView* eclipseView = well->firstAncestorOrThisOfType<RimEclipseView>();
|
||||
|
||||
if ( eclipseView )
|
||||
{
|
||||
@@ -74,13 +71,10 @@ bool RicShowContributingWellsFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowContributingWellsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSimWellInView*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType( &collection );
|
||||
auto well = caf::SelectionManager::instance()->selectedItemOfType<RimSimWellInView>();
|
||||
if ( !well ) return;
|
||||
|
||||
CAF_ASSERT( collection.size() == 1 );
|
||||
|
||||
RimSimWellInView* well = collection[0];
|
||||
RimEclipseView* eclipseView = well->firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
|
||||
RimEclipseView* eclipseView = well->firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
|
||||
|
||||
RimEclipseResultCase* eclipseResultCase = well->firstAncestorOrThisOfTypeAsserted<RimEclipseResultCase>();
|
||||
|
||||
|
||||
@@ -81,9 +81,7 @@ std::set<RimWellAllocationPlot*> RicShowTotalAllocationDataFeature::selectedWell
|
||||
{
|
||||
std::set<RimWellAllocationPlot*> wellAllocPlots;
|
||||
|
||||
std::vector<caf::PdmObject*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
for ( auto obj : objects )
|
||||
for ( auto obj : caf::SelectionManager::instance()->objectsByType<caf::PdmObject>() )
|
||||
{
|
||||
CVF_ASSERT( obj );
|
||||
|
||||
|
||||
@@ -45,17 +45,12 @@ CAF_CMD_SOURCE_INIT( RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowWellAllocationPlotFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimSimWellInView*> simWellCollection;
|
||||
caf::SelectionManager::instance()->objectsByType( &simWellCollection );
|
||||
|
||||
if ( !simWellCollection.empty() )
|
||||
if ( !caf::SelectionManager::instance()->objectsByType<RimSimWellInView>().empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<RimWellPath*> wellPathCollection;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPathCollection );
|
||||
|
||||
const auto wellPathCollection = caf::SelectionManager::instance()->objectsByType<RimWellPath>();
|
||||
if ( wellPathCollection.empty() ) return false;
|
||||
|
||||
Rim3dView* view = RiaApplication::instance()->activeMainOrComparisonGridView();
|
||||
@@ -73,11 +68,8 @@ bool RicShowWellAllocationPlotFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowWellAllocationPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSimWellInView*> collection;
|
||||
caf::SelectionManager::instance()->objectsByType( &collection );
|
||||
|
||||
std::vector<RimWellPath*> wellPathCollection;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPathCollection );
|
||||
const auto collection = caf::SelectionManager::instance()->objectsByType<RimSimWellInView>();
|
||||
const auto wellPathCollection = caf::SelectionManager::instance()->objectsByType<RimWellPath>();
|
||||
|
||||
RimSimWellInView* simWell = nullptr;
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ CAF_CMD_SOURCE_INIT( RicDeleteOptionItemFeature, "RicDeleteOptionItemFeature" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteOptionItemFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RicCreateMultipleFracturesOptionItemUi*> optionItems;
|
||||
caf::SelectionManager::instance()->objectsByType( &optionItems, caf::SelectionManager::FIRST_LEVEL );
|
||||
const auto optionItems =
|
||||
caf::SelectionManager::instance()->objectsByType<RicCreateMultipleFracturesOptionItemUi>( caf::SelectionManager::FIRST_LEVEL );
|
||||
|
||||
if ( !optionItems.empty() )
|
||||
{
|
||||
@@ -62,8 +62,8 @@ void RicDeleteOptionItemFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteOptionItemFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RicCreateMultipleFracturesOptionItemUi*> optionItems;
|
||||
caf::SelectionManager::instance()->objectsByType( &optionItems, caf::SelectionManager::FIRST_LEVEL );
|
||||
const auto optionItems =
|
||||
caf::SelectionManager::instance()->objectsByType<RicCreateMultipleFracturesOptionItemUi>( caf::SelectionManager::FIRST_LEVEL );
|
||||
|
||||
return !optionItems.empty();
|
||||
}
|
||||
@@ -49,8 +49,8 @@ void RicNewOptionItemFeature::onActionTriggered( bool isChecked )
|
||||
RicCreateMultipleFracturesOptionItemUi* selectedOptionItem = nullptr;
|
||||
|
||||
{
|
||||
std::vector<RicCreateMultipleFracturesOptionItemUi*> optionItems;
|
||||
caf::SelectionManager::instance()->objectsByType( &optionItems, caf::SelectionManager::FIRST_LEVEL );
|
||||
const auto optionItems =
|
||||
caf::SelectionManager::instance()->objectsByType<RicCreateMultipleFracturesOptionItemUi>( caf::SelectionManager::FIRST_LEVEL );
|
||||
if ( !optionItems.empty() )
|
||||
{
|
||||
selectedOptionItem = optionItems.front();
|
||||
|
||||
@@ -137,8 +137,7 @@ bool RicNewStimPlanModelFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimStimPlanModelCollection* RicNewStimPlanModelFeature::selectedStimPlanModelCollection()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( selectedItems.size() != 1u ) return nullptr;
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = selectedItems.front();
|
||||
|
||||
@@ -145,13 +145,12 @@ bool RicNewWellPathFractureFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathFractureCollection* RicNewWellPathFractureFeature::selectedWellPathFractureCollection()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> allSelectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( allSelectedItems );
|
||||
if ( allSelectedItems.size() != 1u ) return nullptr;
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( selectedItems.size() != 1u ) return nullptr;
|
||||
|
||||
RimWellPathFractureCollection* objToFind = nullptr;
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = allSelectedItems.front();
|
||||
caf::PdmUiItem* pdmUiItem = selectedItems.front();
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( pdmUiItem );
|
||||
if ( objHandle )
|
||||
@@ -161,8 +160,7 @@ RimWellPathFractureCollection* RicNewWellPathFractureFeature::selectedWellPathFr
|
||||
|
||||
if ( objToFind == nullptr )
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPaths );
|
||||
auto wellPaths = caf::SelectionManager::instance()->objectsByType<RimWellPath>();
|
||||
if ( !wellPaths.empty() )
|
||||
{
|
||||
return wellPaths[0]->fractureCollection();
|
||||
|
||||
@@ -38,10 +38,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGeoMechPropertyFilter*> RicGeoMechPropertyFilterFeatureImpl::selectedPropertyFilters()
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilter*> propertyFilters;
|
||||
caf::SelectionManager::instance()->objectsByType( &propertyFilters );
|
||||
|
||||
return propertyFilters;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimGeoMechPropertyFilter>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -49,10 +46,7 @@ std::vector<RimGeoMechPropertyFilter*> RicGeoMechPropertyFilterFeatureImpl::sele
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGeoMechPropertyFilterCollection*> RicGeoMechPropertyFilterFeatureImpl::selectedPropertyFilterCollections()
|
||||
{
|
||||
std::vector<RimGeoMechPropertyFilterCollection*> propertyFilterCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &propertyFilterCollections );
|
||||
|
||||
return propertyFilterCollections;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimGeoMechPropertyFilterCollection>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
+2
-4
@@ -81,11 +81,9 @@ void RicAppendIntersectionBoxFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionCollection* RicAppendIntersectionBoxFeature::intersectionCollection()
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> selectedObjects;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
|
||||
if ( selectedObjects.size() == 1 )
|
||||
if ( auto selectedObject = caf::SelectionManager::instance()->selectedItemOfType<caf::PdmObjectHandle>() )
|
||||
{
|
||||
return selectedObjects[0]->firstAncestorOrThisOfType<RimIntersectionCollection>();
|
||||
return selectedObject->firstAncestorOrThisOfType<RimIntersectionCollection>();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
+2
-6
@@ -39,9 +39,7 @@ CAF_CMD_SOURCE_INIT( RicExecuteScriptForCasesFeature, "RicExecuteScriptForCasesF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExecuteScriptForCasesFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
const auto selection = caf::SelectionManager::instance()->objectsByType<RimCase>();
|
||||
return !selection.empty();
|
||||
}
|
||||
|
||||
@@ -84,9 +82,7 @@ void RicExecuteScriptForCasesFeature::onActionTriggered( bool isChecked )
|
||||
QStringList arguments = RimCalcScript::createCommandLineArguments( scriptAbsolutePath );
|
||||
std::vector<int> caseIdsInSelection;
|
||||
{
|
||||
std::vector<RimCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
const auto selection = caf::SelectionManager::instance()->objectsByType<RimCase>();
|
||||
for ( RimCase* rimCase : selection )
|
||||
{
|
||||
caseIdsInSelection.push_back( rimCase->caseId() );
|
||||
|
||||
@@ -28,10 +28,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCalcScript*> RicScriptFeatureImpl::selectedScripts()
|
||||
{
|
||||
std::vector<RimCalcScript*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
return selection;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimCalcScript>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -39,8 +36,5 @@ std::vector<RimCalcScript*> RicScriptFeatureImpl::selectedScripts()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimScriptCollection*> RicScriptFeatureImpl::selectedScriptCollections()
|
||||
{
|
||||
std::vector<RimScriptCollection*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
return selection;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimScriptCollection>();
|
||||
}
|
||||
+2
-8
@@ -67,10 +67,7 @@ void RicCopyReferencesToClipboardFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
std::vector<QString> referenceList;
|
||||
|
||||
std::vector<caf::PdmObject*> selectedFormationNamesCollObjs;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
|
||||
|
||||
for ( caf::PdmObject* pdmObject : selectedFormationNamesCollObjs )
|
||||
for ( caf::PdmObject* pdmObject : caf::SelectionManager::instance()->objectsByType<caf::PdmObject>() )
|
||||
{
|
||||
if ( RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported( pdmObject ) )
|
||||
{
|
||||
@@ -106,10 +103,7 @@ void RicCopyReferencesToClipboardFeature::setupActionLook( QAction* actionToSetu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCopyReferencesToClipboardFeature::isAnyCopyableObjectSelected()
|
||||
{
|
||||
std::vector<caf::PdmObject*> selectedFormationNamesCollObjs;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
|
||||
|
||||
for ( caf::PdmObject* pdmObject : selectedFormationNamesCollObjs )
|
||||
for ( caf::PdmObject* pdmObject : caf::SelectionManager::instance()->objectsByType<caf::PdmObject>() )
|
||||
{
|
||||
if ( RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported( pdmObject ) )
|
||||
{
|
||||
|
||||
+2
-8
@@ -52,10 +52,7 @@ void RicCutReferencesToClipboardFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
std::vector<QString> referenceList;
|
||||
|
||||
std::vector<caf::PdmObject*> selectedFormationNamesCollObjs;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
|
||||
|
||||
for ( caf::PdmObject* pdmObject : selectedFormationNamesCollObjs )
|
||||
for ( caf::PdmObject* pdmObject : caf::SelectionManager::instance()->objectsByType<caf::PdmObject>() )
|
||||
{
|
||||
if ( RicCutReferencesToClipboardFeature::isCuttingOfObjectSupported( pdmObject ) )
|
||||
{
|
||||
@@ -91,10 +88,7 @@ void RicCutReferencesToClipboardFeature::setupActionLook( QAction* actionToSetup
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCutReferencesToClipboardFeature::isAnyCuttableObjectSelected()
|
||||
{
|
||||
std::vector<caf::PdmObject*> selectedFormationNamesCollObjs;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
|
||||
|
||||
for ( caf::PdmObject* pdmObject : selectedFormationNamesCollObjs )
|
||||
for ( caf::PdmObject* pdmObject : caf::SelectionManager::instance()->objectsByType<caf::PdmObject>() )
|
||||
{
|
||||
if ( RicCutReferencesToClipboardFeature::isCuttingOfObjectSupported( pdmObject ) )
|
||||
{
|
||||
|
||||
+1
-8
@@ -71,12 +71,5 @@ void RicAppendSummaryCurvesForSummaryAddressesFeature::setupActionLook( QAction*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmObjectHandle*> RicAppendSummaryCurvesForSummaryAddressesFeature::selectedAddresses()
|
||||
{
|
||||
std::vector<RimSummaryAddress*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
// Make the object type general to match the expected type for handleDroppedObjects();
|
||||
std::vector<caf::PdmObjectHandle*> generalObjects;
|
||||
generalObjects.insert( generalObjects.begin(), objects.begin(), objects.end() );
|
||||
|
||||
return generalObjects;
|
||||
return caf::SelectionManager::instance()->objectsByType<caf::PdmObjectHandle>();
|
||||
}
|
||||
+4
-11
@@ -77,18 +77,11 @@ std::vector<caf::PdmObjectHandle*> RicAppendSummaryCurvesForSummaryCasesFeature:
|
||||
// Make the object type general to match the expected type for handleDroppedObjects();
|
||||
std::vector<caf::PdmObjectHandle*> objects;
|
||||
|
||||
{
|
||||
std::vector<RimSummaryCase*> summaryCases;
|
||||
caf::SelectionManager::instance()->objectsByType( &summaryCases );
|
||||
const auto summaryCases = caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
||||
objects.insert( objects.begin(), summaryCases.begin(), summaryCases.end() );
|
||||
|
||||
objects.insert( objects.begin(), summaryCases.begin(), summaryCases.end() );
|
||||
}
|
||||
{
|
||||
std::vector<RimSummaryEnsemble*> ensembles;
|
||||
caf::SelectionManager::instance()->objectsByType( &ensembles );
|
||||
|
||||
objects.insert( objects.begin(), ensembles.begin(), ensembles.end() );
|
||||
}
|
||||
const auto ensembles = caf::SelectionManager::instance()->objectsByType<RimSummaryEnsemble>();
|
||||
objects.insert( objects.begin(), ensembles.begin(), ensembles.end() );
|
||||
|
||||
return objects;
|
||||
}
|
||||
+1
-2
@@ -209,8 +209,7 @@ void RicAppendSummaryPlotsForObjectsFeature::setupActionLook( QAction* actionToS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryAddressCollection*> RicAppendSummaryPlotsForObjectsFeature::selectedCollections()
|
||||
{
|
||||
std::vector<RimSummaryAddressCollection*> sumAddressCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &sumAddressCollections );
|
||||
const auto sumAddressCollections = caf::SelectionManager::instance()->objectsByType<RimSummaryAddressCollection>();
|
||||
|
||||
if ( sumAddressCollections.size() == 1 )
|
||||
{
|
||||
|
||||
+1
-4
@@ -92,8 +92,5 @@ void RicAppendSummaryPlotsForSummaryAddressesFeature::setupActionLook( QAction*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryAddress*> RicAppendSummaryPlotsForSummaryAddressesFeature::selectedAddresses()
|
||||
{
|
||||
std::vector<RimSummaryAddress*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
return objects;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimSummaryAddress>();
|
||||
}
|
||||
+2
-8
@@ -75,10 +75,7 @@ void RicAppendSummaryPlotsForSummaryCasesFeature::setupActionLook( QAction* acti
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCase*> RicAppendSummaryPlotsForSummaryCasesFeature::selectedCases()
|
||||
{
|
||||
std::vector<RimSummaryCase*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
return objects;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -86,8 +83,5 @@ std::vector<RimSummaryCase*> RicAppendSummaryPlotsForSummaryCasesFeature::select
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryEnsemble*> RicAppendSummaryPlotsForSummaryCasesFeature::selectedEnsembles()
|
||||
{
|
||||
std::vector<RimSummaryEnsemble*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
return objects;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimSummaryEnsemble>();
|
||||
}
|
||||
@@ -69,10 +69,9 @@ bool RicNewMultiPlotFeature::isCommandEnabled() const
|
||||
{
|
||||
auto plots = selectedPlots();
|
||||
|
||||
std::vector<caf::PdmUiItem*> selectedUiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedUiItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
|
||||
return !plots.empty() && plots.size() == selectedUiItems.size();
|
||||
return !plots.empty() && plots.size() == selectedItems.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -103,11 +102,8 @@ void RicNewMultiPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlot*> RicNewMultiPlotFeature::selectedPlots()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
|
||||
std::vector<RimPlot*> plots;
|
||||
for ( caf::PdmUiItem* uiItem : uiItems )
|
||||
for ( caf::PdmUiItem* uiItem : caf::SelectionManager::instance()->selectedItems() )
|
||||
{
|
||||
RimPlot* plotInterface = dynamic_cast<RimPlot*>( uiItem );
|
||||
// Special case for all well log tracks which currently need to be in Well Log Plot for
|
||||
|
||||
@@ -39,10 +39,9 @@ CAF_CMD_SOURCE_INIT( RicNewSummaryMultiPlotFeature, "RicNewSummaryMultiPlotFeatu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSummaryMultiPlotFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedUiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedUiItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
|
||||
if ( selectedCollection( selectedUiItems ) ) return true;
|
||||
if ( selectedCollection( selectedItems ) ) return true;
|
||||
|
||||
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
|
||||
std::vector<RimSummaryEnsemble*> selectedEnsembles;
|
||||
@@ -54,13 +53,12 @@ bool RicNewSummaryMultiPlotFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryMultiPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedUiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedUiItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
|
||||
std::vector<RimSummaryCase*> selectedIndividualSummaryCases;
|
||||
std::vector<RimSummaryEnsemble*> selectedEnsembles;
|
||||
|
||||
RimSummaryMultiPlotCollection* coll = selectedCollection( selectedUiItems );
|
||||
RimSummaryMultiPlotCollection* coll = selectedCollection( selectedItems );
|
||||
if ( coll )
|
||||
{
|
||||
auto ensembles = RimProject::current()->summaryGroups();
|
||||
@@ -95,7 +93,7 @@ void RicNewSummaryMultiPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlotCollection* RicNewSummaryMultiPlotFeature::selectedCollection( std::vector<caf::PdmUiItem*>& items )
|
||||
RimSummaryMultiPlotCollection* RicNewSummaryMultiPlotFeature::selectedCollection( const std::vector<caf::PdmUiItem*>& items )
|
||||
{
|
||||
for ( caf::PdmUiItem* uiItem : items )
|
||||
{
|
||||
@@ -113,12 +111,12 @@ bool RicNewSummaryMultiPlotFeature::selectedCases( std::vector<RimSummaryCase*>*
|
||||
{
|
||||
CAF_ASSERT( selectedIndividualSummaryCases && selectedEnsembles );
|
||||
|
||||
caf::SelectionManager::instance()->objectsByTypeStrict( selectedEnsembles );
|
||||
*selectedIndividualSummaryCases = caf::SelectionManager::instance()->objectsByTypeStrict<RimSummaryCase>();
|
||||
if ( !selectedEnsembles->empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Second try selected summary cases
|
||||
caf::SelectionManager::instance()->objectsByTypeStrict( selectedIndividualSummaryCases );
|
||||
*selectedEnsembles = caf::SelectionManager::instance()->objectsByTypeStrict<RimSummaryEnsemble>();
|
||||
return !selectedIndividualSummaryCases->empty();
|
||||
}
|
||||
@@ -41,7 +41,7 @@ protected:
|
||||
void setupActionLook( QAction* actionToSetup ) override;
|
||||
|
||||
private:
|
||||
static RimSummaryMultiPlotCollection* selectedCollection( std::vector<caf::PdmUiItem*>& items );
|
||||
static RimSummaryMultiPlotCollection* selectedCollection( const std::vector<caf::PdmUiItem*>& items );
|
||||
|
||||
static bool selectedCases( std::vector<RimSummaryCase*>* selectedIndividualSummaryCases,
|
||||
std::vector<RimSummaryEnsemble*>* selectedEnsembles );
|
||||
|
||||
+1
-3
@@ -42,9 +42,7 @@ CAF_CMD_SOURCE_INIT( RicNewSummaryMultiPlotFromDataVectorFeature, "RicNewSummary
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSummaryMultiPlotFromDataVectorFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
std::vector<RimSummaryAddress*> selectedAddressItems = caf::selectedObjectsByType<RimSummaryAddress*>();
|
||||
|
||||
unsigned int nEnsembles = 0;
|
||||
|
||||
+1
-3
@@ -40,9 +40,7 @@ CAF_CMD_SOURCE_INIT( RicNewSummaryPlotFromDataVectorFeature, "RicNewSummaryPlotF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewSummaryPlotFromDataVectorFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
std::vector<RimSummaryAddress*> selectedAddressItems = caf::selectedObjectsByType<RimSummaryAddress*>();
|
||||
|
||||
unsigned int nEnsembles = 0;
|
||||
|
||||
@@ -105,10 +105,8 @@ RimSummaryPlot* RicSplitMultiPlotFeature::getSelectedPlot() const
|
||||
|
||||
if ( plot == nullptr )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedUiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedUiItems );
|
||||
|
||||
if ( !selectedUiItems.empty() ) plot = dynamic_cast<RimSummaryPlot*>( selectedUiItems[0] );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( !selectedItems.empty() ) plot = dynamic_cast<RimSummaryPlot*>( selectedItems[0] );
|
||||
}
|
||||
|
||||
return plot;
|
||||
|
||||
+6
-9
@@ -46,11 +46,10 @@ CAF_CMD_SOURCE_INIT( RicCreateNewPlotFromTemplateFeature, "RicCreateNewPlotFromT
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateNewPlotFromTemplateFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
if ( uiItems.size() != 1 ) return false;
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( selectedItems.size() != 1 ) return false;
|
||||
|
||||
RimPlotTemplateFileItem* file = dynamic_cast<RimPlotTemplateFileItem*>( uiItems[0] );
|
||||
RimPlotTemplateFileItem* file = dynamic_cast<RimPlotTemplateFileItem*>( selectedItems[0] );
|
||||
return ( file != nullptr );
|
||||
}
|
||||
|
||||
@@ -59,12 +58,10 @@ bool RicCreateNewPlotFromTemplateFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateNewPlotFromTemplateFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( selectedItems.size() != 1 ) return;
|
||||
|
||||
if ( uiItems.size() != 1 ) return;
|
||||
|
||||
RimPlotTemplateFileItem* file = dynamic_cast<RimPlotTemplateFileItem*>( uiItems[0] );
|
||||
RimPlotTemplateFileItem* file = dynamic_cast<RimPlotTemplateFileItem*>( selectedItems[0] );
|
||||
if ( file == nullptr ) return;
|
||||
|
||||
RimSummaryMultiPlot* plot = nullptr;
|
||||
|
||||
@@ -40,12 +40,8 @@ CAF_CMD_SOURCE_INIT( RicDeletePlotTemplateFeature, "RicDeletePlotTemplateFeature
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeletePlotTemplateFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
if ( uiItems.size() != 1 ) return false;
|
||||
|
||||
RimPlotTemplateFileItem* file = dynamic_cast<RimPlotTemplateFileItem*>( uiItems[0] );
|
||||
return ( file != nullptr );
|
||||
auto object = caf::SelectionManager::instance()->selectedItemOfType<RimPlotTemplateFileItem>();
|
||||
return object != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -53,12 +49,7 @@ bool RicDeletePlotTemplateFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeletePlotTemplateFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
|
||||
if ( uiItems.size() != 1 ) return;
|
||||
|
||||
RimPlotTemplateFileItem* file = dynamic_cast<RimPlotTemplateFileItem*>( uiItems[0] );
|
||||
auto file = caf::SelectionManager::instance()->selectedItemOfType<RimPlotTemplateFileItem>();
|
||||
if ( file == nullptr ) return;
|
||||
|
||||
QWidget* parent = RiuPlotMainWindow::instance();
|
||||
|
||||
@@ -38,11 +38,7 @@ CAF_CMD_SOURCE_INIT( RicRenamePlotTemplateFeature, "RicRenamePlotTemplateFeature
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicRenamePlotTemplateFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
if ( uiItems.size() != 1 ) return false;
|
||||
|
||||
RimPlotTemplateFileItem* file = dynamic_cast<RimPlotTemplateFileItem*>( uiItems[0] );
|
||||
auto file = caf::SelectionManager::instance()->selectedItemOfType<RimPlotTemplateFileItem>();
|
||||
return ( file != nullptr );
|
||||
}
|
||||
|
||||
@@ -51,12 +47,7 @@ bool RicRenamePlotTemplateFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicRenamePlotTemplateFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
|
||||
if ( uiItems.size() != 1 ) return;
|
||||
|
||||
RimPlotTemplateFileItem* file = dynamic_cast<RimPlotTemplateFileItem*>( uiItems[0] );
|
||||
auto file = caf::SelectionManager::instance()->selectedItemOfType<RimPlotTemplateFileItem>();
|
||||
if ( file == nullptr ) return;
|
||||
|
||||
QFileInfo fi( file->absoluteFilePath() );
|
||||
|
||||
@@ -78,10 +78,5 @@ void RicSetAsDefaultTemplateFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotTemplateFileItem* RicSetAsDefaultTemplateFeature::selectedTemplate() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
if ( uiItems.size() != 1 ) return nullptr;
|
||||
|
||||
RimPlotTemplateFileItem* file = dynamic_cast<RimPlotTemplateFileItem*>( uiItems[0] );
|
||||
return file;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimPlotTemplateFileItem>();
|
||||
}
|
||||
@@ -114,9 +114,7 @@ void RicCloseCaseFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCase*> RicCloseCaseFeature::selectedCases() const
|
||||
{
|
||||
std::vector<RimCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
return selection;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimCase>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -99,11 +99,8 @@ void RicCloseObservedDataFeature::deleteObservedRmuRftData( const std::vector<Ri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCloseObservedDataFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimObservedSummaryData*> summarySelection;
|
||||
caf::SelectionManager::instance()->objectsByType( &summarySelection );
|
||||
|
||||
std::vector<RimObservedFmuRftData*> fmuRftSelection;
|
||||
caf::SelectionManager::instance()->objectsByType( &fmuRftSelection );
|
||||
const auto summarySelection = caf::SelectionManager::instance()->objectsByType<RimObservedSummaryData>();
|
||||
const auto fmuRftSelection = caf::SelectionManager::instance()->objectsByType<RimObservedFmuRftData>();
|
||||
|
||||
if ( summarySelection.empty() && fmuRftSelection.empty() )
|
||||
{
|
||||
@@ -125,11 +122,8 @@ bool RicCloseObservedDataFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCloseObservedDataFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimObservedSummaryData*> summarySelection;
|
||||
caf::SelectionManager::instance()->objectsByType( &summarySelection );
|
||||
|
||||
std::vector<RimObservedFmuRftData*> fmuRftSelection;
|
||||
caf::SelectionManager::instance()->objectsByType( &fmuRftSelection );
|
||||
const auto summarySelection = caf::SelectionManager::instance()->objectsByType<RimObservedSummaryData>();
|
||||
const auto fmuRftSelection = caf::SelectionManager::instance()->objectsByType<RimObservedFmuRftData>();
|
||||
|
||||
CVF_ASSERT( !( summarySelection.empty() && fmuRftSelection.empty() ) );
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ void RicCloseSummaryCaseFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector<RimSummaryCase*>& cases )
|
||||
void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector<RimSummaryCase*> cases )
|
||||
{
|
||||
RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection();
|
||||
RimSummaryCaseMainCollection* summaryCaseMainCollection = RiaSummaryTools::summaryCaseMainCollection();
|
||||
@@ -105,9 +105,7 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector<RimSummaryCase*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCloseSummaryCaseFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimSummaryCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
const auto selection = caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
||||
if ( selection.empty() )
|
||||
{
|
||||
return false;
|
||||
@@ -128,9 +126,5 @@ bool RicCloseSummaryCaseFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCloseSummaryCaseFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSummaryCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
CVF_ASSERT( !selection.empty() );
|
||||
|
||||
RicCloseSummaryCaseFeature::deleteSummaryCases( selection );
|
||||
RicCloseSummaryCaseFeature::deleteSummaryCases( caf::SelectionManager::instance()->objectsByType<RimSummaryCase>() );
|
||||
}
|
||||
@@ -33,7 +33,7 @@ class RicCloseSummaryCaseFeature : public caf::CmdFeature
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static void deleteSummaryCases( std::vector<RimSummaryCase*>& cases );
|
||||
static void deleteSummaryCases( std::vector<RimSummaryCase*> cases );
|
||||
|
||||
protected:
|
||||
bool isCommandEnabled() const override;
|
||||
|
||||
@@ -55,11 +55,8 @@ void RicCloseSummaryCaseInCollectionFeature::setupActionLook( QAction* actionToS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCloseSummaryCaseInCollectionFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimSummaryCaseMainCollection*> summaryCaseMainCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &summaryCaseMainCollections );
|
||||
|
||||
std::vector<RimSummaryEnsemble*> summaryCaseCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &summaryCaseCollections );
|
||||
auto summaryCaseMainCollections = caf::SelectionManager::instance()->objectsByType<RimSummaryCaseMainCollection>();
|
||||
auto summaryCaseCollections = caf::SelectionManager::instance()->objectsByType<RimSummaryEnsemble>();
|
||||
|
||||
summaryCaseCollections.erase( std::remove_if( summaryCaseCollections.begin(),
|
||||
summaryCaseCollections.end(),
|
||||
@@ -75,18 +72,14 @@ bool RicCloseSummaryCaseInCollectionFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCloseSummaryCaseInCollectionFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSummaryCaseMainCollection*> summaryCaseMainCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &summaryCaseMainCollections );
|
||||
|
||||
auto summaryCaseMainCollections = caf::SelectionManager::instance()->objectsByType<RimSummaryCaseMainCollection>();
|
||||
if ( !summaryCaseMainCollections.empty() )
|
||||
{
|
||||
std::vector<RimSummaryCase*> allSummaryCases = summaryCaseMainCollections[0]->allSummaryCases();
|
||||
RicCloseSummaryCaseFeature::deleteSummaryCases( allSummaryCases );
|
||||
}
|
||||
|
||||
std::vector<RimSummaryEnsemble*> summaryCaseCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &summaryCaseCollections );
|
||||
|
||||
auto summaryCaseCollections = caf::SelectionManager::instance()->objectsByType<RimSummaryEnsemble>();
|
||||
for ( RimSummaryEnsemble* summaryCaseCollection : summaryCaseCollections )
|
||||
{
|
||||
std::vector<RimSummaryCase*> collectionSummaryCases = summaryCaseCollection->allSummaryCases();
|
||||
|
||||
@@ -33,9 +33,7 @@ CAF_CMD_SOURCE_INIT( RicCreateSummaryEnsembleFeature, "RicCreateSummaryEnsembleF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicCreateSummaryEnsembleFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimSummaryCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
const auto selection = caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
||||
return !selection.empty();
|
||||
}
|
||||
|
||||
@@ -44,8 +42,7 @@ bool RicCreateSummaryEnsembleFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateSummaryEnsembleFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSummaryCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
const auto selection = caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
||||
if ( selection.empty() ) return;
|
||||
|
||||
RicImportEnsembleFeature::createSummaryEnsemble( selection );
|
||||
|
||||
@@ -37,12 +37,11 @@ CAF_CMD_SOURCE_INIT( RicDeleteItemFeature, "RicDeleteItemFeature" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteItemFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> items;
|
||||
caf::SelectionManager::instance()->selectedItems( items );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
|
||||
if ( items.empty() ) return false;
|
||||
if ( selectedItems.empty() ) return false;
|
||||
|
||||
for ( caf::PdmUiItem* item : items )
|
||||
for ( caf::PdmUiItem* item : selectedItems )
|
||||
{
|
||||
auto* currentPdmObject = dynamic_cast<caf::PdmObject*>( item );
|
||||
if ( !currentPdmObject ) return false;
|
||||
@@ -61,10 +60,7 @@ bool RicDeleteItemFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteItemFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> items;
|
||||
caf::SelectionManager::instance()->selectedItems( items );
|
||||
|
||||
for ( caf::PdmUiItem* item : items )
|
||||
for ( caf::PdmUiItem* item : caf::SelectionManager::instance()->selectedItems() )
|
||||
{
|
||||
auto* currentPdmObject = dynamic_cast<caf::PdmObject*>( item );
|
||||
if ( !currentPdmObject ) continue;
|
||||
|
||||
@@ -31,8 +31,7 @@ CAF_CMD_SOURCE_INIT( RicDeletePressureTableItemFeature, "RicDeletePressureTableI
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeletePressureTableItemFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimPressureTableItem*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects, caf::SelectionManager::FIRST_LEVEL );
|
||||
auto objects = caf::SelectionManager::instance()->objectsByType<RimPressureTableItem>( caf::SelectionManager::FIRST_LEVEL );
|
||||
return !objects.empty();
|
||||
}
|
||||
|
||||
@@ -41,12 +40,11 @@ bool RicDeletePressureTableItemFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeletePressureTableItemFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimPressureTableItem*> items;
|
||||
caf::SelectionManager::instance()->objectsByType( &items, caf::SelectionManager::FIRST_LEVEL );
|
||||
if ( !items.empty() )
|
||||
auto objects = caf::SelectionManager::instance()->objectsByType<RimPressureTableItem>( caf::SelectionManager::FIRST_LEVEL );
|
||||
if ( !objects.empty() )
|
||||
{
|
||||
RimPressureTable* pressureTable = items[0]->firstAncestorOrThisOfTypeAsserted<RimPressureTable>();
|
||||
for ( RimPressureTableItem* attributeToDelete : items )
|
||||
RimPressureTable* pressureTable = objects[0]->firstAncestorOrThisOfTypeAsserted<RimPressureTable>();
|
||||
for ( RimPressureTableItem* attributeToDelete : objects )
|
||||
{
|
||||
pressureTable->deleteItem( attributeToDelete );
|
||||
}
|
||||
|
||||
@@ -49,12 +49,10 @@ bool RicDeleteSubItemsFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteSubItemsFeature::canCommandBeEnabled()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> items;
|
||||
caf::SelectionManager::instance()->selectedItems( items );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( selectedItems.empty() ) return false;
|
||||
|
||||
if ( items.empty() ) return false;
|
||||
|
||||
for ( auto* item : items )
|
||||
for ( auto* item : selectedItems )
|
||||
{
|
||||
if ( !RicDeleteSubItemsFeature::hasDeletableSubItems( item ) ) return false;
|
||||
}
|
||||
@@ -134,12 +132,7 @@ bool RicDeleteSubItemsFeature::hasDeletableSubItems( caf::PdmUiItem* uiItem )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteSubItemsFeature::deleteSubItems( bool onlyDeleteUnchecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> items;
|
||||
caf::SelectionManager::instance()->selectedItems( items );
|
||||
|
||||
CVF_ASSERT( !items.empty() );
|
||||
|
||||
for ( auto item : items )
|
||||
for ( auto item : caf::SelectionManager::instance()->selectedItems() )
|
||||
{
|
||||
if ( !RicDeleteSubItemsFeature::hasDeletableSubItems( item ) ) continue;
|
||||
|
||||
|
||||
@@ -68,8 +68,7 @@ void RicDeleteSummaryCaseCollectionFeature::deleteSummaryCaseCollection( RimSumm
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteSummaryCaseCollectionFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimSummaryEnsemble*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
auto selection = caf::SelectionManager::instance()->objectsByType<RimSummaryEnsemble>();
|
||||
|
||||
selection.erase( std::remove_if( selection.begin(),
|
||||
selection.end(),
|
||||
@@ -83,8 +82,7 @@ bool RicDeleteSummaryCaseCollectionFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteSummaryCaseCollectionFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSummaryEnsemble*> ensembles;
|
||||
caf::SelectionManager::instance()->objectsByType( &ensembles );
|
||||
const auto ensembles = caf::SelectionManager::instance()->objectsByType<RimSummaryEnsemble>();
|
||||
if ( ensembles.empty() ) return;
|
||||
|
||||
QMessageBox msgBox;
|
||||
|
||||
@@ -32,8 +32,7 @@ CAF_CMD_SOURCE_INIT( RicDeleteWellMeasurementFilePathFeature, "RicDeleteWellMeas
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicDeleteWellMeasurementFilePathFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimWellMeasurementFilePath*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<RimWellMeasurementFilePath>();
|
||||
return !objects.empty();
|
||||
}
|
||||
|
||||
@@ -42,8 +41,7 @@ bool RicDeleteWellMeasurementFilePathFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteWellMeasurementFilePathFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimWellMeasurementFilePath*> selectedFilePaths;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFilePaths );
|
||||
const auto selectedFilePaths = caf::SelectionManager::instance()->objectsByType<RimWellMeasurementFilePath>();
|
||||
if ( selectedFilePaths.empty() ) return;
|
||||
|
||||
RimWellMeasurementFilePath* filePath = selectedFilePaths[0];
|
||||
|
||||
@@ -105,10 +105,7 @@ cvf::BoundingBox RicFlyToObjectFeature::boundingBoxForSelectedObjects()
|
||||
{
|
||||
cvf::BoundingBox bb;
|
||||
|
||||
std::vector<Rim3dPropertiesInterface*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
for ( auto obj : objects )
|
||||
for ( auto obj : caf::SelectionManager::instance()->objectsByType<Rim3dPropertiesInterface>() )
|
||||
{
|
||||
if ( obj )
|
||||
{
|
||||
|
||||
@@ -40,14 +40,13 @@ CAF_CMD_SOURCE_INIT( RicImportElementPropertyFeature, "RicImportElementPropertyF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportElementPropertyFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
|
||||
RimGeoMechCase* geomCase = nullptr;
|
||||
|
||||
if ( !uiItems.empty() )
|
||||
if ( !selectedItems.empty() )
|
||||
{
|
||||
geomCase = dynamic_cast<RimGeoMechCase*>( uiItems[0] );
|
||||
geomCase = dynamic_cast<RimGeoMechCase*>( selectedItems[0] );
|
||||
}
|
||||
|
||||
if ( geomCase == nullptr )
|
||||
|
||||
@@ -93,11 +93,8 @@ void RicImportObservedDataFeature::selectObservedDataFileInDialog()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportObservedDataFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimObservedDataCollection*> selectionObservedDataCollection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectionObservedDataCollection );
|
||||
|
||||
std::vector<RimObservedSummaryData*> selectionObservedData;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectionObservedData );
|
||||
const auto selectionObservedDataCollection = caf::SelectionManager::instance()->objectsByType<RimObservedDataCollection>();
|
||||
const auto selectionObservedData = caf::SelectionManager::instance()->objectsByType<RimObservedSummaryData>();
|
||||
|
||||
return ( !selectionObservedDataCollection.empty() || !selectionObservedData.empty() );
|
||||
}
|
||||
|
||||
@@ -96,11 +96,8 @@ void RicImportObservedFmuDataFeature::selectObservedDataPathInDialog()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportObservedFmuDataFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimObservedDataCollection*> selectionObservedDataCollection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectionObservedDataCollection );
|
||||
|
||||
std::vector<RimObservedSummaryData*> selectionObservedData;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectionObservedData );
|
||||
const auto selectionObservedDataCollection = caf::SelectionManager::instance()->objectsByType<RimObservedDataCollection>();
|
||||
const auto selectionObservedData = caf::SelectionManager::instance()->objectsByType<RimObservedSummaryData>();
|
||||
|
||||
return ( !selectionObservedDataCollection.empty() || !selectionObservedData.empty() );
|
||||
}
|
||||
|
||||
@@ -77,11 +77,8 @@ void RicImportPressureDepthDataFeature::selectPressureDepthDataPathInDialog()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportPressureDepthDataFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimObservedDataCollection*> selectionObservedDataCollection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectionObservedDataCollection );
|
||||
|
||||
std::vector<RimObservedSummaryData*> selectionObservedData;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectionObservedData );
|
||||
const auto selectionObservedDataCollection = caf::SelectionManager::instance()->objectsByType<RimObservedDataCollection>();
|
||||
const auto selectionObservedData = caf::SelectionManager::instance()->objectsByType<RimObservedSummaryData>();
|
||||
|
||||
return ( !selectionObservedDataCollection.empty() || !selectionObservedData.empty() );
|
||||
}
|
||||
|
||||
@@ -78,13 +78,5 @@ void RicNewStatisticsContourMapFeature::setupActionLook( QAction* actionToSetup
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCaseEnsemble* RicNewStatisticsContourMapFeature::selectedEclipseCaseEnsemble()
|
||||
{
|
||||
std::vector<RimEclipseCaseEnsemble*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if ( !selection.empty() )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCaseEnsemble>();
|
||||
}
|
||||
@@ -159,15 +159,7 @@ Rim3dView* RicNewViewFeature::createReservoirView( RimEclipseCase* eclipseCase,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCase* RicNewViewFeature::selectedEclipseCase()
|
||||
{
|
||||
std::vector<RimEclipseCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if ( !selection.empty() )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCase>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -175,15 +167,7 @@ RimEclipseCase* RicNewViewFeature::selectedEclipseCase()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RicNewViewFeature::selectedGeoMechCase()
|
||||
{
|
||||
std::vector<RimGeoMechCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if ( !selection.empty() )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimGeoMechCase>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -191,9 +175,7 @@ RimGeoMechCase* RicNewViewFeature::selectedGeoMechCase()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RicNewViewFeature::selectedEclipseView()
|
||||
{
|
||||
std::vector<RimEclipseView*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
const auto selection = caf::SelectionManager::instance()->objectsByType<RimEclipseView>();
|
||||
for ( RimEclipseView* view : selection )
|
||||
{
|
||||
if ( dynamic_cast<RimEclipseContourMapView*>( view ) == nullptr )
|
||||
@@ -210,10 +192,7 @@ RimEclipseView* RicNewViewFeature::selectedEclipseView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseViewCollection* RicNewViewFeature::selectedEclipseViewCollection()
|
||||
{
|
||||
std::vector<RimEclipseViewCollection*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
if ( !selection.empty() ) return selection[0];
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseViewCollection>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -221,10 +200,7 @@ RimEclipseViewCollection* RicNewViewFeature::selectedEclipseViewCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCaseEnsemble* RicNewViewFeature::selectedEclipseCaseEnsemble()
|
||||
{
|
||||
std::vector<RimEclipseCaseEnsemble*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
if ( !selection.empty() ) return selection[0];
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCaseEnsemble>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -232,13 +208,5 @@ RimEclipseCaseEnsemble* RicNewViewFeature::selectedEclipseCaseEnsemble()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechView* RicNewViewFeature::selectedGeoMechView()
|
||||
{
|
||||
std::vector<RimGeoMechView*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if ( !selection.empty() )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimGeoMechView>();
|
||||
}
|
||||
@@ -84,13 +84,5 @@ void RicNewViewForGridEnsembleFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseCaseEnsemble* RicNewViewForGridEnsembleFeature::selectedEclipseCaseEnsemble()
|
||||
{
|
||||
std::vector<RimEclipseCaseEnsemble*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
if ( !selection.empty() )
|
||||
{
|
||||
return selection[0];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCaseEnsemble>();
|
||||
}
|
||||
@@ -39,17 +39,8 @@ CAF_CMD_SOURCE_INIT( RicReloadCaseFeature, "RicReloadCaseFeature" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicReloadCaseFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmObject*> selectedFormationNamesCollObjs;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
|
||||
for ( caf::PdmObject* pdmObject : selectedFormationNamesCollObjs )
|
||||
{
|
||||
if ( dynamic_cast<RimEclipseCase*>( pdmObject ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
const auto eclipseCases = caf::SelectionManager::instance()->objectsByType<RimEclipseCase>();
|
||||
return !eclipseCases.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -57,9 +48,7 @@ bool RicReloadCaseFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicReloadCaseFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimEclipseCase*> selectedEclipseCases;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedEclipseCases );
|
||||
|
||||
const auto selectedEclipseCases = caf::SelectionManager::instance()->objectsByType<RimEclipseCase>();
|
||||
RiaGuiApplication::clearAllSelections();
|
||||
|
||||
for ( RimEclipseCase* selectedCase : selectedEclipseCases )
|
||||
|
||||
@@ -34,10 +34,8 @@ CAF_CMD_SOURCE_INIT( RicReloadFormationNamesFeature, "RicReloadFormationNamesFea
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicReloadFormationNamesFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimFormationNames*> selectedFormationNamesObjs;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesObjs );
|
||||
std::vector<RimFormationNamesCollection*> selectedFormationNamesCollObjs;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
|
||||
const auto selectedFormationNamesObjs = caf::SelectionManager::instance()->objectsByType<RimFormationNames>();
|
||||
const auto selectedFormationNamesCollObjs = caf::SelectionManager::instance()->objectsByType<RimFormationNamesCollection>();
|
||||
|
||||
return ( !selectedFormationNamesObjs.empty() || !selectedFormationNamesCollObjs.empty() );
|
||||
}
|
||||
@@ -47,9 +45,7 @@ bool RicReloadFormationNamesFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicReloadFormationNamesFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimFormationNamesCollection*> selectedFormationNamesCollObjs;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
|
||||
|
||||
const auto selectedFormationNamesCollObjs = caf::SelectionManager::instance()->objectsByType<RimFormationNamesCollection>();
|
||||
if ( !selectedFormationNamesCollObjs.empty() )
|
||||
{
|
||||
selectedFormationNamesCollObjs[0]->readAllFormationNames();
|
||||
@@ -61,8 +57,7 @@ void RicReloadFormationNamesFeature::onActionTriggered( bool isChecked )
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<RimFormationNames*> selectedFormationNamesObjs;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesObjs );
|
||||
const auto selectedFormationNamesObjs = caf::SelectionManager::instance()->objectsByType<RimFormationNames>();
|
||||
for ( RimFormationNames* fnames : selectedFormationNamesObjs )
|
||||
{
|
||||
QString errorMessage;
|
||||
|
||||
@@ -33,9 +33,7 @@ CAF_CMD_SOURCE_INIT( RicReloadPressureDepthDataFeature, "RicReloadPressureDepthD
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicReloadPressureDepthDataFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimPressureDepthData*> pressureDepthDataObjects;
|
||||
caf::SelectionManager::instance()->objectsByType( &pressureDepthDataObjects );
|
||||
|
||||
const auto pressureDepthDataObjects = caf::SelectionManager::instance()->objectsByType<RimPressureDepthData>();
|
||||
for ( RimPressureDepthData* pressureDepthData : pressureDepthDataObjects )
|
||||
{
|
||||
pressureDepthData->createRftReaderInterface();
|
||||
|
||||
@@ -72,22 +72,16 @@ void RicReloadSummaryCaseFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCase*> RicReloadSummaryCaseFeature::selectedSummaryCases()
|
||||
{
|
||||
std::vector<RimSummaryCaseMainCollection*> mainCollectionSelection;
|
||||
caf::SelectionManager::instance()->objectsByType( &mainCollectionSelection );
|
||||
|
||||
const auto mainCollectionSelection = caf::SelectionManager::instance()->objectsByType<RimSummaryCaseMainCollection>();
|
||||
if ( !mainCollectionSelection.empty() )
|
||||
{
|
||||
return mainCollectionSelection[0]->allSummaryCases();
|
||||
}
|
||||
|
||||
std::vector<RimSummaryCase*> caseSelection;
|
||||
caf::SelectionManager::instance()->objectsByType( &caseSelection );
|
||||
std::vector<RimSummaryCase*> caseSelection = caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
||||
|
||||
{
|
||||
std::vector<RimSummaryEnsemble*> collectionSelection;
|
||||
caf::SelectionManager::instance()->objectsByType( &collectionSelection );
|
||||
|
||||
for ( auto collection : collectionSelection )
|
||||
for ( auto collection : caf::SelectionManager::instance()->objectsByType<RimSummaryEnsemble>() )
|
||||
{
|
||||
std::vector<RimSummaryCase*> summaryCaseCollection = collection->allSummaryCases();
|
||||
caseSelection.insert( caseSelection.end(), summaryCaseCollection.begin(), summaryCaseCollection.end() );
|
||||
@@ -95,10 +89,7 @@ std::vector<RimSummaryCase*> RicReloadSummaryCaseFeature::selectedSummaryCases()
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<RimObservedDataCollection*> collectionSelection;
|
||||
caf::SelectionManager::instance()->objectsByType( &collectionSelection );
|
||||
|
||||
for ( auto collection : collectionSelection )
|
||||
for ( auto collection : caf::SelectionManager::instance()->objectsByType<RimObservedDataCollection>() )
|
||||
{
|
||||
std::vector<RimObservedSummaryData*> observedCases = collection->allObservedSummaryData();
|
||||
caseSelection.insert( caseSelection.end(), observedCases.begin(), observedCases.end() );
|
||||
|
||||
@@ -36,8 +36,7 @@ CAF_CMD_SOURCE_INIT( RicReloadWellMeasurementsFeature, "RicReloadWellMeasurement
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicReloadWellMeasurementsFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimWellMeasurementFilePath*> filePaths;
|
||||
caf::SelectionManager::instance()->objectsByType( &filePaths );
|
||||
const auto filePaths = caf::SelectionManager::instance()->objectsByType<RimWellMeasurementFilePath>();
|
||||
return !filePaths.empty();
|
||||
}
|
||||
|
||||
@@ -46,8 +45,7 @@ bool RicReloadWellMeasurementsFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicReloadWellMeasurementsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimWellMeasurementFilePath*> filePaths;
|
||||
caf::SelectionManager::instance()->objectsByType( &filePaths );
|
||||
const auto filePaths = caf::SelectionManager::instance()->objectsByType<RimWellMeasurementFilePath>();
|
||||
if ( filePaths.empty() ) return;
|
||||
|
||||
RicWellMeasurementImportTools::removeWellMeasurementsFromFiles( filePaths );
|
||||
|
||||
@@ -33,13 +33,10 @@ CAF_CMD_SOURCE_INIT( RicReloadWellPathFormationNamesFeature, "RicReloadWellPathF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicReloadWellPathFormationNamesFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPaths );
|
||||
const auto wellPaths = caf::SelectionManager::instance()->objectsByType<RimWellPath>();
|
||||
const auto wellPathCollections = caf::SelectionManager::instance()->objectsByType<RimWellPathCollection>();
|
||||
|
||||
std::vector<RimWellPathCollection*> wellPathCollection;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPathCollection );
|
||||
|
||||
return ( !wellPaths.empty() || !wellPathCollection.empty() );
|
||||
return ( !wellPaths.empty() || !wellPathCollections.empty() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -47,11 +44,8 @@ bool RicReloadWellPathFormationNamesFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicReloadWellPathFormationNamesFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPaths );
|
||||
|
||||
std::vector<RimWellPathCollection*> wellPathCollections;
|
||||
caf::SelectionManager::instance()->objectsByType( &wellPathCollections );
|
||||
const auto wellPaths = caf::SelectionManager::instance()->objectsByType<RimWellPath>();
|
||||
const auto wellPathCollections = caf::SelectionManager::instance()->objectsByType<RimWellPathCollection>();
|
||||
|
||||
if ( !wellPaths.empty() )
|
||||
{
|
||||
|
||||
@@ -51,17 +51,8 @@ CAF_CMD_SOURCE_INIT( RicReplaceCaseFeature, "RicReplaceCaseFeature" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicReplaceCaseFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmObject*> selectedFormationNamesCollObjs;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedFormationNamesCollObjs );
|
||||
for ( caf::PdmObject* pdmObject : selectedFormationNamesCollObjs )
|
||||
{
|
||||
if ( dynamic_cast<RimEclipseResultCase*>( pdmObject ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<RimEclipseResultCase>();
|
||||
return !objects.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -41,9 +41,7 @@ void RicShowDataSourcesForRealization::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowDataSourcesForRealization::isCommandChecked() const
|
||||
{
|
||||
std::vector<RimSummaryCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
const auto selection = caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
||||
if ( !selection.empty() )
|
||||
{
|
||||
return selection.front()->showVectorItemsInProjectTree();
|
||||
@@ -57,8 +55,7 @@ bool RicShowDataSourcesForRealization::isCommandChecked() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicShowDataSourcesForRealization::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimSummaryCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
const auto selection = caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
||||
|
||||
for ( RimSummaryCase* summaryCase : selection )
|
||||
{
|
||||
@@ -75,9 +72,7 @@ bool RicShowDataSourcesForRealization::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowDataSourcesForRealization::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSummaryCase*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
|
||||
const auto selection = caf::SelectionManager::instance()->objectsByType<RimSummaryCase>();
|
||||
if ( selection.empty() ) return;
|
||||
|
||||
bool enableDataSources = !selection.front()->showVectorItemsInProjectTree();
|
||||
|
||||
@@ -99,8 +99,7 @@ caf::PdmScriptResponse RicStackSelectedCurvesFeature::execute()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicStackSelectedCurvesFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
|
||||
auto plotCurves = plotCurvesFromSelection( selectedItems );
|
||||
|
||||
@@ -116,8 +115,7 @@ bool RicStackSelectedCurvesFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicStackSelectedCurvesFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
|
||||
auto plotCurves = plotCurvesFromSelection( selectedItems );
|
||||
auto unstackedPlotCurves = subsetOfPlotCurvesFromStacking( plotCurves, false );
|
||||
|
||||
@@ -61,10 +61,8 @@ caf::PdmScriptResponse RicUnstackSelectedCurvesFeature::execute()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicUnstackSelectedCurvesFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
|
||||
auto plotCurves = RicStackSelectedCurvesFeature::plotCurvesFromSelection( selectedItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
auto plotCurves = RicStackSelectedCurvesFeature::plotCurvesFromSelection( selectedItems );
|
||||
|
||||
if ( plotCurves.size() != selectedItems.size() ) return false;
|
||||
|
||||
@@ -78,8 +76,7 @@ bool RicUnstackSelectedCurvesFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicUnstackSelectedCurvesFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
|
||||
auto plotCurves = RicStackSelectedCurvesFeature::plotCurvesFromSelection( selectedItems );
|
||||
auto unstackedPlotCurves = RicStackSelectedCurvesFeature::subsetOfPlotCurvesFromStacking( plotCurves, true );
|
||||
|
||||
@@ -65,10 +65,9 @@ RimSimWellInView* RicWellLogTools::selectedSimulationWell( int* branchIndex )
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RimSimWellInView*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
( *branchIndex ) = 0;
|
||||
return !selection.empty() ? selection[0] : nullptr;
|
||||
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimSimWellInView>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,11 +161,10 @@ void RicWellLogTools::addWellLogChannelsToPlotTrack( RimWellLogTrack* plotTrack,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath* RicWellLogTools::selectedWellPathWithLog()
|
||||
{
|
||||
std::vector<RimWellPath*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
if ( !selection.empty() )
|
||||
const auto selection = caf::SelectionManager::instance()->objectsByType<RimWellPath>();
|
||||
|
||||
for ( const auto& wellPath : selection )
|
||||
{
|
||||
RimWellPath* wellPath = selection[0];
|
||||
if ( !wellPath->wellLogs().empty() )
|
||||
{
|
||||
return wellPath;
|
||||
|
||||
@@ -153,8 +153,7 @@ void RicWellMeasurementImportTools::deleteAllEmptyMeasurementCurves()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPathCollection* RicWellMeasurementImportTools::selectedWellPathCollection()
|
||||
{
|
||||
std::vector<RimWellPathCollection*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<RimWellPathCollection>();
|
||||
|
||||
if ( objects.size() == 1 )
|
||||
{
|
||||
|
||||
@@ -87,15 +87,13 @@ void RicNewSeismicDifferenceFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSeismicData*> RicNewSeismicDifferenceFeature::selectedSeismic()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
|
||||
if ( uiItems.size() != 2 ) return {};
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( selectedItems.size() != 2 ) return {};
|
||||
|
||||
std::vector<RimSeismicData*> seismicItems;
|
||||
|
||||
RimSeismicData* seismic1 = dynamic_cast<RimSeismicData*>( uiItems[0] );
|
||||
RimSeismicData* seismic2 = dynamic_cast<RimSeismicData*>( uiItems[1] );
|
||||
RimSeismicData* seismic1 = dynamic_cast<RimSeismicData*>( selectedItems[0] );
|
||||
RimSeismicData* seismic2 = dynamic_cast<RimSeismicData*>( selectedItems[1] );
|
||||
|
||||
if ( seismic1 == nullptr ) return {};
|
||||
if ( seismic2 == nullptr ) return {};
|
||||
|
||||
@@ -56,17 +56,7 @@ bool RicNewSeismicViewFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSeismicViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> uiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( uiItems );
|
||||
|
||||
RimSeismicData* selectedData = nullptr;
|
||||
|
||||
if ( !uiItems.empty() )
|
||||
{
|
||||
selectedData = dynamic_cast<RimSeismicData*>( uiItems[0] );
|
||||
}
|
||||
|
||||
createSeismicView( selectedData );
|
||||
createSeismicView( caf::SelectionManager::instance()->selectedItemOfType<RimSeismicData>() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
+1
-10
@@ -124,14 +124,5 @@ void RicSeismicSectionFromIntersectionFeature::setupActionLook( QAction* actionT
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimExtrudedCurveIntersection* RicSeismicSectionFromIntersectionFeature::getSelectedIntersection() const
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedUiItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedUiItems );
|
||||
|
||||
RimExtrudedCurveIntersection* intersection = nullptr;
|
||||
|
||||
if ( !selectedUiItems.empty() )
|
||||
{
|
||||
intersection = dynamic_cast<RimExtrudedCurveIntersection*>( selectedUiItems[0] );
|
||||
}
|
||||
return intersection;
|
||||
return caf::SelectionManager::instance()->selectedItemOfType<RimExtrudedCurveIntersection>();
|
||||
}
|
||||
+3
-4
@@ -49,11 +49,10 @@ void RicAsciiExportSummaryPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
disableModelChangeContribution();
|
||||
|
||||
std::vector<RimSummaryPlot*> selectedSummaryPlots;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedSummaryPlots );
|
||||
QString defaultDir = defaultExportDir();
|
||||
const auto selectedSummaryPlots = caf::SelectionManager::instance()->objectsByType<RimSummaryPlot>();
|
||||
|
||||
RiaPreferencesSummary* prefs = RiaPreferencesSummary::current();
|
||||
QString defaultDir = defaultExportDir();
|
||||
RiaPreferencesSummary* prefs = RiaPreferencesSummary::current();
|
||||
|
||||
// Ask user about resampling
|
||||
auto result = RicResampleDialog::openDialog();
|
||||
|
||||
+2
-6
@@ -37,9 +37,7 @@ CAF_CMD_SOURCE_INIT( RicClearSourceSteppingEnsembleCurveSetFeature, "RicClearSou
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicClearSourceSteppingEnsembleCurveSetFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmObject*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<caf::PdmObject>();
|
||||
if ( objects.size() == 1 )
|
||||
{
|
||||
auto c = objects[0];
|
||||
@@ -63,9 +61,7 @@ bool RicClearSourceSteppingEnsembleCurveSetFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicClearSourceSteppingEnsembleCurveSetFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmObject*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<caf::PdmObject>();
|
||||
if ( objects.size() == 1 )
|
||||
{
|
||||
auto c = objects[0];
|
||||
|
||||
+2
-6
@@ -37,9 +37,7 @@ CAF_CMD_SOURCE_INIT( RicClearSourceSteppingSummaryCurveFeature, "RicClearSourceS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicClearSourceSteppingSummaryCurveFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmObject*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<caf::PdmObject>();
|
||||
if ( objects.size() == 1 )
|
||||
{
|
||||
auto c = objects[0];
|
||||
@@ -63,9 +61,7 @@ bool RicClearSourceSteppingSummaryCurveFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicClearSourceSteppingSummaryCurveFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSummaryCurve*> summaryCurves;
|
||||
caf::SelectionManager::instance()->objectsByType( &summaryCurves );
|
||||
|
||||
const auto summaryCurves = caf::SelectionManager::instance()->objectsByType<RimSummaryCurve>();
|
||||
if ( summaryCurves.size() == 1 )
|
||||
{
|
||||
auto c = summaryCurves[0];
|
||||
|
||||
@@ -56,13 +56,13 @@ void extractPlotObjectsFromSelection( std::vector<RimSummaryCase*>* selected
|
||||
CAF_ASSERT( selectedIndividualSummaryCases && selectedEnsembles );
|
||||
|
||||
// First try selected ensembles
|
||||
caf::SelectionManager::instance()->objectsByTypeStrict( selectedEnsembles );
|
||||
*selectedEnsembles = caf::SelectionManager::instance()->objectsByTypeStrict<RimSummaryEnsemble>();
|
||||
if ( !selectedEnsembles->empty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Second try selected summary cases
|
||||
caf::SelectionManager::instance()->objectsByTypeStrict( selectedIndividualSummaryCases );
|
||||
*selectedIndividualSummaryCases = caf::SelectionManager::instance()->objectsByTypeStrict<RimSummaryCase>();
|
||||
if ( !selectedIndividualSummaryCases->empty() )
|
||||
{
|
||||
return;
|
||||
|
||||
+2
-6
@@ -36,9 +36,7 @@ CAF_CMD_SOURCE_INIT( RicSetSourceSteppingEnsembleCurveSetFeature, "RicSetSourceS
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSetSourceSteppingEnsembleCurveSetFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimEnsembleCurveSet*> ensembleCurveSets;
|
||||
caf::SelectionManager::instance()->objectsByType( &ensembleCurveSets );
|
||||
|
||||
const auto ensembleCurveSets = caf::SelectionManager::instance()->objectsByType<RimEnsembleCurveSet>();
|
||||
if ( ensembleCurveSets.size() == 1 )
|
||||
{
|
||||
auto c = ensembleCurveSets[0];
|
||||
@@ -61,9 +59,7 @@ bool RicSetSourceSteppingEnsembleCurveSetFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSetSourceSteppingEnsembleCurveSetFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimEnsembleCurveSet*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
const auto objects = caf::SelectionManager::instance()->objectsByType<RimEnsembleCurveSet>();
|
||||
if ( objects.size() == 1 )
|
||||
{
|
||||
auto c = objects[0];
|
||||
|
||||
+2
-5
@@ -36,8 +36,7 @@ CAF_CMD_SOURCE_INIT( RicSetSourceSteppingSummaryCurveFeature, "RicSetSourceStepp
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicSetSourceSteppingSummaryCurveFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimSummaryCurve*> summaryCurves;
|
||||
caf::SelectionManager::instance()->objectsByType( &summaryCurves );
|
||||
const auto summaryCurves = caf::SelectionManager::instance()->objectsByType<RimSummaryCurve>();
|
||||
|
||||
if ( summaryCurves.size() == 1 )
|
||||
{
|
||||
@@ -61,9 +60,7 @@ bool RicSetSourceSteppingSummaryCurveFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSetSourceSteppingSummaryCurveFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimSummaryCurve*> summaryCurves;
|
||||
caf::SelectionManager::instance()->objectsByType( &summaryCurves );
|
||||
|
||||
const auto summaryCurves = caf::SelectionManager::instance()->objectsByType<RimSummaryCurve>();
|
||||
if ( summaryCurves.size() == 1 )
|
||||
{
|
||||
auto c = summaryCurves[0];
|
||||
|
||||
@@ -42,9 +42,7 @@ bool RicMoveItemsToTopFeature::isCommandEnabled() const
|
||||
{
|
||||
using namespace caf;
|
||||
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( !selectedItems.empty() )
|
||||
{
|
||||
auto pdmObject = RicMoveItemsToTopFeature::objectHandleFromUiItem( selectedItems[0] );
|
||||
@@ -65,9 +63,7 @@ void RicMoveItemsToTopFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
using namespace caf;
|
||||
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( !selectedItems.empty() )
|
||||
{
|
||||
auto pdmObject = RicMoveItemsToTopFeature::objectHandleFromUiItem( selectedItems[0] );
|
||||
|
||||
@@ -42,9 +42,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicToggleItemsFeatureImpl::isToggleCommandsAvailable()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( selectedItems.size() == 1 )
|
||||
{
|
||||
caf::PdmUiTreeOrdering* treeItem = findTreeItemFromSelectedUiItem( selectedItems[0] );
|
||||
@@ -87,8 +85,7 @@ bool RicToggleItemsFeatureImpl::isToggleCommandsAvailable()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicToggleItemsFeatureImpl::isToggleCommandsForSubItems()
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
return isToggleCommandsAvailable() && selectedItems.size() == 1;
|
||||
}
|
||||
|
||||
@@ -163,8 +160,7 @@ void RicToggleItemsFeatureImpl::setObjectToggleStateForSelection( SelectionToggl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicToggleItemsFeatureImpl::findCollectionName( SelectionToggleType state )
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( state != TOGGLE && selectedItems.size() == 1 )
|
||||
{
|
||||
caf::PdmUiTreeOrdering* treeItem = findTreeItemFromSelectedUiItem( selectedItems[0] );
|
||||
@@ -262,8 +258,7 @@ std::vector<caf::PdmField<bool>*> RicToggleItemsFeatureImpl::findToggleFieldsFro
|
||||
{
|
||||
std::vector<caf::PdmField<bool>*> fields;
|
||||
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selectedItems );
|
||||
const auto selectedItems = caf::SelectionManager::instance()->selectedItems();
|
||||
if ( state != TOGGLE && selectedItems.size() == 1 )
|
||||
{
|
||||
// If only one item is selected, loop over its children, and toggle them instead of the
|
||||
|
||||
@@ -35,8 +35,7 @@ CAF_CMD_SOURCE_INIT( RicToggleItemsOnOthersOffFeature, "RicToggleItemsOnOthersOf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicToggleItemsOnOthersOffFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<caf::PdmObject*> selectedObjects;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
|
||||
const auto selectedObjects = caf::SelectionManager::instance()->objectsByType<caf::PdmObject>();
|
||||
|
||||
caf::PdmFieldHandle* commonParent = commonParentForAllSelections( selectedObjects );
|
||||
std::vector<caf::PdmObjectHandle*> children = childObjects( commonParent );
|
||||
@@ -49,8 +48,7 @@ bool RicToggleItemsOnOthersOffFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicToggleItemsOnOthersOffFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<caf::PdmObject*> selectedObjects;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
|
||||
const auto selectedObjects = caf::SelectionManager::instance()->objectsByType<caf::PdmObject>();
|
||||
|
||||
// First toggle off all siblings
|
||||
caf::PdmFieldHandle* commonParent = commonParentForAllSelections( selectedObjects );
|
||||
|
||||
@@ -61,9 +61,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<Rim3dView*> selectedGridViews;
|
||||
|
||||
caf::SelectionManager::instance()->objectsByTypeStrict( &selectedGridViews );
|
||||
const auto selectedGridViews = caf::SelectionManager::instance()->objectsByTypeStrict<Rim3dView>();
|
||||
for ( auto gridView : selectedGridViews )
|
||||
{
|
||||
if ( !gridView ) continue;
|
||||
|
||||
@@ -42,11 +42,9 @@ bool RicShowAllLinkedViewsFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowAllLinkedViewsFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<RimViewLinker*> linkedViews;
|
||||
caf::SelectionManager::instance()->objectsByType( &linkedViews );
|
||||
auto linkedViews = caf::SelectionManager::instance()->objectsByType<RimViewLinker>();
|
||||
auto managedViews = caf::SelectionManager::instance()->objectsByType<RimViewController>();
|
||||
|
||||
std::vector<RimViewController*> managedViews;
|
||||
caf::SelectionManager::instance()->objectsByType( &managedViews );
|
||||
for ( auto& managedView : managedViews )
|
||||
{
|
||||
RimViewLinker* rimLinked = managedView->firstAncestorOrThisOfTypeAsserted<RimViewLinker>();
|
||||
|
||||
@@ -34,9 +34,7 @@ CAF_CMD_SOURCE_INIT( Ric3dWellLogCurveDeleteFeature, "Ric3dWellLogCurveDeleteFea
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool Ric3dWellLogCurveDeleteFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<Rim3dWellLogCurve*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
auto objects = caf::SelectionManager::instance()->objectsByType<Rim3dWellLogCurve>();
|
||||
return !objects.empty();
|
||||
}
|
||||
|
||||
@@ -45,9 +43,7 @@ bool Ric3dWellLogCurveDeleteFeature::isCommandEnabled() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void Ric3dWellLogCurveDeleteFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
std::vector<Rim3dWellLogCurve*> objects;
|
||||
caf::SelectionManager::instance()->objectsByType( &objects );
|
||||
|
||||
auto objects = caf::SelectionManager::instance()->objectsByType<Rim3dWellLogCurve>();
|
||||
if ( objects.empty() ) return;
|
||||
|
||||
Rim3dWellLogCurve* firstCurve = objects[0];
|
||||
|
||||
@@ -118,7 +118,5 @@ void RicAddWellLogToPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogChannel*> RicAddWellLogToPlotFeature::selectedWellLogs()
|
||||
{
|
||||
std::vector<RimWellLogChannel*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType( &selection );
|
||||
return selection;
|
||||
return caf::SelectionManager::instance()->objectsByType<RimWellLogChannel>();
|
||||
}
|
||||
Loaded 100 of 136 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user