Salome HOME
Update of CheckDone
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MultiEditDlg.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 5651284..01cc037
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -57,7 +57,7 @@
 
 #include <SVTK_Selector.h>
 #include <SVTK_ViewWindow.h>
-#include <VTKViewer_CellLocationsArray.h>
+//#include <VTKViewer_CellLocationsArray.h>
 
 // OCCT includes
 #include <Bnd_B3d.hxx>
@@ -369,7 +369,6 @@ SMESH::NumericalFunctor_ptr SMESHGUI_MultiEditDlg::getNumericalFunctor()
     aNF = aFilterMgr->CreateMultiConnection2D();
   else if (myComboBoxFunctor->currentText() == tr("MIN_DIAG_ELEMENTS"))
     aNF = aFilterMgr->CreateMaxElementLength2D();
-  else;
 
   return aNF._retn();
 }
@@ -435,12 +434,12 @@ void SMESHGUI_MultiEditDlg::onOk()
 
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::getIds
-// Purpose : Retrive identifiers from list box or the whole object
+// Purpose : Retrieve identifiers from list box or the whole object
 //=======================================================================
 
-SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds(SMESH::SMESH_IDSource_var& obj)
+SMESH::smIdType_array_var SMESHGUI_MultiEditDlg::getIds(SMESH::SMESH_IDSource_var& obj)
 {
-  SMESH::long_array_var anIds = new SMESH::long_array;
+  SMESH::smIdType_array_var anIds = new SMESH::smIdType_array;
 
   if (myToAllChk->isChecked())
   {
@@ -600,7 +599,7 @@ void SMESHGUI_MultiEditDlg::onSelectionDone()
 
 //=======================================================================
 // name    : SMESHGUI_MultiEditDlg::onDeactivate
-// Purpose : SLOT called when dialog must be deativated
+// Purpose : SLOT called when dialog must be deactivated
 //=======================================================================
 void SMESHGUI_MultiEditDlg::onDeactivate()
 {
@@ -698,7 +697,7 @@ void SMESHGUI_MultiEditDlg::onAddBtn()
   if (nbSelected == 0)
     return;
 
-  TColStd_IndexedMapOfInteger toBeAdded;
+  SVTK_TIndexedMapOfVtkId toBeAdded;
 
   if (!mySubmeshChk->isChecked() && !myGroupChk->isChecked()) {
     if (nbSelected > 0)
@@ -710,9 +709,9 @@ void SMESHGUI_MultiEditDlg::onAddBtn()
         SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIter.Value());
       if (!aSubMesh->_is_nil()) {
         if (aSubMesh->GetFather()->GetId() == myMesh->GetId()) {
-          SMESH::long_array_var anIds = aSubMesh->GetElementsId();
+          SMESH::smIdType_array_var anIds = aSubMesh->GetElementsId();
           for (int i = 0, n = anIds->length(); i < n; i++) {
-            if (isIdValid(anIds[ i ]))
+            if (isIdValid(FromSmIdType<int>(anIds[ i ])))
               toBeAdded.Add(anIds[ i ]);
           }
         }
@@ -726,9 +725,9 @@ void SMESHGUI_MultiEditDlg::onAddBtn()
       if (!aGroup->_is_nil() && ((aGroup->GetType() == SMESH::FACE && entityType() == 0) || 
                                  (aGroup->GetType() == SMESH::VOLUME && entityType() == 1))) {
         if (aGroup->GetMesh()->GetId() == myMesh->GetId()) {
-          SMESH::long_array_var anIds = aGroup->GetListOfID();
+          SMESH::smIdType_array_var anIds = aGroup->GetListOfID();
           for (int i = 0, n = anIds->length(); i < n; i++) {
-            if (isIdValid(anIds[ i ]))
+            if (isIdValid(FromSmIdType<int>(anIds[ i ])))
               toBeAdded.Add(anIds[ i ]);
           }
         }
@@ -876,14 +875,14 @@ void SMESHGUI_MultiEditDlg::onListSelectionChanged()
     anActor = myActor;
   TVisualObjPtr anObj = anActor->GetObject();
 
-  TColStd_MapOfInteger anIndexes;
+  SVTK_TVtkIDsMap anIndexes;
   int total = myListBox->count();
   for (int i = 0; i < total; i++)
   {
     if (myListBox->item(i)->isSelected())
     {
       int anId = myListBox->item(i)->text().toInt();
-      if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in hilight
+      if (anObj->GetElemVTKId(anId) >= 0) // avoid exception in highlight
         anIndexes.Add(anId);
     }
   }
@@ -995,7 +994,7 @@ void SMESHGUI_MultiEditDlg::setSelectionMode()
 //=======================================================================
 bool SMESHGUI_MultiEditDlg::onApply()
 {
-  if (mySMESHGUI->isActiveStudyLocked())
+  if (SMESHGUI::isStudyLocked())
     return false;
   if (!isValid(true))
     return false;
@@ -1009,7 +1008,7 @@ bool SMESHGUI_MultiEditDlg::onApply()
   SUIT_OverrideCursor aWaitCursor;
 
   SMESH::SMESH_IDSource_var obj;
-  SMESH::long_array_var anIds = getIds(obj);
+  SMESH::smIdType_array_var anIds = getIds(obj);
 
   bool aResult = process(aMeshEditor, anIds.inout(), obj);
   if (aResult) {
@@ -1093,16 +1092,16 @@ SMESHGUI_ChangeOrientationDlg
   SMESHGUI_MultiEditDlg(theModule, SMESH::FaceFilter, true)
 {
   setWindowTitle(tr("CAPTION"));
-  myHelpFileName = "changing_orientation_of_elements_page.html";
+  myHelpFileName = "changing_orientation_of_elements.html";
 }
 
 SMESHGUI_ChangeOrientationDlg::~SMESHGUI_ChangeOrientationDlg()
 {
 }
 
-bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
-                                             const SMESH::long_array&    theIds,
-                                             SMESH::SMESH_IDSource_ptr   obj)
+bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr  theEditor,
+                                             const SMESH::smIdType_array& theIds,
+                                             SMESH::SMESH_IDSource_ptr    obj)
 {
   if ( CORBA::is_nil( obj ))
     return theEditor->Reorient(theIds);
@@ -1110,7 +1109,7 @@ bool SMESHGUI_ChangeOrientationDlg::process (SMESH::SMESH_MeshEditor_ptr theEdit
     return theEditor->ReorientObject( obj );
 }
 
-int SMESHGUI_ChangeOrientationDlg::nbElemsInMesh()
+smIdType SMESHGUI_ChangeOrientationDlg::nbElemsInMesh()
 {
   return ( myFilterType == SMESH::FaceFilter ) ? myMesh->NbFaces() : myMesh->NbVolumes();
 }
@@ -1161,7 +1160,7 @@ SMESHGUI_UnionOfTrianglesDlg
   myPreviewCheckBox->setChecked(false);
   onDisplaySimulation(false);
 
-  myHelpFileName = "uniting_set_of_triangles_page.html";
+  myHelpFileName = "uniting_set_of_triangles.html";
 }
 
 SMESHGUI_UnionOfTrianglesDlg::~SMESHGUI_UnionOfTrianglesDlg()
@@ -1190,13 +1189,13 @@ bool SMESHGUI_UnionOfTrianglesDlg::isValid (const bool theMess)
 }
 
 bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
-                                            const SMESH::long_array&    theIds,
+                                            const SMESH::smIdType_array&    theIds,
                                             SMESH::SMESH_IDSource_ptr   obj)
 {
   {
     QStringList aParameters;
     aParameters << myMaxAngleSpin->text();
-    myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+    myMesh->SetParameters( aParameters.join(":").toUtf8().constData() );
   }
   SMESH::NumericalFunctor_var aCriterion = getNumericalFunctor();
   double aMaxAngle = myMaxAngleSpin->GetValue() * M_PI / 180.0;
@@ -1208,7 +1207,7 @@ bool SMESHGUI_UnionOfTrianglesDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito
   return ok;
 }
 
-int SMESHGUI_UnionOfTrianglesDlg::nbElemsInMesh()
+smIdType SMESHGUI_UnionOfTrianglesDlg::nbElemsInMesh()
 {
   return myMesh->NbTriangles();
 }
@@ -1221,7 +1220,7 @@ void SMESHGUI_UnionOfTrianglesDlg::onDisplaySimulation( bool toDisplayPreview )
         SUIT_OverrideCursor aWaitCursor;
         // get Ids of elements
         SMESH::SMESH_IDSource_var obj;
-        SMESH::long_array_var anElemIds = getIds( obj );
+        SMESH::smIdType_array_var anElemIds = getIds( obj );
 
         SMESH::NumericalFunctor_var aCriterion  = getNumericalFunctor();
         SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
@@ -1242,7 +1241,7 @@ void SMESHGUI_UnionOfTrianglesDlg::onDisplaySimulation( bool toDisplayPreview )
         mySimulation->GetActor()->SetProperty( aProp );
         aProp->Delete();
 
-        mySimulation->SetData( aMeshPreviewStruct._retn() );
+        mySimulation->SetData( aMeshPreviewStruct.in() );
       } catch ( ... ) {
         hidePreview();
       }
@@ -1289,7 +1288,7 @@ SMESHGUI_CuttingOfQuadsDlg
   connect(myComboBoxFunctor, SIGNAL(activated(int)),       this, SLOT(onPreviewChk()));
   connect(this,              SIGNAL(ListContensChanged()), this, SLOT(onPreviewChk()));
 
-  myHelpFileName = "cutting_quadrangles_page.html";
+  myHelpFileName = "cutting_quadrangles.html";
 }
 
 SMESHGUI_CuttingOfQuadsDlg::~SMESHGUI_CuttingOfQuadsDlg()
@@ -1303,7 +1302,7 @@ void SMESHGUI_CuttingOfQuadsDlg::reject()
 }
 
 bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
-                                          const SMESH::long_array&    theIds,
+                                          const SMESH::smIdType_array&    theIds,
                                           SMESH::SMESH_IDSource_ptr   obj)
 {
   bool hasObj = (! CORBA::is_nil( obj ));
@@ -1328,7 +1327,7 @@ bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
   return hasObj ? theEditor->QuadToTriObject(obj, aCrit) : theEditor->QuadToTri(theIds, aCrit);
 }
 
-int SMESHGUI_CuttingOfQuadsDlg::nbElemsInMesh()
+smIdType SMESHGUI_CuttingOfQuadsDlg::nbElemsInMesh()
 {
   return myMesh->NbQuadrangles();
 }
@@ -1383,7 +1382,7 @@ void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
   SUIT_OverrideCursor aWaitCursor;
   // get Ids of elements
   SMESH::SMESH_IDSource_var obj;
-  SMESH::long_array_var anElemIds = getIds(obj);
+  SMESH::smIdType_array_var anElemIds = getIds(obj);
   if (anElemIds->length() == 0 && obj->_is_nil() )
     return;
 
@@ -1440,13 +1439,13 @@ void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
       const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(anIter->next());
       if (aNode)
       {
-        if (!anIdToVtk.IsBound(aNode->GetID()))
+        if (!anIdToVtk.IsBound(FromSmIdType<int>(aNode->GetID())))
         {
           aPoints->SetPoint(++nbPoints, aNode->X(), aNode->Y(), aNode->Z());
-          anIdToVtk.Bind(aNode->GetID(), nbPoints);
+          anIdToVtk.Bind(FromSmIdType<int>(aNode->GetID()), nbPoints);
         }
 
-        aNodes[ k++ ] = aNode->GetID();
+        aNodes[ k++ ] = FromSmIdType<int>(aNode->GetID());
       }
     }
 
@@ -1465,7 +1464,7 @@ void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
     else // use numerical functor
     {
       // compare two sets of possible triangles
-      int diag = aMeshEditor->BestSplit(anElemIds[i], aCriterion);
+      smIdType diag = aMeshEditor->BestSplit(anElemIds[i], aCriterion);
       if (diag == 1) // 1-3
         isDiag13 = true;
       else if (diag == 2) // 2-4
@@ -1504,12 +1503,13 @@ void SMESHGUI_CuttingOfQuadsDlg::displayPreview()
     }
   }
 
-  VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New();
+  vtkIdTypeArray* aCellLocationsArray = vtkIdTypeArray::New();
   aCellLocationsArray->SetNumberOfComponents(1);
   aCellLocationsArray->SetNumberOfTuples(aNbCells);
 
   aConnectivity->InitTraversal();
-  for(vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell(npts, pts); idType++)
+  vtkIdType const *pts(nullptr);
+  for(vtkIdType idType = 0, npts; aConnectivity->GetNextCell(npts, pts); idType++)
     aCellLocationsArray->SetValue(idType, aConnectivity->GetTraversalLocation(npts));
 
   aGrid->SetPoints(aPoints);
@@ -1551,7 +1551,7 @@ SMESHGUI_SplitVolumesDlg::SMESHGUI_SplitVolumesDlg(SMESHGUI* theModule)
   : SMESHGUI_MultiEditDlg(theModule, SMESH::VolumeFilter, /*the3d2d=*/true, /*doInit=*/false)
 {
   setWindowTitle(tr("CAPTION"));
-  myHelpFileName = "split_to_tetra_page.html";
+  myHelpFileName = "split_to_tetra.html";
   myEntityType = 1;
   myCellSize = -1.;
 
@@ -1622,13 +1622,13 @@ SMESHGUI_SplitVolumesDlg::SMESHGUI_SplitVolumesDlg(SMESHGUI* theModule)
   }
   if ( myEntityTypeGrp )
   {
-    myEntityTypeGrp->button(0)->setText( tr("SMESH_TETRAS"));
+    myEntityTypeGrp->button(0)->setText( tr("SMESH_TETRAHEDRON"));
     myEntityTypeGrp->button(1)->setText( tr("SMESH_PRISM"));
     if ( QGroupBox* gb = qobject_cast< QGroupBox* >( myEntityTypeGrp->button(0)->parent() ))
       gb->setTitle( tr("TARGET_ELEM_TYPE"));
   }
 
-  myToAllChk->setChecked( true ); //aplly to the whole mesh by default
+  myToAllChk->setChecked( true ); //apply to the whole mesh by default
 
   bool hasHexa = true;//myMesh->_is_nil() ? false : myMesh->NbHexas();
   if ( hasHexa )
@@ -1648,7 +1648,7 @@ SMESHGUI_SplitVolumesDlg::~SMESHGUI_SplitVolumesDlg()
 }
 
 bool SMESHGUI_SplitVolumesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
-                                        const SMESH::long_array&    theIds,
+                                        const SMESH::smIdType_array&    theIds,
                                         SMESH::SMESH_IDSource_ptr   theObj)
 {
   SMESH::IDSource_wrap obj = theObj;
@@ -1666,7 +1666,7 @@ bool SMESHGUI_SplitVolumesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
       aParameters << myDirSpin[0]->text();
       aParameters << myDirSpin[1]->text();
       aParameters << myDirSpin[2]->text();
-      myMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+      myMesh->SetParameters( aParameters.join(":").toUtf8().constData() );
 
       SMESH::PointStruct_var point = new SMESH::PointStruct;
       point->x  = myPointSpin[0]->GetValue();
@@ -1696,7 +1696,7 @@ bool SMESHGUI_SplitVolumesDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
   return true;
 }
 
-int SMESHGUI_SplitVolumesDlg::nbElemsInMesh()
+smIdType SMESHGUI_SplitVolumesDlg::nbElemsInMesh()
 {
   return isIntoPrisms() ? myMesh->NbHexas() : myMesh->NbVolumes() - myMesh->NbTetras();
 }
@@ -1818,7 +1818,7 @@ void SMESHGUI_SplitVolumesDlg::onSelectionDone()
       if (!aSelMesh->_is_nil())
         myMesh = aSelMesh;
 
-      TColStd_IndexedMapOfInteger aMapIndex;
+      SVTK_TIndexedMapOfVtkId aMapIndex;
       mySelector->GetIndex( anIO, aMapIndex );
       if ( !aMapIndex.IsEmpty() )
         showFacetByElement( aMapIndex(1) );