From bc7eea244978c24d9860a2149704dda40b810118 Mon Sep 17 00:00:00 2001 From: adv Date: Fri, 10 Jan 2014 09:23:33 +0000 Subject: [PATCH] Some useful methods. --- src/HYDROData/HYDROData_ShapesTool.cxx | 42 ++++++++++++++++++++++++++ src/HYDROData/HYDROData_ShapesTool.h | 33 ++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/src/HYDROData/HYDROData_ShapesTool.cxx b/src/HYDROData/HYDROData_ShapesTool.cxx index 9bf73f26..0d742e9f 100644 --- a/src/HYDROData/HYDROData_ShapesTool.cxx +++ b/src/HYDROData/HYDROData_ShapesTool.cxx @@ -16,6 +16,8 @@ #include #include +#include +#include #include @@ -90,4 +92,44 @@ bool HYDROData_ShapesTool::IsEdgesEquals( const TopoDS_Edge& theFirstEdge, IsVerticesEquals( aFLastVert, aSLastVert, theIs2D ); } +void HYDROData_ShapesTool::AddShapes( TopTools_SequenceOfShape& theShapes, + const TopTools_SequenceOfShape& theShapesToAdd ) +{ + for ( int i = 1, n = theShapesToAdd.Length(); i <= n; ++i ) + { + const TopoDS_Shape& aShape = theShapesToAdd.Value( i ); + theShapes.Append( aShape ); + } +} + +void HYDROData_ShapesTool::AddShapes( TopTools_SequenceOfShape& theShapes, + const TopTools_ListOfShape& theShapesToAdd ) +{ + TopTools_ListIteratorOfListOfShape anIter( theShapesToAdd ); + for ( ; anIter.More(); anIter.Next() ) + { + const TopoDS_Shape& aShape = anIter.Value(); + theShapes.Append( aShape ); + } +} +void HYDROData_ShapesTool::AddShapes( TopTools_ListOfShape& theShapes, + const TopTools_SequenceOfShape& theShapesToAdd ) +{ + for ( int i = 1, n = theShapesToAdd.Length(); i <= n; ++i ) + { + const TopoDS_Shape& aShape = theShapesToAdd.Value( i ); + theShapes.Append( aShape ); + } +} + +void HYDROData_ShapesTool::AddShapes( TopTools_ListOfShape& theShapes, + const TopTools_ListOfShape& theShapesToAdd ) +{ + TopTools_ListIteratorOfListOfShape anIter( theShapesToAdd ); + for ( ; anIter.More(); anIter.Next() ) + { + const TopoDS_Shape& aShape = anIter.Value(); + theShapes.Append( aShape ); + } +} diff --git a/src/HYDROData/HYDROData_ShapesTool.h b/src/HYDROData/HYDROData_ShapesTool.h index 893f4c50..c689a8ea 100644 --- a/src/HYDROData/HYDROData_ShapesTool.h +++ b/src/HYDROData/HYDROData_ShapesTool.h @@ -10,6 +10,7 @@ class TopoDS_Shape; class TopoDS_Vertex; class TopoDS_Edge; class TopTools_SequenceOfShape; +class TopTools_ListOfShape; class HYDRODATA_EXPORT HYDROData_ShapesTool { @@ -58,6 +59,38 @@ public: static bool IsEdgesEquals( const TopoDS_Edge& theFirstEdge, const TopoDS_Edge& theSecondEdge, const bool theIs2D = false ); + + /** + * \brief Adds the sequence of shapes to other sequence. + * \param theShapes sequence to which the shapes will be added + * \param theShapesToAdd sequence from which the shapes will be extracted + */ + static void AddShapes( TopTools_SequenceOfShape& theShapes, + const TopTools_SequenceOfShape& theShapesToAdd ); + + /** + * \brief Adds the list of shapes to the sequence. + * \param theShapes sequence to which the shapes will be added + * \param theShapesToAdd list from which the shapes will be extracted + */ + static void AddShapes( TopTools_SequenceOfShape& theShapes, + const TopTools_ListOfShape& theShapesToAdd ); + + /** + * \brief Adds the sequence of shapes to the list. + * \param theShapes list to which the shapes will be added + * \param theShapesToAdd sequence from which the shapes will be extracted + */ + static void AddShapes( TopTools_ListOfShape& theShapes, + const TopTools_SequenceOfShape& theShapesToAdd ); + + /** + * \brief Adds the list of shapes to other list. + * \param theShapes list to which the shapes will be added + * \param theShapesToAdd list from which the shapes will be extracted + */ + static void AddShapes( TopTools_ListOfShape& theShapes, + const TopTools_ListOfShape& theShapesToAdd ); }; -- 2.39.2