Salome HOME
Fix for the bug #42: point C is not activated, but point C is shown in preview in...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_PrsImage.cxx
index 9e7be1425bceb3b3ad0d459d8e889020f2e24f0a..250d4c859555c219b757dcf15fb2dc0a9fb3f511 100644 (file)
@@ -342,18 +342,46 @@ 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( anIsVisible );
+    aTransformationPoint.PointItem->setVisible( anIsPointVisible );
 
     QPointF aCaptionShift( -aRadius * 2, aRadius * 2 );
     aTransformationPoint.CaptionItem->setPos( aPoint + aCaptionShift );
-    aTransformationPoint.CaptionItem->setVisible( anIsVisible );
+    aTransformationPoint.CaptionItem->setVisible( anIsPointVisible );
+  }
+}
+
+//================================================================
+// Function : IsByTwoPoints
+// Purpose  : 
+//================================================================
+bool HYDROGUI_PrsImage::getIsByTwoPoints() const
+{
+  return myIsByTwoPoints;
+}
+
+//================================================================
+// Function : SetIsByTwoPoints
+// Purpose  : 
+//================================================================
+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 );
   }
 }