1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
20 // File : StdMeshers_QuadrangleParams_i.cxx
21 // Author : Sergey KUUL, OCC
24 #include "StdMeshers_QuadrangleParams_i.hxx"
25 #include "SMESH_Gen_i.hxx"
26 #include "SMESH_Gen.hxx"
27 #include "SMESH_PythonDump.hxx"
29 #include "Utils_CorbaException.hxx"
30 #include "utilities.h"
32 #include <TCollection_AsciiString.hxx>
36 //=============================================================================
38 * StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i
42 //=============================================================================
44 StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i
45 (PortableServer::POA_ptr thePOA,
47 ::SMESH_Gen* theGenImpl )
48 : SALOME::GenericObj_i( thePOA ),
49 SMESH_Hypothesis_i( thePOA )
51 MESSAGE( "StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i" );
52 myBaseImpl = new ::StdMeshers_QuadrangleParams(theGenImpl->GetANewId(),
57 //=============================================================================
59 * StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i
63 //=============================================================================
65 StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i()
67 MESSAGE( "StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i" );
70 //=============================================================================
72 * StdMeshers_QuadrangleParams_i::SetTriaVertex
74 * Set base vertex for triangles
76 //=============================================================================
78 void StdMeshers_QuadrangleParams_i::SetTriaVertex(CORBA::Long vertID)
80 MESSAGE( "StdMeshers_QuadrangleParams_i::SetTriaVertex" );
83 this->GetImpl()->SetTriaVertex( vertID );
85 catch ( SALOME_Exception& S_ex ) {
86 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
90 // Update Python script
91 SMESH::TPythonDump() << _this() << ".SetTriaVertex( "
95 //=============================================================================
97 * StdMeshers_QuadrangleParams_i::GetTriaVertex
99 * Get base vertex for triangles
101 //=============================================================================
103 CORBA::Long StdMeshers_QuadrangleParams_i::GetTriaVertex()
105 MESSAGE( "StdMeshers_QuadrangleParams_i::GetTriaVertex" );
106 ASSERT( myBaseImpl );
107 return this->GetImpl()->GetTriaVertex();
110 //=============================================================================
112 * StdMeshers_QuadrangleParams_i::SetObjectEntry
114 * Set the Entry for the Main Object
116 //=============================================================================
118 void StdMeshers_QuadrangleParams_i::SetObjectEntry( const char* entry )
120 MESSAGE( "StdMeshers_QuadrangleParams_i::SetObjectEntry" );
121 ASSERT( myBaseImpl );
124 this->GetImpl()->SetObjectEntry( entry );
125 // Update Python script
126 // SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
128 catch ( SALOME_Exception& S_ex ) {
129 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
134 //=============================================================================
136 * StdMeshers_QuadrangleParams_i::GetObjectEntry
138 * Set the Entry for the Main Object
140 //=============================================================================
142 char* StdMeshers_QuadrangleParams_i::GetObjectEntry()
144 MESSAGE( "StdMeshers_QuadrangleParams_i::SetObjectEntry" );
145 ASSERT( myBaseImpl );
148 entry = this->GetImpl()->GetObjectEntry();
150 catch ( SALOME_Exception& S_ex ) {
151 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
154 return CORBA::string_dup( entry );
157 //=============================================================================
159 * StdMeshers_QuadrangleParams_i::SetQuadType
161 * Set the type of quadrangulation
163 //=============================================================================
164 void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type)
166 //static char* quadTypes[5] = {"StdMeshers.QUAD_STANDARD",
167 // "StdMeshers.QUAD_TRIANGLE_PREF",
168 // "StdMeshers.QUAD_QUADRANGLE_PREF",
169 // "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED",
170 // "StdMeshers.QUAD_REDUCED"};
172 MESSAGE("StdMeshers_QuadrangleParams_i::SetQuadType");
175 if (int(type) >= int(StdMeshers::QUAD_NB_TYPES)) {
176 THROW_SALOME_CORBA_EXCEPTION("Bad type of quadrangulation", SALOME::BAD_PARAM);
180 this->GetImpl()->SetQuadType(StdMeshers_QuadType(int(type)));
182 catch (SALOME_Exception& S_ex) {
183 THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
186 // Update Python script
187 const char* quadType;
189 case StdMeshers::QUAD_STANDARD:
190 quadType = "StdMeshers.QUAD_STANDARD"; break;
191 case StdMeshers::QUAD_TRIANGLE_PREF:
192 quadType = "StdMeshers.QUAD_TRIANGLE_PREF"; break;
193 case StdMeshers::QUAD_QUADRANGLE_PREF:
194 quadType = "StdMeshers.QUAD_QUADRANGLE_PREF"; break;
195 case StdMeshers::QUAD_QUADRANGLE_PREF_REVERSED:
196 quadType = "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED"; break;
197 case StdMeshers::QUAD_REDUCED:
198 quadType = "StdMeshers.QUAD_REDUCED"; break;
200 quadType = "UNKNOWN";
202 SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadType << " )";
203 //SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadTypes[int(type)] << " )";
206 //=============================================================================
208 * StdMeshers_QuadrangleParams_i::GetQuadType
210 * Get the type of quadrangulation
212 //=============================================================================
213 StdMeshers::QuadType StdMeshers_QuadrangleParams_i::GetQuadType()
215 MESSAGE("StdMeshers_QuadrangleParams_i::GetQuadType");
217 return StdMeshers::QuadType(int(this->GetImpl()->GetQuadType()));
220 //=============================================================================
222 * StdMeshers_QuadrangleParams_i::GetImpl
226 //=============================================================================
228 ::StdMeshers_QuadrangleParams* StdMeshers_QuadrangleParams_i::GetImpl()
230 MESSAGE( "StdMeshers_QuadrangleParams_i::GetImpl" );
231 return ( ::StdMeshers_QuadrangleParams* )myBaseImpl;
234 //================================================================================
236 * \brief Verify whether hypothesis supports given entity type
237 * \param type - dimension (see SMESH::Dimension enumeration)
238 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
240 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
242 //================================================================================
243 CORBA::Boolean StdMeshers_QuadrangleParams_i::IsDimSupported( SMESH::Dimension type )
245 return type == SMESH::DIM_2D;