Salome HOME
Preparation of intermediate revision
[modules/geom.git] / src / GEOM_I / GEOM_ILocalOperations_i.cc
index c71a24780310ec41c406a41913376ee4388aa809..fe1091f5b57f5cfeedc478fc9fc291c26a424883 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_ILocalOperations_i.hh"
@@ -36,8 +36,8 @@
  */
 //=============================================================================
 GEOM_ILocalOperations_i::GEOM_ILocalOperations_i (PortableServer::POA_ptr thePOA,
-                                                 GEOM::GEOM_Gen_ptr theEngine,
-                                                 ::GEOMImpl_ILocalOperations* theImpl)
+                                                  GEOM::GEOM_Gen_ptr theEngine,
+                                                  ::GEOMImpl_ILocalOperations* theImpl)
      :GEOM_IOperations_i(thePOA, theEngine, theImpl)
 {
   MESSAGE("GEOM_ILocalOperations_i::GEOM_ILocalOperations_i");
@@ -64,12 +64,8 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletAll
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Create the Fillet
@@ -88,15 +84,12 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletAll
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdges
                       (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
-                      const GEOM::ListOfLong& theEdges)
+                       const GEOM::ListOfLong& theEdges)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference edges
@@ -127,11 +120,8 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdgesR1R2
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference edges
@@ -158,15 +148,12 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdgesR1R2
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFaces
                       (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
-                      const GEOM::ListOfLong& theFaces)
+                       const GEOM::ListOfLong& theFaces)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference faces
@@ -197,11 +184,8 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFacesR1R2
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference faces
@@ -228,15 +212,12 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFacesR1R2
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet2D
                       (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
-                      const GEOM::ListOfLong& theVertexes)
+                       const GEOM::ListOfLong& theVertexes)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference vertex
@@ -256,6 +237,38 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet2D
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  MakeFillet1D
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet1D
+                      (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
+                       const GEOM::ListOfLong& theVertexes)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Get the reference shape (wire)
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
+  if (aShapeRef.IsNull()) return aGEOMObject._retn();
+
+  //Get the reference vertex
+  int ind = 0;
+  int aLen = theVertexes.length();
+  list<int> aVertexes;
+  for (; ind < aLen; ind++) {
+    aVertexes.push_back(theVertexes[ind]);
+  }
+
+  //Create the Fillet
+  Handle(GEOM_Object) anObject =
+    GetOperations()->MakeFillet1D(aShapeRef, theR, aVertexes);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  MakeChamferAll
@@ -266,12 +279,8 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferAll
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Create the Chamfer
@@ -290,16 +299,13 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferAll
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdge
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD1, CORBA::Double theD2,
-                      CORBA::Long theFace1, CORBA::Long theFace2)
+                       CORBA::Double theD1, CORBA::Double theD2,
+                       CORBA::Long theFace1, CORBA::Long theFace2)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Create the Chamfer
@@ -317,16 +323,13 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdge
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgeAD
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD, CORBA::Double theAngle,
-                      CORBA::Long theFace1, CORBA::Long theFace2)
+                       CORBA::Double theD, CORBA::Double theAngle,
+                       CORBA::Long theFace1, CORBA::Long theFace2)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Create the Chamfer
@@ -345,16 +348,13 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgeAD
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFaces
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD1, CORBA::Double theD2,
-                      const GEOM::ListOfLong& theFaces)
+                       CORBA::Double theD1, CORBA::Double theD2,
+                       const GEOM::ListOfLong& theFaces)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference faces
@@ -380,16 +380,13 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFaces
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFacesAD
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD, CORBA::Double theAngle,
-                      const GEOM::ListOfLong& theFaces)
+                       CORBA::Double theD, CORBA::Double theAngle,
+                       const GEOM::ListOfLong& theFaces)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference faces
@@ -416,16 +413,13 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFacesAD
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdges
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD1, CORBA::Double theD2,
-                      const GEOM::ListOfLong& theEdges)
+                       CORBA::Double theD1, CORBA::Double theD2,
+                       const GEOM::ListOfLong& theEdges)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference edges
@@ -452,16 +446,13 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdges
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgesAD
                       (GEOM::GEOM_Object_ptr theShape,
-                      CORBA::Double theD, CORBA::Double theAngle,
-                      const GEOM::ListOfLong& theEdges)
+                       CORBA::Double theD, CORBA::Double theAngle,
+                       const GEOM::ListOfLong& theEdges)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Get the reference edges
@@ -487,17 +478,14 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdgesAD
  */
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeArchimede (GEOM::GEOM_Object_ptr theShape,
-                                                             CORBA::Double theWeight,
-                                                             CORBA::Double theWaterDensity,
-                                                             CORBA::Double theMeshingDeflection)
+                                                              CORBA::Double theWeight,
+                                                              CORBA::Double theWaterDensity,
+                                                              CORBA::Double theMeshingDeflection)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
-  if (theShape == NULL) return aGEOMObject._retn();
-
   //Get the reference shape
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
   if (aShapeRef.IsNull()) return aGEOMObject._retn();
 
   //Create the Archimede
@@ -517,13 +505,9 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeArchimede (GEOM::GEOM_Object_
 CORBA::Long GEOM_ILocalOperations_i::GetSubShapeIndex
   (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theSubShape)
 {
-  if (theShape == NULL || theSubShape == NULL) return -1;
-
   //Get the reference shapes
-  Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
-    (theShape->GetStudyID(), theShape->GetEntry());
-  Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject
-    (theSubShape->GetStudyID(), theSubShape->GetEntry());
+  Handle(GEOM_Object) aShapeRef = GetObjectImpl(theShape);
+  Handle(GEOM_Object) aSubShapeRef = GetObjectImpl(theSubShape);
   if (aShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
 
   //Get the unique ID of <theSubShape> inside <theShape>