Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:17:08

0001 // Created on: 2007-09-10
0002 // Created by: Igor FEOKTISTOV
0003 // Copyright (c) 2007-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _BRepLib_FuseEdges_HeaderFile
0017 #define _BRepLib_FuseEdges_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 #include <Standard_DefineAlloc.hxx>
0021 
0022 #include <TopoDS_Shape.hxx>
0023 #include <NCollection_List.hxx>
0024 #include <TopTools_ShapeMapHasher.hxx>
0025 #include <NCollection_IndexedDataMap.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <NCollection_DataMap.hxx>
0028 #include <NCollection_IndexedMap.hxx>
0029 #include <NCollection_Map.hxx>
0030 class TopoDS_Vertex;
0031 class TopoDS_Edge;
0032 
0033 //! This class can detect vertices in a face that can
0034 //! be considered useless and then perform the fuse of
0035 //! the edges and remove the useless vertices. By
0036 //! useles vertices, we mean:
0037 //! * vertices that have exactly two connex edges
0038 //! * the edges connex to the vertex must have
0039 //! exactly the same 2 connex faces.
0040 //! * The edges connex to the vertex must have the
0041 //! same geometric support.
0042 class BRepLib_FuseEdges
0043 {
0044 public:
0045   DEFINE_STANDARD_ALLOC
0046 
0047   //! Initialise members and build construction of map
0048   //! of ancestors.
0049   Standard_EXPORT BRepLib_FuseEdges(const TopoDS_Shape& theShape, const bool PerformNow = false);
0050 
0051   //! set edges to avoid being fused
0052   Standard_EXPORT void AvoidEdges(
0053     const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& theMapEdg);
0054 
0055   //! set mode to enable concatenation G1 BSpline edges in one
0056   //! End Modified by IFV 19.04.07
0057   Standard_EXPORT void SetConcatBSpl(const bool theConcatBSpl = true);
0058 
0059   //! returns all the list of edges to be fused
0060   //! each list of the map represent a set of connex edges
0061   //! that can be fused.
0062   Standard_EXPORT void Edges(
0063     NCollection_DataMap<int, NCollection_List<TopoDS_Shape>>& theMapLstEdg);
0064 
0065   //! returns all the fused edges. each integer entry in
0066   //! the map corresponds to the integer in the
0067   //! DataMapOfIntegerListOfShape we get in method
0068   //! Edges. That is to say, to the list of edges in
0069   //! theMapLstEdg(i) corresponds the resulting edge theMapEdge(i)
0070   Standard_EXPORT void ResultEdges(NCollection_DataMap<int, TopoDS_Shape>& theMapEdg);
0071 
0072   //! returns the map of modified faces.
0073   Standard_EXPORT void Faces(
0074     NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher>& theMapFac);
0075 
0076   //! returns myShape modified with the list of internal
0077   //! edges removed from it.
0078   Standard_EXPORT TopoDS_Shape& Shape();
0079 
0080   //! returns the number of vertices candidate to be removed
0081   Standard_EXPORT int NbVertices();
0082 
0083   //! Using map of list of connex edges, fuse each list to
0084   //! one edge and then update myShape
0085   Standard_EXPORT void Perform();
0086 
0087 private:
0088   //! Build the all the lists of edges that are to be fused
0089   Standard_EXPORT void BuildListEdges();
0090 
0091   //! Build result fused edges according to the list
0092   //! builtin BuildLisEdges
0093   Standard_EXPORT void BuildListResultEdges();
0094 
0095   Standard_EXPORT void BuildListConnexEdge(
0096     const TopoDS_Shape&                                     theEdge,
0097     NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>& theMapUniq,
0098     NCollection_List<TopoDS_Shape>&                         theLstEdg);
0099 
0100   Standard_EXPORT bool NextConnexEdge(const TopoDS_Vertex& theVertex,
0101                                       const TopoDS_Shape&  theEdge,
0102                                       TopoDS_Shape&        theEdgeConnex) const;
0103 
0104   Standard_EXPORT bool SameSupport(const TopoDS_Edge& E1, const TopoDS_Edge& E2) const;
0105 
0106   Standard_EXPORT bool UpdatePCurve(const TopoDS_Edge&                    theOldEdge,
0107                                     TopoDS_Edge&                          theNewEdge,
0108                                     const NCollection_List<TopoDS_Shape>& theLstEdg) const;
0109 
0110   TopoDS_Shape myShape;
0111   bool         myShapeDone;
0112   bool         myEdgesDone;
0113   bool         myResultEdgesDone;
0114   NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0115     myMapVerLstEdg;
0116   NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0117                                                                            myMapEdgLstFac;
0118   NCollection_DataMap<int, NCollection_List<TopoDS_Shape>>                 myMapLstEdg;
0119   NCollection_DataMap<int, TopoDS_Shape>                                   myMapEdg;
0120   NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myMapFaces;
0121   int                                                                      myNbConnexEdge;
0122   NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>            myAvoidEdg;
0123   bool                                                                     myConcatBSpl;
0124 };
0125 
0126 #endif // _BRepLib_FuseEdges_HeaderFile