X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMAlgo%2FGEOMAlgo_ShapeInfoFiller_1.cxx;h=408b58b5045b25057f99a7574b936460e2be7766;hb=d22d69e315de7e0705e63e3838d1111b0bea0b30;hp=891b9c772b682e590f15cc4fccc6f64f0abe3b05;hpb=239f8109c64fa0c5a2e1d87a420bad5529b57f48;p=modules%2Fgeom.git diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx index 891b9c772..408b58b50 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx @@ -1,3 +1,22 @@ +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE +// +// 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 +// + #include #include @@ -58,13 +77,13 @@ GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF); aKNF=aInfoF.KindOfName(); // mb: sphere, torus if (aKNF==GEOMAlgo_KN_SPHERE || - aKNF==GEOMAlgo_KN_TORUS) { + aKNF==GEOMAlgo_KN_TORUS) { aInfo.SetKindOfName(aKNF); aInfo.SetLocation(aInfoF.Location()); aInfo.SetPosition(aInfoF.Position()); aInfo.SetRadius1(aInfoF.Radius1()); if(aKNF==GEOMAlgo_KN_TORUS) { - aInfo.SetRadius2(aInfoF.Radius2()); + aInfo.SetRadius2(aInfoF.Radius2()); } return; } @@ -91,8 +110,8 @@ ++aNbCrc; } else if (aKNF==GEOMAlgo_KN_POLYGON || - aKNF==GEOMAlgo_KN_TRIANGLE || - aKNF==GEOMAlgo_KN_QUADRANGLE) { + aKNF==GEOMAlgo_KN_TRIANGLE || + aKNF==GEOMAlgo_KN_QUADRANGLE) { ++aNbPgn; } @@ -179,7 +198,7 @@ // for (j=i+1; j<=aNbF; ++j) { if (aMp.Contains(j)) { - continue; + continue; } // const TopoDS_Shape& aFj=aMF(j); @@ -188,10 +207,10 @@ // aDot=aDNi*aDNj; if (fabs(1.-aDot)<0.0001) { - aMp.Add(i); - aMp.Add(j); - aMFi.Add(aFi); - break; + aMp.Add(i); + aMp.Add(j); + aMFi.Add(aFi); + break; } // } @@ -246,7 +265,7 @@ //purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Pln& aPln) + const gp_Pln& aPln) { Standard_Integer aNbV, aNbE, i, j; Standard_Real aDot, aD0, aD1, aLength, aWidth; @@ -315,7 +334,7 @@ const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); aKNE=aInfoE.KindOfName(); if (aKNE!=GEOMAlgo_KN_SEGMENT) { - return; + return; } } // @@ -327,11 +346,11 @@ aXYZc.SetCoord(0.,0.,0.); TopExp::MapShapes(aF, TopAbs_VERTEX, aMV); for (i=1; i<=aNbV; ++i) { - const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i)); - aP=BRep_Tool::Pnt(aV); - const gp_XYZ& aXYZ=aP.XYZ(); - aXYZc=aXYZc+aXYZ; - aPx[i-1]=aP; + const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i)); + aP=BRep_Tool::Pnt(aV); + const gp_XYZ& aXYZ=aP.XYZ(); + aXYZc=aXYZc+aXYZ; + aPx[i-1]=aP; } aXYZc.Divide(3.); // @@ -373,8 +392,8 @@ j=(i==3) ? 0 : i+1; aDot=aDx[i]*aDx[j]; if (fabs (aDot) > myTolerance) { - aInfo.SetKindOfName(GEOMAlgo_KN_QUADRANGLE); - return; + aInfo.SetKindOfName(GEOMAlgo_KN_QUADRANGLE); + return; } } // @@ -433,7 +452,7 @@ //purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Sphere& ) + const gp_Sphere& ) { Standard_Integer aNbV, aNbE, aNbSE, aNbDE; TopoDS_Edge aE; @@ -465,10 +484,10 @@ aKSE=aInfoE.KindOfShape(); // if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; + ++aNbSE; } else if (aKSE==GEOMAlgo_KS_DEGENERATED) { - ++aNbDE; + ++aNbDE; } } } @@ -483,7 +502,7 @@ //purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Cone& )//aCone) + const gp_Cone& )//aCone) { Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i; Standard_Real aR[3], aHeight; @@ -529,34 +548,34 @@ aKCE=aInfoE.KindOfClosed(); aKSE=aInfoE.KindOfShape(); if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) { - aPC[i]=aInfoE.Location(); - aR[i]=aInfoE.Radius1(); - // - aIt.Initialize(aE); - for (; aIt.More(); aIt.Next()) { - aVD=TopoDS::Vertex(aIt.Value()); - break; - } - aPX[i]=BRep_Tool::Pnt(aVD); - // - ++i; - ++aNbCE; + aPC[i]=aInfoE.Location(); + aR[i]=aInfoE.Radius1(); + // + aIt.Initialize(aE); + for (; aIt.More(); aIt.Next()) { + aVD=TopoDS::Vertex(aIt.Value()); + break; + } + aPX[i]=BRep_Tool::Pnt(aVD); + // + ++i; + ++aNbCE; } else if (aKNE==GEOMAlgo_KN_SEGMENT) { - if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; - } + if (BRep_Tool::IsClosed(aE, aF)) { + ++aNbSE; + } } else if (aKSE==GEOMAlgo_KS_DEGENERATED) { - aIt.Initialize(aE); - for (; aIt.More(); aIt.Next()) { - aVD=TopoDS::Vertex(aIt.Value()); - break; - } - // - aPD=BRep_Tool::Pnt(aVD); - // - ++aNbDE; + aIt.Initialize(aE); + for (; aIt.More(); aIt.Next()) { + aVD=TopoDS::Vertex(aIt.Value()); + break; + } + // + aPD=BRep_Tool::Pnt(aVD); + // + ++aNbDE; } } } @@ -612,7 +631,7 @@ //purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Cylinder& aCyl) + const gp_Cylinder& aCyl) { Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE; Standard_Real aT0, aT1, aHeight; @@ -654,13 +673,13 @@ aKNE=aInfoE.KindOfName(); aKCE=aInfoE.KindOfClosed(); if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) { - aPC[aNbCE]=aInfoE.Location(); - ++aNbCE; + aPC[aNbCE]=aInfoE.Location(); + ++aNbCE; } else if (aKNE==GEOMAlgo_KN_SEGMENT) { - if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; - } + if (BRep_Tool::IsClosed(aE, aF)) { + ++aNbSE; + } } } } @@ -697,7 +716,7 @@ //purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Torus& ) + const gp_Torus& ) { Standard_Integer aNbV, aNbE, aNbSE; TopoDS_Edge aE; @@ -726,7 +745,7 @@ if (aM.Add(aE)) { //const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; + ++aNbSE; } } }