973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
42cf5bc1 |
14 | |
15 | #include <Message_Msg.hxx> |
16 | #include <ShapeBuild_ReShape.hxx> |
17 | #include <ShapeExtend_BasicMsgRegistrator.hxx> |
18 | #include <ShapeFix_Root.hxx> |
19 | #include <Standard_Type.hxx> |
20 | #include <TopoDS_Shape.hxx> |
7fd59977 |
21 | |
25e59720 |
22 | IMPLEMENT_STANDARD_RTTIEXT(ShapeFix_Root,Standard_Transient) |
92efcf78 |
23 | |
7fd59977 |
24 | //======================================================================= |
25 | //function : ShapeFix_Root |
26 | //purpose : |
27 | //======================================================================= |
7fd59977 |
28 | ShapeFix_Root::ShapeFix_Root() |
29 | { |
30 | myPrecision = myMinTol = myMaxTol = Precision::Confusion(); |
31 | myMsgReg = new ShapeExtend_BasicMsgRegistrator; |
32 | } |
33 | |
34 | //======================================================================= |
35 | //function : Set |
36 | //purpose : |
37 | //======================================================================= |
38 | |
39 | void ShapeFix_Root::Set (const Handle(ShapeFix_Root)& Root) |
40 | { |
41 | myContext = Root->myContext; |
42 | myMsgReg = Root->myMsgReg; |
43 | myPrecision = Root->myPrecision; |
44 | myMinTol = Root->myMinTol; |
45 | myMaxTol = Root->myMaxTol; |
46 | myShape = Root->myShape; |
47 | } |
48 | |
49 | //======================================================================= |
50 | //function : SetContext |
51 | //purpose : |
52 | //======================================================================= |
53 | |
54 | void ShapeFix_Root::SetContext (const Handle(ShapeBuild_ReShape)& context) |
55 | { |
56 | myContext = context; |
57 | } |
58 | |
59 | //======================================================================= |
60 | //function : SetMsgRegistrator |
61 | //purpose : |
62 | //======================================================================= |
63 | |
64 | void ShapeFix_Root::SetMsgRegistrator(const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg) |
65 | { |
66 | myMsgReg = msgreg; |
67 | } |
68 | |
69 | //======================================================================= |
70 | //function : SetPrecision |
71 | //purpose : |
72 | //======================================================================= |
73 | |
74 | void ShapeFix_Root::SetPrecision (const Standard_Real preci) |
75 | { |
76 | myPrecision = preci; |
77 | if(myMaxTol < myPrecision) myMaxTol = myPrecision; |
78 | if(myMinTol > myPrecision) myMinTol = myPrecision; |
79 | } |
80 | |
81 | //======================================================================= |
82 | //function : SetMinTolerance |
83 | //purpose : |
84 | //======================================================================= |
85 | |
86 | void ShapeFix_Root::SetMinTolerance (const Standard_Real mintol) |
87 | { |
88 | myMinTol = mintol; |
89 | } |
90 | |
91 | //======================================================================= |
92 | //function : SetMaxTolerance |
93 | //purpose : |
94 | //======================================================================= |
95 | |
96 | void ShapeFix_Root::SetMaxTolerance (const Standard_Real maxtol) |
97 | { |
98 | myMaxTol = maxtol; |
99 | } |
100 | |
101 | //======================================================================= |
102 | //function : SendMsg |
103 | //purpose : |
104 | //======================================================================= |
105 | |
106 | void ShapeFix_Root::SendMsg(const TopoDS_Shape& shape, |
107 | const Message_Msg& message, |
108 | const Message_Gravity gravity) const |
109 | { |
da2db6a7 |
110 | if ( !myMsgReg.IsNull() ) |
111 | myMsgReg->Send (shape, message, gravity); |
7fd59977 |
112 | } |