]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Explore shape to list of shapes method added.
authoradv <adv@opencascade.com>
Wed, 18 Dec 2013 06:56:38 +0000 (06:56 +0000)
committeradv <adv@opencascade.com>
Wed, 18 Dec 2013 06:56:38 +0000 (06:56 +0000)
src/HYDROData/HYDROData_Tool.cxx
src/HYDROData/HYDROData_Tool.h

index 68e759d729dc1ba2c6bf485ed9d56df19aa64885..d05696b77801cfdc49df41a44322ab9fd036ccaa 100644 (file)
@@ -6,6 +6,12 @@
 #include "HYDROData_Iterator.h"
 #include "HYDROData_NaturalObject.h"
 
+#include <TopoDS_Shape.hxx>
+
+#include <TopTools_SequenceOfShape.hxx>
+
+#include <TopExp_Explorer.hxx>
+
 #include <QFile>
 #include <QStringList>
 #include <QTextStream>
@@ -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 );
+  }
+}
+
index cb1506e05a9a280a6c4bb6de5981a3b54439d57e..6aaf6eeb6931da53ed0781dd277894b0c706346a 100644 (file)
@@ -7,10 +7,14 @@
 
 #include <Precision.hxx>
 
+#include <TopAbs_ShapeEnum.hxx>
+
 #include <QString>
 #include <QStringList>
 
 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 )