0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / ShapeUpgrade / ShapeUpgrade_RemoveInternalWires.hxx
1 // Created on: 2006-08-10
2 // Created by: Galina KULIKOVA
3 // Copyright (c) 2006-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 _ShapeUpgrade_RemoveInternalWires_HeaderFile
17 #define _ShapeUpgrade_RemoveInternalWires_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21
22 #include <TopoDS_Shape.hxx>
23 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
24 #include <TopTools_DataMapOfShapeListOfShape.hxx>
25 #include <TopTools_SequenceOfShape.hxx>
26 #include <Standard_Integer.hxx>
27 #include <ShapeUpgrade_Tool.hxx>
28 #include <ShapeExtend_Status.hxx>
29
30 // resolve name collisions with X11 headers
31 #ifdef Status
32   #undef Status
33 #endif
34
35 class ShapeUpgrade_RemoveInternalWires;
36 DEFINE_STANDARD_HANDLE(ShapeUpgrade_RemoveInternalWires, ShapeUpgrade_Tool)
37
38 //! Removes all internal wires having area less than specified min area
39 class ShapeUpgrade_RemoveInternalWires : public ShapeUpgrade_Tool
40 {
41
42 public:
43
44   
45   //! Creates empty  constructor.
46   Standard_EXPORT ShapeUpgrade_RemoveInternalWires();
47   
48   Standard_EXPORT ShapeUpgrade_RemoveInternalWires(const TopoDS_Shape& theShape);
49   
50   //! Initialize by a Shape.
51   Standard_EXPORT void Init (const TopoDS_Shape& theShape);
52   
53   //! Removes all internal wires having area less than area specified as minimal allowed area
54   Standard_EXPORT Standard_Boolean Perform();
55   
56   //! If specified sequence of shape contains -
57   //! 1.wires then these wires will be removed if they have area less than allowed min area.
58   //! 2.faces than internal wires from these faces will be removed if they have area less than allowed min area.
59   Standard_EXPORT Standard_Boolean Perform (const TopTools_SequenceOfShape& theSeqShapes);
60   
61   //! Get result shape
62     TopoDS_Shape GetResult() const;
63   
64   //! Set min area allowed for holes( all holes having area less than mi area will be removed)
65     Standard_Real& MinArea();
66   
67   //! Set mode which manage removing faces which have outer wires consisting only from edges
68   //! belonginig to removed internal wires.
69   //! By default it is equal to true.
70     Standard_Boolean& RemoveFaceMode();
71   
72   //! Returns sequence of removed faces.
73     const TopTools_SequenceOfShape& RemovedFaces() const;
74   
75   //! Returns sequence of removed faces.
76     const TopTools_SequenceOfShape& RemovedWires() const;
77   
78   //! Queries status of last call to Perform()
79   //! : OK - nothing was done
80   //! :DONE1 - internal wires were removed
81   //! :DONE2 - small faces were removed.
82   //! :FAIL1 - initial shape is not specified
83   //! :FAIL2 - specified sub-shape is not belonged to inotial shape.
84     Standard_Boolean Status (const ShapeExtend_Status theStatus) const;
85
86
87
88
89   DEFINE_STANDARD_RTTIEXT(ShapeUpgrade_RemoveInternalWires,ShapeUpgrade_Tool)
90
91 protected:
92
93   
94   //! Clear all sequences and temporary map;
95   Standard_EXPORT void Clear();
96
97   Standard_Integer myStatus;
98
99
100 private:
101
102   
103   //! Removes internal wires having area of contour less than specified MinArea
104   Standard_EXPORT void removeSmallWire (const TopoDS_Shape& theFace, const TopoDS_Shape& theWire);
105   
106   //! Removes faces having outer wire consisting
107   //! from removed edges(belonging small internal wires)
108   Standard_EXPORT void removeSmallFaces();
109
110   TopoDS_Shape myShape;
111   TopoDS_Shape myResult;
112   Standard_Real myMinArea;
113   Standard_Boolean myRemoveFacesMode;
114   TopTools_IndexedDataMapOfShapeListOfShape myEdgeFaces;
115   TopTools_DataMapOfShapeListOfShape myRemoveEdges;
116   TopTools_SequenceOfShape myRemovedFaces;
117   TopTools_SequenceOfShape myRemoveWires;
118
119
120 };
121
122
123 #include <ShapeUpgrade_RemoveInternalWires.lxx>
124
125
126
127
128
129 #endif // _ShapeUpgrade_RemoveInternalWires_HeaderFile