mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #8387 from OPM/qtcharts-summary-plots
Closes #8228 Major refactoring of summary plotting. Now possible to create plots both with Qwt and QtChart as plotting tool.
This commit is contained in:
committed by
GitHub
parent
d9bb82de91
commit
258fbddc10
@@ -61,6 +61,7 @@
|
||||
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_plot_curve.h"
|
||||
#include "qwt_symbol.h"
|
||||
|
||||
@@ -70,7 +71,7 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Internal functions
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int statisticsCurveSymbolSize( RiuQwtSymbol::PointSymbolEnum symbol );
|
||||
int statisticsCurveSymbolSize( RiuPlotCurveSymbol::PointSymbolEnum symbol );
|
||||
|
||||
namespace caf
|
||||
{
|
||||
@@ -135,7 +136,7 @@ RimEnsembleWellLogCurveSet::RimEnsembleWellLogCurveSet()
|
||||
m_curveAppearance->setColorVisible( false );
|
||||
m_curveAppearance->setFillOptionsVisible( false );
|
||||
|
||||
m_curveAppearance->setSymbol( RiuQwtSymbol::PointSymbolEnum::SYMBOL_ELLIPSE );
|
||||
m_curveAppearance->setSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_ELLIPSE );
|
||||
m_curveAppearance->setSymbolSize( 5 );
|
||||
m_curveAppearance->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE );
|
||||
m_curveAppearance->setSymbolEdgeColor( cvf::Color3f::BLACK );
|
||||
@@ -218,22 +219,22 @@ void RimEnsembleWellLogCurveSet::loadDataAndUpdate( bool updateParentPlot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleWellLogCurveSet::setParentQwtPlotNoReplot( QwtPlot* plot )
|
||||
void RimEnsembleWellLogCurveSet::setParentPlotNoReplot( RiuPlotWidget* plot )
|
||||
{
|
||||
for ( RimWellLogCurve* curve : m_curves )
|
||||
{
|
||||
curve->setParentQwtPlotNoReplot( plot );
|
||||
curve->setParentPlotNoReplot( plot );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleWellLogCurveSet::detachQwtCurves()
|
||||
void RimEnsembleWellLogCurveSet::detachPlotCurves()
|
||||
{
|
||||
for ( RimWellLogCurve* curve : m_curves )
|
||||
{
|
||||
curve->detachQwtCurve();
|
||||
curve->detach();
|
||||
}
|
||||
|
||||
m_qwtPlotCurveForLegendText->detach();
|
||||
@@ -242,11 +243,11 @@ void RimEnsembleWellLogCurveSet::detachQwtCurves()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleWellLogCurveSet::reattachQwtCurves()
|
||||
void RimEnsembleWellLogCurveSet::reattachPlotCurves()
|
||||
{
|
||||
for ( RimWellLogCurve* curve : m_curves )
|
||||
{
|
||||
curve->reattachQwtCurve();
|
||||
curve->reattach();
|
||||
}
|
||||
|
||||
m_qwtPlotCurveForLegendText->detach();
|
||||
@@ -255,7 +256,7 @@ void RimEnsembleWellLogCurveSet::reattachQwtCurves()
|
||||
firstAncestorOrThisOfType( plot );
|
||||
if ( plot )
|
||||
{
|
||||
m_qwtPlotCurveForLegendText->attach( plot->viewer() );
|
||||
m_qwtPlotCurveForLegendText->attach( plot->viewer()->qwtPlot() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -637,8 +638,8 @@ void RimEnsembleWellLogCurveSet::updateFilterLegend()
|
||||
{
|
||||
if ( !m_filterOverlayFrame )
|
||||
{
|
||||
m_filterOverlayFrame =
|
||||
new RiuDraggableOverlayFrame( plotTrack->viewer()->canvas(), plotTrack->viewer()->overlayMargins() );
|
||||
m_filterOverlayFrame = new RiuDraggableOverlayFrame( plotTrack->viewer()->qwtPlot()->canvas(),
|
||||
plotTrack->viewer()->overlayMargins() );
|
||||
}
|
||||
m_filterOverlayFrame->setContentFrame( m_ensembleCurveSet->curveFilters()->makeFilterDescriptionFrame() );
|
||||
plotTrack->viewer()->addOverlayFrame( m_filterOverlayFrame );
|
||||
@@ -735,8 +736,8 @@ void RimEnsembleWellLogCurveSet::updateCurveColors()
|
||||
{
|
||||
if ( !m_legendOverlayFrame )
|
||||
{
|
||||
m_legendOverlayFrame =
|
||||
new RiuDraggableOverlayFrame( plotTrack->viewer()->canvas(), plotTrack->viewer()->overlayMargins() );
|
||||
m_legendOverlayFrame = new RiuDraggableOverlayFrame( plotTrack->viewer()->getParentForOverlay(),
|
||||
plotTrack->viewer()->overlayMargins() );
|
||||
}
|
||||
m_legendOverlayFrame->setContentFrame( m_ensembleCurveSet->legendConfig()->makeLegendFrame() );
|
||||
plotTrack->viewer()->addOverlayFrame( m_legendOverlayFrame );
|
||||
@@ -780,7 +781,7 @@ void RimEnsembleWellLogCurveSet::updateEnsembleCurves( const std::vector<RimWell
|
||||
wellPathFormations = createWellPathFormations( offsets );
|
||||
}
|
||||
|
||||
m_qwtPlotCurveForLegendText->attach( plotTrack->viewer() );
|
||||
m_qwtPlotCurveForLegendText->attach( plotTrack->viewer()->qwtPlot() );
|
||||
|
||||
QString wellLogChannelName = m_wellLogChannelName();
|
||||
if ( plotTrack && wellLogChannelName != "None" )
|
||||
@@ -920,11 +921,13 @@ void RimEnsembleWellLogCurveSet::updateStatisticsCurves( const std::vector<RimWe
|
||||
}
|
||||
|
||||
auto statisticsCurveSymbolFromStatistics = []( RimEnsembleWellLogStatistics::StatisticsType statisticsType ) {
|
||||
if ( statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P10 ) return RiuQwtSymbol::SYMBOL_TRIANGLE;
|
||||
if ( statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P10 )
|
||||
return RiuPlotCurveSymbol::SYMBOL_TRIANGLE;
|
||||
if ( statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P90 )
|
||||
return RiuQwtSymbol::SYMBOL_DOWN_TRIANGLE;
|
||||
if ( statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P50 ) return RiuQwtSymbol::SYMBOL_DIAMOND;
|
||||
return RiuQwtSymbol::SYMBOL_ELLIPSE;
|
||||
return RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE;
|
||||
if ( statisticsType == RimEnsembleWellLogStatistics::StatisticsType::P50 )
|
||||
return RiuPlotCurveSymbol::SYMBOL_DIAMOND;
|
||||
return RiuPlotCurveSymbol::SYMBOL_ELLIPSE;
|
||||
};
|
||||
|
||||
RimWellLogTrack* plotTrack = nullptr;
|
||||
|
||||
@@ -51,6 +51,7 @@ class RimPlotCurveAppearance;
|
||||
class RigWellPathFormations;
|
||||
|
||||
class RiuDraggableOverlayFrame;
|
||||
class RiuPlotWidget;
|
||||
|
||||
class QwtPlot;
|
||||
class QwtPlotCurve;
|
||||
@@ -80,9 +81,9 @@ public:
|
||||
void setColor( cvf::Color3f color );
|
||||
|
||||
void loadDataAndUpdate( bool updateParentPlot );
|
||||
void setParentQwtPlotNoReplot( QwtPlot* plot );
|
||||
void detachQwtCurves();
|
||||
void reattachQwtCurves();
|
||||
void setParentPlotNoReplot( RiuPlotWidget* plot );
|
||||
void detachPlotCurves();
|
||||
void reattachPlotCurves();
|
||||
|
||||
std::vector<RimWellLogCurve*> curves() const;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "RimWellLogCurve.h"
|
||||
|
||||
#include "RiaCurveDataTools.h"
|
||||
#include "RiaPlotDefines.h"
|
||||
#include "RigWellLogCurveData.h"
|
||||
|
||||
#include "RimDepthTrackPlot.h"
|
||||
@@ -46,10 +47,6 @@ RimWellLogCurve::RimWellLogCurve()
|
||||
{
|
||||
CAF_PDM_InitObject( "WellLogCurve", ":/WellLogCurve16x16.png" );
|
||||
|
||||
m_qwtPlotCurve->setXAxis( QwtPlot::xTop );
|
||||
m_qwtCurveErrorBars->setXAxis( QwtPlot::xTop );
|
||||
m_qwtPlotCurve->setYAxis( QwtPlot::yLeft );
|
||||
|
||||
m_curveData = new RigWellLogCurveData;
|
||||
|
||||
m_curveDataXRange = std::make_pair( std::numeric_limits<double>::infinity(), -std::numeric_limits<double>::infinity() );
|
||||
@@ -179,11 +176,22 @@ const RigWellLogCurveData* RimWellLogCurve::curveData() const
|
||||
void RimWellLogCurve::updateCurveAppearance()
|
||||
{
|
||||
RimPlotCurve::updateCurveAppearance();
|
||||
|
||||
if ( m_plotCurve )
|
||||
{
|
||||
m_plotCurve->setXAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP );
|
||||
m_plotCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
||||
}
|
||||
|
||||
if ( fillStyle() != Qt::BrushStyle::NoBrush )
|
||||
{
|
||||
m_qwtPlotCurve->setOrientation( Qt::Horizontal );
|
||||
m_qwtPlotCurve->setBaseline( -std::numeric_limits<double>::infinity() );
|
||||
m_qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true );
|
||||
RiuQwtPlotCurve* qwtPlotCurve = dynamic_cast<RiuQwtPlotCurve*>( m_plotCurve );
|
||||
if ( qwtPlotCurve )
|
||||
{
|
||||
qwtPlotCurve->setOrientation( Qt::Horizontal );
|
||||
qwtPlotCurve->setBaseline( -std::numeric_limits<double>::infinity() );
|
||||
qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,10 +220,10 @@ void RimWellLogCurve::setOverrideCurveData( const std::vector<double>&
|
||||
{
|
||||
auto minmax_it = std::minmax_element( xValues.begin(), xValues.end() );
|
||||
this->setOverrideCurveDataXRange( *( minmax_it.first ), *( minmax_it.second ) );
|
||||
if ( m_qwtPlotCurve )
|
||||
if ( m_plotCurve )
|
||||
{
|
||||
m_qwtPlotCurve->setSamples( xValues.data(), depthValues.data(), static_cast<int>( depthValues.size() ) );
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices( curveIntervals );
|
||||
m_plotCurve->setSamplesValues( xValues, depthValues );
|
||||
m_plotCurve->setLineSegmentStartStopIndices( curveIntervals );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ void RimWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* cha
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
if ( isCurveVisible() )
|
||||
if ( isCurveVisible() && m_plotCurve )
|
||||
{
|
||||
bool isUsingPseudoLength = false;
|
||||
performDataExtraction( &isUsingPseudoLength );
|
||||
@@ -360,9 +360,9 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
std::vector<double> xPlotValues = curveData()->xPlotValues();
|
||||
std::vector<double> depthPlotValues = curveData()->depthPlotValues( depthType, displayUnit );
|
||||
CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() );
|
||||
m_qwtPlotCurve->setSamples( xPlotValues.data(), depthPlotValues.data(), static_cast<int>( xPlotValues.size() ) );
|
||||
m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, static_cast<int>( xPlotValues.size() ) );
|
||||
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
|
||||
m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
|
||||
|
||||
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||
|
||||
@@ -375,7 +375,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
RiuQwtPlotWidget* viewer = wellLogTrack->viewer();
|
||||
if ( viewer )
|
||||
{
|
||||
viewer->setAxisTitleText( QwtPlot::yLeft, "PL/" + wellLogPlot->depthAxisTitle() );
|
||||
viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PL/" + wellLogPlot->depthAxisTitle() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,9 +386,9 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
setLogScaleFromSelectedResult();
|
||||
|
||||
if ( m_parentQwtPlot )
|
||||
if ( m_parentPlot )
|
||||
{
|
||||
m_parentQwtPlot->replot();
|
||||
m_parentPlot->replot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
if ( m_isUsingAutoName )
|
||||
{
|
||||
m_qwtPlotCurve->setTitle( createCurveAutoName() );
|
||||
m_plotCurve->setTitle( createCurveAutoName() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,19 +188,18 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
depthType = wellLogPlot->depthType();
|
||||
}
|
||||
|
||||
m_qwtPlotCurve->setSamples( this->curveData()->xPlotValues().data(),
|
||||
this->curveData()->depthPlotValues( depthType, displayUnit ).data(),
|
||||
static_cast<int>( this->curveData()->xPlotValues().size() ) );
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
|
||||
m_plotCurve->setSamplesValues( this->curveData()->xPlotValues(),
|
||||
this->curveData()->depthPlotValues( depthType, displayUnit ) );
|
||||
m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
|
||||
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
updateZoomInParentPlot();
|
||||
}
|
||||
|
||||
if ( m_parentQwtPlot )
|
||||
if ( m_parentPlot )
|
||||
{
|
||||
m_parentQwtPlot->replot();
|
||||
m_parentPlot->replot();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,7 +314,7 @@ void RimWellLogFileCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
{
|
||||
this->loadDataAndUpdate( true );
|
||||
}
|
||||
if ( m_parentQwtPlot ) m_parentQwtPlot->replot();
|
||||
if ( m_parentPlot ) m_parentPlot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -396,7 +396,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
if ( values.empty() || values.size() != tvDepthVector.size() )
|
||||
{
|
||||
this->detachQwtCurve();
|
||||
this->detach();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
if ( wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::MEASURED_DEPTH )
|
||||
{
|
||||
m_qwtPlotCurve->setPerPointLabels( perPointLabels );
|
||||
m_plotCurve->setPerPointLabels( perPointLabels );
|
||||
|
||||
auto xValues = this->curveData()->xPlotValues();
|
||||
auto yValues = this->curveData()->depthPlotValues( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit );
|
||||
@@ -482,7 +482,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, keepOnlyPositiveValues );
|
||||
m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, keepOnlyPositiveValues );
|
||||
}
|
||||
|
||||
RimWellLogTrack* wellLogTrack;
|
||||
@@ -496,22 +496,24 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
if ( derivedMDSource == WELL_PATH )
|
||||
{
|
||||
viewer->setAxisTitleText( QwtPlot::yLeft, "WELL/" + wellLogPlot->depthAxisTitle() );
|
||||
viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
||||
"WELL/" + wellLogPlot->depthAxisTitle() );
|
||||
}
|
||||
else
|
||||
{
|
||||
viewer->setAxisTitleText( QwtPlot::yLeft, "OBS/" + wellLogPlot->depthAxisTitle() );
|
||||
viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
||||
"OBS/" + wellLogPlot->depthAxisTitle() );
|
||||
}
|
||||
}
|
||||
else // Standard depth title set from plot
|
||||
{
|
||||
viewer->setAxisTitleText( QwtPlot::yLeft, wellLogPlot->depthAxisTitle() );
|
||||
viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, wellLogPlot->depthAxisTitle() );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setPerPointLabels( perPointLabels );
|
||||
m_plotCurve->setPerPointLabels( perPointLabels );
|
||||
|
||||
auto xValues = this->curveData()->xPlotValues();
|
||||
auto yValues =
|
||||
@@ -528,20 +530,20 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_qwtPlotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve );
|
||||
m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve );
|
||||
}
|
||||
}
|
||||
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
|
||||
m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() );
|
||||
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
updateZoomInParentPlot();
|
||||
}
|
||||
|
||||
if ( m_parentQwtPlot )
|
||||
if ( m_parentPlot )
|
||||
{
|
||||
m_parentQwtPlot->replot();
|
||||
m_parentPlot->replot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ void RimWellLogTrack::detachAllPlotItems()
|
||||
{
|
||||
for ( RimPlotCurve* curve : m_curves )
|
||||
{
|
||||
curve->detachQwtCurve();
|
||||
curve->detach();
|
||||
}
|
||||
for ( auto& plotObjects : m_wellPathAttributePlotObjects )
|
||||
{
|
||||
@@ -493,7 +493,7 @@ void RimWellLogTrack::updateXZoom()
|
||||
componentRangeMax *= 1.5;
|
||||
}
|
||||
|
||||
m_plotWidget->setAxisRange( QwtPlot::xBottom, componentRangeMin, componentRangeMax );
|
||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, componentRangeMin, componentRangeMax );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -503,7 +503,7 @@ void RimWellLogTrack::updateYZoom()
|
||||
{
|
||||
if ( !m_plotWidget ) return;
|
||||
|
||||
m_plotWidget->setAxisRange( QwtPlot::yLeft, m_visibleDepthRangeMin(), m_visibleDepthRangeMax() );
|
||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, m_visibleDepthRangeMin(), m_visibleDepthRangeMax() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -540,8 +540,8 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_majorTickInterval = m_plotWidget->majorTickInterval( QwtPlot::xTop );
|
||||
m_minorTickInterval = m_plotWidget->minorTickInterval( QwtPlot::xTop );
|
||||
m_majorTickInterval = m_plotWidget->majorTickInterval( RiaDefines::PlotAxis::PLOT_AXIS_TOP );
|
||||
m_minorTickInterval = m_plotWidget->minorTickInterval( RiaDefines::PlotAxis::PLOT_AXIS_TOP );
|
||||
}
|
||||
m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() );
|
||||
m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() );
|
||||
@@ -762,13 +762,13 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
||||
bool emptyRange = isEmptyVisibleXRange();
|
||||
if ( emptyRange )
|
||||
{
|
||||
m_plotWidget->enableGridLines( QwtPlot::xTop, false, false );
|
||||
m_plotWidget->setAxisRange( QwtPlot::xTop, 0.0, 1.0 );
|
||||
m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::xTop, false, false );
|
||||
m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false, false );
|
||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP, 0.0, 1.0 );
|
||||
m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::xTop, true, true );
|
||||
m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP, true, true );
|
||||
if ( m_minAndMaxTicksOnly )
|
||||
{
|
||||
auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) {
|
||||
@@ -803,11 +803,11 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
||||
|
||||
div.setTicks( QwtScaleDiv::TickType::MajorTick, majorTicks );
|
||||
|
||||
m_plotWidget->setAxisScaleDiv( QwtPlot::xTop, div );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtPlot::xTop, div );
|
||||
}
|
||||
else if ( m_explicitTickIntervals )
|
||||
{
|
||||
m_plotWidget->setMajorAndMinorTickIntervals( QwtPlot::xTop,
|
||||
m_plotWidget->setMajorAndMinorTickIntervals( RiaDefines::PlotAxis::PLOT_AXIS_TOP,
|
||||
m_majorTickInterval(),
|
||||
m_minorTickInterval(),
|
||||
m_visibleXRangeMin(),
|
||||
@@ -817,11 +817,13 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
||||
{
|
||||
int majorTickIntervals = 5;
|
||||
int minorTickIntervals = 10;
|
||||
m_plotWidget->setAutoTickIntervalCounts( QwtPlot::xTop, majorTickIntervals, minorTickIntervals );
|
||||
m_plotWidget->setAxisRange( QwtPlot::xTop, m_visibleXRangeMin, m_visibleXRangeMax );
|
||||
m_plotWidget->setAutoTickIntervalCounts( RiaDefines::PlotAxis::PLOT_AXIS_TOP,
|
||||
majorTickIntervals,
|
||||
minorTickIntervals );
|
||||
m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP, m_visibleXRangeMin, m_visibleXRangeMax );
|
||||
}
|
||||
|
||||
m_plotWidget->enableGridLines( QwtPlot::xTop,
|
||||
m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_TOP,
|
||||
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR,
|
||||
m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR );
|
||||
}
|
||||
@@ -830,7 +832,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
|
||||
this->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
m_plotWidget->enableGridLines( QwtPlot::yLeft,
|
||||
m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_LEFT,
|
||||
wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR,
|
||||
wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR );
|
||||
}
|
||||
@@ -1004,15 +1006,15 @@ QString RimWellLogTrack::asciiDataForPlotExport() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::updateZoomFromQwt()
|
||||
void RimWellLogTrack::updateZoomFromParentPlot()
|
||||
{
|
||||
QwtInterval xInterval = m_plotWidget->axisRange( QwtPlot::xTop );
|
||||
QwtInterval depthInterval = m_plotWidget->axisRange( QwtPlot::yLeft );
|
||||
auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP );
|
||||
auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT );
|
||||
|
||||
m_visibleXRangeMin = xInterval.minValue();
|
||||
m_visibleXRangeMax = xInterval.maxValue();
|
||||
m_visibleDepthRangeMin = depthInterval.minValue();
|
||||
m_visibleDepthRangeMax = depthInterval.maxValue();
|
||||
m_visibleXRangeMin = xIntervalMin;
|
||||
m_visibleXRangeMax = xIntervalMax;
|
||||
m_visibleDepthRangeMin = depthIntervalMin;
|
||||
m_visibleDepthRangeMax = depthIntervalMax;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1120,7 +1122,7 @@ void RimWellLogTrack::addCurve( RimWellLogCurve* curve )
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
curve->setParentQwtPlotAndReplot( m_plotWidget );
|
||||
curve->setParentPlotAndReplot( m_plotWidget );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1141,7 +1143,7 @@ void RimWellLogTrack::insertCurve( RimWellLogCurve* curve, size_t index )
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
curve->setParentQwtPlotAndReplot( m_plotWidget );
|
||||
curve->setParentPlotAndReplot( m_plotWidget );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1154,7 +1156,7 @@ void RimWellLogTrack::removeCurve( RimWellLogCurve* curve )
|
||||
size_t index = m_curves.index( curve );
|
||||
if ( index < m_curves.size() )
|
||||
{
|
||||
m_curves[index]->detachQwtCurve();
|
||||
m_curves[index]->detach();
|
||||
m_curves.removeChildObject( curve );
|
||||
}
|
||||
}
|
||||
@@ -1226,8 +1228,8 @@ void RimWellLogTrack::onLoadDataAndUpdate()
|
||||
|
||||
if ( wellLogPlot && m_plotWidget )
|
||||
{
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::xTop, m_xAxisTitle );
|
||||
m_plotWidget->setAxisTitleText( QwtPlot::yLeft, wellLogPlot->depthAxisTitle() );
|
||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_TOP, m_xAxisTitle );
|
||||
m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, wellLogPlot->depthAxisTitle() );
|
||||
}
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
||||
@@ -1500,17 +1502,17 @@ RimWellLogTrack::TrajectoryType RimWellLogTrack::formationTrajectoryType() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuQwtPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
||||
RiuPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParent )
|
||||
{
|
||||
if ( m_plotWidget == nullptr )
|
||||
{
|
||||
m_plotWidget = new RiuWellLogTrack( this, mainWindowParent );
|
||||
m_plotWidget->setAxisInverted( QwtPlot::yLeft );
|
||||
m_plotWidget->setAxisInverted( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true );
|
||||
updateAxisScaleEngine();
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
||||
{
|
||||
m_curves[cIdx]->setParentQwtPlotNoReplot( this->m_plotWidget );
|
||||
m_curves[cIdx]->setParentPlotNoReplot( m_plotWidget );
|
||||
}
|
||||
}
|
||||
return m_plotWidget;
|
||||
@@ -1539,8 +1541,9 @@ void RimWellLogTrack::reattachAllCurves()
|
||||
{
|
||||
for ( RimPlotCurve* curve : m_curves )
|
||||
{
|
||||
curve->reattachQwtCurve();
|
||||
curve->reattach();
|
||||
}
|
||||
|
||||
for ( auto& plotObjects : m_wellPathAttributePlotObjects )
|
||||
{
|
||||
plotObjects->reattachToQwt();
|
||||
@@ -1597,7 +1600,7 @@ void RimWellLogTrack::setVisibleYRange( double minValue, double maxValue )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::updateZoomInQwt()
|
||||
void RimWellLogTrack::updateZoomInParentPlot()
|
||||
{
|
||||
updateXZoom();
|
||||
updateYZoom();
|
||||
@@ -1767,6 +1770,14 @@ RiuQwtPlotWidget* RimWellLogTrack::viewer()
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuPlotWidget* RimWellLogTrack::plotWidget()
|
||||
{
|
||||
return m_plotWidget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1790,17 +1801,17 @@ void RimWellLogTrack::zoomAll()
|
||||
{
|
||||
setAutoScaleXEnabled( true );
|
||||
setAutoScaleYEnabled( true );
|
||||
updateZoomInQwt();
|
||||
updateZoomInParentPlot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RimWellLogTrack::findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const
|
||||
caf::PdmObject* RimWellLogTrack::findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const
|
||||
{
|
||||
for ( size_t idx = 0; idx < m_curves.size(); idx++ )
|
||||
{
|
||||
if ( m_curves[idx]->qwtPlotCurve() == curve )
|
||||
if ( m_curves[idx]->isSameCurve( curve ) )
|
||||
{
|
||||
return m_curves[idx];
|
||||
}
|
||||
@@ -1965,17 +1976,17 @@ void RimWellLogTrack::updateAxisScaleEngine()
|
||||
|
||||
if ( m_isLogarithmicScaleEnabled )
|
||||
{
|
||||
m_plotWidget->setAxisScaleEngine( QwtPlot::xTop, new QwtLogScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new QwtLogScaleEngine );
|
||||
|
||||
// NB! Must assign scale engine to bottom in order to make QwtPlotGrid work
|
||||
m_plotWidget->setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->setAxisScaleEngine( QwtPlot::xTop, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new RiuQwtLinearScaleEngine );
|
||||
|
||||
// NB! Must assign scale engine to bottom in order to make QwtPlotGrid work
|
||||
m_plotWidget->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine );
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2030,7 +2041,7 @@ void RimWellLogTrack::handleWheelEvent( QWheelEvent* event )
|
||||
{
|
||||
if ( event->modifiers() & Qt::ControlModifier )
|
||||
{
|
||||
QwtScaleMap scaleMap = m_plotWidget->canvasMap( QwtPlot::yLeft );
|
||||
QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::yLeft );
|
||||
double zoomCenter = scaleMap.invTransform( event->pos().y() );
|
||||
|
||||
if ( event->delta() > 0 )
|
||||
@@ -2606,7 +2617,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
|
||||
std::vector<double> convertedYValues =
|
||||
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
|
||||
|
||||
m_annotationTool->attachWellPicks( m_plotWidget, formationNamesToPlot, convertedYValues );
|
||||
m_annotationTool->attachWellPicks( m_plotWidget->qwtPlot(), formationNamesToPlot, convertedYValues );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2674,7 +2685,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
|
||||
const std::vector<std::pair<double, double>> convertedYValues =
|
||||
RiaWellLogUnitTools<double>::convertDepths( waterAndRockIntervals, fromDepthUnit, toDepthUnit );
|
||||
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget,
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
{ "Sea Level", "" },
|
||||
xRange,
|
||||
convertedYValues,
|
||||
@@ -2686,7 +2697,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
|
||||
{ Qt::SolidPattern, Qt::Dense6Pattern } );
|
||||
}
|
||||
|
||||
if ( m_formationSource == CASE )
|
||||
if ( m_formationSource == CASE && m_plotWidget )
|
||||
{
|
||||
if ( ( m_formationSimWellName == QString( "None" ) && m_formationWellPathForSourceCase == nullptr ) ||
|
||||
m_formationCase == nullptr )
|
||||
@@ -2719,7 +2730,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
|
||||
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
|
||||
|
||||
caf::ColorTable colorTable( m_colorShadingLegend->colorArray() );
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget,
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
formationNamesToPlot,
|
||||
xRange,
|
||||
convertedYValues,
|
||||
@@ -2847,7 +2858,7 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot()
|
||||
int fontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(),
|
||||
m_regionLabelFontSize() );
|
||||
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget,
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
namesToPlot,
|
||||
xRange,
|
||||
convertedYValues,
|
||||
@@ -2924,7 +2935,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
|
||||
std::vector<std::pair<double, double>> convertedYValues =
|
||||
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
|
||||
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget,
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
sourceNamesToPlot,
|
||||
xRange,
|
||||
convertedYValues,
|
||||
@@ -2955,7 +2966,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
|
||||
std::vector<std::pair<double, double>> convertedYValues =
|
||||
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
|
||||
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget,
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
sourceNamesToPlot,
|
||||
xRange,
|
||||
convertedYValues,
|
||||
@@ -2985,7 +2996,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot()
|
||||
std::vector<std::pair<double, double>> convertedYValues =
|
||||
RiaWellLogUnitTools<double>::convertDepths( yValues, fromDepthUnit, toDepthUnit );
|
||||
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget,
|
||||
m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(),
|
||||
sourceNamesToPlot,
|
||||
xRange,
|
||||
convertedYValues,
|
||||
@@ -3084,7 +3095,7 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
|
||||
attributePlotObject->setDepthType( depthType );
|
||||
attributePlotObject->setShowLabel( m_showWellPathComponentLabels() );
|
||||
attributePlotObject->loadDataAndUpdate( false );
|
||||
attributePlotObject->setParentQwtPlotNoReplot( m_plotWidget );
|
||||
attributePlotObject->setParentPlotNoReplot( m_plotWidget->qwtPlot() );
|
||||
}
|
||||
}
|
||||
updateXZoom();
|
||||
@@ -3117,7 +3128,7 @@ void RimWellLogTrack::onChildDeleted( caf::PdmChildArrayFieldHandle* childA
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
setAutoScaleXEnabled( true );
|
||||
updateZoomInQwt();
|
||||
updateZoomInParentPlot();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateWellLogPlotToolBar();
|
||||
}
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "qwt_plot.h"
|
||||
|
||||
#include <QPointer>
|
||||
|
||||
#include <map>
|
||||
@@ -58,8 +56,6 @@ class RimEclipseResultDefinition;
|
||||
class RimColorLegend;
|
||||
class RimEnsembleWellLogCurveSet;
|
||||
|
||||
class QwtPlotCurve;
|
||||
|
||||
struct CurveSamplingPointData
|
||||
{
|
||||
std::vector<double> data;
|
||||
@@ -97,7 +93,8 @@ public:
|
||||
~RimWellLogTrack() override;
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
RiuQwtPlotWidget* viewer() override;
|
||||
RiuQwtPlotWidget* viewer();
|
||||
RiuPlotWidget* plotWidget() override;
|
||||
QImage snapshotWindowContent() override;
|
||||
void zoomAll() override;
|
||||
|
||||
@@ -153,8 +150,8 @@ public:
|
||||
void setVisibleXRange( double minValue, double maxValue );
|
||||
void setVisibleYRange( double minValue, double maxValue );
|
||||
|
||||
void updateZoomInQwt() override;
|
||||
void updateZoomFromQwt() override;
|
||||
void updateZoomInParentPlot() override;
|
||||
void updateZoomFromParentPlot() override;
|
||||
|
||||
void updateParentPlotZoom();
|
||||
|
||||
@@ -188,7 +185,7 @@ public:
|
||||
|
||||
RimWellPath* wellPathAttributeSource() const;
|
||||
|
||||
caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
|
||||
caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override;
|
||||
|
||||
void setLogarithmicScale( bool enable );
|
||||
bool isLogarithmicScale() const;
|
||||
@@ -241,7 +238,7 @@ protected:
|
||||
void onLoadDataAndUpdate() override;
|
||||
|
||||
private:
|
||||
RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override;
|
||||
|
||||
void cleanupBeforeClose();
|
||||
void detachAllPlotItems();
|
||||
|
||||
Reference in New Issue
Block a user