Salome HOME
1) Set more correct method name. 2) remove references to deleted objects.
[modules/geom.git] / src / GEOM_I / GEOM_ICurvesOperations_i.cc
index b5109c9bbe65300e268033e1532908662add8d10..f1d2469c0e60293037538300dda6fc8c44754fb2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -428,18 +428,60 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolation
   return GetObject(anObject);
 }
 
+//=============================================================================
+/*!
+ *  MakeSplineInterpolWithTangents
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolWithTangents
+                                              (const GEOM::ListOfGO& thePoints,
+                                               GEOM::GEOM_Object_ptr theFirstVec,
+                                               GEOM::GEOM_Object_ptr theLastVec)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference points
+  int ind = 0;
+  int aLen = thePoints.length();
+  std::list<Handle(GEOM_Object)> aPoints;
+  for (; ind < aLen; ind++) {
+    Handle(GEOM_Object) aPnt = GetObjectImpl(thePoints[ind]);
+    if (aPnt.IsNull()) return aGEOMObject._retn();
+    aPoints.push_back(aPnt);
+  }
+
+  //Get the reference vectors
+  Handle(GEOM_Object) aVec1 = GetObjectImpl(theFirstVec);
+  Handle(GEOM_Object) aVec2 = GetObjectImpl(theLastVec);
+
+  if (aVec1.IsNull() || aVec2.IsNull()) return aGEOMObject._retn();
+
+  // Make Polyline
+  Handle(GEOM_Object) anObject =
+    GetOperations()->MakeSplineInterpolWithTangents(aPoints, aVec1, aVec2);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
 //=============================================================================
 /*!
  *  MakeCurveParametric
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char* thexExpr, const char* theyExpr, const char* thezExpr, 
-                                                                   double theParamMin, double theParamMax, double theParamStep, 
-                                                                   GEOM::curve_type theCurveType) {
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric
+             (const char* thexExpr, const char* theyExpr, const char* thezExpr,
+              double theParamMin, double theParamMax, double theParamStep,
+              GEOM::curve_type theCurveType)
+{
   GEOM::GEOM_Object_var aGEOMObject;
   //Set a not done flag
   GetOperations()->SetNotDone();
-  
+
   GEOMImpl_ICurvesOperations::CurveType aType;
   switch(theCurveType) {
   case GEOM::Polyline:
@@ -453,18 +495,17 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char*
     break;
   default:
     break;
-  }  
-  
+  }
 
   // Make Polyline
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr, 
-                                          theParamMin, theParamMax, 
-                                          theParamStep, aType);
-  
+    GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr,
+                                         theParamMin, theParamMax,
+                                         theParamStep, aType);
+
   if (!GetOperations()->IsDone() || anObject.IsNull())
-    return aGEOMObject._retn();  
-  
+    return aGEOMObject._retn();
+
   return GetObject(anObject);
 }
 
@@ -473,13 +514,15 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametric(const char*
  *  MakeCurveParametricNew
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew(const char* thexExpr, const char* theyExpr, const char* thezExpr, 
-                                    double theParamMin, double theParamMax, CORBA::Long theParamNbStep, 
-                                    GEOM::curve_type theCurveType) {
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew
+             (const char* thexExpr, const char* theyExpr, const char* thezExpr,
+              double theParamMin, double theParamMax, CORBA::Long theParamNbStep,
+              GEOM::curve_type theCurveType)
+{
   GEOM::GEOM_Object_var aGEOMObject;
   //Set a not done flag
   GetOperations()->SetNotDone();
-  
+
   GEOMImpl_ICurvesOperations::CurveType aType;
   switch(theCurveType) {
   case GEOM::Polyline:
@@ -493,18 +536,43 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCurveParametricNew(const cha
     break;
   default:
     break;
-  }  
-  
+  }
 
   // Make Polyline
   Handle(GEOM_Object) anObject =
-    GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr, 
-                       theParamMin, theParamMax, 
+    GetOperations()->MakeCurveParametric(thexExpr, theyExpr, thezExpr,
+                       theParamMin, theParamMax,
                        0.0, aType, theParamNbStep, true);
-  
+
   if (!GetOperations()->IsDone() || anObject.IsNull())
-    return aGEOMObject._retn();  
-  
+    return aGEOMObject._retn();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  MakeIsoline
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeIsoline
+                                         (GEOM::GEOM_Object_ptr theFace,
+                                          CORBA::Boolean        IsUIsoline,
+                                          double                theParameter)
+{
+  GEOM::GEOM_Object_var aGEOMObject;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  Handle(GEOM_Object) aFace = GetObjectImpl(theFace);
+
+  // Make isoline
+  Handle(GEOM_Object) anObject =
+    GetOperations()->MakeIsoline(aFace, IsUIsoline, theParameter);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return aGEOMObject._retn();
+
   return GetObject(anObject);
 }
 
@@ -536,24 +604,20 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher
 
 //=============================================================================
 /*!
- *  Make3DSketcher
+ *  MakeSketcherOnPlane
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher
-            (const GEOM::ListOfDouble& theCoordinates)
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
+                (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  int ind = 0;
-  int aLen = theCoordinates.length();
-  std::list<double> aCoords;
-  for (; ind < aLen; ind++)
-    aCoords.push_back(theCoordinates[ind]);
+  Handle(GEOM_Object) aWorkingPlane = GetObjectImpl(theWorkingPlane);
 
   // Make Sketcher
   Handle(GEOM_Object) anObject =
-    GetOperations()->Make3DSketcher(aCoords);
+      GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return GEOM::GEOM_Object::_nil();
 
@@ -562,20 +626,42 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher
 
 //=============================================================================
 /*!
- *  MakeSketcherOnPlane
+ *  Make3DSketcherCommand
  */
 //=============================================================================
-GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcherOnPlane
-                (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane)
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcherCommand (const char* theCommand)
 {
   //Set a not done flag
   GetOperations()->SetNotDone();
 
-  Handle(GEOM_Object) aWorkingPlane = GetObjectImpl(theWorkingPlane);
+  // Make 3D Sketcher
+  Handle(GEOM_Object) anObject = GetOperations()->Make3DSketcherCommand(theCommand);
+  if (!GetOperations()->IsDone() || anObject.IsNull())
+    return GEOM::GEOM_Object::_nil();
+
+  return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *  Make3DSketcher
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher
+            (const GEOM::ListOfDouble& theCoordinates)
+{
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  int ind = 0;
+  int aLen = theCoordinates.length();
+  std::list<double> aCoords;
+  for (; ind < aLen; ind++)
+    aCoords.push_back(theCoordinates[ind]);
 
   // Make Sketcher
   Handle(GEOM_Object) anObject =
-      GetOperations()->MakeSketcherOnPlane(theCommand, aWorkingPlane);
+    GetOperations()->Make3DSketcher(aCoords);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return GEOM::GEOM_Object::_nil();