0023367: New functionality restoring the middle path of pipe-like shape
[occt.git] / src / ShapeUpgrade / ShapeUpgrade_ShapeDivideContinuity.cxx
1 // Created on: 1999-04-30
2 // Created by: data exchange team
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22
23 #include <ShapeUpgrade_ShapeDivideContinuity.ixx>
24
25 #include <Precision.hxx>
26 #include <ShapeUpgrade_SplitCurve2dContinuity.hxx>
27 #include <ShapeUpgrade_SplitCurve3dContinuity.hxx>
28 #include <ShapeUpgrade_SplitSurfaceContinuity.hxx>
29 #include <ShapeUpgrade_WireDivide.hxx>
30 #include <ShapeUpgrade_FaceDivide.hxx>
31
32 //=======================================================================
33 //function : ShapeUpgrade_ShapeDivideContinuity
34 //purpose  : 
35 //=======================================================================
36
37 ShapeUpgrade_ShapeDivideContinuity::ShapeUpgrade_ShapeDivideContinuity()
38 {
39   myCurve3dCriterion = GeomAbs_C1;
40   myCurve2dCriterion = GeomAbs_C1;
41   mySurfaceCriterion  = GeomAbs_C1;
42   myTolerance3d = Precision::Confusion();
43   myTolerance2d = Precision::PConfusion();
44 }
45
46 //=======================================================================
47 //function : ShapeUpgrade_ShapeDivideContinuity
48 //purpose  : 
49 //=======================================================================
50
51 ShapeUpgrade_ShapeDivideContinuity::ShapeUpgrade_ShapeDivideContinuity(const TopoDS_Shape& S):
52      ShapeUpgrade_ShapeDivide(S)
53 {
54   myCurve3dCriterion = GeomAbs_C1;
55   myCurve2dCriterion = GeomAbs_C1;
56   mySurfaceCriterion  = GeomAbs_C1;
57   myTolerance3d = Precision::Confusion();
58   myTolerance2d = Precision::PConfusion();
59 }
60
61 //=======================================================================
62 //function : SetTolerance
63 //purpose  : 
64 //=======================================================================
65
66 void ShapeUpgrade_ShapeDivideContinuity::SetTolerance(const Standard_Real Tol)
67 {
68   myTolerance3d = Tol;
69 }
70
71 //=======================================================================
72 //function : SetTolerance2d
73 //purpose  : 
74 //=======================================================================
75
76 void ShapeUpgrade_ShapeDivideContinuity::SetTolerance2d(const Standard_Real Tol)
77 {
78   myTolerance2d = Tol;
79 }
80
81 //=======================================================================
82 //function : SetBoundaryCriterion
83 //purpose  : 
84 //=======================================================================
85
86 void ShapeUpgrade_ShapeDivideContinuity::SetBoundaryCriterion(const GeomAbs_Shape Criterion)
87 {
88   myCurve3dCriterion = Criterion;
89 }
90
91 //=======================================================================
92 //function : SetPCurveCriterion
93 //purpose  : 
94 //=======================================================================
95
96 void ShapeUpgrade_ShapeDivideContinuity::SetPCurveCriterion(const GeomAbs_Shape Criterion)
97 {
98   myCurve2dCriterion = Criterion;
99 }
100
101 //=======================================================================
102 //function : SetSurfaceCriterion
103 //purpose  : 
104 //=======================================================================
105
106 void ShapeUpgrade_ShapeDivideContinuity::SetSurfaceCriterion(const GeomAbs_Shape Criterion)
107 {
108   mySurfaceCriterion = Criterion;
109 }
110
111 //=======================================================================
112 //function : GetSplitFaceTool
113 //purpose  : 
114 //=======================================================================
115
116 Handle(ShapeUpgrade_FaceDivide) ShapeUpgrade_ShapeDivideContinuity::GetSplitFaceTool() const
117 {
118   Handle(ShapeUpgrade_SplitCurve2dContinuity) theSplitCurve2dTool = new ShapeUpgrade_SplitCurve2dContinuity;
119   Handle(ShapeUpgrade_SplitCurve3dContinuity) theSplitCurve3dTool = new ShapeUpgrade_SplitCurve3dContinuity;
120   Handle(ShapeUpgrade_SplitSurfaceContinuity) theSplitSurfaceTool = new ShapeUpgrade_SplitSurfaceContinuity;
121   theSplitCurve2dTool->SetCriterion (myCurve2dCriterion);
122   theSplitCurve3dTool->SetCriterion (myCurve3dCriterion);
123   theSplitSurfaceTool->SetCriterion (mySurfaceCriterion);
124   theSplitCurve2dTool->SetTolerance (myTolerance2d);
125   theSplitCurve3dTool->SetTolerance (myTolerance3d);
126   theSplitSurfaceTool->SetTolerance (myTolerance3d);
127   Handle(ShapeUpgrade_WireDivide) theSplitWireTool = new ShapeUpgrade_WireDivide;
128   theSplitWireTool->SetSplitCurve2dTool ( theSplitCurve2dTool );
129   theSplitWireTool->SetSplitCurve3dTool ( theSplitCurve3dTool );
130   Handle(ShapeUpgrade_FaceDivide) theSplitFaceTool = new ShapeUpgrade_FaceDivide;
131   theSplitFaceTool->SetSplitSurfaceTool ( theSplitSurfaceTool );
132   theSplitFaceTool->SetWireDivideTool ( theSplitWireTool );
133   return theSplitFaceTool;
134 }