Salome HOME
change def hasher for indexed map
[modules/hydro.git] / src / HYDROData / HYDROData_GeomTool.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_GeomTool_HeaderFile
20 #define HYDROData_GeomTool_HeaderFile
21
22 #include "HYDROData.h"
23 #include <NCollection_IndexedDataMap.hxx>
24 #include <TopTools_ShapeMapHasher.hxx>
25
26 #ifdef WIN32
27   #pragma warning ( disable: 4251 )
28 #endif
29
30 #ifndef LIGHT_MODE
31 #include <GEOM_Client.hxx>
32
33 #ifdef WIN32
34   #pragma warning ( default: 4251 )
35 #endif
36
37 class TopoDS_Shape;
38 class QString;
39
40 class HYDRODATA_EXPORT HYDROData_GeomTool {
41
42 public:
43
44   /**
45    * \brief Get shape by the specified IOR.
46    * \param theIOR the GEOM object IOR
47    * \param theStudyId the study ID
48    * \return the shape
49    */
50   static TopoDS_Shape GetShapeFromIOR( const int theStudyId, const QString& theIOR );
51
52   /**
53    * \brief Get GEOM engine.
54    * \return the GEOM engine
55    */
56   static GEOM::GEOM_Gen_var GetGeomGen();
57
58   /**
59    * \brief Get shape by the specified study ID.
60    * \param theStudyId the study ID
61    * \return the study
62    */
63   static SALOMEDS::Study_var GetStudyByID( const int theStudyId );
64
65   /**
66    * \brief Get free name for GEOM object.
67    * \param theStudy the study
68    * \param theBaseName the base name
69    * \return the default name
70    */
71   static QString GetFreeName( SALOMEDS::Study_ptr theStudy, const QString& theBaseName );
72
73   /**
74    * Publish the given shape in GEOM as a GEOM object.
75    * \param theGeomEngine GEOM module engine
76    * \param theStudy SALOMEDS study, used for publishing of the shape
77    * \param theShape the shape to publish as a GEOM object
78    * \param theName the name of the published object
79    * \param theGeomObjEntry the entry of the published object
80    * \return the published GEOM object
81    */
82   static GEOM::GEOM_Object_ptr publishShapeInGEOM( GEOM::GEOM_Gen_var  theGeomEngine,
83                                                    SALOMEDS::Study_ptr theStudy,
84                                                    const TopoDS_Shape& theShape, 
85                                                    const QString&      theName,
86                                                    QString& theGeomObjEntry );
87
88   /**
89    * Create and publish face in GEOM as a GEOM object.
90    * \param theGeomEngine GEOM module engine
91    * \param theStudy SALOMEDS study, used for publishing of the face
92    * \param theWidth the face width
93    * \param theHeight the face height
94    * \param theName the name of the published face
95    * \param theFaceEntry the entry of the published face
96    * \return the published GEOM object
97    */
98   static GEOM::GEOM_Object_ptr createFaceInGEOM( GEOM::GEOM_Gen_var theGeomEngine,
99                                                  SALOMEDS::Study_ptr theStudy,
100                                                  const int theWidth,
101                                                  const int theHeight,
102                                                  const QString& theName,
103                                                  QString& theFaceEntry );
104
105   /**
106    * Publish the given GEOM object in the study.
107    * \param theGeomEngine GEOM module engine
108    * \param theStudy SALOMEDS study, used for publishing of the object
109    * \param theGeomObj the GEOM object
110    * \param theName the object name
111    * \return the entry of the published object (empty string in case of fail)
112    */
113   static QString publishGEOMObject( GEOM::GEOM_Gen_var theGeomEngine,
114                                     SALOMEDS::Study_ptr theStudy,
115                                     GEOM::GEOM_Object_ptr theGeomObj,
116                                     const QString& theName );
117
118   static GEOM::GEOM_Object_ptr ExplodeShapeInGEOMandPublish( GEOM::GEOM_Gen_var theGeomEngine, 
119                                                       SALOMEDS::Study_ptr theStudy, 
120                                                       const TopoDS_Shape& theShape, 
121                                                       const NCollection_IndexedDataMap<TopoDS_Shape, QString, TopTools_ShapeMapHasher>& aFacesToNameModif,
122                                                       const QString& theName,
123                                                       QString& theGeomObjEntry);
124
125 };
126
127 #endif
128
129 #endif
130
131