1 // Created on: 2007-09-10
2 // Created by: Igor FEOKTISTOV
3 // Copyright (c) 2007-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _BRepLib_FuseEdges_HeaderFile
17 #define _BRepLib_FuseEdges_HeaderFile
19 #include <Standard.hxx>
20 #include <Standard_DefineAlloc.hxx>
21 #include <Standard_Handle.hxx>
23 #include <TopoDS_Shape.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
26 #include <TopTools_DataMapOfIntegerListOfShape.hxx>
27 #include <TopTools_DataMapOfIntegerShape.hxx>
28 #include <TopTools_DataMapOfShapeShape.hxx>
29 #include <Standard_Integer.hxx>
30 #include <TopTools_IndexedMapOfShape.hxx>
31 #include <TopAbs_ShapeEnum.hxx>
32 #include <TopTools_MapOfShape.hxx>
33 #include <TopTools_ListOfShape.hxx>
34 class Standard_ConstructionError;
35 class Standard_NullObject;
41 //! This class can detect vertices in a face that can
42 //! be considered useless and then perform the fuse of
43 //! the edges and remove the useless vertices. By
44 //! useles vertices, we mean :
45 //! * vertices that have exactly two connex edges
46 //! * the edges connex to the vertex must have
47 //! exactly the same 2 connex faces .
48 //! * The edges connex to the vertex must have the
49 //! same geometric support.
50 class BRepLib_FuseEdges
57 //! Initialise members and build construction of map
59 Standard_EXPORT BRepLib_FuseEdges(const TopoDS_Shape& theShape, const Standard_Boolean PerformNow = Standard_False);
61 //! set edges to avoid being fused
62 Standard_EXPORT void AvoidEdges (const TopTools_IndexedMapOfShape& theMapEdg);
64 //! set mode to enable concatenation G1 BSpline edges in one
65 //! End Modified by IFV 19.04.07
66 Standard_EXPORT void SetConcatBSpl (const Standard_Boolean theConcatBSpl = Standard_True);
68 //! returns all the list of edges to be fused
69 //! each list of the map represent a set of connex edges
70 //! that can be fused.
71 Standard_EXPORT void Edges (TopTools_DataMapOfIntegerListOfShape& theMapLstEdg);
73 //! returns all the fused edges. each integer entry in
74 //! the map corresponds to the integer in the
75 //! DataMapOfIntegerListOfShape we get in method
76 //! Edges. That is to say, to the list of edges in
77 //! theMapLstEdg(i) corresponds the resulting edge theMapEdge(i)
78 Standard_EXPORT void ResultEdges (TopTools_DataMapOfIntegerShape& theMapEdg);
80 //! returns the map of modified faces.
81 Standard_EXPORT void Faces (TopTools_DataMapOfShapeShape& theMapFac);
83 //! returns myShape modified with the list of internal
84 //! edges removed from it.
85 Standard_EXPORT TopoDS_Shape& Shape();
87 //! returns the number of vertices candidate to be removed
88 Standard_EXPORT Standard_Integer NbVertices();
90 //! Using map of list of connex edges, fuse each list to
91 //! one edge and then update myShape
92 Standard_EXPORT void Perform();
105 //! Build the all the lists of edges that are to be fused
106 Standard_EXPORT void BuildListEdges();
108 //! Build result fused edges according to the list
109 //! builtin BuildLisEdges
110 Standard_EXPORT void BuildListResultEdges();
112 Standard_EXPORT void BuildListConnexEdge (const TopoDS_Shape& theEdge, TopTools_MapOfShape& theMapUniq, TopTools_ListOfShape& theLstEdg);
114 Standard_EXPORT Standard_Boolean NextConnexEdge (const TopoDS_Vertex& theVertex, const TopoDS_Shape& theEdge, TopoDS_Shape& theEdgeConnex) const;
116 Standard_EXPORT Standard_Boolean SameSupport (const TopoDS_Edge& E1, const TopoDS_Edge& E2) const;
118 Standard_EXPORT Standard_Boolean UpdatePCurve (const TopoDS_Edge& theOldEdge, TopoDS_Edge& theNewEdge, const TopTools_ListOfShape& theLstEdg) const;
121 TopoDS_Shape myShape;
122 Standard_Boolean myShapeDone;
123 Standard_Boolean myEdgesDone;
124 Standard_Boolean myResultEdgesDone;
125 TopTools_IndexedDataMapOfShapeListOfShape myMapVerLstEdg;
126 TopTools_IndexedDataMapOfShapeListOfShape myMapEdgLstFac;
127 TopTools_DataMapOfIntegerListOfShape myMapLstEdg;
128 TopTools_DataMapOfIntegerShape myMapEdg;
129 TopTools_DataMapOfShapeShape myMapFaces;
130 Standard_Integer myNbConnexEdge;
131 TopTools_IndexedMapOfShape myAvoidEdg;
132 Standard_Boolean myConcatBSpl;
143 #endif // _BRepLib_FuseEdges_HeaderFile