]> SALOME platform Git repositories - modules/hydro.git/blob - src/HYDROData/HYDROData_PolylineOperator.h
Salome HOME
debug split polylines, OK with type POLYLINE, still too many points with SPLINE
[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 class HYDROData_TopoCurve;
29 class Handle(HYDROData_Object);
30
31 class HYDRODATA_EXPORT HYDROData_PolylineOperator
32 {
33 public:
34   bool Split( const Handle( HYDROData_Document )& theDoc,
35               const Handle( HYDROData_PolylineXY )& thePolyline,
36               const gp_Pnt2d& thePoint,
37               double theTolerance ) const;
38   bool Split( const Handle( HYDROData_Document )& theDoc,
39               const Handle( HYDROData_PolylineXY )& thePolyline,
40               const Handle( HYDROData_PolylineXY )& theTool,
41               double theTolerance,
42               bool& theIsIntersected) const;
43   bool Split( const Handle( HYDROData_Document )& theDoc,
44               const HYDROData_SequenceOfObjects& thePolylines,
45               double theTolerance );
46   bool Merge( const Handle( HYDROData_Document )& theDoc,
47               const QString& theName,
48               const HYDROData_SequenceOfObjects& thePolylines,
49               bool isConnectByNewSegment,
50               double theTolerance );
51
52   static void GetWires(
53     const Handle( HYDROData_PolylineXY )& thePolyline,
54     std::vector<TopoDS_Wire>& theWires);
55
56   //! The method is intended to approximate the B-spline edge curve
57   //! by a 'Hydro' spline section.
58   //! Inserts the knot in the middle of each such B-spline piece that
59   //! the middle deflection is more than the required deflection and
60   //! more than the half of the maximal middle deflection.
61   //! Returns the initial maximal middle deflection.
62   //! Returns a negative value in the case of any erorr.
63   static double ReduceDeflection(
64     const double theDeflection,
65     HYDROData_TopoCurve& theCurve,
66     int& thePieceCount);
67
68   bool Extract( const Handle(HYDROData_Document)& theDocument,
69                 const Handle(HYDROData_Object)& theObject );
70
71 protected:
72   bool split( const Handle( HYDROData_Document )& theDoc,
73               const Handle( HYDROData_PolylineXY )& thePolyline,
74               const HYDROData_SequenceOfObjects& theTools,
75               double theTolerance,
76               int theIgnoreIndex,
77               bool& theIsIntersected) const;
78
79   static void Split(
80     const TopoDS_Wire& theWire,
81     const gp_Pnt2d& thePoint,
82     double theTolerance,
83     std::vector<TopoDS_Shape>& theWires);
84
85 //  static bool CreatePolylinesSplit( const Handle( HYDROData_Document )& theDoc,
86 //                                    const Handle( HYDROData_PolylineXY )& thePolyline,
87 //                                    const std::vector<TopoDS_Shape>& theShapes,
88 //                                    bool isUseIndices);
89
90   static bool CreatePolylines( const Handle( HYDROData_Document )& theDoc,
91                                const QString& theNamePrefix,
92                                const std::vector<TopoDS_Shape>& theShape,
93                                bool isUseIndices,
94                                const QColor& theColor );
95 };
96
97 #endif