mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Multi page plot works
This commit is contained in:
@@ -72,7 +72,7 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()
|
||||
"" );
|
||||
|
||||
m_plotWindowTitle = "Well Distribution Plots";
|
||||
m_columnCountEnum = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||
m_columnCount = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||
|
||||
m_showPlotLegends = false;
|
||||
m_showWindow = false;
|
||||
|
||||
@@ -19,10 +19,11 @@
|
||||
|
||||
#include "RimPlot.h"
|
||||
|
||||
#include "RiuMultiPlotWindow.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QPaintDevice>
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include <cvfAssert.h>
|
||||
@@ -39,6 +40,16 @@ void RimMultiPlotWindow::ColumnCountEnum::setUp()
|
||||
addItem( RimMultiPlotWindow::COLUMNS_UNLIMITED, "UNLIMITED", "Unlimited" );
|
||||
setDefault( RimMultiPlotWindow::COLUMNS_2 );
|
||||
}
|
||||
template <>
|
||||
void RimMultiPlotWindow::RowCountEnum::setUp()
|
||||
{
|
||||
addItem( RimMultiPlotWindow::ROWS_1, "1", "1 Row" );
|
||||
addItem( RimMultiPlotWindow::ROWS_2, "2", "2 Rows" );
|
||||
addItem( RimMultiPlotWindow::ROWS_3, "3", "3 Rows" );
|
||||
addItem( RimMultiPlotWindow::ROWS_4, "4", "4 Rows" );
|
||||
setDefault( RimMultiPlotWindow::ROWS_2 );
|
||||
}
|
||||
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimMultiPlotWindow, "MultiPlot" );
|
||||
@@ -58,7 +69,8 @@ RimMultiPlotWindow::RimMultiPlotWindow( bool hidePlotsInTreeView )
|
||||
m_plots.uiCapability()->setUiHidden( true );
|
||||
m_plots.uiCapability()->setUiTreeChildrenHidden( hidePlotsInTreeView );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_columnCountEnum, "NumberOfColumns", "Number of Columns", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_columnCount, "NumberOfColumns", "Number of Columns", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &m_rowsPerPage, "RowsPerPage", "Rows per Page", "", "", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_showIndividualPlotTitles, "ShowPlotTitles", false, "Show Sub Plot Titles", "", "", "" );
|
||||
|
||||
@@ -91,7 +103,13 @@ RimMultiPlotWindow& RimMultiPlotWindow::operator=( RimMultiPlotWindow&& rhs )
|
||||
m_plots.push_back( plot );
|
||||
}
|
||||
|
||||
m_columnCountEnum = rhs.m_columnCountEnum;
|
||||
m_showPlotWindowTitle = rhs.m_showPlotWindowTitle;
|
||||
m_plotWindowTitle = rhs.m_plotWindowTitle;
|
||||
m_columnCount = rhs.m_columnCount;
|
||||
m_rowsPerPage = rhs.m_rowsPerPage;
|
||||
m_showIndividualPlotTitles = rhs.m_showIndividualPlotTitles;
|
||||
|
||||
m_acceptDrops = rhs.m_acceptDrops;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -274,7 +292,7 @@ std::vector<RimPlot*> RimMultiPlotWindow::visiblePlots() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiPlotWindow::doUpdateLayout()
|
||||
{
|
||||
if ( m_showWindow )
|
||||
if ( m_showWindow && m_viewer )
|
||||
{
|
||||
m_viewer->scheduleUpdate();
|
||||
}
|
||||
@@ -350,11 +368,19 @@ void RimMultiPlotWindow::setAutoScaleYEnabled( bool enabled )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimMultiPlotWindow::columnCount() const
|
||||
{
|
||||
if ( m_columnCountEnum() == COLUMNS_UNLIMITED )
|
||||
if ( m_columnCount() == COLUMNS_UNLIMITED )
|
||||
{
|
||||
return std::numeric_limits<int>::max();
|
||||
}
|
||||
return static_cast<int>( m_columnCountEnum() );
|
||||
return static_cast<int>( m_columnCount() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimMultiPlotWindow::rowsPerPage() const
|
||||
{
|
||||
return static_cast<int>( m_rowsPerPage() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -362,7 +388,15 @@ int RimMultiPlotWindow::columnCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimMultiPlotWindow::columnCountField()
|
||||
{
|
||||
return &m_columnCountEnum;
|
||||
return &m_columnCount;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimMultiPlotWindow::rowsPerPageField()
|
||||
{
|
||||
return &m_rowsPerPage;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -494,7 +528,7 @@ void RimMultiPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
updatePlotWindowTitle();
|
||||
applyPlotWindowTitleToWidgets();
|
||||
}
|
||||
else if ( changedField == &m_columnCountEnum )
|
||||
else if ( changedField == &m_columnCount || changedField == &m_rowsPerPage )
|
||||
{
|
||||
updateLayout();
|
||||
RiuPlotMainWindowTools::refreshToolbars();
|
||||
@@ -520,7 +554,8 @@ void RimMultiPlotWindow::uiOrderingForPlotLayout( QString uiConfigName, caf::Pdm
|
||||
uiOrdering.add( &m_plotWindowTitle );
|
||||
uiOrdering.add( &m_showIndividualPlotTitles );
|
||||
RimPlotWindow::uiOrderingForLegendSettings( uiConfigName, uiOrdering );
|
||||
uiOrdering.add( &m_columnCountEnum );
|
||||
uiOrdering.add( &m_columnCount );
|
||||
uiOrdering.add( &m_rowsPerPage );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -531,7 +566,7 @@ QList<caf::PdmOptionItemInfo> RimMultiPlotWindow::calculateValueOptions( const c
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
|
||||
|
||||
if ( fieldNeedingOptions == &m_columnCountEnum )
|
||||
if ( fieldNeedingOptions == &m_columnCount )
|
||||
{
|
||||
for ( size_t i = 0; i < ColumnCountEnum::size(); ++i )
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RimPlotWindow.h"
|
||||
#include "RiuMultiPlotWindow.h"
|
||||
#include "RiuMultiPlotInterface.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
@@ -49,6 +49,15 @@ public:
|
||||
};
|
||||
using ColumnCountEnum = caf::AppEnum<ColumnCount>;
|
||||
|
||||
enum RowCount
|
||||
{
|
||||
ROWS_1 = 1,
|
||||
ROWS_2 = 2,
|
||||
ROWS_3 = 3,
|
||||
ROWS_4 = 4,
|
||||
};
|
||||
using RowCountEnum = caf::AppEnum<RowCount>;
|
||||
|
||||
public:
|
||||
RimMultiPlotWindow( bool hidePlotsInTreeView = false );
|
||||
~RimMultiPlotWindow() override;
|
||||
@@ -82,7 +91,9 @@ public:
|
||||
void setAutoScaleYEnabled( bool enabled );
|
||||
|
||||
int columnCount() const;
|
||||
int rowsPerPage() const;
|
||||
caf::PdmFieldHandle* columnCountField();
|
||||
caf::PdmFieldHandle* rowsPerPageField();
|
||||
bool showPlotTitles() const;
|
||||
|
||||
void zoomAll() override;
|
||||
@@ -134,11 +145,12 @@ private:
|
||||
protected:
|
||||
caf::PdmField<bool> m_showPlotWindowTitle;
|
||||
caf::PdmField<QString> m_plotWindowTitle;
|
||||
caf::PdmField<ColumnCountEnum> m_columnCountEnum;
|
||||
caf::PdmField<ColumnCountEnum> m_columnCount;
|
||||
caf::PdmField<RowCountEnum> m_rowsPerPage;
|
||||
caf::PdmField<bool> m_showIndividualPlotTitles;
|
||||
|
||||
friend class RiuMultiPlotWindow;
|
||||
QPointer<RiuMultiPlotWindow> m_viewer;
|
||||
friend class RiuMultiPlotInterface;
|
||||
QPointer<RiuMultiPlotInterface> m_viewer;
|
||||
|
||||
private:
|
||||
caf::PdmChildArrayField<RimPlot*> m_plots;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "RimWellLogCurveCommonDataSource.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiuMultiPlotWindow.h"
|
||||
#include "RiuMultiPlotPage.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
@@ -105,7 +105,7 @@ RimWellLogPlot::RimWellLogPlot()
|
||||
m_maxAvailableDepth = -HUGE_VAL;
|
||||
|
||||
m_commonDataSourceEnabled = true;
|
||||
m_columnCountEnum = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||
m_columnCount = RimMultiPlotWindow::COLUMNS_UNLIMITED;
|
||||
|
||||
m_plotWindowTitle.xmlCapability()->setIOWritable( false );
|
||||
m_plotLegendsHorizontal = false;
|
||||
@@ -616,7 +616,7 @@ void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Plot Layout" );
|
||||
uiOrderingForAutoName( uiConfigName, *titleAndLegendsGroup );
|
||||
RimPlotWindow::uiOrderingForLegendSettings( uiConfigName, *titleAndLegendsGroup );
|
||||
titleAndLegendsGroup->add( &m_columnCountEnum );
|
||||
titleAndLegendsGroup->add( &m_columnCount );
|
||||
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
@@ -683,7 +683,7 @@ void RimWellLogPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_columnCountEnum )
|
||||
if ( field == &m_columnCount )
|
||||
{
|
||||
auto comboAttr = dynamic_cast<caf::PdmUiComboBoxEditorAttribute*>( attribute );
|
||||
if ( comboAttr )
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <set>
|
||||
|
||||
class RimWellLogCurveCommonDataSource;
|
||||
class RiuMultiPlotWindow;
|
||||
class RiuMultiPlotPage;
|
||||
class RimPlotWindow;
|
||||
class QKeyEvent;
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuMultiPlotWindow.h"
|
||||
#include "RiuPlotAnnotationTool.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtPlotWidget.h"
|
||||
|
||||
Reference in New Issue
Block a user