X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FNMTTools%2FNMTTools_PaveFiller_1.cxx;h=8685855c00e58fce5ffa541f6f4a760e0f6312d1;hb=d2046800b5f3ab6a56c3b9a72766f5d317a235e7;hp=57c923e775c3578e7dddb096da0e8ac56955a7d1;hpb=9499b99fe2dcb53e1ea364f97986f8f432b04600;p=modules%2Fgeom.git diff --git a/src/NMTTools/NMTTools_PaveFiller_1.cxx b/src/NMTTools/NMTTools_PaveFiller_1.cxx index 57c923e77..8685855c0 100644 --- a/src/NMTTools/NMTTools_PaveFiller_1.cxx +++ b/src/NMTTools/NMTTools_PaveFiller_1.cxx @@ -1,31 +1,35 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File: NMTTools_PaveFiller_1.cxx // Created: Mon Dec 8 11:47:55 2003 // Author: Peter KURNEV // - - +// #include -#include +#include +#include +#include +#include #include #include @@ -34,18 +38,16 @@ #include #include +#include #include #include -#include -#include -#include +#include +#include #include -#include -#include +#include - //======================================================================= // function: PerformVV // purpose: @@ -54,136 +56,107 @@ { myIsDone=Standard_False; // - Standard_Integer n1, n2,anIndexIn, aFlag, aWhat, aWith, aNbVVs, aBlockLength; - Standard_Boolean bJustAddInterference; + Standard_Integer aNbVVs, aBL, aNbVSD, nVnew, i, j, n1, n2; + TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aIt1; + TColStd_ListIteratorOfListOfInteger aItX, aItY; + TColStd_ListOfInteger aLIX; + TopTools_ListOfShape aLV; + TopoDS_Vertex aVnew; // - BOPTools_CArray1OfVVInterference& aVVs=myIntrPool->VVInterferences(); + myVSD.Clear(); // - // BlockLength correction - aNbVVs=ExpectedPoolLength(); - aBlockLength=aVVs.BlockLength(); - if (aNbVVs > aBlockLength) { - aVVs.SetBlockLength(aNbVVs); + const TColStd_DataMapOfIntegerListOfInteger& aMVSD=myDSIt->SDVertices(); + aNbVSD=aMVSD.Extent(); + if (!aNbVSD) { + return; } // - // V/V BooleanOperations_VertexVertex - myDSIt.Initialize(TopAbs_VERTEX, TopAbs_VERTEX); + BOPTools_CArray1OfVVInterference& aVVs=myIP->VVInterferences(); // - for (; myDSIt.More(); myDSIt.Next()) { - myDSIt.Current(n1, n2, bJustAddInterference); - // - if (!myIntrPool->IsComputed(n1, n2)) { - anIndexIn=0; - aWhat=n1; - aWith=n2; - SortTypes(aWhat, aWith); - if (!bJustAddInterference) { - const TopoDS_Shape& aS1=myDS->GetShape(aWhat); - const TopoDS_Shape& aS2=myDS->GetShape(aWith); - // - const TopoDS_Vertex& aV1=TopoDS::Vertex(aS1); - const TopoDS_Vertex& aV2=TopoDS::Vertex(aS2); - aFlag=IntTools_Tools::ComputeVV (aV1, aV2); - // - if (!aFlag) { - BOPTools_VVInterference anInterf (aWhat, aWith); - anIndexIn=aVVs.Append(anInterf); - } - } - myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexVertex, anIndexIn); - } + // BlockLength correction + myDSIt->Initialize(TopAbs_VERTEX, TopAbs_VERTEX); + aNbVVs=myDSIt->BlockLength(); + aBL=aVVs.BlockLength(); + if (aNbVVs > aBL) { + aVVs.SetBlockLength(aNbVVs); } - myIsDone=Standard_True; -} -//======================================================================= -// function: PerformNewVertices -// purpose: -//======================================================================= - void NMTTools_PaveFiller::PerformNewVertices() -{ - myIsDone=Standard_False; - // - Standard_Integer i, aNb, anIndex1, anIndex2, aNewShape; - TopoDS_Vertex aNewVertex; - BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; - // - Standard_Integer aNbChains, j, aNbV, aIdV, aNbL; - TColStd_IndexedMapOfInteger aMapWhole; - BOPTColStd_IndexedDataMapOfIntegerIndexedMapOfInteger aMapChains;//aMCV - TopTools_ListOfShape aLV; - TopTools_IndexedMapOfShape aM; // - // 1. VV Interferences - BOPTools_CArray1OfVVInterference& VVs=myIntrPool->VVInterferences(); - // - NMTTools_Tools::FindChains(VVs, aMapChains); - // - aNbChains=aMapChains.Extent(); - for (i=1; i<=aNbChains; ++i) { - const TColStd_IndexedMapOfInteger& aChain=aMapChains(i); - // - aM.Clear(); + aIt1.Initialize(aMVSD); + for (; aIt1.More(); aIt1.Next()) { aLV.Clear(); - aNbV=aChain.Extent(); - for (j=1; j<=aNbV; ++j) { - aIdV=aChain(j); - const TopoDS_Shape& aV=myDS->Shape(aIdV); - if (!aM.Contains(aV)) { - aM.Add(aV); - aLV.Append(aV); - } - } // - aNbL=aLV.Extent(); - if (aNbL==1){ - aNewShape=aChain(1); + n1=aIt1.Key(); + const TColStd_ListOfInteger& aLIV=aIt1.Value(); + // + // new vertex + const TopoDS_Shape& aS1=myDS->Shape(n1); + aLV.Append(aS1); + aItX.Initialize(aLIV); + for (; aItX.More(); aItX.Next()) { + n2=aItX.Value(); + const TopoDS_Shape& aS2=myDS->Shape(n2); + aLV.Append(aS2); } - else if (aNbL>1) { - // - // Make new Vertex - NMTTools_Tools::MakeNewVertex(aLV, aNewVertex); - // Insert New Vertex in DS; - // aNewShape is # of DS-line, where aNewVertex is kept - myDS->InsertShapeAndAncestorsSuccessors(aNewVertex, anASSeq); - aNewShape=myDS->NumberOfInsertedShapes(); - // - // State of New Vertex is ON - myDS->SetState (aNewShape, BooleanOperations_ON); + // + NMTTools_Tools::MakeNewVertex(aLV, aVnew); + // + BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq; + // + myDS->InsertShapeAndAncestorsSuccessors(aVnew, anASSeq); + nVnew=myDS->NumberOfInsertedShapes(); + myDS->SetState (nVnew, BooleanOperations_ON); + // + // myVSD, aLIX + aLIX.Clear(); + aLIX.Append(n1); + myVSD.Bind(n1, nVnew); + // + aItX.Initialize(aLIV); + for (; aItX.More(); aItX.Next()) { + n2=aItX.Value(); + aLIX.Append(n2); + myVSD.Bind(n2, nVnew); } // - // Insert New Vertex in Interference - aNb=VVs.Extent(); - for (j=1; j<=aNb; ++j) { - BOPTools_VVInterference& VV=VVs(j); - anIndex1=VV.Index1(); - anIndex2=VV.Index2(); - if (aChain.Contains(anIndex1) || aChain.Contains(anIndex2)) { - VV.SetNewShape(aNewShape); + // interferences + aItX.Initialize(aLIX); + for (i=0; aItX.More(); aItX.Next(), ++i) { + aItY.Initialize(aLIX); + for (j=0; aItY.More(); aItY.Next(), ++j) { + if (j>i) { + n1=aItX.Value(); + n2=aItY.Value(); + myIP->Add(n1, n2, Standard_True, NMTDS_TI_VV); + // + BOPTools_VVInterference aVV(n1, n2); + aVV.SetNewShape(nVnew); + aVVs.Append(aVV); + } } } - } + }//for (; aIt1.More(); aIt1.Next()) { myIsDone=Standard_True; } - //======================================================================= // function: FindSDVertex // purpose: //======================================================================= Standard_Integer NMTTools_PaveFiller::FindSDVertex(const Standard_Integer nV)const { - Standard_Integer i, aNb, anIndex1, anIndex2, aNewShape=0; - - BOPTools_CArray1OfVVInterference& VVs=myIntrPool->VVInterferences(); - aNb=VVs.Extent(); - - for (i=1; i<=aNb; i++) { - const BOPTools_VVInterference& VV=VVs(i); - anIndex1=VV.Index1(); - anIndex2=VV.Index2(); - if (nV==anIndex1 || nV==anIndex2) { - aNewShape=VV.NewShape(); - return aNewShape; - } + Standard_Integer nVSD; + // + nVSD=0; + if (myVSD.IsBound(nV)) { + nVSD=myVSD.Find(nV); } - return aNewShape; + return nVSD; +} +/* +//======================================================================= +// function: PerformNewVertices +// purpose: +//======================================================================= + void NMTTools_PaveFiller::PerformNewVertices() +{ } +*/