From: ouv Date: Mon, 4 Jul 2011 10:43:40 +0000 (+0000) Subject: To prevent drawing black frames around the markers symbols during the print operation. X-Git-Tag: DIAGRAM_1_0~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8b4f4d413ab123afc8c39a04ea7e15635819ef41;p=modules%2Fgui.git To prevent drawing black frames around the markers symbols during the print operation. --- diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 5d3c36c89..420103f47 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -608,7 +608,7 @@ void Plot2d_ViewFrame::displayCurve( Plot2d_Curve* curve, bool update ) aPCurve->setPen( QPen( color, DEFAULT_LINE_WIDTH, typeLine ) ); aPCurve->setSymbol( QwtSymbol( typeMarker, QBrush( color ), - QPen( color ), + QPen( color, 1 ), // width's set to 1 for correct printing QSize( myMarkerSize, myMarkerSize ) ) ); curve->setColor( color ); curve->setLine( Plot2d::qwt2plotLine( typeLine ) ); @@ -621,7 +621,7 @@ void Plot2d_ViewFrame::displayCurve( Plot2d_Curve* curve, bool update ) aPCurve->setPen( QPen( curve->getColor(), curve->getLineWidth(), ps ) ); aPCurve->setSymbol( QwtSymbol( ms, QBrush( curve->getColor() ), - QPen( curve->getColor() ), + QPen( curve->getColor(), 1 ), // width's set to 1 for correct printing QSize( myMarkerSize, myMarkerSize ) ) ); myPlot->setCurveNbMarkers( curve, curve->getNbMarkers() ); } @@ -707,7 +707,7 @@ void Plot2d_ViewFrame::updateCurve( Plot2d_Curve* curve, bool update ) aPCurve->setPen ( QPen( curve->getColor(), curve->getLineWidth(), ps ) ); aPCurve->setSymbol( QwtSymbol( ms, QBrush( curve->getColor() ), - QPen( curve->getColor() ), + QPen( curve->getColor(), 1 ), // width's set to 1 for correct printing QSize( myMarkerSize, myMarkerSize ) ) ); aPCurve->setData( curve->horData(), curve->verData(), curve->nbPoints() ); Plot2d_PlotCurve* aPlot2dCurve = dynamic_cast< Plot2d_PlotCurve* >( aPCurve ); @@ -2579,3 +2579,30 @@ bool Plot2d_ViewFrame::getAutoUpdateTitle( const ObjectType type ) const } } +/*! + Restores pen's width of marker symbols to 1 +*/ +void Plot2d_ViewFrame::updateSymbols() +{ + curveList aList; + getCurves( aList ); + + curveList::iterator anIter, anIterEnd = aList.end(); + for( anIter = aList.begin(); anIter != anIterEnd; anIter++ ) + { + if( Plot2d_Curve* aCurve = *anIter ) + { + if( QwtPlotCurve* aPCurve = getPlotCurve( aCurve ) ) + { + QwtSymbol aSymbol = aPCurve->symbol(); + QPen aPen = aSymbol.pen(); + if( aPen.width() == 0 ) + { + aPen.setWidth( 1 ); + aSymbol.setPen( aPen ); + aPCurve->setSymbol( aSymbol ); + } + } + } + } +} diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index 9678b57c8..9d0c2c23b 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -141,6 +141,8 @@ public: void setAutoUpdateTitle( const ObjectType type, const bool upd ); bool getAutoUpdateTitle( const ObjectType type ) const; + void updateSymbols(); + protected: int testOperation( const QMouseEvent& ); void readPreferences(); diff --git a/src/Plot2d/Plot2d_ViewWindow.cxx b/src/Plot2d/Plot2d_ViewWindow.cxx index fa4906c7a..9c7b9e224 100755 --- a/src/Plot2d/Plot2d_ViewWindow.cxx +++ b/src/Plot2d/Plot2d_ViewWindow.cxx @@ -606,6 +606,12 @@ void Plot2d_ViewWindow::onDumpView() void Plot2d_ViewWindow::onPrintView() { myViewFrame->print(); + + // This method is called to restore pen's width for all curves' marker symbols + // to 1 instead of zero values set somewhere in QwtPlot::print() (presumably, + // by QwtPlotPrintFilter), and, correspondingly, to prevent drawing black frames + // around the symbols during the next printing. + myViewFrame->updateSymbols(); } /*!