Well Log Plot and Well Distribution Plots no longer inherit Multiplot

* Also cleaned up RiuQwtPlotWidget
This commit is contained in:
Gaute Lindkvist
2020-01-16 12:32:40 +01:00
parent 2044b99818
commit edc276db4d
70 changed files with 1568 additions and 1215 deletions

View File

@@ -25,4 +25,8 @@ list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
list(APPEND QT_MOC_HEADERS
${CMAKE_CURRENT_LIST_DIR}/RimGridCrossPlot.h
)
source_group( "ProjectDataModel\\GridCrossPlots" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@@ -30,7 +30,7 @@
#include "RimGridCrossPlotCollection.h"
#include "RimGridCrossPlotCurve.h"
#include "RimGridCrossPlotDataSet.h"
#include "RimMultiPlotWindow.h"
#include "RimMultiPlot.h"
#include "RimPlotAxisProperties.h"
#include "cafPdmUiCheckBoxEditor.h"
@@ -436,7 +436,17 @@ QString RimGridCrossPlot::generateInfoBoxText() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimGridCrossPlot::createViewWidget( QWidget* mainWindowParent )
void RimGridCrossPlot::onPlotZoomed()
{
setAutoScaleXEnabled( false );
setAutoScaleYEnabled( false );
updateZoomFromQwt();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget* RimGridCrossPlot::doCreatePlotViewWidget( QWidget* mainWindowParent )
{
if ( !m_plotWidget )
{
@@ -446,9 +456,11 @@ QWidget* RimGridCrossPlot::createViewWidget( QWidget* mainWindowParent )
{
dataSet->setParentQwtPlotNoReplot( m_plotWidget );
}
}
m_plotWidget->scheduleReplot();
updateCurveNamesAndPlotTitle();
this->connect( m_plotWidget, SIGNAL( plotZoomed() ), SLOT( onPlotZoomed() ) );
}
return m_plotWidget;
}
@@ -540,9 +552,9 @@ void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField
{
updateParentLayout();
}
else
else if ( changedField == &m_showInfoBox )
{
onLoadDataAndUpdate();
updateLayout();
}
}
@@ -604,10 +616,9 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
if ( m_plotWidget )
{
if ( isMdiWindow() )
{
m_plotWidget->setTitle( this->createAutoName() );
}
QString plotTitle = this->createAutoName();
m_plotWidget->setPlotTitle( plotTitle );
m_plotWidget->setPlotTitleEnabled( isMdiWindow() );
}
updateMdiWindowTitle();
}
@@ -790,11 +801,14 @@ void RimGridCrossPlot::doUpdateLayout()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateLegend()
{
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() && isMdiWindow() );
m_plotWidget->setLegendFontSize( legendFontSize() );
for ( auto dataSet : m_crossPlotDataSets )
if ( m_plotWidget )
{
dataSet->updateLegendIcons();
m_plotWidget->setInternalQwtLegendVisible( legendsVisible() && isMdiWindow() );
m_plotWidget->setLegendFontSize( legendFontSize() );
for ( auto dataSet : m_crossPlotDataSets )
{
dataSet->updateLegendIcons();
}
}
}

View File

@@ -54,6 +54,7 @@ private:
class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface
{
Q_OBJECT;
CAF_PDM_HEADER_INIT;
public:
@@ -112,12 +113,11 @@ public:
void onAxisSelected( int axis, bool toggle ) override;
protected:
QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override;
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void deleteViewWidget() override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
@@ -142,12 +142,17 @@ protected:
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
private:
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
void doUpdateLayout() override;
void cleanupBeforeClose();
void doRemoveFromCollection() override;
QString generateInfoBoxText() const;
private slots:
void onPlotZoomed();
private:
caf::PdmField<bool> m_showInfoBox;
caf::PdmField<bool> m_showLegend_OBSOLETE;

View File

@@ -72,7 +72,7 @@ void RimGridCrossPlotCurve::setSamples( const std::vector<double>& xValues, cons
{
CVF_ASSERT( xValues.size() == yValues.size() );
if ( xValues.empty() || yValues.empty() ) return;
if ( xValues.empty() || yValues.empty() || !m_qwtPlotCurve ) return;
m_qwtPlotCurve->setSamples( &xValues[0], &yValues[0], static_cast<int>( xValues.size() ) );
}
@@ -107,6 +107,8 @@ size_t RimGridCrossPlotCurve::sampleCount() const
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurve::determineLegendIcon()
{
if ( !m_qwtPlotCurve ) return;
RimGridCrossPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
int fontSize = plot->legendFontSize();
@@ -118,7 +120,10 @@ void RimGridCrossPlotCurve::determineLegendIcon()
//--------------------------------------------------------------------------------------------------
void RimGridCrossPlotCurve::setBlackAndWhiteLegendIcons( bool blackAndWhite )
{
m_qwtPlotCurve->setBlackAndWhiteLegendIcon( blackAndWhite );
if ( m_qwtPlotCurve )
{
m_qwtPlotCurve->setBlackAndWhiteLegendIcon( blackAndWhite );
}
}
//--------------------------------------------------------------------------------------------------