From 1b3576a2319ff0703ffb09bfb15c3f2e32eda545 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 20 Aug 2009 08:26:14 +0000 Subject: [PATCH] 0020452: EDF 1056 SMESH : 2D Projection Issue static int GetOrderedEdges (const TopoDS_Face& theFace, TopoDS_Vertex theFirstVertex, std::list< TopoDS_Edge >& theEdges, - std::list< int > & theNbVertexInWires); + std::list< int > & theNbVertexInWires, + const bool theShapeAnalysisAlgo=false); --- src/SMESH/SMESH_Block.cxx | 31 ++++++++++++++++++++++--------- src/SMESH/SMESH_Block.hxx | 7 +++++-- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/SMESH/SMESH_Block.cxx b/src/SMESH/SMESH_Block.cxx index fd4edab32..59971bfee 100644 --- a/src/SMESH/SMESH_Block.cxx +++ b/src/SMESH/SMESH_Block.cxx @@ -952,26 +952,39 @@ int SMESH_Block::GetShapeIDByParams ( const gp_XYZ& theCoord ) return id + 1; // shape ids start at 1 } -//======================================================================= -//function : GetOrderedEdges -//purpose : return nb wires and a list of oredered edges -//======================================================================= +//================================================================================ +/*! + * \brief Return number of wires and a list of oredered edges. + * \param theFace - the face to process + * \param theFirstVertex - the vertex of the outer wire to set first in the returned + * list ( theFirstVertex may be NULL ) + * \param theEdges - all ordered edges of theFace (outer edges goes first). + * \param theNbVertexInWires - nb of vertices (== nb of edges) in each wire + * \param theShapeAnalysisAlgo - if true, ShapeAnalysis::OuterWire() is used to find + * the outer wire else BRepTools::OuterWire() is used. + * \retval int - nb of wires + * + * Always try to set a seam edge first. + * BRepTools::OuterWire() fails e.g. in the case of issue 0020184, + * ShapeAnalysis::OuterWire() fails in the case of issue 0020452 + */ +//================================================================================ int SMESH_Block::GetOrderedEdges (const TopoDS_Face& theFace, TopoDS_Vertex theFirstVertex, list< TopoDS_Edge >& theEdges, - list< int > & theNbVertexInWires) + list< int > & theNbVertexInWires, + const bool theShapeAnalysisAlgo) { // put wires in a list, so that an outer wire comes first list aWireList; - //TopoDS_Wire anOuterWire = BRepTools::OuterWire( theFace ); ### issue 0020184 - TopoDS_Wire anOuterWire = ShapeAnalysis::OuterWire( theFace ); - //aWireList.push_back( anOuterWire ); ### issue 0020184 + TopoDS_Wire anOuterWire = + theShapeAnalysisAlgo ? ShapeAnalysis::OuterWire( theFace ) : BRepTools::OuterWire( theFace ); for ( TopoDS_Iterator wIt (theFace); wIt.More(); wIt.Next() ) if ( !anOuterWire.IsSame( wIt.Value() )) aWireList.push_back( TopoDS::Wire( wIt.Value() )); else - aWireList.push_front( TopoDS::Wire( wIt.Value() ));// ### issue 0020184 + aWireList.push_front( TopoDS::Wire( wIt.Value() )); // loop on edges of wires theNbVertexInWires.clear(); diff --git a/src/SMESH/SMESH_Block.hxx b/src/SMESH/SMESH_Block.hxx index 3de8c3c5b..97caf6116 100644 --- a/src/SMESH/SMESH_Block.hxx +++ b/src/SMESH/SMESH_Block.hxx @@ -137,7 +137,7 @@ class SMESH_EXPORT SMESH_Block: public math_FunctionSetWithDerivatives static int GetShapeIDByParams ( const gp_XYZ& theParams ); // define an id of the block sub-shape by point parameters - static ostream& DumpShapeID (const int theBlockShapeID, ostream& stream); + static std::ostream& DumpShapeID (const int theBlockShapeID, std::ostream& stream); // DEBUG: dump an id of a block sub-shape @@ -276,11 +276,14 @@ public: static int GetOrderedEdges (const TopoDS_Face& theFace, TopoDS_Vertex theFirstVertex, std::list< TopoDS_Edge >& theEdges, - std::list< int > & theNbVertexInWires); + std::list< int > & theNbVertexInWires, + const bool theShapeAnalysisAlgo=false); // Return nb wires and a list of oredered edges. // It is used to assign indices to subshapes. // theFirstVertex may be NULL. // Always try to set a seam edge first + // if (theShapeAnalysisAlgo) then ShapeAnalysis::OuterWire() is used to find the outer + // wire else BRepTools::OuterWire() is used public: // ----------------------------------------------------------- -- 2.39.2