Create Grid plot collection and allow creation of new combination plots

This commit is contained in:
Gaute Lindkvist
2019-10-31 13:48:40 +01:00
parent e042b2d17b
commit 30db19a1d0
55 changed files with 1208 additions and 597 deletions

View File

@@ -3,6 +3,9 @@
#include "RimPlotWindow.h"
#include "RimWellLogPlot.h"
#include "RiuQwtPlotWidget.h"
#include "RiuWellLogTrack.h"
#include "cafAssert.h"
#include "cafPdmPointer.h"
@@ -14,7 +17,22 @@
RiuWellLogPlot::RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent )
: RiuGridPlotWindow( plotDefinition, parent )
{
connect( m_scrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) );
m_trackScrollBar = new QScrollBar( nullptr );
m_trackScrollBar->setOrientation( Qt::Vertical );
m_trackScrollBar->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
m_trackScrollBarLayout = new QVBoxLayout;
m_trackScrollBarLayout->addWidget( m_trackScrollBar, 0 );
connect( m_trackScrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuWellLogPlot::isScrollbarVisible() const
{
return m_trackScrollBar->isVisible();
}
//--------------------------------------------------------------------------------------------------
@@ -27,6 +45,14 @@ RimWellLogPlot* RiuWellLogPlot::wellLogPlotDefinition()
return wellLogPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::setScrollbarVisible( bool visible )
{
m_trackScrollBar->setVisible( visible );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -36,14 +62,53 @@ void RiuWellLogPlot::updateVerticalScrollBar( double minVisible, double maxVisib
double visibleRange = maxVisible - minVisible;
m_scrollBar->blockSignals( true );
m_trackScrollBar->blockSignals( true );
{
m_scrollBar->setRange( (int)minAvailable, (int)( ( maxAvailable - visibleRange ) ) );
m_scrollBar->setPageStep( (int)visibleRange );
m_scrollBar->setValue( (int)minVisible );
m_scrollBar->setVisible( true );
m_trackScrollBar->setRange( (int)minAvailable, (int)( ( maxAvailable - visibleRange ) ) );
m_trackScrollBar->setPageStep( (int)visibleRange );
m_trackScrollBar->setValue( (int)minVisible );
m_trackScrollBar->setVisible( true );
}
m_scrollBar->blockSignals( false );
m_trackScrollBar->blockSignals( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuWellLogPlot::willAcceptDroppedPlot( const RiuQwtPlotWidget* plotWidget ) const
{
return dynamic_cast<const RiuWellLogTrack*>( plotWidget ) != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiuWellLogPlot::showYAxis( int row, int column ) const
{
return column == 0;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::reinsertScrollbar()
{
QList<QPointer<RiuQwtPlotWidget>> plotWidgets = this->visiblePlotWidgets();
QList<QPointer<RiuQwtPlotLegend>> legends = this->visibleLegends();
auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() );
m_trackScrollBar->setVisible( !plotWidgets.empty() );
m_gridLayout->addLayout( m_trackScrollBarLayout, 2, rowAndColumnCount.second, rowAndColumnCount.first * 2 - 1, 1 );
m_gridLayout->setColumnStretch( rowAndColumnCount.second, 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::alignScrollbar( int offset )
{
m_trackScrollBarLayout->setContentsMargins( 0, offset, 0, 0 );
}
//--------------------------------------------------------------------------------------------------
@@ -59,3 +124,14 @@ void RiuWellLogPlot::slotSetMinDepth( int value )
wellLogPlotDefinition()->setDepthAxisRange( minimumDepth + delta, maximumDepth + delta );
wellLogPlotDefinition()->setAutoScaleYEnabled( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::performUpdate()
{
reinsertPlotWidgets();
reinsertScrollbar();
int axisShift = alignCanvasTops();
alignScrollbar( axisShift );
}