Version: 6.3.1

src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
00024 //  File   : StdMeshers_Arithmetic1D_i.cxx
00025 //  Author : Damien COQUERET, OCC
00026 //  Module : SMESH
00027 //  $Header: /home/server/cvs/SMESH/SMESH_SRC/src/StdMeshers_I/StdMeshers_Arithmetic1D_i.cxx,v 1.9.2.3.6.1.8.1 2011-06-02 05:57:34 vsr Exp $
00028 //
00029 #include "StdMeshers_Arithmetic1D_i.hxx"
00030 #include "SMESH_Gen_i.hxx"
00031 #include "SMESH_Gen.hxx"
00032 #include "SMESH_PythonDump.hxx"
00033 
00034 #include "Utils_CorbaException.hxx"
00035 #include "utilities.h"
00036 
00037 #include <TCollection_AsciiString.hxx>
00038 
00039 using namespace std;
00040 
00041 //=============================================================================
00047 //=============================================================================
00048 
00049 StdMeshers_Arithmetic1D_i::StdMeshers_Arithmetic1D_i( PortableServer::POA_ptr thePOA,
00050                                                     int                     theStudyId,
00051                                                     ::SMESH_Gen*            theGenImpl )
00052      : SALOME::GenericObj_i( thePOA ), 
00053        SMESH_Hypothesis_i( thePOA )
00054 {
00055   MESSAGE( "StdMeshers_Arithmetic1D_i::StdMeshers_Arithmetic1D_i" );
00056   myBaseImpl = new ::StdMeshers_Arithmetic1D( theGenImpl->GetANewId(),
00057                                              theStudyId,
00058                                              theGenImpl );
00059 }
00060 
00061 //=============================================================================
00067 //=============================================================================
00068 
00069 StdMeshers_Arithmetic1D_i::~StdMeshers_Arithmetic1D_i()
00070 {
00071   MESSAGE( "StdMeshers_Arithmetic1D_i::~StdMeshers_Arithmetic1D_i" );
00072 }
00073 
00074 //=============================================================================
00080 //=============================================================================
00081 
00082 void StdMeshers_Arithmetic1D_i::SetLength(CORBA::Double theLength,
00083                                           CORBA::Boolean theIsStart )
00084      throw ( SALOME::SALOME_Exception )
00085 {
00086   MESSAGE( "StdMeshers_StartEndLength_i::SetLength" );
00087   ASSERT( myBaseImpl );
00088   try {
00089     this->GetImpl()->SetLength( theLength, theIsStart );
00090   }
00091   catch ( SALOME_Exception& S_ex ) {
00092     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00093                                   SALOME::BAD_PARAM );
00094   }
00095 
00096   // Update Python script
00097   SMESH::TPythonDump()
00098     << _this() << ( theIsStart ? ".SetStartLength( " : ".SetEndLength( " ) << theLength << " )";
00099 }
00100 
00101 //=============================================================================
00105 //=============================================================================
00106 
00107 void StdMeshers_Arithmetic1D_i::SetStartLength( CORBA::Double length)
00108   throw (SALOME::SALOME_Exception)
00109 {
00110   SetLength( length, true );
00111 }
00112 
00113 //=============================================================================
00117 //=============================================================================
00118 
00119 void StdMeshers_Arithmetic1D_i::SetEndLength( CORBA::Double length)
00120   throw (SALOME::SALOME_Exception)
00121 {
00122   SetLength( length, false );
00123 }
00124 
00125 //=============================================================================
00131 //=============================================================================
00132 
00133 CORBA::Double StdMeshers_Arithmetic1D_i::GetLength( CORBA::Boolean theIsStart)
00134 {
00135   MESSAGE( "StdMeshers_Arithmetic1D_i::GetLength" );
00136   ASSERT( myBaseImpl );
00137   return this->GetImpl()->GetLength( theIsStart );
00138 }
00139 
00140 //=============================================================================
00146 //=============================================================================
00147 
00148 void StdMeshers_Arithmetic1D_i::SetReversedEdges( const SMESH::long_array& theIds )
00149 {
00150   ASSERT( myBaseImpl );
00151   try {
00152     std::vector<int> ids( theIds.length() );
00153     CORBA::Long iEnd = theIds.length();
00154     for ( CORBA::Long i = 0; i < iEnd; i++ )
00155       ids[ i ] = theIds[ i ];
00156 
00157     this->GetImpl()->SetReversedEdges( ids );
00158   }
00159   catch ( SALOME_Exception& S_ex ) {
00160     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00161                                   SALOME::BAD_PARAM );
00162   }
00163 
00164   // Update Python script
00165   SMESH::TPythonDump() << _this() << ".SetReversedEdges( " << theIds << " )";
00166 }
00167 
00168 //=============================================================================
00174 //=============================================================================
00175 
00176 void StdMeshers_Arithmetic1D_i::SetObjectEntry( const char* theEntry )
00177 {
00178   ASSERT( myBaseImpl );
00179   string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
00180   try {
00181     this->GetImpl()->SetObjectEntry( entry.c_str() );
00182     // Update Python script
00183     SMESH::TPythonDump() << _this() << ".SetObjectEntry( \"" << entry.c_str() << "\" )";
00184   }
00185   catch ( SALOME_Exception& S_ex ) {
00186     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM );
00187   }
00188 }
00189 
00190 //=============================================================================
00196 //=============================================================================
00197 
00198 char* StdMeshers_Arithmetic1D_i::GetObjectEntry()
00199 {
00200   MESSAGE( "StdMeshers_Arithmetic1D_i::SetObjectEntry" );
00201   ASSERT( myBaseImpl );
00202   const char* entry;
00203   try {
00204     entry = this->GetImpl()->GetObjectEntry();
00205   }
00206   catch ( SALOME_Exception& S_ex ) {
00207     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00208                                   SALOME::BAD_PARAM );
00209   }
00210   return CORBA::string_dup( entry );
00211 }
00212 
00213 //=============================================================================
00219 //=============================================================================
00220 
00221 SMESH::long_array* StdMeshers_Arithmetic1D_i::GetReversedEdges()
00222 {
00223   MESSAGE( "StdMeshers_StartEndLength_i::GetReversedEdges" );
00224   ASSERT( myBaseImpl );
00225   SMESH::long_array_var anArray = new SMESH::long_array;
00226   std::vector<int> ids = this->GetImpl()->GetReversedEdges();
00227   anArray->length( ids.size() );
00228   for ( CORBA::Long i = 0; i < ids.size(); i++)
00229     anArray [ i ] = ids [ i ];
00230 
00231   return anArray._retn();
00232 }
00233 
00234 //=============================================================================
00240 //=============================================================================
00241 
00242 ::StdMeshers_Arithmetic1D* StdMeshers_Arithmetic1D_i::GetImpl()
00243 {
00244   MESSAGE( "StdMeshers_Arithmetic1D_i::GetImpl" );
00245   return ( ::StdMeshers_Arithmetic1D* )myBaseImpl;
00246 }
00247 
00248 //================================================================================
00256 //================================================================================  
00257 CORBA::Boolean StdMeshers_Arithmetic1D_i::IsDimSupported( SMESH::Dimension type )
00258 {
00259   return type == SMESH::DIM_1D;
00260 }
00261 
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS