1 // Created on: 1999-04-30
2 // Created by: data exchange team
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16 
17 
18 #include <Precision.hxx>
19 #include <ShapeUpgrade_FaceDivide.hxx>
20 #include <ShapeUpgrade_ShapeDivideContinuity.hxx>
21 #include <ShapeUpgrade_SplitCurve2dContinuity.hxx>
22 #include <ShapeUpgrade_SplitCurve3dContinuity.hxx>
23 #include <ShapeUpgrade_SplitSurfaceContinuity.hxx>
24 #include <ShapeUpgrade_WireDivide.hxx>
25 #include <TopoDS_Shape.hxx>
26 
27 //=======================================================================
28 //function : ShapeUpgrade_ShapeDivideContinuity
29 //purpose  :
30 //=======================================================================
ShapeUpgrade_ShapeDivideContinuity()31 ShapeUpgrade_ShapeDivideContinuity::ShapeUpgrade_ShapeDivideContinuity()
32 {
33   myCurve3dCriterion = GeomAbs_C1;
34   myCurve2dCriterion = GeomAbs_C1;
35   mySurfaceCriterion  = GeomAbs_C1;
36   myTolerance3d = Precision::Confusion();
37   myTolerance2d = Precision::PConfusion();
38 }
39 
40 //=======================================================================
41 //function : ShapeUpgrade_ShapeDivideContinuity
42 //purpose  :
43 //=======================================================================
44 
ShapeUpgrade_ShapeDivideContinuity(const TopoDS_Shape & S)45 ShapeUpgrade_ShapeDivideContinuity::ShapeUpgrade_ShapeDivideContinuity(const TopoDS_Shape& S):
46      ShapeUpgrade_ShapeDivide(S)
47 {
48   myCurve3dCriterion = GeomAbs_C1;
49   myCurve2dCriterion = GeomAbs_C1;
50   mySurfaceCriterion  = GeomAbs_C1;
51   myTolerance3d = Precision::Confusion();
52   myTolerance2d = Precision::PConfusion();
53 }
54 
55 //=======================================================================
56 //function : SetTolerance
57 //purpose  :
58 //=======================================================================
59 
SetTolerance(const Standard_Real Tol)60 void ShapeUpgrade_ShapeDivideContinuity::SetTolerance(const Standard_Real Tol)
61 {
62   myTolerance3d = Tol;
63 }
64 
65 //=======================================================================
66 //function : SetTolerance2d
67 //purpose  :
68 //=======================================================================
69 
SetTolerance2d(const Standard_Real Tol)70 void ShapeUpgrade_ShapeDivideContinuity::SetTolerance2d(const Standard_Real Tol)
71 {
72   myTolerance2d = Tol;
73 }
74 
75 //=======================================================================
76 //function : SetBoundaryCriterion
77 //purpose  :
78 //=======================================================================
79 
SetBoundaryCriterion(const GeomAbs_Shape Criterion)80 void ShapeUpgrade_ShapeDivideContinuity::SetBoundaryCriterion(const GeomAbs_Shape Criterion)
81 {
82   myCurve3dCriterion = Criterion;
83 }
84 
85 //=======================================================================
86 //function : SetPCurveCriterion
87 //purpose  :
88 //=======================================================================
89 
SetPCurveCriterion(const GeomAbs_Shape Criterion)90 void ShapeUpgrade_ShapeDivideContinuity::SetPCurveCriterion(const GeomAbs_Shape Criterion)
91 {
92   myCurve2dCriterion = Criterion;
93 }
94 
95 //=======================================================================
96 //function : SetSurfaceCriterion
97 //purpose  :
98 //=======================================================================
99 
SetSurfaceCriterion(const GeomAbs_Shape Criterion)100 void ShapeUpgrade_ShapeDivideContinuity::SetSurfaceCriterion(const GeomAbs_Shape Criterion)
101 {
102   mySurfaceCriterion = Criterion;
103 }
104 
105 //=======================================================================
106 //function : GetSplitFaceTool
107 //purpose  :
108 //=======================================================================
109 
Handle(ShapeUpgrade_FaceDivide)110 Handle(ShapeUpgrade_FaceDivide) ShapeUpgrade_ShapeDivideContinuity::GetSplitFaceTool() const
111 {
112   Handle(ShapeUpgrade_SplitCurve2dContinuity) theSplitCurve2dTool = new ShapeUpgrade_SplitCurve2dContinuity;
113   Handle(ShapeUpgrade_SplitCurve3dContinuity) theSplitCurve3dTool = new ShapeUpgrade_SplitCurve3dContinuity;
114   Handle(ShapeUpgrade_SplitSurfaceContinuity) theSplitSurfaceTool = new ShapeUpgrade_SplitSurfaceContinuity;
115   theSplitCurve2dTool->SetCriterion (myCurve2dCriterion);
116   theSplitCurve3dTool->SetCriterion (myCurve3dCriterion);
117   theSplitSurfaceTool->SetCriterion (mySurfaceCriterion);
118   theSplitCurve2dTool->SetTolerance (myTolerance2d);
119   theSplitCurve3dTool->SetTolerance (myTolerance3d);
120   theSplitSurfaceTool->SetTolerance (myTolerance3d);
121   Handle(ShapeUpgrade_WireDivide) theSplitWireTool = new ShapeUpgrade_WireDivide;
122   theSplitWireTool->SetSplitCurve2dTool ( theSplitCurve2dTool );
123   theSplitWireTool->SetSplitCurve3dTool ( theSplitCurve3dTool );
124   Handle(ShapeUpgrade_FaceDivide) theSplitFaceTool = new ShapeUpgrade_FaceDivide;
125   theSplitFaceTool->SetSplitSurfaceTool ( theSplitSurfaceTool );
126   theSplitFaceTool->SetWireDivideTool ( theSplitWireTool );
127   return theSplitFaceTool;
128 }
129