Salome HOME
Fix for the bug #45: check and warning when the same image is used in 2 arguments.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ProfileOp.cxx
index efe8572c2f7ac80496e8b6914cea411413dcbaf5..a9a9cf2cdeb0a2280f2744e85ed1fe1c3ad9af33 100644 (file)
@@ -94,14 +94,14 @@ void HYDROGUI_ProfileOp::startOperation()
     CurveCreator::Coordinates aCurveCoords;
     CurveCreator::SectionsMap aSectionsMap;
 
-    HYDROData_Profile::ProfilePoints aSectPointsList = myEditedObject->GetProfilePoints();
+    HYDROData_ProfileUZ::PointsList aSectPointsList = myEditedObject->GetParametricPoints();
     CurveCreator::PosPointsList aPoints;
     for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
     {
-      const HYDROData_Profile::ProfilePoint& aSectPoint = aSectPointsList.Value( k );
+      const HYDROData_ProfileUZ::Point& aSectPoint = aSectPointsList.Value( k );
       aCurveCoords.clear();
       aCurveCoords.push_back( aSectPoint.X() );
-      aCurveCoords.push_back( aSectPoint.Z() );
+      aCurveCoords.push_back( aSectPoint.Y() );
 
       CurveCreator_PosPoint* aPosPoint = new CurveCreator_PosPoint( k, aCurveCoords );
       aPoints.push_back( aPosPoint );
@@ -182,6 +182,12 @@ bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags,
   HYDROData_ProfileUZ::PointsList aProfileParamPoints;
 
   CurveCreator::Coordinates aCurveCoords = myProfile->getPoints( 0 );
+  if ( aCurveCoords.size() <= 2 )
+  {
+    theErrorMsg = tr( "NUMBER_OF_PROFILE_POINTS_INCORRECT" );
+    return false;
+  }
+
   for ( int k = 0 ; k + 1 < aCurveCoords.size() ; k++ )
   {
     HYDROData_ProfileUZ::Point aProfileParamPoint;
@@ -194,8 +200,7 @@ bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags,
   }
   aProfileObj->SetParametricPoints( aProfileParamPoints );
 
-  if( !myIsEdit )
-    module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aProfileObj, true );
+  aProfileObj->Update();
 
   theUpdateFlags = UF_Model;
   return true;
@@ -211,7 +216,7 @@ void HYDROGUI_ProfileOp::displayPreview()
     {
       CurveCreator_Displayer* aDisplayer = new CurveCreator_Displayer( aCtx );
       myProfile->setDisplayer( aDisplayer );
-      aDisplayer->display( myProfile->constructWire(), true );
+      aDisplayer->display( myProfile->getAISObject( true ), true );
     }
   }
 }
@@ -225,7 +230,7 @@ void HYDROGUI_ProfileOp::erasePreview()
     Handle(AIS_InteractiveContext) aCtx = aPanel->getAISContext();
     if( !aCtx.IsNull() )
     {
-      aDisplayer->erase( true );
+      aDisplayer->eraseAll( true );
     }
   }
 }