1 // Copyright (C) 2007-2012 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 // File : StdMeshers_QuadrangleParams_i.cxx
20 // Author : Sergey KUUL, OCC
23 #include "StdMeshers_QuadrangleParams_i.hxx"
24 #include "SMESH_Gen_i.hxx"
25 #include "SMESH_Gen.hxx"
26 #include "SMESH_PythonDump.hxx"
28 #include "Utils_CorbaException.hxx"
29 #include "utilities.h"
31 #include <TCollection_AsciiString.hxx>
35 //=============================================================================
37 * StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i
41 //=============================================================================
43 StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i
44 (PortableServer::POA_ptr thePOA,
46 ::SMESH_Gen* theGenImpl )
47 : SALOME::GenericObj_i( thePOA ),
48 SMESH_Hypothesis_i( thePOA )
50 MESSAGE( "StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i" );
51 myBaseImpl = new ::StdMeshers_QuadrangleParams(theGenImpl->GetANewId(),
56 //=============================================================================
58 * StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i
62 //=============================================================================
64 StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i()
66 MESSAGE( "StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i" );
69 //=============================================================================
71 * StdMeshers_QuadrangleParams_i::SetTriaVertex
73 * Set base vertex for triangles
75 //=============================================================================
77 void StdMeshers_QuadrangleParams_i::SetTriaVertex(CORBA::Long vertID)
79 MESSAGE( "StdMeshers_QuadrangleParams_i::SetTriaVertex" );
82 this->GetImpl()->SetTriaVertex( vertID );
84 catch ( SALOME_Exception& S_ex ) {
85 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
89 // Update Python script
90 SMESH::TPythonDump() << _this() << ".SetTriaVertex( "
94 //=============================================================================
96 * StdMeshers_QuadrangleParams_i::GetTriaVertex
98 * Get base vertex for triangles
100 //=============================================================================
102 CORBA::Long StdMeshers_QuadrangleParams_i::GetTriaVertex()
104 MESSAGE( "StdMeshers_QuadrangleParams_i::GetTriaVertex" );
105 ASSERT( myBaseImpl );
106 return this->GetImpl()->GetTriaVertex();
109 //=============================================================================
111 * StdMeshers_QuadrangleParams_i::SetObjectEntry
113 * Set the Entry for the Main Object
115 //=============================================================================
117 void StdMeshers_QuadrangleParams_i::SetObjectEntry( const char* entry )
119 MESSAGE( "StdMeshers_QuadrangleParams_i::SetObjectEntry" );
120 ASSERT( myBaseImpl );
123 this->GetImpl()->SetObjectEntry( entry );
124 // Update Python script
125 // SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
127 catch ( SALOME_Exception& S_ex ) {
128 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
133 //=============================================================================
135 * StdMeshers_QuadrangleParams_i::GetObjectEntry
137 * Set the Entry for the Main Object
139 //=============================================================================
141 char* StdMeshers_QuadrangleParams_i::GetObjectEntry()
143 MESSAGE( "StdMeshers_QuadrangleParams_i::SetObjectEntry" );
144 ASSERT( myBaseImpl );
147 entry = this->GetImpl()->GetObjectEntry();
149 catch ( SALOME_Exception& S_ex ) {
150 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
153 return CORBA::string_dup( entry );
156 //=============================================================================
158 * StdMeshers_QuadrangleParams_i::SetQuadType
160 * Set the type of quadrangulation
162 //=============================================================================
163 void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type)
165 //static char* quadTypes[5] = {"StdMeshers.QUAD_STANDARD",
166 // "StdMeshers.QUAD_TRIANGLE_PREF",
167 // "StdMeshers.QUAD_QUADRANGLE_PREF",
168 // "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED",
169 // "StdMeshers.QUAD_REDUCED"};
171 MESSAGE("StdMeshers_QuadrangleParams_i::SetQuadType");
174 if (int(type) >= int(StdMeshers::QUAD_NB_TYPES)) {
175 THROW_SALOME_CORBA_EXCEPTION("Bad type of quadrangulation", SALOME::BAD_PARAM);
179 this->GetImpl()->SetQuadType(StdMeshers_QuadType(int(type)));
181 catch (SALOME_Exception& S_ex) {
182 THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
185 // Update Python script
186 const char* quadType;
188 case StdMeshers::QUAD_STANDARD:
189 quadType = "StdMeshers.QUAD_STANDARD"; break;
190 case StdMeshers::QUAD_TRIANGLE_PREF:
191 quadType = "StdMeshers.QUAD_TRIANGLE_PREF"; break;
192 case StdMeshers::QUAD_QUADRANGLE_PREF:
193 quadType = "StdMeshers.QUAD_QUADRANGLE_PREF"; break;
194 case StdMeshers::QUAD_QUADRANGLE_PREF_REVERSED:
195 quadType = "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED"; break;
196 case StdMeshers::QUAD_REDUCED:
197 quadType = "StdMeshers.QUAD_REDUCED"; break;
199 quadType = "UNKNOWN";
201 SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadType << " )";
202 //SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadTypes[int(type)] << " )";
205 //=============================================================================
207 * StdMeshers_QuadrangleParams_i::GetQuadType
209 * Get the type of quadrangulation
211 //=============================================================================
212 StdMeshers::QuadType StdMeshers_QuadrangleParams_i::GetQuadType()
214 MESSAGE("StdMeshers_QuadrangleParams_i::GetQuadType");
216 return StdMeshers::QuadType(int(this->GetImpl()->GetQuadType()));
219 //=============================================================================
221 * StdMeshers_QuadrangleParams_i::GetImpl
225 //=============================================================================
227 ::StdMeshers_QuadrangleParams* StdMeshers_QuadrangleParams_i::GetImpl()
229 MESSAGE( "StdMeshers_QuadrangleParams_i::GetImpl" );
230 return ( ::StdMeshers_QuadrangleParams* )myBaseImpl;
233 //================================================================================
235 * \brief Verify whether hypothesis supports given entity type
236 * \param type - dimension (see SMESH::Dimension enumeration)
237 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
239 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
241 //================================================================================
242 CORBA::Boolean StdMeshers_QuadrangleParams_i::IsDimSupported( SMESH::Dimension type )
244 return type == SMESH::DIM_2D;