mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix crashes when dropping analysis plots into Multiplots
This commit is contained in:
parent
ab3e43d8fb
commit
93baf776a1
@ -1645,15 +1645,15 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
|
||||
size_t plotCount = 0;
|
||||
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
|
||||
plotCount += spColl ? spColl->summaryPlots().size() : 0;
|
||||
plotCount += scpColl ? scpColl->summaryPlots().size() : 0;
|
||||
plotCount += spColl ? spColl->plots().size() : 0;
|
||||
plotCount += scpColl ? scpColl->plots().size() : 0;
|
||||
plotCount += flowColl ? flowColl->plotCount() : 0;
|
||||
plotCount += rftColl ? rftColl->rftPlots().size() : 0;
|
||||
plotCount += pltColl ? pltColl->pltPlots().size() : 0;
|
||||
plotCount += gcpColl ? gcpColl->gridCrossPlots().size() : 0;
|
||||
plotCount += sppColl ? sppColl->plots().size() : 0;
|
||||
plotCount += alsColl ? alsColl->plots().size() : 0;
|
||||
plotCount += corrColl ? corrColl->plots().size() + corrColl->reports().size() : 0;
|
||||
plotCount += gcpColl ? gcpColl->plotCount() : 0;
|
||||
plotCount += sppColl ? sppColl->plotCount() : 0;
|
||||
plotCount += alsColl ? alsColl->plotCount() : 0;
|
||||
plotCount += corrColl ? corrColl->plotCount() + corrColl->reports().size() : 0;
|
||||
plotCount += gpwColl ? gpwColl->multiPlots().size() : 0;
|
||||
plotCount += frmColl ? frmColl->fractureModelPlots().size() : 0;
|
||||
|
||||
@ -1671,16 +1671,16 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
|
||||
if ( spColl )
|
||||
{
|
||||
for ( size_t wlpIdx = 0; wlpIdx < spColl->summaryPlots().size(); ++wlpIdx )
|
||||
for ( auto plot : spColl->plots() )
|
||||
{
|
||||
spColl->summaryPlots[wlpIdx]->loadDataAndUpdate();
|
||||
plot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
}
|
||||
}
|
||||
|
||||
if ( scpColl )
|
||||
{
|
||||
for ( auto plot : scpColl->summaryPlots() )
|
||||
for ( auto plot : scpColl->plots() )
|
||||
{
|
||||
plot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
@ -1714,7 +1714,7 @@ void RiaApplication::loadAndUpdatePlotData()
|
||||
|
||||
if ( gcpColl )
|
||||
{
|
||||
for ( const auto& gcpPlot : gcpColl->gridCrossPlots() )
|
||||
for ( const auto& gcpPlot : gcpColl->plots() )
|
||||
{
|
||||
gcpPlot->loadDataAndUpdate();
|
||||
plotProgress.incrementProgress();
|
||||
|
@ -77,7 +77,7 @@ void RiaSummaryTools::notifyCalculatedCurveNameHasChanged( int calculationId, co
|
||||
{
|
||||
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
|
||||
|
||||
for ( RimSummaryPlot* plot : summaryPlotColl->summaryPlots() )
|
||||
for ( RimSummaryPlot* plot : summaryPlotColl->plots() )
|
||||
{
|
||||
for ( RimSummaryCurve* curve : plot->summaryCurves() )
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ void RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection(
|
||||
|
||||
RimSummaryPlotCollection* plotColl = RimProject::current()->mainPlotCollection()->summaryPlotCollection();
|
||||
|
||||
plotColl->summaryPlots.push_back( summaryPlot );
|
||||
plotColl->addPlot( summaryPlot );
|
||||
summaryPlot->resolveReferencesRecursively();
|
||||
summaryPlot->initAfterReadRecursively();
|
||||
|
||||
|
@ -56,7 +56,7 @@ void RicCloseObservedDataFeature::deleteObservedSummaryData( const std::vector<R
|
||||
|
||||
for ( RimObservedSummaryData* observedData : data )
|
||||
{
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
summaryPlot->deleteCurvesAssosiatedWithCase( observedData );
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector<RimSummaryCase*
|
||||
|
||||
for ( RimSummaryCase* summaryCase : cases )
|
||||
{
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
summaryPlot->deleteCurvesAssosiatedWithCase( summaryCase );
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ void RicDeleteSubItemsFeature::onActionTriggered( bool isChecked )
|
||||
auto collection = dynamic_cast<RimSummaryPlotCollection*>( item );
|
||||
if ( collection )
|
||||
{
|
||||
collection->summaryPlots.deleteAllChildObjects();
|
||||
collection->deleteAllPlots();
|
||||
|
||||
collection->updateConnectedEditors();
|
||||
}
|
||||
@ -116,7 +116,7 @@ bool RicDeleteSubItemsFeature::hasDeletableSubItems( caf::PdmUiItem* uiItem )
|
||||
{
|
||||
{
|
||||
auto collection = dynamic_cast<RimSummaryPlotCollection*>( uiItem );
|
||||
if ( collection && !collection->summaryPlots().empty() )
|
||||
if ( collection && !collection->plots().empty() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ void RicDeleteSummaryCaseCollectionFeature::deleteSummaryCaseCollection( RimSumm
|
||||
|
||||
for ( RimSummaryCase* summaryCase : caseCollection->allSummaryCases() )
|
||||
{
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
summaryPlot->deleteCurvesAssosiatedWithCase( summaryCase );
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void RicReloadSummaryCaseFeature::onActionTriggered( bool isChecked )
|
||||
RiaLogging::info( QString( "Reloaded data for %1" ).arg( summaryCase->summaryHeaderFilename() ) );
|
||||
}
|
||||
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ void RicReplaceCaseFeature::onActionTriggered( bool isChecked )
|
||||
gridSummaryCase->createRftReaderInterface();
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->summaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() )
|
||||
{
|
||||
// Update summary curves on calculated data
|
||||
std::vector<RimSummaryCurve*> summaryCurves = summaryPlot->summaryCurves();
|
||||
@ -118,7 +118,7 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
|
||||
RimSummaryCrossPlotCollection* summaryCrossPlotColl = RiaSummaryTools::summaryCrossPlotCollection();
|
||||
for ( RimSummaryPlot* summaryPlot : summaryCrossPlotColl->summaryPlots() )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryCrossPlotColl->plots() )
|
||||
{
|
||||
// Update summary curves on calculated data
|
||||
std::vector<RimSummaryCurve*> summaryCurves = summaryPlot->summaryCurves();
|
||||
|
@ -103,9 +103,9 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
defaultSelectedPlot = dynamic_cast<RimSummaryPlot*>( app->activePlotWindow() );
|
||||
}
|
||||
|
||||
if ( !defaultSelectedPlot && summaryPlotColl->summaryPlots().size() > 0 )
|
||||
if ( !defaultSelectedPlot && !summaryPlotColl->plots().empty() )
|
||||
{
|
||||
defaultSelectedPlot = summaryPlotColl->summaryPlots()[0];
|
||||
defaultSelectedPlot = summaryPlotColl->plots().front();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ void RicNewSummaryCrossPlotFeature::onActionTriggered( bool isChecked )
|
||||
RimSummaryCrossPlotCollection* summaryCrossPlotColl = project->mainPlotCollection()->summaryCrossPlotCollection();
|
||||
RimSummaryPlot* summaryPlot = summaryCrossPlotColl->createSummaryPlot();
|
||||
|
||||
summaryCrossPlotColl->addSummaryPlot( summaryPlot );
|
||||
summaryCrossPlotColl->addPlot( summaryPlot );
|
||||
if ( summaryPlot )
|
||||
{
|
||||
summaryCrossPlotColl->updateConnectedEditors();
|
||||
|
@ -257,7 +257,7 @@ RicPasteAsciiDataToSummaryPlotFeature::CurveType
|
||||
RimSummaryPlot*
|
||||
RicPasteAsciiDataToSummaryPlotFeature::createSummaryPlotAndAddToPlotCollection( RimSummaryPlotCollection* plotCollection )
|
||||
{
|
||||
QString name = QString( "Summary Plot %1" ).arg( plotCollection->summaryPlots.size() + 1 );
|
||||
QString name = QString( "Summary Plot %1" ).arg( plotCollection->plots().size() + 1 );
|
||||
|
||||
return plotCollection->createNamedSummaryPlot( name );
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ void RicPasteSummaryCrossPlotFeature::copyPlotAndAddToCollection( RimSummaryCros
|
||||
sourcePlot->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
CVF_ASSERT( newSummaryPlot );
|
||||
|
||||
plotColl->addSummaryPlot( newSummaryPlot );
|
||||
plotColl->addPlot( newSummaryPlot );
|
||||
|
||||
// Resolve references after object has been inserted into the data model
|
||||
newSummaryPlot->resolveReferencesRecursively();
|
||||
|
@ -47,7 +47,7 @@ void RicPasteSummaryPlotFeature::copyPlotAndAddToCollection( RimSummaryPlot* sou
|
||||
sourcePlot->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) );
|
||||
CVF_ASSERT( newSummaryPlot );
|
||||
|
||||
plotColl->summaryPlots.push_back( newSummaryPlot );
|
||||
plotColl->addPlot( newSummaryPlot );
|
||||
|
||||
// Resolve references after object has been inserted into the data model
|
||||
newSummaryPlot->resolveReferencesRecursively();
|
||||
|
@ -104,7 +104,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSelectSummaryPlotUI::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
if ( RiaSummaryTools::summaryPlotCollection()->summaryPlots().size() == 0 )
|
||||
if ( RiaSummaryTools::summaryPlotCollection()->plots().empty() )
|
||||
{
|
||||
m_createNewPlot = true;
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void RicSummaryPlotFeatureImpl::ensureAtLeastOnePlot( RimSummaryPlotCollection*
|
||||
{
|
||||
if ( summaryPlotCollection && summaryCase )
|
||||
{
|
||||
if ( summaryPlotCollection->summaryPlots.empty() )
|
||||
if ( summaryPlotCollection->plots().empty() )
|
||||
{
|
||||
auto objectToSelect = createDefaultSummaryPlot( summaryCase );
|
||||
if ( objectToSelect )
|
||||
|
@ -135,7 +135,6 @@ private:
|
||||
void detachAllCurves() override;
|
||||
|
||||
void reattachAllCurves() override {}
|
||||
void doRemoveFromCollection() override {}
|
||||
void updateAxes() override;
|
||||
void onAxisSelected( int axis, bool toggle ) override;
|
||||
void updateZoomInQwt() override {}
|
||||
@ -176,7 +175,7 @@ private:
|
||||
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
|
||||
int barTextFontSize() const;
|
||||
void initAfterRead();
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
void onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase );
|
||||
|
@ -53,7 +53,7 @@ RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot()
|
||||
applyFirstEnsembleFieldAddressesToPlot( plot, "FOPT" );
|
||||
|
||||
// plot->enableAutoPlotTitle( true );
|
||||
m_analysisPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
@ -79,7 +79,7 @@ RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot( RimSummaryCaseCo
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityName.toStdString(), timeStep );
|
||||
|
||||
// plot->enableAutoPlotTitle( true );
|
||||
m_analysisPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
@ -106,15 +106,7 @@ void RimAnalysisPlotCollection::updateSummaryNameHasChanged()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::removeSummaryPlot( RimAnalysisPlot* analysisPlot )
|
||||
{
|
||||
m_analysisPlots.removeChildObject( analysisPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimAnalysisPlot*> RimAnalysisPlotCollection::plots()
|
||||
std::vector<RimAnalysisPlot*> RimAnalysisPlotCollection::plots() const
|
||||
{
|
||||
return m_analysisPlots.childObjects();
|
||||
}
|
||||
@ -122,9 +114,9 @@ std::vector<RimAnalysisPlot*> RimAnalysisPlotCollection::plots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::deleteAllChildObjects()
|
||||
size_t RimAnalysisPlotCollection::plotCount() const
|
||||
{
|
||||
m_analysisPlots.deleteAllChildObjects();
|
||||
return m_analysisPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -156,6 +148,9 @@ void RimAnalysisPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAnaly
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAnalysisPlot* plot,
|
||||
RimSummaryCaseCollection* ensemble,
|
||||
const std::string& quantityName,
|
||||
@ -182,3 +177,19 @@ void RimAnalysisPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAnalysis
|
||||
plot->setTimeSteps( {timeStep} );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::insertPlot( RimAnalysisPlot* analysisPlot, size_t index )
|
||||
{
|
||||
m_analysisPlots.insert( index, analysisPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlotCollection::removePlot( RimAnalysisPlot* analysisPlot )
|
||||
{
|
||||
m_analysisPlots.removeChildObject( analysisPlot );
|
||||
}
|
||||
|
@ -18,19 +18,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimAnalysisPlot.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
class RimAnalysisPlot;
|
||||
class RimSummaryCaseCollection;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimAnalysisPlotCollection : public caf::PdmObject
|
||||
class RimAnalysisPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimAnalysisPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -43,11 +45,11 @@ public:
|
||||
createAnalysisPlot( RimSummaryCaseCollection* ensemble, const QString& quantityName, std::time_t timeStep );
|
||||
|
||||
void updateSummaryNameHasChanged();
|
||||
void removeSummaryPlot( RimAnalysisPlot* analysisPlot );
|
||||
|
||||
std::vector<RimAnalysisPlot*> plots();
|
||||
|
||||
void deleteAllChildObjects();
|
||||
std::vector<RimAnalysisPlot*> plots() const final;
|
||||
size_t plotCount() const final;
|
||||
void insertPlot( RimAnalysisPlot* analysisPlot, size_t index ) final;
|
||||
void removePlot( RimAnalysisPlot* analysisPlot ) final;
|
||||
|
||||
private:
|
||||
void applyFirstEnsembleFieldAddressesToPlot( RimAnalysisPlot* plot, const std::string& quantityName = "" );
|
||||
|
@ -164,6 +164,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RimElasticProperties.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimElasticPropertiesCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimLayerCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureModelStressCurve.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimAbstractPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFractureModelPropertyCurve.h
|
||||
)
|
||||
|
||||
|
@ -98,7 +98,6 @@ protected:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
|
||||
void reattachAllCurves() override {}
|
||||
void doRemoveFromCollection() override {}
|
||||
void updateZoomInQwt() override {}
|
||||
void updateZoomFromQwt() override {}
|
||||
void setAutoScaleXEnabled( bool enabled ) override {}
|
||||
|
@ -59,7 +59,7 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( bool de
|
||||
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT"} );
|
||||
plot->selectAllParameters();
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
@ -77,7 +77,7 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( RimSumm
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, {quantityName}, timeStep );
|
||||
plot->selectAllParameters();
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
@ -92,7 +92,7 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP
|
||||
if ( defaultToFirstEnsembleField ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT", "FWPT", "FGPT"} );
|
||||
plot->selectAllParameters();
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
@ -109,7 +109,7 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityNames, timeStep );
|
||||
plot->selectAllParameters();
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
@ -123,7 +123,7 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult
|
||||
plot->setAsPlotMdiWindow();
|
||||
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT"} );
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
return plot;
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, {quantityName}, timeStep );
|
||||
plot->setEnsembleParameter( paramName );
|
||||
|
||||
m_correlationPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
return plot;
|
||||
}
|
||||
|
||||
@ -181,15 +181,23 @@ RimCorrelationReportPlot*
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlotCollection::removePlot( RimAbstractCorrelationPlot* correlationPlot )
|
||||
void RimCorrelationPlotCollection::insertPlot( RimAbstractCorrelationPlot* plot, size_t index )
|
||||
{
|
||||
m_correlationPlots.removeChildObject( correlationPlot );
|
||||
m_correlationPlots.insert( index, plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimAbstractCorrelationPlot*> RimCorrelationPlotCollection::plots()
|
||||
void RimCorrelationPlotCollection::removePlot( RimAbstractCorrelationPlot* plot )
|
||||
{
|
||||
m_correlationPlots.removeChildObject( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimAbstractCorrelationPlot*> RimCorrelationPlotCollection::plots() const
|
||||
{
|
||||
return m_correlationPlots.childObjects();
|
||||
}
|
||||
@ -197,7 +205,15 @@ std::vector<RimAbstractCorrelationPlot*> RimCorrelationPlotCollection::plots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCorrelationReportPlot*> RimCorrelationPlotCollection::reports()
|
||||
size_t RimCorrelationPlotCollection::plotCount() const
|
||||
{
|
||||
return m_correlationPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimCorrelationReportPlot*> RimCorrelationPlotCollection::reports() const
|
||||
{
|
||||
return m_correlationReports.childObjects();
|
||||
}
|
||||
@ -205,9 +221,9 @@ std::vector<RimCorrelationReportPlot*> RimCorrelationPlotCollection::reports()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlotCollection::deleteAllChildObjects()
|
||||
void RimCorrelationPlotCollection::deleteAllPlots()
|
||||
{
|
||||
m_correlationPlots.deleteAllChildObjects();
|
||||
RimTypedPlotCollection<RimAbstractCorrelationPlot>::deleteAllPlots();
|
||||
m_correlationReports.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
|
@ -18,13 +18,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractCorrelationPlot.h"
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
|
||||
class RimAbstractCorrelationPlot;
|
||||
class RimCorrelationPlot;
|
||||
class RimCorrelationMatrixPlot;
|
||||
class RimCorrelationReportPlot;
|
||||
@ -35,7 +37,7 @@ class RimSummaryCaseCollection;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimCorrelationPlotCollection : public caf::PdmObject
|
||||
class RimCorrelationPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimAbstractCorrelationPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -64,13 +66,15 @@ public:
|
||||
const QString& tornadoAndCrossPlotQuantityName,
|
||||
std::time_t timeStep );
|
||||
|
||||
void removePlot( RimAbstractCorrelationPlot* correlationPlot );
|
||||
void removeReport( RimCorrelationReportPlot* correlationReport );
|
||||
|
||||
std::vector<RimAbstractCorrelationPlot*> plots();
|
||||
std::vector<RimCorrelationReportPlot*> reports();
|
||||
std::vector<RimAbstractCorrelationPlot*> plots() const final;
|
||||
size_t plotCount() const final;
|
||||
void insertPlot( RimAbstractCorrelationPlot* plot, size_t index ) final;
|
||||
void removePlot( RimAbstractCorrelationPlot* correlationPlot ) final;
|
||||
void deleteAllPlots() final;
|
||||
|
||||
void deleteAllChildObjects();
|
||||
std::vector<RimCorrelationReportPlot*> reports() const;
|
||||
|
||||
private:
|
||||
void applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot,
|
||||
|
@ -282,14 +282,6 @@ void RimWellDistributionPlot::zoomAll()
|
||||
// cvf::Trace::show("RimWellDistributionPlot::zoomAll()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellDistributionPlot::doRemoveFromCollection()
|
||||
{
|
||||
// cvf::Trace::show("RimWellDistributionPlot::doRemoveFromCollection()");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -71,9 +71,6 @@ public:
|
||||
void zoomAll() override;
|
||||
|
||||
private:
|
||||
// RimPlot implementations
|
||||
void doRemoveFromCollection() override;
|
||||
|
||||
// RimViewWindow implementations
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
@ -391,20 +391,6 @@ void RimGridCrossPlot::onAxisSelected( int axis, bool toggle )
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlot::doRemoveFromCollection()
|
||||
{
|
||||
RimGridCrossPlotCollection* crossPlotCollection = nullptr;
|
||||
this->firstAncestorOrThisOfType( crossPlotCollection );
|
||||
if ( crossPlotCollection )
|
||||
{
|
||||
crossPlotCollection->removeGridCrossPlot( this );
|
||||
crossPlotCollection->updateAllRequiredEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -141,7 +141,6 @@ private:
|
||||
void doUpdateLayout() override;
|
||||
void cleanupBeforeClose();
|
||||
|
||||
void doRemoveFromCollection() override;
|
||||
QString generateInfoBoxText() const;
|
||||
|
||||
void connectAxisSignals( RimPlotAxisProperties* axis );
|
||||
|
@ -43,17 +43,17 @@ RimGridCrossPlotCollection::~RimGridCrossPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCollection::deleteAllChildObjects()
|
||||
std::vector<RimGridCrossPlot*> RimGridCrossPlotCollection::plots() const
|
||||
{
|
||||
m_gridCrossPlots.deleteAllChildObjects();
|
||||
return m_gridCrossPlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridCrossPlot*> RimGridCrossPlotCollection::gridCrossPlots() const
|
||||
size_t RimGridCrossPlotCollection::plotCount() const
|
||||
{
|
||||
return m_gridCrossPlots.childObjects();
|
||||
return m_gridCrossPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -65,22 +65,22 @@ RimGridCrossPlot* RimGridCrossPlotCollection::createGridCrossPlot()
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
// plot->setDescription(QString("Summary Cross Plot %1").arg(m_gridCrossPlots.size()));
|
||||
addGridCrossPlot( plot );
|
||||
addPlot( plot );
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCollection::addGridCrossPlot( RimGridCrossPlot* plot )
|
||||
void RimGridCrossPlotCollection::insertPlot( RimGridCrossPlot* plot, size_t index )
|
||||
{
|
||||
m_gridCrossPlots().push_back( plot );
|
||||
m_gridCrossPlots.insert( index, plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCollection::removeGridCrossPlot( RimGridCrossPlot* plot )
|
||||
void RimGridCrossPlotCollection::removePlot( RimGridCrossPlot* plot )
|
||||
{
|
||||
m_gridCrossPlots.removeChildObject( plot );
|
||||
}
|
||||
|
@ -17,16 +17,17 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimGridCrossPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGridCrossPlotCollection : public caf::PdmObject
|
||||
class RimGridCrossPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimGridCrossPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -34,12 +35,12 @@ public:
|
||||
RimGridCrossPlotCollection();
|
||||
~RimGridCrossPlotCollection() override;
|
||||
|
||||
void deleteAllChildObjects();
|
||||
std::vector<RimGridCrossPlot*> plots() const final;
|
||||
size_t plotCount() const final;
|
||||
void insertPlot( RimGridCrossPlot* plot, size_t index ) final;
|
||||
void removePlot( RimGridCrossPlot* plot ) final;
|
||||
|
||||
std::vector<RimGridCrossPlot*> gridCrossPlots() const;
|
||||
RimGridCrossPlot* createGridCrossPlot();
|
||||
void addGridCrossPlot( RimGridCrossPlot* plot );
|
||||
void removeGridCrossPlot( RimGridCrossPlot* plot );
|
||||
RimGridCrossPlot* createGridCrossPlot();
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimGridCrossPlot*> m_gridCrossPlots;
|
||||
|
@ -108,11 +108,19 @@ std::vector<RimSaturationPressurePlot*>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots()
|
||||
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots() const
|
||||
{
|
||||
return m_saturationPressurePlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSaturationPressurePlotCollection::plotCount() const
|
||||
{
|
||||
return m_saturationPressurePlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -38,7 +38,8 @@ public:
|
||||
std::vector<RimSaturationPressurePlot*> createSaturationPressurePlots( RimEclipseResultCase* eclipseResultCase,
|
||||
int timeStep );
|
||||
|
||||
std::vector<RimSaturationPressurePlot*> plots();
|
||||
std::vector<RimSaturationPressurePlot*> plots() const;
|
||||
size_t plotCount() const;
|
||||
void deleteAllChildObjects();
|
||||
|
||||
private:
|
||||
|
68
ApplicationCode/ProjectDataModel/RimAbstractPlotCollection.h
Normal file
68
ApplicationCode/ProjectDataModel/RimAbstractPlotCollection.h
Normal file
@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2020- 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 "RimPlot.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimAbstractPlotCollection
|
||||
{
|
||||
public:
|
||||
virtual ~RimAbstractPlotCollection() = default;
|
||||
|
||||
virtual size_t plotCount() const = 0;
|
||||
virtual void deleteAllPlots() = 0;
|
||||
virtual void removeRimPlot( RimPlot* plot ) = 0;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
/// Templated Base class of all plot collections.
|
||||
/// Specialize on plot type (has to derive from RimPlot) and the base class of the collection.
|
||||
//==================================================================================================
|
||||
template <typename RimPlotType>
|
||||
class RimTypedPlotCollection : public RimAbstractPlotCollection
|
||||
{
|
||||
static_assert( std::is_base_of<RimPlot, RimPlotType>::value, "RimPlotType must inherit from RimPlot" );
|
||||
|
||||
public:
|
||||
~RimTypedPlotCollection() override = default;
|
||||
|
||||
virtual std::vector<RimPlotType*> plots() const = 0;
|
||||
|
||||
void deleteAllPlots() override
|
||||
{
|
||||
for ( auto plot : plots() )
|
||||
{
|
||||
removePlot( plot );
|
||||
delete plot;
|
||||
}
|
||||
}
|
||||
|
||||
void addPlot( RimPlotType* plot ) { insertPlot( plot, plotCount() ); }
|
||||
virtual void insertPlot( RimPlotType* plot, size_t index ) = 0;
|
||||
virtual void removePlot( RimPlotType* plot ) = 0;
|
||||
void removeRimPlot( RimPlot* rimPlot )
|
||||
{
|
||||
auto typedPlot = dynamic_cast<RimPlotType*>( rimPlot );
|
||||
if ( typedPlot )
|
||||
{
|
||||
removePlot( typedPlot );
|
||||
}
|
||||
}
|
||||
};
|
@ -214,52 +214,6 @@ QString RimDepthTrackPlot::description() const
|
||||
return m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::addPlot( RimPlot* plot )
|
||||
{
|
||||
insertPlot( plot, m_plots.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
m_plots.insert( index, plot );
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
plot->createPlotWidget();
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
plot->setShowWindow( true );
|
||||
plot->setLegendsVisible( false );
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::removePlot( RimPlot* plot )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->removePlot( plot->viewer() );
|
||||
}
|
||||
m_plots.removeChildObject( plot );
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -755,7 +709,6 @@ void RimDepthTrackPlot::onPlotsReordered( const SignalEmitter* emitter )
|
||||
recreatePlotWidgets();
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -945,7 +898,6 @@ void RimDepthTrackPlot::initAfterRead()
|
||||
{
|
||||
m_nameConfig->setCustomName( m_plotWindowTitle );
|
||||
}
|
||||
|
||||
performAutoNameUpdate();
|
||||
}
|
||||
|
||||
@ -1001,6 +953,44 @@ caf::PdmFieldHandle* RimDepthTrackPlot::userDescriptionField()
|
||||
return &m_plotWindowTitle;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
m_plots.insert( index, plot );
|
||||
|
||||
if ( m_viewer )
|
||||
{
|
||||
plot->createPlotWidget();
|
||||
m_viewer->insertPlot( plot->viewer(), index );
|
||||
}
|
||||
plot->setShowWindow( true );
|
||||
plot->setLegendsVisible( false );
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::removePlot( RimPlot* plot )
|
||||
{
|
||||
if ( plot )
|
||||
{
|
||||
if ( m_viewer )
|
||||
{
|
||||
m_viewer->removePlot( plot->viewer() );
|
||||
}
|
||||
m_plots.removeChildObject( plot );
|
||||
|
||||
onPlotAdditionOrRemoval();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1129,6 +1119,9 @@ void RimDepthTrackPlot::setDepthUnit( RiaDefines::DepthUnitType depthUnit )
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDepthTrackPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
|
@ -19,6 +19,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
@ -26,10 +31,6 @@
|
||||
#include "cafPdmFieldHandle.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimWellLogPlotNameConfig.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <set>
|
||||
@ -43,7 +44,7 @@ class QKeyEvent;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimDepthTrackPlot : public RimPlotWindow, public RimNameConfigHolderInterface
|
||||
class RimDepthTrackPlot : public RimTypedPlotCollection<RimPlot>, public RimPlotWindow, public RimNameConfigHolderInterface
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -69,16 +70,14 @@ public:
|
||||
QWidget* createPlotWidget( QWidget* mainWindowParent = nullptr );
|
||||
QString description() const override;
|
||||
|
||||
void addPlot( RimPlot* plot );
|
||||
void insertPlot( RimPlot* plot, size_t index );
|
||||
void removePlot( RimPlot* plot );
|
||||
|
||||
size_t plotCount() const;
|
||||
size_t plotCount() const override;
|
||||
size_t plotIndex( const RimPlot* plot ) const;
|
||||
RimPlot* plotByIndex( size_t index ) const;
|
||||
|
||||
std::vector<RimPlot*> plots() const;
|
||||
std::vector<RimPlot*> plots() const override;
|
||||
std::vector<RimPlot*> visiblePlots() const;
|
||||
void insertPlot( RimPlot* plot, size_t index ) final;
|
||||
void removePlot( RimPlot* plot ) final;
|
||||
|
||||
DepthTypeEnum depthType() const;
|
||||
void setDepthType( DepthTypeEnum depthType );
|
||||
@ -154,7 +153,7 @@ private:
|
||||
void onPlotAdditionOrRemoval();
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
void doUpdateLayout() override;
|
||||
void onPlotsReordered( const SignalEmitter* emitter );
|
||||
void onPlotsReordered( const caf::SignalEmitter* emitter );
|
||||
|
||||
protected:
|
||||
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
|
||||
|
@ -240,14 +240,14 @@ void RimMainPlotCollection::deleteAllContainedObjects()
|
||||
m_wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects();
|
||||
m_rftPlotCollection()->deleteAllPlots();
|
||||
m_pltPlotCollection()->deleteAllPlots();
|
||||
m_summaryPlotCollection()->summaryPlots.deleteAllChildObjects();
|
||||
m_summaryCrossPlotCollection()->deleteAllChildObjects();
|
||||
m_gridCrossPlotCollection->deleteAllChildObjects();
|
||||
m_summaryPlotCollection()->deleteAllPlots();
|
||||
m_summaryCrossPlotCollection()->deleteAllPlots();
|
||||
m_gridCrossPlotCollection->deleteAllPlots();
|
||||
m_flowPlotCollection()->closeDefaultPlotWindowAndDeletePlots();
|
||||
m_saturationPressurePlotCollection()->deleteAllChildObjects();
|
||||
m_multiPlotCollection()->deleteAllChildObjects();
|
||||
m_analysisPlotCollection()->deleteAllChildObjects();
|
||||
m_correlationPlotCollection()->deleteAllChildObjects();
|
||||
m_analysisPlotCollection()->deleteAllPlots();
|
||||
m_correlationPlotCollection()->deleteAllPlots();
|
||||
m_fractureModelPlotCollection()->deleteAllPlots();
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ void RimMainPlotCollection::updatePlotsWithFormations()
|
||||
|
||||
if ( m_gridCrossPlotCollection )
|
||||
{
|
||||
for ( RimGridCrossPlot* crossPlot : m_gridCrossPlotCollection->gridCrossPlots() )
|
||||
for ( RimGridCrossPlot* crossPlot : m_gridCrossPlotCollection->plots() )
|
||||
{
|
||||
crossPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "RimPlot.h"
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimPlotCurve.h"
|
||||
#include "RimPlotWindow.h"
|
||||
@ -124,7 +126,13 @@ void RimPlot::removeFromMdiAreaAndCollection()
|
||||
{
|
||||
revokeMdiWindowStatus();
|
||||
}
|
||||
doRemoveFromCollection();
|
||||
|
||||
RimAbstractPlotCollection* plotCollection = nullptr;
|
||||
this->firstAncestorOfType( plotCollection );
|
||||
if ( plotCollection )
|
||||
{
|
||||
plotCollection->removeRimPlot( this );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -101,7 +101,6 @@ protected:
|
||||
void updateFonts() override;
|
||||
|
||||
private:
|
||||
virtual void doRemoveFromCollection() = 0;
|
||||
virtual void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
virtual void handleKeyPressEvent( QKeyEvent* event ) {}
|
||||
virtual void handleWheelEvent( QWheelEvent* event ) {}
|
||||
|
@ -159,7 +159,7 @@ void RimReloadCaseTools::updateAllPlots()
|
||||
RimSummaryPlotCollection* summaryPlotCollection = project->mainPlotCollection()->summaryPlotCollection();
|
||||
if ( summaryPlotCollection )
|
||||
{
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotCollection->summaryPlots() )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlotCollection->plots() )
|
||||
{
|
||||
summaryPlot->loadDataAndUpdate();
|
||||
}
|
||||
@ -168,7 +168,7 @@ void RimReloadCaseTools::updateAllPlots()
|
||||
RimGridCrossPlotCollection* gridCrossPlotCollection = project->mainPlotCollection()->gridCrossPlotCollection();
|
||||
if ( gridCrossPlotCollection )
|
||||
{
|
||||
for ( RimGridCrossPlot* crossPlot : gridCrossPlotCollection->gridCrossPlots() )
|
||||
for ( RimGridCrossPlot* crossPlot : gridCrossPlotCollection->plots() )
|
||||
{
|
||||
crossPlot->loadDataAndUpdate();
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ void RimSummaryCalculation::updateDependentCurvesAndPlots()
|
||||
calcColl->rebuildCaseMetaData();
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotCollection = RiaSummaryTools::summaryPlotCollection();
|
||||
for ( RimSummaryPlot* sumPlot : summaryPlotCollection->summaryPlots() )
|
||||
for ( RimSummaryPlot* sumPlot : summaryPlotCollection->plots() )
|
||||
{
|
||||
bool plotContainsCalculatedCurves = false;
|
||||
|
||||
|
@ -518,19 +518,6 @@ int RimWellLogTrack::axisFontSize() const
|
||||
return caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_axisFontSize() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::doRemoveFromCollection()
|
||||
{
|
||||
RimDepthTrackPlot* wellLogPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
wellLogPlot->removePlot( this );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -247,8 +247,6 @@ private:
|
||||
|
||||
int axisFontSize() const;
|
||||
|
||||
void doRemoveFromCollection() override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void curveDataChanged( const caf::SignalEmitter* emitter );
|
||||
void curveVisibilityChanged( const caf::SignalEmitter* emitter, bool visible );
|
||||
|
@ -48,7 +48,7 @@ RimSummaryCrossPlotCollection::~RimSummaryCrossPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCrossPlotCollection::deleteAllChildObjects()
|
||||
void RimSummaryCrossPlotCollection::deleteAllPlots()
|
||||
{
|
||||
m_summaryCrossPlots.deleteAllChildObjects();
|
||||
}
|
||||
@ -56,11 +56,19 @@ void RimSummaryCrossPlotCollection::deleteAllChildObjects()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryPlot*> RimSummaryCrossPlotCollection::summaryPlots() const
|
||||
std::vector<RimSummaryPlot*> RimSummaryCrossPlotCollection::plots() const
|
||||
{
|
||||
return m_summaryCrossPlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSummaryCrossPlotCollection::plotCount() const
|
||||
{
|
||||
return m_summaryCrossPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -86,6 +94,22 @@ void RimSummaryCrossPlotCollection::summaryPlotItemInfos( QList<caf::PdmOptionIt
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCrossPlotCollection::insertPlot( RimSummaryPlot* plot, size_t index )
|
||||
{
|
||||
m_summaryCrossPlots.insert( index, plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCrossPlotCollection::removePlot( RimSummaryPlot* plot )
|
||||
{
|
||||
m_summaryCrossPlots.removeChildObject( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -98,11 +122,3 @@ RimSummaryPlot* RimSummaryCrossPlotCollection::createSummaryPlot()
|
||||
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCrossPlotCollection::addSummaryPlot( RimSummaryPlot* plot )
|
||||
{
|
||||
m_summaryCrossPlots().push_back( plot );
|
||||
}
|
||||
|
@ -18,16 +18,17 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimSummaryPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryCrossPlotCollection : public caf::PdmObject
|
||||
class RimSummaryCrossPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimSummaryPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -35,11 +36,14 @@ public:
|
||||
RimSummaryCrossPlotCollection();
|
||||
~RimSummaryCrossPlotCollection() override;
|
||||
|
||||
void deleteAllChildObjects();
|
||||
void deleteAllPlots() final;
|
||||
|
||||
std::vector<RimSummaryPlot*> summaryPlots() const;
|
||||
RimSummaryPlot* createSummaryPlot();
|
||||
void addSummaryPlot( RimSummaryPlot* plot );
|
||||
std::vector<RimSummaryPlot*> plots() const final;
|
||||
size_t plotCount() const final;
|
||||
void insertPlot( RimSummaryPlot* plot, size_t index ) final;
|
||||
void removePlot( RimSummaryPlot* plot ) final;
|
||||
|
||||
RimSummaryPlot* createSummaryPlot();
|
||||
|
||||
void updateSummaryNameHasChanged();
|
||||
void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const;
|
||||
|
@ -106,7 +106,7 @@ protected:
|
||||
void updateLegendsInPlot() override;
|
||||
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
void initAfterRead();
|
||||
void initAfterRead() override;
|
||||
|
||||
private:
|
||||
RifSummaryReaderInterface* valuesSummaryReaderX() const;
|
||||
|
@ -1735,20 +1735,6 @@ void RimSummaryPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter,
|
||||
loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::doRemoveFromCollection()
|
||||
{
|
||||
RimSummaryPlotCollection* summaryCollection = nullptr;
|
||||
this->firstAncestorOrThisOfType( summaryCollection );
|
||||
if ( summaryCollection )
|
||||
{
|
||||
summaryCollection->removeSummaryPlot( this );
|
||||
summaryCollection->updateAllRequiredEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -190,7 +190,6 @@ private:
|
||||
|
||||
void detachAllPlotItems();
|
||||
|
||||
void doRemoveFromCollection() override;
|
||||
void handleKeyPressEvent( QKeyEvent* keyEvent ) override;
|
||||
|
||||
void onCurvesReordered( const SignalEmitter* emitter );
|
||||
|
@ -39,9 +39,9 @@ RimSummaryPlotCollection::RimSummaryPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Summary Plots", ":/SummaryPlotsLight16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &summaryPlots, "SummaryPlots", "Summary Plots", "", "", "" );
|
||||
summaryPlots.uiCapability()->setUiHidden( true );
|
||||
caf::PdmFieldReorderCapability::addToField( &summaryPlots );
|
||||
CAF_PDM_InitFieldNoDefault( &m_summaryPlots, "SummaryPlots", "Summary Plots", "", "", "" );
|
||||
m_summaryPlots.uiCapability()->setUiHidden( true );
|
||||
caf::PdmFieldReorderCapability::addToField( &m_summaryPlots );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -49,7 +49,6 @@ RimSummaryPlotCollection::RimSummaryPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotCollection::~RimSummaryPlotCollection()
|
||||
{
|
||||
summaryPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -61,7 +60,8 @@ RimSummaryPlot* RimSummaryPlotCollection::createSummaryPlotWithAutoTitle()
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
plot->enableAutoPlotTitle( true );
|
||||
summaryPlots.push_back( plot );
|
||||
|
||||
addPlot( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
@ -74,7 +74,8 @@ RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot( const QString&
|
||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
summaryPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
plot->setDescription( name );
|
||||
|
||||
return plot;
|
||||
@ -85,7 +86,7 @@ RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot( const QString&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::updateSummaryNameHasChanged()
|
||||
{
|
||||
for ( RimSummaryPlot* plot : summaryPlots )
|
||||
for ( RimSummaryPlot* plot : plots() )
|
||||
{
|
||||
plot->updateCaseNameHasChanged();
|
||||
}
|
||||
@ -96,21 +97,13 @@ void RimSummaryPlotCollection::updateSummaryNameHasChanged()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const
|
||||
{
|
||||
for ( RimSummaryPlot* plot : summaryPlots() )
|
||||
for ( RimSummaryPlot* plot : plots() )
|
||||
{
|
||||
QString displayName = plot->description();
|
||||
optionInfos->push_back( caf::PdmOptionItemInfo( displayName, plot, false, plot->uiCapability()->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::removeSummaryPlot( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
summaryPlots.removeChildObject( summaryPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -121,3 +114,35 @@ void RimSummaryPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle*
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryPlot*> RimSummaryPlotCollection::plots() const
|
||||
{
|
||||
return m_summaryPlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSummaryPlotCollection::plotCount() const
|
||||
{
|
||||
return m_summaryPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::insertPlot( RimSummaryPlot* summaryPlot, size_t index )
|
||||
{
|
||||
m_summaryPlots.insert( index, summaryPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::removePlot( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
m_summaryPlots.removeChildObject( summaryPlot );
|
||||
}
|
||||
|
@ -18,6 +18,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
@ -28,7 +31,7 @@ class RimSummaryPlot;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryPlotCollection : public caf::PdmObject
|
||||
class RimSummaryPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimSummaryPlot>
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@ -36,16 +39,19 @@ public:
|
||||
RimSummaryPlotCollection();
|
||||
~RimSummaryPlotCollection() override;
|
||||
|
||||
caf::PdmChildArrayField<RimSummaryPlot*> summaryPlots;
|
||||
|
||||
RimSummaryPlot* createSummaryPlotWithAutoTitle();
|
||||
RimSummaryPlot* createNamedSummaryPlot( const QString& name );
|
||||
|
||||
void updateSummaryNameHasChanged();
|
||||
void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const;
|
||||
|
||||
void removeSummaryPlot( RimSummaryPlot* summaryPlot );
|
||||
|
||||
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
|
||||
|
||||
std::vector<RimSummaryPlot*> plots() const final;
|
||||
size_t plotCount() const final;
|
||||
void insertPlot( RimSummaryPlot* summaryPlot, size_t index ) final;
|
||||
void removePlot( RimSummaryPlot* summaryPlot ) final;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimSummaryPlot*> m_summaryPlots;
|
||||
};
|
||||
|
@ -150,7 +150,8 @@ public:
|
||||
|
||||
void send( Args... args ) const
|
||||
{
|
||||
for ( auto observerCallbackPair : m_observerCallbacks )
|
||||
auto observerCallBacksCopy = m_observerCallbacks;
|
||||
for ( auto observerCallbackPair : observerCallBacksCopy )
|
||||
{
|
||||
if ( observerCallbackPair.second.second )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user