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:
Kristian Bendiksen
2022-01-17 13:14:21 +01:00
committed by GitHub
parent d9bb82de91
commit 258fbddc10
145 changed files with 7245 additions and 2932 deletions

View File

@@ -180,15 +180,25 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot )
double posMax = 0.75 + m_columnOffset;
addColumnFeature( -posMax, -posMin, startDepth, endDepth, componentColor() );
addColumnFeature( posMin, posMax, startDepth, endDepth, componentColor() );
addMarker( -posMax, endDepth, 12, RiuQwtSymbol::SYMBOL_LEFT_ANGLED_TRIANGLE, componentColor() );
addMarker( posMax, endDepth, 12, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor() );
addMarker( casingTrackEnd, endDepth, 12, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor( 0.0 ), label() );
addMarker( -posMax, endDepth, 12, RiuPlotCurveSymbol::SYMBOL_LEFT_ANGLED_TRIANGLE, componentColor() );
addMarker( posMax, endDepth, 12, RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor() );
addMarker( casingTrackEnd,
endDepth,
12,
RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE,
componentColor( 0.0 ),
label() );
}
else if ( m_componentType == RiaDefines::WellPathComponentType::LINER )
{
addColumnFeature( -0.5, -0.25, startDepth, endDepth, componentColor() );
addColumnFeature( 0.25, 0.5, startDepth, endDepth, componentColor() );
addMarker( casingTrackEnd, endDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor( 0.0 ), label() );
addMarker( casingTrackEnd,
endDepth,
10,
RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE,
componentColor( 0.0 ),
label() );
}
else if ( m_componentType == RiaDefines::WellPathComponentType::PERFORATION_INTERVAL )
{
@@ -200,18 +210,31 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot )
double markerDepth = startDepth;
while ( markerDepth < endDepth - 5 )
{
addMarker( -casingTrackEnd, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_LEFT_ALIGNED_TRIANGLE, componentColor() );
addMarker( casingTrackEnd, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor() );
addMarker( -casingTrackEnd,
markerDepth,
markerSize,
RiuPlotCurveSymbol::SYMBOL_LEFT_ALIGNED_TRIANGLE,
componentColor() );
addMarker( casingTrackEnd,
markerDepth,
markerSize,
RiuPlotCurveSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE,
componentColor() );
markerDepth += markerSpacing;
}
addMarker( casingTrackEnd, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor( 0.0 ), label() );
addMarker( casingTrackEnd,
midDepth,
10,
RiuPlotCurveSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE,
componentColor( 0.0 ),
label() );
QwtPlotItem* legendItem1 =
createMarker( 16.0, 0.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor() );
createMarker( 16.0, 0.0, 6, RiuPlotCurveSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor() );
legendItem1->setLegendIconSize( QSize( 4, 8 ) );
QwtPlotItem* legendItem2 =
createMarker( 16.0, 8.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor() );
createMarker( 16.0, 8.0, 6, RiuPlotCurveSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor() );
legendItem2->setLegendIconSize( QSize( 4, 8 ) );
m_combinedComponentGroup.addLegendItem( legendItem1 );
m_combinedComponentGroup.addLegendItem( legendItem2 );
@@ -220,7 +243,12 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot )
{
addColumnFeature( -casingTrackEnd, -0.25, startDepth, endDepth, componentColor(), Qt::BDiagPattern );
addColumnFeature( 0.25, casingTrackEnd, startDepth, endDepth, componentColor(), Qt::FDiagPattern );
addMarker( casingTrackEnd, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor( 0.0 ), label() );
addMarker( casingTrackEnd,
midDepth,
10,
RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE,
componentColor( 0.0 ),
label() );
}
else if ( m_componentType == RiaDefines::WellPathComponentType::FRACTURE )
{
@@ -229,7 +257,7 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot )
addMarker( casingTrackEnd,
startDepth,
10,
RiuQwtSymbol::SYMBOL_NONE,
RiuPlotCurveSymbol::SYMBOL_NONE,
componentColor(),
"",
Qt::AlignTop | Qt::AlignRight,
@@ -238,7 +266,7 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot )
addMarker( casingTrackEnd,
endDepth,
10,
RiuQwtSymbol::SYMBOL_NONE,
RiuPlotCurveSymbol::SYMBOL_NONE,
componentColor(),
"",
Qt::AlignTop | Qt::AlignRight,
@@ -247,7 +275,7 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot )
addMarker( casingTrackEnd,
startDepth,
1,
RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE,
RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE,
componentColor( 0.0f ),
label(),
Qt::AlignTop | Qt::AlignRight );
@@ -256,34 +284,66 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot )
{
for ( double md : m_subMDs )
{
addMarker( 0.0, md, 16, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), "", Qt::AlignCenter, Qt::Horizontal, false, true );
addMarker( 0.0,
md,
16,
RiuPlotCurveSymbol::SYMBOL_ELLIPSE,
componentColor(),
"",
Qt::AlignCenter,
Qt::Horizontal,
false,
true );
}
m_combinedComponentGroup.addLegendItem(
createMarker( 0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor() ) );
createMarker( 0.0, 0.0, 12.0, RiuPlotCurveSymbol::SYMBOL_ELLIPSE, componentColor() ) );
}
else if ( m_componentType == RiaDefines::WellPathComponentType::ICV )
{
for ( double md : m_subMDs )
{
addMarker( 0.0, md, 16, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), "", Qt::AlignCenter, Qt::Horizontal, false, true );
addMarker( 0.0,
md,
16,
RiuPlotCurveSymbol::SYMBOL_ELLIPSE,
componentColor(),
"",
Qt::AlignCenter,
Qt::Horizontal,
false,
true );
}
m_combinedComponentGroup.addLegendItem(
createMarker( 0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor() ) );
createMarker( 0.0, 0.0, 12.0, RiuPlotCurveSymbol::SYMBOL_ELLIPSE, componentColor() ) );
}
else if ( m_componentType == RiaDefines::WellPathComponentType::AICD )
{
for ( double md : m_subMDs )
{
addMarker( 0.0, md, 16, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), "", Qt::AlignCenter, Qt::Horizontal, false, true );
addMarker( 0.0,
md,
16,
RiuPlotCurveSymbol::SYMBOL_ELLIPSE,
componentColor(),
"",
Qt::AlignCenter,
Qt::Horizontal,
false,
true );
}
m_combinedComponentGroup.addLegendItem(
createMarker( 0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor() ) );
createMarker( 0.0, 0.0, 12.0, RiuPlotCurveSymbol::SYMBOL_ELLIPSE, componentColor() ) );
}
else if ( m_componentType == RiaDefines::WellPathComponentType::PACKER )
{
addColumnFeature( -1.1 * casingTrackEnd, -0.25, startDepth, endDepth, componentColor(), Qt::DiagCrossPattern );
addColumnFeature( 0.25, 1.1 * casingTrackEnd, startDepth, endDepth, componentColor(), Qt::DiagCrossPattern );
addMarker( casingTrackEnd, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor( 0.0 ), label() );
addMarker( casingTrackEnd,
midDepth,
10,
RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE,
componentColor( 0.0 ),
label() );
}
m_combinedComponentGroup.setTitle( legendTitle() );
m_combinedComponentGroup.setLegendIconSize( QSize( 20, 16 ) );
@@ -335,16 +395,16 @@ std::pair<double, double> RiuWellPathComponentPlotItem::depthsOfDepthType() cons
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathComponentPlotItem::addMarker( double posX,
double depth,
int size,
RiuQwtSymbol::PointSymbolEnum symbolType,
cvf::Color4f baseColor,
const QString& label /*= QString("")*/,
Qt::Alignment labelAlignment /*= Qt::AlignTop*/,
Qt::Orientation labelOrientation /*= Qt::Vertical*/,
bool drawLine /*= false*/,
bool contrastTextColor /*= true*/ )
void RiuWellPathComponentPlotItem::addMarker( double posX,
double depth,
int size,
RiuPlotCurveSymbol::PointSymbolEnum symbolType,
cvf::Color4f baseColor,
const QString& label /*= QString("")*/,
Qt::Alignment labelAlignment /*= Qt::AlignTop*/,
Qt::Orientation labelOrientation /*= Qt::Vertical*/,
bool drawLine /*= false*/,
bool contrastTextColor /*= true*/ )
{
QwtPlotItem* marker =
createMarker( posX, depth, size, symbolType, baseColor, label, labelAlignment, labelOrientation, drawLine, contrastTextColor );
@@ -354,12 +414,12 @@ void RiuWellPathComponentPlotItem::addMarker( double posX
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QwtPlotItem* RiuWellPathComponentPlotItem::createMarker( double posX,
double depth,
int size,
RiuQwtSymbol::PointSymbolEnum symbolType,
cvf::Color4f baseColor,
const QString& label /*= QString("")*/,
QwtPlotItem* RiuWellPathComponentPlotItem::createMarker( double posX,
double depth,
int size,
RiuPlotCurveSymbol::PointSymbolEnum symbolType,
cvf::Color4f baseColor,
const QString& label /*= QString("")*/,
Qt::Alignment labelAlignment /*= Qt::AlignTop*/,
Qt::Orientation labelOrientation /*= Qt::Vertical*/,
bool drawLine /*= false*/,
@@ -372,8 +432,8 @@ QwtPlotItem* RiuWellPathComponentPlotItem::createMarker( double
textColor = RiaColorTools::toQColor( RiaColorTools::contrastColor( baseColor.toColor3f() ) );
}
QwtPlotMarker* marker = new QwtPlotMarker( label );
RiuQwtSymbol* symbol = new RiuQwtSymbol( symbolType, "", RiuQwtSymbol::LabelRightOfSymbol );
symbol->setSize( size );
RiuQwtSymbol* symbol = new RiuQwtSymbol( symbolType, "", RiuPlotCurveSymbol::LabelRightOfSymbol );
symbol->setSize( size, size );
symbol->setColor( bgColor );
marker->setSymbol( symbol );
marker->setSpacing( 6 );
@@ -512,7 +572,7 @@ void RiuWellPathComponentPlotItem::setContributeToLegend( bool contributeToLegen
//--------------------------------------------------------------------------------------------------
void RiuWellPathComponentPlotItem::setParentQwtPlotAndReplot( QwtPlot* plot )
{
setParentQwtPlotNoReplot( plot );
setParentPlotNoReplot( plot );
if ( m_parentQwtPlot )
{
m_parentQwtPlot->replot();
@@ -522,7 +582,7 @@ void RiuWellPathComponentPlotItem::setParentQwtPlotAndReplot( QwtPlot* plot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPathComponentPlotItem::setParentQwtPlotNoReplot( QwtPlot* plot )
void RiuWellPathComponentPlotItem::setParentPlotNoReplot( QwtPlot* plot )
{
m_parentQwtPlot = plot;
attachToQwt();