1 // Created on: 2014-11-13
2 // Created by: Maxim YAKUNIN
3 // Copyright (c) 2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15 
16 #ifndef _ShapeFix_FixSmallSolid_HeaderFile
17 #define _ShapeFix_FixSmallSolid_HeaderFile
18 
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21 
22 #include <Standard_Integer.hxx>
23 #include <Standard_Real.hxx>
24 #include <ShapeFix_Root.hxx>
25 #include <Standard_Boolean.hxx>
26 class TopoDS_Shape;
27 class ShapeBuild_ReShape;
28 
29 
30 class ShapeFix_FixSmallSolid;
31 DEFINE_STANDARD_HANDLE(ShapeFix_FixSmallSolid, ShapeFix_Root)
32 
33 //! Fixing solids with small size
34 class ShapeFix_FixSmallSolid : public ShapeFix_Root
35 {
36 
37 public:
38 
39 
40   //! Construct
41   Standard_EXPORT ShapeFix_FixSmallSolid();
42 
43   //! Set working mode for operator:
44   //! - theMode = 0 use both WidthFactorThreshold and VolumeThreshold parameters
45   //! - theMode = 1 use only WidthFactorThreshold parameter
46   //! - theMode = 2 use only VolumeThreshold parameter
47   Standard_EXPORT void SetFixMode (const Standard_Integer theMode);
48 
49   //! Set or clear volume threshold for small solids
50   Standard_EXPORT void SetVolumeThreshold (const Standard_Real theThreshold = -1.0);
51 
52   //! Set or clear width factor threshold for small solids
53   Standard_EXPORT void SetWidthFactorThreshold (const Standard_Real theThreshold = -1.0);
54 
55   //! Remove small solids from the given shape
56   Standard_EXPORT TopoDS_Shape Remove (const TopoDS_Shape& theShape, const Handle(ShapeBuild_ReShape)& theContext) const;
57 
58   //! Merge small solids in the given shape to adjacent non-small ones
59   Standard_EXPORT TopoDS_Shape Merge (const TopoDS_Shape& theShape, const Handle(ShapeBuild_ReShape)& theContext) const;
60 
61 
62 
63 
64   DEFINE_STANDARD_RTTIEXT(ShapeFix_FixSmallSolid,ShapeFix_Root)
65 
66 protected:
67 
68 
69 
70 
71 private:
72 
73 
74   Standard_EXPORT Standard_Boolean IsThresholdsSet() const;
75 
76   Standard_EXPORT Standard_Boolean IsSmall (const TopoDS_Shape& theSolid) const;
77 
78   Standard_EXPORT Standard_Boolean IsUsedWidthFactorThreshold() const;
79 
80   Standard_EXPORT Standard_Boolean IsUsedVolumeThreshold() const;
81 
82   Standard_Integer myFixMode;
83   Standard_Real myVolumeThreshold;
84   Standard_Real myWidthFactorThreshold;
85 
86 
87 };
88 
89 
90 
91 
92 
93 
94 
95 #endif // _ShapeFix_FixSmallSolid_HeaderFile
96