mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #8732 from OPM/summarymultiplot_updates2
Summary Multiplot updates
This commit is contained in:
@@ -126,6 +126,8 @@
|
||||
#include "RimSummaryCrossPlotCollection.h"
|
||||
#include "RimSummaryCurve.h"
|
||||
#include "RimSummaryCurveCollection.h"
|
||||
#include "RimSummaryMultiPlot.h"
|
||||
#include "RimSummaryMultiPlotCollection.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
#include "RimSummaryPlotCollection.h"
|
||||
#include "RimSurface.h"
|
||||
@@ -564,6 +566,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicShowSummaryCurveCalculatorFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimSummaryMultiPlotCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewSummaryMultiPlotFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimAnalysisPlotCollection*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewAnalysisPlotFeature";
|
||||
@@ -768,6 +774,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicImportEnsembleFeature";
|
||||
menuBuilder.subMenuEnd();
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicNewSummaryMultiPlotFeature";
|
||||
menuBuilder << "RicNewDerivedEnsembleFeature";
|
||||
menuBuilder << "RicOpenSummaryPlotEditorFeature";
|
||||
menuBuilder << "RicNewDefaultSummaryPlotFeature";
|
||||
@@ -785,6 +792,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicImportEnsembleFeature";
|
||||
menuBuilder.subMenuEnd();
|
||||
menuBuilder.addSeparator();
|
||||
menuBuilder << "RicNewSummaryMultiPlotFeature";
|
||||
menuBuilder << "RicOpenSummaryPlotEditorFeature";
|
||||
menuBuilder << "RicNewDefaultSummaryPlotFeature";
|
||||
menuBuilder << "RicNewSummaryCrossPlotFeature";
|
||||
@@ -1023,6 +1031,12 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
menuBuilder << "RicReloadPlotTemplatesFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimSummaryMultiPlot*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewDefaultSummaryPlotFeature";
|
||||
menuBuilder << "Separator";
|
||||
menuBuilder << "RicSnapshotViewToPdfFeature";
|
||||
}
|
||||
else if ( dynamic_cast<RimMultiPlot*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicSnapshotViewToPdfFeature";
|
||||
@@ -1062,10 +1076,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
menuBuilder << "RicShowTotalAllocationDataFeature";
|
||||
|
||||
menuBuilder << "RicNewSummaryMultiPlotFeature";
|
||||
menuBuilder << "RicNewDerivedEnsembleFeature";
|
||||
menuBuilder << "RicOpenSummaryPlotEditorFeature";
|
||||
menuBuilder << "RicNewDefaultSummaryPlotFeature";
|
||||
menuBuilder << "RicNewSummaryMultiPlotFeature";
|
||||
menuBuilder << "RicNewSummaryCrossPlotFeature";
|
||||
menuBuilder << "RicSummaryCurveSwitchAxisFeature";
|
||||
menuBuilder << "RicNewDerivedSummaryFeature";
|
||||
@@ -1188,7 +1202,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
||||
}
|
||||
else if ( dynamic_cast<RimSummaryAddress*>( firstUiItem ) )
|
||||
{
|
||||
menuBuilder << "RicNewSummaryPlotFromDataVectorFeature";
|
||||
menuBuilder << "RicNewSummaryMultiPlotFromDataVectorFeature";
|
||||
}
|
||||
#ifdef USE_ODB_API
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "RimMultiPlot.h"
|
||||
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaPreferencesSummary.h"
|
||||
|
||||
#include "RimPlot.h"
|
||||
#include "RimProject.h"
|
||||
@@ -37,29 +38,6 @@
|
||||
|
||||
#include <cvfAssert.h>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void RimMultiPlot::ColumnCountEnum::setUp()
|
||||
{
|
||||
addItem( RimMultiPlot::ColumnCount::COLUMNS_1, "1", "1 Column" );
|
||||
addItem( RimMultiPlot::ColumnCount::COLUMNS_2, "2", "2 Columns" );
|
||||
addItem( RimMultiPlot::ColumnCount::COLUMNS_3, "3", "3 Columns" );
|
||||
addItem( RimMultiPlot::ColumnCount::COLUMNS_4, "4", "4 Columns" );
|
||||
setDefault( RimMultiPlot::ColumnCount::COLUMNS_2 );
|
||||
}
|
||||
template <>
|
||||
void RimMultiPlot::RowCountEnum::setUp()
|
||||
{
|
||||
addItem( RimMultiPlot::RowCount::ROWS_1, "1", "1 Row" );
|
||||
addItem( RimMultiPlot::RowCount::ROWS_2, "2", "2 Rows" );
|
||||
addItem( RimMultiPlot::RowCount::ROWS_3, "3", "3 Rows" );
|
||||
addItem( RimMultiPlot::RowCount::ROWS_4, "4", "4 Rows" );
|
||||
setDefault( RimMultiPlot::RowCount::ROWS_2 );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimMultiPlot, "MultiPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -77,8 +55,11 @@ RimMultiPlot::RimMultiPlot()
|
||||
auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots );
|
||||
reorderability->orderChanged.connect( this, &RimMultiPlot::onPlotsReordered );
|
||||
|
||||
RiaPreferencesSummary* sumPrefs = RiaPreferencesSummary::current();
|
||||
CAF_PDM_InitFieldNoDefault( &m_columnCount, "NumberOfColumns", "Number of Columns" );
|
||||
m_columnCount = sumPrefs->defaultMultiPlotColumnCount();
|
||||
CAF_PDM_InitFieldNoDefault( &m_rowsPerPage, "RowsPerPage", "Rows per Page" );
|
||||
m_rowsPerPage = sumPrefs->defaultMultiPlotRowCount();
|
||||
|
||||
CAF_PDM_InitField( &m_showIndividualPlotTitles, "ShowPlotTitles", true, "Show Sub Plot Titles" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_majorTickmarkCount, "MajorTickmarkCount", "Major Tickmark Count" );
|
||||
@@ -401,7 +382,7 @@ void RimMultiPlot::setAutoScaleYEnabled( bool enabled )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlot::setColumnCount( RiuMultiPlotPage::ColumnCount columnCount )
|
||||
void RimMultiPlot::setColumnCount( RiaDefines::ColumnCount columnCount )
|
||||
{
|
||||
m_columnCount = columnCount;
|
||||
}
|
||||
@@ -409,7 +390,7 @@ void RimMultiPlot::setColumnCount( RiuMultiPlotPage::ColumnCount columnCount )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlot::setRowCount( RowCount rowCount )
|
||||
void RimMultiPlot::setRowCount( RiaDefines::RowCount rowCount )
|
||||
{
|
||||
m_rowsPerPage = rowCount;
|
||||
}
|
||||
@@ -440,7 +421,7 @@ void RimMultiPlot::setTickmarkCount( RimPlot* plot, RimPlotAxisPropertiesInterfa
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimMultiPlot::columnCount() const
|
||||
{
|
||||
if ( m_columnCount() == ColumnCount::COLUMNS_UNLIMITED )
|
||||
if ( m_columnCount() == RiaDefines::ColumnCount::COLUMNS_UNLIMITED )
|
||||
{
|
||||
return std::numeric_limits<int>::max();
|
||||
}
|
||||
@@ -452,22 +433,22 @@ int RimMultiPlot::columnCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimMultiPlot::rowsPerPage() const
|
||||
{
|
||||
RimMultiPlot::RowCount rowEnum = m_rowsPerPage().value();
|
||||
RiaDefines::RowCount rowEnum = m_rowsPerPage().value();
|
||||
|
||||
int rowCount = 2;
|
||||
|
||||
switch ( rowEnum )
|
||||
{
|
||||
case RimMultiPlot::RowCount::ROWS_1:
|
||||
case RiaDefines::RowCount::ROWS_1:
|
||||
rowCount = 1;
|
||||
break;
|
||||
case RimMultiPlot::RowCount::ROWS_2:
|
||||
case RiaDefines::RowCount::ROWS_2:
|
||||
rowCount = 2;
|
||||
break;
|
||||
case RimMultiPlot::RowCount::ROWS_3:
|
||||
case RiaDefines::RowCount::ROWS_3:
|
||||
rowCount = 3;
|
||||
break;
|
||||
case RimMultiPlot::RowCount::ROWS_4:
|
||||
case RiaDefines::RowCount::ROWS_4:
|
||||
rowCount = 4;
|
||||
break;
|
||||
default:
|
||||
@@ -754,8 +735,8 @@ QList<caf::PdmOptionItemInfo> RimMultiPlot::calculateValueOptions( const caf::Pd
|
||||
{
|
||||
for ( size_t i = 0; i < ColumnCountEnum::size(); ++i )
|
||||
{
|
||||
ColumnCount enumVal = ColumnCountEnum::fromIndex( i );
|
||||
QString columnCountString = ( enumVal == ColumnCount::COLUMNS_UNLIMITED )
|
||||
RiaDefines::ColumnCount enumVal = ColumnCountEnum::fromIndex( i );
|
||||
QString columnCountString = ( enumVal == RiaDefines::ColumnCount::COLUMNS_UNLIMITED )
|
||||
? "Unlimited"
|
||||
: QString( "%1" ).arg( static_cast<int>( enumVal ) );
|
||||
QString iconPath = QString( ":/Columns%1.png" ).arg( columnCountString );
|
||||
@@ -769,8 +750,8 @@ QList<caf::PdmOptionItemInfo> RimMultiPlot::calculateValueOptions( const caf::Pd
|
||||
{
|
||||
for ( size_t i = 0; i < RowCountEnum::size(); ++i )
|
||||
{
|
||||
RowCount enumVal = RowCountEnum::fromIndex( i );
|
||||
QString iconPath = QString( ":/Rows%1.png" ).arg( static_cast<int>( enumVal ) );
|
||||
RiaDefines::RowCount enumVal = RowCountEnum::fromIndex( i );
|
||||
QString iconPath = QString( ":/Rows%1.png" ).arg( static_cast<int>( enumVal ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( RowCountEnum::uiText( enumVal ),
|
||||
enumVal,
|
||||
false,
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "RimAbstractPlotCollection.h"
|
||||
#include "RimPlot.h"
|
||||
#include "RimPlotAxisPropertiesInterface.h"
|
||||
@@ -44,19 +46,8 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection<RimPlot
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
using ColumnCount = RiuMultiPlotBook::ColumnCount;
|
||||
using ColumnCountEnum = caf::AppEnum<ColumnCount>;
|
||||
|
||||
enum class RowCount
|
||||
{
|
||||
ROWS_1 = 1,
|
||||
ROWS_2 = 2,
|
||||
ROWS_3 = 3,
|
||||
ROWS_4 = 4,
|
||||
};
|
||||
using RowCountEnum = caf::AppEnum<RowCount>;
|
||||
|
||||
friend class RimSummaryMultiPlot;
|
||||
using ColumnCountEnum = caf::AppEnum<RiaDefines::ColumnCount>;
|
||||
using RowCountEnum = caf::AppEnum<RiaDefines::RowCount>;
|
||||
|
||||
public:
|
||||
RimMultiPlot();
|
||||
@@ -90,8 +81,8 @@ public:
|
||||
void setAutoScaleXEnabled( bool enabled );
|
||||
void setAutoScaleYEnabled( bool enabled );
|
||||
|
||||
void setColumnCount( RiuMultiPlotPage::ColumnCount columnCount );
|
||||
void setRowCount( RimMultiPlot::RowCount rowCount );
|
||||
void setColumnCount( RiaDefines::ColumnCount columnCount );
|
||||
void setRowCount( RiaDefines::RowCount rowCount );
|
||||
void setTickmarkCount( RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount );
|
||||
|
||||
int columnCount() const override;
|
||||
|
||||
@@ -211,7 +211,7 @@ void RimPlotWindow::updateParentLayout()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimPlotWindow::columnCount() const
|
||||
{
|
||||
return static_cast<int>( RiuMultiPlotPage::ColumnCount::COLUMNS_UNLIMITED );
|
||||
return static_cast<int>( RiaDefines::ColumnCount::COLUMNS_UNLIMITED );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -327,6 +327,7 @@ void RimSummaryMultiPlot::updatePlotWindowTitle()
|
||||
populateNameHelper( m_nameHelper.get() );
|
||||
|
||||
auto title = m_nameHelper->plotTitle();
|
||||
if ( title.isEmpty() ) title = "Empty Plot";
|
||||
setMultiPlotTitle( title );
|
||||
}
|
||||
|
||||
@@ -386,62 +387,6 @@ std::vector<RimSummaryPlot*> RimSummaryMultiPlot::summaryPlots() const
|
||||
return typedPlots;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const std::vector<RimSummaryPlot*>& graphs )
|
||||
{
|
||||
auto columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_2;
|
||||
auto rowCount = RimMultiPlot::RowCount::ROWS_2;
|
||||
auto tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT;
|
||||
|
||||
bool showTitleSubGraph = true;
|
||||
if ( graphs.size() == 1 )
|
||||
{
|
||||
showTitleSubGraph = false;
|
||||
tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_MANY;
|
||||
}
|
||||
else if ( 4 < graphs.size() && graphs.size() <= 6 )
|
||||
{
|
||||
columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_3;
|
||||
rowCount = RimMultiPlot::RowCount::ROWS_2;
|
||||
tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW;
|
||||
}
|
||||
else if ( 6 < graphs.size() && graphs.size() <= 12 )
|
||||
{
|
||||
columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_4;
|
||||
rowCount = RimMultiPlot::RowCount::ROWS_3;
|
||||
tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW;
|
||||
}
|
||||
else
|
||||
{
|
||||
columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_4;
|
||||
rowCount = RimMultiPlot::RowCount::ROWS_4;
|
||||
tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW;
|
||||
}
|
||||
|
||||
plot->setAutoTitlePlot( true );
|
||||
plot->setAutoTitleGraphs( showTitleSubGraph );
|
||||
|
||||
plot->setColumnCount( columnCount );
|
||||
plot->setRowCount( rowCount );
|
||||
plot->setShowPlotTitles( showTitleSubGraph );
|
||||
plot->setTickmarkCount( tickmarkCount );
|
||||
|
||||
for ( auto graph : graphs )
|
||||
{
|
||||
plot->addPlot( graph );
|
||||
|
||||
graph->resolveReferencesRecursively();
|
||||
graph->revokeMdiWindowStatus();
|
||||
graph->setShowWindow( true );
|
||||
|
||||
graph->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -570,6 +515,18 @@ void RimSummaryMultiPlot::syncAxisRanges()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const
|
||||
{
|
||||
for ( RimSummaryPlot* plot : summaryPlots() )
|
||||
{
|
||||
QString displayName = plot->description();
|
||||
optionInfos->push_back( caf::PdmOptionItemInfo( displayName, plot, false, plot->uiCapability()->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
#include "cafPdmUiItem.h"
|
||||
#include "cafSignal.h"
|
||||
|
||||
#include <QList>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimSummaryPlot;
|
||||
@@ -68,6 +71,8 @@ public:
|
||||
|
||||
void addPlot( const std::vector<caf::PdmObjectHandle*>& objects );
|
||||
|
||||
void summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const;
|
||||
|
||||
protected:
|
||||
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
|
||||
bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override;
|
||||
@@ -85,8 +90,6 @@ private:
|
||||
|
||||
std::vector<RimSummaryPlot*> summaryPlots() const;
|
||||
|
||||
static void insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const std::vector<RimSummaryPlot*>& graphs );
|
||||
|
||||
void updatePlotWindowTitle() override;
|
||||
|
||||
void duplicate();
|
||||
|
||||
Reference in New Issue
Block a user