mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Show Plot Data missing for some plots
* Add plotContentAsText() to bar chart builder * Add show plot data to analysis plot * Refactor analysis plot * Enable context menu in Analysis Plot * Add show plot data for general RimPlots * Show plot data for correlation report in three separate text dialogs
This commit is contained in:
parent
51fe80b897
commit
cdda7480f3
@ -23,8 +23,13 @@
|
||||
#include "RiaPreferencesSummary.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
|
||||
#include "RimAnalysisPlot.h"
|
||||
#include "RimCorrelationMatrixPlot.h"
|
||||
#include "RimCorrelationPlot.h"
|
||||
#include "RimCorrelationReportPlot.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCurve.h"
|
||||
#include "RimParameterResultCrossPlot.h"
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
@ -72,10 +77,8 @@ public:
|
||||
{
|
||||
return "No Resampling";
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString( "%1" ).arg( RiaQDateTimeTools::dateTimePeriodName( timePeriod ) );
|
||||
}
|
||||
|
||||
return QString( "%1" ).arg( RiaQDateTimeTools::dateTimePeriodName( timePeriod ) );
|
||||
}
|
||||
|
||||
QString tabText( int tabIndex ) const override
|
||||
@ -90,10 +93,8 @@ public:
|
||||
|
||||
return m_summaryPlot->asciiDataForSummaryPlotExport( timePeriod, prefs->showSummaryTimeAsLongString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_summaryPlot->asciiDataForSummaryPlotExport( RiaDefines::DateTimePeriod::NONE, true );
|
||||
}
|
||||
|
||||
return m_summaryPlot->asciiDataForSummaryPlotExport( RiaDefines::DateTimePeriod::NONE, true );
|
||||
}
|
||||
|
||||
int tabCount() const override { return (int)tabs().size(); }
|
||||
@ -192,7 +193,9 @@ bool RicShowPlotDataFeature::isCommandEnabled() const
|
||||
{
|
||||
if ( dynamic_cast<RimSummaryPlot*>( plot ) || dynamic_cast<RimWellLogPlot*>( plot ) || dynamic_cast<RimWellLogTrack*>( plot ) ||
|
||||
dynamic_cast<RimGridCrossPlot*>( plot ) || dynamic_cast<RimVfpPlot*>( plot ) ||
|
||||
dynamic_cast<RimWellAllocationOverTimePlot*>( plot ) )
|
||||
dynamic_cast<RimWellAllocationOverTimePlot*>( plot ) || dynamic_cast<RimAnalysisPlot*>( plot ) ||
|
||||
dynamic_cast<RimCorrelationMatrixPlot*>( plot ) || dynamic_cast<RimAbstractCorrelationPlot*>( plot ) ||
|
||||
dynamic_cast<RimCorrelationReportPlot*>( plot ) )
|
||||
{
|
||||
validPlots++;
|
||||
}
|
||||
@ -224,24 +227,20 @@ void RicShowPlotDataFeature::onActionTriggered( bool isChecked )
|
||||
std::vector<RimPlotWindow*> selection;
|
||||
getSelection( selection );
|
||||
|
||||
std::vector<RimSummaryPlot*> selectedSummaryPlots;
|
||||
std::vector<RimWellLogPlot*> wellLogPlots;
|
||||
std::vector<RimGridCrossPlot*> crossPlots;
|
||||
std::vector<RimVfpPlot*> vfpPlots;
|
||||
std::vector<RimWellLogTrack*> depthTracks;
|
||||
std::vector<RimWellAllocationOverTimePlot*> wellAllocationOverTimePlots;
|
||||
// Using RiuTabbedSummaryPlotTextProvider
|
||||
std::vector<RimSummaryPlot*> summaryPlots;
|
||||
|
||||
// Using RiuTabbedGridCrossPlotTextProvider
|
||||
std::vector<RimGridCrossPlot*> crossPlots;
|
||||
|
||||
// Show content using RimPlot::description() and RimPlot::asciiDataForPlotExport()
|
||||
std::vector<RimPlot*> rimPlots;
|
||||
|
||||
for ( auto plot : selection )
|
||||
{
|
||||
if ( auto sumPlot = dynamic_cast<RimSummaryPlot*>( plot ) )
|
||||
{
|
||||
selectedSummaryPlots.push_back( sumPlot );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( auto wellPlot = dynamic_cast<RimWellLogPlot*>( plot ) )
|
||||
{
|
||||
wellLogPlots.push_back( wellPlot );
|
||||
summaryPlots.push_back( sumPlot );
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -251,62 +250,42 @@ void RicShowPlotDataFeature::onActionTriggered( bool isChecked )
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( auto vfpPlot = dynamic_cast<RimVfpPlot*>( plot ) )
|
||||
if ( auto correlationReportPlot = dynamic_cast<RimCorrelationReportPlot*>( plot ) )
|
||||
{
|
||||
vfpPlots.push_back( vfpPlot );
|
||||
// A correlation report plot contains three plots. Add them as individual plots to rimPlots to make the data available in three
|
||||
// individual text dialogs.
|
||||
|
||||
rimPlots.push_back( correlationReportPlot->matrixPlot() );
|
||||
rimPlots.push_back( correlationReportPlot->correlationPlot() );
|
||||
rimPlots.push_back( correlationReportPlot->crossPlot() );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( auto depthTrack = dynamic_cast<RimWellLogTrack*>( plot ) )
|
||||
if ( auto rimPlot = dynamic_cast<RimPlot*>( plot ) )
|
||||
{
|
||||
depthTracks.push_back( depthTrack );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( auto wellAllocationOverTimePlot = dynamic_cast<RimWellAllocationOverTimePlot*>( plot ) )
|
||||
{
|
||||
wellAllocationOverTimePlots.push_back( wellAllocationOverTimePlot );
|
||||
continue;
|
||||
rimPlots.push_back( rimPlot );
|
||||
}
|
||||
}
|
||||
|
||||
for ( RimSummaryPlot* summaryPlot : selectedSummaryPlots )
|
||||
for ( RimSummaryPlot* summaryPlot : summaryPlots )
|
||||
{
|
||||
auto textProvider = new RiuTabbedSummaryPlotTextProvider( summaryPlot );
|
||||
RicShowPlotDataFeature::showTabbedTextWindow( textProvider );
|
||||
}
|
||||
|
||||
for ( RimWellLogPlot* wellLogPlot : wellLogPlots )
|
||||
{
|
||||
QString title = wellLogPlot->description();
|
||||
QString text = wellLogPlot->asciiDataForPlotExport();
|
||||
RicShowPlotDataFeature::showTextWindow( title, text );
|
||||
}
|
||||
|
||||
for ( auto* plot : depthTracks )
|
||||
{
|
||||
QString title = plot->description();
|
||||
QString text = plot->asciiDataForPlotExport();
|
||||
RicShowPlotDataFeature::showTextWindow( title, text );
|
||||
}
|
||||
|
||||
for ( RimVfpPlot* vfpPlot : vfpPlots )
|
||||
{
|
||||
QString title = vfpPlot->description();
|
||||
QString text = vfpPlot->asciiDataForPlotExport();
|
||||
RicShowPlotDataFeature::showTextWindow( title, text );
|
||||
}
|
||||
|
||||
for ( RimGridCrossPlot* crossPlot : crossPlots )
|
||||
{
|
||||
auto textProvider = new RiuTabbedGridCrossPlotTextProvider( crossPlot );
|
||||
RicShowPlotDataFeature::showTabbedTextWindow( textProvider );
|
||||
}
|
||||
|
||||
for ( RimWellAllocationOverTimePlot* wellAllocationOverTimePlot : wellAllocationOverTimePlots )
|
||||
for ( auto rimPlot : rimPlots )
|
||||
{
|
||||
QString title = wellAllocationOverTimePlot->description();
|
||||
QString text = wellAllocationOverTimePlot->asciiDataForPlotExport();
|
||||
QString title = rimPlot->description();
|
||||
QString text = title;
|
||||
text += "\n";
|
||||
text += "\n";
|
||||
text += rimPlot->asciiDataForPlotExport();
|
||||
|
||||
RicShowPlotDataFeature::showTextWindow( title, text );
|
||||
}
|
||||
}
|
||||
@ -328,7 +307,7 @@ void RicShowPlotDataFeature::showTabbedTextWindow( RiuTabbedTextProvider* textPr
|
||||
RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
CVF_ASSERT( plotwindow );
|
||||
|
||||
RiuTabbedTextDialog* textWidget = new RiuTabbedTextDialog( textProvider );
|
||||
auto* textWidget = new RiuTabbedTextDialog( textProvider );
|
||||
textWidget->setMinimumSize( 800, 600 );
|
||||
plotwindow->addToTemporaryWidgets( textWidget );
|
||||
textWidget->show();
|
||||
@ -343,7 +322,7 @@ void RicShowPlotDataFeature::showTextWindow( const QString& title, const QString
|
||||
RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
CVF_ASSERT( plotwindow );
|
||||
|
||||
RiuTextDialog* textWiget = new RiuTextDialog();
|
||||
auto* textWiget = new RiuTextDialog();
|
||||
textWiget->setMinimumSize( 400, 600 );
|
||||
|
||||
textWiget->setWindowTitle( title );
|
||||
@ -364,7 +343,7 @@ void RicShowPlotDataFeature::getSelection( std::vector<RimPlotWindow*>& selectio
|
||||
QVariant userData = this->userData();
|
||||
if ( !userData.isNull() && userData.canConvert<void*>() )
|
||||
{
|
||||
RimPlot* plot = static_cast<RimPlot*>( userData.value<void*>() );
|
||||
auto* plot = static_cast<RimPlot*>( userData.value<void*>() );
|
||||
if ( plot ) selection.push_back( plot );
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,18 @@
|
||||
RifCsvDataTableFormatter::RifCsvDataTableFormatter( QTextStream& out, const QString fieldSeparator )
|
||||
: m_out( out )
|
||||
, m_fieldSeparator( fieldSeparator )
|
||||
, m_useQuotes( true )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifCsvDataTableFormatter::setUseQuotes( bool useQuotes )
|
||||
{
|
||||
m_useQuotes = useQuotes;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -43,8 +52,15 @@ RifCsvDataTableFormatter& RifCsvDataTableFormatter::header( const std::vector<Ri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RifCsvDataTableFormatter& RifCsvDataTableFormatter::add( const QString& str )
|
||||
{
|
||||
QString quotedString = "\"" + str + "\"";
|
||||
m_lineBuffer.push_back( quotedString );
|
||||
if ( m_useQuotes )
|
||||
{
|
||||
QString quotedString = "\"" + str + "\"";
|
||||
m_lineBuffer.push_back( quotedString );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lineBuffer.push_back( str );
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,8 @@ class RifCsvDataTableFormatter
|
||||
public:
|
||||
RifCsvDataTableFormatter( QTextStream& out, const QString fieldSeparator = "," );
|
||||
|
||||
void setUseQuotes( bool useQuotes );
|
||||
|
||||
RifCsvDataTableFormatter& header( const std::vector<RifTextDataTableColumn>& tableHeader );
|
||||
RifCsvDataTableFormatter& add( const QString& str );
|
||||
RifCsvDataTableFormatter& add( double num );
|
||||
@ -47,4 +49,5 @@ private:
|
||||
std::vector<RifTextDataTableLine> m_buffer;
|
||||
std::vector<QString> m_lineBuffer;
|
||||
QString m_fieldSeparator;
|
||||
bool m_useQuotes;
|
||||
};
|
||||
|
@ -25,12 +25,6 @@
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
#include "RiaTextStringTools.h"
|
||||
|
||||
#include "RiuGroupedBarChartBuilder.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuSummaryVectorSelectionDialog.h"
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RimAnalysisPlotDataEntry.h"
|
||||
@ -43,12 +37,20 @@
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
#include "RimSummaryPlotAxisFormatter.h"
|
||||
|
||||
#include "RiuContextMenuLauncher.h"
|
||||
#include "RiuGroupedBarChartBuilder.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotTools.h"
|
||||
#include "RiuSummaryQwtPlot.h"
|
||||
#include "RiuSummaryVectorSelectionDialog.h"
|
||||
|
||||
#include "qwt_column_symbol.h"
|
||||
#include "qwt_legend.h"
|
||||
#include "qwt_painter.h"
|
||||
#include "qwt_plot_barchart.h"
|
||||
#include "qwt_scale_draw.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiActionPushButtonEditor.h"
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
@ -64,25 +66,25 @@ namespace caf
|
||||
template <>
|
||||
void caf::AppEnum<RimAnalysisPlot::SortGroupType>::setUp()
|
||||
{
|
||||
addItem( RimAnalysisPlot::NONE, "NONE", "None" );
|
||||
addItem( RimAnalysisPlot::SUMMARY_ITEM, "SUMMARY_ITEM", "Summary Item" );
|
||||
addItem( RimAnalysisPlot::VECTOR, "VECTOR", "Vector" );
|
||||
addItem( RimAnalysisPlot::CASE, "CASE", "Case" );
|
||||
addItem( RimAnalysisPlot::ENSEMBLE, "ENSEMBLE", "Ensemble" );
|
||||
addItem( RimAnalysisPlot::VALUE, "VALUE", "Value" );
|
||||
addItem( RimAnalysisPlot::ABS_VALUE, "ABS_VALUE", "abs(Value)" );
|
||||
addItem( RimAnalysisPlot::OTHER_VALUE, "OTHER_VALUE", "Other Value" );
|
||||
addItem( RimAnalysisPlot::ABS_OTHER_VALUE, "ABS_OTHER_VALUE", "abs(Other Value)" );
|
||||
addItem( RimAnalysisPlot::TIME_STEP, "TIME_STEP", "Time Step" );
|
||||
setDefault( RimAnalysisPlot::NONE );
|
||||
addItem( RimAnalysisPlot::SortGroupType::NONE, "NONE", "None" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::SUMMARY_ITEM, "SUMMARY_ITEM", "Summary Item" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::VECTOR, "VECTOR", "Vector" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::CASE, "CASE", "Case" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::ENSEMBLE, "ENSEMBLE", "Ensemble" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::VALUE, "VALUE", "Value" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::ABS_VALUE, "ABS_VALUE", "abs(Value)" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::OTHER_VALUE, "OTHER_VALUE", "Other Value" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::ABS_OTHER_VALUE, "ABS_OTHER_VALUE", "abs(Other Value)" );
|
||||
addItem( RimAnalysisPlot::SortGroupType::TIME_STEP, "TIME_STEP", "Time Step" );
|
||||
setDefault( RimAnalysisPlot::SortGroupType::NONE );
|
||||
}
|
||||
|
||||
template <>
|
||||
void caf::AppEnum<RimAnalysisPlot::BarOrientation>::setUp()
|
||||
{
|
||||
addItem( RimAnalysisPlot::BARS_HORIZONTAL, "BARS_HORIZONTAL", "Horizontal" );
|
||||
addItem( RimAnalysisPlot::BARS_VERTICAL, "BARS_VERTICAL", "Vertical" );
|
||||
setDefault( RimAnalysisPlot::BARS_VERTICAL );
|
||||
addItem( RimAnalysisPlot::BarOrientation::BARS_HORIZONTAL, "BARS_HORIZONTAL", "Horizontal" );
|
||||
addItem( RimAnalysisPlot::BarOrientation::BARS_VERTICAL, "BARS_VERTICAL", "Vertical" );
|
||||
setDefault( RimAnalysisPlot::BarOrientation::BARS_VERTICAL );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
@ -92,7 +94,6 @@ CAF_PDM_SOURCE_INIT( RimAnalysisPlot, "AnalysisPlot" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimAnalysisPlot::RimAnalysisPlot()
|
||||
: RimPlot()
|
||||
{
|
||||
CAF_PDM_InitObject( "Analysis Plot", ":/AnalysisPlot16x16.png" );
|
||||
|
||||
@ -137,7 +138,7 @@ RimAnalysisPlot::RimAnalysisPlot()
|
||||
CAF_PDM_InitFieldNoDefault( &m_valueSortOperation, "ValueSortOperation", "Sort by Value" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_sortGroupForColors, "groupForColors", "Coloring Using" );
|
||||
m_sortGroupForColors = RimAnalysisPlot::CASE;
|
||||
m_sortGroupForColors = RimAnalysisPlot::SortGroupType::CASE;
|
||||
m_showPlotLegends = false;
|
||||
|
||||
CAF_PDM_InitField( &m_useTopBarsFilter, "UseTopBarsFilter", false, "Show Only Top" );
|
||||
@ -172,6 +173,8 @@ RimAnalysisPlot::RimAnalysisPlot()
|
||||
connectAxisSignals( m_valueAxisProperties() );
|
||||
m_plotDataFilterCollection->filtersChanged.connect( this, &RimAnalysisPlot::onFiltersChanged );
|
||||
setDeletable( true );
|
||||
|
||||
m_analyserOfSelectedCurveDefs = std::make_unique<RiaSummaryCurveDefinitionAnalyser>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -205,7 +208,7 @@ RimPlotDataFilterCollection* RimAnalysisPlot::plotDataFilterCollection() const
|
||||
void RimAnalysisPlot::setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
|
||||
{
|
||||
m_analysisPlotDataSelection.deleteChildren();
|
||||
for ( auto curveDef : curveDefinitions )
|
||||
for ( const auto& curveDef : curveDefinitions )
|
||||
{
|
||||
auto dataEntry = new RimAnalysisPlotDataEntry();
|
||||
dataEntry->setFromCurveDefinition( curveDef );
|
||||
@ -235,11 +238,11 @@ void RimAnalysisPlot::setTimeSteps( const std::vector<time_t>& timeSteps )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseSummaryAddress> RimAnalysisPlot::unfilteredAddresses()
|
||||
std::set<RifEclipseSummaryAddress> RimAnalysisPlot::unfilteredAddresses() const
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> addresses;
|
||||
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = updateAndGetCurveAnalyzer();
|
||||
|
||||
for ( RimSummaryCase* sumCase : analyserOfSelectedCurveDefs->m_singleSummaryCases )
|
||||
{
|
||||
@ -253,11 +256,11 @@ std::set<RifEclipseSummaryAddress> RimAnalysisPlot::unfilteredAddresses()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RigEnsembleParameter> RimAnalysisPlot::ensembleParameters()
|
||||
std::set<RigEnsembleParameter> RimAnalysisPlot::ensembleParameters() const
|
||||
{
|
||||
std::set<RigEnsembleParameter> ensembleParms;
|
||||
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = updateAndGetCurveAnalyzer();
|
||||
|
||||
std::set<RimSummaryCaseCollection*> ensembles;
|
||||
|
||||
@ -281,7 +284,7 @@ std::set<RigEnsembleParameter> RimAnalysisPlot::ensembleParameters()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigEnsembleParameter RimAnalysisPlot::ensembleParameter( const QString& ensembleParameterName )
|
||||
RigEnsembleParameter RimAnalysisPlot::ensembleParameter( const QString& ensembleParameterName ) const
|
||||
{
|
||||
std::set<RigEnsembleParameter> ensembleParms = ensembleParameters();
|
||||
for ( const RigEnsembleParameter& eParam : ensembleParms )
|
||||
@ -289,7 +292,7 @@ RigEnsembleParameter RimAnalysisPlot::ensembleParameter( const QString& ensemble
|
||||
if ( eParam.name == ensembleParameterName ) return eParam;
|
||||
}
|
||||
|
||||
return RigEnsembleParameter();
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -300,7 +303,7 @@ void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress&
|
||||
const std::vector<QDateTime>& timeRangeOrSelection,
|
||||
bool useAbsValue,
|
||||
double* minVal,
|
||||
double* maxVal )
|
||||
double* maxVal ) const
|
||||
{
|
||||
double min = std::numeric_limits<double>::infinity();
|
||||
double max = useAbsValue ? 0.0 : -std::numeric_limits<double>::infinity();
|
||||
@ -425,7 +428,7 @@ void RimAnalysisPlot::onFiltersChanged( const caf::SignalEmitter* emitter )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<time_t> RimAnalysisPlot::selectedTimeSteps()
|
||||
std::vector<time_t> RimAnalysisPlot::selectedTimeSteps() const
|
||||
{
|
||||
std::vector<time_t> selectedTimeTTimeSteps;
|
||||
for ( const QDateTime& dateTime : m_selectedTimeSteps.v() )
|
||||
@ -490,9 +493,9 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering
|
||||
selVectorsGrp->add( &m_referenceCase, { true, 3, 2 } );
|
||||
|
||||
QString vectorNames;
|
||||
if ( getOrCreateSelectedCurveDefAnalyser() )
|
||||
if ( updateAndGetCurveAnalyzer() )
|
||||
{
|
||||
for ( const std::string& vectorName : getOrCreateSelectedCurveDefAnalyser()->m_vectorNames )
|
||||
for ( const std::string& vectorName : updateAndGetCurveAnalyzer()->m_vectorNames )
|
||||
{
|
||||
vectorNames += QString::fromStdString( vectorName ) + ", ";
|
||||
}
|
||||
@ -632,16 +635,16 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_valueSortOperation )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( NONE ), NONE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( VALUE ), VALUE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( ABS_VALUE ), ABS_VALUE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::NONE ), SortGroupType::NONE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::VALUE ), SortGroupType::VALUE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::ABS_VALUE ), SortGroupType::ABS_VALUE ) );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_majorGroupType || fieldNeedingOptions == &m_mediumGroupType ||
|
||||
fieldNeedingOptions == &m_minorGroupType || fieldNeedingOptions == &m_sortGroupForColors )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( NONE ), NONE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::NONE ), SortGroupType::NONE ) );
|
||||
QStringList currentSummaryItems;
|
||||
for ( auto summaryAddr : getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses )
|
||||
for ( const auto& summaryAddr : updateAndGetCurveAnalyzer()->m_summaryAdresses )
|
||||
{
|
||||
currentSummaryItems.push_back( QString::fromStdString( summaryAddr.itemUiText() ) );
|
||||
}
|
||||
@ -654,13 +657,13 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
exampleString = exampleString.left( 13 ) + "...";
|
||||
}
|
||||
|
||||
QString summaryItemText = QString( "%1 (%2)" ).arg( SortGroupAppEnum::uiText( SUMMARY_ITEM ) ).arg( exampleString );
|
||||
options.push_back( caf::PdmOptionItemInfo( summaryItemText, SUMMARY_ITEM ) );
|
||||
QString summaryItemText = QString( "%1 (%2)" ).arg( SortGroupAppEnum::uiText( SortGroupType::SUMMARY_ITEM ) ).arg( exampleString );
|
||||
options.push_back( caf::PdmOptionItemInfo( summaryItemText, SortGroupType::SUMMARY_ITEM ) );
|
||||
}
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( VECTOR ), VECTOR ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( CASE ), CASE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( ENSEMBLE ), ENSEMBLE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( TIME_STEP ), TIME_STEP ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::VECTOR ), SortGroupType::VECTOR ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::CASE ), SortGroupType::CASE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::ENSEMBLE ), SortGroupType::ENSEMBLE ) );
|
||||
options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( SortGroupType::TIME_STEP ), SortGroupType::TIME_STEP ) );
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_referenceCase )
|
||||
{
|
||||
@ -691,7 +694,7 @@ QList<caf::PdmOptionItemInfo> RimAnalysisPlot::calculateValueOptions( const caf:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<time_t> RimAnalysisPlot::allAvailableTimeSteps()
|
||||
std::set<time_t> RimAnalysisPlot::allAvailableTimeSteps() const
|
||||
{
|
||||
std::set<time_t> timeStepUnion;
|
||||
|
||||
@ -713,9 +716,9 @@ std::set<time_t> RimAnalysisPlot::allAvailableTimeSteps()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCase*> RimAnalysisPlot::timestepDefiningSourceCases()
|
||||
std::set<RimSummaryCase*> RimAnalysisPlot::timestepDefiningSourceCases() const
|
||||
{
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = updateAndGetCurveAnalyzer();
|
||||
std::set<RimSummaryCase*> timeStepDefiningSumCases = analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
||||
for ( auto ensemble : analyserOfSelectedCurveDefs->m_ensembles )
|
||||
{
|
||||
@ -729,9 +732,9 @@ std::set<RimSummaryCase*> RimAnalysisPlot::timestepDefiningSourceCases()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCase*> RimAnalysisPlot::allSourceCases()
|
||||
std::set<RimSummaryCase*> RimAnalysisPlot::allSourceCases() const
|
||||
{
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = updateAndGetCurveAnalyzer();
|
||||
std::set<RimSummaryCase*> allSumCases = analyserOfSelectedCurveDefs->m_singleSummaryCases;
|
||||
|
||||
return allSumCases;
|
||||
@ -760,7 +763,7 @@ void RimAnalysisPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updateMdiWindowVisibility();
|
||||
|
||||
getOrCreateSelectedCurveDefAnalyser();
|
||||
updateAndGetCurveAnalyzer();
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
@ -773,12 +776,12 @@ void RimAnalysisPlot::onLoadDataAndUpdate()
|
||||
addDataToChartBuilder( chartBuilder );
|
||||
|
||||
chartBuilder.addBarChartToPlot( m_plotWidget->qwtPlot(),
|
||||
m_barOrientation == BARS_HORIZONTAL ? Qt::Horizontal : Qt::Vertical,
|
||||
m_barOrientation == BarOrientation::BARS_HORIZONTAL ? Qt::Horizontal : Qt::Vertical,
|
||||
m_useTopBarsFilter() ? m_maxBarCount : -1 );
|
||||
|
||||
if ( m_showPlotLegends && m_plotWidget->qwtPlot()->legend() == nullptr )
|
||||
{
|
||||
QwtLegend* legend = new QwtLegend( m_plotWidget );
|
||||
auto* legend = new QwtLegend( m_plotWidget );
|
||||
m_plotWidget->qwtPlot()->insertLegend( legend, QwtPlot::RightLegend );
|
||||
}
|
||||
else if ( !m_showPlotLegends )
|
||||
@ -826,6 +829,8 @@ RiuPlotWidget* RimAnalysisPlot::doCreatePlotViewWidget( QWidget* mainWindowParen
|
||||
if ( !m_plotWidget )
|
||||
{
|
||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
|
||||
new RiuContextMenuLauncher( m_plotWidget, { "RicShowPlotDataFeature" } );
|
||||
}
|
||||
|
||||
return m_plotWidget;
|
||||
@ -863,7 +868,7 @@ void RimAnalysisPlot::updateAxes()
|
||||
if ( !m_plotWidget ) return;
|
||||
|
||||
RiuPlotAxis axis = RiuPlotAxis::defaultLeft();
|
||||
if ( m_barOrientation == BARS_HORIZONTAL )
|
||||
if ( m_barOrientation == BarOrientation::BARS_HORIZONTAL )
|
||||
{
|
||||
axis = RiuPlotAxis::defaultBottom();
|
||||
m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), false );
|
||||
@ -898,7 +903,7 @@ void RimAnalysisPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
||||
caf::PdmObject* itemToSelect = nullptr;
|
||||
if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
|
||||
{
|
||||
if ( m_barOrientation == BARS_VERTICAL )
|
||||
if ( m_barOrientation == BarOrientation::BARS_VERTICAL )
|
||||
{
|
||||
itemToSelect = m_valueAxisProperties;
|
||||
}
|
||||
@ -909,7 +914,7 @@ void RimAnalysisPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
||||
}
|
||||
else if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
|
||||
{
|
||||
if ( m_barOrientation == BARS_HORIZONTAL )
|
||||
if ( m_barOrientation == BarOrientation::BARS_HORIZONTAL )
|
||||
{
|
||||
itemToSelect = m_valueAxisProperties;
|
||||
}
|
||||
@ -922,6 +927,17 @@ void RimAnalysisPlot::onAxisSelected( RiuPlotAxis axis, bool toggle )
|
||||
RiuPlotMainWindowTools::selectOrToggleObject( itemToSelect, toggle );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimAnalysisPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
RiuGroupedBarChartBuilder chartBuilder;
|
||||
addDataToChartBuilder( chartBuilder );
|
||||
|
||||
return chartBuilder.plotContentAsText();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -948,13 +964,13 @@ QString RimAnalysisPlot::assignGroupingText( RimAnalysisPlot::SortGroupType sor
|
||||
|
||||
switch ( sortGroup )
|
||||
{
|
||||
case RimAnalysisPlot::SUMMARY_ITEM:
|
||||
case RimAnalysisPlot::SortGroupType::SUMMARY_ITEM:
|
||||
{
|
||||
RifEclipseSummaryAddress addr = dataEntry.summaryAddressY();
|
||||
groupingText = QString::fromStdString( addr.itemUiText() );
|
||||
}
|
||||
break;
|
||||
case RimAnalysisPlot::CASE:
|
||||
case RimAnalysisPlot::SortGroupType::CASE:
|
||||
{
|
||||
if ( dataEntry.summaryCaseY() )
|
||||
{
|
||||
@ -962,7 +978,7 @@ QString RimAnalysisPlot::assignGroupingText( RimAnalysisPlot::SortGroupType sor
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RimAnalysisPlot::ENSEMBLE:
|
||||
case RimAnalysisPlot::SortGroupType::ENSEMBLE:
|
||||
{
|
||||
if ( dataEntry.ensemble() )
|
||||
{
|
||||
@ -970,14 +986,14 @@ QString RimAnalysisPlot::assignGroupingText( RimAnalysisPlot::SortGroupType sor
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RimAnalysisPlot::VECTOR:
|
||||
case RimAnalysisPlot::SortGroupType::VECTOR:
|
||||
{
|
||||
RifEclipseSummaryAddress addr = dataEntry.summaryAddressY();
|
||||
|
||||
groupingText = QString::fromStdString( addr.vectorName() );
|
||||
}
|
||||
break;
|
||||
case RimAnalysisPlot::TIME_STEP:
|
||||
case RimAnalysisPlot::SortGroupType::TIME_STEP:
|
||||
{
|
||||
groupingText = timestepString;
|
||||
}
|
||||
@ -1017,7 +1033,7 @@ std::vector<size_t> RimAnalysisPlot::findTimestepIndices( std::vector<time_t> se
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::filteredCurveDefs()
|
||||
std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::filteredCurveDefs() const
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> dataDefinitions = curveDefinitions();
|
||||
|
||||
@ -1071,7 +1087,7 @@ std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::filteredCurveDefs()
|
||||
|
||||
void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
std::set<RimSummaryCase*>* filteredSumCases,
|
||||
std::set<RifEclipseSummaryAddress>* filteredSummaryItems )
|
||||
std::set<RifEclipseSummaryAddress>* filteredSummaryItems ) const
|
||||
{
|
||||
if ( !filter->isActive() || !filter->isValid() ) return;
|
||||
|
||||
@ -1399,7 +1415,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder )
|
||||
void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder ) const
|
||||
{
|
||||
std::vector<time_t> selectedTimesteps;
|
||||
for ( const QDateTime& dateTime : m_selectedTimeSteps.v() )
|
||||
@ -1482,10 +1498,10 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui
|
||||
|
||||
switch ( m_valueSortOperation() )
|
||||
{
|
||||
case VALUE:
|
||||
case SortGroupType::VALUE:
|
||||
sortValue = value;
|
||||
break;
|
||||
case ABS_VALUE:
|
||||
case SortGroupType::ABS_VALUE:
|
||||
sortValue = fabs( value );
|
||||
break;
|
||||
}
|
||||
@ -1538,22 +1554,22 @@ void RimAnalysisPlot::updatePlotTitle()
|
||||
QString autoTitle;
|
||||
QString separator = ", ";
|
||||
|
||||
if ( getOrCreateSelectedCurveDefAnalyser()->m_ensembles.size() == 1 )
|
||||
if ( updateAndGetCurveAnalyzer()->m_ensembles.size() == 1 )
|
||||
{
|
||||
autoTitle += ( *getOrCreateSelectedCurveDefAnalyser()->m_ensembles.begin() )->name();
|
||||
autoTitle += ( *updateAndGetCurveAnalyzer()->m_ensembles.begin() )->name();
|
||||
}
|
||||
|
||||
if ( getOrCreateSelectedCurveDefAnalyser()->m_singleSummaryCases.size() == 1 )
|
||||
if ( updateAndGetCurveAnalyzer()->m_singleSummaryCases.size() == 1 )
|
||||
{
|
||||
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
||||
autoTitle += ( *getOrCreateSelectedCurveDefAnalyser()->m_singleSummaryCases.begin() )->displayCaseName();
|
||||
autoTitle += ( *updateAndGetCurveAnalyzer()->m_singleSummaryCases.begin() )->displayCaseName();
|
||||
}
|
||||
else if ( getOrCreateSelectedCurveDefAnalyser()->m_singleSummaryCases.size() > 1 )
|
||||
else if ( updateAndGetCurveAnalyzer()->m_singleSummaryCases.size() > 1 )
|
||||
{
|
||||
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
||||
|
||||
QStringList caseNameList;
|
||||
for ( auto summaryCase : getOrCreateSelectedCurveDefAnalyser()->m_singleSummaryCases )
|
||||
for ( auto summaryCase : updateAndGetCurveAnalyzer()->m_singleSummaryCases )
|
||||
{
|
||||
caseNameList.push_back( summaryCase->displayCaseName() );
|
||||
}
|
||||
@ -1570,13 +1586,13 @@ void RimAnalysisPlot::updatePlotTitle()
|
||||
}
|
||||
}
|
||||
|
||||
if ( getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses.size() == 1 )
|
||||
if ( updateAndGetCurveAnalyzer()->m_summaryAdresses.size() == 1 )
|
||||
{
|
||||
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
||||
autoTitle += QString::fromStdString( getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses.begin()->itemUiText() );
|
||||
autoTitle += QString::fromStdString( updateAndGetCurveAnalyzer()->m_summaryAdresses.begin()->itemUiText() );
|
||||
}
|
||||
|
||||
for ( std::string quantName : getOrCreateSelectedCurveDefAnalyser()->m_vectorNames )
|
||||
for ( const std::string& quantName : updateAndGetCurveAnalyzer()->m_vectorNames )
|
||||
{
|
||||
if ( !autoTitle.isEmpty() ) autoTitle += separator;
|
||||
autoTitle += QString::fromStdString( quantName );
|
||||
@ -1618,13 +1634,10 @@ void RimAnalysisPlot::updatePlotTitle()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveDefinitionAnalyser* RimAnalysisPlot::getOrCreateSelectedCurveDefAnalyser()
|
||||
RiaSummaryCurveDefinitionAnalyser* RimAnalysisPlot::updateAndGetCurveAnalyzer() const
|
||||
{
|
||||
if ( !m_analyserOfSelectedCurveDefs )
|
||||
{
|
||||
m_analyserOfSelectedCurveDefs = std::unique_ptr<RiaSummaryCurveDefinitionAnalyser>( new RiaSummaryCurveDefinitionAnalyser );
|
||||
}
|
||||
m_analyserOfSelectedCurveDefs->setCurveDefinitions( curveDefinitions() );
|
||||
|
||||
return m_analyserOfSelectedCurveDefs.get();
|
||||
}
|
||||
|
||||
@ -1634,7 +1647,7 @@ RiaSummaryCurveDefinitionAnalyser* RimAnalysisPlot::getOrCreateSelectedCurveDefA
|
||||
std::vector<RiaSummaryCurveDefinition> RimAnalysisPlot::curveDefinitions() const
|
||||
{
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefs;
|
||||
for ( auto dataEntry : m_analysisPlotDataSelection )
|
||||
for ( const auto& dataEntry : m_analysisPlotDataSelection )
|
||||
{
|
||||
curveDefs.push_back( dataEntry->curveDefinition() );
|
||||
}
|
||||
@ -1678,7 +1691,7 @@ void RimAnalysisPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder )
|
||||
void RimAnalysisPlot::buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder ) const
|
||||
{
|
||||
chartBuilder.addBarEntry( "T1_The_red_Fox", "", "", std::numeric_limits<double>::infinity(), "R1", "", 0.4 );
|
||||
chartBuilder.addBarEntry( "T1_The_red_Fox", "", "", std::numeric_limits<double>::infinity(), "R2", "", 0.45 );
|
||||
@ -1747,7 +1760,7 @@ void RimAnalysisPlot::initAfterRead()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::onCaseRemoved( const SignalEmitter* emitter, RimSummaryCase* summaryCase )
|
||||
{
|
||||
for ( auto existingEntry : m_analysisPlotDataSelection )
|
||||
for ( const auto& existingEntry : m_analysisPlotDataSelection )
|
||||
{
|
||||
if ( existingEntry->summaryCase() == summaryCase )
|
||||
{
|
||||
@ -1765,7 +1778,7 @@ void RimAnalysisPlot::onCaseRemoved( const SignalEmitter* emitter, RimSummaryCas
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::connectAllCaseSignals()
|
||||
{
|
||||
for ( auto dataEntry : m_analysisPlotDataSelection )
|
||||
for ( const auto& dataEntry : m_analysisPlotDataSelection )
|
||||
{
|
||||
if ( dataEntry->ensemble() )
|
||||
{
|
||||
|
@ -48,13 +48,13 @@ class RimAnalysisPlot : public RimPlot
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
enum BarOrientation
|
||||
enum class BarOrientation
|
||||
{
|
||||
BARS_HORIZONTAL,
|
||||
BARS_VERTICAL
|
||||
};
|
||||
|
||||
enum SortGroupType
|
||||
enum class SortGroupType
|
||||
{
|
||||
NONE,
|
||||
SUMMARY_ITEM,
|
||||
@ -82,18 +82,20 @@ public:
|
||||
void setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions );
|
||||
void setTimeSteps( const std::vector<time_t>& timeSteps );
|
||||
|
||||
std::set<RifEclipseSummaryAddress> unfilteredAddresses();
|
||||
std::set<RigEnsembleParameter> ensembleParameters();
|
||||
RigEnsembleParameter ensembleParameter( const QString& ensembleParameterName );
|
||||
std::set<RifEclipseSummaryAddress> unfilteredAddresses() const;
|
||||
std::set<RigEnsembleParameter> ensembleParameters() const;
|
||||
RigEnsembleParameter ensembleParameter( const QString& ensembleParameterName ) const;
|
||||
|
||||
void maxMinValueFromAddress( const RifEclipseSummaryAddress& address,
|
||||
RimPlotDataFilterItem::TimeStepSourceType timeStepSourceType,
|
||||
const std::vector<QDateTime>& timeRangeOrSelection,
|
||||
bool useAbsValue,
|
||||
double* min,
|
||||
double* max );
|
||||
double* max ) const;
|
||||
|
||||
std::vector<time_t> selectedTimeSteps();
|
||||
std::vector<time_t> selectedTimeSteps() const;
|
||||
QString description() const override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
|
||||
private:
|
||||
// Overridden PDM methods
|
||||
@ -104,10 +106,10 @@ private:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
std::set<time_t> allAvailableTimeSteps();
|
||||
std::set<time_t> allAvailableTimeSteps() const;
|
||||
|
||||
std::set<RimSummaryCase*> timestepDefiningSourceCases();
|
||||
std::set<RimSummaryCase*> allSourceCases();
|
||||
std::set<RimSummaryCase*> timestepDefiningSourceCases() const;
|
||||
std::set<RimSummaryCase*> allSourceCases() const;
|
||||
|
||||
void onFiltersChanged( const caf::SignalEmitter* emitter );
|
||||
|
||||
@ -121,8 +123,7 @@ private:
|
||||
|
||||
// RimPlotWindow overrides
|
||||
|
||||
QString description() const override;
|
||||
void doUpdateLayout() override {}
|
||||
void doUpdateLayout() override {}
|
||||
|
||||
// RimPlot Overrides
|
||||
|
||||
@ -139,24 +140,22 @@ private:
|
||||
void setAutoScaleYEnabled( bool enabled ) override {}
|
||||
void updateLegend() override{};
|
||||
|
||||
QString asciiDataForPlotExport() const override { return ""; }
|
||||
|
||||
// Private methods
|
||||
|
||||
void cleanupBeforeClose();
|
||||
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder ) const;
|
||||
void updatePlotTitle();
|
||||
|
||||
QString assignGroupingText( RimAnalysisPlot::SortGroupType sortGroup,
|
||||
const RiaSummaryCurveDefinition dataEntry,
|
||||
const QString& timestepString ) const;
|
||||
|
||||
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* updateAndGetCurveAnalyzer() const;
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefinitions() const;
|
||||
std::vector<RiaSummaryCurveDefinition> filteredCurveDefs();
|
||||
std::vector<RiaSummaryCurveDefinition> filteredCurveDefs() const;
|
||||
void applyFilter( const RimPlotDataFilterItem* filter,
|
||||
std::set<RimSummaryCase*>* filteredSumCases,
|
||||
std::set<RifEclipseSummaryAddress>* filteredSummaryItems );
|
||||
std::set<RifEclipseSummaryAddress>* filteredSummaryItems ) const;
|
||||
|
||||
static std::vector<size_t> findTimestepIndices( std::vector<time_t> selectedTimesteps, const std::vector<time_t>& timesteps );
|
||||
|
||||
@ -166,7 +165,7 @@ private:
|
||||
void axisSettingsChanged( const caf::SignalEmitter* emitter );
|
||||
void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic );
|
||||
|
||||
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
void buildTestPlot( RiuGroupedBarChartBuilder& chartBuilder ) const;
|
||||
|
||||
int barTextFontSize() const;
|
||||
void initAfterRead() override;
|
||||
|
@ -33,10 +33,12 @@
|
||||
#include "RimSummaryCase.h"
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "RiuContextMenuLauncher.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
#include "RiuSummaryVectorSelectionDialog.h"
|
||||
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
@ -91,6 +93,8 @@ RimAbstractCorrelationPlot::RimAbstractCorrelationPlot()
|
||||
CAF_PDM_InitField( &m_editCaseFilter, "EditCaseFilter", false, "Edit" );
|
||||
m_editCaseFilter.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() );
|
||||
m_editCaseFilter.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
|
||||
m_analyserOfSelectedCurveDefs = std::make_unique<RiaSummaryCurveDefinitionAnalyser>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -363,13 +367,8 @@ std::vector<RiaSummaryCurveDefinition> RimAbstractCorrelationPlot::curveDefiniti
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaSummaryCurveDefinitionAnalyser* RimAbstractCorrelationPlot::getOrCreateSelectedCurveDefAnalyser()
|
||||
RiaSummaryCurveDefinitionAnalyser* RimAbstractCorrelationPlot::getOrCreateSelectedCurveDefAnalyser() const
|
||||
{
|
||||
if ( !m_analyserOfSelectedCurveDefs )
|
||||
{
|
||||
m_analyserOfSelectedCurveDefs = std::unique_ptr<RiaSummaryCurveDefinitionAnalyser>( new RiaSummaryCurveDefinitionAnalyser );
|
||||
}
|
||||
|
||||
m_analyserOfSelectedCurveDefs->setCurveDefinitions( curveDefinitions() );
|
||||
return m_analyserOfSelectedCurveDefs.get();
|
||||
}
|
||||
@ -377,7 +376,7 @@ RiaSummaryCurveDefinitionAnalyser* RimAbstractCorrelationPlot::getOrCreateSelect
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RifEclipseSummaryAddress> RimAbstractCorrelationPlot::addresses()
|
||||
std::set<RifEclipseSummaryAddress> RimAbstractCorrelationPlot::addresses() const
|
||||
{
|
||||
std::set<RifEclipseSummaryAddress> addresses;
|
||||
|
||||
@ -392,7 +391,7 @@ std::set<RifEclipseSummaryAddress> RimAbstractCorrelationPlot::addresses()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::set<RimSummaryCaseCollection*> RimAbstractCorrelationPlot::ensembles()
|
||||
std::set<RimSummaryCaseCollection*> RimAbstractCorrelationPlot::ensembles() const
|
||||
{
|
||||
RiaSummaryCurveDefinitionAnalyser* analyserOfSelectedCurveDefs = getOrCreateSelectedCurveDefAnalyser();
|
||||
return analyserOfSelectedCurveDefs->m_ensembles;
|
||||
@ -554,6 +553,8 @@ RiuPlotWidget* RimAbstractCorrelationPlot::doCreatePlotViewWidget( QWidget* main
|
||||
{
|
||||
m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent );
|
||||
updatePlotTitle();
|
||||
|
||||
new RiuContextMenuLauncher( m_plotWidget, { "RicShowPlotDataFeature" } );
|
||||
}
|
||||
|
||||
return m_plotWidget;
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
std::vector<RiaSummaryCurveDefinition> curveDefinitions() const;
|
||||
void setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions );
|
||||
void setTimeStep( std::time_t timeStep );
|
||||
std::set<RimSummaryCaseCollection*> ensembles();
|
||||
std::set<RimSummaryCaseCollection*> ensembles() const;
|
||||
|
||||
// Get summary cases filtered by attached ensemble parameter filter
|
||||
std::set<RimSummaryCase*> filterEnsembleCases( RimSummaryCaseCollection* ensemble ) const;
|
||||
@ -85,7 +85,7 @@ protected:
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
std::set<RifEclipseSummaryAddress> addresses();
|
||||
std::set<RifEclipseSummaryAddress> addresses() const;
|
||||
std::set<RigEnsembleParameter> ensembleParameters();
|
||||
std::set<RigEnsembleParameter> variationSortedEnsembleParameters();
|
||||
RigEnsembleParameter ensembleParameter( const QString& ensembleParameterName );
|
||||
@ -128,7 +128,7 @@ private:
|
||||
void connectCurveFilterSignals();
|
||||
void onFilterSourceChanged( const caf::SignalEmitter* emitter );
|
||||
|
||||
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser();
|
||||
RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser() const;
|
||||
|
||||
protected:
|
||||
std::unique_ptr<RiaSummaryCurveDefinitionAnalyser> m_analyserOfSelectedCurveDefs;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "RiaStatisticsTools.h"
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "RifCsvDataTableFormatter.h"
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
|
||||
#include "RigEnsembleParameter.h"
|
||||
@ -108,44 +109,6 @@ private:
|
||||
std::map<size_t, QString> m_tickLabels;
|
||||
};
|
||||
|
||||
template <typename KeyType, typename ValueType>
|
||||
class CorrelationMatrixRowOrColumn
|
||||
{
|
||||
public:
|
||||
CorrelationMatrixRowOrColumn( const KeyType& key, const std::vector<double>& correlations, const std::vector<ValueType>& values )
|
||||
: m_key( key )
|
||||
, m_correlations( correlations )
|
||||
, m_values( values )
|
||||
, m_correlationSum( 0.0 )
|
||||
, m_correlationAbsSum( 0.0 )
|
||||
{
|
||||
bool anyValid = false;
|
||||
for ( auto value : correlations )
|
||||
{
|
||||
if ( RiaCurveDataTools::isValidValue( value, false ) )
|
||||
{
|
||||
m_correlationSum += value;
|
||||
m_correlationAbsSum += std::abs( value );
|
||||
anyValid = true;
|
||||
}
|
||||
}
|
||||
if ( !anyValid )
|
||||
{
|
||||
m_correlationSum = std::numeric_limits<double>::infinity();
|
||||
m_correlationAbsSum = std::numeric_limits<double>::infinity();
|
||||
}
|
||||
}
|
||||
|
||||
KeyType m_key;
|
||||
std::vector<double> m_correlations;
|
||||
std::vector<ValueType> m_values;
|
||||
double m_correlationSum;
|
||||
double m_correlationAbsSum;
|
||||
};
|
||||
|
||||
using CorrelationMatrixColumn = CorrelationMatrixRowOrColumn<QString, RiaSummaryCurveDefinition>;
|
||||
using CorrelationMatrixRow = CorrelationMatrixRowOrColumn<RiaSummaryCurveDefinition, QString>;
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -249,6 +212,45 @@ bool RimCorrelationMatrixPlot::isCurveHighlightSupported() const
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCorrelationMatrixPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
QString text;
|
||||
|
||||
QTextStream stream( &text );
|
||||
QString fieldSeparator = "\t";
|
||||
RifCsvDataTableFormatter formatter( stream, fieldSeparator );
|
||||
formatter.setUseQuotes( false );
|
||||
|
||||
std::vector<RifTextDataTableColumn> header;
|
||||
header.emplace_back( RifTextDataTableColumn( "Vector" ) );
|
||||
|
||||
for ( const auto& param : m_paramLabels )
|
||||
{
|
||||
header.emplace_back( RifTextDataTableColumn( param.second ) );
|
||||
}
|
||||
|
||||
formatter.header( header );
|
||||
|
||||
for ( const auto& row : m_valuesForTextReport )
|
||||
{
|
||||
formatter.add( QString::fromStdString( row.m_key.summaryAddressY().uiText() ) );
|
||||
|
||||
for ( const auto& corr : row.m_correlations )
|
||||
{
|
||||
formatter.add( corr );
|
||||
}
|
||||
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
|
||||
formatter.tableCompleted();
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -645,6 +647,8 @@ void RimCorrelationMatrixPlot::createMatrix()
|
||||
|
||||
m_resultLabels[rowIdx] = resultLabel;
|
||||
}
|
||||
|
||||
m_valuesForTextReport = correlationMatrixRows;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
#include "RimAbstractCorrelationPlot.h"
|
||||
|
||||
#include "RiaCurveDataTools.h"
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
class RimRegularLegendConfig;
|
||||
@ -28,6 +31,48 @@ class RimSummaryAddress;
|
||||
class RiuGroupedBarChartBuilder;
|
||||
class RiuPlotItem;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
template <typename KeyType, typename ValueType>
|
||||
class CorrelationMatrixRowOrColumn
|
||||
{
|
||||
public:
|
||||
CorrelationMatrixRowOrColumn( const KeyType& key, const std::vector<double>& correlations, const std::vector<ValueType>& values )
|
||||
: m_key( key )
|
||||
, m_correlations( correlations )
|
||||
, m_values( values )
|
||||
, m_correlationSum( 0.0 )
|
||||
, m_correlationAbsSum( 0.0 )
|
||||
{
|
||||
bool anyValid = false;
|
||||
for ( auto value : correlations )
|
||||
{
|
||||
if ( RiaCurveDataTools::isValidValue( value, false ) )
|
||||
{
|
||||
m_correlationSum += value;
|
||||
m_correlationAbsSum += std::abs( value );
|
||||
anyValid = true;
|
||||
}
|
||||
}
|
||||
if ( !anyValid )
|
||||
{
|
||||
m_correlationSum = std::numeric_limits<double>::infinity();
|
||||
m_correlationAbsSum = std::numeric_limits<double>::infinity();
|
||||
}
|
||||
}
|
||||
|
||||
KeyType m_key;
|
||||
std::vector<double> m_correlations;
|
||||
std::vector<ValueType> m_values;
|
||||
double m_correlationSum;
|
||||
double m_correlationAbsSum;
|
||||
};
|
||||
|
||||
using CorrelationMatrixColumn = CorrelationMatrixRowOrColumn<QString, RiaSummaryCurveDefinition>;
|
||||
using CorrelationMatrixRow = CorrelationMatrixRowOrColumn<RiaSummaryCurveDefinition, QString>;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
@ -60,6 +105,7 @@ public:
|
||||
bool showTopNCorrelations() const;
|
||||
int topNFilterCount() const;
|
||||
bool isCurveHighlightSupported() const override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
|
||||
private:
|
||||
// Overridden PDM methods
|
||||
@ -94,4 +140,6 @@ private:
|
||||
|
||||
std::map<size_t, QString> m_paramLabels;
|
||||
std::map<size_t, QString> m_resultLabels;
|
||||
|
||||
std::vector<CorrelationMatrixRow> m_valuesForTextReport;
|
||||
};
|
||||
|
@ -230,7 +230,7 @@ void RimCorrelationPlot::updateAxes()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCorrelationPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder )
|
||||
void RimCorrelationPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder ) const
|
||||
{
|
||||
time_t selectedTimestep = m_timeStep().toSecsSinceEpoch();
|
||||
|
||||
@ -295,6 +295,17 @@ void RimCorrelationPlot::onPlotItemSelected( std::shared_ptr<RiuPlotItem> plotIt
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimCorrelationPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
RiuGroupedBarChartBuilder chartBuilder;
|
||||
addDataToChartBuilder( chartBuilder );
|
||||
|
||||
return chartBuilder.plotContentAsText();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -61,15 +61,14 @@ private:
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
void updateAxes() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void updateAxes() override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
|
||||
// Private methods
|
||||
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder );
|
||||
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder ) const;
|
||||
void updatePlotTitle() override;
|
||||
void onPlotItemSelected( std::shared_ptr<RiuPlotItem> plotItem, bool toggle, int sampleIndex ) override;
|
||||
|
||||
|
@ -223,6 +223,7 @@ QStringList caseNamesOfValidEnsembleCases( const RimSummaryCaseCollection* ensem
|
||||
void RimParameterResultCrossPlot::createPoints()
|
||||
{
|
||||
detachAllCurves();
|
||||
m_valuesForTextReport.clear();
|
||||
|
||||
time_t selectedTimestep = m_timeStep().toSecsSinceEpoch();
|
||||
|
||||
@ -285,6 +286,8 @@ void RimParameterResultCrossPlot::createPoints()
|
||||
double paramValue = parameter.values[caseIdx].toDouble();
|
||||
parameterValues.push_back( paramValue );
|
||||
|
||||
m_valuesForTextReport.push_back( { paramValue, closestValue } );
|
||||
|
||||
m_xRange.first = std::min( m_xRange.first, paramValue );
|
||||
m_xRange.second = std::max( m_xRange.second, paramValue );
|
||||
|
||||
@ -314,6 +317,22 @@ void RimParameterResultCrossPlot::createPoints()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimParameterResultCrossPlot::asciiDataForPlotExport() const
|
||||
{
|
||||
QString asciiData;
|
||||
|
||||
asciiData += "Parameter\tResult\n";
|
||||
for ( const auto& valuePair : m_valuesForTextReport )
|
||||
{
|
||||
asciiData += QString( "%1\t%2\n" ).arg( valuePair.first ).arg( valuePair.second );
|
||||
}
|
||||
|
||||
return asciiData;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -41,9 +41,9 @@ private:
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
void updateAxes() override;
|
||||
void onLoadDataAndUpdate() override;
|
||||
void updateAxes() override;
|
||||
QString asciiDataForPlotExport() const override;
|
||||
|
||||
// Private methods
|
||||
void updatePlotTitle() override;
|
||||
@ -54,4 +54,6 @@ private:
|
||||
|
||||
std::pair<double, double> m_xRange;
|
||||
std::pair<double, double> m_yRange;
|
||||
|
||||
std::vector<std::pair<double, double>> m_valuesForTextReport;
|
||||
};
|
||||
|
@ -270,9 +270,7 @@ RiuPlotWidget* RimWellAllocationOverTimePlot::doCreatePlotViewWidget( QWidget* m
|
||||
// Remove event filter to disable unwanted highlighting on left click in plot.
|
||||
plotWidget->removeEventFilter();
|
||||
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
new RiuContextMenuLauncher( plotWidget, menuBuilder );
|
||||
new RiuContextMenuLauncher( m_plotWidget, { "RicShowPlotDataFeature" } );
|
||||
|
||||
m_plotWidget = plotWidget;
|
||||
RiuQwtPlotTools::enableDateBasedBottomXAxis( m_plotWidget->qwtPlot(),
|
||||
|
@ -376,9 +376,7 @@ RiuPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
||||
// Remove event filter to disable unwanted highlighting on left click in plot.
|
||||
plotWidget->removeEventFilter();
|
||||
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
menuBuilder << "RicShowPlotDataFeature";
|
||||
new RiuContextMenuLauncher( plotWidget, menuBuilder );
|
||||
new RiuContextMenuLauncher( plotWidget, { "RicShowPlotDataFeature" } );
|
||||
|
||||
m_plotWidget = plotWidget;
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifCsvDataTableFormatter.h"
|
||||
|
||||
#include "RiuGuiTheme.h"
|
||||
|
||||
#include "cafFontTools.h"
|
||||
@ -836,6 +838,62 @@ void RiuGroupedBarChartBuilder::setLabelFontSize( int labelPointSize )
|
||||
m_labelPointSize = labelPointSize;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiuGroupedBarChartBuilder::plotContentAsText() const
|
||||
{
|
||||
QString text;
|
||||
|
||||
QTextStream stream( &text );
|
||||
QString fieldSeparator = "\t";
|
||||
RifCsvDataTableFormatter formatter( stream, fieldSeparator );
|
||||
formatter.setUseQuotes( false );
|
||||
|
||||
bool hasTextForMajor = false;
|
||||
bool hasTextForMid = false;
|
||||
bool hasTextForMinor = false;
|
||||
bool hasTextForLegend = false;
|
||||
bool hasTextForBar = false;
|
||||
|
||||
for ( const BarEntry& barDef : m_sortedBarEntries )
|
||||
{
|
||||
if ( !barDef.m_majTickText.isEmpty() ) hasTextForMajor = true;
|
||||
if ( !barDef.m_midTickText.isEmpty() ) hasTextForMid = true;
|
||||
if ( !barDef.m_minTickText.isEmpty() ) hasTextForMinor = true;
|
||||
if ( !barDef.m_legendText.isEmpty() ) hasTextForLegend = true;
|
||||
if ( !barDef.m_barText.isEmpty() && barDef.m_barText != barDef.m_legendText ) hasTextForBar = true;
|
||||
}
|
||||
|
||||
std::vector<RifTextDataTableColumn> header;
|
||||
if ( hasTextForMajor ) header.emplace_back( RifTextDataTableColumn( "Major" ) );
|
||||
if ( hasTextForMid ) header.emplace_back( RifTextDataTableColumn( "Mid" ) );
|
||||
if ( hasTextForMinor ) header.emplace_back( RifTextDataTableColumn( "Minor" ) );
|
||||
if ( hasTextForLegend ) header.emplace_back( RifTextDataTableColumn( "Legend" ) );
|
||||
if ( hasTextForBar ) header.emplace_back( RifTextDataTableColumn( "Bar" ) );
|
||||
|
||||
header.emplace_back( RifTextDataTableColumn( "Value", RifTextDataTableDoubleFormat::RIF_FLOAT ) );
|
||||
|
||||
formatter.header( header );
|
||||
|
||||
for ( const BarEntry& barDef : m_sortedBarEntries )
|
||||
{
|
||||
if ( hasTextForMajor ) formatter.add( barDef.m_majTickText );
|
||||
if ( hasTextForMid ) formatter.add( barDef.m_midTickText );
|
||||
if ( hasTextForMinor ) formatter.add( barDef.m_minTickText );
|
||||
if ( hasTextForLegend ) formatter.add( barDef.m_legendText );
|
||||
if ( hasTextForBar ) formatter.add( barDef.m_barText );
|
||||
|
||||
formatter.add( barDef.m_value );
|
||||
|
||||
formatter.rowCompleted();
|
||||
}
|
||||
|
||||
formatter.tableCompleted();
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -50,6 +50,8 @@ public:
|
||||
void addBarChartToPlot( QwtPlot* plot, Qt::Orientation orientation, int maxBarCount = -1 );
|
||||
void setLabelFontSize( int labelPointSize );
|
||||
|
||||
QString plotContentAsText() const;
|
||||
|
||||
private:
|
||||
double midPoint( double v1, double v2 ) { return v1 + 0.5 * ( v2 - 1.0 - v1 ); }
|
||||
|
||||
|
@ -30,13 +30,30 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuContextMenuLauncher::RiuContextMenuLauncher( QWidget* widget, const caf::CmdFeatureMenuBuilder& commandIds )
|
||||
RiuContextMenuLauncher::RiuContextMenuLauncher( QWidget* widget, const caf::CmdFeatureMenuBuilder& menuBuilder )
|
||||
: QObject( widget )
|
||||
, m_menuBuilder( commandIds )
|
||||
, m_menuBuilder( menuBuilder )
|
||||
{
|
||||
widget->installEventFilter( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuContextMenuLauncher::RiuContextMenuLauncher( QWidget* widget, const QStringList& commandIds )
|
||||
{
|
||||
caf::CmdFeatureMenuBuilder menuBuilder;
|
||||
|
||||
for ( const auto& cmd : commandIds )
|
||||
{
|
||||
menuBuilder << cmd;
|
||||
}
|
||||
|
||||
m_menuBuilder = menuBuilder;
|
||||
|
||||
widget->installEventFilter( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -32,7 +32,8 @@ class QWidget;
|
||||
class RiuContextMenuLauncher : public QObject
|
||||
{
|
||||
public:
|
||||
explicit RiuContextMenuLauncher( QWidget* widget, const caf::CmdFeatureMenuBuilder& commandIds );
|
||||
explicit RiuContextMenuLauncher( QWidget* widget, const caf::CmdFeatureMenuBuilder& menuBuilder );
|
||||
explicit RiuContextMenuLauncher( QWidget* widget, const QStringList& commandIds );
|
||||
|
||||
protected:
|
||||
bool eventFilter( QObject* watched, QEvent* event ) override;
|
||||
|
Loading…
Reference in New Issue
Block a user