Salome HOME
Minor changes.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_CalculationOp.cxx
index 7b0bcaa3556cfd36ec997599eec8344187c5dc4c..f6bd84498bef201b439aa22cf2c74f8d8cbe49dd 100644 (file)
@@ -31,7 +31,7 @@
 #include "HYDROGUI_Region.h"
 
 #include <HYDROData_PolylineXY.h>
-#include <HYDROData_EdgesGroup.h>
+#include <HYDROData_ShapesGroup.h>
 #include <HYDROData_Iterator.h>
 #include <HYDROData_Object.h>
 #include <HYDROData_Tool.h>
@@ -145,6 +145,7 @@ void HYDROGUI_CalculationOp::startOperation()
         aPolylineName = aPolylineObj->GetName();
         aPanel->setBoundary( aPolylineName );
       }
+
       aSeq = myEditedObject->GetGeometryObjects();
       getNamesAndEntries( aSeq, aList, anEntryList );
       aPanel->includeGeomObjects( aList );
@@ -173,8 +174,8 @@ void HYDROGUI_CalculationOp::getNamesAndEntries( const HYDROData_SequenceOfObjec
   for ( ; anIter.More(); anIter.Next() )
   {
     Handle(HYDROData_Entity) anEntity = anIter.Value();
-    if ( !HYDROData_Tool::IsGeometryObject( anEntity ) )
-      continue;
+    //if ( !HYDROData_Tool::IsGeometryObject( anEntity ) )
+    //  continue;
 
     theNames.append( anEntity->GetName() );
     theEntries.append( HYDROGUI_DataObject::dataObjectEntry( anEntity ) );
@@ -394,7 +395,7 @@ void HYDROGUI_CalculationOp::onCreateRegion( const QList<SUIT_DataObject*>& theZ
   }
 }
 
-void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theBathymetryName )
+void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theAltitudeName )
 {
   HYDROGUI_CalculationDlg* aPanel = 
     ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
@@ -403,7 +404,7 @@ void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theBathy
     HYDROGUI_Zone* aZone = aPanel->getCurrentZone();
     if ( aZone )
     {
-      aZone->setMergeType( theMergeType, theBathymetryName );
+      aZone->setMergeType( theMergeType, theAltitudeName );
       HYDROGUI_Shape* aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aZone->modelObject() );
       if ( aShape )
       {
@@ -504,7 +505,7 @@ bool HYDROGUI_CalculationOp::processApply( int&     theUpdateFlags,
   if ( !aPanel )
     return false;
 
-  theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
+  theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init;
 
   return true;
 }
@@ -714,7 +715,7 @@ void HYDROGUI_CalculationOp::createPreview()
       }
 
       //Process the draw events for viewer
-      QApplication::processEvents();
+      QApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
       if ( OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView() )
         vw->onTopView();
     }
@@ -777,7 +778,11 @@ void HYDROGUI_CalculationOp::closePreview()
 void HYDROGUI_CalculationOp::setAvailableGroups()
 {
   HYDROGUI_CalculationDlg* aPanel = 
-    ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+      ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
+
+  HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryGroups();
+  QStringList aList, anEntryList;
+  getNamesAndEntries( aSeq, aList, anEntryList );
 
   QStringList aGroupsNames;
 
@@ -788,12 +793,24 @@ void HYDROGUI_CalculationOp::setAvailableGroups()
     HYDROData_SequenceOfObjects aGroups = anObj->GetGroups();
     for( int aGIndex = 1, aGLength = aGroups.Length(); aGIndex <= aGLength; aGIndex++ )
     {
-      Handle_HYDROData_EdgesGroup aGroup = Handle_HYDROData_EdgesGroup::DownCast( aGroups.Value( aGIndex ) );
+      Handle_HYDROData_ShapesGroup aGroup = Handle_HYDROData_ShapesGroup::DownCast( aGroups.Value( aGIndex ) );
       aGroupsNames.append( aGroup->GetName() );
     }
   }
-  myEditedObject->RemoveGeometryGroups();
+  if( myEditedObject->IsMustBeUpdated() ) {
+    for( int anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ ) {
+      Handle(HYDROData_ShapesGroup) aGeomGroup =
+        Handle(HYDROData_ShapesGroup)::DownCast( aSeq.Value( anIndex ) );
+      if ( !aGeomGroup.IsNull() && !aGroupsNames.contains( aGeomGroup->GetName() ) ) {
+        myEditedObject->RemoveGeometryGroup( aGeomGroup );
+      }
+    }
+  }
+
   aPanel->setAvailableGroups( aGroupsNames );
+  aPanel->includeGroups( aList );
+
+  bool isUpdated = myEditedObject->IsMustBeUpdated();
 }
 
 void HYDROGUI_CalculationOp::onAddGroups()
@@ -811,7 +828,7 @@ void HYDROGUI_CalculationOp::onAddGroups()
   QStringList anAddedList;
   for (int i = 0; i < aSelectedList.length(); i++)
   {
-    Handle(HYDROData_EdgesGroup) aGroup = Handle(HYDROData_EdgesGroup)::DownCast( 
+    Handle(HYDROData_ShapesGroup) aGroup = Handle(HYDROData_ShapesGroup)::DownCast( 
       HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at( i ) ) );
     if ( aGroup.IsNull() )
       continue;
@@ -840,7 +857,7 @@ void HYDROGUI_CalculationOp::onRemoveGroups()
 
   for (int i = 0; i < aSelectedList.length(); i++)
   {
-    Handle(HYDROData_EdgesGroup) aGroup = Handle(HYDROData_EdgesGroup)::DownCast( 
+    Handle(HYDROData_ShapesGroup) aGroup = Handle(HYDROData_ShapesGroup)::DownCast( 
       HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at(i) ) );
     if ( aGroup.IsNull() )
       continue;