]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Python wrapping for HYDROData_PolylineOperator (split, merge)
authorPaul RASCLE <paul.rascle@openfields.fr>
Thu, 27 Aug 2020 13:55:46 +0000 (15:55 +0200)
committerYOANN AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Fri, 30 Oct 2020 16:06:22 +0000 (17:06 +0100)
src/HYDROPy/CMakeLists.txt
src/HYDROPy/HYDROData.sip
src/HYDROPy/HYDROData_PolylineOperator.sip [new file with mode: 0644]

index b6f3fadef1a99d5b771066e858b654f9f038fce3..866baef2e229baafa55539dd2c63aaa7b3f2cc03 100644 (file)
@@ -54,6 +54,7 @@ SET(_add_SOURCES
   sipHYDROPyHYDROData_Obstacle.cc
   sipHYDROPyHYDROData_Polyline3D.cc
   sipHYDROPyHYDROData_PolylineXY.cc
+  sipHYDROPyHYDROData_PolylineOperator.cc
   sipHYDROPyHYDROData_Profile.cc
   sipHYDROPyHYDROData_ProfileUZ.cc
   sipHYDROPyHYDROData_Region.cc
index 0c6c993d0f52e6c48e50e8ce1fcba21dca1c605b..20643fe76bbddcf2912d2d96fc7f6b743128c39b 100644 (file)
@@ -71,6 +71,7 @@
 %Include HYDROData_Obstacle.sip
 %Include HYDROData_ObstacleAltitude.sip
 %Include HYDROData_PolylineXY.sip
+%Include HYDROData_PolylineOperator.sip
 %Include HYDROData_Polyline3D.sip
 %Include HYDROData_Profile.sip
 %Include HYDROData_ProfileUZ.sip
diff --git a/src/HYDROPy/HYDROData_PolylineOperator.sip b/src/HYDROPy/HYDROData_PolylineOperator.sip
new file mode 100644 (file)
index 0000000..90ab42b
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright (C) 2014-2015  EDF-R&D
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+%ExportedHeaderCode
+#include <HYDROData_PolylineOperator.h>
+%End
+
+class HYDROData_PolylineOperator
+{
+
+%TypeHeaderCode
+#include <HYDROData_PolylineOperator.h>
+%End
+
+public:
+
+  HYDROData_PolylineOperator();
+
+  ~HYDROData_PolylineOperator();
+
+  bool Split( HYDROData_Document theDoc,
+              HYDROData_PolylineXY thePolyline,
+              double x, double y,
+              double theTolerance ) const
+              [bool (opencascade::handle<HYDROData_Document>&, opencascade::handle<HYDROData_PolylineXY>&, const gp_Pnt2d&,  double)];
+  %MethodCode
+    Handle(HYDROData_PolylineXY) aPoly = Handle(HYDROData_PolylineXY)::DownCast( createHandle( a1 ) );
+    gp_Pnt2d aPnt( a2, a3 );
+    if ( !aPoly.IsNull() )
+    {
+      Py_BEGIN_ALLOW_THREADS
+      sipRes = sipSelfWasArg ? sipCpp->HYDROData_PolylineOperator::Split( a0, aPoly, aPnt, a4 ):
+                               sipCpp->Split( a0, aPoly, aPnt, a4 );
+      Py_END_ALLOW_THREADS
+    }
+  %End
+
+  bool Split( HYDROData_Document theDoc,
+              HYDROData_PolylineXY thePolyline,
+               HYDROData_PolylineXY theTool,
+              double theTolerance,
+              bool& theIsIntersected) const
+              [bool (opencascade::handle<HYDROData_Document>&, opencascade::handle<HYDROData_PolylineXY>&, opencascade::handle<HYDROData_PolylineXY>&, double,  bool&)];
+  %MethodCode
+    Handle(HYDROData_PolylineXY) aPoly = Handle(HYDROData_PolylineXY)::DownCast( createHandle( a1 ) );
+    Handle(HYDROData_PolylineXY) aTool = Handle(HYDROData_PolylineXY)::DownCast( createHandle( a2 ) );
+    if ( !aPoly.IsNull()  && !aTool.IsNull())
+    {
+      Py_BEGIN_ALLOW_THREADS
+      sipRes = sipSelfWasArg ? sipCpp->HYDROData_PolylineOperator::Split( a0, aPoly, aTool, a3, a4 ):
+                               sipCpp->Split( a0, aPoly, aTool, a3, a4 );
+      Py_END_ALLOW_THREADS
+    }
+  %End
+
+  bool Split( HYDROData_Document theDoc,
+              const HYDROData_SequenceOfObjects& thePolylines,
+              double theTolerance )
+              [bool (opencascade::handle<HYDROData_Document>&, const HYDROData_SequenceOfObjects&, double)];
+  %MethodCode
+    Py_BEGIN_ALLOW_THREADS
+    sipRes = sipSelfWasArg ? sipCpp->HYDROData_PolylineOperator::Split( a0, *a1, a2):
+                            sipCpp->Split( a0, *a1, a2);
+    Py_END_ALLOW_THREADS
+  %End
+
+  bool Merge( HYDROData_Document theDoc,
+              const QString& theName,
+              const HYDROData_SequenceOfObjects& thePolylines,
+              bool isConnectByNewSegment,
+              double theTolerance )
+              [bool (opencascade::handle<HYDROData_Document>&, const QString&, const HYDROData_SequenceOfObjects&, bool, double)];
+  %MethodCode
+    Py_BEGIN_ALLOW_THREADS
+    sipRes = sipSelfWasArg ? sipCpp->HYDROData_PolylineOperator::Merge( a0, *a1, *a2, a3, a4):
+                            sipCpp->Merge( a0, *a1, *a2, a3, a4);
+    Py_END_ALLOW_THREADS
+  %End
+};
+
+