diff --git a/ApplicationCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp index 6b3c58a202..562002770d 100644 --- a/ApplicationCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp @@ -75,8 +75,6 @@ void RicAddStoredFlowCharacteristicsPlotFeature::onActionTriggered( bool isCheck sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); CVF_ASSERT( flowCharacteristicsPlot ); - RiaApplication::instance()->project()->assignViewIdToView( flowCharacteristicsPlot ); - flowPlotColl->addFlowCharacteristicsPlotToStoredPlots( flowCharacteristicsPlot ); flowCharacteristicsPlot->resolveReferencesRecursively(); diff --git a/ApplicationCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp b/ApplicationCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp index cd1164660e..67597b7b7c 100644 --- a/ApplicationCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp +++ b/ApplicationCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp @@ -74,7 +74,6 @@ void RicAddStoredWellAllocationPlotFeature::onActionTriggered( bool isChecked ) RimWellAllocationPlot* wellAllocationPlot = dynamic_cast( sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); - RiaApplication::instance()->project()->assignViewIdToView( wellAllocationPlot ); CVF_ASSERT( wellAllocationPlot ); flowPlotColl->addWellAllocPlotToStoredPlots( wellAllocationPlot ); diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp index f544245fd6..80e51a486b 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp @@ -68,7 +68,6 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked ) QString wellName = selectedWellName(); RimWellRftPlot* rftPlot = new RimWellRftPlot(); - RiaApplication::instance()->project()->assignViewIdToView( rftPlot ); rftPlot->setSimWellOrWellPathName( wellName ); diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp index 0e084e653f..81c2e7ba05 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp @@ -53,7 +53,6 @@ RimWellBoreStabilityPlot* RimWellBoreStabilityPlot* plot = new RimWellBoreStabilityPlot(); plot->setAsPlotMdiWindow(); - RiaApplication::instance()->project()->assignViewIdToView( plot ); wellLogPlotColl->wellLogPlots().push_back( plot ); @@ -88,7 +87,6 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterC RimWellLogPlot* plot = new RimWellLogPlot(); plot->setAsPlotMdiWindow(); - RiaApplication::instance()->project()->assignViewIdToView( plot ); wellLogPlotColl->wellLogPlots().push_back( plot ); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp b/ApplicationCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp index df837c950a..0b4b8cec64 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp @@ -148,7 +148,6 @@ RimWellAllocationPlot* RimFlowPlotCollection::defaultWellAllocPlot() { m_defaultWellAllocPlot = new RimWellAllocationPlot; m_defaultWellAllocPlot->setDescription( "Default Flow Diagnostics Plot" ); - RiaApplication::instance()->project()->assignViewIdToView( m_defaultWellAllocPlot ); } this->updateConnectedEditors(); @@ -164,7 +163,6 @@ RimFlowCharacteristicsPlot* RimFlowPlotCollection::defaultFlowCharacteristicsPlo if ( !m_flowCharacteristicsPlot() ) { m_flowCharacteristicsPlot = new RimFlowCharacteristicsPlot; - RiaApplication::instance()->project()->assignViewIdToView( m_flowCharacteristicsPlot ); } this->updateConnectedEditors(); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp index 9ae64bc280..48dbd76ab0 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp @@ -27,6 +27,7 @@ #include "RigSimWellData.h" #include "RigTofAccumulatedPhaseFractionsCalculator.h" +#include "RimProject.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" diff --git a/ApplicationCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp index 44e3e78f12..e1f4ef6b47 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp @@ -25,6 +25,7 @@ #include "RigSimWellData.h" +#include "RimProject.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 8466068737..e9c2d0a780 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -794,6 +794,8 @@ QImage RimWellAllocationPlot::snapshotWindowContent() //-------------------------------------------------------------------------------------------------- void RimWellAllocationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { + RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering ); + uiOrdering.add( &m_userName ); uiOrdering.add( &m_showPlotTitle ); @@ -809,6 +811,8 @@ void RimWellAllocationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOr optionGroup.add( &m_groupSmallContributions ); optionGroup.add( &m_smallContributionsThreshold ); m_smallContributionsThreshold.uiCapability()->setUiReadOnly( !m_groupSmallContributions() ); + + uiOrdering.skipRemainingFields( true ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index a2970717cf..5670ccc039 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -975,6 +975,7 @@ void RimWellPltPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin //-------------------------------------------------------------------------------------------------- void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { + RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering ); const QString simWellName = RimWellPlotTools::simWellName( m_wellPathName ); uiOrdering.add( &m_wellPathName ); diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index d3fd6789a0..ed723eaa9c 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -891,6 +891,7 @@ void RimWellRftPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin //-------------------------------------------------------------------------------------------------- void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { + RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering ); uiOrdering.add( &m_wellPathNameOrSimWellName ); uiOrdering.add( &m_showStatisticsCurves ); uiOrdering.add( &m_showEnsembleCurves ); diff --git a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp index f750403887..fb107e5d65 100644 --- a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp +++ b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp @@ -62,7 +62,6 @@ RimGridCrossPlot* RimGridCrossPlotCollection::createGridCrossPlot() { RimGridCrossPlot* plot = new RimGridCrossPlot(); plot->setAsPlotMdiWindow(); - RiaApplication::instance()->project()->assignViewIdToView( plot ); // plot->setDescription(QString("Summary Cross Plot %1").arg(m_gridCrossPlots.size())); addGridCrossPlot( plot ); diff --git a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp index b65c4c7eeb..fc0a3ca221 100644 --- a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp +++ b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp @@ -92,7 +92,6 @@ std::vector { RimSaturationPressurePlot* plot = new RimSaturationPressurePlot(); plot->setAsPlotMdiWindow(); - RiaApplication::instance()->project()->assignViewIdToView( plot ); // As discussed with Liv Merete, it is not any use for creation of different plots for matrix/fracture. For // now, use hardcoded value for MATRIX diff --git a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp index 4102b54d17..50b326bc27 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseCase.cpp @@ -275,7 +275,6 @@ void RimEclipseCase::initAfterRead() RimEclipseView* RimEclipseCase::createAndAddReservoirView() { RimEclipseView* rimEclipseView = new RimEclipseView(); - RiaApplication::instance()->project()->assignViewIdToView( rimEclipseView ); rimEclipseView->setEclipseCase( this ); @@ -312,7 +311,6 @@ RimEclipseView* RimEclipseCase::createCopyAndAddView( const RimEclipseView* sour RimEclipseView* rimEclipseView = dynamic_cast( sourceView->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); CVF_ASSERT( rimEclipseView ); - RiaApplication::instance()->project()->assignViewIdToView( rimEclipseView ); rimEclipseView->setEclipseCase( this ); caf::PdmDocument::updateUiIconStateRecursively( rimEclipseView ); diff --git a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp index 5bbd7d60da..a5fd294285 100644 --- a/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimGeoMechCase.cpp @@ -198,7 +198,6 @@ void RimGeoMechCase::reloadDataAndUpdate() RimGeoMechView* RimGeoMechCase::createAndAddReservoirView() { RimGeoMechView* gmv = new RimGeoMechView(); - RiaApplication::instance()->project()->assignViewIdToView( gmv ); gmv->setGeoMechCase( this ); @@ -215,7 +214,6 @@ RimGeoMechView* RimGeoMechCase::createCopyAndAddView( const RimGeoMechView* sour sourceView->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); CVF_ASSERT( rimGeoMechView ); - RiaApplication::instance()->project()->assignViewIdToView( rimGeoMechView ); rimGeoMechView->setGeoMechCase( this ); caf::PdmDocument::updateUiIconStateRecursively( rimGeoMechView ); diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index 6c4748bdb6..c42422d6cc 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -100,6 +100,9 @@ CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" ); /// //-------------------------------------------------------------------------------------------------- RimProject::RimProject( void ) + : m_nextValidCaseId( 0 ) + , m_nextValidCaseGroupId( 0 ) + , m_nextValidViewId( 0 ) { CAF_PDM_InitObject( "Project", "", "", "" ); @@ -242,6 +245,10 @@ void RimProject::close() mainWindowTreeViewState = ""; plotWindowCurrentModelIndexPath = ""; plotWindowTreeViewState = ""; + + m_nextValidCaseId = 0; + m_nextValidCaseGroupId = 0; + m_nextValidViewId = 0; } //-------------------------------------------------------------------------------------------------- @@ -468,17 +475,15 @@ void RimProject::assignCaseIdToCase( RimCase* reservoirCase ) { if ( reservoirCase ) { - int nextValidCaseId = 0; - std::vector cases; this->descendantsIncludingThisOfType( cases ); for ( RimCase* rimCase : cases ) { - nextValidCaseId = std::max( nextValidCaseId, rimCase->caseId() + 1 ); + m_nextValidCaseId = std::max( m_nextValidCaseId, rimCase->caseId() + 1 ); } - reservoirCase->caseId = nextValidCaseId; + reservoirCase->caseId = m_nextValidCaseId++; } } @@ -489,17 +494,15 @@ void RimProject::assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup ) { if ( caseGroup ) { - int nextValidCaseGroupId = 0; - std::vector identicalCaseGroups; this->descendantsIncludingThisOfType( identicalCaseGroups ); for ( RimIdenticalGridCaseGroup* existingCaseGroup : identicalCaseGroups ) { - nextValidCaseGroupId = std::max( nextValidCaseGroupId, existingCaseGroup->groupId() + 1 ); + m_nextValidCaseGroupId = std::max( m_nextValidCaseGroupId, existingCaseGroup->groupId() + 1 ); } - caseGroup->groupId = nextValidCaseGroupId; + caseGroup->groupId = m_nextValidCaseGroupId++; } } @@ -510,17 +513,15 @@ void RimProject::assignViewIdToView( RimViewWindow* view ) { if ( view ) { - int nextValidViewId = 0; - std::vector viewWindows; this->descendantsIncludingThisOfType( viewWindows ); for ( RimViewWindow* existingView : viewWindows ) { - nextValidViewId = std::max( nextValidViewId, existingView->id() + 1 ); + m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 ); } - view->setId( nextValidViewId ); + view->setId( m_nextValidViewId++ ); } } diff --git a/ApplicationCode/ProjectDataModel/RimProject.h b/ApplicationCode/ProjectDataModel/RimProject.h index 76ac24fec6..9a1ed66bbc 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.h +++ b/ApplicationCode/ProjectDataModel/RimProject.h @@ -201,6 +201,10 @@ private: caf::PdmField m_subWindowsTiled3DWindow; caf::PdmField m_subWindowsTiledPlotWindow; + int m_nextValidCaseId; + int m_nextValidCaseGroupId; + int m_nextValidViewId; + caf::PdmChildArrayField casesObsolete; // obsolete caf::PdmChildArrayField caseGroupsObsolete; // obsolete }; diff --git a/ApplicationCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationCode/ProjectDataModel/RimViewWindow.cpp index 849938293b..fb61fc6994 100644 --- a/ApplicationCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationCode/ProjectDataModel/RimViewWindow.cpp @@ -53,6 +53,7 @@ RimViewWindow::RimViewWindow( void ) // Obsolete field CAF_PDM_InitFieldNoDefault( &obsoleteField_windowGeometry, "WindowGeometry", "", "", "", "" ); RiaFieldhandleTools::disableWriteAndSetFieldHidden( &obsoleteField_windowGeometry ); + RiaApplication::instance()->project()->assignViewIdToView( this ); } //-------------------------------------------------------------------------------------------------- @@ -285,10 +286,6 @@ void RimViewWindow::initAfterRead() setAsMdiWindow( mainWindowID ); setMdiWindowGeometry( wg ); } - if ( m_viewId() == -1 ) - { - RiaApplication::instance()->project()->assignViewIdToView( this ); - } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index 9e65858d7a..a3e2843bdc 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -184,7 +184,14 @@ void RimWellLogPlot::updateZoom() { static_cast( plot )->setVisibleYRange( m_minVisibleDepth(), m_maxVisibleDepth() ); } - m_viewer->updateVerticalScrollBar( m_minVisibleDepth(), m_maxVisibleDepth(), m_minAvailableDepth, m_maxAvailableDepth ); + + if ( m_viewer ) + { + m_viewer->updateVerticalScrollBar( m_minVisibleDepth(), + m_maxVisibleDepth(), + m_minAvailableDepth, + m_maxAvailableDepth ); + } RimGridPlotWindow::updateZoom(); } @@ -554,11 +561,10 @@ void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - RimGridPlotWindow::defineUiOrdering( uiConfigName, uiOrdering ); + RimViewWindow::defineUiOrdering( uiConfigName, uiOrdering ); uiOrderingForDepthAxis( uiOrdering ); createPlotSettingsUiGroup( uiOrdering ); - uiOrdering.skipRemainingFields( true ); } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp index 6f00ff48fc..0318c78110 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp @@ -89,7 +89,6 @@ RimSummaryPlot* RimSummaryCrossPlotCollection::createSummaryPlot() { RimSummaryPlot* plot = new RimSummaryCrossPlot(); plot->setAsPlotMdiWindow(); - RiaApplication::instance()->project()->assignViewIdToView( plot ); plot->setDescription( QString( "Summary Cross Plot %1" ).arg( m_summaryCrossPlots.size() ) ); diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp index 335d29d242..4687c6053c 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp @@ -50,7 +50,6 @@ RimSummaryPlot* RimSummaryPlotCollection::createSummaryPlotWithAutoTitle() { RimSummaryPlot* plot = new RimSummaryPlot(); plot->setAsPlotMdiWindow(); - RiaApplication::instance()->project()->assignViewIdToView( plot ); plot->enableAutoPlotTitle( true ); summaryPlots.push_back( plot ); @@ -65,7 +64,6 @@ RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot( const QString& { RimSummaryPlot* plot = new RimSummaryPlot(); plot->setAsPlotMdiWindow(); - RiaApplication::instance()->project()->assignViewIdToView( plot ); summaryPlots.push_back( plot ); plot->setDescription( name ); diff --git a/ApplicationCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp b/ApplicationCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp index 1a24180e07..e8efe6d66e 100644 --- a/ApplicationCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp +++ b/ApplicationCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp @@ -120,7 +120,7 @@ RiuTofAccumulatedPhaseFractionsPlot::~RiuTofAccumulatedPhaseFractionsPlot() //-------------------------------------------------------------------------------------------------- QSize RiuTofAccumulatedPhaseFractionsPlot::sizeHint() const { - return QSize( 350, 250 ); + return QSize( 370, 250 ); } //--------------------------------------------------------------------------------------------------