Salome HOME
Refs #288 - the profile section selected and addition mode is activated
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_StreamOp.cxx
index 5882c2f868ac21fb9d092cc03a0c5d17f7ab7af7..66178e7d720e6db6e872be9e451027ad5d897537 100755 (executable)
@@ -80,6 +80,9 @@ void HYDROGUI_StreamOp::startOperation()
   // Get/create the edited object
   if( myIsEdit ) {
     myEditedObject = Handle(HYDROData_Stream)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
+    if ( !myEditedObject.IsNull() && myEditedObject->IsMustBeUpdated() ) {
+      myEditedObject->Update();
+    }
   } else {
     myEditedObject = Handle(HYDROData_Stream)::DownCast( doc()->CreateObject( KIND_STREAM ) );
   }
@@ -188,8 +191,10 @@ bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags,
     module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), myEditedObject, true );
   }
 
+  module()->setIsToUpdate( myEditedObject );
+
   // Set update flags
-  theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
+  theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer;
 
   return true;
 }
@@ -216,7 +221,7 @@ void HYDROGUI_StreamOp::createPreview()
   }
 
   if ( myPreviewPrs ) {
-    myPreviewPrs->update();  
+    myPreviewPrs->update( true, true );  
   }
 }
 
@@ -304,7 +309,7 @@ void HYDROGUI_StreamOp::onAddProfiles()
       Handle(HYDROData_Profile)::DownCast( aVerifiedProfiles.Value( i ) );
     myEditedObject->AddProfile( aProfile );
   }
-  myEditedObject->Update();
+  myEditedObject->UpdatePrs();
 
   // Update the panel
   updatePanelData();
@@ -344,7 +349,7 @@ void HYDROGUI_StreamOp::onRemoveProfiles( const QStringList& theProfilesToRemove
 
   if ( isRemoved ) {
     // Update the edited stream object
-    myEditedObject->Update();
+    myEditedObject->UpdatePrs();
 
     // Update the panel
     updatePanelData();
@@ -366,11 +371,15 @@ void HYDROGUI_StreamOp::onAxisChanged( const QString& theNewAxis )
 
   // Prepare data for intersection check
   TopoDS_Face aPlane;
-  if ( anAxis.IsNull() || !myEditedObject->BuildFace(anAxis, aPlane) ) {
+  if ( !myEditedObject->BuildFace(anAxis, aPlane) ) {
+    SUIT_MessageBox::critical( module()->getApp()->desktop(), 
+                              tr( "BAD_SELECTED_POLYLINE_TLT" ),
+                              tr( "BAD_SELECTED_POLYLINE_MSG" ).arg( theNewAxis ) );
     // To restore the old axis
     updatePanelData();
     return;
   }
+
   Standard_Real aPar(.0);
 
   // Get list of profiles which do not intersect the axis
@@ -407,7 +416,7 @@ void HYDROGUI_StreamOp::onAxisChanged( const QString& theNewAxis )
   } else {
     // Set axis
     myEditedObject->SetHydraulicAxis( anAxis );
-    myEditedObject->Update();
+    myEditedObject->UpdatePrs();
 
     // Update the panel
     updatePanelData();
@@ -420,7 +429,7 @@ void HYDROGUI_StreamOp::onAxisChanged( const QString& theNewAxis )
 void HYDROGUI_StreamOp::updatePanelData()
 {
   HYDROGUI_StreamDlg* aPanel = ::qobject_cast<HYDROGUI_StreamDlg*>( inputPanel() );
-  if ( !aPanel ) {
+  if ( !aPanel || myEditedObject.IsNull() ) {
     return;
   }