1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-30 12:14:08 +03:00
occt/src/BOPTools/BOPTools_ShapeSet.lxx
abv d5f74e42d6 0024624: Lost word in license statement in source files
License statement text corrected; compiler warnings caused by Bison 2.41 disabled for MSVC; a few other compiler warnings on 54-bit Windows eliminated by appropriate type cast
Wrong license statements corrected in several files.
Copyright and license statements added in XSD and GLSL files.
Copyright year updated in some files.
Obsolete documentation files removed from DrawResources.
2014-02-20 16:15:17 +04:00

187 lines
5.9 KiB
Plaintext

// 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 <TopExp_Explorer.hxx>
#include <TopoDS_Edge.hxx>
#include <BRep_Tool.hxx>
//=======================================================================
//function :
//purpose :
//=======================================================================
inline BOPTools_ShapeSet::BOPTools_ShapeSet()
{
}
//=======================================================================
//function :
//purpose :
//=======================================================================
inline BOPTools_ShapeSet::BOPTools_ShapeSet(const Handle(NCollection_BaseAllocator)& theObj)
:
myMap(100, theObj)
{
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
inline BOPTools_ShapeSet::~BOPTools_ShapeSet()
{
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Clear()
{
myMap.Clear();
}
//=======================================================================
//function : SetShape
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::SetShape(const TopoDS_Shape& theShape)
{
myShape=theShape;
}
//=======================================================================
//function : Shape
//purpose :
//=======================================================================
inline const TopoDS_Shape& BOPTools_ShapeSet::Shape()const
{
return myShape;
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Add(const TopoDS_Shape& theShape)
{
myMap.Add(theShape);
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Add(const TopoDS_Shape& theShape,
const TopAbs_ShapeEnum theType)
{
TopExp_Explorer aExp(theShape, theType);
for(; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aS=aExp.Current();
myMap.Add(aS);
}
}
//=======================================================================
//function : Add
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Add(const BOPCol_ListOfShape& theLS)
{
BOPCol_ListIteratorOfListOfShape aIt;
//
aIt.Init(theLS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
myMap.Add(aS);
}
}
//=======================================================================
//function : AddEdge
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::AddEdge(const TopoDS_Edge& theEdge)
{
if (!BRep_Tool::Degenerated(theEdge)){
myMap.Add(theEdge);
}
}
//=======================================================================
//function : AddEdges
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::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_ShapeSet::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_ShapeSet::Get(BOPCol_ListOfShape& theLS)const
{
BOPCol_MapIteratorOfMapOfOrientedShape aIt;
//
aIt.Initialize(myMap);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
theLS.Append(aS);
}
}
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
inline Standard_Boolean BOPTools_ShapeSet::Contains(const BOPTools_ShapeSet& theOther)const
{
Standard_Boolean bRet;
BOPCol_MapIteratorOfMapOfOrientedShape aIt;
//
aIt.Initialize(theOther.myMap);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
bRet=myMap.Contains(aS);
if (!bRet) {
break;
}
}
return bRet;
}
//=======================================================================
//function : Subtract
//purpose :
//=======================================================================
inline void BOPTools_ShapeSet::Subtract(const BOPTools_ShapeSet& theOther)
{
BOPCol_MapIteratorOfMapOfOrientedShape aIt;
//
aIt.Initialize(theOther.myMap);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
if (myMap.Contains(aS)) {
myMap.Remove(aS);
}
}
}