mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Refactor RimPlotWindow and RimPlotInterface
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
#include "RiaColorTools.h"
|
||||
#include "RiaPlotWindowRedrawScheduler.h"
|
||||
|
||||
#include "RimPlot.h"
|
||||
#include "RimPlotCurve.h"
|
||||
#include "RimPlotInterface.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
#include "RiuQwtCurvePointTracker.h"
|
||||
@@ -60,13 +60,11 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidget* parent )
|
||||
RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plot, QWidget* parent )
|
||||
: QwtPlot( parent )
|
||||
, m_plotDefinition( plot )
|
||||
, m_draggable( true )
|
||||
{
|
||||
m_plotOwner = dynamic_cast<caf::PdmObject*>( plotTrackDefinition );
|
||||
CAF_ASSERT( m_plotOwner );
|
||||
|
||||
setDefaults();
|
||||
|
||||
this->installEventFilter( this );
|
||||
@@ -78,9 +76,9 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidg
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget::~RiuQwtPlotWidget()
|
||||
{
|
||||
if ( plotDefinition() )
|
||||
if ( m_plotDefinition )
|
||||
{
|
||||
plotDefinition()->detachAllCurves();
|
||||
m_plotDefinition->detachAllCurves();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,9 +87,9 @@ RiuQwtPlotWidget::~RiuQwtPlotWidget()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiuQwtPlotWidget::isChecked() const
|
||||
{
|
||||
if ( plotDefinition() )
|
||||
if ( m_plotDefinition )
|
||||
{
|
||||
return plotDefinition()->isChecked();
|
||||
return m_plotDefinition->showWindow();
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -158,17 +156,9 @@ void RiuQwtPlotWidget::setAxisFontsAndAlignment( QwtPlot::Axis axis,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotInterface* RiuQwtPlotWidget::plotDefinition() const
|
||||
RimPlot* RiuQwtPlotWidget::plotDefinition() const
|
||||
{
|
||||
return dynamic_cast<RimPlotInterface*>( m_plotOwner.p() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RiuQwtPlotWidget::plotOwner() const
|
||||
{
|
||||
return m_plotOwner.p();
|
||||
return m_plotDefinition;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -611,7 +601,7 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS
|
||||
axisId = i;
|
||||
}
|
||||
}
|
||||
plotDefinition()->onAxisSelected( axisId, toggleItemInSelection );
|
||||
m_plotDefinition->onAxisSelected( axisId, toggleItemInSelection );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -671,11 +661,11 @@ void RiuQwtPlotWidget::selectPlotOwner( bool toggleItemInSelection )
|
||||
{
|
||||
if ( toggleItemInSelection )
|
||||
{
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( plotOwner() );
|
||||
RiuPlotMainWindowTools::toggleItemInSelection( m_plotDefinition );
|
||||
}
|
||||
else
|
||||
{
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( plotOwner() );
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem( m_plotDefinition );
|
||||
}
|
||||
scheduleReplot();
|
||||
}
|
||||
@@ -710,10 +700,10 @@ void RiuQwtPlotWidget::selectClosestCurve( const QPoint& pos, bool toggleItemInS
|
||||
resetCurveHighlighting();
|
||||
if ( closestCurve && distMin < 20 )
|
||||
{
|
||||
if ( plotDefinition() )
|
||||
if ( m_plotDefinition )
|
||||
{
|
||||
RimPlotCurve* selectedCurve = dynamic_cast<RimPlotCurve*>(
|
||||
plotDefinition()->findPdmObjectFromQwtCurve( closestCurve ) );
|
||||
m_plotDefinition->findPdmObjectFromQwtCurve( closestCurve ) );
|
||||
if ( selectedCurve )
|
||||
{
|
||||
if ( toggleItemInSelection )
|
||||
|
||||
Reference in New Issue
Block a user