Salome HOME
0020660: EDF 1238 GEOM: Missing equivalent of 2nd contructor of LCS in TUI
[modules/geom.git] / src / GEOM_I / GEOM_IHealingOperations_i.cc
index a529c1cfe23570e43fd370fe7b969a2159f86a9c..36f3587c5385861c7796c328f912aa50da6b7028 100644 (file)
@@ -18,7 +18,7 @@
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
 #include <Standard_Stream.hxx>
 
 #include <list>
@@ -40,8 +40,8 @@
 //=============================================================================
 
 GEOM_IHealingOperations_i::GEOM_IHealingOperations_i (PortableServer::POA_ptr thePOA,
-                                                     GEOM::GEOM_Gen_ptr theEngine,
-                                                     ::GEOMImpl_IHealingOperations* theImpl)
+                                                      GEOM::GEOM_Gen_ptr theEngine,
+                                                      ::GEOMImpl_IHealingOperations* theImpl)
 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
 {
   MESSAGE("GEOM_IHealingOperations_i::GEOM_IHealingOperations_i");
@@ -104,27 +104,22 @@ Handle(TColStd_HArray1OfExtendedString) GEOM_IHealingOperations_i::Convert
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ProcessShape (GEOM::GEOM_Object_ptr theObject,
-                                                              const GEOM::string_array& theOperations,
-                                                              const GEOM::string_array& theParams,
-                                                              const GEOM::string_array& theValues)
+                                                               const GEOM::string_array& theOperations,
+                                                               const GEOM::string_array& theParams,
+                                                               const GEOM::string_array& theValues)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   // Set a not done flag
   GetOperations()->SetNotDone();
 
-  // Check parameters
-  if ( CORBA::is_nil(theObject) )
-    return aGEOMObject._retn();
-
   // Check if theOperations has more than 0 elements and theParams and theValues have the same length
-//  if ( theOperations.length() <= 0 || theParams.length() != theValues.length() )
-//    return aGEOMObject._retn();
+  //if (theOperations.length() <= 0 || theParams.length() != theValues.length())
+  //  return aGEOMObject._retn();
 
   // Get the object itself
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
-  if ( anObject.IsNull() )
+  Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
+  if (anObject.IsNull())
     return aGEOMObject._retn();
 
   // Perform
@@ -169,7 +164,7 @@ void GEOM_IHealingOperations_i::GetShapeProcessParameters(GEOM::string_array_out
       anOpArray[i] = CORBA::string_dup( (*opIt).c_str() );
 
     for ( i = 0, parIt = paramsList.begin(), valIt = valuesList.begin();
-         parIt != paramsList.end(); i++, ++parIt,++valIt ) {
+          parIt != paramsList.end(); i++, ++parIt,++valIt ) {
       aParArray[i] = CORBA::string_dup( (*parIt).c_str() );
       aValArray[i] = CORBA::string_dup( (*valIt).c_str() );
     }
@@ -186,9 +181,9 @@ void GEOM_IHealingOperations_i::GetShapeProcessParameters(GEOM::string_array_out
  *  GetOperatorParameters
  */
 //=============================================================================
-void GEOM_IHealingOperations_i::GetOperatorParameters (const char* theOperator,  
-                                                      GEOM::string_array_out theParams, 
-                                                      GEOM::string_array_out theValues)
+void GEOM_IHealingOperations_i::GetOperatorParameters (const char* theOperator,
+                                                       GEOM::string_array_out theParams,
+                                                       GEOM::string_array_out theValues)
 {
   GEOM::string_array_var aParArray = new GEOM::string_array();
   GEOM::string_array_var aValArray = new GEOM::string_array();
@@ -207,8 +202,8 @@ void GEOM_IHealingOperations_i::GetOperatorParameters (const char* theOperator,
       int i;
       for ( i = 0, parIt = paramsList.begin(), valIt = valuesList.begin();
             parIt != paramsList.end(); i++, ++parIt,++valIt ) {
-       aParArray[i] = CORBA::string_dup( (*parIt).c_str() );
-       aValArray[i] = CORBA::string_dup( (*valIt).c_str() );
+        aParArray[i] = CORBA::string_dup( (*parIt).c_str() );
+        aValArray[i] = CORBA::string_dup( (*valIt).c_str() );
       }
     }
   }
@@ -224,23 +219,20 @@ void GEOM_IHealingOperations_i::GetOperatorParameters (const char* theOperator,
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::SuppressFaces (GEOM::GEOM_Object_ptr theObject,
-                                                               const GEOM::short_array& theFaces)
+                                                                const GEOM::short_array& theFaces)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   // Set a not done flag
   GetOperations()->SetNotDone();
 
-  // Check parameters
-  if ( CORBA::is_nil(theObject) ) // if theFaces is empty - it's OK, it means that ALL faces must be removed
-    return aGEOMObject._retn();
-
   // Get the object itself
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
   if (anObject.IsNull())
     return aGEOMObject._retn();
 
+  // if theFaces is empty - it's OK, it means that ALL faces must be removed
+
   // Perform
   Handle(GEOM_Object) aNewObject =
     GetOperations()->SuppressFaces( anObject, Convert( theFaces ) );
@@ -256,21 +248,16 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::SuppressFaces (GEOM::GEOM_Objec
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::CloseContour (GEOM::GEOM_Object_ptr theObject,
-                                                              const GEOM::short_array& theWires,
-                                                              CORBA::Boolean isCommonVertex)
+                                                               const GEOM::short_array& theWires,
+                                                               CORBA::Boolean isCommonVertex)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   // Set a not done flag
   GetOperations()->SetNotDone();
 
-  // Check parameters
-  if ( CORBA::is_nil(theObject) )
-    return aGEOMObject._retn();
-
   // Get the object itself
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
   if (anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -289,23 +276,20 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::CloseContour (GEOM::GEOM_Object
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::RemoveIntWires (GEOM::GEOM_Object_ptr theObject,
-                                                                const GEOM::short_array& theWires)
+                                                                 const GEOM::short_array& theWires)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   // Set a not done flag
   GetOperations()->SetNotDone();
 
-  // Check parameters
-  if ( CORBA::is_nil(theObject) ) // if theWires is empty - it's OK, it means that ALL wires should be removed
-    return aGEOMObject._retn();
-
   // Get the object itself
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
   if (anObject.IsNull())
     return aGEOMObject._retn();
 
+  // if theWires is empty - it's OK, it means that ALL wires should be removed
+
   // Perform
   Handle(GEOM_Object) aNewObject =
     GetOperations()->RemoveIntWires( anObject, Convert( theWires ) );
@@ -321,23 +305,20 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::RemoveIntWires (GEOM::GEOM_Obje
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::FillHoles (GEOM::GEOM_Object_ptr theObject,
-                                                           const GEOM::short_array& theWires)
+                                                            const GEOM::short_array& theWires)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   // Set a not done flag
   GetOperations()->SetNotDone();
 
-  // Check parameters
-  if ( CORBA::is_nil(theObject) ) // if theWires is empty - it's OK, it means that ALL wires should be removed
-    return aGEOMObject._retn();
-
   // Get the object itself
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
   if (anObject.IsNull())
     return aGEOMObject._retn();
 
+  // if theWires is empty - it's OK, it means that ALL wires should be removed
+
   // Perform
   Handle(GEOM_Object) aNewObject =
     GetOperations()->FillHoles( anObject, Convert( theWires ) );
@@ -353,7 +334,7 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::FillHoles (GEOM::GEOM_Object_pt
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theObject,
-                                                     CORBA::Double theTolerance)
+                                                      CORBA::Double theTolerance)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -361,12 +342,11 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theO
   GetOperations()->SetNotDone();
 
   // Check parameters
-  if ( CORBA::is_nil(theObject) || theTolerance < 0 )
+  if (theTolerance < 0)
     return aGEOMObject._retn();
 
   // Get the object itself
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
   if (anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -386,8 +366,8 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::Sew (GEOM::GEOM_Object_ptr theO
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::DivideEdge (GEOM::GEOM_Object_ptr theObject,
                                                              CORBA::Short theIndex,
-                                                            CORBA::Double theValue,
-                                                            CORBA::Boolean isByParameter)
+                                                             CORBA::Double theValue,
+                                                             CORBA::Boolean isByParameter)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -395,12 +375,11 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::DivideEdge (GEOM::GEOM_Object_p
   GetOperations()->SetNotDone();
 
   // Check parameters
-  if ( CORBA::is_nil(theObject) || theValue < 0 || theValue > 1 )
+  if (theValue < 0 || theValue > 1)
     return aGEOMObject._retn();
 
   // Get the object itself
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
   if (anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -419,8 +398,8 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::DivideEdge (GEOM::GEOM_Object_p
  */
 //=============================================================================
 CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_ptr theObject,
-                                                           GEOM::ListOfGO_out theClosedWires,
-                                                           GEOM::ListOfGO_out theOpenWires )
+                                                            GEOM::ListOfGO_out theClosedWires,
+                                                            GEOM::ListOfGO_out theOpenWires )
 {
   theClosedWires = new GEOM::ListOfGO;
   theOpenWires = new GEOM::ListOfGO;
@@ -428,12 +407,8 @@ CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_pt
   // Set a not done flag
   GetOperations()->SetNotDone();
 
-  if ( CORBA::is_nil(theObject) )
-       return false;
-
   // Get the object itself
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
   if (anObject.IsNull())
     return false;
 
@@ -442,7 +417,7 @@ CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_pt
   bool res = GetOperations()->GetFreeBoundary( anObject, aClosed, anOpen );
 
   if ( !GetOperations()->IsDone() || !res )
-       return false;
+    return false;
 
   int i, n = aClosed->Length();
   theClosedWires->length( n );
@@ -477,8 +452,7 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientation (GEOM::GEOM_O
   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
 
   // Get the object itself
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
   if (anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -489,7 +463,7 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientation (GEOM::GEOM_O
 //    return aGEOMObject._retn();
 
   //return GetObject(aNewObject);
-  return aGEOMObject._retn();  
+  return aGEOMObject._retn();
 }
 
 
@@ -505,13 +479,8 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientationCopy (GEOM::GE
   // Set a not done flag
   GetOperations()->SetNotDone();
 
-  // Check parameters
-  if ( CORBA::is_nil(theObject) )
-    return aGEOMObject._retn();
-
   // Get the object itself
-  Handle(GEOM_Object) anObject =
-    GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
+  Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
   if (anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -523,4 +492,3 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientationCopy (GEOM::GE
 
   return GetObject(aNewObject);
 }
-