From 5114139e76c36b62fa0c7134625324ac89090721 Mon Sep 17 00:00:00 2001 From: adv Date: Wed, 18 Dec 2013 06:56:38 +0000 Subject: [PATCH] Explore shape to list of shapes method added. --- src/HYDROData/HYDROData_Tool.cxx | 24 ++++++++++++++++++++++++ src/HYDROData/HYDROData_Tool.h | 14 ++++++++++++++ 2 files changed, 38 insertions(+) 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 ) -- 2.39.2