Salome HOME
Update of CheckDone
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_SelectionProxy.cxx
index e359fb8b51abac88039df54143f2ae11ef9a8dc3..6d7afa4e3cc2ca98bc384b177aa35eb236105ea1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2019  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
@@ -101,7 +101,7 @@ SMESH::SelectionProxy::SelectionProxy( const SelectionProxy& other )
 void SMESH::SelectionProxy::init()
 {
   if ( myIO.IsNull() )
-    myIO = new SALOME_InteractiveObject(); // create dummy IO to avoid crashes when accesing it
+    myIO = new SALOME_InteractiveObject(); // create dummy IO to avoid crashes when accessing it
 
   if ( !CORBA::is_nil( myObject ) )
   {
@@ -276,7 +276,7 @@ SMESH::MeshInfo SMESH::SelectionProxy::meshInfo() const
   SMESH::MeshInfo info;
   if ( !isNull() )
   {
-    SMESH::long_array_var data = myObject->GetMeshInfo();
+    SMESH::smIdType_array_var data = myObject->GetMeshInfo();
     for ( uint type = SMESH::Entity_Node; type < SMESH::Entity_Last; type++ )
     {
       if ( type < data->length() )
@@ -494,7 +494,7 @@ bool SMESH::SelectionProxy::nodeConnectivity( int id, SMESH::Connectivity& conne
       SMESH::SMESH_Mesh_var mesh = myObject->GetMesh();
       if ( !CORBA::is_nil( mesh ) )
       {
-        SMESH::long_array_var elements = mesh->GetNodeInverseElements( id, SMESH::ALL );
+        SMESH::smIdType_array_var elements = mesh->GetNodeInverseElements( id, SMESH::ALL );
         for ( int i = 0, n = elements->length(); i < n; i++ )
         {
           SMESH::ElementType type = mesh->GetElementType( elements[i], true );
@@ -589,7 +589,7 @@ bool SMESH::SelectionProxy::hasElement( int id )
       SMESH::SMESH_Mesh_var mesh = myObject->GetMesh();
       if ( !CORBA::is_nil( mesh ) )
       {
-        SMESH::long_array_var nodes = mesh->GetElemNodes( id );
+        SMESH::smIdType_array_var nodes = mesh->GetElemNodes( id );
         result = nodes->length() > 0;
       }
     }
@@ -663,13 +663,13 @@ int SMESH::SelectionProxy::elementEntityType( int id ) const
   \param connectivity Return element connectivity.
   \return \c true if result is valid; \c false otherwise.
 */
-bool SMESH::SelectionProxy::elementConnectivity( int id, Connectivity& connectivity )
+bool SMESH::SelectionProxy::elementConnectivity( SMESH::smIdType id, Connectivity& connectivity )
 {
   bool result = false;
   connectivity.clear();
   if ( !isNull() )
   {
-    QSet<int> nodes; // order of nodes is important
+    QSet<SMESH::smIdType> nodes; // order of nodes is important
     if ( actor() )
     {
       const SMDS_MeshElement* element = actor()->GetObject()->GetMesh()->FindElement( id );
@@ -678,7 +678,7 @@ bool SMESH::SelectionProxy::elementConnectivity( int id, Connectivity& connectiv
         {
           while ( it->more() )
           {
-            int n = it->next()->GetID();
+            SMESH::smIdType n = it->next()->GetID();
             if ( !nodes.contains( n ))
             {
               connectivity[ SMDSAbs_Node ] << n;
@@ -693,7 +693,7 @@ bool SMESH::SelectionProxy::elementConnectivity( int id, Connectivity& connectiv
       SMESH::SMESH_Mesh_var mesh = myObject->GetMesh();
       if ( !CORBA::is_nil( mesh ) )
       {
-        SMESH::long_array_var nn = mesh->GetElemNodes( id );
+        SMESH::smIdType_array_var nn = mesh->GetElemNodes( id );
         for ( int i = 0, nb = nn->length(); i < nb; i++ )
         {
           if ( !nodes.contains( nn[i] ))
@@ -751,10 +751,10 @@ bool SMESH::SelectionProxy::perFaceConnectivity( int id, Connectivity& connectiv
         CORBA::Long nbFaces = mesh->ElemNbFaces( id );
         for ( CORBA::Long iF = 0; iF < nbFaces; ++iF )
         {
-          SMESH::long_array_var nodes = mesh->GetElemFaceNodes( id, iF );
+          SMESH::smIdType_array_var nodes = mesh->GetElemFaceNodes( id, iF );
           for ( CORBA::ULong iN = 0; iN < nodes->length(); ++iN )
           {
-            connectivity[ iF ] << nodes[iN];
+            connectivity[ iF+1 ] << nodes[iN];
             nodeSet << nodes[iN];
           }
         }
@@ -825,7 +825,7 @@ bool SMESH::SelectionProxy::elementGravityCenter( int id, SMESH::XYZ& xyz )
       SMESH::SMESH_Mesh_var mesh = myObject->GetMesh();
       if ( !CORBA::is_nil( mesh ) )
       {
-        SMESH::long_array_var nodes = mesh->GetElemNodes( id );
+        SMESH::smIdType_array_var nodes = mesh->GetElemNodes( id );
         for ( int i = 0, n = nodes->length(); i < n; i++ )
         {
           SMESH::double_array_var coords = mesh->GetNodeXYZ( nodes[i]  );
@@ -908,6 +908,9 @@ bool SMESH::SelectionProxy::elementControl( int id, int control, double precisio
       case SMESH::FT_Warping:
         functor.reset( new SMESH::Controls::Warping() );
         break;
+      case SMESH::FT_Warping3D:
+        functor.reset(new SMESH::Controls::Warping3D());
+        break;
       case SMESH::FT_MinimumAngle:
         functor.reset( new SMESH::Controls::MinimumAngle() );
         break;
@@ -941,6 +944,9 @@ bool SMESH::SelectionProxy::elementControl( int id, int control, double precisio
       case SMESH::FT_BallDiameter:
         functor.reset( new SMESH::Controls::BallDiameter() );
         break;
+      case SMESH::FT_ScaledJacobian:
+        functor.reset( new SMESH::Controls::ScaledJacobian() );
+        break;
       default:
         break;
       } 
@@ -976,6 +982,9 @@ bool SMESH::SelectionProxy::elementControl( int id, int control, double precisio
       case SMESH::FT_Warping:
         functor = manager->CreateWarping();
         break;
+      case SMESH::FT_Warping3D:
+        functor = manager->CreateWarping3D();
+        break;
       case SMESH::FT_MinimumAngle:
         functor = manager->CreateMinimumAngle();
         break;
@@ -1009,6 +1018,9 @@ bool SMESH::SelectionProxy::elementControl( int id, int control, double precisio
       case SMESH::FT_BallDiameter:
         functor = manager->CreateBallDiameter();
         break;
+      case SMESH::FT_ScaledJacobian:
+        functor = manager->CreateScaledJacobian();
+        break;
       default:
         break;
       }
@@ -1159,10 +1171,10 @@ QColor SMESH::SelectionProxy::color() const
   \param autoCompute Compute size if it is unavailable. Defaults to \c false.
   \return Group's size.
 */
-int SMESH::SelectionProxy::size( bool autoCompute ) const
+SMESH::smIdType SMESH::SelectionProxy::size( bool autoCompute ) const
 {
   // note: size is not computed for group on filter for performance reasons, see IPAL52831
-  int result = -1;
+  SMESH::smIdType result = -1;
   if ( !isNull() )
   {
     SMESH::SMESH_GroupBase_var group = SMESH::SMESH_GroupBase::_narrow( myObject );
@@ -1170,7 +1182,7 @@ int SMESH::SelectionProxy::size( bool autoCompute ) const
     {
       if ( type() == GroupFilter )
         // for group on filter we check if value is already computed and cached
-        autoCompute |= group->IsNodeInfoAvailable();
+        autoCompute |= group->IsMeshInfoCorrect();
       else
         // for other groups we force autoCompute to true
         autoCompute = true;
@@ -1187,10 +1199,10 @@ int SMESH::SelectionProxy::size( bool autoCompute ) const
   \param autoCompute Compute size if it is unavailable. Defaults to \c false.
   \return Number of nodes contained in group.
 */
-int SMESH::SelectionProxy::nbNodes( bool autoCompute ) const
+SMESH::smIdType SMESH::SelectionProxy::nbNodes( bool autoCompute ) const
 {
   // note: nb of nodes is not computed automatically for performance reasons
-  int result = -1;
+  SMESH::smIdType result = -1;
   if ( !isNull() )
   {
     SMESH::SMESH_GroupBase_var group = SMESH::SMESH_GroupBase::_narrow( myObject );
@@ -1220,7 +1232,7 @@ QSet<uint> SMESH::SelectionProxy::ids() const
     SMESH::SMESH_GroupBase_var group = SMESH::SMESH_GroupBase::_narrow( myObject );
     if ( !CORBA::is_nil( group ) )
     {
-      SMESH::long_array_var seq = group->GetListOfID();
+      SMESH::smIdType_array_var seq = group->GetListOfID();
       for ( int i = 0, n = seq->length(); i < n; i++ )
         result << (uint)seq[i];
     }
@@ -1376,7 +1388,7 @@ void SMESH::MedInfo::setVersion( uint major, uint minor, uint release )
 ////////////////////////////////////////////////////////////////////////////////
 
 /*!
-  \brief Contructor. Creates invalid position.
+  \brief Constructor. Creates invalid position.
 */
 SMESH::Position::Position():
   myShapeId(-1), myShapeType(-1), myU(0), myV(0), myHasU(false), myHasV(false)