// Created by: Peter KURNEV
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
-// 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 file is part of Open CASCADE Technology software library.
//
-// 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.
+// 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 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.
-
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
#include <BOPDS_DS.ixx>
//
//function :
//purpose :
//=======================================================================
- BOPDS_DS::BOPDS_DS()
+BOPDS_DS::BOPDS_DS()
:
myAllocator(NCollection_BaseAllocator::CommonBaseAllocator()),
myArguments(myAllocator),
myLines(myAllocator),
myMapShapeIndex(100, myAllocator),
myPaveBlocksPool(myAllocator),
+ myMapPBCB(100, myAllocator),
myFaceInfoPool(myAllocator),
myShapesSD(100, myAllocator),
- myMapPBCB(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(myAllocator),
myInterfVE(myAllocator),
myInterfVF(myAllocator),
myInterfEE(myAllocator),
myInterfEF(myAllocator),
- myInterfFF(myAllocator)
+ myInterfFF(myAllocator),
+ myInterfVZ(myAllocator),
+ myInterfEZ(myAllocator),
+ myInterfFZ(myAllocator),
+ myInterfZZ(myAllocator)
{
myNbShapes=0;
myNbSourceShapes=0;
//function :
//purpose :
//=======================================================================
- BOPDS_DS::BOPDS_DS(const Handle(NCollection_BaseAllocator)& theAllocator)
+BOPDS_DS::BOPDS_DS(const Handle(NCollection_BaseAllocator)& theAllocator)
:
myAllocator(theAllocator),
myArguments(myAllocator),
myLines(myAllocator),
myMapShapeIndex(100, myAllocator),
myPaveBlocksPool(myAllocator),
+ myMapPBCB(100, myAllocator),
myFaceInfoPool(myAllocator),
myShapesSD(100, myAllocator),
- myMapPBCB(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(myAllocator),
myInterfVE(myAllocator),
myInterfVF(myAllocator),
myInterfEE(myAllocator),
myInterfEF(myAllocator),
- myInterfFF(myAllocator)
+ myInterfFF(myAllocator),
+ myInterfVZ(myAllocator),
+ myInterfEZ(myAllocator),
+ myInterfFZ(myAllocator),
+ myInterfZZ(myAllocator)
{
myNbShapes=0;
myNbSourceShapes=0;
//function : ~
//purpose :
//=======================================================================
- BOPDS_DS::~BOPDS_DS()
+BOPDS_DS::~BOPDS_DS()
{
Clear();
}
//function : Clear
//purpose :
//=======================================================================
- void BOPDS_DS::Clear()
+void BOPDS_DS::Clear()
{
myNbShapes=0;
myNbSourceShapes=0;
myInterfEE.Clear();
myInterfEF.Clear();
myInterfFF.Clear();
+ myInterfVZ.Clear();
+ myInterfEZ.Clear();
+ myInterfFZ.Clear();
+ myInterfZZ.Clear();
}
//=======================================================================
//function : SetArguments
//purpose :
//=======================================================================
- void BOPDS_DS::SetArguments(const BOPCol_ListOfShape& theLS)
+void BOPDS_DS::SetArguments(const BOPCol_ListOfShape& theLS)
{
myArguments=theLS;
}
//function : Arguments
//purpose :
//=======================================================================
- const BOPCol_ListOfShape& BOPDS_DS::Arguments()const
+const BOPCol_ListOfShape& BOPDS_DS::Arguments()const
{
return myArguments;
}
//function : Allocator
//purpose :
//=======================================================================
- const Handle(NCollection_BaseAllocator)& BOPDS_DS::Allocator()const
+const Handle(NCollection_BaseAllocator)& BOPDS_DS::Allocator()const
{
return myAllocator;
}
//function : NbShapes
//purpose :
//=======================================================================
- Standard_Integer BOPDS_DS::NbShapes()const
+Standard_Integer BOPDS_DS::NbShapes()const
{
return myLines.Size();
}
//function : NbSourceShapes
//purpose :
//=======================================================================
- Standard_Integer BOPDS_DS::NbSourceShapes()const
+Standard_Integer BOPDS_DS::NbSourceShapes()const
{
return myNbSourceShapes;
}
//function : NbRanges
//purpose :
//=======================================================================
- Standard_Integer BOPDS_DS::NbRanges()const
+Standard_Integer BOPDS_DS::NbRanges()const
{
return myRanges.Size();
}
//function : Range
//purpose :
//=======================================================================
- const BOPDS_IndexRange& BOPDS_DS::Range(const Standard_Integer theI)const
+const BOPDS_IndexRange& BOPDS_DS::Range(const Standard_Integer theI)const
{
return myRanges(theI);
}
//function : Rank
//purpose :
//=======================================================================
- Standard_Integer BOPDS_DS::Rank(const Standard_Integer theI)const
+Standard_Integer BOPDS_DS::Rank(const Standard_Integer theI)const
{
Standard_Integer i, aNb, iErr;
//
//function : IsNewShape
//purpose :
//=======================================================================
- Standard_Boolean BOPDS_DS::IsNewShape(const Standard_Integer theI)const
+Standard_Boolean BOPDS_DS::IsNewShape(const Standard_Integer theI)const
{
return theI>=NbSourceShapes();
}
//function : Append
//purpose :
//=======================================================================
- Standard_Integer BOPDS_DS::Append(const BOPDS_ShapeInfo& theSI)
+Standard_Integer BOPDS_DS::Append(const BOPDS_ShapeInfo& theSI)
{
Standard_Integer iX;
//
//function : Append
//purpose :
//=======================================================================
- Standard_Integer BOPDS_DS::Append(const TopoDS_Shape& theS)
+Standard_Integer BOPDS_DS::Append(const TopoDS_Shape& theS)
{
Standard_Integer iX;
//
//function : ShapeInfo
//purpose :
//=======================================================================
- const BOPDS_ShapeInfo& BOPDS_DS::ShapeInfo(const Standard_Integer theI)const
+const BOPDS_ShapeInfo& BOPDS_DS::ShapeInfo(const Standard_Integer theI)const
{
return myLines(theI);
}
//function : ChangeShapeInfo
//purpose :
//=======================================================================
- BOPDS_ShapeInfo& BOPDS_DS::ChangeShapeInfo(const Standard_Integer theI)
+BOPDS_ShapeInfo& BOPDS_DS::ChangeShapeInfo(const Standard_Integer theI)
{
BOPDS_ShapeInfo *pSI;
//
//function : Shape
//purpose :
//=======================================================================
- const TopoDS_Shape& BOPDS_DS::Shape(const Standard_Integer theI)const
+const TopoDS_Shape& BOPDS_DS::Shape(const Standard_Integer theI)const
{
const TopoDS_Shape& aS=ShapeInfo(theI).Shape();
return aS;
//function : Index
//purpose :
//=======================================================================
- Standard_Integer BOPDS_DS::Index(const TopoDS_Shape& theS)const
+Standard_Integer BOPDS_DS::Index(const TopoDS_Shape& theS)const
{
Standard_Integer iRet;
//
//function : Init
//purpose :
//=======================================================================
- void BOPDS_DS::Init()
+void BOPDS_DS::Init()
{
Standard_Integer i1, i2, j, aI, aNb, aNbS, aNbE, aNbSx, nV, nW, nE, aNbF;
+ Standard_Integer n1, n2, n3;
Standard_Real aTol;
TopAbs_ShapeEnum aTS;
+ TopoDS_Iterator aItS;
BOPCol_ListIteratorOfListOfInteger aIt1, aIt2, aIt3;
BOPCol_ListIteratorOfListOfShape aIt;
BOPDS_IndexRange aR;
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aS=aIt.Value();
+ if (aMSI.IsBound(aS)) {
+ continue;
+ }
aI=Append(aS);
aMSI.Bind(aS, aI);
//
i1=i2+1;
}
//
- //aMSI.Clear();
- //
myNbSourceShapes=NbShapes();
//
// 2 Bounding Boxes
}
}//for (; aIt1.More(); aIt1.Next()) {
//
+ // pure internal vertices on the face
+ aItS.Initialize(aS);
+ for (; aItS.More(); aItS.Next()) {
+ const TopoDS_Shape& aSx=aItS.Value();
+ if (aSx.ShapeType()==TopAbs_VERTEX){
+ nV=Index(aSx);
+ aMI.Add(nV);
+ }
+ }
+ //
//
// For a Face: change wires for BRep sub-shapes
aLW.Clear();
}//if (aTS==TopAbs_FACE) {
}//for (j=0; j<myNbSourceShapes; ++j) {
//
+ // 2.4 Solids
+ for (j=0; j<myNbSourceShapes; ++j) {
+ BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j);
+ //
+ aTS=aSI.ShapeType();
+ if (aTS!=TopAbs_SOLID) {
+ continue;
+ }
+ Bnd_Box& aBox=aSI.ChangeBox();
+ BuildBndBoxSolid(j, aBox);
+ //
+ //
+ // update sub-shapes by BRep comprising ones
+ aMI.Clear();
+ BOPCol_ListOfInteger& aLI1=aSI.ChangeSubShapes();
+ //
+ aIt1.Initialize(aLI1);
+ for (; aIt1.More(); aIt1.Next()) {
+ n1=aIt1.Value();
+ BOPDS_ShapeInfo& aSI1=ChangeShapeInfo(n1);
+ if (aSI1.ShapeType()!=TopAbs_SHELL) {
+ continue;
+ }
+ //
+ const BOPCol_ListOfInteger& aLI2=aSI1.SubShapes();
+ aIt2.Initialize(aLI2);
+ for (; aIt2.More(); aIt2.Next()) {
+ n2=aIt2.Value();
+ BOPDS_ShapeInfo& aSI2=ChangeShapeInfo(n2);
+ if (aSI2.ShapeType()!=TopAbs_FACE) {
+ continue;
+ }
+ //
+ aMI.Add(n2);
+ //
+ const BOPCol_ListOfInteger& aLI3=aSI2.SubShapes();
+ aIt3.Initialize(aLI3);
+ for (; aIt3.More(); aIt3.Next()) {
+ n3=aIt3.Value();
+ aMI.Add(n3);
+ }
+ }
+ }
+ //
+ aLI1.Clear();
+ aItMI.Initialize(aMI);
+ for (; aItMI.More(); aItMI.Next()) {
+ n1=aItMI.Value();
+ aLI1.Append(n1);
+ }
+ aMI.Clear();
+ }//for (j=0; j<myNbSourceShapes; ++j) {
+ //
aMI.Clear();
aAllocator.Nullify();
//-----------------------------------------------------scope_1 t
//function : InitShape
//purpose :
//=======================================================================
- void BOPDS_DS::InitShape(const Standard_Integer aI,
- const TopoDS_Shape& aS,
- Handle(NCollection_BaseAllocator)& theAllocator,
- BOPCol_DataMapOfShapeInteger& aMSI)
+void BOPDS_DS::InitShape(const Standard_Integer aI,
+ const TopoDS_Shape& aS,
+ Handle(NCollection_BaseAllocator)& theAllocator,
+ BOPCol_DataMapOfShapeInteger& aMSI)
{
Standard_Integer aIx;
TopoDS_Iterator aIt;
//function : HasInterf
//purpose :
//=======================================================================
- Standard_Boolean BOPDS_DS::HasInterf(const Standard_Integer theI) const
+Standard_Boolean BOPDS_DS::HasInterf(const Standard_Integer theI) const
{
Standard_Integer n1, n2;
Standard_Boolean bRet;
//
return bRet;
}
-
//=======================================================================
//function : HasInterfShapeSubShapes
//purpose :
//=======================================================================
- Standard_Boolean BOPDS_DS::HasInterfShapeSubShapes(const Standard_Integer theI1,
- const Standard_Integer theI2)const
+Standard_Boolean BOPDS_DS::HasInterfShapeSubShapes
+ (const Standard_Integer theI1,
+ const Standard_Integer theI2,
+ const Standard_Boolean theFlag)const
{
Standard_Boolean bRet;
Standard_Integer n2;
for (; aIt.More(); aIt.Next()) {
n2=aIt.Value();
bRet=HasInterf(theI1, n2);
- if(bRet) {
- break;
+ if (theFlag) {
+ if(bRet) {
+ break;
+ }
+ }
+ else {
+ if(!bRet) {
+ break;
+ }
}
}
return bRet;
}
-
//=======================================================================
//function : HasInterfSubShapes
//purpose :
//=======================================================================
- Standard_Boolean BOPDS_DS::HasInterfSubShapes(const Standard_Integer theI1,
- const Standard_Integer theI2)const
+Standard_Boolean BOPDS_DS::HasInterfSubShapes(const Standard_Integer theI1,
+ const Standard_Integer theI2)const
{
Standard_Boolean bRet;
Standard_Integer n1;
//function : PaveBlocksPool
//purpose :
//=======================================================================
- const BOPDS_VectorOfListOfPaveBlock& BOPDS_DS::PaveBlocksPool()const
+const BOPDS_VectorOfListOfPaveBlock& BOPDS_DS::PaveBlocksPool()const
{
return myPaveBlocksPool;
}
//function : ChangePaveBlocksPool
//purpose :
//=======================================================================
- BOPDS_VectorOfListOfPaveBlock& BOPDS_DS::ChangePaveBlocksPool()
+BOPDS_VectorOfListOfPaveBlock& BOPDS_DS::ChangePaveBlocksPool()
{
return myPaveBlocksPool;
}
//function : HasPaveBlocks
//purpose :
//=======================================================================
- Standard_Boolean BOPDS_DS::HasPaveBlocks(const Standard_Integer theI)const
+Standard_Boolean BOPDS_DS::HasPaveBlocks(const Standard_Integer theI)const
{
return ShapeInfo(theI).HasReference();
}
//function : PaveBlocks
//purpose :
//=======================================================================
- const BOPDS_ListOfPaveBlock& BOPDS_DS::PaveBlocks(const Standard_Integer theI)const
+const BOPDS_ListOfPaveBlock& BOPDS_DS::PaveBlocks(const Standard_Integer theI)const
{
static BOPDS_ListOfPaveBlock sLPB;
Standard_Integer aRef;
//function : ChangePaveBlocks
//purpose :
//=======================================================================
- BOPDS_ListOfPaveBlock& BOPDS_DS::ChangePaveBlocks(const Standard_Integer theI)
+BOPDS_ListOfPaveBlock& BOPDS_DS::ChangePaveBlocks(const Standard_Integer theI)
{
Standard_Boolean bHasReference;
Standard_Integer aRef;
//function : InitPaveBlocks
//purpose :
//=======================================================================
- void BOPDS_DS::InitPaveBlocks(const Standard_Integer theI)
+void BOPDS_DS::InitPaveBlocks(const Standard_Integer theI)
{
- Standard_Integer nV, iRef, aNbV, nVSD, i;
+ Standard_Integer nV = 0, iRef, aNbV, nVSD, i;
Standard_Real aT;
TopoDS_Vertex aV;
BOPCol_ListIteratorOfListOfInteger aIt;
//function : UpdatePaveBlocks
//purpose :
//=======================================================================
- void BOPDS_DS::UpdatePaveBlocks()
+void BOPDS_DS::UpdatePaveBlocks()
{
Standard_Boolean bIsToUpdate;
Standard_Integer i, aNbPBP;
//function : UpdatePaveBlock
//purpose :
//=======================================================================
- void BOPDS_DS::UpdatePaveBlock(const Handle(BOPDS_PaveBlock)& thePB)
+void BOPDS_DS::UpdatePaveBlock(const Handle(BOPDS_PaveBlock)& thePB)
{
if (!thePB->IsToUpdate()){
return;
//function : UpdateCommonBlock
//purpose :
//=======================================================================
- void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB)
+void BOPDS_DS::UpdateCommonBlock(const Handle(BOPDS_CommonBlock)& theCB)
{
Standard_Integer nE, iRef, n1, n2;
BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB, aItPBN;
// function: RealPaveBlock
// purpose:
//=======================================================================
- Handle(BOPDS_PaveBlock) BOPDS_DS::RealPaveBlock
+Handle(BOPDS_PaveBlock) BOPDS_DS::RealPaveBlock
(const Handle(BOPDS_PaveBlock)& thePB) const
{
if (IsCommonBlock(thePB)) {
// function: IsCommonBlockOnEdge
// purpose:
//=======================================================================
- Standard_Boolean BOPDS_DS::IsCommonBlockOnEdge
+Standard_Boolean BOPDS_DS::IsCommonBlockOnEdge
(const Handle(BOPDS_PaveBlock)& thePB) const
{
if (IsCommonBlock(thePB)) {
//function : IsCommonBlock
//purpose :
//=======================================================================
- Standard_Boolean BOPDS_DS::IsCommonBlock
+Standard_Boolean BOPDS_DS::IsCommonBlock
(const Handle(BOPDS_PaveBlock)& thePB) const
{
return myMapPBCB.IsBound(thePB);
//function : CommonBlock
//purpose :
//=======================================================================
- const Handle(BOPDS_CommonBlock)& BOPDS_DS::CommonBlock
+const Handle(BOPDS_CommonBlock)& BOPDS_DS::CommonBlock
(const Handle(BOPDS_PaveBlock)& thePB) const
{
Handle(BOPDS_CommonBlock) aNullCB;
//function : SetCommonBlock
//purpose :
//=======================================================================
- void BOPDS_DS::SetCommonBlock(const Handle(BOPDS_PaveBlock)& thePB,
- const Handle(BOPDS_CommonBlock)& theCB)
+void BOPDS_DS::SetCommonBlock(const Handle(BOPDS_PaveBlock)& thePB,
+ const Handle(BOPDS_CommonBlock)& theCB)
{
if (IsCommonBlock(thePB)) {
Handle(BOPDS_CommonBlock)& aCB = myMapPBCB.ChangeFind(thePB);
//function : FaceInfoPool
//purpose :
//=======================================================================
- const BOPDS_VectorOfFaceInfo& BOPDS_DS::FaceInfoPool()const
+const BOPDS_VectorOfFaceInfo& BOPDS_DS::FaceInfoPool()const
{
return myFaceInfoPool;
}
//function : HasFaceInfo
//purpose :
//=======================================================================
- Standard_Boolean BOPDS_DS::HasFaceInfo(const Standard_Integer theI)const
+Standard_Boolean BOPDS_DS::HasFaceInfo(const Standard_Integer theI)const
{
return ShapeInfo(theI).HasReference();
}
//function : FaceInfo
//purpose :
//=======================================================================
- const BOPDS_FaceInfo& BOPDS_DS::FaceInfo(const Standard_Integer theI)const
+const BOPDS_FaceInfo& BOPDS_DS::FaceInfo(const Standard_Integer theI)const
{
static BOPDS_FaceInfo sFI;
Standard_Integer aRef;
//function : ChangeFaceInfo
//purpose :
//=======================================================================
- BOPDS_FaceInfo& BOPDS_DS::ChangeFaceInfo(const Standard_Integer theI)
+BOPDS_FaceInfo& BOPDS_DS::ChangeFaceInfo(const Standard_Integer theI)
{
Standard_Boolean bHasReference;
Standard_Integer aRef;
//function : InitFaceInfo
//purpose :
//=======================================================================
- void BOPDS_DS::InitFaceInfo(const Standard_Integer theI)
+void BOPDS_DS::InitFaceInfo(const Standard_Integer theI)
{
Standard_Integer iRef;
//
//function : UpdateFaceInfoIn
//purpose :
//=======================================================================
- void BOPDS_DS::UpdateFaceInfoIn(const Standard_Integer theI)
+void BOPDS_DS::UpdateFaceInfoIn(const Standard_Integer theI)
{
Standard_Integer iRef;
//
//function : UpdateFaceInfoOn
//purpose :
//=======================================================================
- void BOPDS_DS::UpdateFaceInfoOn(const Standard_Integer theI)
+void BOPDS_DS::UpdateFaceInfoOn(const Standard_Integer theI)
{
Standard_Integer iRef;
//
//function : FaceInfoOn
//purpose :
//=======================================================================
- void BOPDS_DS::FaceInfoOn(const Standard_Integer theF,
- BOPDS_IndexedMapOfPaveBlock& theMPB,
- BOPCol_MapOfInteger& theMI)
+void BOPDS_DS::FaceInfoOn(const Standard_Integer theF,
+ BOPDS_IndexedMapOfPaveBlock& theMPB,
+ BOPCol_MapOfInteger& theMI)
{
Standard_Integer nS, nSD, nV1, nV2;
BOPCol_ListIteratorOfListOfInteger aIt;
//function : FaceInfoIn
//purpose :
//=======================================================================
- void BOPDS_DS::FaceInfoIn(const Standard_Integer theF,
- BOPDS_IndexedMapOfPaveBlock& theMPB,
- BOPCol_MapOfInteger& theMI)
+void BOPDS_DS::FaceInfoIn(const Standard_Integer theF,
+ BOPDS_IndexedMapOfPaveBlock& theMPB,
+ BOPCol_MapOfInteger& theMI)
{
- Standard_Integer i, aNbVF, aNbEF, nV, nE;
+ Standard_Integer i, aNbVF, aNbEF, nV, nE, nVSD;
+ TopoDS_Iterator aItS;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
//
+ // 1. Pure internal vertices on the face
+ const TopoDS_Shape& aF=Shape(theF);
+ aItS.Initialize(aF);
+ for (; aItS.More(); aItS.Next()) {
+ const TopoDS_Shape& aSx=aItS.Value();
+ if (aSx.ShapeType()==TopAbs_VERTEX){
+ nV=Index(aSx);
+ if (HasShapeSD(nV, nVSD)) {
+ nV=nVSD;
+ }
+ theMI.Add(nV);
+ }
+ }
+ //
+ // 2. aVFs
BOPDS_VectorOfInterfVF& aVFs=InterfVF();
aNbVF=aVFs.Extent();
for (i=0; i<aNbVF; ++i) {
}
}
//
+ // 3. aEFs
BOPDS_VectorOfInterfEF& aEFs=InterfEF();
aNbEF=aEFs.Extent();
for (i=0; i<aNbEF; ++i) {
//function : RefineFaceInfoOn
//purpose :
//=======================================================================
- void BOPDS_DS::RefineFaceInfoOn()
+void BOPDS_DS::RefineFaceInfoOn()
{
Standard_Integer i, aNb, nF, aNbPB, j;
BOPDS_IndexedMapOfPaveBlock aMPB;
//function : AloneVertices
//purpose :
//=======================================================================
- void BOPDS_DS::AloneVertices(const Standard_Integer theI,
- BOPCol_ListOfInteger& theLI)const
+void BOPDS_DS::AloneVertices(const Standard_Integer theI,
+ BOPCol_ListOfInteger& theLI)const
{
if (HasFaceInfo(theI)) {
//
}
}
}
-
//=======================================================================
//function : VerticesOnIn
//purpose :
//=======================================================================
- void BOPDS_DS::VerticesOnIn(const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPCol_MapOfInteger& aMI,
- BOPDS_MapOfPaveBlock& aMPB)const
+void BOPDS_DS::VerticesOnIn(const Standard_Integer nF1,
+ const Standard_Integer nF2,
+ BOPCol_MapOfInteger& aMI,
+ BOPDS_MapOfPaveBlock& aMPB)const
{
- Standard_Integer nV, nV1, nV2;
+ Standard_Integer i, nV, nV1, nV2;
BOPCol_MapIteratorOfMapOfInteger aIt;
+ BOPDS_IndexedMapOfPaveBlock* pMPB[4];
BOPDS_MapIteratorOfMapOfPaveBlock aItMPB;
//
const BOPDS_FaceInfo& aFI1=FaceInfo(nF1);
const BOPDS_FaceInfo& aFI2=FaceInfo(nF2);
//
- const BOPDS_IndexedMapOfPaveBlock& aMPBOn1=aFI1.PaveBlocksOn();
- aItMPB.Initialize(aMPBOn1);
- for (; aItMPB.More(); aItMPB.Next()) {
- const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
- aMPB.Add(aPB);
- aPB->Indices(nV1, nV2);
- aMI.Add(nV1);
- aMI.Add(nV2);
- }
- //
- const BOPDS_IndexedMapOfPaveBlock& aMPBIn1=aFI1.PaveBlocksIn();
- aItMPB.Initialize(aMPBIn1);
- for (; aItMPB.More(); aItMPB.Next()) {
- const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
- aMPB.Add(aPB);
- aPB->Indices(nV1, nV2);
- aMI.Add(nV1);
- aMI.Add(nV2);
- }
- //
- const BOPDS_IndexedMapOfPaveBlock& aMPBOn2=aFI2.PaveBlocksOn();
- aItMPB.Initialize(aMPBOn2);
- for (; aItMPB.More(); aItMPB.Next()) {
- const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
- aMPB.Add(aPB);
- aPB->Indices(nV1, nV2);
- aMI.Add(nV1);
- aMI.Add(nV2);
- }
- //
- const BOPDS_IndexedMapOfPaveBlock& aMPBIn2=aFI2.PaveBlocksIn();
- aItMPB.Initialize(aMPBIn2);
- for (; aItMPB.More(); aItMPB.Next()) {
- const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
- aMPB.Add(aPB);
- aPB->Indices(nV1, nV2);
- aMI.Add(nV1);
- aMI.Add(nV2);
+ pMPB[0]=(BOPDS_IndexedMapOfPaveBlock*)&aFI1.PaveBlocksOn();
+ pMPB[1]=(BOPDS_IndexedMapOfPaveBlock*)&aFI1.PaveBlocksIn();
+ pMPB[2]=(BOPDS_IndexedMapOfPaveBlock*)&aFI2.PaveBlocksOn();
+ pMPB[3]=(BOPDS_IndexedMapOfPaveBlock*)&aFI2.PaveBlocksIn();
+ //
+ for (i=0; i<4; ++i) {
+ aItMPB.Initialize(*pMPB[i]);
+ for (; aItMPB.More(); aItMPB.Next()) {
+ const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
+ aMPB.Add(aPB);
+ aPB->Indices(nV1, nV2);
+ aMI.Add(nV1);
+ aMI.Add(nV2);
+ }
}
//
const BOPCol_MapOfInteger& aMVOn1=aFI1.VerticesOn();
- aIt.Initialize(aMVOn1);
- for (; aIt.More(); aIt.Next()) {
- nV=aIt.Value();
- aMI.Add(nV);
- }
- //
const BOPCol_MapOfInteger& aMVIn1=aFI1.VerticesIn();
- aIt.Initialize(aMVOn1);
- for (; aIt.More(); aIt.Next()) {
- nV=aIt.Value();
- aMI.Add(nV);
- }
- //
const BOPCol_MapOfInteger& aMVOn2=aFI2.VerticesOn();
- aIt.Initialize(aMVOn2);
- for (; aIt.More(); aIt.Next()) {
- nV=aIt.Value();
- aMI.Add(nV);
- }
- //
const BOPCol_MapOfInteger& aMVIn2=aFI2.VerticesIn();
- aIt.Initialize(aMVOn1);
- for (; aIt.More(); aIt.Next()) {
- nV=aIt.Value();
- aMI.Add(nV);
+ //
+ for (i=0; i<2; ++i) {
+ const BOPCol_MapOfInteger& aMV1=(!i) ? aMVOn1 : aMVIn1;
+ aIt.Initialize(aMV1);
+ for (; aIt.More(); aIt.Next()) {
+ nV=aIt.Value();
+ if (aMVOn2.Contains(nV) || aMVIn2.Contains(nV)) {
+ aMI.Add(nV);
+ }
+ }
}
}
//=======================================================================
//function : SharedEdges
//purpose :
//=======================================================================
- void BOPDS_DS::SharedEdges(const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPCol_ListOfInteger& theLI,
- const Handle(NCollection_BaseAllocator)& aAllocator)
+void BOPDS_DS::SharedEdges(const Standard_Integer nF1,
+ const Standard_Integer nF2,
+ BOPCol_ListOfInteger& theLI,
+ const Handle(NCollection_BaseAllocator)& aAllocator)
{
Standard_Integer nE, nSp;
BOPCol_ListIteratorOfListOfInteger aItLI;
//function : ShapesSD
//purpose :
//=======================================================================
- BOPCol_DataMapOfIntegerInteger& BOPDS_DS::ShapesSD()
+BOPCol_DataMapOfIntegerInteger& BOPDS_DS::ShapesSD()
{
return myShapesSD;
}
//function : AddShapeSD
//purpose :
//=======================================================================
- void BOPDS_DS::AddShapeSD(const Standard_Integer theIndex,
+void BOPDS_DS::AddShapeSD(const Standard_Integer theIndex,
const Standard_Integer theIndexSD)
{
myShapesSD.Bind(theIndex, theIndexSD);
//function : HasShapeSD
//purpose :
//=======================================================================
- Standard_Boolean BOPDS_DS::HasShapeSD(const Standard_Integer theIndex,
- Standard_Integer& theIndexSD)const
+Standard_Boolean BOPDS_DS::HasShapeSD(const Standard_Integer theIndex,
+ Standard_Integer& theIndexSD)const
{
Standard_Boolean bRet;
//
//function : Dump
//purpose :
//=======================================================================
- void BOPDS_DS::Dump()const
+void BOPDS_DS::Dump()const
{
Standard_Integer i, aNb, aNbSS;
//
// function: CheckCoincidence
// purpose:
//=======================================================================
- Standard_Boolean BOPDS_DS::CheckCoincidence(const Handle(BOPDS_PaveBlock)& aPB1,
- const Handle(BOPDS_PaveBlock)& aPB2)
+Standard_Boolean BOPDS_DS::CheckCoincidence(const Handle(BOPDS_PaveBlock)& aPB1,
+ const Handle(BOPDS_PaveBlock)& aPB2)
{
Standard_Boolean bRet;
Standard_Integer nE1, nE2, aNbPoints;
// function: SortPaveBlocks
// purpose:
//=======================================================================
- void BOPDS_DS::SortPaveBlocks(const Handle(BOPDS_CommonBlock)& aCB)
+void BOPDS_DS::SortPaveBlocks(const Handle(BOPDS_CommonBlock)& aCB)
{
Standard_Integer theI;
Standard_Boolean bToSort;
// function: IsToSort
// purpose:
//=======================================================================
- Standard_Boolean BOPDS_DS::IsToSort(const Handle(BOPDS_CommonBlock)& aCB,
- Standard_Integer& theI)
+Standard_Boolean BOPDS_DS::IsToSort(const Handle(BOPDS_CommonBlock)& aCB,
+ Standard_Integer& theI)
{
Standard_Boolean bRet;
bRet = Standard_False;
// function: IsSubShape
// purpose:
//=======================================================================
- Standard_Boolean BOPDS_DS::IsSubShape(const Standard_Integer theI1,
- const Standard_Integer theI2)
+Standard_Boolean BOPDS_DS::IsSubShape(const Standard_Integer theI1,
+ const Standard_Integer theI2)
{
Standard_Boolean bRet;
Standard_Integer nS;
// function: Paves
// purpose:
//=======================================================================
- void BOPDS_DS::Paves(const Standard_Integer theEdge,
- BOPDS_ListOfPave& theLP)
+void BOPDS_DS::Paves(const Standard_Integer theEdge,
+ BOPDS_ListOfPave& theLP)
{
Standard_Integer aNb, i;
BOPDS_Pave *pPaves;
// function: UpdateTolerance
// purpose:
//=======================================================================
- void BOPDS_DS::UpdateEdgeTolerance(const Standard_Integer nE,
- const Standard_Real aTol)
+void BOPDS_DS::UpdateEdgeTolerance(const Standard_Integer nE,
+ const Standard_Real aTol)
{
Standard_Integer nV;
Standard_Real aTolV;
}//for (i=0; i<nd; ++i)
}//while (1)
}
+//=======================================================================
+//function : BuildBndBoxSolid
+//purpose :
+//=======================================================================
+void BOPDS_DS::BuildBndBoxSolid(const Standard_Integer theIndex,
+ Bnd_Box& aBoxS)
+{
+ Standard_Boolean bIsOpenBox, bIsInverted;
+ Standard_Integer nSh, nFc;
+ Standard_Real aTolS, aTolFc;
+ BOPCol_ListIteratorOfListOfInteger aItLI, aItLI1;
+ //
+ const BOPDS_ShapeInfo& aSI=ShapeInfo(theIndex);
+ const TopoDS_Shape& aS=aSI.Shape();
+ const TopoDS_Solid& aSolid=(*(TopoDS_Solid*)(&aS));
+ //
+ bIsOpenBox=Standard_False;
+ //
+ aTolS=0.;
+ const BOPCol_ListOfInteger& aLISh=aSI.SubShapes();
+ aItLI.Initialize(aLISh);
+ for (; aItLI.More(); aItLI.Next()) {
+ nSh=aItLI.Value();
+ const BOPDS_ShapeInfo& aSISh=ShapeInfo(nSh);
+ if (aSISh.ShapeType()!=TopAbs_SHELL) {
+ continue;
+ }
+ //
+ const BOPCol_ListOfInteger& aLIFc=aSISh.SubShapes();
+ aItLI1.Initialize(aLIFc);
+ for (; aItLI1.More(); aItLI1.Next()) {
+ nFc=aItLI1.Value();
+ const BOPDS_ShapeInfo& aSIFc=ShapeInfo(nFc);
+ if (aSIFc.ShapeType()!=TopAbs_FACE) {
+ continue;
+ }
+ //
+ const Bnd_Box& aBFc=aSIFc.Box();
+ aBoxS.Add(aBFc);
+ //
+ if (!bIsOpenBox) {
+ bIsOpenBox=(aBFc.IsOpenXmin() || aBFc.IsOpenXmax() ||
+ aBFc.IsOpenYmin() || aBFc.IsOpenYmax() ||
+ aBFc.IsOpenZmin() || aBFc.IsOpenZmax());
+ if (bIsOpenBox) {
+ break;
+ }
+ }
+ //
+ const TopoDS_Face& aFc=*((TopoDS_Face*)&aSIFc.Shape());
+ aTolFc=BRep_Tool::Tolerance(aFc);
+ if (aTolFc>aTolS) {
+ aTolS=aTolFc;
+ }
+ }//for (; aItLI1.More(); aItLI1.Next()) {
+ if (bIsOpenBox) {
+ break;
+ }
+ //
+ const TopoDS_Shell& aSh=*((TopoDS_Shell*)&aSISh.Shape());
+ bIsOpenBox=BOPTools_AlgoTools::IsOpenShell(aSh);
+ if (bIsOpenBox) {
+ break;
+ }
+ }//for (; aItLI.More(); aItLI.Next()) {
+ //
+ if (bIsOpenBox) {
+ aBoxS.SetWhole();
+ }
+ else {
+ bIsInverted=BOPTools_AlgoTools::IsInvertedSolid(aSolid);
+ if (bIsInverted) {
+ aBoxS.SetWhole();
+ }
+ }
+}