0028694: IGES reader produces too small edge covered by its vertices
[occt.git] / src / ShapeFix / ShapeFix_Solid.hxx
1 // Created on: 1998-06-03
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_Solid_HeaderFile
18 #define _ShapeFix_Solid_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <TopoDS_Shape.hxx>
24 #include <Standard_Integer.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <ShapeFix_Root.hxx>
27 #include <ShapeExtend_Status.hxx>
28 #include <Standard_Real.hxx>
29 class ShapeFix_Shell;
30 class TopoDS_Solid;
31 class Message_ProgressIndicator;
32 class TopoDS_Shell;
33 class ShapeExtend_BasicMsgRegistrator;
34
35 // resolve name collisions with X11 headers
36 #ifdef Status
37   #undef Status
38 #endif
39
40 class ShapeFix_Solid;
41 DEFINE_STANDARD_HANDLE(ShapeFix_Solid, ShapeFix_Root)
42
43 //! Provides method to build a solid from a shells and
44 //! orients them in order to have a valid solid with finite volume
45 class ShapeFix_Solid : public ShapeFix_Root
46 {
47
48 public:
49
50   
51   //! Empty constructor;
52   Standard_EXPORT ShapeFix_Solid();
53   
54   //! Initializes by solid.
55   Standard_EXPORT ShapeFix_Solid(const TopoDS_Solid& solid);
56   
57   //! Initializes by solid .
58   Standard_EXPORT virtual void Init (const TopoDS_Solid& solid);
59   
60   //! Iterates on shells and performs fixes
61   //! (calls ShapeFix_Shell for each subshell). The passed
62   //! progress indicator allows user to consult the current
63   //! progress stage and abort algorithm if needed.
64   Standard_EXPORT virtual Standard_Boolean Perform (const Handle(Message_ProgressIndicator)& theProgress = 0);
65   
66   //! Calls MakeSolid and orients the solid to be "not infinite"
67   Standard_EXPORT TopoDS_Solid SolidFromShell (const TopoDS_Shell& shell);
68   
69   //! Returns the status of the last Fix.
70   Standard_EXPORT Standard_Boolean Status (const ShapeExtend_Status status) const;
71   
72   //! Returns resulting solid.
73   Standard_EXPORT TopoDS_Shape Solid() const;
74   
75   //! Returns tool for fixing shells.
76   Handle(ShapeFix_Shell) FixShellTool() const
77   {
78     return myFixShell;
79   }
80   
81   //! Sets message registrator
82   Standard_EXPORT virtual void SetMsgRegistrator (const Handle(ShapeExtend_BasicMsgRegistrator)& msgreg) Standard_OVERRIDE;
83   
84   //! Sets basic precision value (also to FixShellTool)
85   Standard_EXPORT virtual void SetPrecision (const Standard_Real preci) Standard_OVERRIDE;
86   
87   //! Sets minimal allowed tolerance (also to FixShellTool)
88   Standard_EXPORT virtual void SetMinTolerance (const Standard_Real mintol) Standard_OVERRIDE;
89   
90   //! Sets maximal allowed tolerance (also to FixShellTool)
91   Standard_EXPORT virtual void SetMaxTolerance (const Standard_Real maxtol) Standard_OVERRIDE;
92   
93   //! Returns (modifiable) the mode for applying fixes of
94   //! ShapeFix_Shell, by default True.
95   Standard_Integer& FixShellMode()
96   {
97     return myFixShellMode;
98   }
99   
100   //! Returns (modifiable) the mode for applying analysis and fixes of
101   //! orientation of shells in the solid; by default True.
102   Standard_Integer& FixShellOrientationMode()
103   {
104     return myFixShellOrientationMode;
105   }
106   
107   //! Returns (modifiable) the mode for creation of solids.
108   //! If mode myCreateOpenSolidMode is equal to true
109   //! solids are created from open shells
110   //! else solids are created  from closed shells only.
111   //! ShapeFix_Shell, by default False.
112   Standard_Boolean& CreateOpenSolidMode()
113   {
114     return myCreateOpenSolidMode;
115   }
116   
117   //! In case of multiconnexity returns compound of fixed solids
118   //! else returns one solid.
119   Standard_EXPORT TopoDS_Shape Shape();
120
121   DEFINE_STANDARD_RTTIEXT(ShapeFix_Solid,ShapeFix_Root)
122
123 protected:
124   TopoDS_Shape mySolid;
125   Handle(ShapeFix_Shell) myFixShell;
126   Standard_Integer myStatus;
127   Standard_Integer myFixShellMode;
128   Standard_Integer myFixShellOrientationMode;
129   Standard_Boolean myCreateOpenSolidMode;
130 };
131
132 #endif // _ShapeFix_Solid_HeaderFile