From: adv Date: Wed, 18 Dec 2013 06:56:38 +0000 (+0000) Subject: Explore shape to list of shapes method added. X-Git-Tag: BR_hydro_v_0_6~52 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5114139e76c36b62fa0c7134625324ac89090721;p=modules%2Fhydro.git Explore shape to list of shapes method added. --- diff --git a/src/HYDROData/HYDROData_Tool.cxx b/src/HYDROData/HYDROData_Tool.cxx index 68e759d7..d05696b7 100644 --- a/src/HYDROData/HYDROData_Tool.cxx +++ b/src/HYDROData/HYDROData_Tool.cxx @@ -6,6 +6,12 @@ #include "HYDROData_Iterator.h" #include "HYDROData_NaturalObject.h" +#include + +#include + +#include + #include #include #include @@ -156,3 +162,21 @@ bool HYDROData_Tool::IsGeometryObject( const Handle(HYDROData_Entity)& theObject return theObject->IsKind( STANDARD_TYPE(HYDROData_ArtificialObject) ) || theObject->IsKind( STANDARD_TYPE(HYDROData_NaturalObject) ); } + +void HYDROData_Tool::ExploreShapeToShapes( const TopoDS_Shape& theInShape, + const TopAbs_ShapeEnum& theExpType, + TopTools_SequenceOfShape& theOutShapes ) +{ + theOutShapes.Clear(); + + if ( theInShape.IsNull() ) + return; + + TopExp_Explorer anExp( theInShape, theExpType ); + for ( ; anExp.More(); anExp.Next() ) + { + TopoDS_Shape anExpShape = anExp.Current(); + theOutShapes.Append( anExpShape ); + } +} + diff --git a/src/HYDROData/HYDROData_Tool.h b/src/HYDROData/HYDROData_Tool.h index cb1506e0..6aaf6eeb 100644 --- a/src/HYDROData/HYDROData_Tool.h +++ b/src/HYDROData/HYDROData_Tool.h @@ -7,10 +7,14 @@ #include +#include + #include #include class QFile; +class TopoDS_Shape; +class TopTools_SequenceOfShape; class Handle(HYDROData_Document); class HYDRODATA_EXPORT HYDROData_Tool { @@ -69,6 +73,16 @@ public: */ static bool IsGeometryObject( const Handle(HYDROData_Entity)& theObject ); + /** + * \brief Explore the incoming shape to shapes with given type. + * \param theInShape object to explore + * \param theExpType type to explore + * \param theOutShapes[out] list of result shapes if any + */ + static void ExploreShapeToShapes( const TopoDS_Shape& theInShape, + const TopAbs_ShapeEnum& theExpType, + TopTools_SequenceOfShape& theOutShapes ); + }; inline bool ValuesEquals( const double& theFirst, const double& theSecond )