42cf5bc1 |
1 | // Created on: 1998-11-19 |
2 | // Created by: Jean-Michel BOULCOURT |
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 _TopOpeBRepTool_PurgeInternalEdges_HeaderFile |
18 | #define _TopOpeBRepTool_PurgeInternalEdges_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_DefineAlloc.hxx> |
22 | #include <Standard_Handle.hxx> |
23 | |
24 | #include <TopoDS_Shape.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <TopTools_DataMapOfShapeListOfShape.hxx> |
27 | #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> |
28 | #include <Standard_Integer.hxx> |
29 | class Standard_ConstructionError; |
30 | class Standard_NullObject; |
31 | class TopoDS_Shape; |
32 | |
33 | |
34 | //! remove from a shape, the internal edges that are |
35 | //! not connected to any face in the shape. We can |
36 | //! get the list of the edges as a |
37 | //! DataMapOfShapeListOfShape with a Face of the Shape |
38 | //! as the key and a list of internal edges as the |
39 | //! value. The list of internal edges means edges |
40 | //! that are not connected to any face in the shape. |
41 | //! |
42 | //! Example of use : |
43 | //! TopTools_DataMapOfShapeListOfShape mymap; |
44 | //! TopOpeBRepTool_PurgeInternalEdges |
45 | //! mypurgealgo(mysolid); mypurgealgo.GetFaces(mymap); |
46 | class TopOpeBRepTool_PurgeInternalEdges |
47 | { |
48 | public: |
49 | |
50 | DEFINE_STANDARD_ALLOC |
51 | |
52 | |
53 | //! Initialize members and begin exploration of shape |
54 | //! depending of the value of PerformNow |
55 | Standard_EXPORT TopOpeBRepTool_PurgeInternalEdges(const TopoDS_Shape& theShape, const Standard_Boolean PerformNow = Standard_True); |
56 | |
57 | //! returns the list internal edges associated with |
58 | //! the faces of the myShape. If PerformNow was False |
59 | //! when created, then call the private Perform method |
60 | //! that do the main job. |
61 | Standard_EXPORT void Faces (TopTools_DataMapOfShapeListOfShape& theMapFacLstEdg); |
62 | |
63 | //! returns myShape modified with the list of internal |
64 | //! edges removed from it. |
65 | Standard_EXPORT TopoDS_Shape& Shape(); |
66 | |
67 | //! returns the number of edges candidate to be removed |
487bf1ce |
68 | Standard_EXPORT Standard_Integer NbEdges() const; |
42cf5bc1 |
69 | |
70 | //! returns False if the list of internal edges has |
71 | //! not been extracted |
487bf1ce |
72 | Standard_Boolean IsDone() const |
73 | { |
74 | return myIsDone; |
75 | } |
42cf5bc1 |
76 | |
77 | //! Using the list of internal edge from each face, |
78 | //! rebuild myShape by removing thoses edges. |
79 | Standard_EXPORT void Perform(); |
80 | |
42cf5bc1 |
81 | protected: |
82 | |
42cf5bc1 |
83 | TopTools_IndexedDataMapOfShapeListOfShape myMapEdgLstFac; |
84 | |
42cf5bc1 |
85 | private: |
42cf5bc1 |
86 | |
87 | //! Do the main job. Explore all the edges of myShape and |
88 | //! build a map with faces as a key and list of internal |
89 | //! edges(without connected faces) as value. |
90 | Standard_EXPORT void BuildList(); |
91 | |
487bf1ce |
92 | private: |
42cf5bc1 |
93 | |
94 | TopoDS_Shape myShape; |
95 | Standard_Boolean myIsDone; |
96 | TopTools_DataMapOfShapeListOfShape myMapFacLstEdg; |
42cf5bc1 |
97 | }; |
98 | |
42cf5bc1 |
99 | #endif // _TopOpeBRepTool_PurgeInternalEdges_HeaderFile |