The fix forces creation of new sub-shapes (vertex, edge) when the tolerance of some sub-shape of an argument is to be increased.
This new behavior is turned off by default. It can be turned on using two ways:
1) Setting 'locking' flag of the arguments.
2) Calling the method SetNonDestructive(Standard_True) of the class BOPAlgo_PaveFiller.
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
+#include <BOPCol_IndexedMapOfShape.hxx>
+
+#include <BOPDS_ShapeInfo.hxx>
+#include <BOPDS_DS.hxx>
#include <BOPTools_AlgoTools.hxx>
+
//=======================================================================
//function :
//purpose :
myMapFence(100, myAllocator),
myPaveFiller(NULL),
myDS(NULL),
- //myContext(NULL),
myEntryPoint(0),
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
myMapFence(100, myAllocator),
myPaveFiller(NULL),
myDS(NULL),
- //myContext(NULL),
myEntryPoint(0),
myImages(100, myAllocator),
myShapesSD(100, myAllocator),
PostTreat();
}
-//
-// myErrorStatus
-//
-// 0 - Ok
-//
//=======================================================================
//function : PostTreat
//purpose :
//=======================================================================
void BOPAlgo_Builder::PostTreat()
{
- //BRepLib::SameParameter(myShape, 1.e-7, Standard_True);
- BOPTools_AlgoTools::CorrectTolerances(myShape, 0.05);
- BOPTools_AlgoTools::CorrectShapeTolerances(myShape);
+ Standard_Integer i, aNbS;
+ TopAbs_ShapeEnum aType;
+ BOPCol_IndexedMapOfShape aMA;
+ if (myPaveFiller->NonDestructive()) {
+ // MapToAvoid
+ aNbS=myDS->NbSourceShapes();
+ for (i=0; i<aNbS; ++i) {
+ const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
+ aType=aSI.ShapeType();
+ if (aType==TopAbs_VERTEX ||
+ aType==TopAbs_EDGE||
+ aType==TopAbs_FACE) {
+ const TopoDS_Shape& aS=aSI.Shape();
+ aMA.Add(aS);
+ }
+ }
+ }
+ //
+ BOPTools_AlgoTools::CorrectTolerances(myShape, aMA, 0.05);
+ BOPTools_AlgoTools::CorrectShapeTolerances(myShape, aMA);
}
aLE.Append(aSp);
}
//
- BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane (aLE, aFF);
- //
// 3 Build split faces
BOPAlgo_BuilderFace& aBF=aVBF.Append1();
aBF.SetFace(aF);
Iterator from BOPDS,
PIterator from BOPDS,
PaveBlock from BOPDS,
+ CommonBlock from BOPDS,
Curve from BOPDS,
IndexedDataMapOfShapeCoupleOfPaveBlocks from BOPDS,
MapOfPaveBlock from BOPDS,
---Purpose:
-- Updates pave blocks which have the paves with indices contained
-- in the map <theDMI>.
+
+ UpdateVertex(me:out;
+ nV : Integer from Standard;
+ aTolNew: Real from Standard)
+ returns Integer from Standard
+ is protected;
+ ---Purpose:
+ -- Updates tolerance vertex nV due to V/E interference;
+ -- It always creates new vertex if nV is from arguments
+ -- Returns: DS index of updated vertex.
+
+ ComputeTolerance(me:out;
+ theCB:CommonBlock from BOPDS)
+ returns Real from Standard
+ is protected;
+
+ UpdatePaveBlocksWithSDVertices(me:out)
+ is protected;
+
+ UpdateCommonBlocksWithSDVertices (me:out)
+ is protected;
+
+ UpdateBlocksWithSharedVertices (me:out)
+ is protected;
+
+ EstimatePaveOnCurve (me:out;
+ nV : Integer from Standard;
+ theNC : out Curve from BOPDS;
+ theTolR3D : Real from Standard)
+ returns Boolean from Standard
+ is protected;
+ UpdateEdgeTolerance(me:out;
+ nE : Integer from Standard;
+ aTolNew: Real from Standard)
+ is protected;
+
+ SetNonDestructive(me:out;
+ theFlag:Boolean from Standard)
+ is protected;
+
+ SetNonDestructive(me:out)
+ is protected;
+
+ NonDestructive(me)
+ returns Boolean from Standard;
+
+ SetIsPrimary(me:out;
+ theFlag:Boolean from Standard)
+ is protected;
+
+ IsPrimary(me)
+ returns Boolean from Standard
+ is protected;
+
fields
myArguments : ListOfShape from BOPCol is protected;
myDS : PDS from BOPDS is protected;
myIterator : PIterator from BOPDS is protected;
myContext : Context from BOPInt is protected;
mySectionAttribute : SectionAttribute from BOPAlgo is protected;
-
+ myNonDestructive : Boolean from Standard is protected;
+ myIsPrimary : Boolean from Standard is protected;
end PaveFiller;
//function :
//purpose :
//=======================================================================
- BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
+BOPAlgo_PaveFiller::BOPAlgo_PaveFiller()
:
BOPAlgo_Algo()
{
myDS=NULL;
myIterator=NULL;
+ myNonDestructive=Standard_False;
+ myIsPrimary=Standard_True;
}
//=======================================================================
//function :
//purpose :
//=======================================================================
- BOPAlgo_PaveFiller::BOPAlgo_PaveFiller(const Handle(NCollection_BaseAllocator)& theAllocator)
+BOPAlgo_PaveFiller::BOPAlgo_PaveFiller
+ (const Handle(NCollection_BaseAllocator)& theAllocator)
:
BOPAlgo_Algo(theAllocator)
{
myDS=NULL;
myIterator=NULL;
+ myNonDestructive=Standard_False;
+ myIsPrimary=Standard_True;
}
//=======================================================================
//function : ~
//purpose :
//=======================================================================
- BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller()
+BOPAlgo_PaveFiller::~BOPAlgo_PaveFiller()
{
Clear();
}
//=======================================================================
+//function : SetNonDestructive
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::SetNonDestructive(const Standard_Boolean bFlag)
+{
+ myNonDestructive=bFlag;
+}
+//=======================================================================
+//function : NonDestructive
+//purpose :
+//=======================================================================
+Standard_Boolean BOPAlgo_PaveFiller::NonDestructive()const
+{
+ return myNonDestructive;
+}
+//=======================================================================
+//function : SetIsPrimary
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::SetIsPrimary(const Standard_Boolean bFlag)
+{
+ myIsPrimary=bFlag;
+}
+//=======================================================================
+//function : IsPrimary
+//purpose :
+//=======================================================================
+Standard_Boolean BOPAlgo_PaveFiller::IsPrimary()const
+{
+ return myIsPrimary;
+}
+//=======================================================================
//function : Clear
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::Clear()
+void BOPAlgo_PaveFiller::Clear()
{
if (myIterator) {
delete myIterator;
//function : DS
//purpose :
//=======================================================================
- const BOPDS_DS& BOPAlgo_PaveFiller::DS()
+const BOPDS_DS& BOPAlgo_PaveFiller::DS()
{
return *myDS;
}
//function : PDS
//purpose :
//=======================================================================
- BOPDS_PDS BOPAlgo_PaveFiller::PDS()
+BOPDS_PDS BOPAlgo_PaveFiller::PDS()
{
return myDS;
}
//function : Context
//purpose :
//=======================================================================
- Handle(BOPInt_Context) BOPAlgo_PaveFiller::Context()
+Handle(BOPInt_Context) BOPAlgo_PaveFiller::Context()
{
return myContext;
}
//function : SectionAttribute
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::SetSectionAttribute(const BOPAlgo_SectionAttribute& theSecAttr)
+void BOPAlgo_PaveFiller::SetSectionAttribute
+ (const BOPAlgo_SectionAttribute& theSecAttr)
{
mySectionAttribute = theSecAttr;
}
//function : SetArguments
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS)
+void BOPAlgo_PaveFiller::SetArguments(const BOPCol_ListOfShape& theLS)
{
myArguments=theLS;
}
//function : Arguments
//purpose :
//=======================================================================
- const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
+const BOPCol_ListOfShape& BOPAlgo_PaveFiller::Arguments()const
{
return myArguments;
}
// function: Init
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::Init()
+void BOPAlgo_PaveFiller::Init()
{
myErrorStatus=0;
//
//
// 0 Clear
Clear();
+
//
// 1.myDS
myDS=new BOPDS_DS(myAllocator);
//
// 3 myContext
myContext=new BOPInt_Context;
+ //
+ // 4 NonDestructive flag
+ SetNonDestructive();
//
myErrorStatus=0;
}
// function: Perform
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::Perform()
+void BOPAlgo_PaveFiller::Perform()
{
myErrorStatus=0;
//
return;
}
//
+ UpdatePaveBlocksWithSDVertices();
myDS->UpdatePaveBlocks();
// 11
PerformEE();
if (myErrorStatus) {
return;
}
+ UpdatePaveBlocksWithSDVertices();
// 02
PerformVF();
if (myErrorStatus) {
return;
}
+ UpdatePaveBlocksWithSDVertices();
// 12
-
PerformEF();
if (myErrorStatus) {
return;
}
+ UpdatePaveBlocksWithSDVertices();
//
- MakeSplitEdges();
+ // 22
+ PerformFF();
if (myErrorStatus) {
return;
}
//
- // 22
- PerformFF();
+ UpdateBlocksWithSharedVertices();
+ //
+ MakeSplitEdges();
if (myErrorStatus) {
return;
- }
+ }
+ //
+ UpdatePaveBlocksWithSDVertices();
//
MakeBlocks();
if (myErrorStatus) {
if (myErrorStatus) {
return;
}
- //
}
+
#include <TopoDS_Vertex.hxx>
#include <BRepBndLib.hxx>
+#include <BOPCol_DataMapOfIntegerInteger.hxx>
#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
#include <BOPCol_MapOfInteger.hxx>
#include <BOPCol_ListOfShape.hxx>
#include <BOPDS_DS.hxx>
#include <BOPDS_Iterator.hxx>
-#include <BOPTools_AlgoTools.hxx>
+
#include <BOPDS_VectorOfInterfVV.hxx>
#include <BOPDS_ShapeInfo.hxx>
-#include <BOPAlgo_Tools.hxx>
+#include <BOPTools_AlgoTools.hxx>
+#include <BOPAlgo_Tools.hxx>
//=======================================================================
// function: PerformVV
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::PerformVV()
+void BOPAlgo_PaveFiller::PerformVV()
{
Standard_Boolean bWithSubShape;
- Standard_Integer n1, n2, iFlag, nX, n, aSize, i, aNbVV, j, iX, k, aNbBlocks;
+ Standard_Integer n1, n2, iFlag, nX, n, aSize, i, j, iX, k, aNbBlocks;
Handle(NCollection_IncAllocator) aAllocator;
- BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItMILI;
+ //BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItMILI;
BOPCol_ListIteratorOfListOfInteger aItLI, aItLI2;
TopoDS_Vertex aVn;
BOPDS_ShapeInfo aSIn;
//
BOPTools_AlgoTools::MakeVertex(aLV, aVn);
//
- // Appennd new vertex to the DS
+ // Append new vertex to the DS
aSIn.SetShape(aVn);
n=myDS->Append(aSIn);
//
}
}
}
- aNbVV=aVVs.Extent();
+ //
+ BOPCol_DataMapIteratorOfDataMapOfIntegerInteger aItDMII;
+ //
+ BOPCol_DataMapOfIntegerInteger& aDMII=myDS->ShapesSD();
+ aItDMII.Initialize(aDMII);
+ for (; aItDMII.More(); aItDMII.Next()) {
+ n1=aItDMII.Key();
+ myDS->InitPaveBlocksForVertex(n1);
+ }
//
//-----------------------------------------------------scope t
aLV.Clear();
--- /dev/null
+// Created by: Peter KURNEV
+// Copyright (c) 2010-2014 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.
+//
+// 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.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BOPAlgo_PaveFiller.ixx>
+
+#include <Precision.hxx>
+
+#include <gp_Pnt.hxx>
+#include <Bnd_Box.hxx>
+
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepBndLib.hxx>
+
+#include <BOPDS_ShapeInfo.hxx>
+#include <BOPDS_VectorOfListOfPaveBlock.hxx>
+#include <BOPDS_MapOfCommonBlock.hxx>
+#include <BOPDS_ListOfPaveBlock.hxx>
+#include <BOPDS_CommonBlock.hxx>
+#include <BOPDS_DS.hxx>
+
+//=======================================================================
+//function : SetNonDestructive
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::SetNonDestructive()
+{
+ if (!myIsPrimary) {
+ return;
+ }
+ //
+ Standard_Boolean bFlag;
+ BOPCol_ListIteratorOfListOfShape aItLS;
+ //
+ bFlag=Standard_False;
+ aItLS.Initialize(myArguments);
+ for(; aItLS.More() && (!bFlag); aItLS.Next()) {
+ const TopoDS_Shape& aS=aItLS.Value();
+ bFlag=aS.Locked();
+ }
+ myNonDestructive=bFlag;
+}
+//=======================================================================
+//function : UpdateEdgeTolerance
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateEdgeTolerance (const Standard_Integer nE,
+ const Standard_Real aTol)
+{
+ Standard_Boolean bIsNewShape, bHasShapeSD;
+ Standard_Integer nV, nVx;
+ Standard_Real aTolV;
+ BRep_Builder aBB;
+ BOPCol_ListIteratorOfListOfInteger aIt;
+ //
+ BOPDS_ShapeInfo& aSIE=myDS->ChangeShapeInfo(nE);
+ const BOPCol_ListOfInteger& aLI=aSIE.SubShapes();
+ //
+ if (myNonDestructive) {
+ bIsNewShape=myDS->IsNewShape(nE);
+ if (!bIsNewShape) {
+ return;
+ }
+ //
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ nV = aIt.Value();
+ bHasShapeSD=myDS->HasShapeSD(nV, nVx);
+ if (bHasShapeSD) {
+ continue;
+ }
+ bIsNewShape=myDS->IsNewShape(nV);
+ if (!bIsNewShape) {
+ return;
+ }
+ }
+ }
+ //
+ const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
+ aBB.UpdateEdge(aE, aTol);
+ Bnd_Box& aBoxE=aSIE.ChangeBox();
+ BRepBndLib::Add(aE, aBoxE);
+ //
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ nV = aIt.Value();
+ bHasShapeSD=myDS->HasShapeSD(nV, nVx);
+ if (bHasShapeSD) {
+ nV=nVx;
+ }
+ const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
+ aTolV = BRep_Tool::Tolerance(aV);
+ if (aTolV < aTol) {
+ aBB.UpdateVertex(aV, aTol);
+ BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
+ Bnd_Box& aBoxV = aSIV.ChangeBox();
+ BRepBndLib::Add(aV, aBoxV);
+ }
+ }
+}
+//=======================================================================
+//function : UpdateVertex
+//purpose :
+//=======================================================================
+Standard_Integer BOPAlgo_PaveFiller::UpdateVertex
+ (const Standard_Integer nV,
+ const Standard_Real aTolNew)
+{
+ Standard_Integer nVNew;
+ Standard_Real aTolV;
+ BRep_Builder aBB;
+
+ if (!myNonDestructive) {
+ const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
+ aTolV = BRep_Tool::Tolerance(aV);
+ if (aTolV < aTolNew) {
+ aBB.UpdateVertex(aV, aTolNew);
+ BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nV);
+ Bnd_Box& aBoxV = aSIV.ChangeBox();
+ BRepBndLib::Add(aV, aBoxV);
+ }
+ return nV;
+ }
+ //
+ nVNew = nV;
+ if (myDS->IsNewShape(nVNew) ||
+ myDS->HasShapeSD(nV, nVNew)) {
+ // nV is new vertex
+ const TopoDS_Vertex& aVSD = *(TopoDS_Vertex*)&myDS->Shape(nVNew);
+ aTolV = BRep_Tool::Tolerance(aVSD);
+ if (aTolV < aTolNew) {
+ aBB.UpdateVertex(aVSD, aTolNew);
+ BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVNew);
+ Bnd_Box& aBoxV = aSIV.ChangeBox();
+ BRepBndLib::Add(aVSD, aBoxV);
+ }
+ return nVNew;
+ }
+ //
+ // nV is old vertex
+ const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
+ aTolV = BRep_Tool::Tolerance(aV);
+ //
+ // create new vertex
+ TopoDS_Vertex aVNew;
+ gp_Pnt aPV = BRep_Tool::Pnt(aV);
+ aBB.MakeVertex(aVNew, aPV, Max(aTolV, aTolNew));
+ //
+ // append new vertex to DS
+ BOPDS_ShapeInfo aSIV;
+ aSIV.SetShapeType(TopAbs_VERTEX);
+ aSIV.SetShape(aVNew);
+ nVNew = myDS->Append(aSIV);
+ //
+ // bounding box for the new vertex
+ BOPDS_ShapeInfo& aSIDS = myDS->ChangeShapeInfo(nVNew);
+ Bnd_Box& aBoxDS = aSIDS.ChangeBox();
+ BRepBndLib::Add(aVNew, aBoxDS);
+ //
+ // add vertex to SD map
+ myDS->AddShapeSD(nV, nVNew);
+ //
+ myDS->InitPaveBlocksForVertex(nV);
+ //
+ return nVNew;
+}
+//=======================================================================
+//function : UpdatePaveBlocksWithSDVertices
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdatePaveBlocksWithSDVertices()
+{
+ if (!myNonDestructive) {
+ return;
+ }
+ myDS->UpdatePaveBlocksWithSDVertices();
+}
+//=======================================================================
+//function : UpdateCommonBlocksWithSDVertices
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateCommonBlocksWithSDVertices()
+{
+ if (!myNonDestructive) {
+ return;
+ }
+ Standard_Integer aNbPBP;
+ //
+ BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->ChangePaveBlocksPool();
+ aNbPBP=aPBP.Extent();
+ if(!aNbPBP) {
+ return;
+ }
+ //
+ Standard_Integer i, nV1, nV2;
+ Standard_Real aTolV;
+ BOPDS_MapOfCommonBlock aMCB;
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+ Handle(BOPDS_PaveBlock) aPB;
+ //
+ aTolV = Precision::Confusion();
+ //
+ for (i=0; i<aNbPBP; ++i) {
+ BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
+ aItPB.Initialize(aLPB);
+ for (; aItPB.More(); aItPB.Next()) {
+ aPB=aItPB.Value();
+ const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
+ if (aCB.IsNull()) {
+ continue;
+ }
+ //
+ if (aMCB.Add(aCB)) {
+ myDS->SortPaveBlocks(aCB);
+ aPB->Indices(nV1, nV2);
+ UpdateVertex(nV1, aTolV);
+ UpdateVertex(nV2, aTolV);
+ myDS->UpdateCommonBlockWithSDVertices(aCB);
+ }
+ }
+ }
+ UpdatePaveBlocksWithSDVertices();
+}
// function: PerformVE
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::PerformVE()
+void BOPAlgo_PaveFiller::PerformVE()
{
- Standard_Boolean bJustAdd;
+ Standard_Boolean bJustAdd, bHasShapeSD;
Standard_Integer iSize, nV, nE, nVSD, iFlag, nVx, i;
- Standard_Real aT, aTolE, aTolV;
+ Standard_Real aT, aTolVnew;
BOPDS_Pave aPave;
BOPDS_PassKey aPK;
BOPDS_MapOfPassKey aMPK;
- BRep_Builder aBB;
//
myErrorStatus=0;
//
}
//
nVx=nV;
- if (myDS->HasShapeSD(nV, nVSD)) {
+ bHasShapeSD=myDS->HasShapeSD(nV, nVSD);
+ if (bHasShapeSD) {
nVx=nVSD;
}
//
continue;
}
//
- const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
- const TopoDS_Vertex& aV=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
+ const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape()));
+ const TopoDS_Vertex& aVx=(*(TopoDS_Vertex *)(&myDS->Shape(nVx)));
//
- iFlag=myContext->ComputeVE (aV, aE, aT);
+ iFlag=myContext->ComputeVE (aVx, aE, aT, aTolVnew);
if (!iFlag) {
// 1
i=aVEs.Append()-1;
aVE.SetParameter(aT);
// 2
myDS->AddInterf(nV, nE);
- // 3
+ //
+ //
BOPDS_ListOfPaveBlock& aLPB=myDS->ChangePaveBlocks(nE);
Handle(BOPDS_PaveBlock)& aPB=*((Handle_BOPDS_PaveBlock*)&aLPB.First());
- //
+ //
+ // 3 update vertex V/E if necessary
+ nVx=UpdateVertex(nV, aTolVnew);
+ //4
+ if (myDS->IsNewShape(nVx)) {
+ aVE.SetIndexNew(nVx);
+ }
+ //5 append ext pave to pave block
aPave.SetIndex(nVx);
aPave.SetParameter(aT);
aPB->AppendExtPave(aPave);
- aTolV = BRep_Tool::Tolerance(aV);
- aTolE = BRep_Tool::Tolerance(aE);
- if ( aTolV < aTolE) {
- aBB.UpdateVertex(aV, aTolE);
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nVx);
- Bnd_Box& aBoxDS=aSIDS.ChangeBox();
- BRepBndLib::Add(aV, aBoxDS);
- }
}
}//for (; myIterator->More(); myIterator->Next()) {
-}
+}
#include <BOPDS_BoxBndTree.hxx>
#include <BOPAlgo_Tools.hxx>
-#include <GeomAPI_ProjectPointOnCurve.hxx>
//=======================================================================
// function: PerformEE
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::PerformEE()
+void BOPAlgo_PaveFiller::PerformEE()
{
Standard_Boolean bJustAdd, bOrder;
Standard_Integer i, iX, iSize, nE1, nE2, aDiscretize;
continue;
}
//
- // -----------f
- //DEBft
- //printf(" nE1=%d nE2=%d\n", nE1, nE2);
- //
IntTools_EdgeEdge aEdgeEdge;
//
aEdgeEdge.SetEdge1 (aE1);
aPBn2=aPB1;
}
//
- IntTools_Range aR11(aPBR1.First(), aSR1.First()), aR12(aSR1.Last(), aPBR1.Last()),
- aR21(aPBR2.First(), aSR2.First()), aR22(aSR2.Last(), aPBR2.Last());
+ IntTools_Range aR11(aPBR1.First(), aSR1.First()),
+ aR12(aSR1.Last(), aPBR1.Last()),
+ aR21(aPBR2.First(), aSR2.First()),
+ aR22(aSR2.Last(), aPBR2.Last());
//
const IntTools_SequenceOfCommonPrts& aCPrts=aEdgeEdge.CommonParts();
//
aPBn1->Indices(nV[0], nV[1]);
aPBn2->Indices(nV[2], nV[3]);
//
- if((bIsOnPave[0] && bIsOnPave[2]) || (bIsOnPave[0] && bIsOnPave[3]) ||
- (bIsOnPave[1] && bIsOnPave[2]) || (bIsOnPave[1] && bIsOnPave[3])) {
+ if((bIsOnPave[0] && bIsOnPave[2]) ||
+ (bIsOnPave[0] && bIsOnPave[3]) ||
+ (bIsOnPave[1] && bIsOnPave[2]) ||
+ (bIsOnPave[1] && bIsOnPave[3])) {
continue;
}
//
aAllocator.Nullify();
}
//=======================================================================
-//function : PerformVertices
+//function : PerformVerticesEE
//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;
//
//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;
//
BOPDS_BoxBndTreeSelector aSelector;
BOPDS_BoxBndTree aBBTree;
- NCollection_UBTreeFiller <Standard_Integer, Bnd_Box> aTreeFiller(aBBTree);
+ NCollection_UBTreeFiller <Standard_Integer,
+ Bnd_Box> aTreeFiller(aBBTree);
//
aNbV = aMapVI.Extent();
for (i=1; i<=aNbV; ++i) {
}
}
}
-
//=======================================================================
//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;
Handle(BOPDS_PaveBlock)& aPB,
BOPDS_MapOfPaveBlock& aMPBToUpdate)
{
- Standard_Integer aNbPnt, nE;
- gp_Pnt aP;
+ Standard_Integer nI, nE, nVx, nVSD, iFlag;
+ Standard_Real aT, aTolVNew;
//
nE = aPB->OriginalEdge();
//
return;
}
//
- if (aPB->Pave1().Index() == nV || aPB->Pave2().Index() == nV) {
+ if (aPB->Pave1().Index() == nV ||
+ aPB->Pave2().Index() == nV) {
return;
}
//
- const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
- const TopoDS_Edge& aE = *(TopoDS_Edge*) &myDS->Shape(nE);
- aP=BRep_Tool::Pnt(aV);
+ nVx = nV;
+ if (myDS->HasShapeSD(nV, nVSD)) {
+ nVx = nVSD;
+ }
//
- GeomAPI_ProjectPointOnCurve& aProjector=myContext->ProjPC(aE);
- aProjector.Perform(aP);
+ const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nVx);
+ const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
//
- aNbPnt = aProjector.NbPoints();
- if (aNbPnt) {
- Standard_Real aT, aDist;
- Standard_Integer i;
- BRep_Builder aBB;
+ iFlag = myContext->ComputeVE(aV, aE, aT, aTolVNew);
+ if (iFlag == 0 || iFlag == -4) {
BOPDS_Pave aPave;
//
- aDist=aProjector.LowerDistance();
- aT=aProjector.LowerDistanceParameter();
- //
BOPDS_VectorOfInterfVE& aVEs=myDS->InterfVE();
- i=aVEs.Append()-1;
- BOPDS_InterfVE& aVE=aVEs(i);
+ aVEs.SetIncrement(10);
+ // 1
+ nI=aVEs.Append()-1;
+ BOPDS_InterfVE& aVE=aVEs(nI);
+ //
aVE.SetIndices(nV, nE);
aVE.SetParameter(aT);
- //
+ // 2
myDS->AddInterf(nV, nE);
//
- aBB.UpdateVertex(aV, aDist);
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
- Bnd_Box& aBox=aSIDS.ChangeBox();
- BRepBndLib::Add(aV, aBox);
- //
- aPave.SetIndex(nV);
+ // 3 update vertex V/E if necessary
+ nVx=UpdateVertex(nV, aTolVNew);
+ // 4
+ if (myDS->IsNewShape(nVx)) {
+ aVE.SetIndexNew(nVx);
+ }
+ // 5 append ext pave to pave block
+ aPave.SetIndex(nVx);
aPave.SetParameter(aT);
aPB->AppendExtPave(aPave);
//
aMPBToUpdate.Add(aPB);
}
}
-
- /*
- // DEBf
- {
- TopoDS_Compound aCx;
- BRep_Builder aBBx;
- aBBx.MakeCompound(aCx);
- aItMVCPB.Initialize(theMVCPB);
- for (; aItMVCPB.More(); aItMVCPB.Next()) {
- const TopoDS_Shape& aS=aItMVCPB.Key();
- aBBx.Add(aCx, aS);
- }
- BRepTools::Write(aCx, "cx");
- }
- // DEBt
- */
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx>
#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepBndLib.hxx>
#include <BOPCol_MapOfInteger.hxx>
// function: PerformVF
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::PerformVF()
+void BOPAlgo_PaveFiller::PerformVF()
{
Standard_Boolean bJustAdd;
Standard_Integer iSize, nV, nF, nVSD, iFlag, nVx, i;
- Standard_Real aT1, aT2, aTolF, aTolV;
- BRep_Builder aBB;
+ Standard_Real aT1, aT2, aTolF, aTolV, aTolVnew;
//
myErrorStatus=0;
//
aTolV = BRep_Tool::Tolerance(aV);
aTolF = BRep_Tool::Tolerance(aF);
//
- iFlag=myContext->ComputeVF(aV, aF, aT1, aT2);
- if (!iFlag) {
- // 1
- i=aVFs.Append()-1;
- BOPDS_InterfVF& aVF=aVFs(i);
- aVF.SetIndices(nVx, nF);
- aVF.SetUV(aT1, aT2);
- // 2
- myDS->AddInterf(nVx, nF);
- //
- BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
- BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
- aMVIn.Add(nVx);
- //
- if (aTolV < aTolF) {
- aBB.UpdateVertex(aV, aTolF);
- BOPDS_ShapeInfo& aSIV = myDS->ChangeShapeInfo(nVx);
- Bnd_Box& aBoxV = aSIV.ChangeBox();
- BRepBndLib::Add(aV, aBoxV);
- }
+ iFlag=myContext->ComputeVF(aV, aF, aT1, aT2, aTolVnew);
+ if (iFlag) {
+ continue;
}
+ // 1
+ i=aVFs.Append()-1;
+ BOPDS_InterfVF& aVF=aVFs(i);
+ aVF.SetIndices(nVx, nF);
+ aVF.SetUV(aT1, aT2);
+ // 2
+ myDS->AddInterf(nVx, nF);
+ //
+ // 3 update vertex V/F if necessary
+ nVx=UpdateVertex(nVx, aTolVnew);
+ //
+ // 4
+ if (myDS->IsNewShape(nVx)) {
+ aVF.SetIndexNew(nVx);
+ }
+ // update FaceInfo
+ BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
+ BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
+ aMVIn.Add(nVx);
}// for (; myIterator->More(); myIterator->Next()) {
}// if (iSize) {
else {
//
TreatVerticesEE();
}
-
-
//=======================================================================
//function : TreatVerticesEE
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::TreatVerticesEE()
+void BOPAlgo_PaveFiller::TreatVerticesEE()
{
Standard_Integer i, aNbS, aNbEEs, nF, nV, iFlag;
Standard_Real aT1, aT2;
//
myErrorStatus=0;
//
-
aNbS=myDS->NbSourceShapes();
//
BOPDS_VectorOfInterfEE& aEEs=myDS->InterfEE();
#include <NCollection_IncAllocator.hxx>
+#include <Precision.hxx>
+
#include <Bnd_Box.hxx>
#include <TopoDS_Vertex.hxx>
#include <BRep_Builder.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
-
//=======================================================================
//function : PerformEF
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PerformEF()
+void BOPAlgo_PaveFiller::PerformEF()
{
Standard_Integer iSize;
//
if (bIsOnPave[j]) {
bV[j]=CheckFacePaves(nV[j], aMIFOn, aMIFIn);
if (bV[j]) {
- const TopoDS_Vertex& aV = (*(TopoDS_Vertex *)(&myDS->Shape(nV[j])));
- BOPTools_AlgoTools::UpdateVertex(aE, aT, aV);
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV[j]);
- Bnd_Box& aBoxDS=aSIDS.ChangeBox();
- BRepBndLib::Add(aV, aBoxDS);
+ const TopoDS_Vertex& aV =
+ (*(TopoDS_Vertex *)(&myDS->Shape(nV[j])));
+ //
+ Standard_Real f, l, aTolVnew, aDistPP, aTolPC, aTolV;
+ //
+ const Handle(Geom_Curve)& aCur = BRep_Tool::Curve(aE, f, l);
+ //
+ gp_Pnt aP1 = BRep_Tool::Pnt(aV);
+ gp_Pnt aP2 = aCur->Value(aT);
+ //
+
+ aDistPP=aP1.Distance(aP2);
+
+ aTolPC=Precision::PConfusion();
+ aTolV=BRep_Tool::Tolerance(aV);
+ if (aDistPP > (aTolV+aTolPC)) {
+ aTolVnew=Max(aTolE, aDistPP);
+ UpdateVertex(nV[j], aTolVnew);
+ }
}
else {
bIsOnPave[j] = ForceInterfVF(nV[j], nF);
myDS->AddInterf(nE, nF);
break;
}
- //update tolerance of edge if needed
- if (aTolE < aTolF) {
- myDS->UpdateEdgeTolerance(nE, aTolF);
- aTolE = aTolF;
- }
aEF.SetCommonPart(aCPart);
// 2
myDS->AddInterf(nE, nF);
}
// Refine FaceInfoOn to remove all formal pave blocks
// made during EF processing
- //myDS->RefineFaceInfoOn();
//-----------------------------------------------------scope t
aMIEFC.Clear();
aMVCPB.Clear();
aMPBLI.Clear();
aAllocator.Nullify();
- //
-
}
//=======================================================================
//function : PerformVertices1
//purpose :
//=======================================================================
- Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
- (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
- Handle(NCollection_BaseAllocator)& theAllocator)
+Standard_Integer BOPAlgo_PaveFiller::PerformVerticesEF
+ (BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMVCPB,
+ Handle(NCollection_BaseAllocator)& theAllocator)
{
Standard_Integer aNbV, iRet;
//
}
//
// 2 Fuse vertices
+ aPF.SetIsPrimary(Standard_False);
+ aPF.SetNonDestructive(myNonDestructive);
aPF.SetArguments(aLS);
aPF.Perform();
iErr=aPF.ErrorStatus();
}
}
}
- // 6 Split PaveBlocksa
+ // 6 Split PaveBlocks
for (i=1; i<=aNbPBLI; ++i) {
Handle(BOPDS_PaveBlock) aPB=aMPBLI.FindKey(i);
nE=aPB->OriginalEdge();
// function: CheckFacePaves
// purpose:
//=======================================================================
- Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves (const Standard_Integer nVx,
- const BOPCol_MapOfInteger& aMIFOn,
- const BOPCol_MapOfInteger& aMIFIn)
+Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves
+ (const Standard_Integer nVx,
+ const BOPCol_MapOfInteger& aMIFOn,
+ const BOPCol_MapOfInteger& aMIFIn)
{
Standard_Boolean bRet;
Standard_Integer nV;
// function: CheckFacePaves
// purpose:
//=======================================================================
- Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves (const TopoDS_Vertex& aVnew,
- const BOPCol_MapOfInteger& aMIF)
+Standard_Boolean BOPAlgo_PaveFiller::CheckFacePaves
+ (const TopoDS_Vertex& aVnew,
+ const BOPCol_MapOfInteger& aMIF)
{
Standard_Boolean bRet;
Standard_Integer nV, iFlag;
//function : ForceInterfVF
//purpose :
//=======================================================================
-Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF(const Standard_Integer nV,
- const Standard_Integer nF)
+Standard_Boolean BOPAlgo_PaveFiller::ForceInterfVF
+ (const Standard_Integer nV,
+ const Standard_Integer nF)
{
Standard_Boolean bRet;
+ Standard_Integer iFlag, nI, nVx;
+ Standard_Real U, V, aTolVNew;
//
bRet = Standard_False;
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV);
const TopoDS_Face& aF = *(TopoDS_Face*) &myDS->Shape(nF);
//
- GeomAPI_ProjectPointOnSurf& aProj = myContext->ProjPS(aF);
- const gp_Pnt& aP = BRep_Tool::Pnt(aV);
- aProj.Perform(aP);
- if (!aProj.IsDone()) {
- return bRet;
- }
- Standard_Real aDist, U, V;
- //
- aDist=aProj.LowerDistance();
- aProj.LowerDistanceParameters(U, V);
- //
- gp_Pnt2d aP2d(U, V);
- bRet = myContext->IsPointInFace (aF, aP2d);
- if (bRet) {
- Standard_Integer i;
- BRep_Builder aBB;
+ iFlag = myContext->ComputeVF(aV, aF, U, V, aTolVNew);
+ if (iFlag == 0 || iFlag == -2) {
+ bRet=!bRet;
//
BOPDS_VectorOfInterfVF& aVFs=myDS->InterfVF();
- i=aVFs.Append()-1;
- BOPDS_InterfVF& aVF=aVFs(i);
+ aVFs.SetIncrement(10);
+ // 1
+ nI=aVFs.Append()-1;
+ BOPDS_InterfVF& aVF=aVFs(nI);
+ //
aVF.SetIndices(nV, nF);
aVF.SetUV(U, V);
- //
+ // 2
myDS->AddInterf(nV, nF);
//
- aBB.UpdateVertex(aV, aDist);
- BOPDS_ShapeInfo& aSIDS=myDS->ChangeShapeInfo(nV);
- Bnd_Box& aBoxDS=aSIDS.ChangeBox();
- BRepBndLib::Add(aV, aBoxDS);
+ // 3 update vertex V/F if necessary
+ nVx=UpdateVertex(nV, aTolVNew);
+ // 4
+ if (myDS->IsNewShape(nVx)) {
+ aVF.SetIndexNew(nVx);
+ }
//
BOPDS_FaceInfo& aFI=myDS->ChangeFaceInfo(nF);
BOPCol_MapOfInteger& aMVIn=aFI.ChangeVerticesIn();
- aMVIn.Add(nV);
+ aMVIn.Add(nVx);
}
- //
return bRet;
}
-
const BRepAdaptor_Surface& aBAS2,
Standard_Real& aTolFF);
+
//=======================================================================
//function : PerformFF
//purpose :
const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
//
+ if (aMI.Add(nF1)) {
+ myDS->UpdateFaceInfoOn(nF1);
+ myDS->UpdateFaceInfoIn(nF1);
+ }
+ if (aMI.Add(nF2)) {
+ myDS->UpdateFaceInfoOn(nF2);
+ myDS->UpdateFaceInfoIn(nF2);
+ }
+ //
aBAS1.Initialize(aF1, Standard_False);
aBAS2.Initialize(aF2, Standard_False);
- //
if (aBAS1.GetType() == GeomAbs_Plane &&
aBAS2.GetType() == GeomAbs_Plane) {
Standard_Boolean bToIntersect;
//
- if (aMI.Add(nF1)) {
- myDS->UpdateFaceInfoOn(nF1);
- myDS->UpdateFaceInfoIn(nF1);
- }
- if (aMI.Add(nF2)) {
- myDS->UpdateFaceInfoOn(nF2);
- myDS->UpdateFaceInfoIn(nF2);
- }
- //
bToIntersect = CheckPlanes(nF1, nF2);
if (!bToIntersect) {
myDS->AddInterf(nF1, nF2);
if (aMF.Add(nF2)) {
myDS->UpdateFaceInfoOn(nF2);
}
-
+ //
BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1);
BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2);
//
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
aTolE = BRep_Tool::Tolerance(aE);
if (aTolR3D > aTolE) {
- myDS->UpdateEdgeTolerance(nE, aTolR3D);
+ UpdateEdgeTolerance(nE, aTolR3D);
}
bInBothFaces = Standard_False;
- } else {
+ }
+ else {
bInBothFaces = (aFI1.PaveBlocksOn().Contains(aPBOut) ||
aFI1.PaveBlocksIn().Contains(aPBOut))&&
(aFI2.PaveBlocksOn().Contains(aPBOut) ||
aLPBC.RemoveFirst();
}//for (j=0; j<aNbC; ++j) {
//back to previous tolerance values for unused vertices
- aItMV.Initialize(aMVTol);
- for (; aItMV.More(); aItMV.Next()) {
- nV1 = aItMV.Key();
- aTol = aItMV.Value();
+ {
+ BRep_Builder aBB;
//
- const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV1);
- const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*)&aV.TShape());
- TV->Tolerance(aTol);
+ aItMV.Initialize(aMVTol);
+ for (; aItMV.More(); aItMV.Next()) {
+ nV1 = aItMV.Key();
+ aTol = aItMV.Value();
+ //
+ const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV1);
+ //
+ aBB.UpdateVertex(aV, aTol);
+ }
}
//
ProcessExistingPaveBlocks(i, aMPBOnIn, aMSCPB, aMVI, aMVB, aMPBAdd);
//function : PostTreatFF
//purpose :
//=======================================================================
- Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
+Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB,
BOPCol_DataMapOfShapeInteger& aMVI,
BOPDS_DataMapOfPaveBlockListOfPaveBlock& aDMExEdges,
//
BOPCol_ListOfShape aLS(theAllocator);
BOPAlgo_PaveFiller aPF(theAllocator);
+ aPF.SetIsPrimary(Standard_False);
+ aPF.SetNonDestructive(myNonDestructive);
//
BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
//
//function : UpdateFaceInfo
//purpose :
//=======================================================================
-void BOPAlgo_PaveFiller::UpdateFaceInfo(BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME)
+void BOPAlgo_PaveFiller::UpdateFaceInfo
+ (BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME)
{
Standard_Integer i, j, nV1, nF1, nF2,
aNbFF, aNbC, aNbP, aNbS, aNbPBIn;
//function : IsExistingVertex
//purpose :
//=======================================================================
- Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
- (const gp_Pnt& aP,
- const Standard_Real theTolR3D,
- const BOPCol_MapOfInteger& aMVOnIn)const
+Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex
+ (const gp_Pnt& aP,
+ const Standard_Real theTolR3D,
+ const BOPCol_MapOfInteger& aMVOnIn)const
{
Standard_Boolean bRet;
Standard_Integer nV, iFlag;
//function : IsExistingPaveBlock
//purpose :
//=======================================================================
- Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
- (const Handle(BOPDS_PaveBlock)& thePB,
- const BOPDS_Curve& theNC,
- const Standard_Real theTolR3D,
- const BOPCol_ListOfInteger& theLSE)
+Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
+ (const Handle(BOPDS_PaveBlock)& thePB,
+ const BOPDS_Curve& theNC,
+ const Standard_Real theTolR3D,
+ const BOPCol_ListOfInteger& theLSE)
{
Standard_Boolean bRet=Standard_True;
//
//function : IsExistingPaveBlock
//purpose :
//=======================================================================
- Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
- (const Handle(BOPDS_PaveBlock)& thePB,
- const BOPDS_Curve& theNC,
- const Standard_Real theTolR3D,
- const BOPDS_MapOfPaveBlock& theMPBOnIn,
- Handle(BOPDS_PaveBlock&) aPBOut)
+Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock
+ (const Handle(BOPDS_PaveBlock)& thePB,
+ const BOPDS_Curve& theNC,
+ const Standard_Real theTolR3D,
+ const BOPDS_MapOfPaveBlock& theMPBOnIn,
+ Handle(BOPDS_PaveBlock&) aPBOut)
{
Standard_Boolean bRet;
Standard_Real aT1, aT2, aTm, aTx;
//function : PutBoundPaveOnCurve
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PutBoundPaveOnCurve(const TopoDS_Face& aF1,
- const TopoDS_Face& aF2,
- const Standard_Real aTolR3D,
- BOPDS_Curve& aNC,
- BOPCol_MapOfInteger& aMVOnIn,
- BOPCol_MapOfInteger& aMVB)
+void BOPAlgo_PaveFiller::PutBoundPaveOnCurve
+ (const TopoDS_Face& aF1,
+ const TopoDS_Face& aF2,
+ const Standard_Real aTolR3D,
+ BOPDS_Curve& aNC,
+ BOPCol_MapOfInteger& aMVOnIn,
+ BOPCol_MapOfInteger& aMVB)
{
Standard_Boolean bVF;
Standard_Integer nV, iFlag, nVn, j, aNbEP;
//function : PutPavesOnCurve
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PutPavesOnCurve(const BOPCol_MapOfInteger& aMVOnIn,
- const Standard_Real aTolR3D,
- BOPDS_Curve& aNC,
- const Standard_Integer nF1,
- const Standard_Integer nF2,
- const BOPCol_MapOfInteger& aMI,
- const BOPCol_MapOfInteger& aMVEF,
- BOPCol_DataMapOfIntegerReal& aMVTol)
+void BOPAlgo_PaveFiller::PutPavesOnCurve
+ (const BOPCol_MapOfInteger& aMVOnIn,
+ const Standard_Real aTolR3D,
+ BOPDS_Curve& aNC,
+ const Standard_Integer nF1,
+ const Standard_Integer nF2,
+ const BOPCol_MapOfInteger& aMI,
+ const BOPCol_MapOfInteger& aMVEF,
+ BOPCol_DataMapOfIntegerReal& aMVTol)
{
Standard_Boolean bInBothFaces;
Standard_Integer nV;
//function : ExtendedTolerance
//purpose :
//=======================================================================
-Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance(const Standard_Integer nV,
- const BOPCol_MapOfInteger& aMI,
- Standard_Real& aTolVExt,
- const Standard_Integer aType)
+Standard_Boolean BOPAlgo_PaveFiller::ExtendedTolerance
+ (const Standard_Integer nV,
+ const BOPCol_MapOfInteger& aMI,
+ Standard_Real& aTolVExt,
+ const Standard_Integer aType)
{
Standard_Boolean bFound = Standard_False;
if (!(myDS->IsNewShape(nV))) {
//function : GetEFPnts
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::GetEFPnts(const Standard_Integer nF1,
- const Standard_Integer nF2,
- IntSurf_ListOfPntOn2S& aListOfPnts)
+void BOPAlgo_PaveFiller::GetEFPnts
+ (const Standard_Integer nF1,
+ const Standard_Integer nF2,
+ IntSurf_ListOfPntOn2S& aListOfPnts)
{
Standard_Integer nE, nF, nFOpposite, aNbEFs, i;
Standard_Real U1, U2, V1, V2, f, l;
//function : ProcessUnUsedVertices
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PutEFPavesOnCurve(BOPDS_Curve& aNC,
- const BOPCol_MapOfInteger& aMI,
- const BOPCol_MapOfInteger& aMVEF,
- BOPCol_DataMapOfIntegerReal& aMVTol)
+void BOPAlgo_PaveFiller::PutEFPavesOnCurve
+ (BOPDS_Curve& aNC,
+ const BOPCol_MapOfInteger& aMI,
+ const BOPCol_MapOfInteger& aMVEF,
+ BOPCol_DataMapOfIntegerReal& aMVTol)
{
if (!aMVEF.Extent()) {
return;
//function : ProcessUnUsedVertices
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PutStickPavesOnCurve(const TopoDS_Face& aF1,
- const TopoDS_Face& aF2,
- const BOPCol_MapOfInteger& aMI,
- BOPDS_Curve& aNC,
- const BOPCol_MapOfInteger& aMVStick,
- BOPCol_DataMapOfIntegerReal& aMVTol)
+void BOPAlgo_PaveFiller::PutStickPavesOnCurve
+ (const TopoDS_Face& aF1,
+ const TopoDS_Face& aF2,
+ const BOPCol_MapOfInteger& aMI,
+ BOPDS_Curve& aNC,
+ const BOPCol_MapOfInteger& aMVStick,
+ BOPCol_DataMapOfIntegerReal& aMVTol)
{
BOPCol_MapOfInteger aMV;
aMV.Assign(aMVStick);
//function : GetStickVertices
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPCol_MapOfInteger& aMVStick,
- BOPCol_MapOfInteger& aMVEF,
- BOPCol_MapOfInteger& aMI)
+void BOPAlgo_PaveFiller::GetStickVertices(const Standard_Integer nF1,
+ const Standard_Integer nF2,
+ BOPCol_MapOfInteger& aMVStick,
+ BOPCol_MapOfInteger& aMVEF,
+ BOPCol_MapOfInteger& aMI)
{
Standard_Integer nS1, nS2, nVNew, aTypeInt, i;
//
//function : PutPaveOnCurve
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PutPaveOnCurve(const Standard_Integer nV,
- const Standard_Real aTolR3D,
- BOPDS_Curve& aNC,
- const BOPCol_MapOfInteger& aMI,
- BOPCol_DataMapOfIntegerReal& aMVTol,
- const Standard_Integer iCheckExtend)
+void BOPAlgo_PaveFiller::PutPaveOnCurve(const Standard_Integer nV,
+ const Standard_Real aTolR3D,
+ BOPDS_Curve& aNC,
+ const BOPCol_MapOfInteger& aMI,
+ BOPCol_DataMapOfIntegerReal& aMVTol,
+ const Standard_Integer iCheckExtend)
{
Standard_Boolean bIsVertexOnLine;
Standard_Real aT, aTolV;
//function : ProcessOldPaveBlocks
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
+void BOPAlgo_PaveFiller::ProcessExistingPaveBlocks
(const Standard_Integer theInt,
const BOPDS_MapOfPaveBlock& aMPBOnIn,
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB,
//function : UpdateExistingPaveBlocks
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
- (const Handle(BOPDS_PaveBlock)& aPBf,
- BOPDS_ListOfPaveBlock& aLPB,
- const Standard_Integer nF1,
- const Standard_Integer nF2)
+void BOPAlgo_PaveFiller::UpdateExistingPaveBlocks
+ (const Handle(BOPDS_PaveBlock)& aPBf,
+ BOPDS_ListOfPaveBlock& aLPB,
+ const Standard_Integer nF1,
+ const Standard_Integer nF2)
{
Standard_Integer nE;
Standard_Boolean bCB;
IntTools_Range aShrR(aPB->Pave1().Parameter(), aPB->Pave2().Parameter());
const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(aPB->Edge());
//
- Standard_Boolean bCom = BOPTools_AlgoTools::IsBlockInOnFace(aShrR, aF, aE, myContext);
+ Standard_Boolean bCom =
+ BOPTools_AlgoTools::IsBlockInOnFace(aShrR, aF, aE, myContext);
if (bCom) {
if (bCB) {
aCB = myDS->CommonBlock(aPB);
// function: PutClosingPaveOnCurve
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
+void BOPAlgo_PaveFiller::PutClosingPaveOnCurve(BOPDS_Curve& aNC)
{
Standard_Boolean bIsClosed, bHasBounds, bAdded;
Standard_Integer nVC, j;
//function : PreparePostTreatFF
//purpose :
//=======================================================================
- void BOPAlgo_PaveFiller::PreparePostTreatFF
+void BOPAlgo_PaveFiller::PreparePostTreatFF
(const Standard_Integer aInt,
const Handle(BOPDS_PaveBlock)& aPB,
BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& aMSCPB,
//function : CheckPlanes
//purpose :
//=======================================================================
-Standard_Boolean
- BOPAlgo_PaveFiller::CheckPlanes(const Standard_Integer nF1,
- const Standard_Integer nF2)const
+Standard_Boolean BOPAlgo_PaveFiller::CheckPlanes
+ (const Standard_Integer nF1,
+ const Standard_Integer nF2)const
{
Standard_Boolean bToIntersect;
Standard_Integer i, nV2, iCnt;
//function : UpdatePaveBlocks
//purpose :
//=======================================================================
-void BOPAlgo_PaveFiller::UpdatePaveBlocks(const BOPCol_DataMapOfIntegerInteger& aDMI)
+void BOPAlgo_PaveFiller::UpdatePaveBlocks
+ (const BOPCol_DataMapOfIntegerInteger& aDMI)
{
if (aDMI.IsEmpty()) {
return;
aTolFF = Max(aTolFF, 5.e-6);
}
}
+//=======================================================================
+//function : UpdateBlocksWithSharedVertices
+//purpose :
+//=======================================================================
+void BOPAlgo_PaveFiller::UpdateBlocksWithSharedVertices()
+{
+ if (!myNonDestructive) {
+ return;
+ }
+ //
+ myErrorStatus=0;
+ //
+ Standard_Integer aNbFF;
+ //
+ BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
+ aNbFF=aFFs.Extent();
+ if (!aNbFF) {
+ return;
+ }
+ //
+ Standard_Boolean bOnCurve, bHasShapeSD;
+ Standard_Integer i, nF1, nF2, aNbC, j, nV, nVSD;
+ Standard_Real aTolR3D, aTolV;
+ BOPCol_MapOfInteger aMF;
+ //
+ for (i=0; i<aNbFF; ++i) {
+ BOPDS_InterfFF& aFF=aFFs(i);
+ //
+ BOPDS_VectorOfCurve& aVC=aFF.ChangeCurves();
+ aNbC=aVC.Extent();
+ if (!aNbC) {
+ continue;
+ }
+ //
+ aFF.Indices(nF1, nF2);
+ aTolR3D=aFF.TolR3D();
+ //
+ if (aMF.Add(nF1)) {
+ myDS->UpdateFaceInfoOn(nF1);
+ }
+ if (aMF.Add(nF2)) {
+ myDS->UpdateFaceInfoOn(nF2);
+ }
+ //
+ // Collect old vertices that are shared for nF1, nF2 ->aMI;
+ BOPCol_MapOfInteger aMI;
+ BOPCol_MapIteratorOfMapOfInteger aItMI;
+ //
+ BOPDS_FaceInfo& aFI1=myDS->ChangeFaceInfo(nF1);
+ BOPDS_FaceInfo& aFI2=myDS->ChangeFaceInfo(nF2);
+ //
+ const BOPCol_MapOfInteger& aMVOn1=aFI1.VerticesOn();
+ const BOPCol_MapOfInteger& aMVIn1=aFI1.VerticesIn();
+ const BOPCol_MapOfInteger& aMVOn2=aFI2.VerticesOn();
+ const BOPCol_MapOfInteger& aMVIn2=aFI2.VerticesIn();
+ //
+ for (j=0; j<2; ++j) {
+ const BOPCol_MapOfInteger& aMV1=(!j) ? aMVOn1 : aMVIn1;
+ aItMI.Initialize(aMV1);
+ for (; aItMI.More(); aItMI.Next()) {
+ nV=aItMI.Value();
+ if (myDS->IsNewShape(nV)) {
+ continue;
+ }
+ if (aMVOn2.Contains(nV) || aMVIn2.Contains(nV)) {
+ aMI.Add(nV);
+ }
+ }
+ }
+ //
+ // Try to put vertices aMI on curves
+ for (j=0; j<aNbC; ++j) {
+ BOPDS_Curve& aNC=aVC.ChangeValue(j);
+ //const IntTools_Curve& aIC=aNC.Curve();
+ //
+ aItMI.Initialize(aMI);
+ for (; aItMI.More(); aItMI.Next()) {
+ nV=aItMI.Value();
+ //
+ bHasShapeSD=myDS->HasShapeSD(nV, nVSD);
+ if (bHasShapeSD) {
+ continue;
+ }
+ //
+ bOnCurve=EstimatePaveOnCurve(nV, aNC, aTolR3D);
+ if (!bOnCurve) {
+ continue;
+ }
+ //
+ const TopoDS_Vertex& aV=*((TopoDS_Vertex *)&myDS->Shape(nV));
+ aTolV=BRep_Tool::Tolerance(aV);
+ //
+ UpdateVertex(nV, aTolV);
+ }
+ }//for (j=0; j<aNbC; ++j) {
+ }//for (i=0; i<aNbFF; ++i) {
+ //
+ UpdateCommonBlocksWithSDVertices();
+}
+//=======================================================================
+//function : EstimatePaveOnCurve
+//purpose :
+//=======================================================================
+Standard_Boolean BOPAlgo_PaveFiller::EstimatePaveOnCurve
+ (const Standard_Integer nV,
+ BOPDS_Curve& aNC,
+ const Standard_Real aTolR3D)
+{
+ Standard_Boolean bIsVertexOnLine;
+ Standard_Real aT;
+ //
+ const TopoDS_Vertex& aV=*((TopoDS_Vertex *)&myDS->Shape(nV));
+ const IntTools_Curve& aIC=aNC.Curve();
+ //
+ bIsVertexOnLine=myContext->IsVertexOnLine(aV, aIC, aTolR3D, aT);
+ return bIsVertexOnLine;
+}
#include <BOPDS_FaceInfo.hxx>
#include <BOPDS_MapOfPaveBlock.hxx>
#include <BOPDS_Curve.hxx>
+#include <Precision.hxx>
+#include <BOPDS_MapOfCommonBlock.hxx>
static void UpdateVertices(const TopoDS_Edge& aE,
const TopoDS_Face& aF);
// function: MakeSplitEdges
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::MakeSplitEdges()
+void BOPAlgo_PaveFiller::MakeSplitEdges()
{
Standard_Integer aNbPBP;
//
}
//
Standard_Boolean bCB, bV1, bV2;
- Standard_Integer i, nE, nV1, nV2, nSp, aNbPB, nOrE;
+ Standard_Integer i, nE, nV1, nV2, nSp, aNbPB;
Standard_Real aT1, aT2;
- Handle(NCollection_IncAllocator) aAllocator;
- BOPDS_ListIteratorOfListOfPaveBlock aItPB, aItPBCB;
+
Handle(BOPDS_PaveBlock) aPB, aPBx;
- //-----------------------------------------------------scope f
+ BOPDS_MapOfPaveBlock aMPB;
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB;
//
- aAllocator=new NCollection_IncAllocator();
+ UpdateCommonBlocksWithSDVertices();
//
- BOPDS_MapOfPaveBlock aMPB(100,aAllocator);
+ aNbPBP=aPBP.Extent();
//
for (i=0; i<aNbPBP; ++i) {
BOPDS_ListOfPaveBlock& aLPB=aPBP(i);
//
aNbPB=aLPB.Extent();
- //DEBf
- if (aNbPB) {
- aPBx=aLPB.First();
- nOrE=aPBx->OriginalEdge();
- }
- //DEBt
+ //
if (aNbPB==1) {
aPB=aLPB.First();
aPB->Indices(nV1, nV2);
bV1=myDS->IsNewShape(nV1);
bV2=myDS->IsNewShape(nV2);
+ bCB=myDS->IsCommonBlock(aPB);
//
- if (!(bV1 || bV2)) {
- nE=aPB->OriginalEdge();
- aPB->SetEdge(nE);
- continue;
+ if (!(bV1 || bV2)) { // no new vertices here
+ if (!myNonDestructive || (myNonDestructive && !bCB)) {
+ nE=aPB->OriginalEdge();
+ aPB->SetEdge(nE);
+ continue;
+ }
}
+
}
//
aItPB.Initialize(aLPB);
for (; aItPB.More(); aItPB.Next()) {
aPB=aItPB.Value();
+ nE=aPB->OriginalEdge();
+ const BOPDS_ShapeInfo& aSIE=myDS->ShapeInfo(nE);
+ if (aSIE.HasFlag()){
+ continue;
+ }
+ //
const Handle(BOPDS_CommonBlock)& aCB=myDS->CommonBlock(aPB);
bCB=!aCB.IsNull();
if (bCB) {
myDS->SortPaveBlocks(aCB);
aPB=aCB->PaveBlock1();
+ //
+ aPB->Indices(nV1, nV2);
}
//
if (aMPB.Add(aPB)) {
aPB->Indices(nV1, nV2);
aPB->Range(aT1, aT2);
//
- nSp = SplitEdge(nE, nV1, aT1, nV2, aT2);
- //
+ nSp=SplitEdge(nE, nV1, aT1, nV2, aT2);
+ //
if (bCB) {
+ Standard_Real aTolCB;
+ //
+ aTolCB=ComputeTolerance(aCB);
+ myDS->UpdateEdgeTolerance(nSp, aTolCB);
aCB->SetEdge(nSp);
}
else {
}// if (aMPB.Add(aPB)) {
}// for (; aItPB.More(); aItPB.Next()) {
}// for (i=0; i<aNbPBP; ++i) {
+}
+//=======================================================================
+//function : ComputeTolerance
+//purpose :
+//=======================================================================
+Standard_Real BOPAlgo_PaveFiller::ComputeTolerance
+ (const Handle(BOPDS_CommonBlock)& theCB)
+{
+ Standard_Integer nE, nF;
+ Standard_Real aTol, aTolMax;
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+ BOPCol_ListIteratorOfListOfInteger aItLI;
//
- //-----------------------------------------------------scope t
- aMPB.Clear();
- aAllocator.Nullify();
+ const Handle(BOPDS_PaveBlock)& aPBR = theCB->PaveBlock1();
+ nE = aPBR->OriginalEdge();
+ const TopoDS_Edge& aEOr = *(TopoDS_Edge*)&myDS->Shape(nE);
+ aTolMax = BRep_Tool::Tolerance(aEOr);
+ //
+ const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks();
+ aItPB.Initialize(aLPB);
+ for (; aItPB.More(); aItPB.Next()) {
+ const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+ if (aPB == aPBR) {
+ continue;
+ }
+ //
+ nE = aPB->OriginalEdge();
+ const TopoDS_Edge& aE = *(TopoDS_Edge*)&myDS->Shape(nE);
+ aTol = BRep_Tool::Tolerance(aE);
+ if (aTol > aTolMax) {
+ aTolMax=aTol;
+ }
+ }
+ //
+ const BOPCol_ListOfInteger& aLFI = theCB->Faces();
+ aItLI.Initialize(aLFI);
+ for (; aItLI.More(); aItLI.Next()) {
+ nF = aItLI.Value();
+ const TopoDS_Face& aF = *(TopoDS_Face*)&myDS->Shape(nF);
+ //
+ aTol=BRep_Tool::Tolerance(aF);
+ if (aTol > aTolMax) {
+ aTolMax=aTol;
+ }
+ }
+ return aTolMax;
}
-
//=======================================================================
// function: SplitEdge
// purpose:
// function: MakePCurves
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::MakePCurves()
+void BOPAlgo_PaveFiller::MakePCurves()
{
Standard_Integer i, nF1, nF2, aNbC, k, nE, aNbFF, aNbFI;
BOPDS_ListIteratorOfListOfPaveBlock aItLPB;
// function: RefineFaceInfoOn
// purpose:
//=======================================================================
- void BOPAlgo_PaveFiller::RefineFaceInfoOn()
+void BOPAlgo_PaveFiller::RefineFaceInfoOn()
{
Standard_Integer aNbPBP;
//
//function : SplitBlock
//purpose :
//=======================================================================
- void BOPAlgo_WireSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
+void BOPAlgo_WireSplitter::SplitBlock(BOPTools_ConnexityBlock& aCB)
{
Standard_Boolean bNothingToDo;
Standard_Integer aIx, aNb, i, aCntIn, aCntOut;
const BOPCol_ListOfShape& myEdges=aCB.Shapes();
//
// 1.Filling mySmartMap
- BOPTools_AlgoTools2D::BuildPCurveForEdgesOnPlane(myEdges, myFace);
- //
aIt.Initialize(myEdges);
for(; aIt.More(); aIt.Next()) {
const TopoDS_Edge& aE=(*(TopoDS_Edge *)&aIt.Value());
BOPAlgo_ListOfCheckResult.hxx
BOPAlgo_Builder_2Cnt.hxx
+BOPAlgo_PaveFiller_11.cxx
ListOfInteger from BOPCol,
MapOfInteger from BOPCol,
BaseAllocator from BOPCol,
+ DataMapOfIntegerListOfInteger from BOPCol,
--
ShapeInfo from BOPDS,
IndexRange from BOPDS,
---Purpose:
--- Updates tolerance of the sub-shapes of the shape with index <theIndex>.
---
-
+ UpdatePaveBlocksWithSDVertices(me:out);
+
+ UpdatePaveBlockWithSDVertices(me:out;
+ thePB:PaveBlock from BOPDS);
+
+ UpdateCommonBlockWithSDVertices(me:out;
+ theCB:CommonBlock from BOPDS);
+
+ InitPaveBlocksForVertex(me:out;
+ theNV:Integer from Standard);
+
fields
myAllocator : BaseAllocator from BOPCol is protected;
myArguments : ListOfShape from BOPCol is protected;
--
--same domain shapes
myShapesSD : DataMapOfIntegerInteger from BOPCol is protected;
+ --
+ myMapVE: DataMapOfIntegerListOfInteger from BOPCol is protected;
--
--interferences
myInterfTB : MapOfPassKey from BOPDS is protected;
#include <BOPTools_AlgoTools.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <BOPDS_MapOfPave.hxx>
+#include <BOPCol_MapOfShape.hxx>
+#include <BOPCol_DataMapOfIntegerListOfInteger.hxx>
//
-static
- inline void ResetShape(const TopoDS_Shape& aS);
-
-static
- inline void ResetShapes(const TopoDS_Shape& aS);
static
void TotalShapes(const TopoDS_Shape& aS,
- Standard_Integer& aNbS);
+ Standard_Integer& aNbS,
+ BOPCol_MapOfShape& aMS);
static
Standard_Real ComputeParameter(const TopoDS_Vertex& aV,
myMapPBCB(100, myAllocator),
myFaceInfoPool(myAllocator),
myShapesSD(100, myAllocator),
+ myMapVE(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(myAllocator),
myInterfVE(myAllocator),
myMapPBCB(100, myAllocator),
myFaceInfoPool(myAllocator),
myShapesSD(100, myAllocator),
+ myMapVE(100, myAllocator),
myInterfTB(100, myAllocator),
myInterfVV(myAllocator),
myInterfVE(myAllocator),
myPaveBlocksPool.Clear();
myFaceInfoPool.Clear();
myShapesSD.Clear();
+ myMapVE.Clear();
myMapPBCB.Clear();
myInterfTB.Clear();
myInterfVV.Clear();
myInterfEE.Clear();
myInterfEF.Clear();
myInterfFF.Clear();
+
}
//=======================================================================
//function : SetArguments
}
return iRet;
}
-
//=======================================================================
//function : Init
//purpose :
{
Standard_Integer i1, i2, j, aI, aNb, aNbS, aNbE, aNbSx, nV, nW, nE, aNbF;
Standard_Real aTol;
+ Handle(NCollection_IncAllocator) aAllocator;
TopAbs_ShapeEnum aTS;
+ BOPDS_IndexRange aR;
BOPCol_ListIteratorOfListOfInteger aIt1, aIt2, aIt3;
BOPCol_ListIteratorOfListOfShape aIt;
- BOPDS_IndexRange aR;
- Handle(NCollection_IncAllocator) aAllocator;
+ BOPCol_MapOfShape aMS;
//
// 1 Append Source Shapes
aNb=myArguments.Extent();
myRanges.SetStartSize(aNb);
myRanges.Init();
//
- aIt.Initialize(myArguments);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aSx=aIt.Value();
- ResetShapes(aSx);
- }
- //
aNbS=0;
aIt.Initialize(myArguments);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
//
aNbSx=0;
- TotalShapes(aSx, aNbSx);
+ TotalShapes(aSx, aNbSx, aMS);
+ //
aNbS=aNbS+aNbSx;
}
+ aMS.Clear();
//
myLines.SetStartSize(2*aNbS);
myLines.SetIncrement(aNbS);
BOPDS_ShapeInfo& aSI=ChangeShapeInfo(j);
//
const TopoDS_Shape& aS=aSI.Shape();
- ResetShape(aS);
//
aTS=aSI.ShapeType();
//
}//for (j=0; j<myNbSourceShapes; ++j) {
//
aMI.Clear();
+ //
aAllocator.Nullify();
+ //-----------------------------------------------------
+ //
+ for (nE=0; nE<myNbSourceShapes; ++nE) {
+ BOPDS_ShapeInfo& aSI=ChangeShapeInfo(nE);
+ if (aSI.ShapeType()!=TopAbs_EDGE) {
+ continue;
+ }
+ //
+ const BOPCol_ListOfInteger& aLV=aSI.SubShapes();
+ aIt1.Initialize(aLV);
+ for (; aIt1.More(); aIt1.Next()) {
+ nV=aIt1.Value();
+ if (myMapVE.IsBound(nV)) {
+ BOPCol_ListOfInteger& aLE=myMapVE.ChangeFind(nV);
+ aLE.Append(nE);
+ }
+ else {
+ BOPCol_ListOfInteger aLE(myAllocator);
+ //
+ aLE.Append(nE);
+ myMapVE.Bind(nV, aLE);
+ }
+ }
+ }
+ //
+ BOPCol_DataMapIteratorOfDataMapOfIntegerListOfInteger aItDMILI;
+ aItDMILI.Initialize(myMapVE);
+ for(; aItDMILI.More(); aItDMILI.Next()) {
+ BOPCol_MapOfInteger aMFence;
+ BOPCol_ListOfInteger aLEx;
+ //
+ nV=aItDMILI.Key();
+ BOPCol_ListOfInteger& aLE=aItDMILI.ChangeValue();
+ aIt1.Initialize(aLE);
+ for (; aIt1.More(); aIt1.Next()) {
+ nE=aIt1.Value();
+ if(aMFence.Add(nE)) {
+ aLEx.Append(nE);
+ }
+ }
+ //
+ aLE.Clear();
+ aIt1.Initialize(aLEx);
+ for (; aIt1.More(); aIt1.Next()) {
+ nE=aIt1.Value();
+ aLE.Append(nE);
+ }
+ }
//-----------------------------------------------------scope_1 t
//
// 3 myPaveBlocksPool
//purpose :
//=======================================================================
void BOPDS_DS::InitShape(const Standard_Integer aI,
- const TopoDS_Shape& aS,
- Handle(NCollection_BaseAllocator)& theAllocator,
- BOPCol_DataMapOfShapeInteger& aMSI)
+ const TopoDS_Shape& aS,
+ Handle(NCollection_BaseAllocator)& theAllocator,
+ BOPCol_DataMapOfShapeInteger& aMSI)
{
Standard_Integer aIx;
TopoDS_Iterator aIt;
//purpose :
//=======================================================================
Standard_Boolean BOPDS_DS::HasInterfShapeSubShapes(const Standard_Integer theI1,
- const Standard_Integer theI2)const
+ const Standard_Integer theI2)const
{
Standard_Boolean bRet;
Standard_Integer n2;
//purpose :
//=======================================================================
Standard_Boolean BOPDS_DS::HasInterfSubShapes(const Standard_Integer theI1,
- const Standard_Integer theI2)const
+ const Standard_Integer theI2)const
{
Standard_Boolean bRet;
Standard_Integer n1;
}
return sLPB;
}
+
//=======================================================================
//function : ChangePaveBlocks
//purpose :
//purpose :
//=======================================================================
void BOPDS_DS::SetCommonBlock(const Handle(BOPDS_PaveBlock)& thePB,
- const Handle(BOPDS_CommonBlock)& theCB)
+ const Handle(BOPDS_CommonBlock)& theCB)
{
if (IsCommonBlock(thePB)) {
Handle(BOPDS_CommonBlock)& aCB = myMapPBCB.ChangeFind(thePB);
//purpose :
//=======================================================================
void BOPDS_DS::FaceInfoOn(const Standard_Integer theF,
- BOPDS_IndexedMapOfPaveBlock& theMPB,
- BOPCol_MapOfInteger& theMI)
+ BOPDS_IndexedMapOfPaveBlock& theMPB,
+ BOPCol_MapOfInteger& theMI)
{
Standard_Integer nS, nSD, nV1, nV2;
BOPCol_ListIteratorOfListOfInteger aIt;
//purpose :
//=======================================================================
void BOPDS_DS::FaceInfoIn(const Standard_Integer theF,
- BOPDS_IndexedMapOfPaveBlock& theMPB,
- BOPCol_MapOfInteger& theMI)
+ BOPDS_IndexedMapOfPaveBlock& theMPB,
+ BOPCol_MapOfInteger& theMI)
{
- Standard_Integer i, aNbVF, aNbEF, nV, nE;
+ Standard_Integer i, aNbVF, aNbEF, nV, nE, nVSD;
BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+ TopoDS_Iterator aItS;
+ //
+ // 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) {
BOPDS_InterfVF& aVF=aVFs(i);
if(aVF.Contains(theF)) {
nV=aVF.OppositeIndex(theF);
+ if (HasShapeSD(nV, nVSD)) {
+ nV=nVSD;
+ }
theMI.Add(nV);
}
}
//
+ // 3. aEFs
BOPDS_VectorOfInterfEF& aEFs=InterfEF();
aNbEF=aEFs.Extent();
for (i=0; i<aNbEF; ++i) {
//purpose :
//=======================================================================
void BOPDS_DS::AloneVertices(const Standard_Integer theI,
- BOPCol_ListOfInteger& theLI)const
+ BOPCol_ListOfInteger& theLI)const
{
if (HasFaceInfo(theI)) {
//
const BOPDS_FaceInfo& aFI=FaceInfo(theI);
//
for (i=0; i<2; ++i) {
- const BOPDS_IndexedMapOfPaveBlock& aMPB=(!i) ? aFI.PaveBlocksIn() : aFI.PaveBlocksSc();
+ const BOPDS_IndexedMapOfPaveBlock& aMPB=(!i) ?
+ aFI.PaveBlocksIn() : aFI.PaveBlocksSc();
aItMPB.Initialize(aMPB);
for (; aItMPB.More(); aItMPB.Next()) {
const Handle(BOPDS_PaveBlock)& aPB=aItMPB.Value();
//purpose :
//=======================================================================
void BOPDS_DS::VerticesOnIn(const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPCol_MapOfInteger& aMI,
- BOPDS_MapOfPaveBlock& aMPB)const
+ const Standard_Integer nF2,
+ BOPCol_MapOfInteger& aMI,
+ BOPDS_MapOfPaveBlock& aMPB)const
{
Standard_Integer i, nV, nV1, nV2;
BOPCol_MapIteratorOfMapOfInteger aIt;
for (; aIt.More(); aIt.Next()) {
nV=aIt.Value();
if (aMVOn2.Contains(nV) || aMVIn2.Contains(nV)) {
- aMI.Add(nV);
+ aMI.Add(nV);
}
}
}
//purpose :
//=======================================================================
void BOPDS_DS::SharedEdges(const Standard_Integer nF1,
- const Standard_Integer nF2,
- BOPCol_ListOfInteger& theLI,
- const Handle(NCollection_BaseAllocator)& aAllocator)
+ const Standard_Integer nF2,
+ BOPCol_ListOfInteger& theLI,
+ const Handle(NCollection_BaseAllocator)& aAllocator)
{
Standard_Integer nE, nSp;
BOPCol_ListIteratorOfListOfInteger aItLI;
//purpose :
//=======================================================================
Standard_Boolean BOPDS_DS::HasShapeSD(const Standard_Integer theIndex,
- Standard_Integer& theIndexSD)const
+ Standard_Integer& theIndexSD)const
{
Standard_Boolean bRet;
//
// 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;
// purpose:
//=======================================================================
Standard_Boolean BOPDS_DS::IsToSort(const Handle(BOPDS_CommonBlock)& aCB,
- Standard_Integer& theI)
+ Standard_Integer& theI)
{
Standard_Boolean bRet;
bRet = Standard_False;
// purpose:
//=======================================================================
Standard_Boolean BOPDS_DS::IsSubShape(const Standard_Integer theI1,
- const Standard_Integer theI2)
+ const Standard_Integer theI2)
{
Standard_Boolean bRet;
Standard_Integer nS;
return bRet;
}
-
//=======================================================================
// function: Paves
// purpose:
//=======================================================================
void BOPDS_DS::Paves(const Standard_Integer theEdge,
- BOPDS_ListOfPave& theLP)
+ BOPDS_ListOfPave& theLP)
{
Standard_Integer aNb, i;
BOPDS_Pave *pPaves;
theLP.Append(pPaves[i]);
}
}
-
//=======================================================================
// function: UpdateTolerance
// purpose:
//=======================================================================
void BOPDS_DS::UpdateEdgeTolerance(const Standard_Integer nE,
- const Standard_Real aTol)
+ const Standard_Real aTol)
{
Standard_Integer nV;
Standard_Real aTolV;
}
}
}
-
//=======================================================================
//function : TotalShapes
//purpose :
//=======================================================================
void TotalShapes(const TopoDS_Shape& aS,
- Standard_Integer& aNbS)
+ Standard_Integer& aNbS,
+ BOPCol_MapOfShape& aMS)
{
- TopoDS_Shape *pS;
- //
- pS=(TopoDS_Shape *)&aS;
- if (!pS->Checked()) {
+ if (aMS.Add(aS)) {
TopoDS_Iterator aIt;
- //
- pS->Checked(1);
++aNbS;
aIt.Initialize(aS);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aSx=aIt.Value();
- TotalShapes(aSx, aNbS);
+ TotalShapes(aSx, aNbS, aMS);
}
}
}
-//=======================================================================
-//function : ResetShape
-//purpose :
-//=======================================================================
-void ResetShape(const TopoDS_Shape& aS)
-{
- TopoDS_Shape *pS;
- //
- pS=(TopoDS_Shape *)&aS;
- pS->Checked(0);
-}
-//=======================================================================
-//function : ResetShape
-//purpose :
-//=======================================================================
-void ResetShapes(const TopoDS_Shape& aS)
-{
- TopoDS_Iterator aIt;
- //
- ResetShape(aS);
- aIt.Initialize(aS);
- for (; aIt.More(); aIt.Next()) {
- const TopoDS_Shape& aSx=aIt.Value();
- ResetShape(aSx);
- }
-}
-#include <Geom_Curve.hxx>
-
//=======================================================================
//function : ComputeParameter
//purpose :
}//for (i=0; i<nd; ++i)
}//while (1)
}
+//=======================================================================
+//function : UpdatePaveBlocksWithSDVertices
+//purpose :
+//=======================================================================
+void BOPDS_DS::UpdatePaveBlocksWithSDVertices()
+{
+ Standard_Integer i, aNbPBP;
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+ //
+ BOPDS_VectorOfListOfPaveBlock& aPBP=myPaveBlocksPool;
+ //
+ aNbPBP=aPBP.Size();
+ for (i = 0; i < aNbPBP; ++i) {
+ BOPDS_ListOfPaveBlock& aLPB = aPBP(i);
+ //
+ aItPB.Initialize(aLPB);
+ for (; aItPB.More(); aItPB.Next()) {
+ Handle(BOPDS_PaveBlock)& aPB = aItPB.ChangeValue();
+ UpdatePaveBlockWithSDVertices(aPB);
+ }// for (; aItPB.More(); aItPB.Next()) {
+ }// for (i = 0; i < aNbPBP; ++i) {
+}
+//=======================================================================
+//function : UpdatePaveBlockWithSDVertices
+//purpose :
+//=======================================================================
+void BOPDS_DS::UpdatePaveBlockWithSDVertices
+ (const Handle(BOPDS_PaveBlock)& thePB)
+{
+ Standard_Integer nV1, nV2;
+ BOPDS_Pave aPave1, aPave2;
+ //
+ aPave1 = thePB->Pave1();
+ aPave2 = thePB->Pave2();
+ //
+ nV1 = aPave1.Index();
+ nV2 = aPave2.Index();
+ //
+ if (HasShapeSD(nV1, nV1)) {
+ aPave1.SetIndex(nV1);
+ thePB->SetPave1(aPave1);
+ }
+ //
+ if (HasShapeSD(nV2, nV2)) {
+ aPave2.SetIndex(nV2);
+ thePB->SetPave2(aPave2);
+ }
+}
+//=======================================================================
+//function : UpdateCommonBlockWithSDVertices
+//purpose :
+//=======================================================================
+void BOPDS_DS::UpdateCommonBlockWithSDVertices
+ (const Handle(BOPDS_CommonBlock)& theCB)
+{
+ const BOPDS_ListOfPaveBlock& aLPB = theCB->PaveBlocks();
+ BOPDS_ListIteratorOfListOfPaveBlock aItPB(aLPB);
+ for (; aItPB.More(); aItPB.Next()) {
+ const Handle(BOPDS_PaveBlock)& aPB = aItPB.Value();
+ UpdatePaveBlockWithSDVertices(aPB);
+ }
+}
+//=======================================================================
+//function : InitPaveBlocksForVertex
+//purpose :
+//=======================================================================
+void BOPDS_DS::InitPaveBlocksForVertex(const Standard_Integer theNV)
+{
+ Standard_Integer nE;
+ BOPCol_ListIteratorOfListOfInteger aItLE;
+ //
+ if (myMapVE.IsBound(theNV)) {
+ const BOPCol_ListOfInteger& aLE=myMapVE.Find(theNV);
+ aItLE.Initialize(aLE);
+ for (; aItLE.More(); aItLE.Next()) {
+ nE=aItLE.Value();
+ ChangePaveBlocks(nE);
+ }
+ }
+}
--- 2. the edge does not contain 3d curve and pcurves (-2)
--- 3. projection algorithm failed (-3)
---
-
- --ComputeVE (me:mutable;
- --aV : Vertex from TopoDS;
- --aE : Edge from TopoDS;
- --aT :out Real from Standard;
- --bToUpdateVertex:out Boolean from Standard;
- --aDist :out Real from Standard)
- --returns Integer from Standard;
- ---Purpose:
- --- Computes parameter aT of the vertex aV on
+ ComputeVE (me:mutable;
+ aV : Vertex from TopoDS;
+ aE : Edge from TopoDS;
+ aT :out Real from Standard;
+ aTolVnew:out Real from Standard)
+ returns Integer from Standard;
+ ---Purpose:
+ --- Computes parameter of the vertex aV on
--- the edge aE.
--- Returns zero if the distance between vertex
--- and edge is less than sum of tolerances,
--- 1. the edge is degenerated (-1)
--- 2. the edge does not contain 3d curve and pcurves (-2)
--- 3. projection algorithm failed (-3)
- ---
- --- Output parameters
- --- bToUpdateVertex - the flag that indicates whether the
- --- vertex tolerance should be modified or not
- --- aDist - the value of the distance between the vertex
- --- and the edge
-
-
-
+
ComputeVF (me:mutable;
aV : Vertex from TopoDS;
aF : Face from TopoDS;
--- 1. projection algorithm failed (-1)
--- 2. distance is more than sum of tolerances (-2)
--- 3. projection point out or on the boundaries of face (-3)
+ ---
+
+ ComputeVF (me:mutable;
+ aV : Vertex from TopoDS;
+ aF : Face from TopoDS;
+ U : out Real from Standard;
+ V : out Real from Standard;
+ aTolVnew:out Real from Standard)
+ returns Integer from Standard;
+ ---Purpose:
+ --- Computes UV parameters of the vertex aV on face aF
+ --- Returns zero if the distance between vertex and face is
+ --- less than or equal the sum of tolerances and the projection
+ --- point lays inside boundaries of the face.
+ --- For following conditions returns negative value
+ --- 1. projection algorithm failed (-1)
+ --- 2. distance is more than sum of tolerances (-2)
+ --- 3. projection point out or on the boundaries of face (-3)
---
-
+
StatePointFace(me:mutable;
aF : Face from TopoDS;
aP2D : Pnt2d from gp)
}
return 0;
}
+
+
//=======================================================================
//function : ComputeVE
//purpose :
//=======================================================================
- Standard_Integer BOPInt_Context::ComputeVE(const TopoDS_Vertex& aV1,
- const TopoDS_Edge& aE2,
- Standard_Real& aT)
+Standard_Integer BOPInt_Context::ComputeVE(const TopoDS_Vertex& aV1,
+ const TopoDS_Edge& aE2,
+ Standard_Real& aT)
+{
+ Standard_Real aTolVnew;
+ //
+ return ComputeVE(aV1, aE2, aT, aTolVnew);
+}
+//=======================================================================
+//function : ComputeVE
+//purpose :
+//=======================================================================
+Standard_Integer BOPInt_Context::ComputeVE(const TopoDS_Vertex& aV1,
+ const TopoDS_Edge& aE2,
+ Standard_Real& aT,
+ Standard_Real& aTolVnew)
{
if (BRep_Tool::Degenerated(aE2)) {
return -1;
aTolE2=BRep_Tool::Tolerance(aE2);
aTolSum = aTolV1 + aTolE2 + Precision::Confusion();
//
+ aTolVnew=aDist+aTolE2;
+ //
aT=aProjector.LowerDistanceParameter();
if (aDist > aTolSum) {
return -4;
return 0;
}
//=======================================================================
-//function : ComputeVS
+//function : ComputeVF
//purpose :
//=======================================================================
- Standard_Integer BOPInt_Context::ComputeVF(const TopoDS_Vertex& aV1,
- const TopoDS_Face& aF2,
- Standard_Real& U,
- Standard_Real& V)
+Standard_Integer BOPInt_Context::ComputeVF(const TopoDS_Vertex& aV1,
+ const TopoDS_Face& aF2,
+ Standard_Real& U,
+ Standard_Real& V)
+{
+ Standard_Real aTolVnew;
+ //
+ return ComputeVF(aV1, aF2, U, V, aTolVnew);
+}
+//=======================================================================
+//function : ComputeVF
+//purpose :
+//=======================================================================
+Standard_Integer BOPInt_Context::ComputeVF(const TopoDS_Vertex& aV1,
+ const TopoDS_Face& aF2,
+ Standard_Real& U,
+ Standard_Real& V,
+ Standard_Real& aTolVnew)
{
Standard_Real aTolV1, aTolF2, aTolSum, aDist;
gp_Pnt aP;
// 2. Check the distance between the projection point and
// the original point
aDist=aProjector.LowerDistance();
-
+ //
aTolV1=BRep_Tool::Tolerance(aV1);
aTolF2=BRep_Tool::Tolerance(aF2);
- aTolSum=aTolV1+aTolF2;
+ //
+ aTolSum=aTolV1 + aTolF2 + Precision::Confusion();
+ aTolVnew=aDist+aTolF2;
+ //
if (aDist > aTolSum) {
// the distance is too large
return -2;
--raises
is
- ComputeVV(myclass;
+ ComputeVV(myclass;
aV1:Vertex from TopoDS;
aP2:Pnt from gp;
aTolP2:Real from Standard)
theF2: Face from TopoDS;
theCurve:Curve from IntTools;
thePC1:Boolean from Standard;
- thePC2:Boolean from Standard);
+ thePC2:Boolean from Standard);
MakeContainer(myclass;
theType:ShapeEnum from TopAbs;
OrientFacesOnShell (myclass;
theS :out Shape from TopoDS);
- CorrectTolerances (myclass;
- theS: Shape from TopoDS;
- theTolMax: Real from Standard =0.0001);
- ---Purpose:
- --- Provides valid values of tolerances for the shape <theS>
- --- <theTolMax> is max value of the tolerance that can be
- --- accepted for correction. If real value of the tolerance
- --- will be greater than <aTolMax>, the correction does not
- --- perform.
- ---
- CorrectCurveOnSurface (myclass;
- theS: Shape from TopoDS;
- theTolMax: Real from Standard =0.0001);
- ---Purpose:
- --- Provides valid values of tolerances for the shape <theS>
- --- in terms of BRepCheck_InvalidCurveOnSurface.
- ---
- CorrectPointOnCurve (myclass;
- theS: Shape from TopoDS;
- theTolMax: Real from Standard =0.0001);
- ---Purpose:
- --- Provides valid values of tolerances for the shape <theS>
- --- in terms of BRepCheck_InvalidPointOnCurve.
- ---
- --fields
+
--copy from BOPTools_AlgoTools.cdl
MakeNewVertex (myclass;
returns Boolean from Standard;
---Purpose:
--- Checks if it is possible to compute shrunk range for the edge <aE>.
- ---
-
- CorrectShapeTolerances (myclass;
- theS: Shape from TopoDS);
- ---Purpose:
- --- Corrects tolerance values of the sub-shapes of the shape <theS> if needed.
- ---
-
+ ---
Dimension(myclass;
theS:Shape from TopoDS)
returns Integer from Standard;
---Purpose:
--- Retutns dimension of the shape <theS>.
+
+ CorrectTolerances (myclass;
+ theS: Shape from TopoDS;
+ theTolMax: Real from Standard =0.0001);
+ ---Purpose:
+ --- Provides valid values of tolerances for the shape <theS>
+ --- <theTolMax> is max value of the tolerance that can be
+ --- accepted for correction. If real value of the tolerance
+ --- will be greater than <aTolMax>, the correction does not
+ --- perform.
+ ---
+ CorrectCurveOnSurface (myclass;
+ theS: Shape from TopoDS;
+ theTolMax: Real from Standard =0.0001);
+ ---Purpose:
+ --- Provides valid values of tolerances for the shape <theS>
+ --- in terms of BRepCheck_InvalidCurveOnSurface.
+ ---
+ CorrectPointOnCurve (myclass;
+ theS: Shape from TopoDS;
+ theTolMax: Real from Standard =0.0001);
+ ---Purpose:
+ --- Provides valid values of tolerances for the shape <theS>
+ --- in terms of BRepCheck_InvalidPointOnCurve.
+ ---
+ CorrectShapeTolerances (myclass;
+ theS: Shape from TopoDS);
+ ---Purpose:
+ --- Corrects tolerance values of the sub-shapes of the shape <theS> if needed.
+ ---
+
+ CorrectTolerances (myclass;
+ theS: Shape from TopoDS;
+ theMapToAvoid:IndexedMapOfShape from BOPCol;
+ theTolMax: Real from Standard =0.0001);
+
+ CorrectCurveOnSurface (myclass;
+ theS: Shape from TopoDS;
+ theMapToAvoid:IndexedMapOfShape from BOPCol;
+ theTolMax: Real from Standard =0.0001);
+
+ CorrectPointOnCurve (myclass;
+ theS: Shape from TopoDS;
+ theMapToAvoid:IndexedMapOfShape from BOPCol;
+ theTolMax: Real from Standard =0.0001);
+
+ CorrectShapeTolerances (myclass;
+ theS: Shape from TopoDS;
+ theMapToAvoid:IndexedMapOfShape from BOPCol);
+
end AlgoTools;
static
void CheckEdge (const TopoDS_Edge& E,
- const Standard_Real aMaxTol);
+ const Standard_Real aMaxTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
const TopoDS_Face& S,
- const Standard_Real aMaxTol);
+ const Standard_Real aMaxTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
Standard_Boolean Validate(const Adaptor3d_Curve& CRef,
const Adaptor3d_Curve& Other,
Standard_Real& aNewTolerance);
static
- void CorrectVertexTolerance(const TopoDS_Edge& aE);
+ void CorrectVertexTolerance(const TopoDS_Edge& aE,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
- void CorrectWires(const TopoDS_Face& aF);
+ void CorrectWires(const TopoDS_Face& aF,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
Standard_Real IntersectCurves2d(const gp_Pnt& aPV,
const TopoDS_Edge& aE2);
static
- void UpdateEdges(const TopoDS_Face& aF);
+ void UpdateEdges(const TopoDS_Face& aF,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
static
- void UpdateVertices(const TopoDS_Edge& aE);
+ void UpdateVertices(const TopoDS_Edge& aE,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
+
+static
+ void UpdateShape(const TopoDS_Shape& aS,
+ const Standard_Real aTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid);
//=======================================================================
// Function : CorrectTolerances
// purpose :
//=======================================================================
- void BOPTools_AlgoTools::CorrectTolerances(const TopoDS_Shape& aShape,
- const Standard_Real aMaxTol)
+void BOPTools_AlgoTools::CorrectTolerances(const TopoDS_Shape& aShape,
+ const Standard_Real aMaxTol)
{
- BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMaxTol);
- BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMaxTol);
+ BOPCol_IndexedMapOfShape aMapToAvoid;
+ //
+ CorrectTolerances(aShape, aMapToAvoid, aMaxTol);
+}
+//=======================================================================
+// Function : CorrectShapeTolerances
+// purpose :
+//=======================================================================
+void BOPTools_AlgoTools::CorrectShapeTolerances
+ (const TopoDS_Shape& aShape)
+{
+ BOPCol_IndexedMapOfShape aMapToAvoid;
+ //
+ BOPTools_AlgoTools::CorrectShapeTolerances(aShape, aMapToAvoid);
+}
+//=======================================================================
+// Function : CorrectPointOnCurve
+// purpose :
+//=======================================================================
+void BOPTools_AlgoTools::CorrectPointOnCurve
+ (const TopoDS_Shape& S,
+ const Standard_Real aMaxTol)
+{
+ BOPCol_IndexedMapOfShape aMapToAvoid;
+ //
+ BOPTools_AlgoTools::CorrectPointOnCurve(S, aMapToAvoid, aMaxTol);
+}
+//=======================================================================
+// Function : CorrectCurveOnSurface
+// purpose :
+//=======================================================================
+void BOPTools_AlgoTools::CorrectCurveOnSurface
+ (const TopoDS_Shape& S,
+ const Standard_Real aMaxTol)
+{
+ BOPCol_IndexedMapOfShape aMapToAvoid;
+ //
+ BOPTools_AlgoTools::CorrectCurveOnSurface(S, aMapToAvoid, aMaxTol);
+}
+//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+//=======================================================================
+// Function : CorrectTolerances
+// purpose :
+//=======================================================================
+void BOPTools_AlgoTools::CorrectTolerances
+ (const TopoDS_Shape& aShape,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid,
+ const Standard_Real aMaxTol)
+{
+ BOPTools_AlgoTools::CorrectPointOnCurve(aShape, aMapToAvoid, aMaxTol);
+ BOPTools_AlgoTools::CorrectCurveOnSurface(aShape, aMapToAvoid,aMaxTol);
+}
+//=======================================================================
+// Function : CorrectShapeTolerances
+// purpose :
+//=======================================================================
+void BOPTools_AlgoTools::CorrectShapeTolerances
+ (const TopoDS_Shape& aShape,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
+{
+ TopExp_Explorer aExp;
+ Standard_Integer aDim;
+ //
+ aDim=Dimension(aShape);
+ if (aDim == 1) {
+ aExp.Init(aShape, TopAbs_EDGE);
+ for (; aExp.More(); aExp.Next()) {
+ const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExp.Current();
+ UpdateVertices(aE, aMapToAvoid);
+ }
+ }
+ else {
+ aExp.Init(aShape, TopAbs_FACE);
+ for (; aExp.More(); aExp.Next()) {
+ const TopoDS_Face& aF = *(TopoDS_Face*)&aExp.Current();
+ UpdateEdges(aF, aMapToAvoid);
+ }
+ }
}
-
//=======================================================================
// Function : CorrectPointOnCurve
// purpose :
//=======================================================================
- void BOPTools_AlgoTools::CorrectPointOnCurve(const TopoDS_Shape& S,
- const Standard_Real aMaxTol)
+void BOPTools_AlgoTools::CorrectPointOnCurve
+ (const TopoDS_Shape& S,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid,
+ const Standard_Real aMaxTol)
{
Standard_Integer i, aNb;
TopTools_IndexedMapOfShape Edges;
aNb=Edges.Extent();
for (i=1; i<=aNb; i++) {
const TopoDS_Edge& E= TopoDS::Edge(Edges(i));
- CheckEdge(E, aMaxTol);
+ CheckEdge(E, aMaxTol, aMapToAvoid);
}
}
-
//=======================================================================
// Function : CorrectCurveOnSurface
// purpose :
//=======================================================================
- void BOPTools_AlgoTools::CorrectCurveOnSurface(const TopoDS_Shape& S,
- const Standard_Real aMaxTol)
+void BOPTools_AlgoTools::CorrectCurveOnSurface
+ (const TopoDS_Shape& S,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid,
+ const Standard_Real aMaxTol)
{
Standard_Integer i, aNbFaces, j, aNbEdges;
TopTools_IndexedMapOfShape Faces;
for (i=1; i<=aNbFaces; i++) {
const TopoDS_Face& F= TopoDS::Face(Faces(i));
//
- CorrectWires(F);
+ CorrectWires(F, aMapToAvoid);
//
TopTools_IndexedMapOfShape Edges;
TopExp::MapShapes (F, TopAbs_EDGE, Edges);
aNbEdges=Edges.Extent();
for (j=1; j<=aNbEdges; j++) {
const TopoDS_Edge& E= TopoDS::Edge(Edges(j));
- CorrectEdgeTolerance (E, F, aMaxTol);
+ CorrectEdgeTolerance (E, F, aMaxTol, aMapToAvoid);
}
}
}
// Function : CorrectWires
// purpose :
//=======================================================================
-void CorrectWires(const TopoDS_Face& aFx)
+void CorrectWires(const TopoDS_Face& aFx,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Integer i, aNbV;
Standard_Real aTol, aTol2, aD2, aD2max, aT1, aT2, aT, aTol2d;
gp_Pnt aP, aPV;
gp_Pnt2d aP2D;
TopoDS_Face aF;
- BRep_Builder aBB;
+ //BRep_Builder aBB;
TopTools_IndexedDataMapOfShapeListOfShape aMVE;
TopTools_ListIteratorOfListOfShape aIt, aIt1;
//
}
if (aD2max>aTol2) {
aTol=sqrt(aD2max);
- aBB.UpdateVertex(aV, aTol);
+ UpdateShape(aV, aTol, aMapToAvoid);
+ //aBB.UpdateVertex(aV, aTol);
}
}
}
//=======================================================================
void CorrectEdgeTolerance (const TopoDS_Edge& myShape,
const TopoDS_Face& S,
- const Standard_Real aMaxTol)
+ const Standard_Real aMaxTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
//
// 1. Minimum of conditions to Perform
}
//
if (aNewTol<aMaxTol) {
- TE->UpdateTolerance(aNewTol+Delta);
- //
- CorrectVertexTolerance(myShape);
+ UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+ //TE->UpdateTolerance(aNewTol+Delta);
+ CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
//return;//BRepCheck::Add(lst,BRepCheck_InvalidSameParameterFlag);
}
if (aNewTol<aMaxTol) {
- TE->UpdateTolerance(aNewTol+Delta);
- CorrectVertexTolerance(myShape);
+ UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+ //TE->UpdateTolerance(aNewTol+Delta);
+ CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
}
if (okx) {
//return;//BRepCheck::Add(lst,BRepCheck_InvalidCurveOnSurface);
if (aNewTol<aMaxTol) {
- TE->UpdateTolerance(aNewTol+Delta);
- CorrectVertexTolerance(myShape);
+ UpdateShape(myShape, aNewTol+Delta, aMapToAvoid);
+ //TE->UpdateTolerance(aNewTol+Delta);
+ CorrectVertexTolerance(myShape, aMapToAvoid);
}
}
}
} // end of 2. Tolerances in InContext
}
-
-//=======================================================================
-// Function : CorrectShapeTolerances
-// purpose :
-//=======================================================================
- void BOPTools_AlgoTools::CorrectShapeTolerances(const TopoDS_Shape& aShape)
-{
- TopExp_Explorer aExp;
- Standard_Integer aDim;
- //
- aDim=Dimension(aShape);
- if (aDim == 1) {
- aExp.Init(aShape, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- const TopoDS_Edge& aE = *(TopoDS_Edge*)&aExp.Current();
- UpdateVertices(aE);
- }
- } else {
- aExp.Init(aShape, TopAbs_FACE);
- for (; aExp.More(); aExp.Next()) {
- const TopoDS_Face& aF = *(TopoDS_Face*)&aExp.Current();
- UpdateEdges(aF);
- }
- }
-}
-
//=======================================================================
//function : CorrectVertexTolerance
//purpose :
//=======================================================================
-void CorrectVertexTolerance(const TopoDS_Edge& aE)
+void CorrectVertexTolerance(const TopoDS_Edge& aE,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Integer k, aNbV;
Standard_Real aTolE, aTolV;
const TopoDS_Vertex& aV=TopoDS::Vertex(aVMap(k));
aTolV=BRep_Tool::Tolerance(aV);
if (aTolV<aTolE) {
- Handle(BRep_TVertex)& aTV = *((Handle(BRep_TVertex)*)&aV.TShape());
- aTV->UpdateTolerance(aTolE);
+ UpdateShape(aV, aTolE, aMapToAvoid);
+ //Handle(BRep_TVertex)& aTV = *((Handle(BRep_TVertex)*)&aV.TShape());
+ //aTV->UpdateTolerance(aTolE);
}
}
}
return aFlag;
}
-
//=======================================================================
// Function : CheckEdge
// purpose : Correct tolerances for Vertices on Edge
//=======================================================================
-void CheckEdge (const TopoDS_Edge& Ed, const Standard_Real aMaxTol)
+void CheckEdge (const TopoDS_Edge& Ed,
+ const Standard_Real aMaxTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
TopoDS_Edge E=Ed;
E.Orientation(TopAbs_FORWARD);
aD2=prep.SquareDistance(Controlp);
if (aD2 > Tol) {
aNewTolerance=sqrt(aD2)+dd;
- if (aNewTolerance<aMaxTol)
- TV->UpdateTolerance(aNewTolerance);
+ if (aNewTolerance<aMaxTol) {
+ UpdateShape(aVertex, aNewTolerance, aMapToAvoid);
+ //TV->UpdateTolerance(aNewTolerance);
+ }
}
}
itpr.Next();
if (aD2 > Tol) {
aNewTolerance=sqrt(aD2)+dd;
- if (aNewTolerance<aMaxTol)
- TV->UpdateTolerance(aNewTolerance);
+ if (aNewTolerance<aMaxTol) {
+ UpdateShape(aVertex, aNewTolerance, aMapToAvoid);
+ //TV->UpdateTolerance(aNewTolerance);
+ }
}
}
}
}
}
}
-
//=======================================================================
// Function : UpdateVertices
// purpose :
//=======================================================================
- void UpdateVertices(const TopoDS_Edge& aE)
+void UpdateVertices(const TopoDS_Edge& aE,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Real aTolE, aTolV;
TopoDS_Iterator aItE;
- BRep_Builder aBB;
+ //BRep_Builder aBB;
//
aTolE = BRep_Tool::Tolerance(aE);
aItE.Initialize(aE);
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aItE.Value();
aTolV = BRep_Tool::Tolerance(aV);
if (aTolV < aTolE) {
- aBB.UpdateVertex(aV, aTolE);
+ UpdateShape(aV, aTolE, aMapToAvoid);
+ //aBB.UpdateVertex(aV, aTolE);
}
}
}
// Function : UpdateEdges
// purpose :
//=======================================================================
- void UpdateEdges(const TopoDS_Face& aF)
+void UpdateEdges(const TopoDS_Face& aF,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
{
Standard_Real aTolF, aTolE, aTolV;
TopoDS_Iterator aItF, aItW, aItE;
- BRep_Builder aBB;
+ //BRep_Builder aBB;
//
aTolE = aTolF = BRep_Tool::Tolerance(aF);
aItF.Initialize(aF);
const TopoDS_Edge& aE = *(TopoDS_Edge*)&aItW.Value();
aTolE = BRep_Tool::Tolerance(aE);
if (aTolE < aTolF) {
- aBB.UpdateEdge(aE, aTolF);
+ UpdateShape(aE, aTolF,aMapToAvoid);
+ //aBB.UpdateEdge(aE, aTolF);
aTolE = aTolF;
}
- UpdateVertices(aE);
+ UpdateVertices(aE, aMapToAvoid);
}
}
else {
const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&aItF.Value();
aTolV = BRep_Tool::Tolerance(aV);
if (aTolV < aTolE) {
- aBB.UpdateVertex(aV, aTolF);
+ UpdateShape(aV, aTolF,aMapToAvoid);
+ //aBB.UpdateVertex(aV, aTolF);
}
}
}
}
+//=======================================================================
+//function : UpdateShape
+//purpose :
+//=======================================================================
+void UpdateShape(const TopoDS_Shape& aS,
+ const Standard_Real aTol,
+ const BOPCol_IndexedMapOfShape& aMapToAvoid)
+{
+ if (aMapToAvoid.Contains(aS)) {
+ return;
+ }
+ //
+ TopAbs_ShapeEnum aType;
+ BRep_Builder aBB;
+ //
+ aType=aS.ShapeType();
+ if (aType==TopAbs_EDGE) {
+ const TopoDS_Edge& aE = *((TopoDS_Edge*)&aS);
+ aBB.UpdateEdge(aE, aTol);
+ }
+ else if (aType==TopAbs_VERTEX) {
+ const TopoDS_Vertex& aV = *((TopoDS_Vertex*)&aS);
+ aBB.UpdateVertex(aV, aTol);
+ }
+}
const Standard_Real Tol) const
{
Handle(BRep_TFace) TF = new BRep_TFace();
+ if(!F.IsNull() && F.Locked()) {
+ Standard_NullObject::Raise("BRep_Builder::MakeFace");
+ }
TF->Surface(S);
TF->Tolerance(Tol);
MakeShape(F,TF);
const Handle(Poly_Triangulation)& T) const
{
Handle(BRep_TFace) TF = new BRep_TFace();
+ if(!F.IsNull() && F.Locked()) {
+ Standard_NullObject::Raise("BRep_Builder::MakeFace");
+ }
TF->Triangulation(T);
MakeShape(F, TF);
}
const Standard_Real Tol) const
{
Handle(BRep_TFace) TF = new BRep_TFace();
+ if(!F.IsNull() && F.Locked()) {
+ Standard_NullObject::Raise("BRep_Builder::MakeFace");
+ }
TF->Surface(S);
TF->Tolerance(Tol);
TF->Location(L);
const Standard_Real Tol) const
{
const Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &F.TShape());
+ if(!F.IsNull() && F.Locked()) {
+ Standard_NullObject::Raise("BRep_Builder::UpdateFace");
+ }
TF->Surface(S);
TF->Tolerance(Tol);
TF->Location(L.Predivided(F.Location()));
void BRep_Builder::UpdateFace(const TopoDS_Face& F,
const Handle(Poly_Triangulation)& T) const
{
+ const Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &F.TShape());
+ if(TF->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateFace");
+ }
(*((Handle(BRep_TFace)*) &F.TShape()))->Triangulation(T);
F.TShape()->Modified(Standard_True);
}
void BRep_Builder::UpdateFace(const TopoDS_Face& F,
const Standard_Real Tol) const
{
+ const Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &F.TShape());
+ if(TF->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateFace");
+ }
(*((Handle(BRep_TFace)*) &F.TShape()))->Tolerance(Tol);
F.TShape()->Modified(Standard_True);
}
void BRep_Builder::NaturalRestriction(const TopoDS_Face& F,
const Standard_Boolean N) const
{
+ const Handle(BRep_TFace)& TF = *((Handle(BRep_TFace)*) &F.TShape());
+ if(TF->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::NaturalRestriction");
+ }
(*((Handle(BRep_TFace)*) &F.TShape()))->NaturalRestriction(N);
F.TShape()->Modified(Standard_True);
}
void BRep_Builder::MakeEdge(TopoDS_Edge& E) const
{
Handle(BRep_TEdge) TE = new BRep_TEdge();
+ if(!E.IsNull() && E.Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::MakeEdge");
+ }
TE->Closed(Standard_False);
MakeShape(E,TE);
}
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
const TopLoc_Location l = L.Predivided(E.Location());
-
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
UpdateCurves(TE->ChangeCurves(),C,l);
if (!C.IsNull()) TE->Closed(C->IsClosed());
const Standard_Real Tol) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
const TopLoc_Location l = L.Predivided(E.Location());
UpdateCurves(TE->ChangeCurves(),C,S,l);
const gp_Pnt2d& Pl) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
const TopLoc_Location l = L.Predivided(E.Location());
UpdateCurves(TE->ChangeCurves(),C,S,l,Pf,Pl);
const Standard_Real Tol) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
const TopLoc_Location l = L.Predivided(E.Location());
UpdateCurves(TE->ChangeCurves(),C1,C2,S,l);
const gp_Pnt2d& Pl) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
const TopLoc_Location l = L.Predivided(E.Location());
UpdateCurves(TE->ChangeCurves(),C1,C2,S,l,Pf,Pl);
const TopLoc_Location& L) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
-
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
const TopLoc_Location& L) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
const TopLoc_Location l = L.Predivided(E.Location());
Standard_Boolean isModified = Standard_False;
const TopLoc_Location& L) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
const TopLoc_Location l = L.Predivided(E.Location());
Standard_Boolean isModified = Standard_False;
const TopLoc_Location& L) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
TopLoc_Location l = L.Predivided(E.Location());
BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
const TopLoc_Location& L) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
TopLoc_Location l = L.Predivided(E.Location());
BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
const Standard_Real Tol) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateEdge");
+ }
TE->UpdateTolerance(Tol);
TE->Modified(Standard_True);
}
const GeomAbs_Shape C)const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
-
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::Continuity");
+ }
const TopLoc_Location l1 = L1.Predivided(E.Location());
const TopLoc_Location l2 = L2.Predivided(E.Location());
void BRep_Builder::SameParameter(const TopoDS_Edge& E,
const Standard_Boolean S) const
{
- const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::SameParameter");
+ }
TE->SameParameter(S);
TE->Modified(Standard_True);
}
const Standard_Boolean S) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::SameRange");
+ }
TE->SameRange(S);
TE->Modified(Standard_True);
}
const Standard_Boolean D) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::Degenerated");
+ }
TE->Degenerated(D);
if (D) {
// set a null 3d curve
{
// set the range to all the representations if Only3d=FALSE
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
-
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::Range");
+ }
BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
BRep_ListIteratorOfListOfCurveRepresentation itcr(lcr);
Handle(BRep_GCurve) GC;
const Standard_Real Last) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::Range");
+ }
const TopLoc_Location l = L.Predivided(E.Location());
BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
const TopoDS_Edge& Eout) const
{
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &Ein.TShape());
-
+ if(TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::Transfert");
+ }
const Standard_Real tol = TE->Tolerance();
BRep_ListOfCurveRepresentation& lcr = TE->ChangeCurves();
const Standard_Real Tol) const
{
const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
-
+ if(TV->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateVertex");
+ }
TV->Pnt(P.Transformed(V.Location().Inverted().Transformation()));
TV->UpdateTolerance(Tol);
TV->Modified(Standard_True);
const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
-
+ if(TV->Locked() || TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateVertex");
+ }
TopLoc_Location L = E.Location().Predivided(V.Location());
// Search the vertex in the edge
const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &E.TShape());
-
-
+ if(TV->Locked() || TE->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateVertex");
+ }
// Search the vertex in the edge
TopAbs_Orientation ori = TopAbs_INTERNAL;
const Standard_Real Tol) const
{
const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &Ve.TShape());
-
+ if(TV->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateVertex");
+ }
TopLoc_Location L;
const Handle(Geom_Surface)& S = BRep_Tool::Surface(F,L);
L = L.Predivided(Ve.Location());
const Standard_Real Tol) const
{
const Handle(BRep_TVertex)& TV = *((Handle(BRep_TVertex)*) &V.TShape());
+ if(TV->Locked())
+ {
+ Standard_NullObject::Raise("BRep_Builder::UpdateVertex");
+ }
TV->UpdateTolerance(Tol);
TV->Modified(Standard_True);
}
#include <BRepTools_WireExplorer.hxx>
#include <BRepTools_ShapeSet.hxx>
#include <BRepAdaptor_Surface.hxx>
+#include <BRep_TEdge.hxx>
#include <Precision.hxx>
#include <Poly_Triangulation.hxx>
#include <gp_Ax2.hxx>
return 0;
}
+//=======================================================================
+//
+//=======================================================================
+void setProp(TopoDS_Shape Sh, const char** a, Standard_Integer n)
+{
+ Standard_Integer i;
+ for(i = 2; i < n; i++) {
+ if (strstr ( a[i], "free" )) {
+ if(a[i][0] == '-') {
+ Sh.Free(Standard_False);
+ }
+ else {
+ Sh.Free(Standard_True);
+ }
+ }
+ if (strstr ( a[i], "modified" )) {
+ if(a[i][0] == '-') {
+ Sh.Modified(Standard_False);
+ }
+ else {
+ Sh.Modified(Standard_True);
+ }
+ }
+ if (strstr ( a[i], "checked" )) {
+ if(a[i][0] == '-') {
+ Sh.Checked(Standard_False);
+ }
+ else {
+ Sh.Checked(Standard_True);
+ }
+ }
+ if (strstr ( a[i], "orientable" )) {
+ if(a[i][0] == '-') {
+ Sh.Orientable(Standard_False);
+ }
+ else {
+ Sh.Orientable(Standard_True);
+ }
+ }
+ if (strstr ( a[i], "closed" )) {
+ if(a[i][0] == '-') {
+ Sh.Closed(Standard_False);
+ }
+ else {
+ Sh.Closed(Standard_True);
+ }
+ }
+ if (strstr ( a[i], "infinite" )) {
+ if(a[i][0] == '-') {
+ Sh.Infinite(Standard_False);
+ }
+ else {
+ Sh.Infinite(Standard_True);
+ }
+ }
+ if (strstr ( a[i], "convex" )) {
+ if(a[i][0] == '-') {
+ Sh.Convex(Standard_False);
+ }
+ else {
+ Sh.Convex(Standard_True);
+ }
+ }
+ if (strstr ( a[i], "locked" )) {
+ if(a[i][0] == '-') {
+ Sh.Locked(Standard_False);
+ }
+ else {
+ Sh.Locked(Standard_True);
+ }
+ }
+ }
+}
+
+//=======================================================================
+//
+//=======================================================================
+static Standard_Integer setFlags(Draw_Interpretor& ,
+ Standard_Integer n, const char** a)
+{
+ if (n < 3) return 1;
+
+ TopExp_Explorer ex;
+ TopoDS_Shape Sh = DBRep::Get(a[1]);
+
+ if (Sh.IsNull()) return 1;
+
+ setProp(Sh, a, n);
+ for (ex.Init (Sh,TopAbs_VERTEX); ex.More(); ex.Next()) {
+ TopoDS_Shape S = ex.Current();
+ setProp(S, a, n);
+ }
+
+ for (ex.Init (Sh,TopAbs_EDGE); ex.More(); ex.Next()) {
+ TopoDS_Shape S = ex.Current();
+ setProp(S, a, n);
+ }
+
+ for (ex.Init (Sh,TopAbs_FACE); ex.More(); ex.Next()) {
+ TopoDS_Shape S = ex.Current();
+ setProp(S, a, n);
+ }
+
+ return 0;
+}
+
//=======================================================================
//memory management
//=======================================================================
__FILE__,nbshapes,g);
theCommands.Add("numshapes","numshapes s; size of shape",__FILE__,numshapes,g);
theCommands.Add("countshapes","countshapes s; count of shape",__FILE__,countshapes,g);
+ theCommands.Add("setflags",
+ "setflags shape_name flag1[flag2...]\n sets flags for shape(free, modidfied, checked, orientable, closed, infinite, convex, locked), for exmple <setflags a free> or <setflags a -free> if necessary unflag ",
+ __FILE__,setFlags,g);
// theCommands.Add("dumpmmgt",
// "dump le contenu du gestionnaire de memoire",__FILE__,dumpmmgt,g);
TShape(me : in out; T : TShape from TopoDS)
---C++: inline
- is static;
+ is static;
+
+ Locked(me:out;
+ bFlag:Boolean from Standard);
+ ---C++: inline
+
+ Locked(me)
+ returns Boolean from Standard;
+ ---C++: inline
fields
myTShape : TShape from TopoDS;
//
// 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 version 2.1 as published
+// 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.
myTShape->Free(B);
}
+//=======================================================================
+//function : Locked
+//purpose :
+//=======================================================================
+
+inline Standard_Boolean TopoDS_Shape::Locked () const
+{
+ return myTShape->Locked();
+}
+
+//=======================================================================
+//function : Locked
+//purpose :
+//=======================================================================
+
+inline void TopoDS_Shape::Locked (const Standard_Boolean B)
+{
+ myTShape->Locked(B);
+}
+
//=======================================================================
//function : Modified
//purpose :
//purpose :
//=======================================================================
-inline void TopoDS_Shape::TShape (const Handle(TopoDS_TShape& TS))
+inline void TopoDS_Shape::TShape (const Handle(TopoDS_TShape)& TS)
{
myTShape = TS;
}
---C++: return &
---C++: inline
is static private;
-
+
+
+ Locked(me:mutable;
+ bFlag:Boolean from Standard);
+ ---C++: inline
+
+ Locked(me)
+ returns Boolean from Standard;
+ ---C++: inline
+
fields
myShapes : ListOfShape from TopoDS;
myFlags : Integer from Standard;
//
// 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 version 2.1 as published
+// 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.
#define TopoDS_TShape_Flags_Closed (1<<4)
#define TopoDS_TShape_Flags_Infinite (1<<5)
#define TopoDS_TShape_Flags_Convex (1<<6)
+#define TopoDS_TShape_Flags_Locked (1<<7)
//=======================================================================
else myFlags &= ~TopoDS_TShape_Flags_Free;
}
+//=======================================================================
+//function : Locked
+//purpose :
+//=======================================================================
+inline Standard_Boolean TopoDS_TShape::Locked() const
+{
+ return ((myFlags & TopoDS_TShape_Flags_Locked) != 0);
+}
+
+//=======================================================================
+//function : Locked
+//purpose :
+//=======================================================================
+
+inline void TopoDS_TShape::Locked(const Standard_Boolean F)
+{
+ if (F) myFlags |= TopoDS_TShape_Flags_Locked;
+ else myFlags &= ~TopoDS_TShape_Flags_Locked;
+}
+
//=======================================================================
//function : Modified
//purpose :