42cf5bc1 |
1 | // Created on: 1999-08-09 |
2 | // Created by: Galina KULIKOVA |
3 | // Copyright (c) 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 | #ifndef _ShapeFix_Root_HeaderFile |
18 | #define _ShapeFix_Root_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Real.hxx> |
24 | #include <TopoDS_Shape.hxx> |
25e59720 |
25 | #include <Standard_Transient.hxx> |
42cf5bc1 |
26 | #include <Message_Gravity.hxx> |
27 | #include <Standard_Boolean.hxx> |
28 | #include <Standard_Integer.hxx> |
e8862cf4 |
29 | |
30 | #include <ShapeExtend_BasicMsgRegistrator.hxx> |
31 | |
42cf5bc1 |
32 | class ShapeBuild_ReShape; |
33 | class ShapeExtend_BasicMsgRegistrator; |
34 | class TopoDS_Shape; |
35 | class Message_Msg; |
36 | |
37 | |
38 | class ShapeFix_Root; |
25e59720 |
39 | DEFINE_STANDARD_HANDLE(ShapeFix_Root, Standard_Transient) |
42cf5bc1 |
40 | |
41 | //! Root class for fixing operations |
42 | //! Provides context for recording changes (optional), |
43 | //! basic precision value and limit (minimal and |
44 | //! maximal) values for tolerances, |
45 | //! and message registrator |
25e59720 |
46 | class ShapeFix_Root : public Standard_Transient |
42cf5bc1 |
47 | { |
48 | |
49 | public: |
50 | |
51 | |
52 | //! Empty Constructor (no context is created) |
53 | Standard_EXPORT ShapeFix_Root(); |
54 | |
55 | //! Copy all fields from another Root object |
56 | Standard_EXPORT virtual void Set (const Handle(ShapeFix_Root)& Root); |
57 | |
58 | //! Sets context |
59 | Standard_EXPORT virtual void SetContext (const Handle(ShapeBuild_ReShape)& context); |
60 | |
61 | //! Returns context |
62 | Handle(ShapeBuild_ReShape) Context() const; |
63 | |
64 | //! Sets message registrator |
65 | Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg); |
66 | |
67 | //! Returns message registrator |
68 | Handle(ShapeExtend_BasicMsgRegistrator) MsgRegistrator() const; |
69 | |
70 | //! Sets basic precision value |
71 | Standard_EXPORT virtual void SetPrecision (const Standard_Real preci); |
72 | |
73 | //! Returns basic precision value |
74 | Standard_Real Precision() const; |
75 | |
76 | //! Sets minimal allowed tolerance |
77 | Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol); |
78 | |
79 | //! Returns minimal allowed tolerance |
80 | Standard_Real MinTolerance() const; |
81 | |
82 | //! Sets maximal allowed tolerance |
83 | Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol); |
84 | |
85 | //! Returns maximal allowed tolerance |
86 | Standard_Real MaxTolerance() const; |
87 | |
88 | //! Returns tolerance limited by [myMinTol,myMaxTol] |
89 | Standard_Real LimitTolerance (const Standard_Real toler) const; |
90 | |
91 | //! Sends a message to be attached to the shape. |
92 | //! Calls corresponding message of message registrator. |
93 | Standard_EXPORT void SendMsg (const TopoDS_Shape& shape, const Message_Msg& message, const Message_Gravity gravity = Message_Info) const; |
94 | |
95 | //! Sends a message to be attached to myShape. |
96 | //! Calls previous method. |
97 | void SendMsg (const Message_Msg& message, const Message_Gravity gravity = Message_Info) const; |
98 | |
99 | //! Sends a warning to be attached to the shape. |
100 | //! Calls SendMsg with gravity set to Message_Warning. |
101 | void SendWarning (const TopoDS_Shape& shape, const Message_Msg& message) const; |
102 | |
103 | //! Calls previous method for myShape. |
104 | void SendWarning (const Message_Msg& message) const; |
105 | |
106 | //! Sends a fail to be attached to the shape. |
107 | //! Calls SendMsg with gravity set to Message_Fail. |
108 | void SendFail (const TopoDS_Shape& shape, const Message_Msg& message) const; |
109 | |
110 | //! Calls previous method for myShape. |
111 | void SendFail (const Message_Msg& message) const; |
112 | |
113 | |
114 | |
115 | |
25e59720 |
116 | DEFINE_STANDARD_RTTIEXT(ShapeFix_Root,Standard_Transient) |
42cf5bc1 |
117 | |
118 | protected: |
119 | |
120 | |
121 | //! Auxiliary method for work with three-position |
122 | //! (on/off/default) flags (modes) in ShapeFix. |
123 | static Standard_Boolean NeedFix (const Standard_Integer flag, const Standard_Boolean def = Standard_True); |
124 | |
125 | TopoDS_Shape myShape; |
126 | |
127 | |
128 | private: |
129 | |
130 | |
131 | Handle(ShapeBuild_ReShape) myContext; |
132 | Handle(ShapeExtend_BasicMsgRegistrator) myMsgReg; |
133 | Standard_Real myPrecision; |
134 | Standard_Real myMinTol; |
135 | Standard_Real myMaxTol; |
136 | |
137 | |
138 | }; |
139 | |
140 | |
141 | #include <ShapeFix_Root.lxx> |
142 | |
143 | |
144 | |
145 | |
146 | |
147 | #endif // _ShapeFix_Root_HeaderFile |