Salome HOME
Merge branch 'BR_v14_rc' into BR_quadtree
[modules/hydro.git] / src / HYDROData / HYDROData_PolylineOperator.h
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 #ifndef HYDROData_PolylineOperator_HeaderFile
20 #define HYDROData_PolylineOperator_HeaderFile
21
22 #include <HYDROData_PolylineXY.h>
23 #include <Geom2d_Curve.hxx>
24 #include <gp_Pnt2d.hxx>
25 #include <vector>
26
27 class Handle( HYDROData_Document );
28
29 class HYDRODATA_EXPORT HYDROData_PolylineOperator
30 {
31 public:
32   bool Split( const Handle( HYDROData_Document )& theDoc,
33               const Handle( HYDROData_PolylineXY )& thePolyline,
34               const gp_Pnt2d& thePoint,
35               double theTolerance ) const;
36   bool Split( const Handle( HYDROData_Document )& theDoc,
37               const Handle( HYDROData_PolylineXY )& thePolyline,
38               const Handle( HYDROData_PolylineXY )& theTool,
39               double theTolerance ) const;
40   bool Split( const Handle( HYDROData_Document )& theDoc,
41               const HYDROData_SequenceOfObjects& thePolylines,
42               double theTolerance );
43   bool Merge( const Handle( HYDROData_Document )& theDoc,
44               const QString& theName,
45               const HYDROData_SequenceOfObjects& thePolylines,
46               bool isConnectByNewSegment,
47               double theTolerance );
48
49 protected:
50   bool split( const Handle( HYDROData_Document )& theDoc,
51               const Handle( HYDROData_PolylineXY )& thePolyline,
52               const HYDROData_SequenceOfObjects& theTools,
53               double theTolerance,
54               int theIgnoreIndex ) const;
55
56   static std::vector<TopoDS_Wire> GetWires( const Handle( HYDROData_PolylineXY )& thePolyline );
57
58   static std::vector<TopoDS_Shape> Split( const TopoDS_Wire& theWire,
59                                           const gp_Pnt2d& thePoint,
60                                           double theTolerance );
61
62   static bool CreatePolylines( const Handle( HYDROData_Document )& theDoc,
63                                const QString& theNamePrefix,
64                                const std::vector<TopoDS_Shape>& theShape,
65                                bool isUseIndices );
66 };
67
68 #endif