0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / ShapeFix / ShapeFix_Shape.hxx
1 // Created on: 1998-08-12
2 // Created by: DATA EXCHANGE TEAM
3 // Copyright (c) 1998-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_Shape_HeaderFile
18 #define _ShapeFix_Shape_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <TopoDS_Shape.hxx>
24 #include <TopTools_MapOfShape.hxx>
25 #include <Standard_Integer.hxx>
26 #include <ShapeFix_Root.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <ShapeExtend_Status.hxx>
29 #include <Standard_Real.hxx>
30
31 #include <Message_ProgressIndicator.hxx>
32
33 class ShapeFix_Solid;
34 class Message_ProgressIndicator;
35 class ShapeFix_Shell;
36 class ShapeFix_Face;
37 class ShapeFix_Wire;
38 class ShapeFix_Edge;
39 class ShapeExtend_BasicMsgRegistrator;
40
41 // resolve name collisions with X11 headers
42 #ifdef Status
43   #undef Status
44 #endif
45
46 class ShapeFix_Shape;
47 DEFINE_STANDARD_HANDLE(ShapeFix_Shape, ShapeFix_Root)
48
49 //! Fixing shape in general
50 class ShapeFix_Shape : public ShapeFix_Root
51 {
52
53 public:
54
55   
56   //! Empty Constructor
57   Standard_EXPORT ShapeFix_Shape();
58   
59   //! Initislises by shape.
60   Standard_EXPORT ShapeFix_Shape(const TopoDS_Shape& shape);
61   
62   //! Initislises by shape.
63   Standard_EXPORT void Init (const TopoDS_Shape& shape);
64   
65   //! Iterates on sub- shape and performs fixes
66   Standard_EXPORT Standard_Boolean Perform (const Handle(Message_ProgressIndicator)& theProgress = 0);
67   
68   //! Returns resulting shape
69   Standard_EXPORT TopoDS_Shape Shape() const;
70   
71   //! Returns tool for fixing solids.
72     Handle(ShapeFix_Solid) FixSolidTool() const;
73   
74   //! Returns tool for fixing shells.
75     Handle(ShapeFix_Shell) FixShellTool() const;
76   
77   //! Returns tool for fixing faces.
78     Handle(ShapeFix_Face) FixFaceTool() const;
79   
80   //! Returns tool for fixing wires.
81     Handle(ShapeFix_Wire) FixWireTool() const;
82   
83   //! Returns tool for fixing edges.
84     Handle(ShapeFix_Edge) FixEdgeTool() const;
85   
86   //! Returns the status of the last Fix.
87   //! This can be a combination of the following flags:
88   //! ShapeExtend_DONE1: some free edges were fixed
89   //! ShapeExtend_DONE2: some free wires were fixed
90   //! ShapeExtend_DONE3: some free faces were fixed
91   //! ShapeExtend_DONE4: some free shells were fixed
92   //! ShapeExtend_DONE5: some free solids were fixed
93   //! ShapeExtend_DONE6: shapes in compound(s) were fixed
94   Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
95   
96   //! Sets message registrator
97   Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg) Standard_OVERRIDE;
98   
99   //! Sets basic precision value (also to FixSolidTool)
100   Standard_EXPORT virtual void SetPrecision (const Standard_Real preci) Standard_OVERRIDE;
101   
102   //! Sets minimal allowed tolerance (also to FixSolidTool)
103   Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol) Standard_OVERRIDE;
104   
105   //! Sets maximal allowed tolerance (also to FixSolidTool)
106   Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol) Standard_OVERRIDE;
107   
108   //! Returns (modifiable) the mode for applying fixes of
109   //! ShapeFix_Solid, by default True.
110     Standard_Integer& FixSolidMode();
111   
112   //! Returns (modifiable) the mode for applying fixes of
113   //! ShapeFix_Shell, by default True.
114     Standard_Integer& FixFreeShellMode();
115   
116   //! Returns (modifiable) the mode for applying fixes of
117   //! ShapeFix_Face, by default True.
118     Standard_Integer& FixFreeFaceMode();
119   
120   //! Returns (modifiable) the mode for applying fixes of
121   //! ShapeFix_Wire, by default True.
122     Standard_Integer& FixFreeWireMode();
123   
124   //! Returns (modifiable) the mode for applying
125   //! ShapeFix::SameParameter after all fixes, by default True.
126     Standard_Integer& FixSameParameterMode();
127   
128   //! Returns (modifiable) the mode for applying
129   //! ShapeFix::FixVertexPosition before all fixes, by default False.
130     Standard_Integer& FixVertexPositionMode();
131   
132   //! Returns (modifiable) the mode for fixing tolerances of vertices on whole shape
133   //! after performing all fixes
134     Standard_Integer& FixVertexTolMode();
135
136
137
138
139   DEFINE_STANDARD_RTTIEXT(ShapeFix_Shape,ShapeFix_Root)
140
141 protected:
142
143   
144   //! Fixes same parameterization problem on the passed shape
145   //! by updating tolerances of the corresponding topological
146   //! entitites.
147   Standard_EXPORT void SameParameter (const TopoDS_Shape& shape, const Standard_Boolean enforce, const Handle(Message_ProgressIndicator)& theProgress = 0);
148
149   TopoDS_Shape myResult;
150   Handle(ShapeFix_Solid) myFixSolid;
151   TopTools_MapOfShape myMapFixingShape;
152   Standard_Integer myFixSolidMode;
153   Standard_Integer myFixShellMode;
154   Standard_Integer myFixFaceMode;
155   Standard_Integer myFixWireMode;
156   Standard_Integer myFixSameParameterMode;
157   Standard_Integer myFixVertexPositionMode;
158   Standard_Integer myFixVertexTolMode;
159   Standard_Integer myStatus;
160
161
162 private:
163
164
165
166
167 };
168
169
170 #include <ShapeFix_Shape.lxx>
171
172
173
174
175
176 #endif // _ShapeFix_Shape_HeaderFile