Salome HOME
Merge branch 'BR_v14_rc' into BR_SINUSX_FORMAT
[modules/hydro.git] / src / HYDROData / HYDROData_Pipes.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 // modify it under the terms of the GNU Lesser General Public
20 // License as published by the Free Software Foundation; either
21 // version 2.1 of the License, or (at your option) any later version.
22 //
23 // This library is distributed in the hope that it will be useful,
24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26 // Lesser General Public License for more details.
27 //
28 // You should have received a copy of the GNU Lesser General Public
29 // License along with this library; if not, write to the Free Software
30 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
31 //
32 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
33 //
34
35 #ifndef HYDROData_Pipes_HeaderFile
36 #define HYDROData_Pipes_HeaderFile
37
38 #include <TopoDS_Vertex.hxx>
39 #include <TopoDS_Wire.hxx>
40 #include <gp_Pnt.hxx>
41 #include <TopTools_ListOfShape.hxx>
42 #include <ShapeUpgrade_UnifySameDomain.hxx>
43
44 class BRepOffsetAPI_MakePipeShell;
45 class TopoDS_Face;
46
47 class HYDROData_Canal3dAnd2d
48 {
49 public:
50   HYDROData_Canal3dAnd2d( const TopoDS_Wire& Profile,
51                           const TopoDS_Wire& Guideline );
52   
53   Standard_Boolean Create3dPresentation();
54
55   Standard_Boolean Create2dPresentation();
56
57   Standard_Boolean ProjectWireOntoXOY(const TopoDS_Wire& aWire,
58                                       TopoDS_Wire& ProjectedWire);
59
60   void Make2dProfile();
61
62   TopoDS_Vertex ProjectVertexOntoXOY(const TopoDS_Vertex& aVertex);
63
64   void SetMiddlePoint2d();
65
66   void SetMiddlePoint3d();
67
68   TopoDS_Wire SetTransformedProfile(const TopoDS_Wire& aProfile,
69                                     const TopoDS_Wire& aGuideline,
70                                     const gp_Pnt& aMiddlePoint);
71
72   TopoDS_Wire CreateWireOnUnifiedPipe2d(const TopoDS_Wire& aWireOnPipe2d);
73
74   TopoDS_Wire GetBank(const TopoDS_Vertex& aFreeVertex);
75
76   //Queries
77   TopoDS_Shape Get3dPresentation();
78   TopoDS_Face  Get2dPresentation();
79   TopoDS_Wire GetLeftBank();
80   TopoDS_Wire GetRightBank();
81   TopoDS_Wire GetInlet();
82   TopoDS_Wire GetOutlet();
83   Standard_Integer GetStatus();
84
85   void MakeSharpVertexList();
86
87   Standard_Boolean MakeFillet();
88
89 private:
90
91   TopoDS_Wire myProfile;
92   TopoDS_Wire myGuideline;
93   TopoDS_Vertex myLeftVertex;
94   TopoDS_Vertex myRightVertex;
95   TopoDS_Vertex myLeftVertex2d;
96   TopoDS_Vertex myRightVertex2d;
97   gp_Pnt myMiddlePoint2d;
98   gp_Pnt myMiddlePoint3d;
99
100   TopoDS_Wire myProjectedProfile;
101   TopoDS_Wire myProjectedGuideline, myOriginalGuideline;
102   TopoDS_Wire myTransformedProfile3d;
103   TopoDS_Wire myTransformedProfile2d;
104   BRepOffsetAPI_MakePipeShell* mySweep3d;
105   BRepOffsetAPI_MakePipeShell* mySweep2d;
106
107   TopoDS_Shape myPipe3d;
108   TopoDS_Shape myPipe2d;
109   TopoDS_Shape myUnifiedPipe2d;
110   ShapeUpgrade_UnifySameDomain myUnifier;
111   TopoDS_Wire myInlet;
112   TopoDS_Wire myOutlet;
113   //TopoDS_Shape myLeftBank;
114   //TopoDS_Shape myRightBank;
115
116   Standard_Integer myStatus;
117   //0 - Ok
118   //1 - some edges does not belong to same plane or parallel (fillet can not be build)
119   //2 - can not create fillet at some vertex with given radius: the length of some edge is too small respective to width of canal
120   //3 - fillet failed at some vertex
121   //4 - fillet failed
122   //5 - projection failed
123   //6 - sweep 3d failed
124   //7 - sweep 2d failed
125
126   Standard_Real myFilletRadius;
127   TopTools_ListOfShape mySharpVertexList;
128   Standard_Real myTolAngular;
129 };
130
131 #endif