X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FGEOMAlgo%2FGEOMAlgo_FinderShapeOn2.cxx;h=c919c9c77def6f3828e80aaeabcd43641ca2f121;hb=0c1af31f5408860fef60c451bb2692ffbc352d63;hp=b7f70f544ed4b07fec46b0e3595793abd1cc4dcd;hpb=392885c1a8d50369708bbe5e6b44033ed8b8ba51;p=modules%2Fgeom.git diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx index b7f70f544..c919c9c77 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx @@ -1,28 +1,29 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2011 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 +// 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 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. +// 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 +// 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_FinderShapeOn1.cxx -// Created: Fri Mar 4 10:31:06 2005 -// Author: Peter KURNEV -// + +// File: GEOMAlgo_FinderShapeOn1.cxx +// Created: Fri Mar 4 10:31:06 2005 +// Author: Peter KURNEV +// // #include #include @@ -285,10 +286,10 @@ } // if (!(myShapeType==TopAbs_VERTEX || - myShapeType==TopAbs_EDGE || - myShapeType==TopAbs_FACE || - myShapeType==TopAbs_SOLID)) { - myErrorStatus=12; // unallowed subshape type + myShapeType==TopAbs_EDGE || + myShapeType==TopAbs_FACE || + myShapeType==TopAbs_SOLID)) { + myErrorStatus=12; // unallowed sub-shape type return; } // @@ -331,7 +332,7 @@ // if (myShapeType==TopAbs_VERTEX){ if (bIsConformState) { - myMSS.Add(aV, aSt); + myMSS.Add(aV, aSt); } } else if (bIsConformState || aSt==TopAbs_ON) { @@ -368,11 +369,11 @@ // bIsConformState=myMSS.Contains(aV); if (!bIsConformState) { - break;// vertex has non-conformed state + break;// vertex has non-conformed state } else { - aSt=myMSS.FindFromKey(aV); - aSC.AppendState(aSt); + aSt=myMSS.FindFromKey(aV); + aSC.AppendState(aSt); } } // @@ -393,7 +394,7 @@ aC=BRep_Tool::Curve(aE, aT1, aT2); bCanBeON=myClsf->CanBeON(aC); if(!bCanBeON) { - continue; + continue; } } // @@ -406,9 +407,9 @@ aIt.Initialize(aLP); for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) { if (myNbPntsMax) { - if (iCnt > myNbPntsMax) { - break; - } + if (iCnt > myNbPntsMax) { + break; + } } // const gp_Pnt& aP=aIt.Value(); @@ -417,15 +418,15 @@ myClsf->Perform(); iErr=myClsf->ErrorStatus(); if (iErr) { - myErrorStatus=40; // point can not be classified - return; + myErrorStatus=40; // point can not be classified + return; } // aSt=myClsf->State(); // bIsToBreak=aSC.AppendState(aSt); if (bIsToBreak) { - break; + break; } } // @@ -434,7 +435,7 @@ bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); if (myShapeType==TopAbs_EDGE) { if (bIsConformState) { - myMSS.Add(aE, aSt); + myMSS.Add(aE, aSt); } } else if (bIsConformState || aSt==TopAbs_ON) { @@ -471,7 +472,7 @@ aS=BRep_Tool::Surface(aF); bCanBeON=myClsf->CanBeON(aS); if(!bCanBeON) { - continue; + continue; } } // @@ -480,11 +481,11 @@ const TopoDS_Shape& aE=aExp.Current(); bIsConformState=myMSS.Contains(aE); if (!bIsConformState) { - break;// edge has non-conformed state + break;// edge has non-conformed state } else { - aSt=myMSS.FindFromKey(aE); - aSC.AppendState(aSt); + aSt=myMSS.FindFromKey(aE); + aSC.AppendState(aSt); } } // @@ -501,9 +502,9 @@ aIt.Initialize(aLP); for (iCnt=0; aIt.More(); aIt.Next(), ++iCnt) { if (myNbPntsMax) { - if (iCnt > myNbPntsMax) { - break; - } + if (iCnt > myNbPntsMax) { + break; + } } // const gp_Pnt& aP=aIt.Value(); @@ -512,15 +513,15 @@ myClsf->Perform(); iErr=myClsf->ErrorStatus(); if (iErr) { - myErrorStatus=40; // point can not be classified - return; + myErrorStatus=40; // point can not be classified + return; } // aSt=myClsf->State(); // bIsToBreak=aSC.AppendState(aSt); if (bIsToBreak) { - break; + break; } } // @@ -529,7 +530,7 @@ bIsConformState=GEOMAlgo_SurfaceTools::IsConformState(aSt, myState); if (myShapeType==TopAbs_FACE) { if (bIsConformState) { - myMSS.Add(aF, aSt); + myMSS.Add(aF, aSt); } } else if (bIsConformState || aSt==TopAbs_ON) { @@ -563,11 +564,11 @@ const TopoDS_Shape& aF=aMF(j); bIsConformState=myMSS.Contains(aF); if (!bIsConformState) { - break;// face has non-conformed state + break;// face has non-conformed state } else { - aSt=myMSS.FindFromKey(aF); - aSC.AppendState(aSt); + aSt=myMSS.FindFromKey(aF); + aSC.AppendState(aSt); } } // @@ -589,7 +590,7 @@ //purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Face& aF, - GEOMAlgo_ListOfPnt& aLP) + GEOMAlgo_ListOfPnt& aLP) { myErrorStatus=0; // @@ -628,11 +629,11 @@ // aPK.SetIds(n[k], n[k+1]); if (aMPKI.IsBound(aPK)) { - Standard_Integer& iCntX=aMPKI.ChangeFind(aPK); - ++iCntX; + Standard_Integer& iCntX=aMPKI.ChangeFind(aPK); + ++iCntX; } else { - aMPKI.Bind(aPK, 1); + aMPKI.Bind(aPK, 1); } } } @@ -649,8 +650,8 @@ aNbMax=aPK.NbMax(); pIds=(Standard_Integer*)aPK.Key(); for (k=1; k<3; ++k) { - aNx=*(pIds+aNbMax-k); - aMBN.Add(aNx); + aNx=*(pIds+aNbMax-k); + aMBN.Add(aNx); } */ aNx=(Standard_Integer)aPK.Id(1); @@ -689,49 +690,49 @@ aNbLinks=aMPKI.Extent(); aIt.Initialize(aMPKI); for (; aIt.More(); aIt.Next()) { - iCnt=aIt.Value(); - if (iCnt>1) { - // take the first having occured inner link - // and discretize it - const GEOMAlgo_PassKey& aPK=aIt.Key(); - //qf - /* - aNbMax=aPK.NbMax(); - pIds=(Standard_Integer*)aPK.Key(); - aN1=*(pIds+aNbMax-1); - aN2=*(pIds+aNbMax-2); - */ - // - aN1=(Standard_Integer)aPK.Id(1); - aN2=(Standard_Integer)aPK.Id(2); - //qt - aP1=aNodes(aN1).Transformed(aTrsf); - aP2=aNodes(aN2).Transformed(aTrsf); - // - if (aType==GeomAbs_Cylinder) { - Standard_Real aTolSM; - gp_Cylinder aCyl; - // - aTolSM=1.523e-6;//~1.-cos(0.1 deg) - aCyl=aGAS.Cylinder(); - if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) { - continue; - } - } - // - BRepLib_MakeEdge aBME(aP1, aP2); - bIsDone=aBME.IsDone(); - if (!bIsDone) { - myErrorStatus=30; //can not obtain the line fron the link - return; - } - // - const TopoDS_Shape& aSx=aBME.Shape(); - const TopoDS_Edge& aE=TopoDS::Edge(aSx); - // - InnerPoints(aE, myNbPntsMin, aLP); - break; - }// if (iCnt>1) + iCnt=aIt.Value(); + if (iCnt>1) { + // take the first having occured inner link + // and discretize it + const GEOMAlgo_PassKey& aPK=aIt.Key(); + //qf + /* + aNbMax=aPK.NbMax(); + pIds=(Standard_Integer*)aPK.Key(); + aN1=*(pIds+aNbMax-1); + aN2=*(pIds+aNbMax-2); + */ + // + aN1=(Standard_Integer)aPK.Id(1); + aN2=(Standard_Integer)aPK.Id(2); + //qt + aP1=aNodes(aN1).Transformed(aTrsf); + aP2=aNodes(aN2).Transformed(aTrsf); + // + if (aType==GeomAbs_Cylinder) { + Standard_Real aTolSM; + gp_Cylinder aCyl; + // + aTolSM=1.523e-6;//~1.-cos(0.1 deg) + aCyl=aGAS.Cylinder(); + if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) { + continue; + } + } + // + BRepLib_MakeEdge aBME(aP1, aP2); + bIsDone=aBME.IsDone(); + if (!bIsDone) { + myErrorStatus=30; //can not obtain the line fron the link + return; + } + // + const TopoDS_Shape& aSx=aBME.Shape(); + const TopoDS_Edge& aE=TopoDS::Edge(aSx); + // + InnerPoints(aE, myNbPntsMin, aLP); + break; + }// if (iCnt>1) }// for (; aIt.More(); aIt.Next()) }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) }// if (!aNb && myNbPntsMin) { @@ -741,7 +742,7 @@ //purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE, - GEOMAlgo_ListOfPnt& aLP) + GEOMAlgo_ListOfPnt& aLP) { myErrorStatus=0; // @@ -797,8 +798,8 @@ //purpose : //======================================================================= void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE, - const Standard_Integer aNbPntsMin, - GEOMAlgo_ListOfPnt& aLP) + const Standard_Integer aNbPntsMin, + GEOMAlgo_ListOfPnt& aLP) { // try to fill it yourself Standard_Boolean bInf1, bInf2; @@ -832,7 +833,7 @@ // // 10 -myClsf=NULL // 11 -myShape=NULL -// 12 -unallowed type of subshapes +// 12 -unallowed type of sub-shapes // 13 -unallowed state // 15 -unallowed surface type // 20- no triangulation found