Salome HOME
Merge remote-tracking branch 'origin/BR_LAND_COVER' into BR_v14_rc
[modules/hydro.git] / src / HYDROData / HYDROData_ShapesTool.h
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.
6 //
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.
11 //
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
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #ifndef HYDROData_ShapesTool_HeaderFile
20 #define HYDROData_ShapesTool_HeaderFile
21
22 #include "HYDROData.h"
23
24 #include <TopAbs_ShapeEnum.hxx>
25
26 class TopoDS_Shape;
27 class TopoDS_Vertex;
28 class TopoDS_Edge;
29 class TopTools_SequenceOfShape;
30 class TopTools_ListOfShape;
31
32 class HYDRODATA_EXPORT HYDROData_ShapesTool {
33
34 public:
35
36   /**
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
41    */
42   static void                           ExploreShapeToShapes( const TopoDS_Shape&       theInShape,
43                                                               const TopAbs_ShapeEnum&   theExpType,
44                                                               TopTools_SequenceOfShape& theOutShapes );
45
46   /**
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
52    */
53   static bool                           Vertices( const TopoDS_Shape& theInShape,
54                                                   TopoDS_Vertex&      theFirstVertex,
55                                                   TopoDS_Vertex&      theLastVertex,
56                                                   const bool          theIsCumOri = false );
57
58   /**
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
64    */
65   static bool                           IsVerticesEquals( const TopoDS_Vertex& theFirstVert,
66                                                           const TopoDS_Vertex& theSecondVert,
67                                                           const bool           theIs2D = false  );
68
69   /**
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
75    */
76   static bool                           IsEdgesEquals( const TopoDS_Edge& theFirstEdge,
77                                                        const TopoDS_Edge& theSecondEdge,
78                                                        const bool         theIs2D = false );
79
80   /**
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
87    */
88   static TopoDS_Shape                   Translated( const TopoDS_Shape& theShape,
89                                                     const double        theDx,
90                                                     const double        theDy,
91                                                     const double        theDz );
92
93   /**
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
97    */
98   static void                           AddShapes( TopTools_SequenceOfShape&       theShapes,
99                                                    const TopTools_SequenceOfShape& theShapesToAdd );
100
101   /**
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
105    */
106   static void                           AddShapes( TopTools_SequenceOfShape&   theShapes,
107                                                    const TopTools_ListOfShape& theShapesToAdd );
108
109   /**
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
113    */
114   static void                           AddShapes( TopTools_ListOfShape&           theShapes,
115                                                    const TopTools_SequenceOfShape& theShapesToAdd );
116
117   /**
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
121    */
122   static void                           AddShapes( TopTools_ListOfShape&       theShapes,
123                                                    const TopTools_ListOfShape& theShapesToAdd );
124
125
126   /**
127    * \brief Explode and dump the shape to the stream.
128    */
129   static void                           DumpShapeSubShapes( std::ostream&           theStream,
130                                                             const char*             theTitle,
131                                                             const TopoDS_Shape&     theShape,
132                                                             const TopAbs_ShapeEnum& theExpType );
133
134   /**
135    * \brief Dump the shapes sequence to the stream.
136    */
137   static void                           DumpSequenceOfShapes( std::ostream&                   theStream,
138                                                               const TopTools_SequenceOfShape& theShapes );
139 };
140
141
142 #endif
143
144