X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FGEOMAlgo%2FGEOMAlgo_VertexSolid.cxx;h=982e21921f602a39a10d68c1fa57ae6af7f5b6de;hb=dc562ec459ca37e90b612ce81b0312ce3ff1096b;hp=716bf0390599f4f1fe37e83f3baf9db07595b5ee;hpb=9499b99fe2dcb53e1ea364f97986f8f432b04600;p=modules%2Fgeom.git diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx index 716bf0390..982e21921 100644 --- a/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx @@ -1,29 +1,33 @@ -// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2007-2014 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 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// 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 +// 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: GEOMAlgo_VertexSolid.cxx -// Created: Wed Jan 12 16:36:40 2005 -// Author: Peter KURNEV -// +// File: GEOMAlgo_VertexSolid.cxx +// Created: Wed Jan 12 16:36:40 2005 +// Author: Peter KURNEV +// +// +#include -#include +#include #include @@ -42,23 +46,24 @@ #include #include - -#include - +// +#include +#if OCC_VERSION_LARGE > 0x06070100 #include - -#include -#include - -#include -#include -#include -#include -#include +#else +#include +#endif +// +#include +#include +#include +#include +#include +#include //======================================================================= //function : GEOMAlgo_VertexSolid -//purpose : +//purpose : //======================================================================= GEOMAlgo_VertexSolid::GEOMAlgo_VertexSolid() : @@ -67,14 +72,14 @@ GEOMAlgo_VertexSolid::GEOMAlgo_VertexSolid() } //======================================================================= //function : ~ -//purpose : +//purpose : //======================================================================= GEOMAlgo_VertexSolid::~GEOMAlgo_VertexSolid() { } //======================================================================= // function: Perform -// purpose: +// purpose: //======================================================================= void GEOMAlgo_VertexSolid::Perform() { @@ -85,154 +90,136 @@ void GEOMAlgo_VertexSolid::Perform() myErrorStatus=10; return; } - if(!myDSFiller->IsDone()) { + if(myDSFiller->ErrorStatus()) { myErrorStatus=11; return; } // - Standard_Boolean bIsNewFiller; - Standard_Integer aNbF; + Standard_Integer aNbF, aNbArgs; TopTools_IndexedMapOfShape aM; // - const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); - const TopoDS_Shape& aObj=aDS.Object(); + const BOPDS_DS& aDS=myDSFiller->DS(); + const BOPCol_ListOfShape& aLS=aDS.Arguments(); + aNbArgs=aLS.Extent(); + if (aNbArgs!=2) { + myErrorStatus=14; + return; + } + + const TopoDS_Shape& aObj=aLS.First(); // TopExp::MapShapes(aObj, TopAbs_FACE, aM); aNbF=aM.Extent(); - myRank=(aNbF) ? 2 : 1; + myRank=(aNbF) ? 1 : 0; // - bIsNewFiller=myDSFiller->IsNewFiller(); - - if (bIsNewFiller) { - Prepare(); - myDSFiller->SetNewFiller(!bIsNewFiller); - } BuildResult(); } // catch (Standard_Failure) { myErrorStatus = 12; } -} +} //======================================================================= -// function: Prepare -// purpose: +// function: BuildResult +// purpose: //======================================================================= -void GEOMAlgo_VertexSolid::Prepare() +void GEOMAlgo_VertexSolid::BuildResult() { - Standard_Integer i, iBeg, iEnd, aNbVV, j, n1, n2, iFound; + Standard_Integer i, iBeg, iEnd, aNbVV, aNbVE, aNbVF, j, iFound, aNbRanges; Standard_Real aTol; TopAbs_State aSt; TopAbs_ShapeEnum aType; - BooleanOperations_StateOfShape aState; gp_Pnt aP3D; // - const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); - BooleanOperations_ShapesDataStructure* pDS=(BooleanOperations_ShapesDataStructure*)&aDS; - const BOPTools_InterferencePool& aIP=myDSFiller->InterfPool(); - BOPTools_InterferencePool* pIP=(BOPTools_InterferencePool*) &aIP; - BOPTools_CArray1OfVVInterference& aVVs=pIP->VVInterferences(); - const BOPTools_PaveFiller& aPF=myDSFiller->PaveFiller(); - BOPTools_PaveFiller* pPF=(BOPTools_PaveFiller*)&aPF; - IntTools_Context& aCtx=pPF->ChangeContext(); + myLSIN.Clear(); + myLSOUT.Clear(); + myLSON.Clear(); + // + const BOPDS_DS& aDS=myDSFiller->DS(); + BOPDS_DS* pDS=(BOPDS_DS*)&aDS; // - const TopoDS_Shape& aObj=aDS.Object(); - const TopoDS_Shape& aTool=aDS.Tool(); + BOPDS_VectorOfInterfVV& aVVs=pDS->InterfVV(); + BOPDS_VectorOfInterfVE& aVEs=pDS->InterfVE(); + BOPDS_VectorOfInterfVF& aVFs=pDS->InterfVF(); // - const TopoDS_Solid& aSolid=(myRank==1) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj); - const TopoDS_Shape& aSV =(myRank==1)? aObj : aTool; + const BOPCol_ListOfShape& aLS=aDS.Arguments(); + const TopoDS_Shape& aObj=aLS.First(); // - BRepClass3d_SolidClassifier& aSC=aCtx.SolidClassifier(aSolid); + const TopoDS_Shape& aTool=aLS.Last(); + const TopoDS_Solid& aSolid=(myRank==0) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj); // - iBeg=1; - iEnd=aDS.NumberOfShapesOfTheObject(); - if (myRank==2) { - iBeg=iEnd+1; - iEnd=aDS.NumberOfSourceShapes(); - } +#if OCC_VERSION_LARGE > 0x06070100 + Handle(IntTools_Context) aCtx=myDSFiller->Context(); +#else + Handle(BOPInt_Context) aCtx=myDSFiller->Context(); +#endif + BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid); + // + aNbRanges=aDS.NbRanges(); + const BOPDS_IndexRange& aRange=aDS.Range(myRank); + aRange.Indices(iBeg, iEnd); // for (i=iBeg; i<=iEnd; ++i) { - aType=aDS.GetShapeType(i); + const TopoDS_Shape& aS=aDS.Shape(i); + aType=aS.ShapeType(); if (aType!=TopAbs_VERTEX) { - continue; + continue; } // - const TopoDS_Vertex& aV=TopoDS::Vertex(aDS.Shape(i)); - // - aState=aDS.GetState(i); - if (aState==BooleanOperations_ON || - aState==BooleanOperations_IN || - aState==BooleanOperations_OUT) { - continue; - } + const TopoDS_Vertex& aV=TopoDS::Vertex(aS); // iFound=0; + // + // 1 aNbVV=aVVs.Extent(); - for (j=1; j<=aNbVV; ++j) { - BOPTools_VVInterference& aVV=aVVs(j); - aVV.Indices(n1, n2); - if (n1==i || n2==i) { - pDS->SetState (n1, BooleanOperations_ON); - pDS->SetState (n2, BooleanOperations_ON); + for (j=0; jSetState (i, BooleanOperations_IN); + // 2 + aNbVE=aVEs.Extent(); + for (j=0; jSetState (i, BooleanOperations_OUT); + if (iFound) { + continue; } - } -} -//======================================================================= -// function: BuildResult -// purpose: -//======================================================================= -void GEOMAlgo_VertexSolid::BuildResult() -{ - const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS(); - // - Standard_Integer i, iBeg, iEnd; - TopAbs_ShapeEnum aType; - BooleanOperations_StateOfShape aState; - // - myLSIN.Clear(); - myLSOUT.Clear(); - myLSON.Clear(); - // - iBeg=1; - iEnd=aDS.NumberOfShapesOfTheObject(); - if (myRank==2) { - iBeg=iEnd+1; - iEnd=aDS.NumberOfSourceShapes(); - } - // - for (i=iBeg; i<=iEnd; ++i) { - aType=aDS.GetShapeType(i); - if (aType!=TopAbs_VERTEX) { - continue; + // 3 + aNbVF=aVFs.Extent(); + for (j=0; j