Salome HOME
Merge commit '4823245056426a9ccf9c7965daecf11459f58af5' into V9_11_BR
[modules/geom.git] / src / RepairGUI / RepairGUI_ShapeProcessDlg.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 6d9f4dc..395c12a
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -40,6 +40,7 @@
 #include <SUIT_ResourceMgr.h>
 #include <SUIT_MessageBox.h>
 #include <SALOME_ListIO.hxx>
+#include "utilities.h"
 
 #include <Basics_Utils.hxx>
 #include "utilities.h"
@@ -360,7 +361,7 @@ void RepairGUI_ShapeProcessDlg::init()
   //myOpList->setCurrentRow( myOpList->findItem( 0 );
   reset();
 
-  myStack->setCurrentIndex( 0 );
+  myOpList->setCurrentRow(0);
 
   initName( tr( "PROCESS_SHAPE_NEW_OBJ_NAME" ));
   selectionChanged();
@@ -518,12 +519,12 @@ QString set_convert( const char* theParam, const char* theValue )
 //=================================================================================
 void RepairGUI_ShapeProcessDlg::loadDefaults()
 {
-  GEOM::GEOM_IHealingOperations_var anOp = myGeomGUI->GetGeomGen()->GetIHealingOperations( getStudyId() );
+  GEOM::GEOM_IHealingOperations_var anOp = myGeomGUI->GetGeomGen()->GetIHealingOperations();
   GEOM::string_array_var anOperators, aParams, aValues;
   anOp->GetShapeProcessParameters( anOperators, aParams, aValues );
 
   // check the default items-operators
-  for ( int i = 0; i < anOperators->length(); i++ ) {
+  for ( int i = 0; i < (int)anOperators->length(); i++ ) {
     //MESSAGE("-->"<<(const char*)anOperators[i]);
     QList<QListWidgetItem*> items = myOpList->findItems ( (const char*)anOperators[i], Qt::MatchFixedString );
     if ( items.count() ) 
@@ -540,7 +541,7 @@ void RepairGUI_ShapeProcessDlg::loadDefaults()
     if ( aParams->length() != aValues->length() )
       continue;
 
-    for ( int j = 0; j < aParams->length(); j++ ) {
+    for ( int j = 0; j < (int)aParams->length(); j++ ) {
       QWidget* aCtrl = getControl( (const char*)aParams[j] );
       setValue( aCtrl, set_convert( (const char*)aParams[j], aValues[j] ));
     }
@@ -614,7 +615,7 @@ QString RepairGUI_ShapeProcessDlg::getText( QWidget* theControl ) const
 //=================================================================================
 GEOM::GEOM_IOperations_ptr RepairGUI_ShapeProcessDlg::createOperation()
 {
-  return getGeomEngine()->GetIHealingOperations( getStudyId() );
+  return getGeomEngine()->GetIHealingOperations();
 }
 
 //=================================================================================
@@ -683,7 +684,7 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
   */// -----------
 
   QStringList anErrorObjNames;
-  for ( int i = 0; i < myObjects->length(); i++ ) {
+  for ( int i = 0; i < (int)myObjects->length(); i++ ) {
     GEOM::GEOM_Object_var obj = myObjects[i];
     GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
     GEOM::GEOM_Object_var anObj = anOper->ProcessShape( obj, anOperators, aParams, aValues );
@@ -695,14 +696,14 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
       {
         QStringList aParameters;
 
-        for ( int i = 0; i < anOperators->length(); i++ )
+        for ( int i = 0; i < (int)anOperators->length(); i++ )
           aParameters << QString( anOperators[i] );
 
-        for ( int i = 0; i < aParams->length(); i++ )
+        for ( int i = 0; i < (int)aParams->length(); i++ )
           aParameters << QString( aParams[i] );
 
         aParameters << getTexts( aParams );
-        anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+        anObj->SetParameters(aParameters.join(":").toUtf8().constData());
 
         RepairGUI::ShowStatistics( anOper, this );
       }
@@ -711,9 +712,9 @@ bool RepairGUI_ShapeProcessDlg::execute( ObjectList& objects )
   }
 
   if ( !anErrorObjNames.empty() )
-    MESSAGE( "ERRORS occured while processing the following objects: " << anErrorObjNames.join( " " ).toLatin1().data() );
+    MESSAGE( "ERRORS occurred while processing the following objects: " << anErrorObjNames.join( " " ).toLatin1().data() );
     
-  return anErrorObjNames.size() < myObjects->length(); // true if at least one object was OK, false if ALL objects were nil after Healing.
+  return anErrorObjNames.size() < (int)myObjects->length(); // true if at least one object was OK, false if ALL objects were nil after Healing.
 }
 
 //=================================================================================
@@ -838,14 +839,14 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getParameters( const GEOM::string
   int i = 0, j = 0;
 
   // calculate the length of parameters
-  for ( i = 0, j = 0; i < theOperators.length(); i++ )
+  for ( i = 0, j = 0; i < (int)theOperators.length(); i++ )
     j += myValMap[ QString( theOperators[i].in() ) ].size();
   
-  // set the new length of paremeters
+  // set the new length of parameters
   aParams->length( j );
 
   // fill the parameters
-  for ( i = 0, j = 0; i < theOperators.length(); i++ ) {
+  for ( i = 0, j = 0; i < (int)theOperators.length(); i++ ) {
     QStringList aParamLst = myValMap[ QString( theOperators[i].in() ) ];
     foreach ( QString aParam, aParamLst ) {
       aParams[j++] = CORBA::string_dup( aParam.toLatin1().constData() );
@@ -867,7 +868,7 @@ GEOM::string_array* RepairGUI_ShapeProcessDlg::getValues( const GEOM::string_arr
   GEOM::string_array_var aValues = new GEOM::string_array();
   aValues->length( theParams.length() );
 
-  for ( int i = 0; i < theParams.length(); i++ ) {
+  for ( int i = 0; i < (int)theParams.length(); i++ ) {
     QWidget* aCtrl = getControl( (const char*)theParams[i] );
     if ( aCtrl )
       aValues[i] = get_convert( (const char*)theParams[i], getValue( aCtrl ));
@@ -884,7 +885,7 @@ QStringList RepairGUI_ShapeProcessDlg::getTexts( const GEOM::string_array& thePa
 {
   QStringList aTexts;
     
-  for ( int i = 0; i < theParams.length(); i++ ) {
+  for ( int i = 0; i < (int)theParams.length(); i++ ) {
     QWidget* aCtrl = getControl( (const char*)theParams[i] );
     if ( aCtrl )
     {
@@ -958,6 +959,7 @@ void RepairGUI_ShapeProcessDlg::operatorChecked( QListWidgetItem * item )
 {
   if ( item && item->checkState() == Qt::Checked )
   {
+    item->setSelected(true);
     myStack->setCurrentIndex( myOpList->row( item ));
   }
   updateSelectAll();
@@ -989,3 +991,18 @@ void RepairGUI_ShapeProcessDlg::onSelectAll( int state )
   }
   myOpList->blockSignals( false );
 }
+
+//=================================================================================
+// function : getSourceObjects
+// purpose  : virtual method to get source objects
+//=================================================================================
+QList<GEOM::GeomObjPtr> RepairGUI_ShapeProcessDlg::getSourceObjects()
+{
+  QList<GEOM::GeomObjPtr> res;
+  GEOM::ListOfGO aListPtr(myObjects);
+  for (int i = 0; i < (int)aListPtr.length(); i++) {
+    GEOM::GeomObjPtr aGeomObjPtr(aListPtr[i]);
+    res << aGeomObjPtr;
+  }
+  return res;
+}