// Created by: Peter KURNEV // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #include #include #include //======================================================================= //function : //purpose : //======================================================================= inline BOPTools_EdgeSet::BOPTools_EdgeSet() { } //======================================================================= //function : //purpose : //======================================================================= inline BOPTools_EdgeSet::BOPTools_EdgeSet(const Handle(NCollection_BaseAllocator)& theObj) : myMap(100, theObj), myEdges(theObj) { } //======================================================================= //function : ~ //purpose : //======================================================================= inline BOPTools_EdgeSet::~BOPTools_EdgeSet() { } //======================================================================= //function : Clear //purpose : //======================================================================= inline void BOPTools_EdgeSet::Clear() { myMap.Clear(); myEdges.Clear(); } //======================================================================= //function : SetShape //purpose : //======================================================================= inline void BOPTools_EdgeSet::SetShape(const TopoDS_Shape& theShape) { myShape=theShape; } //======================================================================= //function : Shape //purpose : //======================================================================= inline const TopoDS_Shape& BOPTools_EdgeSet::Shape()const { return myShape; } //======================================================================= //function : AddEdge //purpose : //======================================================================= inline void BOPTools_EdgeSet::AddEdge(const TopoDS_Edge& theEdge) { if (!BRep_Tool::Degenerated(theEdge)){ myEdges.Append(theEdge); myMap.Add(theEdge); } } //======================================================================= //function : AddEdges //purpose : //======================================================================= inline void BOPTools_EdgeSet::AddEdges(const BOPCol_ListOfShape& theLS) { BOPCol_ListIteratorOfListOfShape aIt; // aIt.Initialize(theLS); for (; aIt.More(); aIt.Next()) { const TopoDS_Edge& aE=(*(TopoDS_Edge*)&aIt.Value()); AddEdge(aE); } } //======================================================================= //function : AddEdges //purpose : //======================================================================= inline void BOPTools_EdgeSet::AddEdges(const TopoDS_Shape& theFace) { TopExp_Explorer aExp(theFace, TopAbs_EDGE); for(; aExp.More(); aExp.Next()) { const TopoDS_Edge& aE=(*(TopoDS_Edge*)&aExp.Current()); AddEdge(aE); } } //======================================================================= //function : Get //purpose : //======================================================================= inline void BOPTools_EdgeSet::Get(BOPCol_ListOfShape& theLS)const { BOPCol_ListIteratorOfListOfShape aIt; // aIt.Initialize(myEdges); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aS=aIt.Value(); theLS.Append(aS); } } //======================================================================= //function : Contains //purpose : //======================================================================= inline Standard_Boolean BOPTools_EdgeSet::Contains(const BOPTools_EdgeSet& theOther)const { Standard_Integer aNbEOther, aNbE; Standard_Boolean bRet; BOPCol_ListIteratorOfListOfShape aIt; // aNbE=0; aNbEOther=theOther.myEdges.Extent(); aIt.Initialize(theOther.myEdges); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aS=aIt.Value(); bRet=myMap.Contains(aS); if (!bRet) { return bRet; } ++aNbE; } bRet=(aNbE==aNbEOther); // return bRet; }