X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_PrsImage.cxx;h=172f5f72b41b7b4a2edb7eac4b3f10631d03cef4;hb=de7cf9bb0a7a41d6487013c87f4a54d0664cd303;hp=250d4c859555c219b757dcf15fb2dc0a9fb3f511;hpb=844c6abc897469c996e8df5a1569c3aeaa08c446;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_PrsImage.cxx b/src/HYDROGUI/HYDROGUI_PrsImage.cxx index 250d4c85..172f5f72 100644 --- a/src/HYDROGUI/HYDROGUI_PrsImage.cxx +++ b/src/HYDROGUI/HYDROGUI_PrsImage.cxx @@ -298,6 +298,7 @@ void HYDROGUI_PrsImage::computeTransformationPoints() int aWidth = myImage.width(); int aHeight = myImage.height(); + // Create presentations for transformation points A, B and C for( int aPointType = PointA; aPointType <= PointC; aPointType++ ) { TransformationPoint aTransformationPoint; @@ -341,29 +342,37 @@ void HYDROGUI_PrsImage::computeTransformationPoints() } } - bool anIsVisible = myIsTransformationPointPreview; - bool anIsPointVisible; for( int aPointType = PointA; aPointType <= PointC; aPointType++ ) { - // If image is transformed only by two points then the point C is invisible - anIsPointVisible = anIsVisible && ( - ( !myIsByTwoPoints ) || ( myIsByTwoPoints && ( aPointType != PointC ) ) ); - TransformationPoint& aTransformationPoint = myTransformationPointMap[ aPointType ]; - - double aRadius = 5; - const QPointF& aPoint = aTransformationPoint.Point; - QRectF aRect( aPoint - QPointF( aRadius, aRadius ), QSizeF( aRadius * 2 + 1, aRadius * 2 + 1 ) ); - aTransformationPoint.PointItem->setRect( aRect ); - aTransformationPoint.PointItem->setVisible( anIsPointVisible ); - - QPointF aCaptionShift( -aRadius * 2, aRadius * 2 ); - aTransformationPoint.CaptionItem->setPos( aPoint + aCaptionShift ); - aTransformationPoint.CaptionItem->setVisible( anIsPointVisible ); + // Show/hide the point if necessary + updateTrsfPoint( aPointType ); } } //================================================================ -// Function : IsByTwoPoints +// Function : updateTrsfPoint +// Purpose : +//================================================================ +void HYDROGUI_PrsImage::updateTrsfPoint( const int thePointType ) +{ + // If image is transformed only by two points then the point C is invisible + bool anIsPointVisible = myIsTransformationPointPreview && ( + ( !myIsByTwoPoints ) || ( myIsByTwoPoints && ( thePointType != PointC ) ) ); + TransformationPoint& aTransformationPoint = myTransformationPointMap[ thePointType ]; + + double aRadius = 5; + const QPointF& aPoint = aTransformationPoint.Point; + QRectF aRect( aPoint - QPointF( aRadius, aRadius ), QSizeF( aRadius * 2 + 1, aRadius * 2 + 1 ) ); + aTransformationPoint.PointItem->setRect( aRect ); + aTransformationPoint.PointItem->setVisible( anIsPointVisible ); + + QPointF aCaptionShift( -aRadius * 2, aRadius * 2 ); + aTransformationPoint.CaptionItem->setPos( aPoint + aCaptionShift ); + aTransformationPoint.CaptionItem->setVisible( anIsPointVisible ); +} + +//================================================================ +// Function : getIsByTwoPoints // Purpose : //================================================================ bool HYDROGUI_PrsImage::getIsByTwoPoints() const @@ -372,7 +381,7 @@ bool HYDROGUI_PrsImage::getIsByTwoPoints() const } //================================================================ -// Function : SetIsByTwoPoints +// Function : setIsByTwoPoints // Purpose : //================================================================ void HYDROGUI_PrsImage::setIsByTwoPoints( const bool theIsByTwoPoints ) @@ -380,8 +389,7 @@ void HYDROGUI_PrsImage::setIsByTwoPoints( const bool theIsByTwoPoints ) myIsByTwoPoints = theIsByTwoPoints; if ( myTransformationPointMap.contains( PointC ) ) { - TransformationPoint& aTransformationPoint = myTransformationPointMap[ PointC ]; - aTransformationPoint.PointItem->setVisible( myIsTransformationPointPreview && theIsByTwoPoints ); - aTransformationPoint.CaptionItem->setVisible( myIsTransformationPointPreview && theIsByTwoPoints ); + // Show/hide the point C if necessary + updateTrsfPoint( PointC ); } }