Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:59:50

0001 // Created on: 1998-11-19
0002 // Created by: Jean-Michel BOULCOURT
0003 // Copyright (c) 1998-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TopOpeBRepTool_PurgeInternalEdges_HeaderFile
0018 #define _TopOpeBRepTool_PurgeInternalEdges_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopoDS_Shape.hxx>
0024 #include <NCollection_List.hxx>
0025 #include <TopTools_ShapeMapHasher.hxx>
0026 #include <NCollection_DataMap.hxx>
0027 #include <NCollection_IndexedDataMap.hxx>
0028 #include <Standard_Integer.hxx>
0029 
0030 //! remove from a shape, the internal edges that are
0031 //! not connected to any face in the shape. We can
0032 //! get the list of the edges as a
0033 //! DataMapOfShapeListOfShape with a Face of the Shape
0034 //! as the key and a list of internal edges as the
0035 //! value. The list of internal edges means edges
0036 //! that are not connected to any face in the shape.
0037 //!
0038 //! Example of use:
0039 //! NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0040 //! mymap; TopOpeBRepTool_PurgeInternalEdges mypurgealgo(mysolid); mypurgealgo.GetFaces(mymap);
0041 class TopOpeBRepTool_PurgeInternalEdges
0042 {
0043 public:
0044   DEFINE_STANDARD_ALLOC
0045 
0046   //! Initialize members and begin exploration of shape
0047   //! depending of the value of PerformNow
0048   Standard_EXPORT TopOpeBRepTool_PurgeInternalEdges(const TopoDS_Shape& theShape,
0049                                                     const bool          PerformNow = true);
0050 
0051   //! returns the list internal edges associated with
0052   //! the faces of the myShape. If PerformNow was False
0053   //! when created, then call the private Perform method
0054   //! that do the main job.
0055   Standard_EXPORT void Faces(
0056     NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>&
0057       theMapFacLstEdg);
0058 
0059   //! returns myShape modified with the list of internal
0060   //! edges removed from it.
0061   Standard_EXPORT TopoDS_Shape& Shape();
0062 
0063   //! returns the number of edges candidate to be removed
0064   Standard_EXPORT int NbEdges() const;
0065 
0066   //! returns False if the list of internal edges has
0067   //! not been extracted
0068   bool IsDone() const { return myIsDone; }
0069 
0070   //! Using the list of internal edges from each face,
0071   //! rebuild myShape by removing those edges.
0072   Standard_EXPORT void Perform();
0073 
0074 protected:
0075   NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0076     myMapEdgLstFac;
0077 
0078 private:
0079   //! Do the main job. Explore all the edges of myShape and
0080   //! build a map with faces as a key and list of internal
0081   //! edges(without connected faces) as value.
0082   Standard_EXPORT void BuildList();
0083 
0084 private:
0085   TopoDS_Shape myShape;
0086   bool         myIsDone;
0087   NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0088     myMapFacLstEdg;
0089 };
0090 
0091 #endif // _TopOpeBRepTool_PurgeInternalEdges_HeaderFile