b311480e |
1 | // Created on: 1999-05-06 |
2 | // Created by: Pavel DURANDIN |
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 | |
7fd59977 |
21 | |
22 | |
23 | #include <ShapeUpgrade_ShapeDivideAngle.ixx> |
24 | #include <ShapeUpgrade_SplitSurfaceAngle.hxx> |
25 | #include <ShapeUpgrade_FaceDivide.hxx> |
26 | |
27 | //======================================================================= |
28 | //function : ShapeUpgrade_ShapeDivideAngle |
29 | //purpose : |
30 | //======================================================================= |
31 | |
32 | ShapeUpgrade_ShapeDivideAngle::ShapeUpgrade_ShapeDivideAngle (const Standard_Real MaxAngle) |
33 | { |
34 | InitTool ( MaxAngle ); |
35 | } |
36 | |
37 | //======================================================================= |
38 | //function : ShapeUpgrade_ShapeDivideAngle |
39 | //purpose : |
40 | //======================================================================= |
41 | |
42 | ShapeUpgrade_ShapeDivideAngle::ShapeUpgrade_ShapeDivideAngle(const Standard_Real MaxAngle, |
43 | const TopoDS_Shape& S): |
44 | ShapeUpgrade_ShapeDivide(S) |
45 | { |
46 | InitTool ( MaxAngle ); |
47 | } |
48 | |
49 | //======================================================================= |
50 | //function : InitTool |
51 | //purpose : |
52 | //======================================================================= |
53 | |
54 | void ShapeUpgrade_ShapeDivideAngle::InitTool (const Standard_Real MaxAngle) |
55 | { |
56 | Handle(ShapeUpgrade_FaceDivide) tool = GetSplitFaceTool(); |
57 | tool->SetSplitSurfaceTool ( new ShapeUpgrade_SplitSurfaceAngle (MaxAngle) ); |
58 | tool->SetWireDivideTool ( 0 ); // no splitting of wire |
59 | SetSplitFaceTool(tool); |
60 | } |
61 | |
62 | //======================================================================= |
63 | //function : SetMaxAngle |
64 | //purpose : |
65 | //======================================================================= |
66 | |
67 | void ShapeUpgrade_ShapeDivideAngle::SetMaxAngle (const Standard_Real MaxAngle) |
68 | { |
69 | InitTool ( MaxAngle ); |
70 | } |
71 | |
72 | //======================================================================= |
73 | //function : MaxAngle |
74 | //purpose : |
75 | //======================================================================= |
76 | |
77 | double ShapeUpgrade_ShapeDivideAngle::MaxAngle () const |
78 | { |
79 | Handle(ShapeUpgrade_FaceDivide) faceTool = GetSplitFaceTool(); |
80 | if ( faceTool.IsNull() ) return 0.; |
81 | Handle(ShapeUpgrade_SplitSurfaceAngle) tool = |
82 | Handle(ShapeUpgrade_SplitSurfaceAngle)::DownCast ( faceTool ); |
83 | return ( tool.IsNull() ? 0. : tool->MaxAngle() ); |
84 | } |
85 | |