ResInsight/ApplicationCode/UserInterface/RiuWellLogPlot.cpp

62 lines
2.4 KiB
C++
Raw Normal View History

#include "RiuWellLogPlot.h"
#include "RimPlotWindow.h"
#include "RimWellLogPlot.h"
#include "cafAssert.h"
#include "cafPdmPointer.h"
#include <QScrollBar>
//--------------------------------------------------------------------------------------------------
2019-09-06 06:17:36 -05:00
///
//--------------------------------------------------------------------------------------------------
2019-09-06 06:17:36 -05:00
RiuWellLogPlot::RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent )
: RiuGridPlotWindow( plotDefinition, parent )
{
2019-09-06 06:17:36 -05:00
connect( m_scrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RiuWellLogPlot::wellLogPlotDefinition()
{
RimWellLogPlot* wellLogPlot = dynamic_cast<RimWellLogPlot*>( m_plotDefinition.p() );
CAF_ASSERT( wellLogPlot );
return wellLogPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::updateVerticalScrollBar( double minVisible, double maxVisible, double minAvailable, double maxAvailable )
{
maxAvailable += 0.01 * ( maxAvailable - minAvailable );
2019-10-10 06:33:57 -05:00
double visibleRange = maxVisible - minVisible;
2019-09-06 06:17:36 -05:00
m_scrollBar->blockSignals( true );
{
m_scrollBar->setRange( (int)minAvailable, (int)( ( maxAvailable - visibleRange ) ) );
m_scrollBar->setPageStep( (int)visibleRange );
m_scrollBar->setValue( (int)minVisible );
2019-09-06 06:17:36 -05:00
m_scrollBar->setVisible( true );
}
2019-09-06 06:17:36 -05:00
m_scrollBar->blockSignals( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2019-09-06 06:17:36 -05:00
void RiuWellLogPlot::slotSetMinDepth( int value )
{
double minimumDepth;
double maximumDepth;
wellLogPlotDefinition()->availableDepthRange( &minimumDepth, &maximumDepth );
double delta = value - minimumDepth;
wellLogPlotDefinition()->setDepthAxisRange( minimumDepth + delta, maximumDepth + delta );
wellLogPlotDefinition()->setAutoScaleYEnabled( false );
}