0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / TopOpeBRepTool / TopOpeBRepTool_FuseEdges.hxx
1 // Created on: 1998-11-26
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_FuseEdges_HeaderFile
18 #define _TopOpeBRepTool_FuseEdges_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_IndexedDataMapOfShapeListOfShape.hxx>
27 #include <TopTools_DataMapOfIntegerListOfShape.hxx>
28 #include <TopTools_DataMapOfIntegerShape.hxx>
29 #include <TopTools_DataMapOfShapeShape.hxx>
30 #include <Standard_Integer.hxx>
31 #include <TopTools_IndexedMapOfShape.hxx>
32 #include <TopAbs_ShapeEnum.hxx>
33 #include <TopTools_MapOfShape.hxx>
34 #include <TopTools_ListOfShape.hxx>
35 class Standard_ConstructionError;
36 class Standard_NullObject;
37 class TopoDS_Shape;
38 class TopoDS_Vertex;
39 class TopoDS_Edge;
40
41
42 //! This class can detect  vertices in a face that can
43 //! be considered useless and then perform the fuse of
44 //! the  edges and remove  the  useless vertices.  By
45 //! useles vertices,  we mean :
46 //! * vertices that  have  exactly two connex edges
47 //! * the edges connex to the vertex must have
48 //! exactly the same 2 connex faces .
49 //! * The edges connex to the vertex must have the
50 //! same geometric support.
51 class TopOpeBRepTool_FuseEdges 
52 {
53 public:
54
55   DEFINE_STANDARD_ALLOC
56
57   
58   //! Initialise members  and build  construction of map
59   //! of ancestors.
60   Standard_EXPORT TopOpeBRepTool_FuseEdges(const TopoDS_Shape& theShape, const Standard_Boolean PerformNow = Standard_False);
61   
62   //! set edges to avoid being fused
63   Standard_EXPORT void AvoidEdges (const TopTools_IndexedMapOfShape& theMapEdg);
64   
65   //! returns  all the list of edges to be fused
66   //! each list of the map represent a set of connex edges
67   //! that can be fused.
68   Standard_EXPORT void Edges (TopTools_DataMapOfIntegerListOfShape& theMapLstEdg);
69   
70   //! returns all the fused edges. each integer entry in
71   //! the   map  corresponds  to  the  integer   in the
72   //! DataMapOfIntegerListOfShape  we    get in  method
73   //! Edges.   That is to say, to  the list  of edges in
74   //! theMapLstEdg(i) corresponds the resulting edge theMapEdge(i)
75   Standard_EXPORT void ResultEdges (TopTools_DataMapOfIntegerShape& theMapEdg);
76   
77   //! returns the map of modified faces.
78   Standard_EXPORT void Faces (TopTools_DataMapOfShapeShape& theMapFac);
79   
80   //! returns myShape modified with the list of internal
81   //! edges removed from it.
82   Standard_EXPORT TopoDS_Shape& Shape();
83   
84   //! returns the number of vertices candidate to be removed
85   Standard_EXPORT Standard_Integer NbVertices();
86   
87   //! Using  map of list of connex  edges, fuse each list to
88   //! one edge and then update myShape
89   Standard_EXPORT void Perform();
90
91
92
93
94 protected:
95
96
97
98
99
100 private:
101   
102   //! Build the all the lists of edges that are to be fused
103   Standard_EXPORT void BuildListEdges();
104   
105   //! Build result   fused edges according  to  the list
106   //! builtin BuildLisEdges
107   Standard_EXPORT void BuildListResultEdges();
108   
109   Standard_EXPORT void BuildListConnexEdge (const TopoDS_Shape& theEdge, TopTools_MapOfShape& theMapUniq, TopTools_ListOfShape& theLstEdg);
110   
111   Standard_EXPORT Standard_Boolean NextConnexEdge (const TopoDS_Vertex& theVertex, const TopoDS_Shape& theEdge, TopoDS_Shape& theEdgeConnex) const;
112   
113   Standard_EXPORT Standard_Boolean SameSupport (const TopoDS_Edge& E1, const TopoDS_Edge& E2) const;
114   
115   Standard_EXPORT Standard_Boolean UpdatePCurve (const TopoDS_Edge& theOldEdge, TopoDS_Edge& theNewEdge, const TopTools_ListOfShape& theLstEdg) const;
116
117
118   TopoDS_Shape myShape;
119   Standard_Boolean myShapeDone;
120   Standard_Boolean myEdgesDone;
121   Standard_Boolean myResultEdgesDone;
122   TopTools_IndexedDataMapOfShapeListOfShape myMapVerLstEdg;
123   TopTools_IndexedDataMapOfShapeListOfShape myMapEdgLstFac;
124   TopTools_DataMapOfIntegerListOfShape myMapLstEdg;
125   TopTools_DataMapOfIntegerShape myMapEdg;
126   TopTools_DataMapOfShapeShape myMapFaces;
127   Standard_Integer myNbConnexEdge;
128   TopTools_IndexedMapOfShape myAvoidEdg;
129
130
131 };
132
133
134
135
136
137
138
139 #endif // _TopOpeBRepTool_FuseEdges_HeaderFile