Back to index

salome-geom  6.5.0
NMTTools_PaveFiller_1.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File:        NMTTools_PaveFiller_1.cxx
00024 // Created:     Mon Dec  8 11:47:55 2003
00025 // Author:      Peter KURNEV
00026 //              <pkv@irinox>
00027 //
00028 #include <NMTTools_PaveFiller.hxx>
00029 
00030 #include <TColStd_DataMapOfIntegerListOfInteger.hxx>
00031 #include <TColStd_ListOfInteger.hxx>
00032 #include <TColStd_ListIteratorOfListOfInteger.hxx>
00033 #include <TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger.hxx>
00034 
00035 #include <TopoDS.hxx>
00036 #include <TopoDS_Shape.hxx>
00037 #include <TopoDS_Vertex.hxx>
00038 
00039 #include <TopTools_ListOfShape.hxx>
00040 
00041 #include <IntTools_Tools.hxx>
00042 #include <BooleanOperations_AncestorsSeqAndSuccessorsSeq.hxx>
00043 #include <BOPTools_VVInterference.hxx>
00044 #include <BOPTools_CArray1OfVVInterference.hxx>
00045 
00046 #include <NMTDS_Iterator.hxx>
00047 #include <NMTDS_InterfPool.hxx>
00048 #include <NMTDS_ShapesDataStructure.hxx>
00049 
00050 #include <NMTTools_Tools.hxx>
00051 
00052 //=======================================================================
00053 // function: PerformVV
00054 // purpose:
00055 //=======================================================================
00056   void NMTTools_PaveFiller::PerformVV()
00057 {
00058   myIsDone=Standard_False;
00059   //
00060   Standard_Integer aNbVVs, aBL, aNbVSD, nVnew, i, j, n1, n2;
00061   TColStd_DataMapIteratorOfDataMapOfIntegerListOfInteger aIt1;
00062   TColStd_ListIteratorOfListOfInteger aItX, aItY;
00063   TColStd_ListOfInteger aLIX;
00064   TopTools_ListOfShape aLV;
00065   TopoDS_Vertex aVnew;
00066   //
00067   myVSD.Clear();
00068   //
00069   const TColStd_DataMapOfIntegerListOfInteger& aMVSD=myDSIt->SDVertices();
00070   aNbVSD=aMVSD.Extent();
00071   if (!aNbVSD) {
00072     return;
00073   }
00074   //
00075   BOPTools_CArray1OfVVInterference& aVVs=myIP->VVInterferences();
00076   //
00077   // BlockLength correction
00078   myDSIt->Initialize(TopAbs_VERTEX, TopAbs_VERTEX);
00079   aNbVVs=myDSIt->BlockLength();
00080   aBL=aVVs.BlockLength();
00081   if (aNbVVs > aBL) {
00082     aVVs.SetBlockLength(aNbVVs);
00083   }
00084   //
00085   aIt1.Initialize(aMVSD);
00086   for (; aIt1.More(); aIt1.Next()) {
00087     aLV.Clear();
00088     //
00089     n1=aIt1.Key();
00090     const TColStd_ListOfInteger& aLIV=aIt1.Value();
00091     //
00092     // new vertex
00093     const TopoDS_Shape& aS1=myDS->Shape(n1);
00094     aLV.Append(aS1);
00095     aItX.Initialize(aLIV);
00096     for (; aItX.More(); aItX.Next()) {
00097       n2=aItX.Value();
00098       const TopoDS_Shape& aS2=myDS->Shape(n2);
00099       aLV.Append(aS2);
00100     }
00101     //
00102     NMTTools_Tools::MakeNewVertex(aLV, aVnew);
00103     //
00104     BooleanOperations_AncestorsSeqAndSuccessorsSeq anASSeq;
00105     //
00106     myDS->InsertShapeAndAncestorsSuccessors(aVnew, anASSeq);
00107     nVnew=myDS->NumberOfInsertedShapes();
00108     myDS->SetState (nVnew, BooleanOperations_ON);
00109     //
00110     // myVSD, aLIX
00111     aLIX.Clear();
00112     aLIX.Append(n1);
00113     myVSD.Bind(n1, nVnew);
00114     //
00115     aItX.Initialize(aLIV);
00116     for (; aItX.More(); aItX.Next()) {
00117       n2=aItX.Value();
00118       aLIX.Append(n2);
00119       myVSD.Bind(n2, nVnew);
00120     }
00121     //
00122     // interferences
00123     aItX.Initialize(aLIX);
00124     for (i=0; aItX.More(); aItX.Next(), ++i) {
00125       aItY.Initialize(aLIX);
00126       for (j=0; aItY.More(); aItY.Next(), ++j) {
00127         if (j>i) {
00128           n1=aItX.Value();
00129           n2=aItY.Value();
00130           myIP->Add(n1, n2, Standard_True, NMTDS_TI_VV);
00131           //
00132           BOPTools_VVInterference aVV(n1, n2);
00133           aVV.SetNewShape(nVnew);
00134           aVVs.Append(aVV);
00135         }
00136       }
00137     }
00138   }//for (; aIt1.More(); aIt1.Next()) {
00139   myIsDone=Standard_True;
00140 }
00141 //=======================================================================
00142 // function: FindSDVertex
00143 // purpose:
00144 //=======================================================================
00145   Standard_Integer NMTTools_PaveFiller::FindSDVertex(const Standard_Integer nV)const
00146 {
00147   Standard_Integer nVSD;
00148   //
00149   nVSD=0;
00150   if (myVSD.IsBound(nV)) {
00151     nVSD=myVSD.Find(nV);
00152   }
00153   return nVSD;
00154 }
00155 /*
00156 //=======================================================================
00157 // function: PerformNewVertices
00158 // purpose:
00159 //=======================================================================
00160   void NMTTools_PaveFiller::PerformNewVertices()
00161 {
00162 }
00163 */