1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROData_ShapesTool_HeaderFile
20 #define HYDROData_ShapesTool_HeaderFile
22 #include "HYDROData.h"
24 #include <TopAbs_ShapeEnum.hxx>
29 class TopTools_SequenceOfShape;
30 class TopTools_ListOfShape;
32 class HYDRODATA_EXPORT HYDROData_ShapesTool {
37 * \brief Explore the incoming shape to shapes with given type.
38 * \param theInShape object to explore
39 * \param theExpType type to explore
40 * \param theOutShapes[out] list of result shapes if any
42 static void ExploreShapeToShapes( const TopoDS_Shape& theInShape,
43 const TopAbs_ShapeEnum& theExpType,
44 TopTools_SequenceOfShape& theOutShapes );
47 * \brief Gets the first and last vertex from shape. Shape can be an Edge or Wire.
48 * \param theInShape object to explore
49 * \param theFirstVertex[out] first shape vertex
50 * \param theLastVertex[out] last shape vertex
51 * \return true if shape is of correct type
53 static bool Vertices( const TopoDS_Shape& theInShape,
54 TopoDS_Vertex& theFirstVertex,
55 TopoDS_Vertex& theLastVertex,
56 const bool theIsCumOri = false );
59 * \brief Compare two vertices on coordinates equation.
60 * \param theFirstVert first vertex
61 * \param theSecondVert second vertex
62 * \param theIs2D flag indicating the 2D equation (ie. z coord will be ignored)
63 * \return \c true if cooredinates of vertices is equals
65 static bool IsVerticesEquals( const TopoDS_Vertex& theFirstVert,
66 const TopoDS_Vertex& theSecondVert,
67 const bool theIs2D = false );
70 * \brief Compare two edges on points coordinates equation.
71 * \param theFirstVert first edge
72 * \param theSecondVert second edge
73 * \param theIs2D flag indicating the 2D equation (ie. z coord will be ignored)
74 * \return \c true if coordinates of all points of given edges is equals
76 static bool IsEdgesEquals( const TopoDS_Edge& theFirstEdge,
77 const TopoDS_Edge& theSecondEdge,
78 const bool theIs2D = false );
81 * \brief Translate the shape to the given distance.
82 * \param theShape shape to translate
83 * \param theDx X vector component
84 * \param theDy Y vector component
85 * \param theDz Z vector component
86 * \return result translated shape
88 static TopoDS_Shape Translated( const TopoDS_Shape& theShape,
94 * \brief Adds the sequence of shapes to other sequence.
95 * \param theShapes sequence to which the shapes will be added
96 * \param theShapesToAdd sequence from which the shapes will be extracted
98 static void AddShapes( TopTools_SequenceOfShape& theShapes,
99 const TopTools_SequenceOfShape& theShapesToAdd );
102 * \brief Adds the list of shapes to the sequence.
103 * \param theShapes sequence to which the shapes will be added
104 * \param theShapesToAdd list from which the shapes will be extracted
106 static void AddShapes( TopTools_SequenceOfShape& theShapes,
107 const TopTools_ListOfShape& theShapesToAdd );
110 * \brief Adds the sequence of shapes to the list.
111 * \param theShapes list to which the shapes will be added
112 * \param theShapesToAdd sequence from which the shapes will be extracted
114 static void AddShapes( TopTools_ListOfShape& theShapes,
115 const TopTools_SequenceOfShape& theShapesToAdd );
118 * \brief Adds the list of shapes to other list.
119 * \param theShapes list to which the shapes will be added
120 * \param theShapesToAdd list from which the shapes will be extracted
122 static void AddShapes( TopTools_ListOfShape& theShapes,
123 const TopTools_ListOfShape& theShapesToAdd );
127 * \brief Explode and dump the shape to the stream.
129 static void DumpShapeSubShapes( std::ostream& theStream,
130 const char* theTitle,
131 const TopoDS_Shape& theShape,
132 const TopAbs_ShapeEnum& theExpType );
135 * \brief Dump the shapes sequence to the stream.
137 static void DumpSequenceOfShapes( std::ostream& theStream,
138 const TopTools_SequenceOfShape& theShapes );