Salome HOME
Correction for hydro_test
[modules/hydro.git] / src / HYDROPy / HYDROData_PolylineOperator.sip
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 %ExportedHeaderCode
20 #include <HYDROData_PolylineOperator.h>
21 %End
22
23 class HYDROData_PolylineOperator
24 {
25
26 %TypeHeaderCode
27 //#define _DEVDEBUG_
28 #include "HYDRO_trace.hxx"
29 #include <HYDROData_PolylineOperator.h>
30 %End
31
32 public:
33
34   HYDROData_PolylineOperator();
35
36   ~HYDROData_PolylineOperator();
37
38   bool SplitPoint( HYDROData_Document theDoc,
39                    HYDROData_PolylineXY thePolyline,
40                    double x, double y,
41                    double theTolerance ) const
42               [bool (opencascade::handle<HYDROData_Document>&, opencascade::handle<HYDROData_PolylineXY>&, const gp_Pnt2d&,  double)];
43   %MethodCode
44     Handle(HYDROData_PolylineXY) aPoly = Handle(HYDROData_PolylineXY)::DownCast( createHandle( a1 ) );
45     gp_Pnt2d aPnt( a2, a3 );
46     if ( !aPoly.IsNull() )
47     {
48       Py_BEGIN_ALLOW_THREADS
49       sipRes = sipSelfWasArg ? sipCpp->HYDROData_PolylineOperator::SplitPoint( a0, aPoly, aPnt, a4 ):
50                                sipCpp->SplitPoint( a0, aPoly, aPnt, a4 );
51       Py_END_ALLOW_THREADS
52     }
53   %End
54
55   bool SplitTool( HYDROData_Document theDoc,
56                   HYDROData_PolylineXY thePolyline,
57                   HYDROData_PolylineXY theTool,
58                   double theTolerance,
59                   bool& theIsIntersected) const
60               [bool (opencascade::handle<HYDROData_Document>&, opencascade::handle<HYDROData_PolylineXY>&, opencascade::handle<HYDROData_PolylineXY>&, double,  bool&)];
61   %MethodCode
62     Handle(HYDROData_PolylineXY) aPoly = Handle(HYDROData_PolylineXY)::DownCast( createHandle( a1 ) );
63     Handle(HYDROData_PolylineXY) aTool = Handle(HYDROData_PolylineXY)::DownCast( createHandle( a2 ) );
64     if ( !aPoly.IsNull()  && !aTool.IsNull())
65     {
66       Py_BEGIN_ALLOW_THREADS
67       sipRes = sipSelfWasArg ? sipCpp->HYDROData_PolylineOperator::SplitTool( a0, aPoly, aTool, a3, a4 ):
68                                sipCpp->SplitTool( a0, aPoly, aTool, a3, a4 );
69       Py_END_ALLOW_THREADS
70     }
71   %End
72
73   bool SplitAll( HYDROData_Document theDoc,
74                  std::vector<HYDROData_Entity*> thePolylines,
75                  double theTolerance )
76               [bool (opencascade::handle<HYDROData_Document>&, const HYDROData_SequenceOfObjects&, double)];
77   %MethodCode
78     NCollection_Sequence<Handle(HYDROData_Entity)> objs;
79     for (size_t i = 0; i != a1->size(); i++)
80     {
81         DEBTRACE("item " <<  i);
82         Handle(HYDROData_Entity) anEnt = createHandle( (*a1)[i] );
83         objs.Append(anEnt);
84     }
85     Py_BEGIN_ALLOW_THREADS
86     sipRes = sipSelfWasArg ? sipCpp->HYDROData_PolylineOperator::SplitAll( a0, objs, a2):
87                             sipCpp->SplitAll( a0, objs, a2);
88     Py_END_ALLOW_THREADS
89   %End
90
91   bool Merge( HYDROData_Document theDoc,
92               const QString& theName,
93               std::vector<HYDROData_Entity*> thePolylines,
94               bool isConnectByNewSegment,
95               double theTolerance )
96               [bool (opencascade::handle<HYDROData_Document>&, const QString&, const HYDROData_SequenceOfObjects&, bool, double)];
97   %MethodCode
98     NCollection_Sequence<Handle(HYDROData_Entity)> objs;
99     for (size_t i = 0; i != a2->size(); i++)
100     {
101         DEBTRACE("item " <<  i);
102         Handle(HYDROData_Entity) anEnt = createHandle( (*a2)[i] );
103         objs.Append(anEnt);
104     }
105     Py_BEGIN_ALLOW_THREADS
106     sipRes = sipSelfWasArg ? sipCpp->HYDROData_PolylineOperator::Merge( a0, *a1, objs, a3, a4):
107                             sipCpp->Merge( a0, *a1, objs, a3, a4);
108     Py_END_ALLOW_THREADS
109   %End
110 };
111
112