Salome HOME
Merge branch 'master' of ssh://git.salome-platform.org/modules/hydro
[modules/hydro.git] / src / HYDROData / HYDROData_ShapesTool.h
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef HYDROData_ShapesTool_HeaderFile
24 #define HYDROData_ShapesTool_HeaderFile
25
26 #include "HYDROData.h"
27
28 #include <TopAbs_ShapeEnum.hxx>
29
30 class TopoDS_Shape;
31 class TopoDS_Vertex;
32 class TopoDS_Edge;
33 class TopTools_SequenceOfShape;
34 class TopTools_ListOfShape;
35
36 class HYDRODATA_EXPORT HYDROData_ShapesTool {
37
38 public:
39
40   /**
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
45    */
46   static void                           ExploreShapeToShapes( const TopoDS_Shape&       theInShape,
47                                                               const TopAbs_ShapeEnum&   theExpType,
48                                                               TopTools_SequenceOfShape& theOutShapes );
49
50   /**
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
56    */
57   static bool                           Vertices( const TopoDS_Shape& theInShape,
58                                                   TopoDS_Vertex&      theFirstVertex,
59                                                   TopoDS_Vertex&      theLastVertex,
60                                                   const bool          theIsCumOri = false );
61
62   /**
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
68    */
69   static bool                           IsVerticesEquals( const TopoDS_Vertex& theFirstVert,
70                                                           const TopoDS_Vertex& theSecondVert,
71                                                           const bool           theIs2D = false  );
72
73   /**
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
79    */
80   static bool                           IsEdgesEquals( const TopoDS_Edge& theFirstEdge,
81                                                        const TopoDS_Edge& theSecondEdge,
82                                                        const bool         theIs2D = false );
83
84   /**
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
91    */
92   static TopoDS_Shape                   Translated( const TopoDS_Shape& theShape,
93                                                     const double        theDx,
94                                                     const double        theDy,
95                                                     const double        theDz );
96
97   /**
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
101    */
102   static void                           AddShapes( TopTools_SequenceOfShape&       theShapes,
103                                                    const TopTools_SequenceOfShape& theShapesToAdd );
104
105   /**
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
109    */
110   static void                           AddShapes( TopTools_SequenceOfShape&   theShapes,
111                                                    const TopTools_ListOfShape& theShapesToAdd );
112
113   /**
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
117    */
118   static void                           AddShapes( TopTools_ListOfShape&           theShapes,
119                                                    const TopTools_SequenceOfShape& theShapesToAdd );
120
121   /**
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
125    */
126   static void                           AddShapes( TopTools_ListOfShape&       theShapes,
127                                                    const TopTools_ListOfShape& theShapesToAdd );
128
129
130   /**
131    * \brief Explode and dump the shape to the stream.
132    */
133   static void                           DumpShapeSubShapes( std::ostream&           theStream,
134                                                             const char*             theTitle,
135                                                             const TopoDS_Shape&     theShape,
136                                                             const TopAbs_ShapeEnum& theExpType );
137
138   /**
139    * \brief Dump the shapes sequence to the stream.
140    */
141   static void                           DumpSequenceOfShapes( std::ostream&                   theStream,
142                                                               const TopTools_SequenceOfShape& theShapes );
143 };
144
145
146 #endif
147
148