1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef HYDROData_ShapesTool_HeaderFile
24 #define HYDROData_ShapesTool_HeaderFile
26 #include "HYDROData.h"
28 #include <TopAbs_ShapeEnum.hxx>
33 class TopTools_SequenceOfShape;
34 class TopTools_ListOfShape;
36 class HYDRODATA_EXPORT HYDROData_ShapesTool {
41 * \brief Explore the incoming shape to shapes with given type.
42 * \param theInShape object to explore
43 * \param theExpType type to explore
44 * \param theOutShapes[out] list of result shapes if any
46 static void ExploreShapeToShapes( const TopoDS_Shape& theInShape,
47 const TopAbs_ShapeEnum& theExpType,
48 TopTools_SequenceOfShape& theOutShapes );
51 * \brief Gets the first and last vertex from shape. Shape can be an Edge or Wire.
52 * \param theInShape object to explore
53 * \param theFirstVertex[out] first shape vertex
54 * \param theLastVertex[out] last shape vertex
55 * \return true if shape is of correct type
57 static bool Vertices( const TopoDS_Shape& theInShape,
58 TopoDS_Vertex& theFirstVertex,
59 TopoDS_Vertex& theLastVertex,
60 const bool theIsCumOri = false );
63 * \brief Compare two vertices on coordinates equation.
64 * \param theFirstVert first vertex
65 * \param theSecondVert second vertex
66 * \param theIs2D flag indicating the 2D equation (ie. z coord will be ignored)
67 * \return \c true if cooredinates of vertices is equals
69 static bool IsVerticesEquals( const TopoDS_Vertex& theFirstVert,
70 const TopoDS_Vertex& theSecondVert,
71 const bool theIs2D = false );
74 * \brief Compare two edges on points coordinates equation.
75 * \param theFirstVert first edge
76 * \param theSecondVert second edge
77 * \param theIs2D flag indicating the 2D equation (ie. z coord will be ignored)
78 * \return \c true if coordinates of all points of given edges is equals
80 static bool IsEdgesEquals( const TopoDS_Edge& theFirstEdge,
81 const TopoDS_Edge& theSecondEdge,
82 const bool theIs2D = false );
85 * \brief Translate the shape to the given distance.
86 * \param theShape shape to translate
87 * \param theDx X vector component
88 * \param theDy Y vector component
89 * \param theDz Z vector component
90 * \return result translated shape
92 static TopoDS_Shape Translated( const TopoDS_Shape& theShape,
98 * \brief Adds the sequence of shapes to other sequence.
99 * \param theShapes sequence to which the shapes will be added
100 * \param theShapesToAdd sequence from which the shapes will be extracted
102 static void AddShapes( TopTools_SequenceOfShape& theShapes,
103 const TopTools_SequenceOfShape& theShapesToAdd );
106 * \brief Adds the list of shapes to the sequence.
107 * \param theShapes sequence to which the shapes will be added
108 * \param theShapesToAdd list from which the shapes will be extracted
110 static void AddShapes( TopTools_SequenceOfShape& theShapes,
111 const TopTools_ListOfShape& theShapesToAdd );
114 * \brief Adds the sequence of shapes to the list.
115 * \param theShapes list to which the shapes will be added
116 * \param theShapesToAdd sequence from which the shapes will be extracted
118 static void AddShapes( TopTools_ListOfShape& theShapes,
119 const TopTools_SequenceOfShape& theShapesToAdd );
122 * \brief Adds the list of shapes to other list.
123 * \param theShapes list to which the shapes will be added
124 * \param theShapesToAdd list from which the shapes will be extracted
126 static void AddShapes( TopTools_ListOfShape& theShapes,
127 const TopTools_ListOfShape& theShapesToAdd );
131 * \brief Explode and dump the shape to the stream.
133 static void DumpShapeSubShapes( std::ostream& theStream,
134 const char* theTitle,
135 const TopoDS_Shape& theShape,
136 const TopAbs_ShapeEnum& theExpType );
139 * \brief Dump the shapes sequence to the stream.
141 static void DumpSequenceOfShapes( std::ostream& theStream,
142 const TopTools_SequenceOfShape& theShapes );