Salome HOME
Update copyright notes (for 2010)
[modules/smesh.git] / src / StdMeshers_I / StdMeshers_QuadrangleParams_i.cxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  This library is free software; you can redistribute it and/or
4 //  modify it under the terms of the GNU Lesser General Public
5 //  License as published by the Free Software Foundation; either
6 //  version 2.1 of the License.
7 //
8 //  This library is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //  Lesser General Public License for more details.
12 //
13 //  You should have received a copy of the GNU Lesser General Public
14 //  License along with this library; if not, write to the Free Software
15 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
21 //  File   : StdMeshers_QuadrangleParams_i.cxx
22 //  Author : Sergey KUUL, OCC
23 //  Module : SMESH
24 //  $Header$
25 //
26 #include "StdMeshers_QuadrangleParams_i.hxx"
27 #include "SMESH_Gen_i.hxx"
28 #include "SMESH_Gen.hxx"
29 #include "SMESH_PythonDump.hxx"
30
31 #include "Utils_CorbaException.hxx"
32 #include "utilities.h"
33
34 #include <TCollection_AsciiString.hxx>
35
36 using namespace std;
37
38 //=============================================================================
39 /*!
40  *  StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i
41  *
42  *  Constructor
43  */
44 //=============================================================================
45
46 StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i
47                                           (PortableServer::POA_ptr thePOA,
48                                            int                     theStudyId,
49                                            ::SMESH_Gen*            theGenImpl )
50      : SALOME::GenericObj_i( thePOA ), 
51        SMESH_Hypothesis_i( thePOA )
52 {
53   MESSAGE( "StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i" );
54   myBaseImpl = new ::StdMeshers_QuadrangleParams(theGenImpl->GetANewId(),
55                                                  theStudyId,
56                                                  theGenImpl);
57 }
58
59 //=============================================================================
60 /*!
61  *  StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i
62  *
63  *  Destructor
64  */
65 //=============================================================================
66
67 StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i()
68 {
69   MESSAGE( "StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i" );
70 }
71
72 //=============================================================================
73 /*!
74  *  StdMeshers_QuadrangleParams_i::SetTriaVertex
75  *
76  *  Set base vertex for triangles
77  */
78 //=============================================================================
79
80 void StdMeshers_QuadrangleParams_i::SetTriaVertex(CORBA::Long vertID)
81 {
82   MESSAGE( "StdMeshers_QuadrangleParams_i::SetTriaVertex" );
83   ASSERT( myBaseImpl );
84   try {
85     this->GetImpl()->SetTriaVertex( vertID );
86   }
87   catch ( SALOME_Exception& S_ex ) {
88     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
89                                   SALOME::BAD_PARAM );
90   }
91
92   // Update Python script
93   SMESH::TPythonDump() << _this() << ".SetTriaVertex( "
94       << vertID << " )";
95 }
96
97 //=============================================================================
98 /*!
99  *  StdMeshers_QuadrangleParams_i::SetObjectEntry
100  *
101  *  Set the Entry for the Main Object
102  */
103 //=============================================================================
104
105 void StdMeshers_QuadrangleParams_i::SetObjectEntry( const char* entry )
106 {
107   MESSAGE( "StdMeshers_QuadrangleParams_i::SetObjectEntry" );
108   ASSERT( myBaseImpl );
109
110   try {
111     this->GetImpl()->SetObjectEntry( entry );
112     // Update Python script
113     //    SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
114   }
115   catch ( SALOME_Exception& S_ex ) {
116     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
117                                   SALOME::BAD_PARAM );
118   }
119 }
120
121 //=============================================================================
122 /*!
123  *  StdMeshers_QuadrangleParams_i::GetObjectEntry
124  *
125  *  Set the Entry for the Main Object
126  */
127 //=============================================================================
128
129 char* StdMeshers_QuadrangleParams_i::GetObjectEntry()
130 {
131   MESSAGE( "StdMeshers_QuadrangleParams_i::SetObjectEntry" );
132   ASSERT( myBaseImpl );
133   const char* entry;
134   try {
135     entry = this->GetImpl()->GetObjectEntry();
136   }
137   catch ( SALOME_Exception& S_ex ) {
138     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
139                                   SALOME::BAD_PARAM );
140   }
141   return CORBA::string_dup( entry );
142 }
143
144 //=============================================================================
145 /*!
146  *  StdMeshers_QuadrangleParams_i::GetTriaVertex
147  *
148  *  Get base vertex for triangles
149  */
150 //=============================================================================
151
152 CORBA::Long StdMeshers_QuadrangleParams_i::GetTriaVertex()
153 {
154   MESSAGE( "StdMeshers_QuadrangleParams_i::GetTriaVertex" );
155   ASSERT( myBaseImpl );
156   return this->GetImpl()->GetTriaVertex();
157 }
158
159 //=============================================================================
160 /*!
161  *  StdMeshers_QuadrangleParams_i::GetImpl
162  *
163  *  Get implementation
164  */
165 //=============================================================================
166
167 ::StdMeshers_QuadrangleParams* StdMeshers_QuadrangleParams_i::GetImpl()
168 {
169   MESSAGE( "StdMeshers_QuadrangleParams_i::GetImpl" );
170   return ( ::StdMeshers_QuadrangleParams* )myBaseImpl;
171 }
172
173 //================================================================================
174 /*!
175  * \brief Verify whether hypothesis supports given entity type 
176   * \param type - dimension (see SMESH::Dimension enumeration)
177   * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
178  * 
179  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
180  */
181 //================================================================================  
182 CORBA::Boolean StdMeshers_QuadrangleParams_i::IsDimSupported( SMESH::Dimension type )
183 {
184   return type == SMESH::DIM_2D;
185 }
186