Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:27

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