Merge pull request #9048 from OPM/9047-performance-avoid-update-project

- Avoid update of project when creating new objects
- Added icon resource cache
- Avoid use of descendantsIncludingThisOfType()
This commit is contained in:
Magne Sjaastad
2022-06-13 13:54:55 +02:00
committed by GitHub
parent 7d246c1535
commit ccbda23b96
29 changed files with 184 additions and 149 deletions

View File

@@ -18,12 +18,10 @@
#include "RiaSimWellBranchTools.h"
#include "RiaApplication.h"
#include "RigEclipseCaseData.h"
#include "RimEclipseCase.h"
#include "RimProject.h"
#include "RimEclipseCaseTools.h"
#include "RimWellPlotTools.h"
#include "cafPdmUiOrdering.h"
@@ -34,12 +32,7 @@
std::vector<const RigWellPath*> RiaSimWellBranchTools::simulationWellBranches( const QString& simWellName,
bool useAutoDetectionOfBranches )
{
RiaApplication* app = RiaApplication::instance();
RimProject* proj = app->project();
// Find first case containing the specified simulation well
std::vector<RimEclipseCase*> simCases;
proj->descendantsIncludingThisOfType( simCases );
std::vector<RimEclipseCase*> simCases = RimEclipseCaseTools::eclipseCases();
auto caseItr = std::find_if( simCases.begin(), simCases.end(), [&simWellName]( const RimEclipseCase* eclCase ) {
const auto& eclData = eclCase->eclipseCaseData();

View File

@@ -82,7 +82,7 @@ void RicImportPolylinesAnnotationFeature::onActionTriggered( bool isChecked )
RimPolylinesFromFileAnnotation* lastCreatedOrUpdated = annotColl->importOrUpdatePolylinesFromFile( fileNames );
proj->updateConnectedEditors();
proj->activeOilField()->updateConnectedEditors();
if ( lastCreatedOrUpdated )
{

View File

@@ -292,8 +292,6 @@ void RicNewStimPlanModelPlotFeature::createFaciesTrack( RimStimPlanModelPlot* pl
faciesTrack->updateConnectedEditors();
plot->updateConnectedEditors();
RiaApplication::instance()->project()->updateConnectedEditors();
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::showPlotMainWindow();
}
@@ -343,8 +341,6 @@ void RicNewStimPlanModelPlotFeature::createLayersTrack( RimStimPlanModelPlot* pl
faciesTrack->updateConnectedEditors();
plot->updateConnectedEditors();
RiaApplication::instance()->project()->updateConnectedEditors();
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::showPlotMainWindow();
}
@@ -430,8 +426,6 @@ void RicNewStimPlanModelPlotFeature::createParametersTrack( RimStimPlanModelPlot
plotTrack->updateConnectedEditors();
plot->updateConnectedEditors();
RiaApplication::instance()->project()->updateConnectedEditors();
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::showPlotMainWindow();
}

View File

@@ -107,6 +107,8 @@ void RicCreateMultipleFracturesFeature::slotAppendFractures()
RiuCreateMultipleFractionsUi* multipleFractionsUi = this->multipleFractionsUi();
if ( !multipleFractionsUi ) return;
std::set<RimWellPathFractureCollection*> fractureCollectionToUpdate;
auto items = multipleFractionsUi->locationsForNewFractures();
for ( auto item : items )
{
@@ -127,6 +129,7 @@ void RicCreateMultipleFracturesFeature::slotAppendFractures()
RimWellPathFracture* fracture = new RimWellPathFracture();
fractureCollection->addFracture( fracture );
fractureCollectionToUpdate.insert( fractureCollection );
fracture->setFractureUnit( item.wellPath->unitSystem() );
fracture->setMeasuredDepth( item.measuredDepth );
@@ -145,7 +148,11 @@ void RicCreateMultipleFracturesFeature::slotAppendFractures()
RiaApplication* app = RiaApplication::instance();
RimProject* proj = app->project();
proj->updateConnectedEditors();
for ( auto coll : fractureCollectionToUpdate )
{
coll->updateConnectedEditors();
}
proj->reloadCompletionTypeResultsInAllViews();
}

View File

@@ -117,7 +117,7 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered( bool isChecked )
if ( eclipseCase )
{
proj->reloadCompletionTypeResultsForEclipseCase( eclipseCase );
proj->updateConnectedEditors();
fractureCollection->updateConnectedEditors();
}
Riu3DMainWindowTools::selectAsCurrentItem( fracture );
}

View File

@@ -101,7 +101,7 @@ void RicNewSimWellFractureFeature::onActionTriggered( bool isChecked )
if ( eclipseCase )
{
proj->reloadCompletionTypeResultsForEclipseCase( eclipseCase );
proj->updateConnectedEditors();
eclipseWell->simwellFractureCollection()->updateConnectedEditors();
}
Riu3DMainWindowTools::selectAsCurrentItem( fracture );
}

View File

@@ -86,7 +86,7 @@ RimStimPlanModel* RicNewStimPlanModelFeature::addStimPlanModel( RimWellPath*
if ( project )
{
project->reloadCompletionTypeResultsInAllViews();
project->updateAllRequiredEditors();
stimPlanModelCollection->updateAllRequiredEditors();
}
if ( measuredDepth > 0.0 )

View File

@@ -101,7 +101,7 @@ RimWellPathFracture* RicNewWellPathFractureFeature::addFracture( gsl::not_null<R
if ( project )
{
project->reloadCompletionTypeResultsInAllViews();
project->updateAllRequiredEditors();
fractureCollection->updateAllRequiredEditors();
}
Riu3DMainWindowTools::selectAsCurrentItem( fracture );

View File

@@ -325,7 +325,6 @@ ExtractionCurveType* RicWellLogTools::addExtractionCurve( RimWellLogTrack*
plotTrack->updateConnectedEditors();
plot->updateConnectedEditors();
RimProject::current()->updateConnectedEditors();
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem( curve );
@@ -387,7 +386,6 @@ RimWellLogRftCurve*
plotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL );
plotTrack->updateConnectedEditors();
RimProject::current()->updateConnectedEditors();
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem( curve );
@@ -416,7 +414,6 @@ RimWellLogFileCurve* RicWellLogTools::addFileCurve( RimWellLogTrack* plotTrack,
plotTrack->updateConnectedEditors();
RimProject::current()->updateConnectedEditors();
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem( curve );
@@ -489,7 +486,6 @@ RimWellMeasurementCurve* RicWellLogTools::addWellMeasurementCurve( RimWellLogTra
plotTrack->addCurve( curve );
plotTrack->updateConnectedEditors();
RimProject::current()->updateConnectedEditors();
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
RiuPlotMainWindowTools::selectAsCurrentItem( curve );

View File

@@ -164,7 +164,7 @@ void RicLinkVisibleViewsFeature::linkViews( std::vector<RimGridView*>& linkableV
viewLinker->updateUiNameAndIcon();
proj->viewLinkerCollection.uiCapability()->updateConnectedEditors();
proj->updateConnectedEditors();
proj->viewLinkerCollection->updateConnectedEditors();
Riu3DMainWindowTools::setExpanded( proj->viewLinkerCollection() );
}

View File

@@ -75,7 +75,7 @@ void RicSetMasterViewFeature::onActionTriggered( bool isChecked )
viewLinker->addDependentView( previousMasterView );
proj->viewLinkerCollection.uiCapability()->updateConnectedEditors();
proj->updateConnectedEditors();
proj->viewLinkerCollection->updateConnectedEditors();
// Set managed view collection to selected and expanded in project tree
Riu3DMainWindowTools::selectAsCurrentItem( viewLinker );

View File

@@ -68,8 +68,6 @@ void RicAdd3dWellLogCurveFeature::onActionTriggered( bool isChecked )
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
RimProject::current()->updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( rim3dWellLogExtractionCurve );
Riu3DMainWindowTools::setExpanded( selectedWellPath );

View File

@@ -56,7 +56,6 @@ void RicAdd3dWellLogFileCurveFeature::onActionTriggered( bool isChecked )
rim3dWellLogFileCurve->setDefaultFileCurveDataInfo();
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
RimProject::current()->updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( rim3dWellLogFileCurve );
Riu3DMainWindowTools::setExpanded( selectedWellPath );

View File

@@ -63,7 +63,6 @@ void RicAdd3dWellLogRftCurveFeature::onActionTriggered( bool isChecked )
selectedWellPath->add3dWellLogCurve( rim3dWellLogRftCurve );
RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews();
RimProject::current()->updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( rim3dWellLogRftCurve );
Riu3DMainWindowTools::setExpanded( selectedWellPath );

View File

@@ -104,8 +104,6 @@ void RicAddWellLogToPlotFeature::onActionTriggered( bool isChecked )
}
plot->updateLayout();
RimProject::current()->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
RiuPlotMainWindowTools::setExpanded( plotTrack );

View File

@@ -106,6 +106,8 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterC
QString( "Well Log Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots().size() ) );
}
wellLogPlotColl->updateConnectedEditors();
if ( showAfterCreation )
{
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();

View File

@@ -126,6 +126,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddress.h
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddressCollection.h
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.h
)
set(SOURCE_GROUP_SOURCE_FILES
@@ -251,6 +252,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddress.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddressCollection.cpp
${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.cpp
)
if(RESINSIGHT_USE_QT_CHARTS)

View File

@@ -26,6 +26,7 @@
#include "RigEclipseCaseData.h"
#include "RigFlowDiagResults.h"
#include "RimEclipseCaseTools.h"
#include "RimEclipseCellColors.h"
#include "RimEclipsePropertyFilter.h"
#include "RimEclipsePropertyFilterCollection.h"
@@ -33,7 +34,6 @@
#include "RimEclipseView.h"
#include "RimFaultInViewCollection.h"
#include "RimFlowDiagSolution.h"
#include "RimProject.h"
#include "RicEclipsePropertyFilterFeatureImpl.h"
#include "RicSelectOrCreateViewFeatureImpl.h"
@@ -268,18 +268,12 @@ QList<caf::PdmOptionItemInfo>
if ( fieldNeedingOptions == &m_case )
{
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType( proj );
if ( proj )
auto resultCases = RimEclipseCaseTools::eclipseResultCases();
for ( RimEclipseResultCase* c : resultCases )
{
std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType( cases );
for ( RimEclipseResultCase* c : cases )
if ( c->defaultFlowDiagSolution() )
{
if ( c->defaultFlowDiagSolution() )
{
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
}
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
}
}
}
@@ -399,29 +393,23 @@ QList<caf::PdmOptionItemInfo>
void RimFlowCharacteristicsPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
{
// Ensure a case is selected if one is available
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType( proj );
if ( proj )
RimEclipseResultCase* defaultCase = nullptr;
auto resultCases = RimEclipseCaseTools::eclipseResultCases();
for ( RimEclipseResultCase* c : resultCases )
{
std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType( cases );
RimEclipseResultCase* defaultCase = nullptr;
for ( RimEclipseResultCase* c : cases )
if ( c->defaultFlowDiagSolution() )
{
if ( c->defaultFlowDiagSolution() )
{
if ( !defaultCase ) defaultCase = c; // Select first
}
if ( !defaultCase ) defaultCase = c; // Select first
}
if ( !m_case() && defaultCase )
}
if ( !m_case() && defaultCase )
{
m_case = defaultCase;
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
if ( !m_case()->reservoirViews.empty() )
{
m_case = defaultCase;
m_flowDiagSolution = m_case->defaultFlowDiagSolution();
if ( !m_case()->reservoirViews.empty() )
{
m_cellFilterView = m_case()->reservoirViews()[0];
}
m_cellFilterView = m_case()->reservoirViews()[0];
}
}
}

View File

@@ -30,11 +30,11 @@
#include "RigWellResultPoint.h"
#include "RimEclipseCase.h"
#include "RimEclipseCaseTools.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseResultCase.h"
#include "RimEclipseView.h"
#include "RimFlowDiagSolution.h"
#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
@@ -43,11 +43,11 @@
#include "RimWellAllocationPlotLegend.h"
#include "RimWellFlowRateCurve.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogFile.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellLogFile.h"
#include "RimWellPlotTools.h"
#include "RiuPlotMainWindow.h"
#include "RiuQwtPlotWidget.h"
#include "RiuWellAllocationPlot.h"
@@ -732,17 +732,10 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions( cons
}
else if ( fieldNeedingOptions == &m_case )
{
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType( proj );
if ( proj )
auto resultCases = RimEclipseCaseTools::eclipseResultCases();
for ( RimEclipseResultCase* c : resultCases )
{
std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType( cases );
for ( RimEclipseResultCase* c : cases )
{
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
}
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
}
}
else if ( fieldNeedingOptions == &m_flowDiagSolution )

View File

@@ -17,9 +17,10 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellDistributionPlot.h"
#include "RimEclipseCaseTools.h"
#include "RimEclipseResultCase.h"
#include "RimFlowDiagSolution.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RigEclipseCaseData.h"
@@ -38,10 +39,6 @@
#include <QTextBrowser>
#include <QWidget>
//#include "cvfBase.h"
//#include "cvfTrace.h"
//#include "cvfDebugTimer.h"
#include <array>
//==================================================================================================
@@ -480,16 +477,10 @@ QList<caf::PdmOptionItemInfo> RimWellDistributionPlot::calculateValueOptions( co
if ( fieldNeedingOptions == &m_case )
{
RimProject* ownerProj = nullptr;
firstAncestorOrThisOfType( ownerProj );
if ( ownerProj )
auto resultCases = RimEclipseCaseTools::eclipseResultCases();
for ( RimEclipseResultCase* c : resultCases )
{
std::vector<RimEclipseResultCase*> caseArr;
ownerProj->descendantsIncludingThisOfType( caseArr );
for ( RimEclipseResultCase* c : caseArr )
{
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
}
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
}
}

View File

@@ -17,10 +17,11 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimWellDistributionPlotCollection.h"
#include "RimEclipseCaseTools.h"
#include "RimEclipseResultCase.h"
#include "RimFlowDiagSolution.h"
#include "RimPlot.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellDistributionPlot.h"
@@ -42,10 +43,6 @@
#include <QTextBrowser>
#include <QWidget>
//#include "cvfBase.h"
//#include "cvfTrace.h"
//#include "cvfDebugTimer.h"
//==================================================================================================
//
//
@@ -258,16 +255,10 @@ QList<caf::PdmOptionItemInfo>
if ( fieldNeedingOptions == &m_case )
{
RimProject* ownerProj = nullptr;
firstAncestorOrThisOfType( ownerProj );
if ( ownerProj )
auto resultCases = RimEclipseCaseTools::eclipseResultCases();
for ( RimEclipseResultCase* c : resultCases )
{
std::vector<RimEclipseResultCase*> caseArr;
ownerProj->descendantsIncludingThisOfType( caseArr );
for ( RimEclipseResultCase* c : caseArr )
{
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
}
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) );
}
}

View File

@@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RimEclipseCaseTools.h"
#include "RimEclipseResultCase.h"
#include "RimProject.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimEclipseCase*> RimEclipseCaseTools::eclipseCases()
{
if ( RimProject::current() )
{
return RimProject::current()->eclipseCases();
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimEclipseResultCase*> RimEclipseCaseTools::eclipseResultCases()
{
std::vector<RimEclipseResultCase*> resultCases;
auto eclipseCases = RimEclipseCaseTools::eclipseCases();
for ( auto ec : eclipseCases )
{
auto resultCase = dynamic_cast<RimEclipseResultCase*>( ec );
if ( resultCase != nullptr )
{
resultCases.push_back( resultCase );
}
}
return resultCases;
}

View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <vector>
class RimEclipseCase;
class RimEclipseResultCase;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RimEclipseCaseTools
{
public:
static std::vector<RimEclipseCase*> eclipseCases();
static std::vector<RimEclipseResultCase*> eclipseResultCases();
};

View File

@@ -19,7 +19,7 @@
#include "RimEclipseResultAddress.h"
#include "RimEclipseCase.h"
#include "RimProject.h"
#include "RimEclipseCaseTools.h"
CAF_PDM_SOURCE_INIT( RimEclipseResultAddress, "EclipseResultAddress" );
@@ -104,16 +104,10 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultAddress::calculateValueOptions( co
if ( fieldNeedingOptions == &m_eclipseCase )
{
RimProject* proj = nullptr;
this->firstAncestorOrThisOfType( proj );
if ( proj )
auto cases = RimEclipseCaseTools::eclipseCases();
for ( auto* c : cases )
{
std::vector<RimEclipseCase*> cases;
proj->descendantsIncludingThisOfType( cases );
for ( auto* c : cases )
{
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
}
options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
}
}

View File

@@ -125,8 +125,8 @@ CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" );
RimProject::RimProject( void )
: m_nextValidCaseId( 0 )
, m_nextValidCaseGroupId( 0 )
, m_nextValidViewId( 1 )
, m_nextValidPlotId( 1 )
, m_nextValidViewId( -1 )
, m_nextValidPlotId( -1 )
, m_nextValidSummaryCaseId( 1 )
, m_nextValidEnsembleId( 1 )
{
@@ -279,8 +279,8 @@ void RimProject::close()
m_nextValidCaseId = 0;
m_nextValidCaseGroupId = 0;
m_nextValidViewId = 1;
m_nextValidPlotId = 1;
m_nextValidViewId = -1;
m_nextValidPlotId = -1;
m_nextValidSummaryCaseId = 1;
m_nextValidEnsembleId = 1;
}
@@ -579,12 +579,15 @@ void RimProject::assignViewIdToView( Rim3dView* view )
{
if ( view )
{
std::vector<Rim3dView*> views;
this->descendantsIncludingThisOfType( views );
for ( Rim3dView* existingView : views )
if ( m_nextValidViewId < 0 )
{
m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 );
std::vector<Rim3dView*> views;
this->descendantsIncludingThisOfType( views );
for ( Rim3dView* existingView : views )
{
m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 );
}
}
view->setId( m_nextValidViewId++ );
@@ -598,12 +601,15 @@ void RimProject::assignPlotIdToPlotWindow( RimPlotWindow* plotWindow )
{
if ( plotWindow )
{
std::vector<RimPlotWindow*> plotWindows;
this->descendantsIncludingThisOfType( plotWindows );
for ( RimPlotWindow* existingPlotWindow : plotWindows )
if ( m_nextValidPlotId < 0 )
{
m_nextValidPlotId = std::max( m_nextValidPlotId, existingPlotWindow->id() + 1 );
std::vector<RimPlotWindow*> plotWindows;
this->descendantsIncludingThisOfType( plotWindows );
for ( RimPlotWindow* existingPlotWindow : plotWindows )
{
m_nextValidPlotId = std::max( m_nextValidPlotId, existingPlotWindow->id() + 1 );
}
}
plotWindow->setId( m_nextValidPlotId++ );
@@ -1475,11 +1481,8 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
}
else
{
if ( viewLinkerCollection()->viewLinker() )
{
// Use object instead of field to avoid duplicate entries in the tree view
uiTreeOrdering.add( viewLinkerCollection() );
}
// Use object instead of field to avoid duplicate entries in the tree view
uiTreeOrdering.add( viewLinkerCollection() );
RimOilField* oilField = activeOilField();
if ( oilField )

View File

@@ -251,15 +251,7 @@ void RimWellLogPlotCollection::removeExtractors( const RigGeoMechCaseData* caseD
void RimWellLogPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::vector<caf::PdmObjectHandle*>& referringObjects )
{
// Make sure the plot collection disappears with the last plot
if ( m_wellLogPlots().empty() )
{
RimProject* project = RimProject::current();
if ( project )
{
project->updateConnectedEditors();
}
}
updateConnectedEditors();
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
mainPlotWindow->updateWellLogPlotToolBar();

View File

@@ -70,6 +70,7 @@ RimWellLogTrack* RimcWellLogPlot_newWellLogTrack::createWellLogTrack( RimWellLog
RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, title, wellLogPlot );
if ( eclipseCase ) plotTrack->setFormationCase( eclipseCase );
if ( wellPath ) plotTrack->setFormationWellPath( wellPath );
plotTrack->setColSpan( RimPlot::TWO );
plotTrack->setLegendsVisible( true );
plotTrack->setPlotTitleVisible( true );
@@ -78,12 +79,11 @@ RimWellLogTrack* RimcWellLogPlot_newWellLogTrack::createWellLogTrack( RimWellLog
plotTrack->setShowRegionLabels( true );
plotTrack->setAutoScalePropertyValuesEnabled( true );
plotTrack->updateConnectedEditors();
wellLogPlot->setShowWindow( true );
wellLogPlot->updateConnectedEditors();
RiaApplication::instance()->project()->updateConnectedEditors();
wellLogPlot->loadDataAndUpdate();
return plotTrack;
}

View File

@@ -106,8 +106,6 @@ RimWellLogExtractionCurve*
wellLogTrack->updateConnectedEditors();
wellLogTrack->setShowWindow( true );
RiaApplication::instance()->project()->updateConnectedEditors();
RimWellLogPlot* wellLogPlot = dynamic_cast<RimWellLogPlot*>( wellLogTrack->parentField() );
if ( wellLogPlot ) wellLogPlot->loadDataAndUpdate();

View File

@@ -38,6 +38,7 @@
#include <QApplication>
#include <QLinearGradient>
#include <QPainter>
#include <QPixmapCache>
using namespace caf;
@@ -201,9 +202,16 @@ std::unique_ptr<QIcon> IconProvider::icon( const QSize& size ) const
if ( !m_iconResourceString.isEmpty() )
{
QIcon resourceStringIcon( m_iconResourceString );
if ( !resourceStringIcon.isNull() )
QPixmap pm;
if ( !QPixmapCache::find( m_iconResourceString, &pm ) )
{
pm.load( m_iconResourceString );
QPixmapCache::insert( m_iconResourceString, pm );
}
if ( !pm.isNull() )
{
QIcon resourceStringIcon( pm );
QPixmap iconPixmap = resourceStringIcon.pixmap( size, m_active ? QIcon::Normal : QIcon::Disabled );
QPainter painter( &pixmap );
painter.drawPixmap( 0, 0, iconPixmap );