Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:13

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 <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
0024 #include <TopTools_DataMapOfIntegerListOfShape.hxx>
0025 #include <TopTools_DataMapOfIntegerShape.hxx>
0026 #include <TopTools_DataMapOfShapeShape.hxx>
0027 #include <Standard_Integer.hxx>
0028 #include <TopTools_IndexedMapOfShape.hxx>
0029 #include <TopTools_MapOfShape.hxx>
0030 #include <TopTools_ListOfShape.hxx>
0031 class TopoDS_Vertex;
0032 class TopoDS_Edge;
0033 
0034 
0035 //! This class can detect  vertices in a face that can
0036 //! be considered useless and then perform the fuse of
0037 //! the  edges and remove  the  useless vertices.  By
0038 //! useles vertices,  we mean :
0039 //! * vertices that  have  exactly two connex edges
0040 //! * the edges connex to the vertex must have
0041 //! exactly the same 2 connex faces .
0042 //! * The edges connex to the vertex must have the
0043 //! same geometric support.
0044 class BRepLib_FuseEdges 
0045 {
0046 public:
0047 
0048   DEFINE_STANDARD_ALLOC
0049 
0050   
0051   //! Initialise members  and build  construction of map
0052   //! of ancestors.
0053   Standard_EXPORT BRepLib_FuseEdges(const TopoDS_Shape& theShape, const Standard_Boolean PerformNow = Standard_False);
0054   
0055   //! set edges to avoid being fused
0056   Standard_EXPORT void AvoidEdges (const TopTools_IndexedMapOfShape& theMapEdg);
0057   
0058   //! set mode to enable concatenation G1 BSpline edges in one
0059   //! End  Modified  by  IFV  19.04.07
0060   Standard_EXPORT void SetConcatBSpl (const Standard_Boolean theConcatBSpl = Standard_True);
0061   
0062   //! returns  all the list of edges to be fused
0063   //! each list of the map represent a set of connex edges
0064   //! that can be fused.
0065   Standard_EXPORT void Edges (TopTools_DataMapOfIntegerListOfShape& theMapLstEdg);
0066   
0067   //! returns all the fused edges. each integer entry in
0068   //! the   map  corresponds  to  the  integer   in the
0069   //! DataMapOfIntegerListOfShape  we    get in  method
0070   //! Edges.   That is to say, to  the list  of edges in
0071   //! theMapLstEdg(i) corresponds the resulting edge theMapEdge(i)
0072   Standard_EXPORT void ResultEdges (TopTools_DataMapOfIntegerShape& theMapEdg);
0073   
0074   //! returns the map of modified faces.
0075   Standard_EXPORT void Faces (TopTools_DataMapOfShapeShape& theMapFac);
0076   
0077   //! returns myShape modified with the list of internal
0078   //! edges removed from it.
0079   Standard_EXPORT TopoDS_Shape& Shape();
0080   
0081   //! returns the number of vertices candidate to be removed
0082   Standard_EXPORT Standard_Integer NbVertices();
0083   
0084   //! Using  map of list of connex  edges, fuse each list to
0085   //! one edge and then update myShape
0086   Standard_EXPORT void Perform();
0087 
0088 
0089 
0090 
0091 protected:
0092 
0093 
0094 
0095 
0096 
0097 private:
0098   
0099   //! Build the all the lists of edges that are to be fused
0100   Standard_EXPORT void BuildListEdges();
0101   
0102   //! Build result   fused edges according  to  the list
0103   //! builtin BuildLisEdges
0104   Standard_EXPORT void BuildListResultEdges();
0105   
0106   Standard_EXPORT void BuildListConnexEdge (const TopoDS_Shape& theEdge, TopTools_MapOfShape& theMapUniq, TopTools_ListOfShape& theLstEdg);
0107   
0108   Standard_EXPORT Standard_Boolean NextConnexEdge (const TopoDS_Vertex& theVertex, const TopoDS_Shape& theEdge, TopoDS_Shape& theEdgeConnex) const;
0109   
0110   Standard_EXPORT Standard_Boolean SameSupport (const TopoDS_Edge& E1, const TopoDS_Edge& E2) const;
0111   
0112   Standard_EXPORT Standard_Boolean UpdatePCurve (const TopoDS_Edge& theOldEdge, TopoDS_Edge& theNewEdge, const TopTools_ListOfShape& theLstEdg) const;
0113 
0114 
0115   TopoDS_Shape myShape;
0116   Standard_Boolean myShapeDone;
0117   Standard_Boolean myEdgesDone;
0118   Standard_Boolean myResultEdgesDone;
0119   TopTools_IndexedDataMapOfShapeListOfShape myMapVerLstEdg;
0120   TopTools_IndexedDataMapOfShapeListOfShape myMapEdgLstFac;
0121   TopTools_DataMapOfIntegerListOfShape myMapLstEdg;
0122   TopTools_DataMapOfIntegerShape myMapEdg;
0123   TopTools_DataMapOfShapeShape myMapFaces;
0124   Standard_Integer myNbConnexEdge;
0125   TopTools_IndexedMapOfShape myAvoidEdg;
0126   Standard_Boolean myConcatBSpl;
0127 
0128 
0129 };
0130 
0131 
0132 
0133 
0134 
0135 
0136 
0137 #endif // _BRepLib_FuseEdges_HeaderFile