mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Change API for PdmObjectHandle and PdmFieldHandle
* Refactor interface to PdmObjectHandle and PdmFieldHandle Return objects instead of passing in structures as parameters * Add nodiscard to several functions * Remove redundant this-> * Rename to ptrReferencedObjectsByType
This commit is contained in:
parent
37e29a0f68
commit
0c90f67dcc
@ -568,8 +568,8 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
|
||||
oilField->fractureDefinitionCollection()->createAndAssignTemplateCopyForNonMatchingUnit();
|
||||
|
||||
{
|
||||
std::vector<RimWellPathFracture*> wellPathFractures;
|
||||
oilField->wellPathCollection->descendantsIncludingThisOfType( wellPathFractures );
|
||||
std::vector<RimWellPathFracture*> wellPathFractures =
|
||||
oilField->wellPathCollection->descendantsIncludingThisOfType<RimWellPathFracture>();
|
||||
|
||||
for ( auto fracture : wellPathFractures )
|
||||
{
|
||||
@ -627,8 +627,7 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
|
||||
|
||||
if ( m_project->isProjectFileVersionEqualOrOlderThan( "2018.1.0.103" ) )
|
||||
{
|
||||
std::vector<RimStimPlanColors*> stimPlanColors;
|
||||
riv->descendantsIncludingThisOfType( stimPlanColors );
|
||||
std::vector<RimStimPlanColors*> stimPlanColors = riv->descendantsIncludingThisOfType<RimStimPlanColors>();
|
||||
if ( stimPlanColors.size() == 1 )
|
||||
{
|
||||
stimPlanColors[0]->updateConductivityResultName();
|
||||
|
@ -81,6 +81,7 @@
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimTextAnnotationInView.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimViewLinker.h"
|
||||
#include "RimViewLinkerCollection.h"
|
||||
#include "RimWellLogFile.h"
|
||||
@ -1375,10 +1376,9 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences*
|
||||
|
||||
if ( this->project() )
|
||||
{
|
||||
std::vector<RimViewWindow*> allViewWindows;
|
||||
project()->descendantsIncludingThisOfType( allViewWindows );
|
||||
std::vector<RimViewWindow*> allViewWindows = project()->descendantsIncludingThisOfType<RimViewWindow>();
|
||||
|
||||
RimWellPathCollection* wellPathCollection = this->project()->activeOilField()->wellPathCollection();
|
||||
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||
|
||||
bool existingViewsWithDifferentMeshLines = false;
|
||||
bool existingViewsWithCustomColors = false;
|
||||
|
@ -153,8 +153,7 @@ std::set<RigFemResultAddress> RiaMemoryCleanup::findGeoMechCaseResultsInUse() co
|
||||
auto geoMechCase = dynamic_cast<RimGeoMechCase*>( m_case() );
|
||||
if ( geoMechCase )
|
||||
{
|
||||
std::vector<RimFemResultObserver*> geoMechResults;
|
||||
geoMechCase->descendantsIncludingThisOfType( geoMechResults );
|
||||
std::vector<RimFemResultObserver*> geoMechResults = geoMechCase->descendantsIncludingThisOfType<RimFemResultObserver>();
|
||||
for ( RimFemResultObserver* resultDef : geoMechResults )
|
||||
{
|
||||
auto pdmObj = dynamic_cast<caf::PdmObject*>( resultDef );
|
||||
@ -181,8 +180,7 @@ std::set<RigEclipseResultAddress> RiaMemoryCleanup::findEclipseResultsInUse() co
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
|
||||
if ( eclipseCase )
|
||||
{
|
||||
std::vector<RimEclipseResultDefinition*> eclipseResultDefs;
|
||||
eclipseCase->descendantsIncludingThisOfType( eclipseResultDefs );
|
||||
auto eclipseResultDefs = eclipseCase->descendantsIncludingThisOfType<RimEclipseResultDefinition>();
|
||||
for ( RimEclipseResultDefinition* resultDef : eclipseResultDefs )
|
||||
{
|
||||
RigEclipseResultAddress resultAddr( resultDef->resultType(), resultDef->resultVariable() );
|
||||
|
@ -265,8 +265,7 @@ QString RiaEnsembleNameTools::uniqueShortNameForSummaryCase( RimSummaryCase* sum
|
||||
{
|
||||
std::set<QString> allAutoShortNames;
|
||||
|
||||
std::vector<RimSummaryCase*> allCases;
|
||||
RimProject::current()->descendantsOfType( allCases );
|
||||
std::vector<RimSummaryCase*> allCases = RimProject::current()->descendantsOfType<RimSummaryCase>();
|
||||
|
||||
for ( auto sumCase : allCases )
|
||||
{
|
||||
|
@ -60,8 +60,7 @@ RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateSimWellExtractor( co
|
||||
auto wlPlotCollection = wellLogPlotCollection();
|
||||
if ( !wlPlotCollection ) return nullptr;
|
||||
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
simWell->firstAncestorOrThisOfType( eclipseCase );
|
||||
auto eclipseCase = simWell->firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( !( eclipseCase && eclipseCase->eclipseCaseData() ) )
|
||||
{
|
||||
return nullptr;
|
||||
|
@ -123,11 +123,10 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList&
|
||||
auto existingSummaryCase = sumCaseColl->findTopLevelSummaryCaseFromFileName( newSumCase->summaryHeaderFilename() );
|
||||
if ( existingSummaryCase )
|
||||
{
|
||||
existingSummaryCase->firstAncestorOrThisOfType( existingCollection );
|
||||
existingCollection = existingSummaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
|
||||
|
||||
// Replace file summary case pointers in Rft Curves
|
||||
std::vector<RimWellLogRftCurve*> rftCurves;
|
||||
existingSummaryCase->objectsWithReferringPtrFieldsOfType( rftCurves );
|
||||
auto rftCurves = existingSummaryCase->objectsWithReferringPtrFieldsOfType<RimWellLogRftCurve>();
|
||||
for ( RimWellLogRftCurve* curve : rftCurves )
|
||||
{
|
||||
if ( curve->summaryCase() == existingSummaryCase )
|
||||
@ -138,8 +137,7 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList&
|
||||
|
||||
// Replace all occurrences of file sum with ecl sum
|
||||
|
||||
std::vector<RimSummaryCurve*> objects;
|
||||
existingSummaryCase->objectsWithReferringPtrFieldsOfType( objects );
|
||||
auto objects = existingSummaryCase->objectsWithReferringPtrFieldsOfType<RimSummaryCurve>();
|
||||
|
||||
// UI settings of a curve filter is updated based
|
||||
// on the new case association for the curves in the curve filter
|
||||
@ -158,8 +156,7 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList&
|
||||
summaryCurve->setSummaryCaseY( newSumCase );
|
||||
}
|
||||
|
||||
RimSummaryCurveCollection* parentCollection = nullptr;
|
||||
summaryCurve->firstAncestorOrThisOfType( parentCollection );
|
||||
auto parentCollection = summaryCurve->firstAncestorOrThisOfType<RimSummaryCurveCollection>();
|
||||
if ( parentCollection )
|
||||
{
|
||||
parentCollection->loadDataAndUpdate( true );
|
||||
|
@ -45,8 +45,7 @@ void RiaOptionItemFactory::appendOptionItemsForEnsembleCurveSets( QList<caf::Pdm
|
||||
options->push_back( caf::PdmOptionItemInfo( "None", nullptr ) );
|
||||
|
||||
RimMainPlotCollection* mainPlotColl = RimMainPlotCollection::current();
|
||||
std::vector<RimEnsembleCurveSet*> ensembleCurveSets;
|
||||
mainPlotColl->descendantsOfType( ensembleCurveSets );
|
||||
std::vector<RimEnsembleCurveSet*> ensembleCurveSets = mainPlotColl->descendantsOfType<RimEnsembleCurveSet>();
|
||||
for ( auto ensembleCurveSet : ensembleCurveSets )
|
||||
{
|
||||
options->push_back( caf::PdmOptionItemInfo( ensembleCurveSet->name(), ensembleCurveSet ) );
|
||||
|
@ -127,14 +127,12 @@ RimSummaryPlot* RiaSummaryTools::parentSummaryPlot( caf::PdmObject* object )
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( summaryPlot );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
}
|
||||
|
||||
return summaryPlot;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -142,14 +140,12 @@ RimSummaryPlot* RiaSummaryTools::parentSummaryPlot( caf::PdmObject* object )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlotCollection* RiaSummaryTools::parentSummaryPlotCollection( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryMultiPlotCollection* summaryPlotColl = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( summaryPlotColl );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryMultiPlotCollection>();
|
||||
}
|
||||
|
||||
return summaryPlotColl;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -157,14 +153,12 @@ RimSummaryMultiPlotCollection* RiaSummaryTools::parentSummaryPlotCollection( caf
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlot* RiaSummaryTools::parentSummaryMultiPlot( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryMultiPlot* multiPlot = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( multiPlot );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryMultiPlot>();
|
||||
}
|
||||
|
||||
return multiPlot;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -172,14 +166,12 @@ RimSummaryMultiPlot* RiaSummaryTools::parentSummaryMultiPlot( caf::PdmObject* ob
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCrossPlot* RiaSummaryTools::parentCrossPlot( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryCrossPlot* crossPlot = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( crossPlot );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryCrossPlot>();
|
||||
}
|
||||
|
||||
return crossPlot;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -187,14 +179,12 @@ RimSummaryCrossPlot* RiaSummaryTools::parentCrossPlot( caf::PdmObject* object )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCrossPlotCollection* RiaSummaryTools::parentCrossPlotCollection( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryCrossPlotCollection* crossPlotColl = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( crossPlotColl );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryCrossPlotCollection>();
|
||||
}
|
||||
|
||||
return crossPlotColl;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -210,14 +200,12 @@ bool RiaSummaryTools::isSummaryCrossPlot( const RimSummaryPlot* plot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryTable* RiaSummaryTools::parentSummaryTable( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryTable* summaryTable = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( summaryTable );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryTable>();
|
||||
}
|
||||
|
||||
return summaryTable;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -225,14 +213,12 @@ RimSummaryTable* RiaSummaryTools::parentSummaryTable( caf::PdmObject* object )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryTableCollection* RiaSummaryTools::parentSummaryTableCollection( caf::PdmObject* object )
|
||||
{
|
||||
RimSummaryTableCollection* summaryTableColl = nullptr;
|
||||
|
||||
if ( object )
|
||||
{
|
||||
object->firstAncestorOrThisOfType( summaryTableColl );
|
||||
return object->firstAncestorOrThisOfType<RimSummaryTableCollection>();
|
||||
}
|
||||
|
||||
return summaryTableColl;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -34,8 +34,7 @@ RicfCloneView::RicfCloneView()
|
||||
caf::PdmScriptResponse RicfCloneView::execute()
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
std::vector<Rim3dView*> allViews;
|
||||
project->descendantsIncludingThisOfType( allViews );
|
||||
std::vector<Rim3dView*> allViews = project->descendantsIncludingThisOfType<Rim3dView>();
|
||||
|
||||
for ( Rim3dView* view : allViews )
|
||||
{
|
||||
|
@ -59,8 +59,7 @@ caf::PdmScriptResponse RicfCreateStatisticsCase::execute()
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
|
||||
std::vector<RimIdenticalGridCaseGroup*> gridCaseGroups;
|
||||
project->descendantsIncludingThisOfType( gridCaseGroups );
|
||||
std::vector<RimIdenticalGridCaseGroup*> gridCaseGroups = project->descendantsIncludingThisOfType<RimIdenticalGridCaseGroup>();
|
||||
for ( auto gridCaseGroup : gridCaseGroups )
|
||||
{
|
||||
if ( gridCaseGroup->groupId() == m_caseGroupId() )
|
||||
|
@ -64,8 +64,7 @@ caf::PdmScriptResponse RicfCreateWellBoreStabilityPlotFeature::execute()
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
|
||||
std::vector<RimGeoMechCase*> geoMechCases;
|
||||
project->descendantsIncludingThisOfType( geoMechCases );
|
||||
std::vector<RimGeoMechCase*> geoMechCases = project->descendantsIncludingThisOfType<RimGeoMechCase>();
|
||||
|
||||
RimGeoMechCase* chosenCase = nullptr;
|
||||
for ( RimGeoMechCase* geoMechCase : geoMechCases )
|
||||
|
@ -81,8 +81,7 @@ caf::PdmScriptResponse RicfExportWellLogPlotData::execute()
|
||||
|
||||
if ( QFileInfo::exists( m_folder ) )
|
||||
{
|
||||
std::vector<RimWellLogPlot*> plots;
|
||||
RimProject::current()->descendantsIncludingThisOfType( plots );
|
||||
std::vector<RimWellLogPlot*> plots = RimProject::current()->descendantsIncludingThisOfType<RimWellLogPlot>();
|
||||
RicfExportWellLogPlotDataResult* result = new RicfExportWellLogPlotDataResult;
|
||||
|
||||
for ( RimWellLogPlot* plot : plots )
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -38,19 +39,8 @@ CAF_CMD_SOURCE_INIT( RicNewAnalysisPlotFeature, "RicNewAnalysisPlotFeature" );
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewAnalysisPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimAnalysisPlotCollection* analysisPlotColl = nullptr;
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( analysisPlotColl );
|
||||
selObj->firstAncestorOrThisOfType( summaryPlot );
|
||||
}
|
||||
|
||||
if ( analysisPlotColl ) return true;
|
||||
|
||||
if ( summaryPlot ) return true;
|
||||
if ( caf::firstAncestorOfTypeFromSelectedObject<RimAnalysisPlotCollection>() ) return true;
|
||||
if ( caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlot>() ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -60,13 +50,7 @@ bool RicNewAnalysisPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewAnalysisPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimAnalysisPlotCollection* analysisPlotColl = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( analysisPlotColl );
|
||||
}
|
||||
RimAnalysisPlotCollection* analysisPlotColl = caf::firstAncestorOfTypeFromSelectedObject<RimAnalysisPlotCollection>();
|
||||
|
||||
RimAnalysisPlot* newPlot = nullptr;
|
||||
if ( !analysisPlotColl )
|
||||
@ -74,8 +58,7 @@ void RicNewAnalysisPlotFeature::onActionTriggered( bool isChecked )
|
||||
QVariant userData = this->userData();
|
||||
if ( !userData.isNull() && userData.canConvert<EnsemblePlotParams>() )
|
||||
{
|
||||
std::vector<RimAnalysisPlotCollection*> correlationPlotCollections;
|
||||
RimProject::current()->descendantsOfType( correlationPlotCollections );
|
||||
auto correlationPlotCollections = RimProject::current()->descendantsOfType<RimAnalysisPlotCollection>();
|
||||
CAF_ASSERT( !correlationPlotCollections.empty() );
|
||||
analysisPlotColl = correlationPlotCollections.front();
|
||||
|
||||
|
@ -83,12 +83,11 @@ RimAnnotationCollectionBase* RicCreateTextAnnotationFeature::annotationCollectio
|
||||
auto selColls = caf::selectedObjectsByTypeStrict<RimAnnotationCollectionBase*>();
|
||||
if ( selColls.size() == 1 ) return selColls.front();
|
||||
|
||||
RimAnnotationCollectionBase* coll = nullptr;
|
||||
auto selGroupColl = caf::selectedObjectsByTypeStrict<RimAnnotationGroupCollection*>();
|
||||
if ( selGroupColl.size() == 1 )
|
||||
{
|
||||
selGroupColl.front()->firstAncestorOrThisOfType( coll );
|
||||
return selGroupColl.front()->firstAncestorOrThisOfType<RimAnnotationCollectionBase>();
|
||||
}
|
||||
|
||||
return coll;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -46,8 +46,7 @@ bool RicEditPreferencesFeature::isCommandEnabled()
|
||||
std::vector<caf::FontHolderInterface*> findFontObjects()
|
||||
{
|
||||
auto project = RimProject::current();
|
||||
std::vector<caf::FontHolderInterface*> allFontObjects;
|
||||
project->descendantsIncludingThisOfType( allFontObjects );
|
||||
std::vector<caf::FontHolderInterface*> allFontObjects = project->descendantsIncludingThisOfType<caf::FontHolderInterface>();
|
||||
|
||||
std::vector<caf::FontHolderInterface*> defaultFontObjects;
|
||||
for ( auto fontObject : allFontObjects )
|
||||
|
@ -116,8 +116,7 @@ void RicExportObjectAndFieldKeywordsFeature::exportObjectAndFieldKeywords( const
|
||||
|
||||
stream << "\n";
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> fields;
|
||||
myClass->fields( fields );
|
||||
std::vector<caf::PdmFieldHandle*> fields = myClass->fields();
|
||||
|
||||
for ( auto f : fields )
|
||||
{
|
||||
|
@ -49,8 +49,7 @@ void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
|
||||
RimCellFilterCollection* filtColl = colls[0];
|
||||
|
||||
// and the case to use
|
||||
RimCase* sourceCase = nullptr;
|
||||
filtColl->firstAncestorOrThisOfTypeAsserted( sourceCase );
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
RimPolygonFilter* lastCreatedOrUpdated = filtColl->addNewPolygonFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
|
@ -53,8 +53,7 @@ void RicNewRangeFilterSliceFeature::onActionTriggered( bool isChecked )
|
||||
RimCellFilterCollection* filtColl = colls[0];
|
||||
|
||||
// and the case to use
|
||||
RimCase* sourceCase = nullptr;
|
||||
filtColl->firstAncestorOrThisOfTypeAsserted( sourceCase );
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
int gridIndex = 0;
|
||||
RimCellFilter* lastCreatedOrUpdated = filtColl->addNewCellRangeFilter( sourceCase, gridIndex, m_sliceDirection );
|
||||
|
@ -49,8 +49,7 @@ void RicNewUserDefinedFilterFeature::onActionTriggered( bool isChecked )
|
||||
RimCellFilterCollection* filtColl = colls[0];
|
||||
|
||||
// and the case to use
|
||||
RimCase* sourceCase = nullptr;
|
||||
filtColl->firstAncestorOrThisOfTypeAsserted( sourceCase );
|
||||
RimCase* sourceCase = filtColl->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
RimUserDefinedFilter* lastCreatedOrUpdated = filtColl->addNewUserDefinedFilter( sourceCase );
|
||||
if ( lastCreatedOrUpdated )
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
@ -79,14 +80,5 @@ void RicCopyStandardLegendFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegend* RicCopyStandardLegendFeature::selectedColorLegend()
|
||||
{
|
||||
caf::PdmObject* selectedObject = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
|
||||
if ( !selectedObject ) return nullptr;
|
||||
|
||||
RimColorLegend* colorLegend = nullptr;
|
||||
|
||||
selectedObject->firstAncestorOrThisOfType( colorLegend );
|
||||
if ( colorLegend ) return colorLegend;
|
||||
|
||||
return nullptr;
|
||||
return caf::firstAncestorOfTypeFromSelectedObject<RimColorLegend>();
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "RiuFileDialogTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QFileInfo>
|
||||
@ -43,17 +44,7 @@ CAF_CMD_SOURCE_INIT( RicImportColorCategoriesFeature, "RicImportColorCategoriesF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportColorCategoriesFeature::isCommandEnabled()
|
||||
{
|
||||
RimColorLegendCollection* legendCollection = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( legendCollection );
|
||||
}
|
||||
|
||||
if ( legendCollection ) return true;
|
||||
|
||||
return false;
|
||||
return caf::firstAncestorOfTypeFromSelectedObject<RimColorLegendCollection>() != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -83,9 +83,7 @@ RimColorLegendCollection* RicInsertColorLegendFeature::selectedColorLegendCollec
|
||||
|
||||
if ( !selectedObject ) return nullptr;
|
||||
|
||||
RimColorLegendCollection* colorLegendCollection = nullptr;
|
||||
|
||||
selectedObject->firstAncestorOrThisOfType( colorLegendCollection );
|
||||
RimColorLegendCollection* colorLegendCollection = selectedObject->firstAncestorOrThisOfType<RimColorLegendCollection>();
|
||||
if ( colorLegendCollection )
|
||||
{
|
||||
// Disable the menu for standard color legends
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "Riu3DMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -40,9 +41,7 @@ bool RicInsertColorLegendItemFeature::isCommandEnabled()
|
||||
|
||||
if ( legend )
|
||||
{
|
||||
RimColorLegendCollection* colorLegendCollection = nullptr;
|
||||
|
||||
legend->firstAncestorOrThisOfType( colorLegendCollection );
|
||||
RimColorLegendCollection* colorLegendCollection = legend->firstAncestorOrThisOfType<RimColorLegendCollection>();
|
||||
|
||||
if ( colorLegendCollection && !colorLegendCollection->isStandardColorLegend( legend ) ) return true;
|
||||
}
|
||||
@ -88,15 +87,5 @@ void RicInsertColorLegendItemFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimColorLegend* RicInsertColorLegendItemFeature::selectedColorLegend()
|
||||
{
|
||||
caf::PdmObject* selectedObject = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
|
||||
if ( !selectedObject ) return nullptr;
|
||||
|
||||
RimColorLegend* colorLegend = nullptr;
|
||||
|
||||
selectedObject->firstAncestorOrThisOfType( colorLegend );
|
||||
|
||||
if ( colorLegend ) return colorLegend;
|
||||
|
||||
return nullptr;
|
||||
return caf::firstAncestorOfTypeFromSelectedObject<RimColorLegend>();
|
||||
}
|
||||
|
@ -49,10 +49,8 @@ void RicDeleteValveTemplateFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( valveTemplate )
|
||||
{
|
||||
RimProject* project = nullptr;
|
||||
valveTemplate->firstAncestorOrThisOfTypeAsserted( project );
|
||||
std::vector<RimWellPathValve*> valves;
|
||||
project->descendantsIncludingThisOfType( valves );
|
||||
RimProject* project = RimProject::current();
|
||||
std::vector<RimWellPathValve*> valves = project->descendantsIncludingThisOfType<RimWellPathValve>();
|
||||
for ( RimWellPathValve* valve : valves )
|
||||
{
|
||||
if ( valve->valveTemplate() == valveTemplate )
|
||||
@ -62,8 +60,7 @@ void RicDeleteValveTemplateFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
}
|
||||
|
||||
RimValveTemplateCollection* collection = nullptr;
|
||||
valveTemplate->firstAncestorOrThisOfTypeAsserted( collection );
|
||||
RimValveTemplateCollection* collection = valveTemplate->firstAncestorOrThisOfTypeAsserted<RimValveTemplateCollection>();
|
||||
collection->removeAndDeleteValveTemplate( valveTemplate );
|
||||
collection->updateAllRequiredEditors();
|
||||
|
||||
|
@ -50,8 +50,7 @@ void RicEditPerforationCollectionFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( perforationCollection == nullptr ) return;
|
||||
|
||||
RimWellPath* wellPath;
|
||||
perforationCollection->firstAncestorOrThisOfTypeAsserted( wellPath );
|
||||
RimWellPath* wellPath = perforationCollection->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
|
||||
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
|
||||
|
||||
RiuEditPerforationCollectionWidget dlg( nullptr, perforationCollection );
|
||||
@ -73,15 +72,12 @@ void RicEditPerforationCollectionFeature::setupActionLook( QAction* actionToSetu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPerforationCollection* RicEditPerforationCollectionFeature::selectedPerforationCollection()
|
||||
{
|
||||
RimPerforationCollection* objToFind = nullptr;
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( pdmUiItem );
|
||||
if ( objHandle )
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType( objToFind );
|
||||
return objHandle->firstAncestorOrThisOfType<RimPerforationCollection>();
|
||||
}
|
||||
|
||||
return objToFind;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
@ -48,9 +49,7 @@ void RicExportFishbonesLateralsFeature::onActionTriggered( bool isChecked )
|
||||
RimFishbonesCollection* fishbonesCollection = selectedFishbonesCollection();
|
||||
CVF_ASSERT( fishbonesCollection );
|
||||
|
||||
RimWellPath* wellPath = nullptr;
|
||||
fishbonesCollection->firstAncestorOrThisOfType( wellPath );
|
||||
CVF_ASSERT( wellPath );
|
||||
auto wellPath = fishbonesCollection->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
|
||||
|
||||
auto fileName = caf::Utils::makeValidFileBasename( wellPath->name() ) + "_laterals.dev";
|
||||
|
||||
@ -109,17 +108,7 @@ void RicExportFishbonesLateralsFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFishbonesCollection* RicExportFishbonesLateralsFeature::selectedFishbonesCollection()
|
||||
{
|
||||
RimFishbonesCollection* objToFind = nullptr;
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
|
||||
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( pdmUiItem );
|
||||
if ( objHandle )
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType( objToFind );
|
||||
}
|
||||
|
||||
return objToFind;
|
||||
return caf::firstAncestorOfTypeFromSelectedObject<RimFishbonesCollection>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -58,8 +58,7 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered( bool isChecke
|
||||
wellPath->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( obj );
|
||||
|
||||
RimProject* proj;
|
||||
wellPath->firstAncestorOrThisOfTypeAsserted( proj );
|
||||
RimProject* proj = RimProject::current();
|
||||
proj->reloadCompletionTypeResultsInAllViews();
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <QAction>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "RimTools.h"
|
||||
#include <cmath>
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicNewFishbonesSubsFeature, "RicNewFishbonesSubsFeature" );
|
||||
@ -52,8 +53,7 @@ void RicNewFishbonesSubsFeature::onActionTriggered( bool isChecked )
|
||||
RimFishbonesCollection* fishbonesCollection = selectedFishbonesCollection();
|
||||
CVF_ASSERT( fishbonesCollection );
|
||||
|
||||
RimWellPath* wellPath;
|
||||
fishbonesCollection->firstAncestorOrThisOfTypeAsserted( wellPath );
|
||||
RimWellPath* wellPath = fishbonesCollection->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
|
||||
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
|
||||
|
||||
RimFishbones* obj = new RimFishbones;
|
||||
@ -70,8 +70,7 @@ void RicNewFishbonesSubsFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
RicNewFishbonesSubsFeature::adjustWellPathScaling( fishbonesCollection );
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
fishbonesCollection->firstAncestorOrThisOfType( wellPathCollection );
|
||||
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||
if ( wellPathCollection )
|
||||
{
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
@ -79,8 +78,7 @@ void RicNewFishbonesSubsFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( obj );
|
||||
|
||||
RimProject* proj;
|
||||
fishbonesCollection->firstAncestorOrThisOfTypeAsserted( proj );
|
||||
RimProject* proj = RimProject::current();
|
||||
proj->reloadCompletionTypeResultsInAllViews();
|
||||
}
|
||||
|
||||
@ -100,7 +98,7 @@ RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection(
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( pdmUiItem );
|
||||
if ( objHandle )
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType( objToFind );
|
||||
objToFind = objHandle->firstAncestorOrThisOfType<RimFishbonesCollection>();
|
||||
}
|
||||
|
||||
if ( objToFind == nullptr )
|
||||
@ -149,8 +147,7 @@ bool RicNewFishbonesSubsFeature::isCommandEnabled()
|
||||
void RicNewFishbonesSubsFeature::adjustWellPathScaling( RimFishbonesCollection* fishboneCollection )
|
||||
{
|
||||
CVF_ASSERT( fishboneCollection );
|
||||
RimWellPathCollection* wellPathColl = nullptr;
|
||||
fishboneCollection->firstAncestorOrThisOfTypeAsserted( wellPathColl );
|
||||
RimWellPathCollection* wellPathColl = RimTools::wellPathCollection();
|
||||
|
||||
if ( wellPathColl->wellPathRadiusScaleFactor > 0.05 )
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
@ -56,8 +57,7 @@ void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered( bool is
|
||||
|
||||
wellPath->perforationIntervalCollection()->appendPerforation( perforationInterval );
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
wellPath->firstAncestorOrThisOfTypeAsserted( wellPathCollection );
|
||||
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
wellPathCollection->scheduleRedrawAffectedViews();
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPathCompletions.h"
|
||||
@ -51,8 +52,7 @@ void RicNewPerforationIntervalFeature::onActionTriggered( bool isChecked )
|
||||
RimPerforationCollection* perforationCollection = selectedPerforationCollection();
|
||||
if ( perforationCollection == nullptr ) return;
|
||||
|
||||
RimWellPath* wellPath;
|
||||
perforationCollection->firstAncestorOrThisOfTypeAsserted( wellPath );
|
||||
RimWellPath* wellPath = perforationCollection->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
|
||||
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
|
||||
|
||||
RimPerforationInterval* perforationInterval = new RimPerforationInterval;
|
||||
@ -61,8 +61,7 @@ void RicNewPerforationIntervalFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
perforationCollection->appendPerforation( perforationInterval );
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
perforationCollection->firstAncestorOrThisOfType( wellPathCollection );
|
||||
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||
if ( !wellPathCollection ) return;
|
||||
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
@ -95,7 +94,7 @@ RimPerforationCollection* RicNewPerforationIntervalFeature::selectedPerforationC
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( pdmUiItem );
|
||||
if ( objHandle )
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType( perforationCollection );
|
||||
perforationCollection = objHandle->firstAncestorOrThisOfType<RimPerforationCollection>();
|
||||
|
||||
if ( perforationCollection ) return perforationCollection;
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "RimPerforationCollection.h"
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPathValve.h"
|
||||
@ -57,8 +58,7 @@ void RicNewValveAtMeasuredDepthFeature::onActionTriggered( bool isChecked )
|
||||
std::vector<RimWellPathValve*> existingValves = perfInterval->valves();
|
||||
valve->setName( QString( "Valve #%1" ).arg( existingValves.size() + 1 ) );
|
||||
|
||||
RimProject* project;
|
||||
perfInterval->firstAncestorOrThisOfTypeAsserted( project );
|
||||
RimProject* project = RimProject::current();
|
||||
|
||||
std::vector<RimValveTemplate*> allValveTemplates = project->allValveTemplates();
|
||||
if ( !allValveTemplates.empty() )
|
||||
@ -68,8 +68,7 @@ void RicNewValveAtMeasuredDepthFeature::onActionTriggered( bool isChecked )
|
||||
perfInterval->addValve( valve );
|
||||
valve->setMeasuredDepthAndCount( measuredDepth, perfInterval->endMD() - measuredDepth, 1 );
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
wellPath->firstAncestorOrThisOfTypeAsserted( wellPathCollection );
|
||||
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
wellPathCollection->scheduleRedrawAffectedViews();
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "RimPerforationInterval.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimTools.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
#include "RimWellPathValve.h"
|
||||
|
||||
@ -35,8 +36,7 @@ void RicNewValveFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimWellPathValve* valve = new RimWellPathValve;
|
||||
|
||||
RimProject* project = nullptr;
|
||||
perfInterval->firstAncestorOrThisOfTypeAsserted( project );
|
||||
RimProject* project = RimProject::current();
|
||||
|
||||
std::vector<RimWellPathValve*> existingValves = perfInterval->valves();
|
||||
valve->setName( QString( "Valve #%1" ).arg( existingValves.size() + 1 ) );
|
||||
@ -50,8 +50,7 @@ void RicNewValveFeature::onActionTriggered( bool isChecked )
|
||||
perfInterval->addValve( valve );
|
||||
valve->setMeasuredDepthAndCount( perfInterval->startMD(), perfInterval->endMD() - perfInterval->startMD(), 1 );
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
perfInterval->firstAncestorOrThisOfType( wellPathCollection );
|
||||
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||
if ( !wellPathCollection ) return;
|
||||
|
||||
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||
|
@ -42,8 +42,7 @@ void RicNewValveTemplateFeature::selectValveTemplateAndUpdate( RimValveTemplate*
|
||||
{
|
||||
valveTemplate->loadDataAndUpdate();
|
||||
|
||||
RimValveTemplateCollection* templateCollection = nullptr;
|
||||
valveTemplate->firstAncestorOrThisOfType( templateCollection );
|
||||
RimValveTemplateCollection* templateCollection = valveTemplate->firstAncestorOrThisOfType<RimValveTemplateCollection>();
|
||||
if ( templateCollection )
|
||||
{
|
||||
templateCollection->updateConnectedEditors();
|
||||
|
@ -468,10 +468,9 @@ std::map<int, std::vector<std::pair<QString, QString>>> RicExportCompletionDataS
|
||||
{
|
||||
std::map<int, std::vector<std::pair<QString, QString>>> wellProductionStartStrings;
|
||||
|
||||
const RimProject* project = nullptr;
|
||||
const RimProject* project = RimProject::current();
|
||||
if ( caseToApply )
|
||||
{
|
||||
caseToApply->firstAncestorOrThisOfTypeAsserted( project );
|
||||
for ( const RimWellPath* wellPath : project->allWellPaths() )
|
||||
{
|
||||
int initialWellProductionTimeStep = -1;
|
||||
|
@ -83,7 +83,7 @@ std::vector<RimWellPath*> RicExportCompletionsForTemporaryLgrsFeature::wellPaths
|
||||
{
|
||||
std::vector<RimWellPath*> wellPaths;
|
||||
|
||||
auto selectedEclipseCase = caf::firstAncestorOfTypeFromSelectedObject<RimEclipseCase*>();
|
||||
auto selectedEclipseCase = caf::firstAncestorOfTypeFromSelectedObject<RimEclipseCase>();
|
||||
if ( selectedEclipseCase )
|
||||
{
|
||||
auto mainGrid = selectedEclipseCase->mainGrid();
|
||||
|
@ -85,8 +85,7 @@ std::vector<RimSimWellInView*> RicExportCompletionsForVisibleSimWellsFeature::vi
|
||||
|
||||
if ( !selectedSimWells.empty() )
|
||||
{
|
||||
RimSimWellInViewCollection* parent = nullptr;
|
||||
selectedSimWells[0]->firstAncestorOrThisOfType( parent );
|
||||
RimSimWellInViewCollection* parent = selectedSimWells[0]->firstAncestorOrThisOfType<RimSimWellInViewCollection>();
|
||||
if ( parent )
|
||||
{
|
||||
simWellCollection.push_back( parent );
|
||||
|
@ -45,9 +45,7 @@ bool RicExportCompletionsForVisibleWellPathsFeature::isCommandEnabled()
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
|
||||
for ( caf::PdmObject* object : selectedObjects )
|
||||
{
|
||||
RimWellPathCollection* wellPathCollection;
|
||||
|
||||
object->firstAncestorOrThisOfType( wellPathCollection );
|
||||
RimWellPathCollection* wellPathCollection = object->firstAncestorOrThisOfType<RimWellPathCollection>();
|
||||
if ( wellPathCollection )
|
||||
{
|
||||
foundWellPathCollection = true;
|
||||
@ -116,8 +114,7 @@ std::vector<RimWellPath*> RicExportCompletionsForVisibleWellPathsFeature::visibl
|
||||
|
||||
if ( !selectedWellPaths.empty() )
|
||||
{
|
||||
RimWellPathCollection* parent = nullptr;
|
||||
selectedWellPaths[0]->firstAncestorOrThisOfType( parent );
|
||||
RimWellPathCollection* parent = selectedWellPaths[0]->firstAncestorOrThisOfType<RimWellPathCollection>();
|
||||
if ( parent )
|
||||
{
|
||||
wellPathCollections.push_back( parent );
|
||||
|
@ -94,7 +94,8 @@ void RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompl
|
||||
|
||||
for ( auto s : simWells )
|
||||
{
|
||||
s->descendantsIncludingThisOfType( simWellFractures );
|
||||
auto fratures = s->descendantsIncludingThisOfType<RimSimWellFracture>();
|
||||
simWellFractures.insert( simWellFractures.end(), fratures.begin(), fratures.end() );
|
||||
}
|
||||
|
||||
std::vector<RimWellPath*> topLevelWells;
|
||||
@ -127,9 +128,14 @@ void RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompl
|
||||
|
||||
for ( auto w : allLaterals )
|
||||
{
|
||||
w->descendantsIncludingThisOfType( wellPathFractures );
|
||||
w->descendantsIncludingThisOfType( wellPathFishbones );
|
||||
w->descendantsIncludingThisOfType( wellPathPerforations );
|
||||
auto fractures = w->descendantsIncludingThisOfType<RimWellPathFracture>();
|
||||
wellPathFractures.insert( wellPathFractures.end(), fractures.begin(), fractures.end() );
|
||||
|
||||
auto fishbones = w->descendantsIncludingThisOfType<RimFishbones>();
|
||||
wellPathFishbones.insert( wellPathFishbones.end(), fishbones.begin(), fishbones.end() );
|
||||
|
||||
auto perforations = w->descendantsIncludingThisOfType<RimPerforationInterval>();
|
||||
wellPathPerforations.insert( wellPathPerforations.end(), perforations.begin(), perforations.end() );
|
||||
}
|
||||
|
||||
if ( ( !simWellFractures.empty() ) || ( !wellPathFractures.empty() ) )
|
||||
@ -157,7 +163,8 @@ void RicWellPathExportCompletionDataFeature::prepareExportSettingsAndExportCompl
|
||||
std::vector<const RimWellPathValve*> perforationValves;
|
||||
for ( const auto& perf : wellPathPerforations )
|
||||
{
|
||||
perf->descendantsIncludingThisOfType( perforationValves );
|
||||
auto other = perf->descendantsIncludingThisOfType<const RimWellPathValve>();
|
||||
perforationValves.insert( perforationValves.end(), other.begin(), other.end() );
|
||||
}
|
||||
|
||||
if ( !perforationValves.empty() )
|
||||
|
@ -1641,16 +1641,14 @@ std::pair<double, cvf::Vec2i>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath* RicWellPathExportCompletionDataFeatureImpl::topLevelWellPath( const RigCompletionData& completion )
|
||||
{
|
||||
RimWellPath* parentWellPath = nullptr;
|
||||
if ( completion.sourcePdmObject() )
|
||||
{
|
||||
completion.sourcePdmObject()->firstAncestorOrThisOfType( parentWellPath );
|
||||
}
|
||||
|
||||
auto parentWellPath = completion.sourcePdmObject()->firstAncestorOrThisOfType<RimWellPath>();
|
||||
if ( parentWellPath )
|
||||
{
|
||||
return parentWellPath->topLevelWellPath();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1159,9 +1159,7 @@ void RicWellPathExportMswCompletionsImpl::createValveCompletions( gsl::not_null<
|
||||
{
|
||||
if ( !interval->isChecked() ) continue;
|
||||
|
||||
std::vector<const RimWellPathValve*> perforationValves;
|
||||
interval->descendantsIncludingThisOfType( perforationValves );
|
||||
|
||||
auto perforationValves = interval->descendantsIncludingThisOfType<RimWellPathValve>();
|
||||
for ( const RimWellPathValve* valve : perforationValves )
|
||||
{
|
||||
if ( !valve->isChecked() ) continue;
|
||||
@ -1306,9 +1304,7 @@ void RicWellPathExportMswCompletionsImpl::assignValveContributionsToSuperICDsOrA
|
||||
{
|
||||
if ( !interval->isChecked() ) continue;
|
||||
|
||||
std::vector<const RimWellPathValve*> perforationValves;
|
||||
interval->descendantsIncludingThisOfType( perforationValves );
|
||||
|
||||
std::vector<const RimWellPathValve*> perforationValves = interval->descendantsIncludingThisOfType<const RimWellPathValve>();
|
||||
double totalPerforationLength = 0.0;
|
||||
for ( const RimWellPathValve* valve : perforationValves )
|
||||
{
|
||||
@ -1409,8 +1405,7 @@ void RicWellPathExportMswCompletionsImpl::moveIntersectionsToICVs( gsl::not_null
|
||||
{
|
||||
if ( !interval->isChecked() ) continue;
|
||||
|
||||
std::vector<const RimWellPathValve*> perforationValves;
|
||||
interval->descendantsIncludingThisOfType( perforationValves );
|
||||
std::vector<const RimWellPathValve*> perforationValves = interval->descendantsIncludingThisOfType<const RimWellPathValve>();
|
||||
|
||||
for ( const RimWellPathValve* valve : perforationValves )
|
||||
{
|
||||
|
@ -552,8 +552,7 @@ QString RicWellPathFractureTextReportFeatureImpl::createFractureInstancesText( c
|
||||
|
||||
QString wellName;
|
||||
|
||||
RimWellPath* wellPath = nullptr;
|
||||
fracture->firstAncestorOrThisOfType( wellPath );
|
||||
auto wellPath = fracture->firstAncestorOrThisOfType<RimWellPath>();
|
||||
if ( wellPath )
|
||||
{
|
||||
wellName = wellPath->completionSettings()->wellNameForExport();
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -39,19 +40,8 @@ CAF_CMD_SOURCE_INIT( RicNewCorrelationMatrixPlotFeature, "RicNewCorrelationMatri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewCorrelationMatrixPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||
selObj->firstAncestorOrThisOfType( summaryPlot );
|
||||
}
|
||||
|
||||
if ( correlationPlotColl ) return true;
|
||||
|
||||
if ( summaryPlot ) return true;
|
||||
if ( caf::firstAncestorOfTypeFromSelectedObject<RimCorrelationPlotCollection>() ) return true;
|
||||
if ( caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlot>() ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -61,13 +51,7 @@ bool RicNewCorrelationMatrixPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewCorrelationMatrixPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||
}
|
||||
RimCorrelationPlotCollection* correlationPlotColl = caf::firstAncestorOfTypeFromSelectedObject<RimCorrelationPlotCollection>();
|
||||
|
||||
RimCorrelationMatrixPlot* newPlot = nullptr;
|
||||
if ( !correlationPlotColl )
|
||||
@ -75,8 +59,7 @@ void RicNewCorrelationMatrixPlotFeature::onActionTriggered( bool isChecked )
|
||||
QVariant userData = this->userData();
|
||||
if ( !userData.isNull() && userData.canConvert<EnsemblePlotParams>() )
|
||||
{
|
||||
std::vector<RimCorrelationPlotCollection*> correlationPlotCollections;
|
||||
RimProject::current()->descendantsOfType( correlationPlotCollections );
|
||||
auto correlationPlotCollections = RimProject::current()->descendantsOfType<RimCorrelationPlotCollection>();
|
||||
CAF_ASSERT( !correlationPlotCollections.empty() );
|
||||
correlationPlotColl = correlationPlotCollections.front();
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -36,19 +37,8 @@ CAF_CMD_SOURCE_INIT( RicNewCorrelationPlotFeature, "RicNewCorrelationPlotFeature
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewCorrelationPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||
selObj->firstAncestorOrThisOfType( summaryPlot );
|
||||
}
|
||||
|
||||
if ( correlationPlotColl ) return true;
|
||||
|
||||
if ( summaryPlot ) return true;
|
||||
if ( caf::firstAncestorOfTypeFromSelectedObject<RimCorrelationPlotCollection>() ) return true;
|
||||
if ( caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlot>() ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -58,13 +48,7 @@ bool RicNewCorrelationPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewCorrelationPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||
}
|
||||
RimCorrelationPlotCollection* correlationPlotColl = caf::firstAncestorOfTypeFromSelectedObject<RimCorrelationPlotCollection>();
|
||||
|
||||
RimCorrelationPlot* newPlot = nullptr;
|
||||
if ( !correlationPlotColl )
|
||||
@ -72,8 +56,7 @@ void RicNewCorrelationPlotFeature::onActionTriggered( bool isChecked )
|
||||
QVariant userData = this->userData();
|
||||
if ( !userData.isNull() && userData.canConvert<EnsemblePlotParams>() )
|
||||
{
|
||||
std::vector<RimCorrelationPlotCollection*> correlationPlotCollections;
|
||||
RimProject::current()->descendantsOfType( correlationPlotCollections );
|
||||
auto correlationPlotCollections = RimProject::current()->descendantsOfType<RimCorrelationPlotCollection>();
|
||||
CAF_ASSERT( !correlationPlotCollections.empty() );
|
||||
correlationPlotColl = correlationPlotCollections.front();
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -37,19 +38,8 @@ CAF_CMD_SOURCE_INIT( RicNewCorrelationReportPlotFeature, "RicNewCorrelationRepor
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewCorrelationReportPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||
selObj->firstAncestorOrThisOfType( summaryPlot );
|
||||
}
|
||||
|
||||
if ( correlationPlotColl ) return true;
|
||||
|
||||
if ( summaryPlot ) return true;
|
||||
if ( caf::firstAncestorOfTypeFromSelectedObject<RimCorrelationPlotCollection>() ) return true;
|
||||
if ( caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlot>() ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -59,13 +49,7 @@ bool RicNewCorrelationReportPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewCorrelationReportPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||
}
|
||||
RimCorrelationPlotCollection* correlationPlotColl = caf::firstAncestorOfTypeFromSelectedObject<RimCorrelationPlotCollection>();
|
||||
|
||||
RimCorrelationReportPlot* newPlot = nullptr;
|
||||
if ( !correlationPlotColl )
|
||||
@ -73,8 +57,7 @@ void RicNewCorrelationReportPlotFeature::onActionTriggered( bool isChecked )
|
||||
QVariant userData = this->userData();
|
||||
if ( !userData.isNull() && userData.canConvert<EnsemblePlotParams>() )
|
||||
{
|
||||
std::vector<RimCorrelationPlotCollection*> correlationPlotCollections;
|
||||
RimProject::current()->descendantsOfType( correlationPlotCollections );
|
||||
auto correlationPlotCollections = RimProject::current()->descendantsOfType<RimCorrelationPlotCollection>();
|
||||
CAF_ASSERT( !correlationPlotCollections.empty() );
|
||||
correlationPlotColl = correlationPlotCollections.front();
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -38,19 +39,8 @@ CAF_CMD_SOURCE_INIT( RicNewParameterResultCrossPlotFeature, "RicNewParameterResu
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicNewParameterResultCrossPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||
selObj->firstAncestorOrThisOfType( summaryPlot );
|
||||
}
|
||||
|
||||
if ( correlationPlotColl ) return true;
|
||||
|
||||
if ( summaryPlot ) return true;
|
||||
if ( caf::firstAncestorOfTypeFromSelectedObject<RimCorrelationPlotCollection>() ) return true;
|
||||
if ( caf::firstAncestorOfTypeFromSelectedObject<RimSummaryPlot>() ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -60,13 +50,7 @@ bool RicNewParameterResultCrossPlotFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewParameterResultCrossPlotFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimCorrelationPlotCollection* correlationPlotColl = nullptr;
|
||||
|
||||
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( selObj )
|
||||
{
|
||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||
}
|
||||
RimCorrelationPlotCollection* correlationPlotColl = caf::firstAncestorOfTypeFromSelectedObject<RimCorrelationPlotCollection>();
|
||||
|
||||
RimSummaryCaseCollection* ensemble = nullptr;
|
||||
QString quantityName;
|
||||
@ -79,8 +63,7 @@ void RicNewParameterResultCrossPlotFeature::onActionTriggered( bool isChecked )
|
||||
QVariant userData = this->userData();
|
||||
if ( !userData.isNull() && userData.canConvert<EnsemblePlotParams>() )
|
||||
{
|
||||
std::vector<RimCorrelationPlotCollection*> correlationPlotCollections;
|
||||
RimProject::current()->descendantsOfType( correlationPlotCollections );
|
||||
auto correlationPlotCollections = RimProject::current()->descendantsOfType<RimCorrelationPlotCollection>();
|
||||
CAF_ASSERT( !correlationPlotCollections.empty() );
|
||||
correlationPlotColl = correlationPlotCollections.front();
|
||||
|
||||
|
@ -51,8 +51,7 @@ void RicAppendIntersectionFeature::onActionTriggered( bool isChecked )
|
||||
caf::SelectionManager::instance()->objectsByType( &collection );
|
||||
CVF_ASSERT( collection.size() == 1 );
|
||||
|
||||
RimIntersectionCollection* intersectionCollection = nullptr;
|
||||
collection[0]->firstAncestorOrThisOfType( intersectionCollection );
|
||||
RimIntersectionCollection* intersectionCollection = collection[0]->firstAncestorOrThisOfType<RimIntersectionCollection>();
|
||||
|
||||
CVF_ASSERT( intersectionCollection );
|
||||
|
||||
@ -104,8 +103,7 @@ void RicAppendIntersectionFeatureCmd::redo()
|
||||
intersection->setName( "Intersection" );
|
||||
m_intersectionCollection->appendIntersectionAndUpdate( intersection );
|
||||
|
||||
RimGridView* view = nullptr;
|
||||
m_intersectionCollection->firstAncestorOrThisOfTypeAsserted( view );
|
||||
RimGridView* view = m_intersectionCollection->firstAncestorOrThisOfTypeAsserted<RimGridView>();
|
||||
|
||||
RimGeoMechView* geoMechView = nullptr;
|
||||
geoMechView = dynamic_cast<RimGeoMechView*>( view );
|
||||
|
@ -49,8 +49,8 @@ void RicAppendSeparateIntersectionResultFeature::onActionTriggered( bool isCheck
|
||||
caf::SelectionManager::instance()->objectsByType( &collection );
|
||||
CVF_ASSERT( collection.size() == 1 );
|
||||
|
||||
RimIntersectionResultsDefinitionCollection* intersectionResCollection = nullptr;
|
||||
collection[0]->firstAncestorOrThisOfType( intersectionResCollection );
|
||||
RimIntersectionResultsDefinitionCollection* intersectionResCollection =
|
||||
collection[0]->firstAncestorOrThisOfType<RimIntersectionResultsDefinitionCollection>();
|
||||
|
||||
CVF_ASSERT( intersectionResCollection );
|
||||
|
||||
|
@ -67,11 +67,7 @@ bool RicCopyIntersectionsToAllViewsInCaseFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCopyIntersectionsToAllViewsInCaseFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimCase* gridCase = nullptr;
|
||||
std::vector<caf::PdmUiItem*> selItems;
|
||||
caf::SelectionManager::instance()->selectedItems( selItems );
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( selItems.front() );
|
||||
if ( objHandle ) objHandle->firstAncestorOrThisOfType( gridCase );
|
||||
RimCase* gridCase = caf::firstAncestorOfTypeFromSelectedObject<RimCase>();
|
||||
|
||||
if ( gridCase )
|
||||
{
|
||||
@ -117,8 +113,7 @@ void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionsToOtherViews(
|
||||
for ( Rim3dView* const view : gridCase.views() )
|
||||
{
|
||||
RimGridView* currGridView = dynamic_cast<RimGridView*>( view );
|
||||
RimGridView* parentView = nullptr;
|
||||
intersection->firstAncestorOrThisOfType( parentView );
|
||||
RimGridView* parentView = intersection->firstAncestorOrThisOfType<RimGridView>();
|
||||
|
||||
if ( currGridView && parentView != nullptr && parentView != currGridView )
|
||||
{
|
||||
@ -149,8 +144,7 @@ void RicCopyIntersectionsToAllViewsInCaseFeature::copyIntersectionBoxesToOtherVi
|
||||
for ( Rim3dView* const view : gridCase.views() )
|
||||
{
|
||||
RimGridView* currGridView = dynamic_cast<RimGridView*>( view );
|
||||
RimGridView* parentView = nullptr;
|
||||
intersectionBox->firstAncestorOrThisOfType( parentView );
|
||||
RimGridView* parentView = intersectionBox->firstAncestorOrThisOfType<RimGridView>();
|
||||
|
||||
if ( currGridView && parentView != nullptr && parentView != currGridView )
|
||||
{
|
||||
@ -238,8 +232,7 @@ RimCase* commonGridCase( std::vector<caf::PdmUiItem*> selectedItems )
|
||||
continue;
|
||||
}
|
||||
|
||||
RimCase* itemCase = nullptr;
|
||||
obj->firstAncestorOrThisOfType( itemCase );
|
||||
RimCase* itemCase = obj->firstAncestorOrThisOfType<RimCase>();
|
||||
|
||||
if ( gridCase == nullptr )
|
||||
gridCase = itemCase;
|
||||
|
@ -111,8 +111,7 @@ void RicNewAzimuthDipIntersectionFeatureCmd::redo()
|
||||
intersection->setName( "Azimuth and Dip" );
|
||||
intersection->configureForAzimuthLine();
|
||||
|
||||
RimCase* rimCase;
|
||||
m_intersectionCollection->firstAncestorOrThisOfTypeAsserted( rimCase );
|
||||
RimCase* rimCase = m_intersectionCollection->firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
cvf::BoundingBox bBox = rimCase->allCellsBoundingBox();
|
||||
if ( bBox.isValid() )
|
||||
{
|
||||
|
@ -51,9 +51,7 @@ void RicNewSimWellIntersectionFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
for ( auto simWell : simWells )
|
||||
{
|
||||
RimEclipseView* eclView = nullptr;
|
||||
simWell->firstAncestorOrThisOfType( eclView );
|
||||
CVF_ASSERT( eclView );
|
||||
RimEclipseView* eclView = simWell->firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
|
||||
|
||||
auto* cmd = new RicNewSimWellIntersectionCmd( eclView->intersectionCollection(), simWell );
|
||||
caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd );
|
||||
|
@ -114,7 +114,7 @@ RimEclipseCase* RicAddEclipseInputPropertyFeature::getEclipseCase() const
|
||||
RimEclipseCellColors* cellColors = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCellColors>();
|
||||
if ( cellColors )
|
||||
{
|
||||
cellColors->firstAncestorOrThisOfType( eclipseCase );
|
||||
eclipseCase = cellColors->firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
return eclipseCase;
|
||||
@ -124,7 +124,7 @@ RimEclipseCase* RicAddEclipseInputPropertyFeature::getEclipseCase() const
|
||||
RimEclipseView* eclipseView = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseView>();
|
||||
if ( eclipseView )
|
||||
{
|
||||
eclipseView->firstAncestorOrThisOfType( eclipseCase );
|
||||
eclipseCase = eclipseView->firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
return eclipseCase;
|
||||
|
@ -76,8 +76,7 @@ void RicApplyPropertyFilterAsCellResultFeature::onActionTriggered( bool isChecke
|
||||
RimEclipsePropertyFilter* propertyFilter = objects[0];
|
||||
if ( !propertyFilter ) return;
|
||||
|
||||
RimEclipseView* rimEclipseView = nullptr;
|
||||
propertyFilter->firstAncestorOrThisOfType( rimEclipseView );
|
||||
RimEclipseView* rimEclipseView = propertyFilter->firstAncestorOrThisOfType<RimEclipseView>();
|
||||
if ( !rimEclipseView ) return;
|
||||
|
||||
rimEclipseView->cellResult()->simpleCopy( propertyFilter->resultDefinition() );
|
||||
@ -98,8 +97,7 @@ void RicApplyPropertyFilterAsCellResultFeature::onActionTriggered( bool isChecke
|
||||
RimGeoMechPropertyFilter* propertyFilter = objects[0];
|
||||
if ( !propertyFilter ) return;
|
||||
|
||||
RimGeoMechView* geoMechView = nullptr;
|
||||
propertyFilter->firstAncestorOrThisOfType( geoMechView );
|
||||
RimGeoMechView* geoMechView = propertyFilter->firstAncestorOrThisOfType<RimGeoMechView>();
|
||||
if ( !geoMechView ) return;
|
||||
|
||||
geoMechView->cellResultResultDefinition()->setResultAddress( propertyFilter->resultDefinition()->resultAddress() );
|
||||
|
@ -43,8 +43,7 @@ bool RicComputeStatisticsFeature::isCommandEnabled()
|
||||
RimEclipseStatisticsCase* statisticsCase = selection[0];
|
||||
if ( statisticsCase )
|
||||
{
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup = nullptr;
|
||||
statisticsCase->firstAncestorOrThisOfType( gridCaseGroup );
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup = statisticsCase->firstAncestorOrThisOfType<RimIdenticalGridCaseGroup>();
|
||||
|
||||
RimCaseCollection* caseCollection = gridCaseGroup ? gridCaseGroup->caseCollection() : nullptr;
|
||||
return caseCollection ? caseCollection->reservoirs.size() > 0 : false;
|
||||
|
@ -94,8 +94,7 @@ void RicEclipsePropertyFilterFeatureImpl::insertPropertyFilter( RimEclipseProper
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipsePropertyFilterFeatureImpl::isPropertyFilterCommandAvailable( caf::PdmObjectHandle* object )
|
||||
{
|
||||
Rim3dView* rimView = nullptr;
|
||||
object->firstAncestorOrThisOfType( rimView );
|
||||
auto rimView = object->firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( rimView )
|
||||
{
|
||||
RimViewController* vc = rimView->viewController();
|
||||
@ -115,11 +114,7 @@ void RicEclipsePropertyFilterFeatureImpl::setDefaults( RimEclipsePropertyFilter*
|
||||
{
|
||||
CVF_ASSERT( propertyFilter );
|
||||
|
||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
|
||||
propertyFilter->firstAncestorOrThisOfTypeAsserted( propertyFilterCollection );
|
||||
|
||||
RimEclipseView* reservoirView = nullptr;
|
||||
propertyFilter->firstAncestorOrThisOfTypeAsserted( reservoirView );
|
||||
auto reservoirView = propertyFilter->firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
|
||||
|
||||
propertyFilter->resultDefinition()->setEclipseCase( reservoirView->eclipseCase() );
|
||||
|
||||
|
@ -56,8 +56,8 @@ QString RicEclipsePropertyFilterInsertExec::name()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipsePropertyFilterInsertExec::redo()
|
||||
{
|
||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
|
||||
m_propertyFilter->firstAncestorOrThisOfTypeAsserted( propertyFilterCollection );
|
||||
RimEclipsePropertyFilterCollection* propertyFilterCollection =
|
||||
m_propertyFilter->firstAncestorOrThisOfTypeAsserted<RimEclipsePropertyFilterCollection>();
|
||||
|
||||
size_t index = propertyFilterCollection->propertyFiltersField().indexOf( m_propertyFilter );
|
||||
CVF_ASSERT( index < propertyFilterCollection->propertyFilters().size() );
|
||||
|
@ -57,8 +57,7 @@ void RicEclipsePropertyFilterNewExec::redo()
|
||||
{
|
||||
RicEclipsePropertyFilterFeatureImpl::addPropertyFilter( m_propertyFilterCollection );
|
||||
|
||||
RimGridView* view = nullptr;
|
||||
m_propertyFilterCollection->firstAncestorOrThisOfTypeAsserted( view );
|
||||
RimGridView* view = m_propertyFilterCollection->firstAncestorOrThisOfTypeAsserted<RimGridView>();
|
||||
|
||||
// Enable display of grid cells, to be able to show generated property filter
|
||||
view->showGridCells( true );
|
||||
|
@ -76,9 +76,7 @@ void RicEclipseShowOnlyFaultFeature::onActionTriggered( bool isChecked )
|
||||
if ( !rimFault ) return;
|
||||
if ( !rimFault->parentField() ) return;
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> children;
|
||||
rimFault->parentField()->children( &children );
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> children = rimFault->parentField()->children();
|
||||
for ( auto& child : children )
|
||||
{
|
||||
caf::PdmUiObjectHandle* childUiObject = uiObj( child );
|
||||
|
@ -177,8 +177,7 @@ void RicCellRangeUi::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
}
|
||||
|
||||
// If this object is contained in another object, make sure the other object is updated
|
||||
RicExportCarfinUi* exportCarfin = nullptr;
|
||||
this->firstAncestorOrThisOfType( exportCarfin );
|
||||
RicExportCarfinUi* exportCarfin = firstAncestorOrThisOfType<RicExportCarfinUi>();
|
||||
if ( exportCarfin )
|
||||
{
|
||||
exportCarfin->uiCapability()->updateConnectedEditors();
|
||||
|
@ -75,7 +75,7 @@ void RicCreateDepthAdjustedLasFilesFeature::onActionTriggered( bool isChecked )
|
||||
RimCase* selectedCase = featureUi.selectedCase();
|
||||
RimWellPath* sourceWell = featureUi.sourceWell();
|
||||
RimWellLogFile* soureWellLogFile = featureUi.wellLogFile();
|
||||
std::vector<RimWellPath*> destinationWells = featureUi.destinationWells().ptrReferencedObjects();
|
||||
std::vector<RimWellPath*> destinationWells = featureUi.destinationWells().ptrReferencedObjectsByType();
|
||||
std::vector<QString> selectedResultProperties = featureUi.selectedResultProperties();
|
||||
QString exportFolder = featureUi.exportFolder();
|
||||
|
||||
|
@ -78,9 +78,7 @@ void RicExportFaultsFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
for ( RimFaultInView* rimFault : selectedFaults )
|
||||
{
|
||||
RimEclipseCase* eclCase = nullptr;
|
||||
rimFault->firstAncestorOrThisOfType( eclCase );
|
||||
|
||||
RimEclipseCase* eclCase = rimFault->firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( eclCase )
|
||||
{
|
||||
QString caseName = eclCase->caseUserDescription();
|
||||
|
@ -834,8 +834,7 @@ std::vector<RimWellPath*> RicExportLgrFeature::selectedWellPaths()
|
||||
|
||||
for ( auto completion : selectedCompletions )
|
||||
{
|
||||
RimWellPath* parentWellPath;
|
||||
completion->firstAncestorOrThisOfType( parentWellPath );
|
||||
RimWellPath* parentWellPath = completion->firstAncestorOrThisOfType<RimWellPath>();
|
||||
|
||||
if ( parentWellPath ) wellPaths.push_back( parentWellPath );
|
||||
}
|
||||
|
@ -86,9 +86,7 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QS
|
||||
|
||||
const QString absSnapshotPath = snapshotPath.absolutePath();
|
||||
|
||||
std::vector<RimViewWindow*> viewWindows;
|
||||
RimMainPlotCollection::current()->descendantsIncludingThisOfType( viewWindows );
|
||||
|
||||
std::vector<RimViewWindow*> viewWindows = RimMainPlotCollection::current()->descendantsIncludingThisOfType<RimViewWindow>();
|
||||
for ( auto viewWindow : viewWindows )
|
||||
{
|
||||
if ( viewWindow->isMdiWindow() && viewWindow->viewWidget() && ( viewId == -1 || viewId == viewWindow->id() ) )
|
||||
|
@ -45,7 +45,7 @@ void RicSelectViewUI::setView( RimEclipseView* currentView )
|
||||
{
|
||||
m_currentView = currentView;
|
||||
|
||||
m_currentView->firstAncestorOrThisOfTypeAsserted( m_currentCase );
|
||||
m_currentCase = m_currentView->firstAncestorOrThisOfTypeAsserted<RimEclipseResultCase>();
|
||||
|
||||
m_selectedView = m_currentView;
|
||||
}
|
||||
|
@ -45,17 +45,14 @@ bool RicShowContributingWellsFeature::isCommandEnabled()
|
||||
if ( collection.size() == 1 )
|
||||
{
|
||||
RimSimWellInView* well = collection[0];
|
||||
RimEclipseView* eclipseView = nullptr;
|
||||
well->firstAncestorOrThisOfType( eclipseView );
|
||||
RimEclipseView* eclipseView = well->firstAncestorOrThisOfType<RimEclipseView>();
|
||||
|
||||
if ( eclipseView )
|
||||
{
|
||||
RimFlowDiagSolution* flowDiagSolution = eclipseView->cellResult()->flowDiagSolution();
|
||||
if ( !flowDiagSolution )
|
||||
{
|
||||
RimEclipseResultCase* eclipseResultCase = nullptr;
|
||||
well->firstAncestorOrThisOfType( eclipseResultCase );
|
||||
|
||||
RimEclipseResultCase* eclipseResultCase = well->firstAncestorOrThisOfType<RimEclipseResultCase>();
|
||||
if ( eclipseResultCase )
|
||||
{
|
||||
flowDiagSolution = eclipseResultCase->defaultFlowDiagSolution();
|
||||
@ -83,11 +80,9 @@ void RicShowContributingWellsFeature::onActionTriggered( bool isChecked )
|
||||
CAF_ASSERT( collection.size() == 1 );
|
||||
|
||||
RimSimWellInView* well = collection[0];
|
||||
RimEclipseView* eclipseView = nullptr;
|
||||
well->firstAncestorOrThisOfTypeAsserted( eclipseView );
|
||||
RimEclipseView* eclipseView = well->firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
|
||||
|
||||
RimEclipseResultCase* eclipseResultCase = nullptr;
|
||||
well->firstAncestorOrThisOfTypeAsserted( eclipseResultCase );
|
||||
RimEclipseResultCase* eclipseResultCase = well->firstAncestorOrThisOfTypeAsserted<RimEclipseResultCase>();
|
||||
|
||||
RimEclipseView* modifiedView =
|
||||
RicShowContributingWellsFeatureImpl::manipulateSelectedView( eclipseResultCase, well->name(), eclipseView->currentTimeStep() );
|
||||
|
@ -83,8 +83,7 @@ void RicShowContributingWellsFeatureImpl::modifyViewToShowContributingWells( Rim
|
||||
CVF_ASSERT( selectedWell );
|
||||
if ( !selectedWell ) return;
|
||||
|
||||
RimEclipseResultCase* eclipseResultCase = nullptr;
|
||||
selectedWell->firstAncestorOrThisOfTypeAsserted( eclipseResultCase );
|
||||
RimEclipseResultCase* eclipseResultCase = selectedWell->firstAncestorOrThisOfTypeAsserted<RimEclipseResultCase>();
|
||||
|
||||
// Use the active flow diag solutions, or the first one as default
|
||||
RimFlowDiagSolution* flowDiagSolution = viewToModify->cellResult()->flowDiagSolution();
|
||||
|
@ -97,24 +97,20 @@ void RicShowCumulativePhasePlotFeature::setupActionLook( QAction* actionToSetup
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseResultCase* RicShowCumulativePhasePlotFeature::getDataFromSimWell( RimSimWellInView* simWell, QString& wellName, int& timeStepIndex )
|
||||
{
|
||||
RimEclipseResultCase* resultCase = nullptr;
|
||||
|
||||
if ( simWell )
|
||||
{
|
||||
wellName = simWell->name();
|
||||
|
||||
RimEclipseView* eclView = nullptr;
|
||||
simWell->firstAncestorOfType( eclView );
|
||||
|
||||
auto eclView = simWell->firstAncestorOfType<RimEclipseView>();
|
||||
if ( eclView )
|
||||
{
|
||||
timeStepIndex = eclView->currentTimeStep();
|
||||
}
|
||||
|
||||
simWell->firstAncestorOfType( resultCase );
|
||||
return simWell->firstAncestorOfType<RimEclipseResultCase>();
|
||||
}
|
||||
|
||||
return resultCase;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -92,9 +92,7 @@ std::set<RimWellAllocationPlot*> RicShowTotalAllocationDataFeature::selectedWell
|
||||
{
|
||||
CVF_ASSERT( obj );
|
||||
|
||||
RimWellAllocationPlot* parentPlot = nullptr;
|
||||
obj->firstAncestorOrThisOfType( parentPlot );
|
||||
|
||||
RimWellAllocationPlot* parentPlot = obj->firstAncestorOrThisOfType<RimWellAllocationPlot>();
|
||||
if ( parentPlot )
|
||||
{
|
||||
wellAllocPlots.insert( parentPlot );
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
@ -48,14 +49,9 @@ CAF_CMD_SOURCE_INIT( RicConvertAllFractureTemplatesToFieldFeature, "RicConvertAl
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicConvertAllFractureTemplatesToFieldFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto objHandle = caf::SelectionManager::instance()->selectedItemOfType<caf::PdmObjectHandle>();
|
||||
if ( !objHandle ) return;
|
||||
RimFractureTemplateCollection* fracTempColl = caf::firstAncestorOfTypeFromSelectedObject<RimFractureTemplateCollection>();
|
||||
|
||||
RimFractureTemplateCollection* fracTempColl = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( fracTempColl );
|
||||
|
||||
std::vector<RimEllipseFractureTemplate*> ellipseFracTemplates;
|
||||
fracTempColl->descendantsIncludingThisOfType( ellipseFracTemplates );
|
||||
std::vector<RimEllipseFractureTemplate*> ellipseFracTemplates = fracTempColl->descendantsIncludingThisOfType<RimEllipseFractureTemplate>();
|
||||
|
||||
for ( auto ellipseFracTemplate : ellipseFracTemplates )
|
||||
{
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include "cafSelectionManagerTools.h"
|
||||
#include <QAction>
|
||||
#include <QFileInfo>
|
||||
#include <QString>
|
||||
@ -48,16 +49,10 @@ CAF_CMD_SOURCE_INIT( RicConvertAllFractureTemplatesToMetricFeature, "RicConvertA
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicConvertAllFractureTemplatesToMetricFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto objHandle = caf::SelectionManager::instance()->selectedItemOfType<caf::PdmObjectHandle>();
|
||||
if ( !objHandle ) return;
|
||||
|
||||
RimFractureTemplateCollection* fracTempColl = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( fracTempColl );
|
||||
RimFractureTemplateCollection* fracTempColl = caf::firstAncestorOfTypeFromSelectedObject<RimFractureTemplateCollection>();
|
||||
if ( !fracTempColl ) return;
|
||||
|
||||
std::vector<RimEllipseFractureTemplate*> ellipseFracTemplates;
|
||||
fracTempColl->descendantsIncludingThisOfType( ellipseFracTemplates );
|
||||
|
||||
std::vector<RimEllipseFractureTemplate*> ellipseFracTemplates = fracTempColl->descendantsIncludingThisOfType<RimEllipseFractureTemplate>();
|
||||
for ( auto ellipseFracTemplate : ellipseFracTemplates )
|
||||
{
|
||||
if ( ellipseFracTemplate->fractureTemplateUnit() == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "cafPdmObjectHandle.h"
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
@ -50,19 +51,13 @@ CAF_CMD_SOURCE_INIT( RicCreateDuplicateTemplateInOtherUnitSystemFeature, "RicCon
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateDuplicateTemplateInOtherUnitSystemFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
auto objHandle = caf::SelectionManager::instance()->selectedItemOfType<caf::PdmObjectHandle>();
|
||||
if ( !objHandle ) return;
|
||||
|
||||
RimFractureTemplate* fractureTemplate = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( fractureTemplate );
|
||||
RimFractureTemplate* fractureTemplate = caf::firstAncestorOfTypeFromSelectedObject<RimFractureTemplate>();
|
||||
if ( !fractureTemplate ) return;
|
||||
|
||||
RimFractureTemplateCollection* fractureTemplateCollection = nullptr;
|
||||
fractureTemplate->firstAncestorOrThisOfType( fractureTemplateCollection );
|
||||
|
||||
auto copyOfTemplate = dynamic_cast<RimFractureTemplate*>(
|
||||
fractureTemplate->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
|
||||
RimFractureTemplateCollection* fractureTemplateCollection = caf::firstAncestorOfTypeFromSelectedObject<RimFractureTemplateCollection>();
|
||||
fractureTemplateCollection->addFractureTemplate( copyOfTemplate );
|
||||
|
||||
auto currentUnit = copyOfTemplate->fractureTemplateUnit();
|
||||
@ -90,11 +85,7 @@ void RicCreateDuplicateTemplateInOtherUnitSystemFeature::onActionTriggered( bool
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateDuplicateTemplateInOtherUnitSystemFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
auto objHandle = caf::SelectionManager::instance()->selectedItemOfType<caf::PdmObjectHandle>();
|
||||
if ( !objHandle ) return;
|
||||
|
||||
RimFractureTemplate* fractureTemplate = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( fractureTemplate );
|
||||
RimFractureTemplate* fractureTemplate = caf::firstAncestorOfTypeFromSelectedObject<RimFractureTemplate>();
|
||||
if ( !fractureTemplate ) return;
|
||||
|
||||
QString destinationUnit;
|
||||
|
@ -112,8 +112,7 @@ void RicCreateMultipleFracturesOptionItemUi::fieldChangedByUi( const caf::PdmFie
|
||||
if ( m_baseKOneBased < m_topKOneBased ) m_topKOneBased = m_baseKOneBased;
|
||||
}
|
||||
|
||||
RiuCreateMultipleFractionsUi* parent = nullptr;
|
||||
this->firstAncestorOrThisOfType( parent );
|
||||
RiuCreateMultipleFractionsUi* parent = firstAncestorOrThisOfType<RiuCreateMultipleFractionsUi>();
|
||||
if ( parent )
|
||||
{
|
||||
parent->updateButtonsEnableState();
|
||||
|
@ -132,7 +132,7 @@ void RiuCreateMultipleFractionsUi::resetValues()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RicCreateMultipleFracturesOptionItemUi*> RiuCreateMultipleFractionsUi::options() const
|
||||
{
|
||||
return m_options.children();
|
||||
return m_options.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -37,8 +37,7 @@ void RicDeleteOptionItemFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( !optionItems.empty() )
|
||||
{
|
||||
RiuCreateMultipleFractionsUi* multipleFractionUi = nullptr;
|
||||
optionItems[0]->firstAncestorOrThisOfTypeAsserted( multipleFractionUi );
|
||||
RiuCreateMultipleFractionsUi* multipleFractionUi = optionItems[0]->firstAncestorOrThisOfTypeAsserted<RiuCreateMultipleFractionsUi>();
|
||||
|
||||
for ( auto optionItem : optionItems )
|
||||
{
|
||||
|
@ -37,8 +37,7 @@ private:
|
||||
template <typename T>
|
||||
static QString nameForNewObject( const QString& namePattern )
|
||||
{
|
||||
std::vector<T*> oldObjects;
|
||||
RimProject::current()->activeOilField()->descendantsIncludingThisOfType( oldObjects );
|
||||
std::vector<T*> oldObjects = RimProject::current()->activeOilField()->descendantsIncludingThisOfType<T>();
|
||||
|
||||
size_t objectNum = oldObjects.size();
|
||||
|
||||
|
@ -64,8 +64,7 @@ void RicMeshFractureTemplateHelper<T>::selectFractureTemplateAndUpdate( RimFract
|
||||
{
|
||||
fractureTemplate->loadDataAndUpdate();
|
||||
|
||||
RimFractureTemplateCollection* templateCollection = nullptr;
|
||||
fractureTemplate->firstAncestorOrThisOfTypeAsserted( templateCollection );
|
||||
RimFractureTemplateCollection* templateCollection = fractureTemplate->firstAncestorOrThisOfTypeAsserted<RimFractureTemplateCollection>();
|
||||
templateCollection->updateConnectedEditors();
|
||||
|
||||
RimProject* project = RimProject::current();
|
||||
|
@ -53,8 +53,7 @@ void RicNewEllipseFractureTemplateFeature::selectFractureTemplateAndUpdate( RimF
|
||||
{
|
||||
fractureTemplate->loadDataAndUpdate();
|
||||
|
||||
RimFractureTemplateCollection* templateCollection = nullptr;
|
||||
fractureTemplate->firstAncestorOrThisOfTypeAsserted( templateCollection );
|
||||
RimFractureTemplateCollection* templateCollection = fractureTemplate->firstAncestorOrThisOfTypeAsserted<RimFractureTemplateCollection>();
|
||||
templateCollection->updateConnectedEditors();
|
||||
|
||||
RimProject* project = RimProject::current();
|
||||
|
@ -62,7 +62,7 @@ void RicNewOptionItemFeature::onActionTriggered( bool isChecked )
|
||||
if ( !optionItems.empty() )
|
||||
{
|
||||
selectedOptionItem = optionItems.front();
|
||||
selectedOptionItem->firstAncestorOrThisOfTypeAsserted( multipleFractionUi );
|
||||
multipleFractionUi = selectedOptionItem->firstAncestorOrThisOfTypeAsserted<RiuCreateMultipleFractionsUi>();
|
||||
}
|
||||
|
||||
if ( !selectedOptionItem && multipleFractionUi && !multipleFractionUi->options().empty() )
|
||||
|
@ -83,20 +83,17 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
fracture->setClosestWellCoord( simWellItem->m_domainCoord, simWellItem->m_branchIndex );
|
||||
|
||||
RimOilField* oilfield = nullptr;
|
||||
simWell->firstAncestorOrThisOfType( oilfield );
|
||||
RimOilField* oilfield = RimProject::current()->activeOilField();
|
||||
if ( !oilfield ) return;
|
||||
|
||||
std::vector<RimFracture*> oldFractures;
|
||||
oilfield->descendantsIncludingThisOfType( oldFractures );
|
||||
std::vector<RimFracture*> oldFractures = oilfield->descendantsIncludingThisOfType<RimFracture>();
|
||||
QString fracNum = QString( "%1" ).arg( oldFractures.size(), 2, 10, QChar( '0' ) );
|
||||
|
||||
fracture->setName( QString( "Fracture_" ) + fracNum );
|
||||
|
||||
auto unitSet = RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
|
||||
{
|
||||
RimEclipseResultCase* eclipseCase = nullptr;
|
||||
simWell->firstAncestorOrThisOfType( eclipseCase );
|
||||
RimEclipseResultCase* eclipseCase = simWell->firstAncestorOrThisOfType<RimEclipseResultCase>();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
unitSet = eclipseCase->eclipseCaseData()->unitsType();
|
||||
@ -112,8 +109,7 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
activeView->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
simWell->firstAncestorOrThisOfType( eclipseCase );
|
||||
auto eclipseCase = simWell->firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
proj->reloadCompletionTypeResultsForEclipseCase( eclipseCase );
|
||||
@ -142,9 +138,7 @@ bool RicNewSimWellFractureAtPosFeature::isCommandEnabled()
|
||||
auto objHandle = caf::SelectionManager::instance()->selectedItemOfType<caf::PdmObjectHandle>();
|
||||
if ( !objHandle ) return false;
|
||||
|
||||
RimSimWellInView* eclipseWell = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( eclipseWell );
|
||||
|
||||
RimSimWellInView* eclipseWell = objHandle->firstAncestorOrThisOfType<RimSimWellInView>();
|
||||
if ( eclipseWell )
|
||||
{
|
||||
return true;
|
||||
|
@ -57,8 +57,7 @@ void RicNewSimWellFractureFeature::onActionTriggered( bool isChecked )
|
||||
auto objHandle = caf::SelectionManager::instance()->selectedItemOfType<caf::PdmObjectHandle>();
|
||||
if ( !objHandle ) return;
|
||||
|
||||
RimSimWellInView* eclipseWell = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( eclipseWell );
|
||||
auto eclipseWell = objHandle->firstAncestorOrThisOfType<RimSimWellInView>();
|
||||
|
||||
RimSimWellFracture* fracture = new RimSimWellFracture();
|
||||
if ( eclipseWell->simwellFractureCollection()->simwellFractures.empty() )
|
||||
@ -72,16 +71,14 @@ void RicNewSimWellFractureFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
eclipseWell->simwellFractureCollection()->simwellFractures.push_back( fracture );
|
||||
|
||||
RimOilField* oilfield = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( oilfield );
|
||||
auto oilfield = objHandle->firstAncestorOrThisOfType<RimOilField>();
|
||||
if ( !oilfield ) return;
|
||||
|
||||
fracture->setName( RicFractureNameGenerator::nameForNewFracture() );
|
||||
|
||||
auto unitSet = RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
|
||||
{
|
||||
RimEclipseResultCase* eclipseCase = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( eclipseCase );
|
||||
auto eclipseCase = objHandle->firstAncestorOrThisOfType<RimEclipseResultCase>();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
unitSet = eclipseCase->eclipseCaseData()->unitsType();
|
||||
@ -96,8 +93,7 @@ void RicNewSimWellFractureFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
eclipseWell->updateConnectedEditors();
|
||||
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( eclipseCase );
|
||||
auto eclipseCase = objHandle->firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
proj->reloadCompletionTypeResultsForEclipseCase( eclipseCase );
|
||||
@ -126,9 +122,7 @@ bool RicNewSimWellFractureFeature::isCommandEnabled()
|
||||
auto objHandle = caf::SelectionManager::instance()->selectedItemOfType<caf::PdmObjectHandle>();
|
||||
if ( !objHandle ) return false;
|
||||
|
||||
RimSimWellInView* simWell = nullptr;
|
||||
objHandle->firstAncestorOrThisOfType( simWell );
|
||||
|
||||
auto simWell = objHandle->firstAncestorOrThisOfType<RimSimWellInView>();
|
||||
if ( simWell )
|
||||
{
|
||||
return true;
|
||||
|
@ -60,10 +60,6 @@ RimStimPlanModel* RicNewStimPlanModelFeature::addStimPlanModel( RimWellPath*
|
||||
RimStimPlanModelCollection* stimPlanModelCollection = wellPath->stimPlanModelCollection();
|
||||
CVF_ASSERT( stimPlanModelCollection );
|
||||
|
||||
RimOilField* oilfield = nullptr;
|
||||
stimPlanModelCollection->firstAncestorOrThisOfType( oilfield );
|
||||
if ( !oilfield ) return nullptr;
|
||||
|
||||
RimStimPlanModel* stimPlanModel = new RimStimPlanModel();
|
||||
stimPlanModelCollection->addStimPlanModel( stimPlanModel );
|
||||
|
||||
@ -73,9 +69,6 @@ RimStimPlanModel* RicNewStimPlanModelFeature::addStimPlanModel( RimWellPath*
|
||||
QString stimPlanModelName = RicFractureNameGenerator::nameForNewStimPlanModel();
|
||||
stimPlanModel->setName( stimPlanModelName );
|
||||
|
||||
RimProject* project = nullptr;
|
||||
stimPlanModelCollection->firstAncestorOrThisOfType( project );
|
||||
|
||||
// Add a "fake" well path for thickess direction
|
||||
RimModeledWellPath* thicknessDirectionWellPath = new RimModeledWellPath;
|
||||
stimPlanModel->setThicknessDirectionWellPath( thicknessDirectionWellPath );
|
||||
@ -83,6 +76,7 @@ RimStimPlanModel* RicNewStimPlanModelFeature::addStimPlanModel( RimWellPath*
|
||||
std::vector<RimWellPath*> wellPaths = { thicknessDirectionWellPath };
|
||||
wellPathCollection->addWellPaths( wellPaths );
|
||||
|
||||
RimProject* project = RimProject::current();
|
||||
if ( project )
|
||||
{
|
||||
project->reloadCompletionTypeResultsInAllViews();
|
||||
@ -106,11 +100,8 @@ void RicNewStimPlanModelFeature::onActionTriggered( bool isChecked )
|
||||
RimStimPlanModelCollection* fractureColl = RicNewStimPlanModelFeature::selectedStimPlanModelCollection();
|
||||
if ( !fractureColl ) return;
|
||||
|
||||
RimWellPath* wellPath = nullptr;
|
||||
fractureColl->firstAncestorOrThisOfTypeAsserted( wellPath );
|
||||
|
||||
RimWellPathCollection* wellPathCollection = nullptr;
|
||||
fractureColl->firstAncestorOrThisOfTypeAsserted( wellPathCollection );
|
||||
auto wellPath = fractureColl->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
|
||||
auto wellPathCollection = fractureColl->firstAncestorOrThisOfTypeAsserted<RimWellPathCollection>();
|
||||
|
||||
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>( RiaApplication::instance()->activeGridView() );
|
||||
RimEclipseCase* eclipseCase = nullptr;
|
||||
@ -152,12 +143,10 @@ RimStimPlanModelCollection* RicNewStimPlanModelFeature::selectedStimPlanModelCol
|
||||
|
||||
caf::PdmUiItem* pdmUiItem = selectedItems.front();
|
||||
|
||||
RimStimPlanModelCollection* stimPlanModelCollection = nullptr;
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( pdmUiItem );
|
||||
if ( objHandle )
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType( stimPlanModelCollection );
|
||||
|
||||
RimStimPlanModelCollection* stimPlanModelCollection = objHandle->firstAncestorOrThisOfType<RimStimPlanModelCollection>();
|
||||
if ( stimPlanModelCollection ) return stimPlanModelCollection;
|
||||
|
||||
RimWellPath* wellPath = dynamic_cast<RimWellPath*>( objHandle );
|
||||
|
@ -72,9 +72,7 @@ RimWellPathFracture* RicNewWellPathFractureFeature::addFracture( gsl::not_null<R
|
||||
CVF_ASSERT( wellPathGeometry );
|
||||
if ( !wellPathGeometry ) return nullptr;
|
||||
|
||||
RimOilField* oilfield = nullptr;
|
||||
fractureCollection->firstAncestorOrThisOfType( oilfield );
|
||||
if ( !oilfield ) return nullptr;
|
||||
RimProject* project = RimProject::current();
|
||||
|
||||
RimWellPathFracture* fracture = new RimWellPathFracture();
|
||||
fractureCollection->addFracture( fracture );
|
||||
@ -90,14 +88,12 @@ RimWellPathFracture* RicNewWellPathFractureFeature::addFracture( gsl::not_null<R
|
||||
auto unitSet = wellPath->unitSystem();
|
||||
fracture->setFractureUnit( unitSet );
|
||||
|
||||
RimFractureTemplate* fracDef = oilfield->fractureDefinitionCollection()->firstFractureOfUnit( unitSet );
|
||||
RimFractureTemplate* fracDef = project->activeOilField()->fractureDefinitionCollection()->firstFractureOfUnit( unitSet );
|
||||
if ( fracDef )
|
||||
{
|
||||
fracture->setFractureTemplate( fracDef );
|
||||
}
|
||||
|
||||
RimProject* project = nullptr;
|
||||
fractureCollection->firstAncestorOrThisOfType( project );
|
||||
if ( project )
|
||||
{
|
||||
project->reloadCompletionTypeResultsInAllViews();
|
||||
@ -119,8 +115,7 @@ void RicNewWellPathFractureFeature::onActionTriggered( bool isChecked )
|
||||
RimWellPathFractureCollection* fractureColl = RicNewWellPathFractureFeature::selectedWellPathFractureCollection();
|
||||
if ( !fractureColl ) return;
|
||||
|
||||
RimWellPath* wellPath = nullptr;
|
||||
fractureColl->firstAncestorOrThisOfTypeAsserted( wellPath );
|
||||
auto wellPath = fractureColl->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
|
||||
|
||||
double defaultMeasuredDepth = wellPath->uniqueStartMD();
|
||||
RicNewWellPathFractureFeature::addFracture( wellPath, defaultMeasuredDepth );
|
||||
@ -164,7 +159,7 @@ RimWellPathFractureCollection* RicNewWellPathFractureFeature::selectedWellPathFr
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>( pdmUiItem );
|
||||
if ( objHandle )
|
||||
{
|
||||
objHandle->firstAncestorOrThisOfType( objToFind );
|
||||
objToFind = objHandle->firstAncestorOrThisOfType<RimWellPathFractureCollection>();
|
||||
}
|
||||
|
||||
if ( objToFind == nullptr )
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "cafPdmObjectGroup.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QString>
|
||||
@ -99,13 +100,5 @@ void RicPasteEllipseFractureFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFractureTemplateCollection* RicPasteEllipseFractureFeature::fractureTemplateCollection()
|
||||
{
|
||||
RimFractureTemplateCollection* fractureTemplateColl = nullptr;
|
||||
|
||||
auto destinationObject = dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( destinationObject )
|
||||
{
|
||||
destinationObject->firstAncestorOrThisOfType( fractureTemplateColl );
|
||||
}
|
||||
|
||||
return fractureTemplateColl;
|
||||
return caf::firstAncestorOfTypeFromSelectedObject<RimFractureTemplateCollection>();
|
||||
}
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "cafPdmObjectGroup.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QString>
|
||||
@ -99,13 +100,5 @@ void RicPasteStimPlanFractureFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimFractureTemplateCollection* RicPasteStimPlanFractureFeature::fractureTemplateCollection()
|
||||
{
|
||||
RimFractureTemplateCollection* fractureTemplateColl = nullptr;
|
||||
|
||||
auto destinationObject = dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( destinationObject )
|
||||
{
|
||||
destinationObject->firstAncestorOrThisOfType( fractureTemplateColl );
|
||||
}
|
||||
|
||||
return fractureTemplateColl;
|
||||
return caf::firstAncestorOfTypeFromSelectedObject<RimFractureTemplateCollection>();
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "cafCmdFeatureManager.h"
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cafSelectionManagerTools.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -65,11 +66,7 @@ void RicCreateGridCrossPlotFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
else
|
||||
{
|
||||
caf::PdmObject* selectedObject = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
if ( !selectedObject ) return;
|
||||
|
||||
RimGridView* cellFilterView = nullptr;
|
||||
selectedObject->firstAncestorOrThisOfType( cellFilterView );
|
||||
auto cellFilterView = caf::firstAncestorOfTypeFromSelectedObject<RimGridView>();
|
||||
if ( cellFilterView ) dataSet->setCellFilterView( cellFilterView );
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,7 @@ std::vector<VdeExportPart> RicHoloLensExportImpl::partsForExport( const RimGridV
|
||||
{
|
||||
std::vector<VdeExportPart> exportParts;
|
||||
|
||||
RimEclipseCase* rimEclipseCase = nullptr;
|
||||
view.firstAncestorOrThisOfType( rimEclipseCase );
|
||||
RimEclipseCase* rimEclipseCase = view.firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
|
||||
if ( view.viewer() )
|
||||
{
|
||||
|
@ -63,8 +63,7 @@ void RicAppendIntersectionBoxFeature::onActionTriggered( bool isChecked )
|
||||
coll->updateConnectedEditors();
|
||||
Riu3DMainWindowTools::selectAsCurrentItem( intersectionBox );
|
||||
|
||||
RimGridView* rimView = nullptr;
|
||||
coll->firstAncestorOrThisOfTypeAsserted( rimView );
|
||||
RimGridView* rimView = coll->firstAncestorOrThisOfTypeAsserted<RimGridView>();
|
||||
rimView->showGridCells( false );
|
||||
}
|
||||
}
|
||||
@ -83,14 +82,12 @@ void RicAppendIntersectionBoxFeature::setupActionLook( QAction* actionToSetup )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionCollection* RicAppendIntersectionBoxFeature::intersectionCollection()
|
||||
{
|
||||
RimIntersectionCollection* intersectionBoxColl = nullptr;
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> selectedObjects;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedObjects );
|
||||
if ( selectedObjects.size() == 1 )
|
||||
{
|
||||
selectedObjects[0]->firstAncestorOrThisOfType( intersectionBoxColl );
|
||||
return selectedObjects[0]->firstAncestorOrThisOfType<RimIntersectionCollection>();
|
||||
}
|
||||
|
||||
return intersectionBoxColl;
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -58,8 +58,7 @@ void RicNewIntersectionViewFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
if ( !intersection ) continue;
|
||||
|
||||
RimCase* rimCase = nullptr;
|
||||
intersection->firstAncestorOrThisOfType( rimCase );
|
||||
RimCase* rimCase = intersection->firstAncestorOrThisOfType<RimCase>();
|
||||
if ( rimCase )
|
||||
{
|
||||
if ( intersection->direction() != RimExtrudedCurveIntersection::CrossSectionDirEnum::CS_VERTICAL )
|
||||
|
@ -61,8 +61,7 @@ void RicExecuteLastUsedScriptFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
RimScriptCollection* rootScriptCollection = RiaApplication::instance()->project()->scriptCollection();
|
||||
|
||||
std::vector<RimCalcScript*> scripts;
|
||||
rootScriptCollection->descendantsIncludingThisOfType( scripts );
|
||||
std::vector<RimCalcScript*> scripts = rootScriptCollection->descendantsIncludingThisOfType<RimCalcScript>();
|
||||
for ( auto c : scripts )
|
||||
{
|
||||
if ( c->absoluteFileName() == lastUsedScript )
|
||||
|
@ -69,7 +69,7 @@ void RicNewPythonScriptFeature::onActionTriggered( bool isChecked )
|
||||
{
|
||||
QFileInfo existingScriptFileInfo( calcScript->absoluteFileName() );
|
||||
fullPathNewScript = existingScriptFileInfo.absolutePath();
|
||||
calcScript->firstAncestorOrThisOfTypeAsserted( scriptColl );
|
||||
scriptColl = calcScript->firstAncestorOrThisOfTypeAsserted<RimScriptCollection>();
|
||||
}
|
||||
else if ( scriptColl )
|
||||
{
|
||||
|
@ -138,10 +138,8 @@ bool RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported( caf::PdmObjec
|
||||
if ( dynamic_cast<RimSummaryMultiPlot*>( pdmObject ) ) return true;
|
||||
|
||||
// Copy support based combined logic
|
||||
RimWellAllocationPlot* wellAllocPlot = nullptr;
|
||||
RimWellRftPlot* rftPlot = nullptr;
|
||||
pdmObject->firstAncestorOrThisOfType( wellAllocPlot );
|
||||
pdmObject->firstAncestorOrThisOfType( rftPlot );
|
||||
RimWellAllocationPlot* wellAllocPlot = pdmObject->firstAncestorOrThisOfType<RimWellAllocationPlot>();
|
||||
RimWellRftPlot* rftPlot = pdmObject->firstAncestorOrThisOfType<RimWellRftPlot>();
|
||||
|
||||
if ( dynamic_cast<RimPlotCurve*>( pdmObject ) && !dynamic_cast<RimGridCrossPlotCurve*>( pdmObject ) )
|
||||
{
|
||||
|
@ -89,12 +89,10 @@ RimIdenticalGridCaseGroup* RicPasteFeatureImpl::findGridCaseGroup( caf::PdmObjec
|
||||
{
|
||||
return dynamic_cast<RimIdenticalGridCaseGroup*>( objectHandle );
|
||||
}
|
||||
else if ( dynamic_cast<RimCaseCollection*>( objectHandle ) || dynamic_cast<RimEclipseCase*>( objectHandle ) )
|
||||
{
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup = nullptr;
|
||||
objectHandle->firstAncestorOrThisOfType( gridCaseGroup );
|
||||
|
||||
return gridCaseGroup;
|
||||
if ( dynamic_cast<RimCaseCollection*>( objectHandle ) || dynamic_cast<RimEclipseCase*>( objectHandle ) )
|
||||
{
|
||||
return objectHandle->firstAncestorOrThisOfType<RimIdenticalGridCaseGroup>();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -145,15 +145,13 @@ RimIntersectionCollection* RicPasteIntersectionsFeature::findIntersectionCollect
|
||||
RimExtrudedCurveIntersection* intersection = dynamic_cast<RimExtrudedCurveIntersection*>( objectHandle );
|
||||
if ( intersection )
|
||||
{
|
||||
intersection->firstAncestorOrThisOfType( intersectionCollection );
|
||||
return intersectionCollection;
|
||||
return intersection->firstAncestorOrThisOfType<RimIntersectionCollection>();
|
||||
}
|
||||
|
||||
RimBoxIntersection* intersectionBox = dynamic_cast<RimBoxIntersection*>( objectHandle );
|
||||
if ( intersectionBox )
|
||||
{
|
||||
intersectionBox->firstAncestorOrThisOfType( intersectionCollection );
|
||||
return intersectionCollection;
|
||||
return intersectionBox->firstAncestorOrThisOfType<RimIntersectionCollection>();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -163,8 +163,7 @@ void RicCloseCaseFeature::deleteEclipseCase( RimEclipseCase* eclipseCase )
|
||||
// This is done because the views do not work well
|
||||
if ( caseGroup->caseCollection()->reservoirs.size() == 1 )
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> children;
|
||||
caseGroup->statisticsCaseCollection()->reservoirs.children( &children );
|
||||
std::vector<caf::PdmObjectHandle*> children = caseGroup->statisticsCaseCollection()->reservoirs.children();
|
||||
|
||||
for ( size_t i = children.size(); i-- > 0; )
|
||||
{
|
||||
@ -257,8 +256,7 @@ bool RicCloseCaseFeature::userConfirmedGridCaseGroupChange( const std::vector<Ri
|
||||
|
||||
for ( auto caseToDelete : casesToBeDeleted )
|
||||
{
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup = nullptr;
|
||||
caseToDelete->firstAncestorOrThisOfType( gridCaseGroup );
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup = caseToDelete->firstAncestorOrThisOfType<RimIdenticalGridCaseGroup>();
|
||||
|
||||
if ( gridCaseGroup && hasAnyStatisticsResults( gridCaseGroup ) )
|
||||
{
|
||||
|
@ -65,8 +65,7 @@ void RicCloseObservedDataFeature::deleteObservedSummaryData( const std::vector<R
|
||||
multiPlot->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimObservedDataCollection* observedDataCollection = nullptr;
|
||||
observedData->firstAncestorOrThisOfTypeAsserted( observedDataCollection );
|
||||
RimObservedDataCollection* observedDataCollection = observedData->firstAncestorOrThisOfTypeAsserted<RimObservedDataCollection>();
|
||||
|
||||
observedDataCollection->removeObservedSummaryData( observedData );
|
||||
delete observedData;
|
||||
@ -83,8 +82,7 @@ void RicCloseObservedDataFeature::deleteObservedRmuRftData( const std::vector<Ri
|
||||
|
||||
for ( RimObservedFmuRftData* observedData : data )
|
||||
{
|
||||
RimObservedDataCollection* observedDataCollection = nullptr;
|
||||
observedData->firstAncestorOrThisOfTypeAsserted( observedDataCollection );
|
||||
RimObservedDataCollection* observedDataCollection = observedData->firstAncestorOrThisOfTypeAsserted<RimObservedDataCollection>();
|
||||
|
||||
for ( RimWellRftPlot* plot : rftPlotColl->rftPlots() )
|
||||
{
|
||||
|
@ -75,15 +75,13 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector<RimSummaryCase*
|
||||
plotsToUpdate.insert( multiPlot );
|
||||
}
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects;
|
||||
summaryCase->objectsWithReferringPtrFields( referringObjects );
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects = summaryCase->objectsWithReferringPtrFields();
|
||||
|
||||
for ( auto object : referringObjects )
|
||||
{
|
||||
if ( !object ) continue;
|
||||
|
||||
RimWellLogPlot* wellLogPlot = nullptr;
|
||||
object->firstAncestorOrThisOfType( wellLogPlot );
|
||||
RimWellLogPlot* wellLogPlot = object->firstAncestorOrThisOfType<RimWellLogPlot>();
|
||||
if ( wellLogPlot ) wellLogPlotsToDelete.insert( wellLogPlot );
|
||||
}
|
||||
}
|
||||
|
@ -58,8 +58,7 @@ bool RicContourMapPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eve
|
||||
{
|
||||
RiuMainWindow::instance()->selectAsCurrentItem( contourMap );
|
||||
|
||||
RimGridView* view = nullptr;
|
||||
contourMap->firstAncestorOrThisOfTypeAsserted( view );
|
||||
RimGridView* view = contourMap->firstAncestorOrThisOfTypeAsserted<RimGridView>();
|
||||
if ( !view ) return false;
|
||||
|
||||
cvf::Vec2d pickedPoint;
|
||||
|
@ -50,14 +50,12 @@ void RicDeleteItemExec::redo()
|
||||
caf::PdmChildArrayFieldHandle* listField = dynamic_cast<caf::PdmChildArrayFieldHandle*>( field );
|
||||
if ( listField )
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> children;
|
||||
listField->children( &children );
|
||||
std::vector<caf::PdmObjectHandle*> children = listField->children();
|
||||
|
||||
caf::PdmObjectHandle* obj = children[m_commandData.m_indexToObject];
|
||||
caf::SelectionManager::instance()->removeObjectFromAllSelections( obj );
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects;
|
||||
obj->objectsWithReferringPtrFields( referringObjects );
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects = obj->objectsWithReferringPtrFields();
|
||||
|
||||
if ( m_commandData.m_deletedObjectAsXml().isEmpty() )
|
||||
{
|
||||
|
@ -85,8 +85,7 @@ void RicDeleteItemFeature::deleteObject( caf::PdmObject* objectToDelete )
|
||||
|
||||
int indexToObject = -1;
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> childObjects;
|
||||
childArrayFieldHandle->children( &childObjects );
|
||||
std::vector<caf::PdmObjectHandle*> childObjects = childArrayFieldHandle->children();
|
||||
|
||||
for ( size_t i = 0; i < childObjects.size(); i++ )
|
||||
{
|
||||
|
@ -45,8 +45,7 @@ void RicDeletePressureTableItemFeature::onActionTriggered( bool isChecked )
|
||||
caf::SelectionManager::instance()->objectsByType( &items, caf::SelectionManager::FIRST_LEVEL );
|
||||
if ( !items.empty() )
|
||||
{
|
||||
RimPressureTable* pressureTable = nullptr;
|
||||
items[0]->firstAncestorOrThisOfTypeAsserted( pressureTable );
|
||||
RimPressureTable* pressureTable = items[0]->firstAncestorOrThisOfTypeAsserted<RimPressureTable>();
|
||||
for ( RimPressureTableItem* attributeToDelete : items )
|
||||
{
|
||||
pressureTable->deleteItem( attributeToDelete );
|
||||
|
@ -223,8 +223,7 @@ void RicDeleteSubItemsFeature::deleteSubItems( bool onlyDeleteUnchecked )
|
||||
|
||||
collection->updateConnectedEditors();
|
||||
|
||||
RimProject* proj = nullptr;
|
||||
collection->firstAncestorOrThisOfType( proj );
|
||||
RimProject* proj = RimProject::current();
|
||||
if ( proj ) proj->reloadCompletionTypeResultsInAllViews();
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user