Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/opencascade/BOPAlgo_WireSplitter.lxx is written in an unsupported language. File is not indexed.

0001 // Created by: Peter KURNEV
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #include <BRep_Builder.hxx>
0016 #include <BRep_Tool.hxx>
0017 
0018 #include <TopoDS_Edge.hxx>
0019 
0020 //=======================================================================
0021 // function : BOPAlgo_EdgeInfo
0022 // purpose  :
0023 //=======================================================================
0024 class BOPAlgo_EdgeInfo
0025 {
0026 public:
0027   //
0028   BOPAlgo_EdgeInfo()
0029       : myPassed(Standard_False),
0030         myInFlag(Standard_False),
0031         myIsInside(Standard_False),
0032         myAngle(-1.) {};
0033 
0034   //
0035   void SetEdge(const TopoDS_Edge& theE) { myEdge = theE; };
0036 
0037   //
0038   const TopoDS_Edge& Edge() const { return myEdge; };
0039 
0040   //
0041   void SetPassed(const Standard_Boolean theFlag) { myPassed = theFlag; };
0042 
0043   //
0044   Standard_Boolean Passed() const { return myPassed; };
0045 
0046   //
0047   void SetInFlag(const Standard_Boolean theFlag) { myInFlag = theFlag; };
0048 
0049   //
0050   Standard_Boolean IsIn() const { return myInFlag; };
0051 
0052   //
0053   void SetAngle(const Standard_Real theAngle) { myAngle = theAngle; };
0054 
0055   //
0056   Standard_Real Angle() const { return myAngle; };
0057 
0058   //
0059   Standard_Boolean IsInside() const { return myIsInside; };
0060 
0061   //
0062   void SetIsInside(const Standard_Boolean theIsInside) { myIsInside = theIsInside; };
0063 
0064   //
0065 protected:
0066   TopoDS_Edge      myEdge;
0067   Standard_Boolean myPassed;
0068   Standard_Boolean myInFlag;
0069   Standard_Boolean myIsInside;
0070   Standard_Real    myAngle;
0071 };
0072 
0073 #include <NCollection_List.hxx>
0074 typedef NCollection_List<BOPAlgo_EdgeInfo> BOPAlgo_ListOfEdgeInfo;
0075 typedef BOPAlgo_ListOfEdgeInfo::Iterator   BOPAlgo_ListIteratorOfListOfEdgeInfo;
0076 
0077 #include <NCollection_IndexedDataMap.hxx>
0078 #include <TopTools_ShapeMapHasher.hxx>
0079 
0080 typedef NCollection_IndexedDataMap<TopoDS_Shape, BOPAlgo_ListOfEdgeInfo, TopTools_ShapeMapHasher>
0081   BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo;
0082 
0083 //=======================================================================
0084 // function : MakeWire
0085 // purpose  :
0086 //=======================================================================
0087 inline void BOPAlgo_WireSplitter::MakeWire(TopTools_ListOfShape& aLE, TopoDS_Wire& aWire)
0088 {
0089   BRep_Builder aBB;
0090   aBB.MakeWire(aWire);
0091   //
0092   TopTools_ListIteratorOfListOfShape aIt(aLE);
0093   for (; aIt.More(); aIt.Next())
0094   {
0095     aBB.Add(aWire, aIt.Value());
0096   }
0097   aWire.Closed(BRep_Tool::IsClosed(aWire));
0098 }