diff --git a/src/BOPAlgo/BOPAlgo_Algo.cdl b/src/BOPAlgo/BOPAlgo_Algo.cdl index 88d57b7c8a..b2cc9b4cbd 100644 --- a/src/BOPAlgo/BOPAlgo_Algo.cdl +++ b/src/BOPAlgo/BOPAlgo_Algo.cdl @@ -49,10 +49,20 @@ is Allocator(me) returns BaseAllocator from BOPCol; ---C++: return const & - + + SetRunParallel(me:out; + theFlag:Boolean from Standard); + ---Purpose: Set the flag of parallel processing + -- if is true the parallel processing is switched on + -- if is false the parallel processing is switched off + -- + RunParallel(me) + returns Boolean from Standard; + ---Purpose: Returns the flag of parallel processing + fields myAllocator : BaseAllocator from BOPCol is protected; myErrorStatus : Integer from Standard is protected; myWarningStatus : Integer from Standard is protected; - + myRunParallel : Boolean from Standard is protected; end Algo; diff --git a/src/BOPAlgo/BOPAlgo_Algo.cxx b/src/BOPAlgo/BOPAlgo_Algo.cxx index b2dcf3a25b..8c87d1e672 100644 --- a/src/BOPAlgo/BOPAlgo_Algo.cxx +++ b/src/BOPAlgo/BOPAlgo_Algo.cxx @@ -23,35 +23,38 @@ // function: // purpose: //======================================================================= - BOPAlgo_Algo::BOPAlgo_Algo() +BOPAlgo_Algo::BOPAlgo_Algo() : myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()), myErrorStatus(1), - myWarningStatus(0) + myWarningStatus(0), + myRunParallel(Standard_False) {} //======================================================================= // function: // purpose: //======================================================================= - BOPAlgo_Algo::BOPAlgo_Algo(const Handle(NCollection_BaseAllocator)& theAllocator) +BOPAlgo_Algo::BOPAlgo_Algo + (const Handle(NCollection_BaseAllocator)& theAllocator) : myAllocator(theAllocator), myErrorStatus(1), - myWarningStatus(0) + myWarningStatus(0), + myRunParallel(Standard_False) {} //======================================================================= // function: ~ // purpose: //======================================================================= - BOPAlgo_Algo::~BOPAlgo_Algo() +BOPAlgo_Algo::~BOPAlgo_Algo() { } //======================================================================= //function : Allocator //purpose : //======================================================================= - const Handle(NCollection_BaseAllocator)& BOPAlgo_Algo::Allocator()const +const Handle(NCollection_BaseAllocator)& BOPAlgo_Algo::Allocator()const { return myAllocator; } @@ -59,7 +62,7 @@ // function: CheckData // purpose: //======================================================================= - void BOPAlgo_Algo::CheckData() +void BOPAlgo_Algo::CheckData() { myErrorStatus=0; } @@ -67,7 +70,7 @@ // function: CheckResult // purpose: //======================================================================= - void BOPAlgo_Algo::CheckResult() +void BOPAlgo_Algo::CheckResult() { myErrorStatus=0; } @@ -75,7 +78,7 @@ // function: ErrorStatus // purpose: //======================================================================= - Standard_Integer BOPAlgo_Algo::ErrorStatus()const +Standard_Integer BOPAlgo_Algo::ErrorStatus()const { return myErrorStatus; } @@ -83,10 +86,26 @@ // function: WarningStatus // purpose: //======================================================================= - Standard_Integer BOPAlgo_Algo::WarningStatus()const +Standard_Integer BOPAlgo_Algo::WarningStatus()const { return myWarningStatus; } +//======================================================================= +//function : SetRunParallel +//purpose : +//======================================================================= +void BOPAlgo_Algo::SetRunParallel(const Standard_Boolean theFlag) +{ + myRunParallel=theFlag; +} +//======================================================================= +//function : RunParallel +//purpose : +//======================================================================= +Standard_Boolean BOPAlgo_Algo::RunParallel()const +{ + return myRunParallel; +} // myErrorStatus // // 1 - object is just initialized diff --git a/src/BOPAlgo/BOPAlgo_Builder.cdl b/src/BOPAlgo/BOPAlgo_Builder.cdl index 9d1cf10f06..03ac6a6891 100644 --- a/src/BOPAlgo/BOPAlgo_Builder.cdl +++ b/src/BOPAlgo/BOPAlgo_Builder.cdl @@ -102,16 +102,6 @@ is ---Purpose: Returns true if the shape theS has been deleted. returns Boolean from Standard is redefined; - - SetRunParallel(me:out; - theFlag:Boolean from Standard); - ---Purpose: Set the flag of parallel processing - -- if is true the parallel processing is switched on - -- if is false the parallel processing is switched off - -- - RunParallel(me) - returns Boolean from Standard; - ---Purpose: Returns the flag of parallel processing -- -- Debug -- @@ -241,8 +231,6 @@ fields -- mySplits : DataMapOfShapeListOfShape from BOPCol is protected; myOrigins : DataMapOfShapeShape from BOPCol is protected; - -- - myRunParallel : Boolean from Standard is protected; - -- + end Builder; diff --git a/src/BOPAlgo/BOPAlgo_Builder.cxx b/src/BOPAlgo/BOPAlgo_Builder.cxx index 21377ff7f2..31137e9168 100644 --- a/src/BOPAlgo/BOPAlgo_Builder.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder.cxx @@ -36,13 +36,11 @@ BOPAlgo_Builder::BOPAlgo_Builder() myMapFence(100, myAllocator), myPaveFiller(NULL), myDS(NULL), - //myContext(NULL), myEntryPoint(0), myImages(100, myAllocator), myShapesSD(100, myAllocator), mySplits(100, myAllocator), - myOrigins(100, myAllocator), - myRunParallel(Standard_False) + myOrigins(100, myAllocator) { } //======================================================================= @@ -57,13 +55,11 @@ BOPAlgo_Builder::BOPAlgo_Builder myMapFence(100, myAllocator), myPaveFiller(NULL), myDS(NULL), - //myContext(NULL), myEntryPoint(0), myImages(100, myAllocator), myShapesSD(100, myAllocator), mySplits(100, myAllocator), - myOrigins(100, myAllocator), - myRunParallel(Standard_False) + myOrigins(100, myAllocator) { } //======================================================================= @@ -93,22 +89,6 @@ void BOPAlgo_Builder::Clear() myOrigins.Clear(); } //======================================================================= -//function : SetRunParallel -//purpose : -//======================================================================= -void BOPAlgo_Builder::SetRunParallel(const Standard_Boolean theFlag) -{ - myRunParallel=theFlag; -} -//======================================================================= -//function : RunParallel -//purpose : -//======================================================================= -Standard_Boolean BOPAlgo_Builder::RunParallel()const -{ - return myRunParallel; -} -//======================================================================= //function : AddArgument //purpose : //======================================================================= diff --git a/src/BOPAlgo/BOPAlgo_BuilderFace.cxx b/src/BOPAlgo/BOPAlgo_BuilderFace.cxx index f2d3b3e9a0..9f753e3d03 100644 --- a/src/BOPAlgo/BOPAlgo_BuilderFace.cxx +++ b/src/BOPAlgo/BOPAlgo_BuilderFace.cxx @@ -1,19 +1,23 @@ // Created by: Peter KURNEV -// Copyright (c) 2010-2014 OPEN CASCADE SAS +// Copyright (c) 2010-2012 OPEN CASCADE SAS // Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, // EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This file is part of Open CASCADE Technology software library. +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. // -// This library is free software; you can redistribute it and / or modify it -// under the terms of the GNU Lesser General Public 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. +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. // -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. #include @@ -70,12 +74,72 @@ static static void MakeInternalWires(const BOPCol_MapOfShape& , BOPCol_ListOfShape& ); - +static + void GetWire(const TopoDS_Shape& , + TopoDS_Shape& ); +// +#include +#include +#include +#include +#include +// +//======================================================================= +//class : BOPAlgo_ShapeBox2D +//purpose : Auxiliary class +//======================================================================= +class BOPAlgo_ShapeBox2D { + public: + BOPAlgo_ShapeBox2D() { + myIsHole=Standard_False; + }; + // + ~BOPAlgo_ShapeBox2D() { + }; + // + void SetShape(const TopoDS_Shape& aS) { + myShape=aS; + }; + // + const TopoDS_Shape& Shape()const { + return myShape; + }; + // + void SetBox2D(const Bnd_Box2d& aBox2D) { + myBox2D=aBox2D; + }; + // + const Bnd_Box2d& Box2D()const { + return myBox2D; + }; + // + void SetIsHole(const Standard_Boolean bFlag) { + myIsHole=bFlag; + }; + // + Standard_Boolean IsHole()const { + return myIsHole; + }; + // + protected: + Standard_Boolean myIsHole; + TopoDS_Shape myShape; + Bnd_Box2d myBox2D; +}; +// +typedef NCollection_DataMap\ + \ + BOPAlgo_DataMapOfIntegerShapeBox2D; +// +typedef BOPAlgo_DataMapOfIntegerShapeBox2D::Iterator \ + BOPAlgo_DataMapIteratorOfDataMapOfIntegerShapeBox2D; +// +// //======================================================================= //function : //purpose : //======================================================================= - BOPAlgo_BuilderFace::BOPAlgo_BuilderFace() +BOPAlgo_BuilderFace::BOPAlgo_BuilderFace() : BOPAlgo_BuilderArea() { @@ -85,7 +149,8 @@ static //function : //purpose : //======================================================================= - BOPAlgo_BuilderFace::BOPAlgo_BuilderFace(const Handle(NCollection_BaseAllocator)& theAllocator) +BOPAlgo_BuilderFace::BOPAlgo_BuilderFace + (const Handle(NCollection_BaseAllocator)& theAllocator) : BOPAlgo_BuilderArea(theAllocator) { @@ -102,7 +167,7 @@ static //function : SetFace //purpose : //======================================================================= - void BOPAlgo_BuilderFace::SetFace(const TopoDS_Face& theFace) +void BOPAlgo_BuilderFace::SetFace(const TopoDS_Face& theFace) { myOrientation=theFace.Orientation(); myFace=theFace; @@ -120,7 +185,7 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const //function : Face //purpose : //======================================================================= - const TopoDS_Face& BOPAlgo_BuilderFace::Face()const +const TopoDS_Face& BOPAlgo_BuilderFace::Face()const { return myFace; } @@ -128,26 +193,23 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const //function : CheckData //purpose : //======================================================================= - void BOPAlgo_BuilderFace::CheckData() +void BOPAlgo_BuilderFace::CheckData() { myErrorStatus=0; // - if (myContext.IsNull()) { - //myErrorStatus=11;// Null Context - //return; - myContext = new BOPInt_Context; - } - // if (myFace.IsNull()) { myErrorStatus=12;// Null face generix return; } + if (myContext.IsNull()) { + myContext = new BOPInt_Context; + } } //======================================================================= //function : Perform //purpose : //======================================================================= - void BOPAlgo_BuilderFace::Perform() +void BOPAlgo_BuilderFace::Perform() { myErrorStatus=0; // @@ -180,7 +242,7 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const //function :PerformShapesToAvoid //purpose : //======================================================================= - void BOPAlgo_BuilderFace::PerformShapesToAvoid() +void BOPAlgo_BuilderFace::PerformShapesToAvoid() { Standard_Boolean bFound; Standard_Integer i, iCnt, aNbV, aNbE; @@ -256,7 +318,7 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const //function : PerformLoops //purpose : //======================================================================= - void BOPAlgo_BuilderFace::PerformLoops() +void BOPAlgo_BuilderFace::PerformLoops() { myErrorStatus=0; // @@ -284,6 +346,7 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const } // aWSp.SetWES(aWES); + aWSp.SetRunParallel(myRunParallel); aWSp.Perform(); iErr=aWSp.ErrorStatus(); if (iErr) { @@ -372,127 +435,173 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const myLoopsInternal.Append(aW); }//for (; aItM.More(); aItM.Next()) { } +// + //======================================================================= //function : PerformAreas //purpose : //======================================================================= - void BOPAlgo_BuilderFace::PerformAreas() +void BOPAlgo_BuilderFace::PerformAreas() { - myErrorStatus=0; - // Standard_Boolean bIsGrowth, bIsHole; + Standard_Integer k,aNbHoles; Standard_Real aTol; - TopoDS_Shape anInfinitePointShape; - // - BOPCol_ListOfShape aNewFaces, aHoleWires; - BOPCol_DataMapOfShapeShape aInOutMap; - BOPCol_DataMapOfShapeListOfShape aMSH; - BOPCol_IndexedMapOfShape aMHE; - - BOPCol_DataMapIteratorOfDataMapOfShapeListOfShape aItMSH; - BOPCol_ListIteratorOfListOfShape aIt1, aIt2; - BRep_Builder aBB; - Handle(Geom_Surface) aS; TopLoc_Location aLoc; + Handle(Geom_Surface) aS; + BRep_Builder aBB; + TopoDS_Face aFace; + // + BOPCol_ListIteratorOfListOfInteger aItLI; + BOPCol_IndexedMapOfShape aMHE; + BOPCol_DataMapOfShapeShape aInOutMap; + BOPCol_DataMapIteratorOfDataMapOfShapeShape aItDMSS; + BOPCol_DataMapOfShapeListOfShape aMSH; + BOPCol_DataMapIteratorOfDataMapOfShapeListOfShape aItMSH; + BOPCol_ListIteratorOfListOfShape aIt1; + BOPAlgo_DataMapOfIntegerShapeBox2D aDMISB(100); + BOPAlgo_DataMapIteratorOfDataMapOfIntegerShapeBox2D aItDMISB; + // + BOPCol_Box2DBndTreeSelector aSelector; + BOPCol_Box2DBndTree aBBTree; + NCollection_UBTreeFiller aTreeFiller(aBBTree); + // + myErrorStatus=0; // aTol=BRep_Tool::Tolerance(myFace); aS=BRep_Tool::Surface(myFace, aLoc); // myAreas.Clear(); // - // Draft faces [aNewFaces] + // 1. Growthes and Holes -> aDMISB: [Index/ShapeBox2D] aIt1.Initialize(myLoops); - for ( ; aIt1.More(); aIt1.Next()) { + for (k=0 ; aIt1.More(); aIt1.Next(), ++k) { + Bnd_Box2d aBox2D; + // const TopoDS_Shape& aWire=aIt1.Value(); // + aBB.MakeFace(aFace, aS, aLoc, aTol); + aBB.Add (aFace, aWire); + BRepTools::AddUVBounds(aFace, aBox2D); + // bIsGrowth=IsGrowthWire(aWire, aMHE); if (bIsGrowth) { - // make a growth face from a wire - TopoDS_Face aFace; - aBB.MakeFace(aFace, aS, aLoc, aTol); - aBB.Add (aFace, aWire); - // - aNewFaces.Append (aFace); + bIsHole=Standard_False; } else{ // check if a wire is a hole - //XX - TopoDS_Face aFace; - aBB.MakeFace(aFace, aS, aLoc, aTol); - aBB.Add (aFace, aWire); - // IntTools_FClass2d& aClsf=myContext->FClass2d(aFace); aClsf.Init(aFace, aTol); // bIsHole=aClsf.IsHole(); - // - //bIsHole=BOPTools_AlgoTools::IsHole(aWire, myFace); - //XX if (bIsHole) { - aHoleWires.Append(aWire); BOPTools::MapShapes(aWire, TopAbs_EDGE, aMHE); + // + bIsHole=Standard_True; } else { - // make a growth face from a wire - TopoDS_Face aFace; - aBB.MakeFace(aFace, aS, aLoc, aTol); - aBB.Add (aFace, aWire); - // - aNewFaces.Append (aFace); + bIsHole=Standard_False; } } + // + BOPAlgo_ShapeBox2D aSB2D; + // + aSB2D.SetShape(aFace); + aSB2D.SetBox2D(aBox2D); + aSB2D.SetIsHole(bIsHole); + // + aDMISB.Bind(k, aSB2D); + } + // + // 2. Prepare TreeFiller + aItDMISB.Initialize(aDMISB); + for (; aItDMISB.More(); aItDMISB.Next()) { + k=aItDMISB.Key(); + const BOPAlgo_ShapeBox2D& aSB2D=aItDMISB.Value(); + // + bIsHole=aSB2D.IsHole(); + if (bIsHole) { + const Bnd_Box2d& aBox2D=aSB2D.Box2D(); + aTreeFiller.Add(k, aBox2D); + } } // - // 2. Find outer growth shell that is most close to each hole shell - aIt2.Initialize(aHoleWires); - for (; aIt2.More(); aIt2.Next()) { - const TopoDS_Shape& aHole = aIt2.Value(); + // 3. Shake TreeFiller + aTreeFiller.Fill(); + // + // 4. Find outer growth shell that is most close + // to each hole shell + aItDMISB.Initialize(aDMISB); + for (; aItDMISB.More(); aItDMISB.Next()) { + k=aItDMISB.Key(); + const BOPAlgo_ShapeBox2D& aSB2D=aItDMISB.Value(); + bIsHole=aSB2D.IsHole(); + if (bIsHole) { + continue; + } // - aIt1.Initialize(aNewFaces); - for ( ; aIt1.More(); aIt1.Next()) { - const TopoDS_Shape& aF=aIt1.Value(); + const Bnd_Box2d& aBox2DF=aSB2D.Box2D(); + const TopoDS_Shape aF=aSB2D.Shape(); + // + aSelector.Clear(); + aSelector.SetBox(aBox2DF); + // + aNbHoles=aBBTree.Select(aSelector); + // + const BOPCol_ListOfInteger& aLI=aSelector.Indices(); + // + aItLI.Initialize(aLI); + for (; aItLI.More(); aItLI.Next()) { + k=aItLI.Value(); + const BOPAlgo_ShapeBox2D& aSB2Dk=aDMISB.Find(k); + const TopoDS_Shape& aHole=aSB2Dk.Shape(); // if (!IsInside(aHole, aF, myContext)){ continue; } // - if ( aInOutMap.IsBound (aHole)){ - const TopoDS_Shape& aF2=aInOutMap(aHole); - if (IsInside(aF, aF2, myContext)) { + if (aInOutMap.IsBound (aHole)){ + const TopoDS_Shape& aF2=aInOutMap(aHole); + if (IsInside(aF, aF2, myContext)) { aInOutMap.UnBind(aHole); aInOutMap.Bind (aHole, aF); } } else{ - aInOutMap.Bind (aHole, aF); + aInOutMap.Bind(aHole, aF); } } - // - // Add aHole to a map Face/ListOfHoles [aMSH] - if (aInOutMap.IsBound(aHole)){ - const TopoDS_Shape& aF=aInOutMap(aHole); - if (aMSH.IsBound(aF)) { - BOPCol_ListOfShape& aLH=aMSH.ChangeFind(aF); - aLH.Append(aHole); - } - else { - BOPCol_ListOfShape aLH; - aLH.Append(aHole); - aMSH.Bind(aF, aLH); - } - } - }// for (; aIt2.More(); aIt2.Next()) + } // - // 3. Add aHoles to Faces + // 5. Map [Face/Holes] -> aMSH + aItDMSS.Initialize(aInOutMap); + for (; aItDMSS.More(); aItDMSS.Next()) { + const TopoDS_Shape& aHole=aItDMSS.Key(); + const TopoDS_Shape& aF=aItDMSS.Value(); + // + if (aMSH.IsBound(aF)) { + BOPCol_ListOfShape& aLH=aMSH.ChangeFind(aF); + aLH.Append(aHole); + } + else { + BOPCol_ListOfShape aLH; + aLH.Append(aHole); + aMSH.Bind(aF, aLH); + } + } + // + // 6. Add aHoles to Faces, aItMSH.Initialize(aMSH); for (; aItMSH.More(); aItMSH.Next()) { TopoDS_Face aF=(*(TopoDS_Face *)(&aItMSH.Key())); // const BOPCol_ListOfShape& aLH=aItMSH.Value(); - aIt2.Initialize(aLH); - for (; aIt2.More(); aIt2.Next()) { - const TopoDS_Shape& aHole = aIt2.Value(); - aBB.Add (aF, aHole); + aIt1.Initialize(aLH); + for (; aIt1.More(); aIt1.Next()) { + TopoDS_Shape aWHole; + // + const TopoDS_Shape& aFHole=aIt1.Value(); + GetWire(aFHole, aWHole); + aBB.Add (aF, aWHole); } // // update classifier @@ -501,20 +610,38 @@ TopAbs_Orientation BOPAlgo_BuilderFace::Orientation()const aClsf.Init(aF, aTol); } // - // These aNewFaces are draft faces that - // do not contain any internal shapes + // 7. Fill myAreas + // NB:These aNewFaces are draft faces that + // do not contain any internal shapes + aItDMISB.Initialize(aDMISB); + for (; aItDMISB.More(); aItDMISB.Next()) { + const BOPAlgo_ShapeBox2D& aSB2D=aItDMISB.Value(); + bIsHole=aSB2D.IsHole(); + if (!bIsHole) { + const TopoDS_Shape aF=aSB2D.Shape(); + myAreas.Append(aF); + } + } +} +//======================================================================= +//function : GetWire +//purpose : +//======================================================================= +void GetWire(const TopoDS_Shape& aF, TopoDS_Shape& aW) +{ + TopoDS_Shape aWx; + TopoDS_Iterator aIt; // - aIt1.Initialize(aNewFaces); - for ( ; aIt1.More(); aIt1.Next()) { - const TopoDS_Shape& aF=aIt1.Value(); - myAreas.Append(aF); + aIt.Initialize(aF); + for (; aIt.More(); aIt.Next()) { + aW=aIt.Value(); } } //======================================================================= //function : PerformInternalShapes //purpose : //======================================================================= - void BOPAlgo_BuilderFace::PerformInternalShapes() +void BOPAlgo_BuilderFace::PerformInternalShapes() { myErrorStatus=0; // diff --git a/src/BOPAlgo/BOPAlgo_Builder_2.cxx b/src/BOPAlgo/BOPAlgo_Builder_2.cxx index 83a93486a4..0fe1da56ca 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_2.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_2.cxx @@ -252,6 +252,7 @@ void BOPAlgo_Builder::BuildSplitFaces() BOPAlgo_BuilderFace& aBF=aVBF.Append1(); aBF.SetFace(aF); aBF.SetShapes(aLE); + aBF.SetRunParallel(myRunParallel); // }// for (i=0; i #include +#include +#include #include #include @@ -38,31 +40,27 @@ #include #include #include +#include // #include #include #include #include +#include +#include +#include +// +#include // #include #include // #include #include -// #include #include // #include - -#include -#include -#include - -#include -#include -#include -#include #include @@ -218,7 +216,7 @@ void BOPAlgo_Builder::FillIn3DParts(BOPCol_DataMapOfShapeListOfShape& theInParts }//for (i=0; i aTreeFiller(aBBTree); // aItDMISB.Initialize(aDMISB); @@ -250,7 +248,7 @@ void BOPAlgo_Builder::FillIn3DParts(BOPCol_DataMapOfShapeListOfShape& theInParts BOPCol_ListOfShape aLIF(aAlr1); BOPCol_IndexedMapOfShape aMF(100, aAlr1); BOPCol_IndexedDataMapOfShapeListOfShape aMEF(100, aAlr1); - BOPDS_BoxBndTreeSelector aSelector; + BOPCol_BoxBndTreeSelector aSelector; Bnd_Box aBoxS; // const TopoDS_Shape& aS=aSI.Shape(); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx index 6af0a7639f..fb439eddd7 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx @@ -23,6 +23,8 @@ #include +#include + #include #include #include @@ -42,6 +44,7 @@ #include #include #include +#include // #include #include @@ -56,16 +59,15 @@ #include #include #include -#include - +// #include -#include + //======================================================================= // function: PerformEE // purpose: //======================================================================= - void BOPAlgo_PaveFiller::PerformEE() +void BOPAlgo_PaveFiller::PerformEE() { Standard_Boolean bJustAdd, bOrder; Standard_Integer i, iX, iSize, nE1, nE2, aDiscretize; @@ -385,9 +387,9 @@ //function : PerformVertices //purpose : //======================================================================= - Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE - (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, - Handle(NCollection_BaseAllocator)& theAllocator) +Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEE + (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB, + Handle(NCollection_BaseAllocator)& theAllocator) { Standard_Integer aNbV, iRet; // @@ -520,9 +522,9 @@ //function : TreatNewVertices //purpose : //======================================================================= - void BOPAlgo_PaveFiller::TreatNewVertices( - const BOPCol_IndexedDataMapOfShapeInteger& aMapVI, - BOPCol_IndexedDataMapOfShapeListOfShape& myImages) +void BOPAlgo_PaveFiller::TreatNewVertices + (const BOPCol_IndexedDataMapOfShapeInteger& aMapVI, + BOPCol_IndexedDataMapOfShapeListOfShape& myImages) { Standard_Integer j, i, aNbV, aNbVSD; Standard_Real aTol; @@ -535,8 +537,8 @@ BOPCol_DataMapOfIntegerShape aMIS; BOPCol_IndexedDataMapOfShapeBox aMSB; // - BOPDS_BoxBndTreeSelector aSelector; - BOPDS_BoxBndTree aBBTree; + BOPCol_BoxBndTreeSelector aSelector; + BOPCol_BoxBndTree aBBTree; NCollection_UBTreeFiller aTreeFiller(aBBTree); // aNbV = aMapVI.Extent(); @@ -658,7 +660,7 @@ //function : FillShrunkData //purpose : //======================================================================= - void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB) +void BOPAlgo_PaveFiller::FillShrunkData(Handle(BOPDS_PaveBlock)& thePB) { Standard_Integer nE, nV1, nV2, iErr; Standard_Real aT1, aT2, aTS1, aTS2; diff --git a/src/BOPAlgo/BOPAlgo_WireSplitter.cdl b/src/BOPAlgo/BOPAlgo_WireSplitter.cdl index 0700020a58..e07656ff10 100644 --- a/src/BOPAlgo/BOPAlgo_WireSplitter.cdl +++ b/src/BOPAlgo/BOPAlgo_WireSplitter.cdl @@ -1,16 +1,20 @@ -- Created by: Peter KURNEV --- Copyright (c) 1999-2014 OPEN CASCADE SAS +-- Copyright (c) 1999-2012 OPEN CASCADE SAS -- --- This file is part of Open CASCADE Technology software library. +-- The content of this file is subject to the Open CASCADE Technology Public +-- License Version 6.5 (the "License"). You may not use the content of this file +-- except in compliance with the License. Please obtain a copy of the License +-- at http://www.opencascade.org and read it completely before using this file. -- --- This library is free software; you can redistribute it and / or modify it --- under the terms of the GNU Lesser General Public 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. +-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -- --- Alternatively, this file may be used under the terms of Open CASCADE --- commercial license or contractual agreement. +-- The Original Code and all software distributed under the License is +-- distributed on an "AS IS" basis, without warranty of any kind, and the +-- Initial Developer hereby disclaims all such warranties, including without +-- limitation, any warranties of merchantability, fitness for a particular +-- purpose or non-infringement. Please see the License for the specific terms +-- and conditions governing the rights and limitations under the License. class WireSplitter from BOPAlgo inherits Algo from BOPAlgo @@ -19,6 +23,7 @@ class WireSplitter from BOPAlgo uses Wire from TopoDS, + Face from TopoDS, BaseAllocator from BOPCol, ListOfShape from BOPCol, WireEdgeSet from BOPAlgo, @@ -60,12 +65,12 @@ is is protected; MakeWires(me:out) - is protected; - - SplitBlock(me:out; - theCB:out ConnexityBlock from BOPTools) - is protected; - + is protected; + + SplitBlock(myclass; + theF :Face from TopoDS; + theCB:out ConnexityBlock from BOPTools); + fields myWES : PWireEdgeSet from BOPAlgo is protected; myLCB : ListOfConnexityBlock from BOPTools is protected; diff --git a/src/BOPAlgo/BOPAlgo_WireSplitter.cxx b/src/BOPAlgo/BOPAlgo_WireSplitter.cxx index 4071d2d987..33e431ec34 100644 --- a/src/BOPAlgo/BOPAlgo_WireSplitter.cxx +++ b/src/BOPAlgo/BOPAlgo_WireSplitter.cxx @@ -1,16 +1,21 @@ // Created by: Peter KURNEV -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 1999-2012 OPEN CASCADE SAS // -// This file is part of Open CASCADE Technology software library. +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. // -// This library is free software; you can redistribute it and / or modify it -// under the terms of the GNU Lesser General Public 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. +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. // -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + #include @@ -27,6 +32,8 @@ #include #include #include +#include +#include #include @@ -35,7 +42,7 @@ //function : //purpose : //======================================================================= - BOPAlgo_WireSplitter::BOPAlgo_WireSplitter() +BOPAlgo_WireSplitter::BOPAlgo_WireSplitter() : BOPAlgo_Algo(), myWES(NULL), @@ -46,7 +53,8 @@ //function : //purpose : //======================================================================= - BOPAlgo_WireSplitter::BOPAlgo_WireSplitter(const Handle(NCollection_BaseAllocator)& theAllocator) +BOPAlgo_WireSplitter::BOPAlgo_WireSplitter + (const Handle(NCollection_BaseAllocator)& theAllocator) : BOPAlgo_Algo(theAllocator), myWES(NULL), @@ -57,14 +65,14 @@ //function : ~ //purpose : //======================================================================= - BOPAlgo_WireSplitter::~BOPAlgo_WireSplitter() +BOPAlgo_WireSplitter::~BOPAlgo_WireSplitter() { } //======================================================================= //function : SetWES //purpose : //======================================================================= - void BOPAlgo_WireSplitter::SetWES(const BOPAlgo_WireEdgeSet& theWES) +void BOPAlgo_WireSplitter::SetWES(const BOPAlgo_WireEdgeSet& theWES) { myWES=(BOPAlgo_WireEdgeSet*)&theWES; } @@ -72,7 +80,7 @@ //function : WES //purpose : //======================================================================= - BOPAlgo_WireEdgeSet& BOPAlgo_WireSplitter::WES() +BOPAlgo_WireEdgeSet& BOPAlgo_WireSplitter::WES() { return *myWES; } @@ -80,7 +88,7 @@ // function: CheckData // purpose: //======================================================================= - void BOPAlgo_WireSplitter::CheckData() +void BOPAlgo_WireSplitter::CheckData() { myErrorStatus=0; if (!myWES) { @@ -92,7 +100,7 @@ //function : Perform //purpose : //======================================================================= - void BOPAlgo_WireSplitter::Perform() +void BOPAlgo_WireSplitter::Perform() { myErrorStatus=0; // @@ -104,43 +112,12 @@ MakeConnexityBlocks(); MakeWires(); } -//======================================================================= -//function : MakeWires -//purpose : -//======================================================================= - void BOPAlgo_WireSplitter::MakeWires() -{ - Standard_Boolean bIsRegular; - TopoDS_Wire aW; - BOPTools_ListIteratorOfListOfConnexityBlock aItCB; - BOPCol_ListIteratorOfListOfShape aIt; - // - aItCB.Initialize(myLCB); - for (; aItCB.More(); aItCB.Next()) { - BOPTools_ConnexityBlock& aCB=aItCB.ChangeValue(); - bIsRegular=aCB.IsRegular(); - if (bIsRegular) { - BOPCol_ListOfShape& aLE=aCB.ChangeShapes(); - BOPAlgo_WireSplitter::MakeWire(aLE, aW); - myWES->AddShape(aW); - } - else { - SplitBlock(aCB); - // - const BOPCol_ListOfShape& aLW=aCB.Loops(); - aIt.Initialize(aLW); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aWx=aIt.Value(); - myWES->AddShape(aWx); - } - } - } -} + //======================================================================= //function : MakeConnexityBlocks //purpose : //======================================================================= - void BOPAlgo_WireSplitter::MakeConnexityBlocks() +void BOPAlgo_WireSplitter::MakeConnexityBlocks() { Standard_Boolean bRegular, bClosed; Standard_Integer i, j, aNbV, aNbVS, aNbVP, k; @@ -280,3 +257,105 @@ myLCB.Append(aCB); } } +///////////////////////////////////////////////////////////////////////// + +typedef BOPCol_NCVector \ + BOPTools_VectorOfConnexityBlock; + +//======================================================================= +//class : WireSplitterFunctor +//purpose : +//======================================================================= +class BOPAlgo_WireSplitterFunctor { + protected: + TopoDS_Face myFace; + BOPTools_VectorOfConnexityBlock* myPVCB; + // + public: + // + BOPAlgo_WireSplitterFunctor(const TopoDS_Face& aF, + BOPTools_VectorOfConnexityBlock& aVCB) + : myFace(aF), myPVCB(&aVCB) { + } + // + void operator()( const flexible_range& aBR ) const{ + Standard_Size i, iBeg, iEnd; + // + BOPTools_VectorOfConnexityBlock& aVCB=*myPVCB; + // + iBeg=aBR.begin(); + iEnd=aBR.end(); + for(i=iBeg; i!=iEnd; ++i) { + BOPTools_ConnexityBlock& aCB=aVCB((Standard_Integer)i); + // + BOPAlgo_WireSplitter::SplitBlock(myFace, aCB); + } + } +}; +//======================================================================= +//class : BOPAlgo_WireSplitterCnt +//purpose : +//======================================================================= +class BOPAlgo_WireSplitterCnt { + public: + //------------------------------- + // Perform + Standard_EXPORT + static void Perform(const Standard_Boolean bRunParallel, + const TopoDS_Face& aF, + BOPTools_VectorOfConnexityBlock& aVCB) { + // + BOPAlgo_WireSplitterFunctor aWSF(aF, aVCB); + Standard_Size aNbVCB=aVCB.Extent(); + // + if (bRunParallel) { + flexible_for(flexible_range(0,aNbVCB), aWSF); + } + else { + aWSF.operator()(flexible_range(0,aNbVCB)); + } + } + // +}; +//======================================================================= +//function : MakeWires +//purpose : +//======================================================================= +void BOPAlgo_WireSplitter::MakeWires() +{ + Standard_Boolean bIsRegular; + Standard_Integer aNbVCB, k; + TopoDS_Wire aW; + BOPTools_ListIteratorOfListOfConnexityBlock aItCB; + BOPCol_ListIteratorOfListOfShape aIt; + BOPTools_VectorOfConnexityBlock aVCB; + // + aItCB.Initialize(myLCB); + for (; aItCB.More(); aItCB.Next()) { + BOPTools_ConnexityBlock& aCB=aItCB.ChangeValue(); + bIsRegular=aCB.IsRegular(); + if (bIsRegular) { + BOPCol_ListOfShape& aLE=aCB.ChangeShapes(); + BOPAlgo_WireSplitter::MakeWire(aLE, aW); + myWES->AddShape(aW); + } + else { + aVCB.Append(aCB); + } + } + // + aNbVCB=aVCB.Extent(); + const TopoDS_Face& aF=myWES->Face(); + //=================================================== + BOPAlgo_WireSplitterCnt::Perform(myRunParallel, aF, aVCB); + //=================================================== + for (k=0; kAddShape(aWx); + } + } +} diff --git a/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx b/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx index 17a3b3a0ea..1e12f7535a 100644 --- a/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx +++ b/src/BOPAlgo/BOPAlgo_WireSplitter_1.cxx @@ -133,7 +133,8 @@ static //function : SplitBlock //purpose : //======================================================================= - void BOPAlgo_WireSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB) +void BOPAlgo_WireSplitter::SplitBlock(const TopoDS_Face& myFace, + BOPTools_ConnexityBlock& aCB) { Standard_Boolean bNothingToDo; Standard_Integer aIx, aNb, i, aCntIn, aCntOut; @@ -144,9 +145,8 @@ static BOPCol_ListIteratorOfListOfShape aIt; BOPAlgo_ListIteratorOfListOfEdgeInfo aItLEI; // - BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo mySmartMap(100, myAllocator); + BOPAlgo_IndexedDataMapOfShapeListOfEdgeInfo mySmartMap(100); // - const TopoDS_Face& myFace=myWES->Face(); const BOPCol_ListOfShape& myEdges=aCB.Shapes(); // // 1.Filling mySmartMap @@ -164,7 +164,7 @@ static const TopoDS_Shape& aV=aItS.Value(); aIx=mySmartMap.FindIndex(aV); if (!aIx) { - BOPAlgo_ListOfEdgeInfo aLEIx(myAllocator); + BOPAlgo_ListOfEdgeInfo aLEIx; aIx=mySmartMap.Add(aV, aLEIx); } // @@ -214,14 +214,14 @@ static Standard_Integer aNbE, aNbMapEE; Standard_Boolean bFlag; // - BOPCol_IndexedDataMapOfShapeListOfShape aMapEE(100, myAllocator); + BOPCol_IndexedDataMapOfShapeListOfShape aMapEE(100); aNbE=myEdges.Extent(); // aIt.Initialize(myEdges); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aE = aIt.Value(); if (!aMapEE.Contains(aE)) { - BOPCol_ListOfShape aLEx(myAllocator); + BOPCol_ListOfShape aLEx; aLEx.Append(aE); aMapEE.Add(aE, aLEx); } @@ -262,7 +262,6 @@ static BOPCol_ListOfShape& aLoops=aCB.ChangeLoops(); aLoops.Append(aW); // - myErrorStatus=0; return; } // diff --git a/src/BOPAlgo/FILES b/src/BOPAlgo/FILES index 7c26eefbe5..7959228b19 100644 --- a/src/BOPAlgo/FILES +++ b/src/BOPAlgo/FILES @@ -14,5 +14,5 @@ BOPAlgo_BOP_1.cxx BOPAlgo_WireSplitter_1.cxx BOPAlgo_ListOfCheckResult.hxx BOPAlgo_Builder_2Cnt.hxx - BOPAlgo_CheckerSI_1.cxx + diff --git a/src/BOPCol/BOPCol_Box2DBndTree.cxx b/src/BOPCol/BOPCol_Box2DBndTree.cxx new file mode 100644 index 0000000000..ac2e4c5ef9 --- /dev/null +++ b/src/BOPCol/BOPCol_Box2DBndTree.cxx @@ -0,0 +1,85 @@ +// Created by: Peter KURNEV +// Copyright (c) 2010-2012 OPEN CASCADE SAS +// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, +// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +#include + +//======================================================================= +//function : +//purpose : +//======================================================================= +BOPCol_Box2DBndTreeSelector::BOPCol_Box2DBndTreeSelector() +{ +} +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +BOPCol_Box2DBndTreeSelector::~BOPCol_Box2DBndTreeSelector() +{ +} +//======================================================================= +//function : Reject +//purpose : +//======================================================================= +Standard_Boolean BOPCol_Box2DBndTreeSelector::Reject + (const Bnd_Box2d& aBox2D) const +{ + return myBox2D.IsOut(aBox2D); +} +//======================================================================= +//function : Accept +//purpose : +//======================================================================= +Standard_Boolean BOPCol_Box2DBndTreeSelector::Accept + (const Standard_Integer& aIndex) +{ + Standard_Boolean bRet=Standard_False; + // + myIndices.Append(aIndex); + bRet=!bRet; + //} + return bRet; +} +//======================================================================= +//function : SetBox +//purpose : +//======================================================================= +void BOPCol_Box2DBndTreeSelector::SetBox(const Bnd_Box2d& aBox2D) +{ + myBox2D=aBox2D; +} +//======================================================================= +//function : Clear +//purpose : +//======================================================================= +void BOPCol_Box2DBndTreeSelector::Clear() +{ + myIndices.Clear(); +} +//======================================================================= +//function : Indices +//purpose : +//======================================================================= +const BOPCol_ListOfInteger& BOPCol_Box2DBndTreeSelector::Indices() const +{ + return myIndices; +} diff --git a/src/BOPCol/BOPCol_Box2DBndTree.hxx b/src/BOPCol/BOPCol_Box2DBndTree.hxx new file mode 100644 index 0000000000..53d2059304 --- /dev/null +++ b/src/BOPCol/BOPCol_Box2DBndTree.hxx @@ -0,0 +1,52 @@ +// Created by: Peter KURNEV +// Copyright (c) 2010-2012 OPEN CASCADE SAS +// Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, +// EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. +// +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. +// +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + + +#ifndef BOPCol_Box2DBndTree_HeaderFile +#define BOPCol_Box2DBndTree_HeaderFile + +#include +#include +#include +/** + * The instantiation of the algorithm of unbalanced binary tree + * of overlapped bounding boxes 2D. + * +*/ +typedef NCollection_UBTree BOPCol_Box2DBndTree; + + class BOPCol_Box2DBndTreeSelector : public BOPCol_Box2DBndTree::Selector { + public: + Standard_EXPORT BOPCol_Box2DBndTreeSelector(); + Standard_EXPORT virtual Standard_Boolean Reject(const Bnd_Box2d&) const; + Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &); + Standard_EXPORT virtual ~BOPCol_Box2DBndTreeSelector(); + + Standard_EXPORT void Clear(); + Standard_EXPORT void SetBox(const Bnd_Box2d&); + Standard_EXPORT const BOPCol_ListOfInteger& Indices() const; + + protected: + Bnd_Box2d myBox2D; + BOPCol_ListOfInteger myIndices; + }; + +#endif diff --git a/src/BOPDS/BOPDS_BoxBndTree.cxx b/src/BOPCol/BOPCol_BoxBndTree.cxx similarity index 81% rename from src/BOPDS/BOPDS_BoxBndTree.cxx rename to src/BOPCol/BOPCol_BoxBndTree.cxx index dd36b9c458..2ae25dd815 100644 --- a/src/BOPDS/BOPDS_BoxBndTree.cxx +++ b/src/BOPCol/BOPCol_BoxBndTree.cxx @@ -15,26 +15,27 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include + //======================================================================= //function : //purpose : //======================================================================= - BOPDS_BoxBndTreeSelector::BOPDS_BoxBndTreeSelector() +BOPCol_BoxBndTreeSelector::BOPCol_BoxBndTreeSelector() { } //======================================================================= //function : ~ //purpose : //======================================================================= - BOPDS_BoxBndTreeSelector::~BOPDS_BoxBndTreeSelector() +BOPCol_BoxBndTreeSelector::~BOPCol_BoxBndTreeSelector() { } //======================================================================= //function : Reject //purpose : //======================================================================= - Standard_Boolean BOPDS_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const + Standard_Boolean BOPCol_BoxBndTreeSelector::Reject (const Bnd_Box& aBox) const { return myBox.IsOut(aBox); } @@ -42,21 +43,19 @@ //function : Accept //purpose : //======================================================================= - Standard_Boolean BOPDS_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex) +Standard_Boolean BOPCol_BoxBndTreeSelector::Accept (const Standard_Integer& aIndex) { Standard_Boolean bRet=Standard_False; // - //if (myFence.Add(aIndex)) { myIndices.Append(aIndex); bRet=!bRet; - //} return bRet; } //======================================================================= //function : SetBox //purpose : //======================================================================= - void BOPDS_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox) +void BOPCol_BoxBndTreeSelector::SetBox(const Bnd_Box& aBox) { myBox=aBox; } @@ -64,16 +63,15 @@ //function : Clear //purpose : //======================================================================= - void BOPDS_BoxBndTreeSelector::Clear() +void BOPCol_BoxBndTreeSelector::Clear() { - //myFence.Clear(); myIndices.Clear(); } //======================================================================= //function : Indices //purpose : //======================================================================= - const BOPCol_ListOfInteger& BOPDS_BoxBndTreeSelector::Indices() const +const BOPCol_ListOfInteger& BOPCol_BoxBndTreeSelector::Indices() const { return myIndices; } diff --git a/src/BOPDS/BOPDS_BoxBndTree.hxx b/src/BOPCol/BOPCol_BoxBndTree.hxx similarity index 85% rename from src/BOPDS/BOPDS_BoxBndTree.hxx rename to src/BOPCol/BOPCol_BoxBndTree.hxx index efc575d7f5..f1065d7911 100644 --- a/src/BOPDS/BOPDS_BoxBndTree.hxx +++ b/src/BOPCol/BOPCol_BoxBndTree.hxx @@ -26,14 +26,14 @@ * of overlapped bounding boxes. * */ -typedef NCollection_UBTree BOPDS_BoxBndTree; +typedef NCollection_UBTree BOPCol_BoxBndTree; - class BOPDS_BoxBndTreeSelector : public BOPDS_BoxBndTree::Selector { + class BOPCol_BoxBndTreeSelector : public BOPCol_BoxBndTree::Selector { public: - Standard_EXPORT BOPDS_BoxBndTreeSelector(); + Standard_EXPORT BOPCol_BoxBndTreeSelector(); Standard_EXPORT virtual Standard_Boolean Reject(const Bnd_Box&) const; Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &); - Standard_EXPORT virtual ~BOPDS_BoxBndTreeSelector(); + Standard_EXPORT virtual ~BOPCol_BoxBndTreeSelector(); Standard_EXPORT void Clear(); Standard_EXPORT void SetBox(const Bnd_Box&); diff --git a/src/BOPCol/BOPCol_DataMapOfIntegerShape.hxx b/src/BOPCol/BOPCol_DataMapOfIntegerShape.hxx index d9c54a4ca2..5b1ca2bc3e 100644 --- a/src/BOPCol/BOPCol_DataMapOfIntegerShape.hxx +++ b/src/BOPCol/BOPCol_DataMapOfIntegerShape.hxx @@ -23,10 +23,11 @@ #endif #include -#include +#include #include + typedef NCollection_DataMap BOPCol_DataMapOfIntegerShape; typedef BOPCol_DataMapOfIntegerShape::Iterator BOPCol_DataMapIteratorOfDataMapOfIntegerShape; diff --git a/src/BOPCol/FILES b/src/BOPCol/FILES index e1d8d8ba58..7245d70a19 100644 --- a/src/BOPCol/FILES +++ b/src/BOPCol/FILES @@ -29,6 +29,10 @@ BOPCol_SequenceOfReal.hxx BOPCol_DataMapOfIntegerShape.hxx BOPCol_IndexedDataMapOfIntegerListOfInteger.hxx BOPCol_IndexedDataMapOfShapeInteger.hxx - BOPCol_TBB.hxx BOPCol_NCVector.hxx + +BOPCol_BoxBndTree.hxx +BOPCol_BoxBndTree.cxx +BOPCol_Box2DBndTree.hxx +BOPCol_Box2DBndTree.cxx diff --git a/src/BOPDS/BOPDS_Iterator.cxx b/src/BOPDS/BOPDS_Iterator.cxx index cf1dea3a20..edfab8374c 100644 --- a/src/BOPDS/BOPDS_Iterator.cxx +++ b/src/BOPDS/BOPDS_Iterator.cxx @@ -31,7 +31,7 @@ #include #include // -#include +#include #include #include #include @@ -218,8 +218,8 @@ void BOPDS_Iterator::Intersect() BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator); BOPDS_PassKeyBoolean aPKXB; // - BOPDS_BoxBndTreeSelector aSelector; - BOPDS_BoxBndTree aBBTree; + BOPCol_BoxBndTreeSelector aSelector; + BOPCol_BoxBndTree aBBTree; NCollection_UBTreeFiller aTreeFiller(aBBTree); // aNb=myDS->NbSourceShapes(); diff --git a/src/BOPDS/BOPDS_IteratorSI.cxx b/src/BOPDS/BOPDS_IteratorSI.cxx index 1b090f8ba3..97e365d9ad 100644 --- a/src/BOPDS/BOPDS_IteratorSI.cxx +++ b/src/BOPDS/BOPDS_IteratorSI.cxx @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include @@ -103,8 +103,8 @@ void BOPDS_IteratorSI::Intersect() BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator); BOPDS_PassKeyBoolean aPKXB; // - BOPDS_BoxBndTreeSelector aSelector; - BOPDS_BoxBndTree aBBTree; + BOPCol_BoxBndTreeSelector aSelector; + BOPCol_BoxBndTree aBBTree; NCollection_UBTreeFiller aTreeFiller(aBBTree); // // myPairsAvoid, aMSI, aMSB diff --git a/src/BOPDS/BOPDS_SubIterator.cxx b/src/BOPDS/BOPDS_SubIterator.cxx index 162c577f36..75c5e8759a 100644 --- a/src/BOPDS/BOPDS_SubIterator.cxx +++ b/src/BOPDS/BOPDS_SubIterator.cxx @@ -27,8 +27,8 @@ #include #include #include +#include // -#include #include #include #include @@ -193,8 +193,8 @@ BOPDS_MapOfPassKeyBoolean aMPKXB(100, aAllocator); BOPCol_IndexedDataMapOfShapeBox aMSB(100, aAllocator); // - BOPDS_BoxBndTreeSelector aSelector; - BOPDS_BoxBndTree aBBTree; + BOPCol_BoxBndTreeSelector aSelector; + BOPCol_BoxBndTree aBBTree; NCollection_UBTreeFiller aTreeFiller(aBBTree); // aIt1.Initialize(*mySubSet1); diff --git a/src/BOPDS/FILES b/src/BOPDS/FILES index 3e262561a5..0af176ffb1 100644 --- a/src/BOPDS/FILES +++ b/src/BOPDS/FILES @@ -1,8 +1,6 @@ BOPDS_VectorOfShapeInfo.hxx BOPDS_VectorOfIndexRange.hxx BOPDS_ListOfPassKeyBoolean.hxx -BOPDS_BoxBndTree.cxx -BOPDS_BoxBndTree.hxx BOPDS_MapOfPassKeyBoolean.hxx BOPDS_MapOfPassKey.hxx BOPDS_ListIteratorOfListOfPassKeyBoolean.hxx @@ -16,6 +14,10 @@ BOPDS_VectorOfInterfVF.hxx BOPDS_VectorOfInterfEE.hxx BOPDS_VectorOfInterfEF.hxx BOPDS_VectorOfInterfFF.hxx +BOPDS_VectorOfInterfVZ.hxx +BOPDS_VectorOfInterfEZ.hxx +BOPDS_VectorOfInterfFZ.hxx +BOPDS_VectorOfInterfZZ.hxx BOPDS_Interf.hxx BOPDS_DataMapOfPaveBlockListOfPaveBlock.hxx BOPDS_MapOfPaveBlock.hxx @@ -35,7 +37,3 @@ BOPDS_IndexedDataMapOfPaveBlockListOfInteger.hxx BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks.hxx BOPDS_DataMapOfPaveBlockCommonBlock.hxx -BOPDS_VectorOfInterfVZ.hxx -BOPDS_VectorOfInterfEZ.hxx -BOPDS_VectorOfInterfFZ.hxx -BOPDS_VectorOfInterfZZ.hxx diff --git a/src/Bnd/Bnd_Box2d.cdl b/src/Bnd/Bnd_Box2d.cdl index fea1a90839..a9f410abb9 100644 --- a/src/Bnd/Bnd_Box2d.cdl +++ b/src/Bnd/Bnd_Box2d.cdl @@ -1,18 +1,24 @@ -- Created on: 1991-01-28 -- Created by: Remi Lequette -- Copyright (c) 1991-1999 Matra Datavision --- Copyright (c) 1999-2014 OPEN CASCADE SAS +-- Copyright (c) 1999-2012 OPEN CASCADE SAS -- --- This file is part of Open CASCADE Technology software library. +-- The content of this file is subject to the Open CASCADE Technology Public +-- License Version 6.5 (the "License"). You may not use the content of this file +-- except in compliance with the License. Please obtain a copy of the License +-- at http://www.opencascade.org and read it completely before using this file. -- --- This library is free software; you can redistribute it and / or modify it --- under the terms of the GNU Lesser General Public 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. +-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. -- --- Alternatively, this file may be used under the terms of Open CASCADE --- commercial license or contractual agreement. +-- The Original Code and all software distributed under the License is +-- distributed on an "AS IS" basis, without warranty of any kind, and the +-- Initial Developer hereby disclaims all such warranties, including without +-- limitation, any warranties of merchantability, fitness for a particular +-- purpose or non-infringement. Please see the License for the specific terms +-- and conditions governing the rights and limitations under the License. + + class Box2d from Bnd @@ -217,8 +223,12 @@ is ---Level: Public ---C++: inline - Dump(me) is static; - + Dump(me) is static; + + SquareExtent(me) + returns Real from Standard; + --- Purpose : Computes the squared diagonal of me. + ---C++: inline fields Xmin : Real; Xmax : Real; diff --git a/src/Bnd/Bnd_Box2d.lxx b/src/Bnd/Bnd_Box2d.lxx index 8c297c7e32..ab410c56cf 100644 --- a/src/Bnd/Bnd_Box2d.lxx +++ b/src/Bnd/Bnd_Box2d.lxx @@ -1,18 +1,23 @@ // Created on: 1997-11-27 // Created by: Christophe MARION // Copyright (c) 1997-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS +// Copyright (c) 1999-2012 OPEN CASCADE SAS // -// This file is part of Open CASCADE Technology software library. +// The content of this file is subject to the Open CASCADE Technology Public +// License Version 6.5 (the "License"). You may not use the content of this file +// except in compliance with the License. Please obtain a copy of the License +// at http://www.opencascade.org and read it completely before using this file. // -// This library is free software; you can redistribute it and / or modify it -// under the terms of the GNU Lesser General Public 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. +// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its +// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. // -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. +// The Original Code and all software distributed under the License is +// distributed on an "AS IS" basis, without warranty of any kind, and the +// Initial Developer hereby disclaims all such warranties, including without +// limitation, any warranties of merchantability, fitness for a particular +// purpose or non-infringement. Please see the License for the specific terms +// and conditions governing the rights and limitations under the License. + #define VoidMask 0x01 #define XminMask 0x02 @@ -231,4 +236,15 @@ inline Standard_Boolean Bnd_Box2d::IsOut (const gp_Trsf2d& T1, { return Transformed(T1).IsOut (Other.Transformed(T2)); } +//======================================================================= +//function : SquareExtent +//purpose : Computes the squared diagonal +//======================================================================= +inline Standard_Real Bnd_Box2d::SquareExtent() const +{ + if ( IsVoid() ) return 0.; + Standard_Real dx = Xmax-Xmin+Gap; + Standard_Real dy = Ymax-Ymin+Gap; + return dx*dx + dy*dy; +}