Back to index

salome-smesh  6.5.0
StdMeshers_QuadrangleParams_i.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 //  File   : StdMeshers_QuadrangleParams_i.cxx
00020 //  Author : Sergey KUUL, OCC
00021 //  Module : SMESH
00022 
00023 #include "StdMeshers_QuadrangleParams_i.hxx"
00024 #include "SMESH_Gen_i.hxx"
00025 #include "SMESH_Gen.hxx"
00026 #include "SMESH_PythonDump.hxx"
00027 
00028 #include "Utils_CorbaException.hxx"
00029 #include "utilities.h"
00030 
00031 #include <TCollection_AsciiString.hxx>
00032 
00033 using namespace std;
00034 
00035 //=============================================================================
00041 //=============================================================================
00042 
00043 StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i
00044                                           (PortableServer::POA_ptr thePOA,
00045                                            int                     theStudyId,
00046                                            ::SMESH_Gen*            theGenImpl )
00047      : SALOME::GenericObj_i( thePOA ), 
00048        SMESH_Hypothesis_i( thePOA )
00049 {
00050   MESSAGE( "StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i" );
00051   myBaseImpl = new ::StdMeshers_QuadrangleParams(theGenImpl->GetANewId(),
00052                                                  theStudyId,
00053                                                  theGenImpl);
00054 }
00055 
00056 //=============================================================================
00062 //=============================================================================
00063 
00064 StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i()
00065 {
00066   MESSAGE( "StdMeshers_QuadrangleParams_i::~StdMeshers_QuadrangleParams_i" );
00067 }
00068 
00069 //=============================================================================
00075 //=============================================================================
00076 
00077 void StdMeshers_QuadrangleParams_i::SetTriaVertex(CORBA::Long vertID)
00078 {
00079   MESSAGE( "StdMeshers_QuadrangleParams_i::SetTriaVertex" );
00080   ASSERT( myBaseImpl );
00081   try {
00082     this->GetImpl()->SetTriaVertex( vertID );
00083   }
00084   catch ( SALOME_Exception& S_ex ) {
00085     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00086                                   SALOME::BAD_PARAM );
00087   }
00088 
00089   // Update Python script
00090   SMESH::TPythonDump() << _this() << ".SetTriaVertex( "
00091       << vertID << " )";
00092 }
00093 
00094 //=============================================================================
00100 //=============================================================================
00101 
00102 CORBA::Long StdMeshers_QuadrangleParams_i::GetTriaVertex()
00103 {
00104   MESSAGE( "StdMeshers_QuadrangleParams_i::GetTriaVertex" );
00105   ASSERT( myBaseImpl );
00106   return this->GetImpl()->GetTriaVertex();
00107 }
00108 
00109 //=============================================================================
00115 //=============================================================================
00116 
00117 void StdMeshers_QuadrangleParams_i::SetObjectEntry( const char* entry )
00118 {
00119   MESSAGE( "StdMeshers_QuadrangleParams_i::SetObjectEntry" );
00120   ASSERT( myBaseImpl );
00121 
00122   try {
00123     this->GetImpl()->SetObjectEntry( entry );
00124     // Update Python script
00125     //    SMESH::TPythonDump() << _this() << ".SetObjectEntry( '" << entry << "' )";
00126   }
00127   catch ( SALOME_Exception& S_ex ) {
00128     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00129                                   SALOME::BAD_PARAM );
00130   }
00131 }
00132 
00133 //=============================================================================
00139 //=============================================================================
00140 
00141 char* StdMeshers_QuadrangleParams_i::GetObjectEntry()
00142 {
00143   MESSAGE( "StdMeshers_QuadrangleParams_i::SetObjectEntry" );
00144   ASSERT( myBaseImpl );
00145   const char* entry;
00146   try {
00147     entry = this->GetImpl()->GetObjectEntry();
00148   }
00149   catch ( SALOME_Exception& S_ex ) {
00150     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00151                                   SALOME::BAD_PARAM );
00152   }
00153   return CORBA::string_dup( entry );
00154 }
00155 
00156 //=============================================================================
00162 //=============================================================================
00163 void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type)
00164 {
00165   //static char* quadTypes[5] = {"StdMeshers.QUAD_STANDARD",
00166   //                             "StdMeshers.QUAD_TRIANGLE_PREF",
00167   //                             "StdMeshers.QUAD_QUADRANGLE_PREF",
00168   //                             "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED",
00169   //                             "StdMeshers.QUAD_REDUCED"};
00170 
00171   MESSAGE("StdMeshers_QuadrangleParams_i::SetQuadType");
00172   ASSERT(myBaseImpl);
00173 
00174   if (int(type) >= int(StdMeshers::QUAD_NB_TYPES)) {
00175     THROW_SALOME_CORBA_EXCEPTION("Bad type of quadrangulation", SALOME::BAD_PARAM);
00176   }
00177 
00178   try {
00179     this->GetImpl()->SetQuadType(StdMeshers_QuadType(int(type)));
00180   }
00181   catch (SALOME_Exception& S_ex) {
00182     THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
00183   }
00184 
00185   // Update Python script
00186   const char* quadType;
00187   switch (type) {
00188   case StdMeshers::QUAD_STANDARD:
00189     quadType = "StdMeshers.QUAD_STANDARD"; break;
00190   case StdMeshers::QUAD_TRIANGLE_PREF:
00191     quadType = "StdMeshers.QUAD_TRIANGLE_PREF"; break;
00192   case StdMeshers::QUAD_QUADRANGLE_PREF:
00193     quadType = "StdMeshers.QUAD_QUADRANGLE_PREF"; break;
00194   case StdMeshers::QUAD_QUADRANGLE_PREF_REVERSED:
00195     quadType = "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED"; break;
00196   case StdMeshers::QUAD_REDUCED:
00197     quadType = "StdMeshers.QUAD_REDUCED"; break;
00198   default:
00199     quadType = "UNKNOWN";
00200   }
00201   SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadType << " )";
00202   //SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadTypes[int(type)] << " )";
00203 }
00204 
00205 //=============================================================================
00211 //=============================================================================
00212 StdMeshers::QuadType StdMeshers_QuadrangleParams_i::GetQuadType()
00213 {
00214   MESSAGE("StdMeshers_QuadrangleParams_i::GetQuadType");
00215   ASSERT(myBaseImpl);
00216   return StdMeshers::QuadType(int(this->GetImpl()->GetQuadType()));
00217 }
00218 
00219 //=============================================================================
00225 //=============================================================================
00226 
00227 ::StdMeshers_QuadrangleParams* StdMeshers_QuadrangleParams_i::GetImpl()
00228 {
00229   MESSAGE( "StdMeshers_QuadrangleParams_i::GetImpl" );
00230   return ( ::StdMeshers_QuadrangleParams* )myBaseImpl;
00231 }
00232 
00233 //================================================================================
00241 //================================================================================  
00242 CORBA::Boolean StdMeshers_QuadrangleParams_i::IsDimSupported( SMESH::Dimension type )
00243 {
00244   return type == SMESH::DIM_2D;
00245 }