Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-25 08:17:46

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 <TopTools_DataMapOfShapeListOfShape.hxx>
0025 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
0026 #include <Standard_Integer.hxx>
0027 
0028 //! remove from  a shape, the  internal edges that are
0029 //! not  connected to any face in  the shape.   We can
0030 //! get  the    list   of      the    edges  as   a
0031 //! DataMapOfShapeListOfShape with a Face of the Shape
0032 //! as  the key and  a  list of internal  edges as the
0033 //! value.  The list   of internal edges  means edges
0034 //! that are  not connected to any  face in the shape.
0035 //!
0036 //! Example of use          :
0037 //! TopTools_DataMapOfShapeListOfShape     mymap;
0038 //! TopOpeBRepTool_PurgeInternalEdges
0039 //! mypurgealgo(mysolid); mypurgealgo.GetFaces(mymap);
0040 class TopOpeBRepTool_PurgeInternalEdges
0041 {
0042 public:
0043   DEFINE_STANDARD_ALLOC
0044 
0045   //! Initialize   members and  begin  exploration   of  shape
0046   //! depending of the value of PerformNow
0047   Standard_EXPORT TopOpeBRepTool_PurgeInternalEdges(
0048     const TopoDS_Shape&    theShape,
0049     const Standard_Boolean PerformNow = Standard_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(TopTools_DataMapOfShapeListOfShape& theMapFacLstEdg);
0056 
0057   //! returns myShape modified with the list of internal
0058   //! edges removed from it.
0059   Standard_EXPORT TopoDS_Shape& Shape();
0060 
0061   //! returns the number of edges candidate to be removed
0062   Standard_EXPORT Standard_Integer NbEdges() const;
0063 
0064   //! returns False  if the list  of internal  edges has
0065   //! not been extracted
0066   Standard_Boolean IsDone() const { return myIsDone; }
0067 
0068   //! Using the list of internal edges from each face,
0069   //! rebuild myShape by removing those edges.
0070   Standard_EXPORT void Perform();
0071 
0072 protected:
0073   TopTools_IndexedDataMapOfShapeListOfShape myMapEdgLstFac;
0074 
0075 private:
0076   //! Do the main job. Explore all the  edges of myShape and
0077   //! build a map with  faces as a key  and list of internal
0078   //! edges(without connected faces) as value.
0079   Standard_EXPORT void BuildList();
0080 
0081 private:
0082   TopoDS_Shape                       myShape;
0083   Standard_Boolean                   myIsDone;
0084   TopTools_DataMapOfShapeListOfShape myMapFacLstEdg;
0085 };
0086 
0087 #endif // _TopOpeBRepTool_PurgeInternalEdges_HeaderFile