mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Summary multiplot improvements (#8598)
* Create multi summary plot from summary plot(s) * Rearrange multi summary plot properties * Enable source stepping toolbar for multi summary plot * Automatically activate new summary plot when creating from data sources -> data vector tree * Enable global key controls for switching data in summary and multi summary plots * Update tooltip texts for summary plot toolbar
This commit is contained in:
@@ -68,7 +68,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void addPlot( RimPlotType* plot ) { insertPlot( plot, plotCount() ); }
|
||||
virtual 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 ) override
|
||||
|
||||
@@ -1065,6 +1065,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicNewDerivedEnsembleFeature";
|
||||
menuBuilder << "RicNewSummaryPlotFeature";
|
||||
menuBuilder << "RicNewDefaultSummaryPlotFeature";
|
||||
menuBuilder << "RicNewSummaryMultiPlotFeature";
|
||||
menuBuilder << "RicNewSummaryCrossPlotFeature";
|
||||
menuBuilder << "RicSummaryCurveSwitchAxisFeature";
|
||||
menuBuilder << "RicNewDerivedSummaryFeature";
|
||||
@@ -1104,7 +1105,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicCloseObservedDataFeature";
|
||||
|
||||
menuBuilder << "RicNewMultiPlotFeature";
|
||||
menuBuilder << "RicNewSummaryMultiPlotFeature";
|
||||
|
||||
// Work in progress -- End
|
||||
|
||||
@@ -1189,6 +1189,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
else if ( dynamic_cast<RimSummaryAddress*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewSummaryPlotFromDataVectorFeature";
|
||||
menuBuilder << "RicNewSummaryMultiPlotFromDataVectorFeature";
|
||||
}
|
||||
#ifdef USE_ODB_API
|
||||
else if ( dynamic_cast<RimWellIASettings*>( firstUiItem ) )
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "RimStimPlanModelPlotCollection.h"
|
||||
#include "RimSummaryAddress.h"
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
#include "RimSummaryMultiPlotCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimVfpPlotCollection.h"
|
||||
#include "RimViewWindow.h"
|
||||
@@ -82,6 +83,9 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault( &m_summaryPlotCollection, "SummaryPlotCollection", "Summary Plots" );
|
||||
m_summaryPlotCollection.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_summaryMultiPlotCollection, "SummaryMultiPlotCollection", "Multi Summary Plots" );
|
||||
m_summaryMultiPlotCollection.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_analysisPlotCollection, "AnalysisPlotCollection", "Analysis Plots" );
|
||||
m_analysisPlotCollection.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
@@ -122,6 +126,7 @@ RimMainPlotCollection::RimMainPlotCollection()
|
||||
m_rftPlotCollection = new RimRftPlotCollection();
|
||||
m_pltPlotCollection = new RimPltPlotCollection();
|
||||
m_summaryPlotCollection = new RimSummaryPlotCollection();
|
||||
m_summaryMultiPlotCollection = new RimSummaryMultiPlotCollection();
|
||||
m_summaryCrossPlotCollection = new RimSummaryCrossPlotCollection();
|
||||
m_flowPlotCollection = new RimFlowPlotCollection();
|
||||
m_gridCrossPlotCollection = new RimGridCrossPlotCollection;
|
||||
@@ -193,6 +198,14 @@ RimSummaryPlotCollection* RimMainPlotCollection::summaryPlotCollection() const
|
||||
return m_summaryPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlotCollection* RimMainPlotCollection::summaryMultiPlotCollection() const
|
||||
{
|
||||
return m_summaryMultiPlotCollection();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -403,6 +416,7 @@ std::vector<RimPlotCollection*> RimMainPlotCollection::allPlotCollections() cons
|
||||
std::vector<RimPlotCollection*> plotCollections;
|
||||
plotCollections.push_back( wellLogPlotCollection() );
|
||||
plotCollections.push_back( summaryPlotCollection() );
|
||||
plotCollections.push_back( summaryMultiPlotCollection() );
|
||||
plotCollections.push_back( summaryCrossPlotCollection() );
|
||||
plotCollections.push_back( gridCrossPlotCollection() );
|
||||
plotCollections.push_back( analysisPlotCollection() );
|
||||
|
||||
@@ -33,6 +33,7 @@ class RimRftPlotCollection;
|
||||
class RimPltPlotCollection;
|
||||
class RimGridCrossPlotCollection;
|
||||
class RimMultiPlotCollection;
|
||||
class RimSummaryMultiPlotCollection;
|
||||
class RimSummaryPlotCollection;
|
||||
class RimSummaryCrossPlotCollection;
|
||||
class RimSummaryPlot;
|
||||
@@ -65,6 +66,7 @@ public:
|
||||
RimRftPlotCollection* rftPlotCollection() const;
|
||||
RimPltPlotCollection* pltPlotCollection() const;
|
||||
RimSummaryPlotCollection* summaryPlotCollection() const;
|
||||
RimSummaryMultiPlotCollection* summaryMultiPlotCollection() const;
|
||||
RimSummaryCrossPlotCollection* summaryCrossPlotCollection() const;
|
||||
RimAnalysisPlotCollection* analysisPlotCollection() const;
|
||||
RimCorrelationPlotCollection* correlationPlotCollection() const;
|
||||
@@ -105,6 +107,7 @@ private:
|
||||
caf::PdmChildField<RimRftPlotCollection*> m_rftPlotCollection;
|
||||
caf::PdmChildField<RimPltPlotCollection*> m_pltPlotCollection;
|
||||
caf::PdmChildField<RimSummaryPlotCollection*> m_summaryPlotCollection;
|
||||
caf::PdmChildField<RimSummaryMultiPlotCollection*> m_summaryMultiPlotCollection;
|
||||
caf::PdmChildField<RimSummaryCrossPlotCollection*> m_summaryCrossPlotCollection;
|
||||
caf::PdmChildField<RimAnalysisPlotCollection*> m_analysisPlotCollection;
|
||||
caf::PdmChildField<RimCorrelationPlotCollection*> m_correlationPlotCollection;
|
||||
|
||||
@@ -757,22 +757,9 @@ void RimMultiPlot::uiOrderingForMultiPlotLayout( QString uiConfigName, caf::PdmU
|
||||
uiOrdering.add( &m_showPlotWindowTitle );
|
||||
uiOrdering.add( &m_plotWindowTitle );
|
||||
uiOrdering.add( &m_showIndividualPlotTitles );
|
||||
RimPlotWindow::uiOrderingForPlotLayout( uiConfigName, uiOrdering );
|
||||
uiOrdering.add( &m_subTitleFontSize );
|
||||
uiOrdering.add( &m_columnCount );
|
||||
uiOrdering.add( &m_rowsPerPage );
|
||||
uiOrdering.add( &m_majorTickmarkCount );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlot::uiOrderingForSummaryMultiPlot( caf::PdmUiOrdering& uiOrdering ) const
|
||||
{
|
||||
uiOrdering.add( &m_showPlotWindowTitle );
|
||||
uiOrdering.add( &m_plotWindowTitle );
|
||||
uiOrdering.add( &m_showIndividualPlotTitles );
|
||||
uiOrdering.add( &m_subTitleFontSize );
|
||||
RimPlotWindow::uiOrderingForPlotLayout( uiConfigName, uiOrdering );
|
||||
uiOrdering.add( &m_columnCount );
|
||||
uiOrdering.add( &m_rowsPerPage );
|
||||
uiOrdering.add( &m_majorTickmarkCount );
|
||||
|
||||
@@ -79,7 +79,6 @@ public:
|
||||
|
||||
void insertPlots( const std::vector<RimPlot*>& plots );
|
||||
void deleteAllPlots() override;
|
||||
void uiOrderingForSummaryMultiPlot( caf::PdmUiOrdering& uiOrdering ) const;
|
||||
|
||||
size_t plotCount() const override;
|
||||
size_t plotIndex( const RimPlot* plot ) const;
|
||||
@@ -140,11 +139,12 @@ protected:
|
||||
void updateZoom();
|
||||
void recreatePlotWidgets();
|
||||
|
||||
virtual void updatePlotWindowTitle();
|
||||
|
||||
private:
|
||||
void cleanupBeforeClose();
|
||||
void doUpdateLayout() override;
|
||||
void updateSubPlotNames();
|
||||
void updatePlotWindowTitle();
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
void onPlotAdditionOrRemoval();
|
||||
void onPlotsReordered( const caf::SignalEmitter* emitter );
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
|
||||
#include "cafPdmFieldReorderCapability.h"
|
||||
|
||||
@@ -35,10 +34,6 @@ RimMultiPlotCollection::RimMultiPlotCollection()
|
||||
CAF_PDM_InitFieldNoDefault( &m_multiPlots, "MultiPlots", "Plots Reports" );
|
||||
m_multiPlots.uiCapability()->setUiTreeHidden( true );
|
||||
caf::PdmFieldReorderCapability::addToField( &m_multiPlots );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_multiSummaryPlots, "MultiSummaryPlots", "Multi Summary Plots" );
|
||||
m_multiSummaryPlots.uiCapability()->setUiTreeHidden( true );
|
||||
caf::PdmFieldReorderCapability::addToField( &m_multiSummaryPlots );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -54,7 +49,6 @@ RimMultiPlotCollection::~RimMultiPlotCollection()
|
||||
void RimMultiPlotCollection::deleteAllPlots()
|
||||
{
|
||||
m_multiPlots.deleteAllChildObjects();
|
||||
m_multiSummaryPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -65,18 +59,6 @@ std::vector<RimMultiPlot*> RimMultiPlotCollection::multiPlots() const
|
||||
return m_multiPlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMultiPlot* RimMultiPlotCollection::createMultiPlot()
|
||||
{
|
||||
RimMultiPlot* plot = new RimMultiPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
addMultiPlot( plot );
|
||||
return plot;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -85,14 +67,6 @@ void RimMultiPlotCollection::addMultiPlot( RimMultiPlot* plot )
|
||||
m_multiPlots().push_back( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotCollection::addMultiSummaryPlot( RimSummaryMultiPlot* plot )
|
||||
{
|
||||
m_multiSummaryPlots().push_back( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -100,9 +74,6 @@ void RimMultiPlotCollection::loadDataAndUpdateAllPlots()
|
||||
{
|
||||
for ( const auto& p : m_multiPlots.childObjects() )
|
||||
p->loadDataAndUpdate();
|
||||
|
||||
for ( const auto& p : m_multiSummaryPlots.childObjects() )
|
||||
p->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -110,5 +81,5 @@ void RimMultiPlotCollection::loadDataAndUpdateAllPlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimMultiPlotCollection::plotCount() const
|
||||
{
|
||||
return m_multiPlots.size() + m_multiSummaryPlots.size();
|
||||
return m_multiPlots.size();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimMultiPlot;
|
||||
class RimSummaryMultiPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -42,11 +41,9 @@ public:
|
||||
size_t plotCount() const override;
|
||||
|
||||
std::vector<RimMultiPlot*> multiPlots() const;
|
||||
RimMultiPlot* createMultiPlot();
|
||||
void addMultiPlot( RimMultiPlot* plot );
|
||||
void addMultiSummaryPlot( RimSummaryMultiPlot* plot );
|
||||
|
||||
void addMultiPlot( RimMultiPlot* plot );
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimMultiPlot*> m_multiPlots;
|
||||
caf::PdmChildArrayField<RimSummaryMultiPlot*> m_multiSummaryPlots;
|
||||
caf::PdmChildArrayField<RimMultiPlot*> m_multiPlots;
|
||||
};
|
||||
|
||||
@@ -336,3 +336,11 @@ void RimPlotWindow::assignIdIfNecessary()
|
||||
RimProject::current()->assignPlotIdToPlotWindow( this );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotWindow::handleGlobalKeyEvent( QKeyEvent* keyEvent )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,8 @@ public:
|
||||
void renderWindowContent( QPaintDevice* painter );
|
||||
QPageLayout pageLayout() const;
|
||||
|
||||
virtual bool handleGlobalKeyEvent( QKeyEvent* keyEvent );
|
||||
|
||||
protected:
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
@@ -82,6 +84,7 @@ protected:
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
|
||||
|
||||
void updateWindowVisibility();
|
||||
|
||||
private:
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCaseMainCollection.h"
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
#include "RimSummaryMultiPlotCollection.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSurfaceCollection.h"
|
||||
#include "RimTools.h"
|
||||
@@ -1377,6 +1378,11 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q
|
||||
uiTreeOrdering.add( mainPlotCollection->summaryPlotCollection() );
|
||||
}
|
||||
|
||||
if ( mainPlotCollection->summaryMultiPlotCollection() )
|
||||
{
|
||||
uiTreeOrdering.add( mainPlotCollection->summaryMultiPlotCollection() );
|
||||
}
|
||||
|
||||
if ( mainPlotCollection->analysisPlotCollection() )
|
||||
{
|
||||
uiTreeOrdering.add( mainPlotCollection->analysisPlotCollection() );
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
RimVfpPlotCollection();
|
||||
~RimVfpPlotCollection() override;
|
||||
|
||||
void addPlot( RimVfpPlot* newPlot );
|
||||
void addPlot( RimVfpPlot* newPlot ) override;
|
||||
std::vector<RimVfpPlot*> plots() const override;
|
||||
void deleteAllChildObjects();
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryNameHelper.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultipleSummaryPlotNameHelper.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.h
|
||||
)
|
||||
|
||||
set(SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -90,6 +92,8 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryNameHelper.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMultipleSummaryPlotNameHelper.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryPlotControls.h"
|
||||
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
@@ -51,20 +52,8 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
CAF_PDM_InitObject( "Multi Summary Plot" );
|
||||
this->setDeletable( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_filterText, "FilterText", "Filter Text" );
|
||||
m_filterText.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" );
|
||||
CAF_PDM_InitField( &m_individualPlotPerObject, "IndividualPlotPerObject", false, "One plot per Object" );
|
||||
CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" );
|
||||
CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", false, "Auto Plot Titles" );
|
||||
CAF_PDM_InitField( &m_autoPlotTitlesOnSubPlots, "AutoPlotTitlesSubPlots", false, "Auto Plot Titles Sub Plots" );
|
||||
|
||||
CAF_PDM_InitField( &m_showMultiPlotInProjectTree, "ShowMultiPlotInProjectTree", true, "Show Multi Plot In Project Tree" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_multiPlot, "MultiPlot", "Multi Plot" );
|
||||
m_multiPlot.uiCapability()->setUiTreeHidden( true );
|
||||
m_multiPlot = new RimMultiPlot;
|
||||
CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", true, "Auto Plot Titles" );
|
||||
CAF_PDM_InitField( &m_autoPlotTitlesOnSubPlots, "AutoPlotTitlesSubPlots", true, "Auto Plot Titles Sub Plots" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" );
|
||||
m_sourceStepping = new RimSummaryPlotSourceStepping;
|
||||
@@ -82,67 +71,26 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlot::~RimSummaryMultiPlot()
|
||||
{
|
||||
removeMdiWindowFromMdiArea();
|
||||
m_multiPlot->cleanupBeforeClose();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimSummaryMultiPlot::viewWidget()
|
||||
void RimSummaryMultiPlot::addPlot( RimPlot* plot )
|
||||
{
|
||||
return m_multiPlot->viewWidget();
|
||||
RimSummaryPlot* sumPlot = dynamic_cast<RimSummaryPlot*>( plot );
|
||||
CVF_ASSERT( sumPlot != nullptr );
|
||||
if ( sumPlot ) RimMultiPlot::addPlot( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage RimSummaryMultiPlot::snapshotWindowContent()
|
||||
void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index )
|
||||
{
|
||||
return m_multiPlot->snapshotWindowContent();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::zoomAll()
|
||||
{
|
||||
m_multiPlot->zoomAll();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryMultiPlot::description() const
|
||||
{
|
||||
return "RimSummaryMultiPlot Placeholder Text";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::addPlot( RimSummaryPlot* plot )
|
||||
{
|
||||
m_multiPlot->addPlot( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlot* RimSummaryMultiPlot::createAndAppendMultiPlot( const std::vector<RimSummaryPlot*>& plots )
|
||||
{
|
||||
RimProject* project = RimProject::current();
|
||||
auto* plotCollection = project->mainPlotCollection()->multiPlotCollection();
|
||||
|
||||
auto* plotWindow = new RimSummaryMultiPlot;
|
||||
plotWindow->setAsPlotMdiWindow();
|
||||
plotCollection->addMultiSummaryPlot( plotWindow );
|
||||
|
||||
insertGraphsIntoPlot( plotWindow, plots );
|
||||
|
||||
plotCollection->updateAllRequiredEditors();
|
||||
|
||||
return plotWindow;
|
||||
RimSummaryPlot* sumPlot = dynamic_cast<RimSummaryPlot*>( plot );
|
||||
CVF_ASSERT( sumPlot != nullptr );
|
||||
if ( sumPlot ) RimMultiPlot::insertPlot( plot, index );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -235,83 +183,32 @@ void RimSummaryMultiPlot::populateNameHelper( RimSummaryPlotNameHelper* nameHelp
|
||||
nameHelper->setEnsembleCases( ensembleCases );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QWidget* RimSummaryMultiPlot::createViewWidget( QWidget* mainWindowParent /*= nullptr*/ )
|
||||
{
|
||||
return m_multiPlot->createViewWidget( mainWindowParent );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::deleteViewWidget()
|
||||
{
|
||||
m_multiPlot->deleteViewWidget();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
if ( m_autoPlotTitles )
|
||||
{
|
||||
updatePlotTitles();
|
||||
}
|
||||
|
||||
m_multiPlot->onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::doRenderWindowContent( QPaintDevice* paintDevice )
|
||||
{
|
||||
m_multiPlot->doRenderWindowContent( paintDevice );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimSummaryMultiPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly )
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_autoPlotTitles );
|
||||
uiOrdering.add( &m_autoPlotTitlesOnSubPlots );
|
||||
caf::PdmUiGroup* titlesGroup = uiOrdering.addNewGroup( "Titles" );
|
||||
titlesGroup->add( &m_autoPlotTitles );
|
||||
titlesGroup->add( &m_autoPlotTitlesOnSubPlots );
|
||||
|
||||
{
|
||||
auto group = uiOrdering.addNewGroup( "Data Source" );
|
||||
m_sourceStepping()->uiOrdering( uiConfigName, *group );
|
||||
}
|
||||
titlesGroup->add( &m_showPlotWindowTitle );
|
||||
titlesGroup->add( &m_plotWindowTitle );
|
||||
titlesGroup->add( &m_showIndividualPlotTitles );
|
||||
titlesGroup->add( &m_titleFontSize );
|
||||
titlesGroup->add( &m_subTitleFontSize );
|
||||
|
||||
auto group = uiOrdering.addNewGroup( "Multi Plot Options" );
|
||||
m_multiPlot->uiOrderingForSummaryMultiPlot( *group );
|
||||
caf::PdmUiGroup* legendsGroup = uiOrdering.addNewGroup( "Legends" );
|
||||
legendsGroup->add( &m_showPlotLegends );
|
||||
legendsGroup->add( &m_plotLegendsHorizontal );
|
||||
legendsGroup->add( &m_legendFontSize );
|
||||
|
||||
{
|
||||
auto group = uiOrdering.addNewGroup( "Graph Building" );
|
||||
group->setCollapsedByDefault( true );
|
||||
caf::PdmUiGroup* layoutGroup = uiOrdering.addNewGroup( "Layout" );
|
||||
layoutGroup->add( &m_columnCount );
|
||||
layoutGroup->add( &m_rowsPerPage );
|
||||
layoutGroup->add( &m_majorTickmarkCount );
|
||||
|
||||
group->add( &m_filterText );
|
||||
group->add( &m_individualPlotPerVector );
|
||||
group->add( &m_individualPlotPerDataSource );
|
||||
group->add( &m_individualPlotPerObject );
|
||||
}
|
||||
uiOrdering.add( &m_showMultiPlotInProjectTree );
|
||||
|
||||
uiOrdering.skipRemainingFields();
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -321,110 +218,29 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_showWindow && m_showWindow() )
|
||||
{
|
||||
// Plots contained in a RimMultiPlot will automatically be set invisible
|
||||
// Restore plot visibility
|
||||
|
||||
for ( auto p : m_multiPlot->plots() )
|
||||
{
|
||||
p->setShowWindow( true );
|
||||
}
|
||||
}
|
||||
else if ( changedField == &m_filterText || changedField == &m_individualPlotPerDataSource ||
|
||||
changedField == &m_individualPlotPerVector || changedField == &m_individualPlotPerObject )
|
||||
{
|
||||
updatePlots();
|
||||
}
|
||||
else if ( changedField == &m_autoPlotTitles || changedField == &m_autoPlotTitlesOnSubPlots )
|
||||
if ( changedField == &m_autoPlotTitles || changedField == &m_autoPlotTitlesOnSubPlots )
|
||||
{
|
||||
onLoadDataAndUpdate();
|
||||
updateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_filterText )
|
||||
else
|
||||
{
|
||||
auto attr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>( attribute );
|
||||
if ( attr )
|
||||
{
|
||||
attr->enableEditableContent = true;
|
||||
attr->enableAutoComplete = false;
|
||||
attr->adjustWidthToContents = true;
|
||||
attr->notifyWhenTextIsEdited = true;
|
||||
}
|
||||
RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName )
|
||||
void RimSummaryMultiPlot::updatePlotWindowTitle()
|
||||
{
|
||||
uiTreeOrdering.skipRemainingChildren( !m_showMultiPlotInProjectTree );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::updatePlots()
|
||||
{
|
||||
auto [addressFilters, dataSourceFilters] =
|
||||
RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( m_filterText() );
|
||||
|
||||
auto [matchingSummaryCases, matchingEnsembles] = RiaSummaryStringTools::dataSourcesMatchingFilters( dataSourceFilters );
|
||||
|
||||
std::set<RifEclipseSummaryAddress> allAddresses;
|
||||
if ( !matchingSummaryCases.empty() )
|
||||
if ( m_autoPlotTitles )
|
||||
{
|
||||
allAddresses = RicSummaryPlotBuilder::addressesForSource( matchingSummaryCases.front() );
|
||||
populateNameHelper( m_nameHelper.get() );
|
||||
|
||||
auto title = m_nameHelper->plotTitle();
|
||||
setMultiPlotTitle( title );
|
||||
}
|
||||
else if ( !matchingEnsembles.empty() )
|
||||
{
|
||||
allAddresses = RicSummaryPlotBuilder::addressesForSource( matchingEnsembles.front() );
|
||||
}
|
||||
|
||||
bool includeDiffCurves = false;
|
||||
auto filteredAddresses =
|
||||
RiaSummaryStringTools::computeFilteredAddresses( addressFilters, allAddresses, includeDiffCurves );
|
||||
|
||||
{
|
||||
m_multiPlot->deleteAllPlots();
|
||||
|
||||
RicSummaryPlotBuilder plotBuilder;
|
||||
plotBuilder.setAddresses( filteredAddresses );
|
||||
plotBuilder.setDataSources( matchingSummaryCases, matchingEnsembles );
|
||||
plotBuilder.setIndividualPlotPerDataSource( m_individualPlotPerDataSource );
|
||||
|
||||
RicSummaryPlotBuilder::RicGraphCurveGrouping groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::NONE;
|
||||
if ( m_individualPlotPerVector ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::SINGLE_CURVES;
|
||||
if ( m_individualPlotPerObject ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::CURVES_FOR_OBJECT;
|
||||
plotBuilder.setGrouping( groping );
|
||||
|
||||
auto plots = plotBuilder.createPlots();
|
||||
|
||||
insertGraphsIntoPlot( this, plots );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::updatePlotTitles()
|
||||
{
|
||||
populateNameHelper( m_nameHelper.get() );
|
||||
|
||||
auto title = m_nameHelper->plotTitle();
|
||||
m_multiPlot->setMultiPlotTitle( title );
|
||||
|
||||
if ( m_autoPlotTitlesOnSubPlots )
|
||||
{
|
||||
@@ -473,7 +289,7 @@ std::vector<RimSummaryPlot*> RimSummaryMultiPlot::summaryPlots() const
|
||||
{
|
||||
std::vector<RimSummaryPlot*> typedPlots;
|
||||
|
||||
for ( auto plot : m_multiPlot->plots() )
|
||||
for ( auto plot : plots() )
|
||||
{
|
||||
auto summaryPlot = dynamic_cast<RimSummaryPlot*>( plot );
|
||||
if ( summaryPlot ) typedPlots.push_back( summaryPlot );
|
||||
@@ -519,10 +335,10 @@ void RimSummaryMultiPlot::insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const
|
||||
plot->setAutoTitlePlot( true );
|
||||
plot->setAutoTitleGraphs( showTitleSubGraph );
|
||||
|
||||
plot->m_multiPlot->setColumnCount( columnCount );
|
||||
plot->m_multiPlot->setRowCount( rowCount );
|
||||
plot->m_multiPlot->setShowPlotTitles( showTitleSubGraph );
|
||||
plot->m_multiPlot->setTickmarkCount( tickmarkCount );
|
||||
plot->setColumnCount( columnCount );
|
||||
plot->setRowCount( rowCount );
|
||||
plot->setShowPlotTitles( showTitleSubGraph );
|
||||
plot->setTickmarkCount( tickmarkCount );
|
||||
|
||||
for ( auto graph : graphs )
|
||||
{
|
||||
@@ -537,3 +353,28 @@ void RimSummaryMultiPlot::insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmFieldHandle*> RimSummaryMultiPlot::fieldsToShowInToolbar()
|
||||
{
|
||||
std::vector<caf::PdmFieldHandle*> toolBarFields;
|
||||
|
||||
auto& sourceObject = m_sourceStepping();
|
||||
if ( sourceObject )
|
||||
{
|
||||
auto fields = sourceObject->fieldsToShowInToolbar();
|
||||
toolBarFields.insert( std::end( toolBarFields ), std::begin( fields ), std::end( fields ) );
|
||||
}
|
||||
|
||||
return toolBarFields;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryMultiPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent )
|
||||
{
|
||||
return RimSummaryPlotControls::handleKeyEvents( m_sourceStepping(), keyEvent );
|
||||
}
|
||||
|
||||
@@ -18,14 +18,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimMultiPlot.h"
|
||||
#include "RimSummaryDataSourceStepping.h"
|
||||
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
|
||||
class RimMultiPlot;
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryPlot;
|
||||
class RimSummaryPlotSourceStepping;
|
||||
class RimSummaryPlotNameHelper;
|
||||
@@ -35,7 +36,7 @@ class RimSummaryNameHelper;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryMultiPlot : public RimPlotWindow, public RimSummaryDataSourceStepping
|
||||
class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStepping
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -43,60 +44,38 @@ public:
|
||||
RimSummaryMultiPlot();
|
||||
~RimSummaryMultiPlot() override;
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
QImage snapshotWindowContent() override;
|
||||
void zoomAll() override;
|
||||
QString description() const override;
|
||||
|
||||
void addPlot( RimSummaryPlot* plot );
|
||||
|
||||
void updatePlotTitles();
|
||||
const RimSummaryNameHelper* nameHelper() const;
|
||||
|
||||
void setAutoTitlePlot( bool enable );
|
||||
void setAutoTitleGraphs( bool enable );
|
||||
|
||||
static RimSummaryMultiPlot* createAndAppendMultiPlot( const std::vector<RimSummaryPlot*>& plots );
|
||||
|
||||
std::vector<RimSummaryDataSourceStepping::Axis> availableAxes() const override;
|
||||
std::vector<RimSummaryCurve*> curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const override;
|
||||
std::vector<RimEnsembleCurveSet*> curveSets() const override;
|
||||
std::vector<RimSummaryCurve*> allCurves( RimSummaryDataSourceStepping::Axis axis ) const override;
|
||||
|
||||
void addPlot( RimPlot* plot ) override;
|
||||
void insertPlot( RimPlot* plot, size_t index ) override;
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
|
||||
|
||||
protected:
|
||||
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
|
||||
|
||||
private:
|
||||
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
void deleteViewWidget() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
void doRenderWindowContent( QPaintDevice* paintDevice ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
|
||||
bool* useOptionsOnly ) override;
|
||||
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
|
||||
void updatePlots();
|
||||
void populateNameHelper( RimSummaryPlotNameHelper* nameHelper );
|
||||
|
||||
std::vector<RimSummaryPlot*> summaryPlots() const;
|
||||
|
||||
static void insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const std::vector<RimSummaryPlot*>& graphs );
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_filterText;
|
||||
caf::PdmField<bool> m_individualPlotPerVector;
|
||||
caf::PdmField<bool> m_individualPlotPerDataSource;
|
||||
caf::PdmField<bool> m_individualPlotPerObject;
|
||||
caf::PdmField<bool> m_autoPlotTitles;
|
||||
caf::PdmField<bool> m_autoPlotTitlesOnSubPlots;
|
||||
void updatePlotWindowTitle() override;
|
||||
|
||||
caf::PdmField<bool> m_showMultiPlotInProjectTree;
|
||||
caf::PdmChildField<RimMultiPlot*> m_multiPlot;
|
||||
private:
|
||||
caf::PdmField<bool> m_autoPlotTitles;
|
||||
caf::PdmField<bool> m_autoPlotTitlesOnSubPlots;
|
||||
|
||||
caf::PdmChildField<RimSummaryPlotSourceStepping*> m_sourceStepping;
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimSummaryMultiPlotCollection.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
|
||||
#include "cafPdmFieldReorderCapability.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimSummaryMultiPlotCollection, "RimSummaryMultiPlotCollection" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlotCollection::RimSummaryMultiPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitObject( "Summary Multi Plots", ":/MultiPlot16x16.png" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_summaryMultiPlots, "MultiSummaryPlots", "Multi Summary Plots" );
|
||||
m_summaryMultiPlots.uiCapability()->setUiTreeHidden( true );
|
||||
caf::PdmFieldReorderCapability::addToField( &m_summaryMultiPlots );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryMultiPlotCollection::~RimSummaryMultiPlotCollection()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlotCollection::deleteAllPlots()
|
||||
{
|
||||
m_summaryMultiPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryMultiPlot*> RimSummaryMultiPlotCollection::multiPlots() const
|
||||
{
|
||||
return m_summaryMultiPlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlotCollection::addMultiSummaryPlot( RimSummaryMultiPlot* plot )
|
||||
{
|
||||
m_summaryMultiPlots().push_back( plot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlotCollection::loadDataAndUpdateAllPlots()
|
||||
{
|
||||
for ( const auto& p : m_summaryMultiPlots.childObjects() )
|
||||
p->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSummaryMultiPlotCollection::plotCount() const
|
||||
{
|
||||
return m_summaryMultiPlots.size();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimAbstractPlotCollection.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
class RimSummaryMultiPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimSummaryMultiPlotCollection : public caf::PdmObject, public RimPlotCollection
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimSummaryMultiPlotCollection();
|
||||
~RimSummaryMultiPlotCollection() override;
|
||||
|
||||
void deleteAllPlots() override;
|
||||
void loadDataAndUpdateAllPlots() override;
|
||||
size_t plotCount() const override;
|
||||
|
||||
std::vector<RimSummaryMultiPlot*> multiPlots() const;
|
||||
|
||||
void addMultiSummaryPlot( RimSummaryMultiPlot* plot );
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimSummaryMultiPlot*> m_summaryMultiPlots;
|
||||
};
|
||||
@@ -51,6 +51,7 @@
|
||||
#include "RimSummaryCurvesData.h"
|
||||
#include "RimSummaryPlotAxisFormatter.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSummaryPlotControls.h"
|
||||
#include "RimSummaryPlotFilterTextCurveSetEditor.h"
|
||||
#include "RimSummaryPlotNameHelper.h"
|
||||
#include "RimSummaryTimeAxisProperties.h"
|
||||
@@ -2279,60 +2280,9 @@ void RimSummaryPlot::reattachAllCurves()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlot::handleKeyPressEvent( QKeyEvent* keyEvent )
|
||||
bool RimSummaryPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent )
|
||||
{
|
||||
if ( !keyEvent ) return;
|
||||
|
||||
if ( RiuTreeViewEventFilter::activateFeatureFromKeyEvent( keyEvent ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RimSummaryPlotSourceStepping* sourceStepping = sourceSteppingObjectForKeyEventHandling();
|
||||
if ( !sourceStepping ) return;
|
||||
|
||||
if ( keyEvent->key() == Qt::Key_PageUp )
|
||||
{
|
||||
if ( keyEvent->modifiers() & Qt::ShiftModifier )
|
||||
{
|
||||
sourceStepping->applyPrevCase();
|
||||
|
||||
keyEvent->accept();
|
||||
}
|
||||
else if ( keyEvent->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
sourceStepping->applyPrevOtherIdentifier();
|
||||
|
||||
keyEvent->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceStepping->applyPrevQuantity();
|
||||
|
||||
keyEvent->accept();
|
||||
}
|
||||
}
|
||||
else if ( keyEvent->key() == Qt::Key_PageDown )
|
||||
{
|
||||
if ( keyEvent->modifiers() & Qt::ShiftModifier )
|
||||
{
|
||||
sourceStepping->applyNextCase();
|
||||
|
||||
keyEvent->accept();
|
||||
}
|
||||
else if ( keyEvent->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
sourceStepping->applyNextOtherIdentifier();
|
||||
|
||||
keyEvent->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceStepping->applyNextQuantity();
|
||||
|
||||
keyEvent->accept();
|
||||
}
|
||||
}
|
||||
return RimSummaryPlotControls::handleKeyEvents( sourceSteppingObjectForKeyEventHandling(), keyEvent );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -208,8 +208,6 @@ private:
|
||||
void detachAllPlotItems();
|
||||
void deleteAllPlotCurves();
|
||||
|
||||
void handleKeyPressEvent( QKeyEvent* keyEvent ) override;
|
||||
|
||||
void onCurveCollectionChanged( const SignalEmitter* emitter );
|
||||
|
||||
void connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis );
|
||||
@@ -231,6 +229,8 @@ protected:
|
||||
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
|
||||
|
||||
private slots:
|
||||
void onPlotZoomed();
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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 "RimSummaryPlotControls.h"
|
||||
|
||||
#include "RimSummaryPlotSourceStepping.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlotControls::handleKeyEvents( RimSummaryPlotSourceStepping* srcStepping, QKeyEvent* keyEvent )
|
||||
{
|
||||
if ( !keyEvent ) return false;
|
||||
if ( !srcStepping ) return false;
|
||||
|
||||
if ( !( keyEvent->modifiers() & Qt::ControlModifier ) ) return false;
|
||||
|
||||
bool bHandled = false;
|
||||
|
||||
if ( keyEvent->key() == Qt::Key_Left )
|
||||
{
|
||||
srcStepping->applyPrevOtherIdentifier();
|
||||
keyEvent->accept();
|
||||
bHandled = true;
|
||||
}
|
||||
else if ( keyEvent->key() == Qt::Key_Right )
|
||||
{
|
||||
srcStepping->applyNextOtherIdentifier();
|
||||
keyEvent->accept();
|
||||
bHandled = true;
|
||||
}
|
||||
else if ( keyEvent->key() == Qt::Key_PageDown )
|
||||
{
|
||||
srcStepping->applyNextCase();
|
||||
keyEvent->accept();
|
||||
bHandled = true;
|
||||
}
|
||||
else if ( keyEvent->key() == Qt::Key_PageUp )
|
||||
{
|
||||
srcStepping->applyPrevCase();
|
||||
keyEvent->accept();
|
||||
bHandled = true;
|
||||
}
|
||||
else if ( keyEvent->key() == Qt::Key_Up )
|
||||
{
|
||||
srcStepping->applyPrevQuantity();
|
||||
keyEvent->accept();
|
||||
bHandled = true;
|
||||
}
|
||||
else if ( keyEvent->key() == Qt::Key_Down )
|
||||
{
|
||||
srcStepping->applyNextQuantity();
|
||||
keyEvent->accept();
|
||||
bHandled = true;
|
||||
}
|
||||
|
||||
return bHandled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlotControls::quantityNextKeyText()
|
||||
{
|
||||
return QString( "Ctrl-Down" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlotControls::quantityPrevKeyText()
|
||||
{
|
||||
return QString( "Ctrl-Up" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlotControls::caseNextKeyText()
|
||||
{
|
||||
return QString( "Ctrl-PgDown" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlotControls::casePrevKeyText()
|
||||
{
|
||||
return QString( "Ctrl-PgUp" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlotControls::otherNextKeyText()
|
||||
{
|
||||
return QString( "Ctrl-Right" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlotControls::otherPrevKeyText()
|
||||
{
|
||||
return QString( "Ctrl-Left" );
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 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
|
||||
|
||||
class RimSummaryPlotSourceStepping;
|
||||
class QKeyEvent;
|
||||
|
||||
#include <QString>
|
||||
|
||||
class RimSummaryPlotControls
|
||||
{
|
||||
public:
|
||||
static bool handleKeyEvents( RimSummaryPlotSourceStepping* srcStepping, QKeyEvent* keyEvent );
|
||||
|
||||
static QString quantityNextKeyText();
|
||||
static QString quantityPrevKeyText();
|
||||
static QString caseNextKeyText();
|
||||
static QString casePrevKeyText();
|
||||
static QString otherNextKeyText();
|
||||
static QString otherPrevKeyText();
|
||||
|
||||
private:
|
||||
RimSummaryPlotControls() = default;
|
||||
};
|
||||
@@ -399,9 +399,7 @@ void RimSummaryPlotManager::createNewPlot()
|
||||
{
|
||||
{
|
||||
auto summaryPlots = plotBuilder.createPlots();
|
||||
auto plot = RimSummaryMultiPlot::createAndAppendMultiPlot( summaryPlots );
|
||||
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( plot );
|
||||
RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( summaryPlots );
|
||||
}
|
||||
|
||||
bool createStandardMultiPlot = false;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "RimSummaryDataSourceStepping.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotControls.h"
|
||||
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
@@ -976,25 +977,29 @@ void RimSummaryPlotSourceStepping::defineEditorAttribute( const caf::PdmFieldHan
|
||||
myAttr->nextIcon = QIcon( ":/ComboBoxDown.svg" );
|
||||
myAttr->previousIcon = QIcon( ":/ComboBoxUp.svg" );
|
||||
|
||||
QString modifierText;
|
||||
QString nextText;
|
||||
QString prevText;
|
||||
|
||||
if ( field == &m_summaryCase )
|
||||
{
|
||||
modifierText = ( "(Shift+" );
|
||||
nextText = RimSummaryPlotControls::caseNextKeyText();
|
||||
prevText = RimSummaryPlotControls::casePrevKeyText();
|
||||
}
|
||||
else if ( field == &m_wellName || field == &m_wellGroupName || field == &m_region )
|
||||
{
|
||||
modifierText = ( "(Ctrl+" );
|
||||
nextText = RimSummaryPlotControls::otherNextKeyText();
|
||||
prevText = RimSummaryPlotControls::otherPrevKeyText();
|
||||
}
|
||||
else if ( field == &m_quantity )
|
||||
{
|
||||
modifierText = ( "(" );
|
||||
nextText = RimSummaryPlotControls::quantityNextKeyText();
|
||||
prevText = RimSummaryPlotControls::quantityPrevKeyText();
|
||||
}
|
||||
|
||||
if ( !modifierText.isEmpty() )
|
||||
if ( !nextText.isEmpty() )
|
||||
{
|
||||
myAttr->nextButtonText = "Next " + modifierText + "PgDown)";
|
||||
myAttr->prevButtonText = "Previous " + modifierText + "PgUp)";
|
||||
myAttr->nextButtonText = "Next (" + nextText + ")";
|
||||
myAttr->prevButtonText = "Previous (" + prevText + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user