Adjustments for RC2

* Add dependency to Svg
* Renaming
* Remove special handling of bright colored curves
For some ensemble cases, the curve highlight does not work well. A prototype for ensemble curve highlight was introduced, but this was not working for a collection of standalone summary curves.
* Set version to RC_02
This commit is contained in:
Magne Sjaastad
2022-09-06 15:29:10 +02:00
parent 5014d7ddf7
commit e1dda4c6b3
8 changed files with 18 additions and 65 deletions

View File

@@ -925,8 +925,8 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem
RiuPlotMainWindowTools::showPlotMainWindow();
if ( closestItem && distanceFromClick < 20 )
{
bool refreshCurveOrder = false;
resetPlotItemHighlighting( refreshCurveOrder );
bool updateCurveOrder = false;
resetPlotItemHighlighting( updateCurveOrder );
std::set<const QwtPlotItem*> plotItems = { closestItem };
highlightPlotItems( plotItems );
auto plotItem = std::make_shared<RiuQwtPlotItem>( closestItem );
@@ -963,53 +963,6 @@ void RiuQwtPlotWidget::replot()
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::highlightPlotItems( const std::set<const QwtPlotItem*>& closestItems )
{
if ( closestItems.size() == 1 )
{
auto* constPlotCurve = dynamic_cast<const QwtPlotCurve*>( *closestItems.begin() );
auto* plotCurve = const_cast<QwtPlotCurve*>( constPlotCurve );
if ( plotCurve )
{
auto curveColor = plotCurve->pen().color();
if ( RiaColorTools::isBrightnessAboveThreshold( RiaColorTools::fromQColorTo3f( curveColor ) ) )
{
// The brightness of selected curve is above threshold. Modify the saturation, and leave the other
// curves unchanged
QColor symbolColor;
QColor symbolLineColor;
auto* symbol = const_cast<QwtSymbol*>( plotCurve->symbol() );
if ( symbol )
{
symbolColor = symbol->brush().color();
symbolLineColor = symbol->pen().color();
}
double zValue = plotCurve->z();
plotCurve->setZ( zValue + 100.0 );
highlightPlotAxes( plotCurve->xAxis(), plotCurve->yAxis() );
auto hightlightColor = curveColor;
qreal h, s, v;
hightlightColor.getHsvF( &h, &s, &v );
hightlightColor.setHsvF( h, 0.95, v );
auto curveWidth = plotCurve->pen().width();
plotCurve->setPen( hightlightColor,
plotCurve->pen().width() + highlightItemWidthAdjustment(),
plotCurve->pen().style() );
CurveProperties properties = { curveColor, symbolColor, symbolLineColor, curveWidth };
m_originalCurveProperties.insert( std::make_pair( plotCurve, properties ) );
m_originalZValues.insert( std::make_pair( plotCurve, zValue ) );
restoreCurveOrder();
return;
}
}
}
auto plotItemList = m_plot->itemList();
for ( QwtPlotItem* plotItem : plotItemList )
{
@@ -1070,13 +1023,13 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set<const QwtPlotItem*>& c
}
}
restoreCurveOrder();
updateCurveOrder();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::resetPlotItemHighlighting( bool refreshCurveOrder )
void RiuQwtPlotWidget::resetPlotItemHighlighting( bool doUpdateCurveOrder )
{
auto plotItemList = m_plot->itemList();
for ( QwtPlotItem* plotItem : plotItemList )
@@ -1118,7 +1071,7 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting( bool refreshCurveOrder )
resetPlotAxisHighlighting();
if ( refreshCurveOrder ) restoreCurveOrder();
if ( doUpdateCurveOrder ) updateCurveOrder();
}
//--------------------------------------------------------------------------------------------------
@@ -1539,7 +1492,7 @@ void RiuQwtPlotWidget::onLegendClicked( const QVariant& itemInfo, int index )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::restoreCurveOrder()
void RiuQwtPlotWidget::updateCurveOrder()
{
emit curveOrderNeedsUpdate();
}

View File

@@ -215,14 +215,14 @@ private:
void highlightPlotAxes( QwtAxisId axisIdX, QwtAxisId axisIdY );
void highlightPlotItemsForQwtAxis( QwtAxisId axisId );
void highlightPlotItems( const std::set<const QwtPlotItem*>& closestItems );
void resetPlotItemHighlighting( bool refreshCurveOrder = true );
void resetPlotItemHighlighting( bool doUpdateCurveOrder = true );
void resetPlotAxisHighlighting();
void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection );
void recalculateAxisExtents( RiuPlotAxis axis );
static int highlightItemWidthAdjustment();
void restoreCurveOrder();
void updateCurveOrder();
private:
struct CurveProperties