]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Small change of the interface for MakeVertexOnCurveByLength function: use boolean...
authorvsr <vsr@opencascade.com>
Thu, 6 Jan 2011 21:40:34 +0000 (21:40 +0000)
committervsr <vsr@opencascade.com>
Thu, 6 Jan 2011 21:40:34 +0000 (21:40 +0000)
15 files changed:
doc/salome/gui/GEOM/input/creating_point.doc
doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc
idl/GEOM_Gen.idl
src/BasicGUI/BasicGUI_PointDlg.cxx
src/BasicGUI/BasicGUI_PointDlg.h
src/GEOMImpl/GEOMImpl_IBasicOperations.cxx
src/GEOMImpl/GEOMImpl_IBasicOperations.hxx
src/GEOMImpl/GEOMImpl_IPoint.hxx
src/GEOMImpl/GEOMImpl_PointDriver.cxx
src/GEOM_I/GEOM_IBasicOperations_i.cc
src/GEOM_I/GEOM_IBasicOperations_i.hh
src/GEOM_I_Superv/GEOM_Superv_i.cc
src/GEOM_I_Superv/GEOM_Superv_i.hh
src/GEOM_SWIG/GEOM_TestAll.py
src/GEOM_SWIG/geompyDC.py

index 2ae82dc92fbcb12cd157f28639588295a3ee53ab..295e3ede18bcd153fe00d463ab967f7a449cde74 100644 (file)
@@ -35,9 +35,10 @@ position of the point on the given edge.
 
 Alternatively, it is possible to define the point by \b Edge and \b Length,
 the given length must not exceed the length of the edge. The orientation of the edge can be reversed.
-\n <b>TUI Command:</b> <em>geompy.MakeVertexOnCurveByLength(Edge,Length,Direction).</em>
+\n <b>TUI Command:</b> <em>geompy.MakeVertexOnCurveByLength(Edge,Length,Reverse).</em>
 \n <b>Arguments:</b> Name + 1 edge  + 1 Length defining the
-position of the point on the given edge + 1 Direction for the calculation of the length (0 = forward, 2 = reversed).
+position of the point on the given edge + 1 Reverse flag defining the direction for the
+calculation of the length (False = forward, True = reversed).
 \image html point3_3.png
 
 It is also possible to define 3D coordinates of the point
index b4c537d435b5c01cb8aeb612d628216ffa46bd04..631c3c77bedfcd034c750357b314db4eb3c97d53 100644 (file)
@@ -23,7 +23,7 @@ Arc = geompy.MakeArc(py, pz, px)
 # create a vertex by parameter
 p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
 # create a vertex by length
-p_on_arc2 = geompy.MakeVertexOnCurveByLength(Arc, 50., 0)
+p_on_arc2 = geompy.MakeVertexOnCurveByLength(Arc, 50., False)
 #create a vertex by point projection
 p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
 
index 2f8019d3fae294a4a77403f65b77a83b250711df..21ed9b2f8f55a4d19ee061a42c0ba78a537963d0 100644 (file)
@@ -422,12 +422,12 @@ module GEOM
      *  Create a point, corresponding to the given length on the given curve.
      *  \param theRefCurve The referenced curve.
      *  \param theLength Length on the referenced curve.
-     *  \param theDirection Direction for the calculation of the length (0 = forward or 2 = reversed).
+     *  \param theReverse Direction for the calculation of the length (false = forward or true = reversed).
      *  \return New GEOM_Object, containing the created point.
      */
     GEOM_Object MakePointOnCurveByLength (in GEOM_Object theRefCurve,
                                           in double theLength,
-                                          in double theDirection);
+                                          in boolean theReverse);
 
     /*!
      *  Create a point on the given curve, projecting given point
index 9a039e9bacfa1aaba1d71421e9d2d43a654d645a..f1f65dfb649cd7094d81bd6347cea4abae91ccf2 100644 (file)
@@ -233,7 +233,6 @@ void BasicGUI_PointDlg::Init()
   myNeedType = TopAbs_VERTEX;
 
   myEditCurrentArgument = 0;
-  myCheckFlag = 0;
 
   /* Get setting of step value from file configuration */
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
@@ -712,7 +711,6 @@ void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue)
 //=================================================================================
 void BasicGUI_PointDlg::CheckBoxClicked( int  State ) 
 {
-  myCheckFlag = State;
   displayPreview();
 }
 
@@ -871,13 +869,11 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
         aParameters<<GroupOnCurve->SpinBox_DX->text();
       } 
       else if ( myParamCoord->checkedId() == LENGTH_VALUE ) {
-       anObj = anOper->MakePointOnCurveByLength( myEdge, getParameter(), myCheckFlag );
+       bool reversed = GroupOnCurve->CheckButton1->isChecked();
+       anObj = anOper->MakePointOnCurveByLength( myEdge, getParameter(), reversed );
        
-       std::stringstream out;
-       out<<myCheckFlag;
-       std::string flag = out.str();
        aParameters<<GroupOnCurve->SpinBox_DX->text();
-       aParameters<<flag.c_str();
+       aParameters<<QString::number( reversed );
       }
       else if ( myParamCoord->checkedId() == COORD_VALUE ) {
         double x = GroupXYZ->SpinBox_DX->value();
index 206111d8e3ae63fbe9b9b02932e9fbd0f46c93c1..fad9a15912215141b1bc081cd28afbda6aff9052 100644 (file)
@@ -84,8 +84,6 @@ private:
 
   bool                               myBusy;
 
-  int                               myCheckFlag;
-
   DlgRef_3Spin*                      GroupXYZ;
   DlgRef_1Sel3Spin*                  GroupRefPoint;
   DlgRef_1Sel1Spin1Check*            GroupOnCurve;
index 7e7d53bf9359ecbe1f304e10b8b324b4ec3a6767..07b40dc68230e9f49e850005c570f12d19dd81e6 100644 (file)
@@ -191,8 +191,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
                      double theParam1,
                      double theParam2,
                      double theParam3,
-                    int theFlag1,
-                     const PointLocation theLocation)
+                     const PointLocation theLocation,
+                    bool theReverse)
 {
   SetErrorCode(KO);
 
@@ -231,7 +231,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
     case PointOn_CurveByLength:
       aPI.SetCurve(aRefFunction);
       aPI.SetLength(theParam1);
-      aPI.SetFlag(theFlag1);
+      aPI.SetReversed(theReverse);
       break;
     case PointOn_CurveByCoord:
       aPI.SetCurve(aRefFunction);
@@ -277,7 +277,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
       break;
     case PointOn_CurveByLength:
       GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength("
-                                   << theGeomObj << ", " << theParam1 << ", " << theFlag1 <<  ")";
+                                   << theGeomObj << ", " << theParam1 << ", " << theReverse <<  ")";
       break;
     case PointOn_CurveByCoord:
   GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
@@ -308,7 +308,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
                             (Handle(GEOM_Object) theCurve, double theParameter)
 {
-  return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, 1, PointOn_CurveByParam);
+  return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam);
 }
 
 //=============================================================================
@@ -322,7 +322,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByCoord
                      double theYParam,
                      double theZParam)
 {
-  return makePointOnGeom(theCurve, theXParam, theYParam, theZParam, 1, PointOn_CurveByCoord);
+  return makePointOnGeom(theCurve, theXParam, theYParam, theZParam, PointOn_CurveByCoord);
 }
 
 //=============================================================================
@@ -333,9 +333,9 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByCoord
 Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByLength
                     (Handle(GEOM_Object) theCurve, 
                     double theLength, 
-                    int theDirection)
+                    bool theReverse)
 {
-  return makePointOnGeom(theCurve, theLength, 0.0, 0.0, theDirection, PointOn_CurveByLength);
+  return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theReverse);
 }
 
 //=============================================================================
@@ -348,7 +348,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurface
                      double theUParameter,
                      double theVParameter)
 {
-  return makePointOnGeom(theSurface, theUParameter, theVParameter, 0., 1, PointOn_SurfaceByParam);
+  return makePointOnGeom(theSurface, theUParameter, theVParameter, 0., PointOn_SurfaceByParam);
 }
 
 //=============================================================================
@@ -362,7 +362,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnSurfaceByCoord
                      double theYParam,
                      double theZParam)
 {
-  return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, 1, PointOn_SurfaceByCoord);
+  return makePointOnGeom(theSurface, theXParam, theYParam, theZParam, PointOn_SurfaceByCoord);
 }
 
 
index 2066e14a03874f0f4ffda60a1cb0fde87994f417..64d65f5527d0d32de3345b9c9bfe5643331860fc 100644 (file)
@@ -45,7 +45,7 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
 
   Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByLength (Handle(GEOM_Object) theCurve,
                                                                double theLength,
-                                                               int theDirection);
+                                                               bool theReverse);
 
   Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByCoord (Handle(GEOM_Object) theCurve,
                                                                double theXParam,
@@ -135,8 +135,8 @@ class GEOMImpl_IBasicOperations : public GEOM_IOperations {
                                        double theParam1,
                                        double theParam2,
                                        double theParam3,
-                                      int theFlag1,
-                                       const PointLocation theLocation);
+                                       const PointLocation theLocation,
+                                      bool   theReverse = false);
 };
 
 #endif
index 36ce68cac5b6fbb9a62e011cae05c6a070c98d39..c115695335d0909c703feffd568398baf4870c8c 100755 (executable)
@@ -73,12 +73,12 @@ class GEOMImpl_IPoint
   void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); }
   void SetParameter2(double theParam) { _func->SetReal(ARG_PARAM2, theParam); }
   void SetLength(double theLength) { _func->SetReal(ARG_LENGTH, theLength); }
-  void SetFlag(int theFlag)  { _func->SetInteger(ARG_FLAG, theFlag); }
+  void SetReversed(bool theReversed)  { _func->SetInteger(ARG_FLAG, theReversed); }
 
   double GetParameter() { return _func->GetReal(ARG_PARAM); }
   double GetParameter2() { return _func->GetReal(ARG_PARAM2); }
   double GetLength() { return _func->GetReal(ARG_LENGTH); }
-  int GetFlag() { return _func->GetInteger(ARG_FLAG); }
+  bool   GetReversed() { return _func->GetInteger(ARG_FLAG); }
 
  private:
 
index 4ea8d498138c65de7828880531847171cceab4a7..8aed2e4be51ad0d0d8e20ce24d492179966719b2 100644 (file)
@@ -156,7 +156,7 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
   else if (aType == POINT_CURVE_LENGTH) {
     Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
     Standard_Real theLength = aPI.GetLength();
-    Standard_Integer theDirection = aPI.GetFlag(); 
+    Standard_Integer theReversed = aPI.GetReversed(); 
     TopoDS_Shape aRefShape = aRefCurve->GetValue();
     Standard_Real UFirst = 0;
     Standard_Real ULast = 0;
@@ -171,14 +171,10 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const
     }
     Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), UFirst, ULast);
     Handle(Geom_Curve) ReOrientedCurve = EdgeCurve;
-    if ( theDirection == 2 ) {
+    if ( theReversed ) {
       ReOrientedCurve = EdgeCurve -> Reversed();
       UFirst=ULast;
     }
-    else if ( theDirection != 0 ){
-      Standard_TypeMismatch::Raise
-       ("Point On Curve creation aborted : direction parameter must be 0 or 2");
-    }
     GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
     GCPnts_AbscissaPoint anAbsPnt(AdapCurve, theLength, UFirst); 
     Standard_Real aParam = anAbsPnt.Parameter();
index fd462fa836fe9fa05a13ac390229ae0eadd3e6f3..d11abf3db154685c04b3831d8954e3ffdeeb5551 100644 (file)
@@ -163,7 +163,7 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve
 GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurveByLength
                   (GEOM::GEOM_Object_ptr theCurve,  
                   CORBA::Double theLength,
-                  CORBA::Double theDirection)
+                  CORBA::Boolean theReverse)
 {
   GEOM::GEOM_Object_var aGEOMObject;
 
@@ -177,7 +177,7 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurveByLength
   //Create the point
   Handle(GEOM_Object) anObject =
     GetOperations()->MakePointOnCurveByLength(aReference, theLength,
-                                             theDirection);
+                                             theReverse);
   if (!GetOperations()->IsDone() || anObject.IsNull())
     return aGEOMObject._retn();
 
index a559062d6c0ab523953644ebdf0e90c3740c656b..7fa3570658905e8abb55bbf39053ddc4d94ecf7e 100644 (file)
@@ -56,8 +56,8 @@ class GEOM_I_EXPORT GEOM_IBasicOperations_i :
                                           CORBA::Double theParameter);
 
    GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theCurve,
-                                                  CORBA::Double theLength,
-                                                  CORBA::Double theDirection);
+                                                  CORBA::Double theLength,
+                                                  CORBA::Boolean theReverse);
 
    GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theCurve,
                                                   CORBA::Double theXParameter,
index bcfb2485ac8f48cf4c780dd95431b416f72c325f..3d0c6154faeca2cb87693746ea3c00e87b9c17f6 100644 (file)
@@ -592,12 +592,12 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr the
 //=============================================================================
 GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve,
                                                               CORBA::Double theLength,
-                                                              CORBA::Double theDirection)
+                                                              CORBA::Boolean theReverse)
 {
   beginService( " GEOM_Superv_i::MakePointOnCurveByLength" );
   MESSAGE("GEOM_Superv_i::MakePointOnCurveByLength");
   getBasicOp();
-  GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurveByLength(theRefCurve, theLength, theDirection);
+  GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurveByLength(theRefCurve, theLength, theReverse);
   endService( " GEOM_Superv_i::MakePointOnCurveByLength" );
   return anObj;
 }
index c97e931d319d05b046803d7644603241b559577e..dcef3641487869c35108a09114d1ec95754d2532 100644 (file)
@@ -152,7 +152,7 @@ public:
                                          CORBA::Double theParameter);
   GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve,
                                                  CORBA::Double theLength,
-                                                 CORBA::Double theDirection);
+                                                 CORBA::Boolean theReverse);
   GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theRefCurve,
                                                  CORBA::Double theXParameter,
                                                  CORBA::Double theYParameter,
index 2b22e3f7a17b8244c6e08abfcde8545b357d98f1..3a69656ddba6caf108c3c89b1b69c3e129d52c2e 100644 (file)
@@ -114,7 +114,7 @@ def TestAll (geompy, math):
   #Test point on curve creation
   p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
   p_on_arc2 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10 ) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
-  p_on_arc3 = geompy.MakeVertexOnCurveByLength(Arc, 50, 2) #(GEOM_Object_ptr, Double, Double)->GEOM_Object_ptr
+  p_on_arc3 = geompy.MakeVertexOnCurveByLength(Arc, 50, True) #(GEOM_Object_ptr, Double, Boolean)->GEOM_Object_ptr
 
   #Test point on lines intersection
   p_on_l1l2 = geompy.MakeVertexOnLinesIntersection(Line1, Line2) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
index 54e6a2c7741685f226010e6a7e18b8a992c66918..5f84eb89b242a18bc4df0e7d3847e17becb604dd 100644 (file)
@@ -515,14 +515,14 @@ class geompyDC(GEOM._objref_GEOM_Gen):
         ## Create a point, corresponding to the given length on the given curve.
         #  @param theRefCurve The referenced curve.
         #  @param theLength Length on the referenced curve.
-        #  @param theDirection Flag allowing to choose the direction for the calculation of the length (0 = forward or 2 = reversed).
+        #  @param theReverse Flag allowing to choose the direction for the calculation of the length (False = forward or True = reversed).
         #  @return New GEOM_Object, containing the created point.
         #
         #  @ref tui_creation_point "Example"
-        def MakeVertexOnCurveByLength(self,theRefCurve, theLength, theDirection):
+        def MakeVertexOnCurveByLength(self,theRefCurve, theLength, theReverse = False):
             # Example: see GEOM_TestAll.py
             theLength, Parameters = ParseParameters(theLength)
-            anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theDirection)
+            anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theReverse)
             RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
             anObj.SetParameters(Parameters)
             return anObj