#5174 Paint non-filled plot symbols with curve color rather than edge color

This commit is contained in:
Gaute Lindkvist 2019-12-04 09:37:41 +01:00
parent 28a0a3ad06
commit f795dfcf11
4 changed files with 27 additions and 15 deletions

View File

@ -494,14 +494,6 @@ void RimPlotCurve::updateLegendsInPlot()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlotCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
throw std::logic_error( "The method or operation is not implemented." );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -578,7 +570,10 @@ void RimPlotCurve::appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_curveColor );
uiOrdering.add( &m_pointSymbol );
uiOrdering.add( &m_symbolEdgeColor );
if ( !RiuQwtSymbol::isFilledSymbol( m_pointSymbol() ) )
{
uiOrdering.add( &m_symbolEdgeColor );
}
uiOrdering.add( &m_symbolSize );
uiOrdering.add( &m_symbolSkipPixelDistance );
uiOrdering.add( &m_lineStyle );
@ -672,13 +667,21 @@ void RimPlotCurve::updateCurveAppearance()
symbol->setSize( m_symbolSize, m_symbolSize );
symbol->setColor( curveColor );
QColor symbolEdgeColor( m_symbolEdgeColor.value().rByte(),
m_symbolEdgeColor.value().gByte(),
m_symbolEdgeColor.value().bByte() );
// If the symbol is a "filled" symbol, we can have a different edge color
// Otherwise we'll have to use the curve color.
if ( RiuQwtSymbol::isFilledSymbol( m_pointSymbol() ) )
{
QColor symbolEdgeColor( m_symbolEdgeColor.value().rByte(),
m_symbolEdgeColor.value().gByte(),
m_symbolEdgeColor.value().bByte() );
symbol->setPen( symbolEdgeColor );
symbol->setPen( symbolEdgeColor );
}
else
{
symbol->setPen( curveColor );
}
}
m_qwtPlotCurve->setAppearance( m_lineStyle(), m_curveInterpolation(), m_curveThickness(), curveColor );
m_qwtPlotCurve->setSymbol( symbol );
m_qwtPlotCurve->setSymbolSkipPixelDistance( m_symbolSkipPixelDistance() );

View File

@ -122,7 +122,6 @@ protected:
void updateOptionSensitivity();
void updatePlotTitle();
virtual void updateLegendsInPlot();
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void setSamplesFromXYErrorValues( const std::vector<double>& xValues,
const std::vector<double>& yValues,

View File

@ -217,6 +217,14 @@ RiuQwtSymbol::PointSymbolEnum RiuQwtSymbol::cycledSymbolStyle( int indexLevel )
return contrastingSymbols[indexLevel % (int)contrastingSymbols.size()];
}
//--------------------------------------------------------------------------------------------------
/// Is this a symbol with an interior and a border? If false, it is just lines.
//--------------------------------------------------------------------------------------------------
bool RiuQwtSymbol::isFilledSymbol( PointSymbolEnum symbol )
{
return symbol != SYMBOL_NONE && symbol != SYMBOL_CROSS && symbol != SYMBOL_XCROSS && symbol != SYMBOL_STAR1;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -72,6 +72,8 @@ public:
static PointSymbolEnum cycledSymbolStyle( int indexLevel1, int indexLevel2 );
static PointSymbolEnum cycledSymbolStyle( int indexLevel );
static bool isFilledSymbol( PointSymbolEnum symbol );
private:
QRect labelBoundingRect( const QPainter* painter, const QRect& symbolRect, const QString& label ) const;