]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0020230: Memory perf of BoundingBox
authorjfa <jfa@opencascade.com>
Thu, 9 Apr 2009 09:31:11 +0000 (09:31 +0000)
committerjfa <jfa@opencascade.com>
Thu, 9 Apr 2009 09:31:11 +0000 (09:31 +0000)
src/GEOM_I/GEOM_I3DPrimOperations_i.cc
src/GEOM_I/GEOM_IBasicOperations_i.cc
src/GEOM_I/GEOM_IMeasureOperations_i.cc
src/GEOM_I/GEOM_IOperations_i.cc
src/GEOM_I/GEOM_IOperations_i.hh

index 104bb85abf835d3e585ca16d5d6fbb95af5b6592..14922b2e0240a7fbf2e183d6eb3ff2bc0255a809 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 "GEOM_I3DPrimOperations_i.hh"
@@ -58,19 +58,19 @@ GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i()
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX,
-                                                              CORBA::Double theDY,
-                                                              CORBA::Double theDZ)
+                                                               CORBA::Double theDY,
+                                                               CORBA::Double theDZ)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
-   
+
   //Create the Box
   Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
+
   return GetObject(anObject);
 }
 
@@ -87,13 +87,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
-
-  //Get the reference points
-  Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
-    (thePnt1->GetStudyID(), thePnt1->GetEntry());
-  Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
-    (thePnt2->GetStudyID(), thePnt2->GetEntry());
+  Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
+  Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
 
   if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
 
@@ -111,8 +106,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
-                                                           CORBA::Double theW,
-                                                           CORBA::Short  theOrientation)
+                                                            CORBA::Double theW,
+                                                            CORBA::Short  theOrientation)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -137,20 +132,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
                                                (GEOM::GEOM_Object_ptr theObj,
-                                               CORBA::Double theH,
-                                               CORBA::Double theW)
+                                                CORBA::Double theH,
+                                                CORBA::Double theW)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theObj == NULL || theH == 0 || theW == 0)
-    return aGEOMObject._retn();
-
-  //Get the reference points
-  Handle(GEOM_Object) anObj = GetOperations()->GetEngine()->GetObject
-    (theObj->GetStudyID(), theObj->GetEntry());
+  //Get the reference object
+  Handle(GEOM_Object) anObj = GetObjectImpl(theObj);
 
   if (anObj.IsNull())
     return aGEOMObject._retn();
@@ -170,20 +161,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
-                      CORBA::Double theR)
+                       CORBA::Double theR)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
-
   //Get the reference points
-  Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
-    (thePnt->GetStudyID(), thePnt->GetEntry());
-  Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
-    (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
+  Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
 
   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
 
@@ -203,22 +190,17 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
-                      GEOM::GEOM_Object_ptr thePnt3)
+                       GEOM::GEOM_Object_ptr thePnt3)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn();
-
   //Get the reference points
-  Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
-    (thePnt1->GetStudyID(), thePnt1->GetEntry());
-  Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
-    (thePnt2->GetStudyID(), thePnt2->GetEntry());
-  Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject
-    (thePnt3->GetStudyID(), thePnt3->GetEntry());
+  Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
+  Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
+  Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3);
 
   if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
 
@@ -237,7 +219,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
-                                                          CORBA::Short  theOrientation)
+                                                           CORBA::Short  theOrientation)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -261,7 +243,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
-                                                               CORBA::Double theH)
+                                                                CORBA::Double theH)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -283,20 +265,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
-                      CORBA::Double theR, CORBA::Double theH)
+                       CORBA::Double theR, CORBA::Double theH)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
-
   //Get the reference points
-  Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
-    (thePnt->GetStudyID(), thePnt->GetEntry());
-  Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
-    (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
+  Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
 
   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
 
@@ -314,8 +292,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
-                                                              CORBA::Double theR2,
-                                                              CORBA::Double theH)
+                                                               CORBA::Double theR2,
+                                                               CORBA::Double theH)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -337,20 +315,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double the
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
-                      CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
+                       CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
-
   //Get the reference points
-  Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
-    (thePnt->GetStudyID(), thePnt->GetEntry());
-  Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
-    (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
+  Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
 
   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
 
@@ -396,18 +370,14 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt == NULL) return aGEOMObject._retn();
-
   //Get the reference point
-  CORBA::String_var entry=thePnt->GetEntry();
-  Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
-    (thePnt->GetStudyID(), entry);
+  Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
 
   if (aPnt.IsNull()) return aGEOMObject._retn();
 
   //Create the Sphere
   Handle(GEOM_Object) anObject =
-      GetOperations()->MakeSpherePntR(aPnt, theR);
+    GetOperations()->MakeSpherePntR(aPnt, theR);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -443,20 +413,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
-                      CORBA::Double theRMajor, CORBA::Double theRMinor)
+                       CORBA::Double theRMajor, CORBA::Double theRMinor)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
-
   //Get the reference points
-  Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
-    (thePnt->GetStudyID(), thePnt->GetEntry());
-  Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
-    (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
+  Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
 
   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
 
@@ -476,20 +442,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
-                      CORBA::Double theH)
+                       CORBA::Double theH)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
-    (theBase->GetStudyID(), theBase->GetEntry());
-  Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
-    (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
+  Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
 
   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
 
@@ -509,20 +471,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
-                      CORBA::Double theH)
+                       CORBA::Double theH)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
-    (theBase->GetStudyID(), theBase->GetEntry());
-  Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
-    (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
+  Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
 
   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
 
@@ -542,24 +500,18 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
                                              (GEOM::GEOM_Object_ptr theBase,
-                                             GEOM::GEOM_Object_ptr thePoint1,
-                                             GEOM::GEOM_Object_ptr thePoint2)
+                                              GEOM::GEOM_Object_ptr thePoint1,
+                                              GEOM::GEOM_Object_ptr thePoint2)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
-    return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
-    (theBase->GetStudyID(), theBase->GetEntry());
-  Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
-    (thePoint1->GetStudyID(), thePoint1->GetEntry());
-  Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
-    (thePoint2->GetStudyID(), thePoint2->GetEntry());
+  Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
+  Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
+  Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
 
   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
     return aGEOMObject._retn();
@@ -580,24 +532,18 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
                                              (GEOM::GEOM_Object_ptr theBase,
-                                             GEOM::GEOM_Object_ptr thePoint1,
-                                             GEOM::GEOM_Object_ptr thePoint2)
+                                              GEOM::GEOM_Object_ptr thePoint1,
+                                              GEOM::GEOM_Object_ptr thePoint2)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
-    return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
-    (theBase->GetStudyID(), theBase->GetEntry());
-  Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
-    (thePoint1->GetStudyID(), thePoint1->GetEntry());
-  Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
-    (thePoint2->GetStudyID(), thePoint2->GetEntry());
+  Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
+  Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
+  Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
 
   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
     return aGEOMObject._retn();
@@ -618,18 +564,15 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
-                      CORBA::Double theDY, CORBA::Double theDZ)
+                       CORBA::Double theDY, CORBA::Double theDZ)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBase == NULL) return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
-    (theBase->GetStudyID(), theBase->GetEntry());
+  Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
 
   if (aBase.IsNull()) return aGEOMObject._retn();
 
@@ -649,18 +592,15 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
-                      CORBA::Double theDY, CORBA::Double theDZ)
+                       CORBA::Double theDY, CORBA::Double theDZ)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBase == NULL) return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
-    (theBase->GetStudyID(), theBase->GetEntry());
+  Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
 
   if (aBase.IsNull()) return aGEOMObject._retn();
 
@@ -686,13 +626,9 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBase == NULL || thePath == NULL) return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
-    (theBase->GetStudyID(), theBase->GetEntry());
-  Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
-    (thePath->GetStudyID(), thePath->GetEntry());
+  Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
+  Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
 
   if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
 
@@ -712,20 +648,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
-                      CORBA::Double theAngle)
+                       CORBA::Double theAngle)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
-    (theBase->GetStudyID(), theBase->GetEntry());
-  Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
-    (theAxis->GetStudyID(), theAxis->GetEntry());
+  Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
+  Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
 
   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
 
@@ -745,20 +677,16 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
-                      CORBA::Double theAngle)
+                       CORBA::Double theAngle)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
-    (theBase->GetStudyID(), theBase->GetEntry());
-  Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
-    (theAxis->GetStudyID(), theAxis->GetEntry());
+  Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
+  Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
 
   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
 
@@ -777,28 +705,26 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
-                                                           CORBA::Long theMinDeg,
-                                                           CORBA::Long theMaxDeg,
-                                                           CORBA::Double theTol2D,
-                                                           CORBA::Double theTol3D,
-                                                           CORBA::Long theNbIter,
-                                                           CORBA::Boolean theApprox)
+                                                            CORBA::Long theMinDeg,
+                                                            CORBA::Long theMaxDeg,
+                                                            CORBA::Double theTol2D,
+                                                            CORBA::Double theTol3D,
+                                                            CORBA::Long theNbIter,
+                                                            CORBA::Boolean theApprox)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
 
   if (aShape.IsNull()) return aGEOMObject._retn();
 
   //Create the Solid
-  Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox);
+  Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
+    (aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theApprox);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -811,9 +737,9 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_pt
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
-                                                                CORBA::Boolean theModeSolid,
-                                                                CORBA::Double thePreci,
-                                                                CORBA::Boolean theRuled)
+                                                                 CORBA::Boolean theModeSolid,
+                                                                 CORBA::Double thePreci,
+                                                                 CORBA::Boolean theRuled)
 {
    GEOM::GEOM_Object_var aGEOMObject;
 
@@ -825,13 +751,11 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::Lis
   //Get the shapes
   aLen = theSeqSections.length();
   for (ind = 0; ind < aLen; ind++) {
-    if (theSeqSections[ind] == NULL) continue;
-    Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
-      (theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry());
+    Handle(GEOM_Object) aSh = GetObjectImpl(theSeqSections[ind]);
     if (!aSh.IsNull())
       aSeqSections->Append(aSh);
   }
-  if(!aSeqSections->Length())
+  if (!aSeqSections->Length())
     return aGEOMObject._retn();
 
   // Make shell or solid
@@ -848,55 +772,52 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::Lis
  *  MakePipeWithDifferentSections
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
-                                                                             const GEOM::ListOfGO& theLocations,
-                                                                             GEOM::GEOM_Object_ptr thePath,
-                                                                             CORBA::Boolean theWithContact,
-                                                                             CORBA::Boolean theWithCorrections)
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
+                      (const GEOM::ListOfGO& theBases,
+                       const GEOM::ListOfGO& theLocations,
+                       GEOM::GEOM_Object_ptr thePath,
+                       CORBA::Boolean theWithContact,
+                       CORBA::Boolean theWithCorrections)
 {
-   GEOM::GEOM_Object_var aGEOMObject;
+  GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
   int ind=0, aNbBases =0,aNbLocs=0;
-  
+
   //Get the shapes
   aNbBases = theBases.length();
   aNbLocs = theLocations.length();
 
-  if( aNbLocs &&  aNbBases != aNbLocs)
+  if (aNbLocs && aNbBases != aNbLocs)
+    return aGEOMObject._retn();
+
+  Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
+  if (aPath.IsNull())
     return aGEOMObject._retn();
-  
-   Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
-      (thePath->GetStudyID(), thePath->GetEntry());
-   if(aPath.IsNull())
-     return aGEOMObject._retn();
 
   for (ind = 0; ind < aNbBases; ind++) {
-    if (theBases[ind] == NULL) continue;
-    Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject(theBases[ind]->GetStudyID(), 
-                       theBases[ind]->GetEntry());
-    if(aBase.IsNull())
+    Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
+    if (aBase.IsNull())
       continue;
-    if(aNbLocs)
+    if (aNbLocs)
     {
-      Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
-       (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
-      if(aLoc.IsNull())
-       continue;
+      Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
+      if (aLoc.IsNull())
+        continue;
       aSeqLocations->Append(aLoc);
     }
     aSeqBases->Append(aBase);
   }
-  if(!aSeqBases->Length())
+  if (!aSeqBases->Length())
     return aGEOMObject._retn();
 
   // Make pipe
   Handle(GEOM_Object) anObject =
     GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
-                                                  theWithContact,theWithCorrections);
+                                                   theWithContact,theWithCorrections);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -911,11 +832,11 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(co
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
                  (const GEOM::ListOfGO& theBases,
-                 const GEOM::ListOfGO& theSubBases,
-                 const GEOM::ListOfGO& theLocations,
-                 GEOM::GEOM_Object_ptr thePath,
-                 CORBA::Boolean theWithContact,
-                 CORBA::Boolean theWithCorrections)
+                  const GEOM::ListOfGO& theSubBases,
+                  const GEOM::ListOfGO& theLocations,
+                  GEOM::GEOM_Object_ptr thePath,
+                  CORBA::Boolean theWithContact,
+                  CORBA::Boolean theWithCorrections)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -925,55 +846,49 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
   Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
   int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
-  
+
   //Get the shapes
   aNbBases = theBases.length();
   aNbSubBases = theSubBases.length();
   aNbLocs = theLocations.length();
 
-  if( aNbLocs &&  aNbBases != aNbLocs)
+  if (aNbLocs && aNbBases != aNbLocs)
+    return aGEOMObject._retn();
+
+  Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
+  if (aPath.IsNull())
     return aGEOMObject._retn();
-  
-   Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
-      (thePath->GetStudyID(), thePath->GetEntry());
-   if(aPath.IsNull())
-     return aGEOMObject._retn();
 
   for (ind = 0; ind < aNbBases; ind++) {
-    if (theBases[ind] == NULL) continue;
-    Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
-      GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
-    if(aBase.IsNull())
+    Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
+    if (aBase.IsNull())
       continue;
-    if(aNbLocs) {
-      Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
-       (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
-      if(aLoc.IsNull())
-       continue;
+    if (aNbLocs) {
+      Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
+      if (aLoc.IsNull())
+        continue;
       aSeqLocations->Append(aLoc);
     }
     aSeqBases->Append(aBase);
 
-    if(aNbSubBases>=aNbBases) {
-      Handle(GEOM_Object) aSubBase = GetOperations()->GetEngine()->
-       GetObject(theSubBases[ind]->GetStudyID(), theSubBases[ind]->GetEntry());
-      if(aSubBase.IsNull()) {
-       aSeqSubBases->Clear();
-       aNbSubBases = 0;
-       continue;
+    if (aNbSubBases >= aNbBases) {
+      Handle(GEOM_Object) aSubBase = GetObjectImpl(theSubBases[ind]);
+      if (aSubBase.IsNull()) {
+        aSeqSubBases->Clear();
+        aNbSubBases = 0;
+        continue;
       }
       aSeqSubBases->Append(aSubBase);
     }
-
   }
-  if(!aSeqBases->Length())
+  if (!aSeqBases->Length())
     return aGEOMObject._retn();
 
   // Make pipe
   Handle(GEOM_Object) anObject =
     GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
-                                              aSeqLocations, aPath,
-                                              theWithContact, theWithCorrections);
+                                               aSeqLocations, aPath,
+                                               theWithContact, theWithCorrections);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -988,7 +903,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
                  (const GEOM::ListOfGO& theBases,
-                 const GEOM::ListOfGO& theLocations)
+                  const GEOM::ListOfGO& theLocations)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -997,31 +912,28 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
   int ind=0, aNbBases=0, aNbLocs=0;
-  
+
   //Get the shapes
   aNbBases = theBases.length();
   aNbLocs = theLocations.length();
 
-  if( aNbLocs &&  aNbBases != aNbLocs)
+  if (aNbLocs && aNbBases != aNbLocs)
     return aGEOMObject._retn();
-  
+
   for (ind = 0; ind < aNbBases; ind++) {
-    if (theBases[ind] == NULL) continue;
-    Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
-      GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
-    if(aBase.IsNull())
+    Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
+    if (aBase.IsNull())
       continue;
-    if(aNbLocs) {
-      Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
-       (theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
-      if(aLoc.IsNull())
-       continue;
+    if (aNbLocs) {
+      Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
+      if (aLoc.IsNull())
+        continue;
       aSeqLocations->Append(aLoc);
     }
     aSeqBases->Append(aBase);
   }
 
-  if(!aSeqBases->Length())
+  if (!aSeqBases->Length())
     return aGEOMObject._retn();
 
   // Make pipe
@@ -1041,24 +953,19 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
-                 (GEOM::GEOM_Object_ptr theBase, 
-                 GEOM::GEOM_Object_ptr thePath, 
-                 GEOM::GEOM_Object_ptr theVec)
+                 (GEOM::GEOM_Object_ptr theBase,
+                  GEOM::GEOM_Object_ptr thePath,
+                  GEOM::GEOM_Object_ptr theVec)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theBase == NULL || thePath == NULL || theVec == NULL) return aGEOMObject._retn();
-
   //Get the reference objects
-  Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
-    (theBase->GetStudyID(), theBase->GetEntry());
-  Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
-    (thePath->GetStudyID(), thePath->GetEntry());
-  Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
-    (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
+  Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
+  Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
 
   if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
 
index f475de827f6ea049caa991d573a4e17543d69d5a..b4c3b9f8e0e21655d8f77d1f1590293f2e443775 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 "GEOM_IBasicOperations_i.hh"
@@ -36,8 +36,8 @@
  */
 //=============================================================================
 GEOM_IBasicOperations_i::GEOM_IBasicOperations_i (PortableServer::POA_ptr thePOA,
-                                                 GEOM::GEOM_Gen_ptr theEngine,
-                                                 ::GEOMImpl_IBasicOperations* theImpl)
+                                                  GEOM::GEOM_Gen_ptr theEngine,
+                                                  ::GEOMImpl_IBasicOperations* theImpl)
      :GEOM_IOperations_i(thePOA, theEngine, theImpl)
 {
   MESSAGE("GEOM_IBasicOperations_i::GEOM_IBasicOperations_i");
@@ -67,8 +67,7 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointXYZ
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-   //Create the point
-
+  //Create the point
   Handle(GEOM_Object) anObject = GetOperations()->MakePointXYZ(theX, theY, theZ);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -89,18 +88,13 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointWithReference
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if(theReference == NULL) return aGEOMObject._retn();
-
   //Get the reference point
-
-  Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject
-    (theReference->GetStudyID(), theReference->GetEntry());
-  if (aRefernce.IsNull()) return aGEOMObject._retn();
+  Handle(GEOM_Object) aReference = GetObjectImpl(theReference);
+  if (aReference.IsNull()) return aGEOMObject._retn();
 
   //Create the point
-
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakePointWithReference(aRefernce, theX, theY, theZ);
+    GetOperations()->MakePointWithReference(aReference, theX, theY, theZ);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -120,18 +114,12 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnLinesIntersection
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theLine1 == NULL || theLine2 == NULL) return aGEOMObject._retn();
-
   //Get the reference Lines
-
-  Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
-    (theLine1->GetStudyID(), theLine1->GetEntry());
-  Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
-    (theLine2->GetStudyID(), theLine2->GetEntry());
+  Handle(GEOM_Object) aRef1 = GetObjectImpl(theLine1);
+  Handle(GEOM_Object) aRef2 = GetObjectImpl(theLine2);
   if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
 
   //Create the point
-
   Handle(GEOM_Object) anObject =
     GetOperations()->MakePointOnLinesIntersection(aRef1, aRef2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
@@ -140,7 +128,6 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnLinesIntersection
   return GetObject(anObject);
 }
 
-
 //=============================================================================
 /*!
  *  MakePointOnCurve
@@ -154,25 +141,19 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theCurve == NULL) return aGEOMObject._retn();
-
   //Get the reference curve
-
-  Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject
-    (theCurve->GetStudyID(), theCurve->GetEntry());
-  if (aRefernce.IsNull()) return aGEOMObject._retn();
+  Handle(GEOM_Object) aReference = GetObjectImpl(theCurve);
+  if (aReference.IsNull()) return aGEOMObject._retn();
 
   //Create the point
-
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakePointOnCurve(aRefernce, theParameter);
+    GetOperations()->MakePointOnCurve(aReference, theParameter);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
   return GetObject(anObject);
 }
 
-
 //=============================================================================
 /*!
  *  MakePointOnSurface
@@ -180,24 +161,21 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnSurface
                                              (GEOM::GEOM_Object_ptr theSurface,
-                                             CORBA::Double theUParameter,
-                                             CORBA::Double theVParameter)
+                                              CORBA::Double theUParameter,
+                                              CORBA::Double theVParameter)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theSurface == NULL) return aGEOMObject._retn();
-
   //Get the reference surface
-  Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject
-    (theSurface->GetStudyID(), theSurface->GetEntry());
-  if (aRefernce.IsNull()) return aGEOMObject._retn();
+  Handle(GEOM_Object) aReference = GetObjectImpl(theSurface);
+  if (aReference.IsNull()) return aGEOMObject._retn();
 
   //Create the point
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakePointOnSurface(aRefernce, theUParameter, theVParameter);
+    GetOperations()->MakePointOnSurface(aReference, theUParameter, theVParameter);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -218,25 +196,19 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeTangentOnCurve
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theCurve == NULL) return aGEOMObject._retn();
-
   //Get the reference curve
+  Handle(GEOM_Object) aReference = GetObjectImpl(theCurve);
+  if (aReference.IsNull()) return aGEOMObject._retn();
 
-  Handle(GEOM_Object) aRefernce = GetOperations()->GetEngine()->GetObject
-    (theCurve->GetStudyID(), theCurve->GetEntry());
-  if (aRefernce.IsNull()) return aGEOMObject._retn();
-
-  //Create the point
-
+  //Create the vector
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakeTangentOnCurve(aRefernce, theParameter);
+    GetOperations()->MakeTangentOnCurve(aReference, theParameter);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
   return GetObject(anObject);
 }
 
-
 //=============================================================================
 /*!
  *  MakeVectorDXDYDZ
@@ -272,20 +244,13 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeVectorTwoPnt
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
-
   //Get the reference points
-
-  Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
-    (thePnt1->GetStudyID(), thePnt1->GetEntry());
-  Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
-    (thePnt2->GetStudyID(), thePnt2->GetEntry());
+  Handle(GEOM_Object) aRef1 = GetObjectImpl(thePnt1);
+  Handle(GEOM_Object) aRef2 = GetObjectImpl(thePnt2);
   if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
 
   //Create the vector
-
-  Handle(GEOM_Object) anObject =
-    GetOperations()->MakeVectorTwoPnt(aRef1, aRef2);
+  Handle(GEOM_Object) anObject = GetOperations()->MakeVectorTwoPnt(aRef1, aRef2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -306,20 +271,13 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLine
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt == NULL || theDir == NULL) return aGEOMObject._retn();
-
   //Get the reference objects
-
-  Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
-    (thePnt->GetStudyID(), thePnt->GetEntry());
-  Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
-    (theDir->GetStudyID(), theDir->GetEntry());
+  Handle(GEOM_Object) aRef1 = GetObjectImpl(thePnt);
+  Handle(GEOM_Object) aRef2 = GetObjectImpl(theDir);
   if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
 
   //Create the Line
-
-  Handle(GEOM_Object) anObject =
-    GetOperations()->MakeLine(aRef1, aRef2);
+  Handle(GEOM_Object) anObject = GetOperations()->MakeLine(aRef1, aRef2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -339,20 +297,13 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoPnt
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
-
   //Get the reference points
-
-  Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
-    (thePnt1->GetStudyID(), thePnt1->GetEntry());
-  Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
-    (thePnt2->GetStudyID(), thePnt2->GetEntry());
+  Handle(GEOM_Object) aRef1 = GetObjectImpl(thePnt1);
+  Handle(GEOM_Object) aRef2 = GetObjectImpl(thePnt2);
   if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
 
   //Create the Line
-
-  Handle(GEOM_Object) anObject =
-    GetOperations()->MakeLineTwoPnt(aRef1, aRef2);
+  Handle(GEOM_Object) anObject = GetOperations()->MakeLineTwoPnt(aRef1, aRef2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -372,18 +323,12 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoFaces
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theFace1 == NULL || theFace2 == NULL) return aGEOMObject._retn();
-
   //Get the reference points
-
-  Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
-    (theFace1->GetStudyID(), theFace1->GetEntry());
-  Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
-    (theFace2->GetStudyID(), theFace2->GetEntry());
+  Handle(GEOM_Object) aRef1 = GetObjectImpl(theFace1);
+  Handle(GEOM_Object) aRef2 = GetObjectImpl(theFace2);
   if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
 
   //Create the Line
-
   Handle(GEOM_Object) anObject =
     GetOperations()->MakeLineTwoFaces(aRef1, aRef2);
   if (!GetOperations()->IsDone() || anObject.IsNull())
@@ -392,6 +337,7 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoFaces
   return GetObject(anObject);
 }
 
+
 //=============================================================================
 /*!
  *  MakePlanePntVec
@@ -399,25 +345,19 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeLineTwoFaces
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlanePntVec
                  (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
-                 CORBA::Double theTrimSize)
+                  CORBA::Double theTrimSize)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
-
   //Get the references
-
-  Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
-    (thePnt->GetStudyID(), thePnt->GetEntry());
-  Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
-    (theVec->GetStudyID(), theVec->GetEntry());
+  Handle(GEOM_Object) aRef1 = GetObjectImpl(thePnt);
+  Handle(GEOM_Object) aRef2 = GetObjectImpl(theVec);
   if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
 
   //Create the plane
-
   Handle(GEOM_Object) anObject =
     GetOperations()->MakePlanePntVec(aRef1, aRef2, theTrimSize);
   if (!GetOperations()->IsDone() || anObject.IsNull())
@@ -433,29 +373,21 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlanePntVec
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneThreePnt
                  (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
-                 GEOM::GEOM_Object_ptr thePnt3, CORBA::Double theTrimSize)
+                  GEOM::GEOM_Object_ptr thePnt3, CORBA::Double theTrimSize)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL)
-    return aGEOMObject._retn();
-
   //Get the reference points
-
-  Handle(GEOM_Object) aRef1 = GetOperations()->GetEngine()->GetObject
-    (thePnt1->GetStudyID(), thePnt1->GetEntry());
-  Handle(GEOM_Object) aRef2 = GetOperations()->GetEngine()->GetObject
-    (thePnt2->GetStudyID(), thePnt2->GetEntry());
-  Handle(GEOM_Object) aRef3 = GetOperations()->GetEngine()->GetObject
-    (thePnt3->GetStudyID(), thePnt3->GetEntry());
+  Handle(GEOM_Object) aRef1 = GetObjectImpl(thePnt1);
+  Handle(GEOM_Object) aRef2 = GetObjectImpl(thePnt2);
+  Handle(GEOM_Object) aRef3 = GetObjectImpl(thePnt3);
   if (aRef1.IsNull() || aRef2.IsNull() || aRef3.IsNull())
     return aGEOMObject._retn();
 
   //Create the plane
-
   Handle(GEOM_Object) anObject =
     GetOperations()->MakePlaneThreePnt(aRef1, aRef2, aRef3, theTrimSize);
   if (!GetOperations()->IsDone() || anObject.IsNull())
@@ -477,16 +409,11 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneFace
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theFace == NULL) return aGEOMObject._retn();
-
   //Get the reference face
-
-  Handle(GEOM_Object) aRef = GetOperations()->GetEngine()->GetObject
-    (theFace->GetStudyID(), theFace->GetEntry());
+  Handle(GEOM_Object) aRef = GetObjectImpl(theFace);
   if (aRef.IsNull()) return aGEOMObject._retn();
 
   //Create the plane
-
   Handle(GEOM_Object) anObject =
     GetOperations()->MakePlaneFace(aRef, theTrimSize);
   if (!GetOperations()->IsDone() || anObject.IsNull())
@@ -513,8 +440,8 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarker
 
   //Create the point
   Handle(GEOM_Object) anObject = GetOperations()->MakeMarker(theOX , theOY , theOZ,
-                                                            theXDX, theXDY, theXDZ,
-                                                            theYDX, theYDY, theYDZ);
+                                                             theXDX, theXDY, theXDZ,
+                                                             theYDX, theYDY, theYDZ);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
@@ -528,26 +455,21 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeMarker
 //=============================================================================
 
 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeTangentPlaneOnFace
-                     (GEOM::GEOM_Object_ptr theFace, 
-                     CORBA::Double theParameterU,
-                     CORBA::Double theParameterV,
-                     CORBA::Double theTrimSize)
+                     (GEOM::GEOM_Object_ptr theFace,
+                      CORBA::Double theParameterU,
+                      CORBA::Double theParameterV,
+                      CORBA::Double theTrimSize)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theFace == NULL) return aGEOMObject._retn();
-
   //Get the reference face
-
-  Handle(GEOM_Object) aRef = GetOperations()->GetEngine()->GetObject
-    (theFace->GetStudyID(), theFace->GetEntry());
+  Handle(GEOM_Object) aRef = GetObjectImpl(theFace);
   if (aRef.IsNull()) return aGEOMObject._retn();
 
   //Create the plane
-
   Handle(GEOM_Object) anObject =
     GetOperations()->MakeTangentPlaneOnFace(aRef, theParameterU,theParameterV,theTrimSize);
   if (!GetOperations()->IsDone() || anObject.IsNull())
@@ -555,4 +477,3 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakeTangentPlaneOnFace
 
   return GetObject(anObject);
 }
-
index 84248c73bcd2f408ab954e8d1de21403287a9a33..f3e332365e3e296a40fb64ff00e96063661aad87 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 "GEOM_IMeasureOperations_i.hh"
@@ -35,8 +35,8 @@
  */
 //=============================================================================
 GEOM_IMeasureOperations_i::GEOM_IMeasureOperations_i (PortableServer::POA_ptr thePOA,
-                                                   GEOM::GEOM_Gen_ptr theEngine,
-                                                   ::GEOMImpl_IMeasureOperations* theImpl)
+                                                      GEOM::GEOM_Gen_ptr theEngine,
+                                                      ::GEOMImpl_IMeasureOperations* theImpl)
 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
 {
   MESSAGE("GEOM_IMeasureOperations_i::GEOM_IMeasureOperations_i");
@@ -59,8 +59,8 @@ GEOM_IMeasureOperations_i::~GEOM_IMeasureOperations_i()
 //=============================================================================
 GEOM::GEOM_IKindOfShape::shape_kind GEOM_IMeasureOperations_i::KindOfShape
                                    (GEOM::GEOM_Object_ptr  theShape,
-                                   GEOM::ListOfLong_out   theIntegers,
-                                   GEOM::ListOfDouble_out theDoubles)
+                                    GEOM::ListOfLong_out   theIntegers,
+                                    GEOM::ListOfDouble_out theDoubles)
 {
   GEOMImpl_IMeasureOperations::ShapeKind aKind = GEOMImpl_IMeasureOperations::SK_NO_SHAPE;
 
@@ -69,8 +69,7 @@ GEOM::GEOM_IKindOfShape::shape_kind GEOM_IMeasureOperations_i::KindOfShape
   GEOM::ListOfDouble_var aDoublesArray = new GEOM::ListOfDouble();
 
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
 
   if (!aShape.IsNull()) {
     Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger;
@@ -106,9 +105,9 @@ GEOM::GEOM_IKindOfShape::shape_kind GEOM_IMeasureOperations_i::KindOfShape
 //=============================================================================
 void GEOM_IMeasureOperations_i::GetPosition
                  (GEOM::GEOM_Object_ptr theShape,
-                 CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz,
-                 CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz,
-                 CORBA::Double& Xx, CORBA::Double& Xy, CORBA::Double& Xz)
+                  CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz,
+                  CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz,
+                  CORBA::Double& Xx, CORBA::Double& Xy, CORBA::Double& Xz)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
@@ -117,12 +116,8 @@ void GEOM_IMeasureOperations_i::GetPosition
   Ox = Oy = Oz = Zx = Zy = Xy = Xz = 0.;
   Zz = Xx = 1.;
 
-  if (theShape == NULL) return;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return;
 
   // Get shape parameters
@@ -142,12 +137,8 @@ GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetCentreOfMass
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (CORBA::is_nil(theShape)) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return aGEOMObject._retn();
 
   // Make Point - centre of mass of theShape
@@ -165,27 +156,21 @@ GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetCentreOfMass
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetNormal
                                        (GEOM::GEOM_Object_ptr theFace,
-                                       GEOM::GEOM_Object_ptr theOptionalPoint)
+                                        GEOM::GEOM_Object_ptr theOptionalPoint)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (CORBA::is_nil(theFace)) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aFace = GetOperations()->GetEngine()->GetObject
-    (theFace->GetStudyID(), theFace->GetEntry());
-
+  Handle(GEOM_Object) aFace = GetObjectImpl(theFace);
   if (aFace.IsNull()) return aGEOMObject._retn();
 
+  // Get the OptionalPoint (can be not defined)
+  Handle(GEOM_Object) anOptionalPoint = GetObjectImpl(theOptionalPoint);
+
   // Make Vector - normal to theFace (in point theOptionalPoint if the face is not planar)
-  Handle(GEOM_Object) anOptionalPoint;
-  if (!CORBA::is_nil(theOptionalPoint)) {
-    anOptionalPoint = GetOperations()->GetEngine()->GetObject
-      (theOptionalPoint->GetStudyID(), theOptionalPoint->GetEntry());
-  }
   Handle(GEOM_Object) anObject = GetOperations()->GetNormal(aFace, anOptionalPoint);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
@@ -199,19 +184,15 @@ GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetNormal
  */
 //=============================================================================
 void GEOM_IMeasureOperations_i::GetBasicProperties (GEOM::GEOM_Object_ptr theShape,
-                                                   CORBA::Double& theLength,
-                                                   CORBA::Double& theSurfArea,
-                                                   CORBA::Double& theVolume)
+                                                    CORBA::Double& theLength,
+                                                    CORBA::Double& theSurfArea,
+                                                    CORBA::Double& theVolume)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL) return;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return;
 
   // Get shape parameters
@@ -233,20 +214,16 @@ void GEOM_IMeasureOperations_i::GetInertia
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL) return;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return;
 
   // Get shape parameters
   GetOperations()->GetInertia(aShape,
-                             I11, I12, I13,
-                             I21, I22, I23,
-                             I31, I32, I33,
-                             Ix , Iy , Iz);
+                              I11, I12, I13,
+                              I21, I22, I23,
+                              I31, I32, I33,
+                              Ix , Iy , Iz);
 }
 
 //=============================================================================
@@ -255,19 +232,15 @@ void GEOM_IMeasureOperations_i::GetInertia
  */
 //=============================================================================
 void GEOM_IMeasureOperations_i::GetBoundingBox (GEOM::GEOM_Object_ptr theShape,
-                                               CORBA::Double& Xmin, CORBA::Double& Xmax,
-                                               CORBA::Double& Ymin, CORBA::Double& Ymax,
-                                               CORBA::Double& Zmin, CORBA::Double& Zmax)
+                                                CORBA::Double& Xmin, CORBA::Double& Xmax,
+                                                CORBA::Double& Ymin, CORBA::Double& Ymax,
+                                                CORBA::Double& Zmin, CORBA::Double& Zmax)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL) return;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return;
 
   // Get shape parameters
@@ -281,26 +254,22 @@ void GEOM_IMeasureOperations_i::GetBoundingBox (GEOM::GEOM_Object_ptr theShape,
 //=============================================================================
 void GEOM_IMeasureOperations_i::GetTolerance
                                 (GEOM::GEOM_Object_ptr theShape,
-                                CORBA::Double& FaceMin, CORBA::Double& FaceMax,
-                                CORBA::Double& EdgeMin, CORBA::Double& EdgeMax,
-                                CORBA::Double& VertMin, CORBA::Double& VertMax)
+                                 CORBA::Double& FaceMin, CORBA::Double& FaceMax,
+                                 CORBA::Double& EdgeMin, CORBA::Double& EdgeMax,
+                                 CORBA::Double& VertMin, CORBA::Double& VertMax)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL) return;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return;
 
   // Get shape parameters
   GetOperations()->GetTolerance(aShape,
-                               FaceMin, FaceMax,
-                               EdgeMin, EdgeMax,
-                               VertMin, VertMax);
+                                FaceMin, FaceMax,
+                                EdgeMin, EdgeMax,
+                                VertMin, VertMax);
 }
 
 //=============================================================================
@@ -309,20 +278,19 @@ void GEOM_IMeasureOperations_i::GetTolerance
  */
 //=============================================================================
 CORBA::Boolean GEOM_IMeasureOperations_i::CheckShape (GEOM::GEOM_Object_ptr theShape,
-                                                     CORBA::String_out     theDescription)
+                                                      CORBA::String_out     theDescription)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL)
+  if (CORBA::is_nil(theShape))
   {
     theDescription = CORBA::string_dup("null");
     return 0;
   }
 
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
 
   if (aShape.IsNull())
   {
@@ -342,20 +310,19 @@ CORBA::Boolean GEOM_IMeasureOperations_i::CheckShape (GEOM::GEOM_Object_ptr theS
 }
 
 CORBA::Boolean GEOM_IMeasureOperations_i::CheckShapeWithGeometry (GEOM::GEOM_Object_ptr theShape,
-                                                                 CORBA::String_out     theDescription)
+                                                                  CORBA::String_out     theDescription)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL)
+  if (CORBA::is_nil(theShape))
   {
     theDescription = CORBA::string_dup("null");
     return 0;
   }
 
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
 
   if (aShape.IsNull())
   {
@@ -384,12 +351,8 @@ char* GEOM_IMeasureOperations_i::WhatIs (GEOM::GEOM_Object_ptr theShape)
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape == NULL) return NULL;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
   if (aShape.IsNull()) return NULL;
 
   // Get shape parameters
@@ -410,14 +373,9 @@ CORBA::Double GEOM_IMeasureOperations_i::GetMinDistance
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape1 == NULL || theShape2 == NULL) return -1.0;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape1 = GetOperations()->GetEngine()->GetObject
-    (theShape1->GetStudyID(), theShape1->GetEntry());
-  Handle(GEOM_Object) aShape2 = GetOperations()->GetEngine()->GetObject
-    (theShape2->GetStudyID(), theShape2->GetEntry());
-
+  Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
+  Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
   if (aShape1.IsNull() || aShape2.IsNull()) return -1.0;
 
   // Get shape parameters
@@ -430,20 +388,15 @@ CORBA::Double GEOM_IMeasureOperations_i::GetMinDistance
  */
 //=============================================================================
 void GEOM_IMeasureOperations_i::PointCoordinates (GEOM::GEOM_Object_ptr theShape,
-                                                 CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z)
+                                                  CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z)
 
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if ( theShape->_is_nil() )
-    return;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject(
-    theShape->GetStudyID(), theShape->GetEntry() );
-
-  if ( aShape.IsNull() )
+  Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+  if (aShape.IsNull())
     return;
 
   // Get shape parameters
@@ -456,19 +409,14 @@ void GEOM_IMeasureOperations_i::PointCoordinates (GEOM::GEOM_Object_ptr theShape
  */
 //=============================================================================
 CORBA::Double GEOM_IMeasureOperations_i::GetAngle (GEOM::GEOM_Object_ptr theShape1,
-                                                  GEOM::GEOM_Object_ptr theShape2)
+                                                   GEOM::GEOM_Object_ptr theShape2)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if (theShape1 == NULL || theShape2 == NULL) return -1.0;
-
   //Get the reference shapes
-  Handle(GEOM_Object) aShape1 = GetOperations()->GetEngine()->GetObject
-    (theShape1->GetStudyID(), theShape1->GetEntry());
-  Handle(GEOM_Object) aShape2 = GetOperations()->GetEngine()->GetObject
-    (theShape2->GetStudyID(), theShape2->GetEntry());
-
+  Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
+  Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
   if (aShape1.IsNull() || aShape2.IsNull()) return -1.0;
 
   // Get the angle
@@ -487,18 +435,13 @@ CORBA::Double GEOM_IMeasureOperations_i::CurveCurvatureByParam
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if(theCurve==NULL) return -1.0;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theCurve->GetStudyID(), theCurve->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theCurve);
   if(aShape.IsNull()) return -1.0;
 
   return GetOperations()->CurveCurvatureByParam(aShape,theParam);
 }
 
-
 //=============================================================================
 /*!
  *  CurveCurvatureByPoint
@@ -510,14 +453,9 @@ CORBA::Double GEOM_IMeasureOperations_i::CurveCurvatureByPoint
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if( theCurve==NULL || thePoint==NULL ) return -1.0;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theCurve->GetStudyID(), theCurve->GetEntry());
-  Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject
-    (thePoint->GetStudyID(), thePoint->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theCurve);
+  Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
   if( aShape.IsNull() || aPoint.IsNull() ) return -1.0;
 
   return GetOperations()->CurveCurvatureByPoint(aShape,aPoint);
@@ -531,24 +469,19 @@ CORBA::Double GEOM_IMeasureOperations_i::CurveCurvatureByPoint
 //=============================================================================
 CORBA::Double GEOM_IMeasureOperations_i::MaxSurfaceCurvatureByParam
                                                 (GEOM::GEOM_Object_ptr theSurf,
-                                                CORBA::Double theUParam,
-                                                CORBA::Double theVParam)
+                                                 CORBA::Double theUParam,
+                                                 CORBA::Double theVParam)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if(theSurf==NULL) return -1.0;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theSurf->GetStudyID(), theSurf->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theSurf);
   if(aShape.IsNull()) return -1.0;
 
   return GetOperations()->MaxSurfaceCurvatureByParam(aShape,theUParam,theVParam);
 }
 
-
 //=============================================================================
 /*!
  *  MaxSurfaceCurvatureByPoint
@@ -560,20 +493,14 @@ CORBA::Double GEOM_IMeasureOperations_i::MaxSurfaceCurvatureByPoint
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if( theSurf==NULL || thePoint==NULL ) return -1.0;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theSurf->GetStudyID(), theSurf->GetEntry());
-  Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject
-    (thePoint->GetStudyID(), thePoint->GetEntry());
-
+  Handle(GEOM_Object) aShape = GetObjectImpl(theSurf);
+  Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
   if( aShape.IsNull() || aPoint.IsNull() ) return -1.0;
 
   return GetOperations()->MaxSurfaceCurvatureByPoint(aShape,aPoint);
 }
 
-
 //=============================================================================
 /*!
  *  MinSurfaceCurvatureByParam
@@ -581,24 +508,19 @@ CORBA::Double GEOM_IMeasureOperations_i::MaxSurfaceCurvatureByPoint
 //=============================================================================
 CORBA::Double GEOM_IMeasureOperations_i::MinSurfaceCurvatureByParam
                                                 (GEOM::GEOM_Object_ptr theSurf,
-                                                CORBA::Double theUParam,
-                                                CORBA::Double theVParam)
+                                                 CORBA::Double theUParam,
+                                                 CORBA::Double theVParam)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if(theSurf==NULL) return -1.0;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theSurf->GetStudyID(), theSurf->GetEntry());
-
-  if(aShape.IsNull()) return -1.0;
+  Handle(GEOM_Object) aShape = GetObjectImpl(theSurf);
+  if (aShape.IsNull()) return -1.0;
 
   return GetOperations()->MinSurfaceCurvatureByParam(aShape,theUParam,theVParam);
 }
 
-
 //=============================================================================
 /*!
  *  MinSurfaceCurvatureByPoint
@@ -610,15 +532,10 @@ CORBA::Double GEOM_IMeasureOperations_i::MinSurfaceCurvatureByPoint
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  if( theSurf==NULL || thePoint==NULL ) return -1.0;
-
   //Get the reference shape
-  Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
-    (theSurf->GetStudyID(), theSurf->GetEntry());
-  Handle(GEOM_Object) aPoint = GetOperations()->GetEngine()->GetObject
-    (thePoint->GetStudyID(), thePoint->GetEntry());
-
-  if( aShape.IsNull() || aPoint.IsNull() ) return -1.0;
+  Handle(GEOM_Object) aShape = GetObjectImpl(theSurf);
+  Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
+  if (aShape.IsNull() || aPoint.IsNull()) return -1.0;
 
   return GetOperations()->MinSurfaceCurvatureByPoint(aShape,aPoint);
 }
index 3a6516150124c95a41ce45137192e17044472547..e26172e61db143b928d8d6139c828c6aa49e1556 100644 (file)
@@ -137,3 +137,19 @@ GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObjec
   GEOM::GEOM_Object_var GO = _engine->GetObject(theObject->GetDocID(), anEntry.ToCString());
   return GO._retn();
 }
+
+//=============================================================================
+/*!
+ *  GetObjectImpl
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOM_IOperations_i::GetObjectImpl(GEOM::GEOM_Object_ptr theObject)
+{
+  Handle(GEOM_Object) anImpl;
+  if (!CORBA::is_nil(theObject)) {
+    CORBA::String_var anEntry = theObject->GetEntry();
+    anImpl = GetImpl()->GetEngine()->GetObject
+      (theObject->GetStudyID(), anEntry);
+  }
+  return anImpl;
+}
index c816e0bebaebb45e3014d525abb6b3f8c6312ddd..54e7b6dad87db2b1e424177629729995e789a5fd 100644 (file)
@@ -47,6 +47,7 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio
   virtual CORBA::Long GetStudyID();    
 
   virtual GEOM::GEOM_Object_ptr GetObject(Handle(GEOM_Object) theObject);
+  virtual Handle(GEOM_Object) GetObjectImpl(GEOM::GEOM_Object_ptr theObject);
 
   virtual void StartOperation();