1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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
20 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
21 // File : StdMeshers_MaxLength_i.cxx
24 #include "StdMeshers_MaxLength_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_MaxLength_i::StdMeshers_MaxLength_i
42 //=============================================================================
44 StdMeshers_MaxLength_i::StdMeshers_MaxLength_i( PortableServer::POA_ptr thePOA,
45 ::SMESH_Gen* theGenImpl )
46 : SALOME::GenericObj_i( thePOA ),
47 SMESH_Hypothesis_i( thePOA )
49 myBaseImpl = new ::StdMeshers_MaxLength( theGenImpl->GetANewId(),
53 //=============================================================================
55 * StdMeshers_MaxLength_i::~StdMeshers_MaxLength_i
59 //=============================================================================
61 StdMeshers_MaxLength_i::~StdMeshers_MaxLength_i()
65 //=============================================================================
67 * StdMeshers_MaxLength_i::SetLength
71 //=============================================================================
72 void StdMeshers_MaxLength_i::SetLength( CORBA::Double theLength )
73 throw ( SALOME::SALOME_Exception )
77 this->GetImpl()->SetLength( theLength );
79 catch ( SALOME_Exception& S_ex ) {
80 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
84 // Update Python script
85 SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )";
88 //=============================================================================
90 * Sets preestimation flag
92 //=============================================================================
93 void StdMeshers_MaxLength_i::SetUsePreestimatedLength( CORBA::Boolean toUse )
94 throw ( SALOME::SALOME_Exception )
98 this->GetImpl()->SetUsePreestimatedLength( toUse );
100 catch ( SALOME_Exception& S_ex ) {
101 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
105 // this is an internal kitchen call - no Python dump
106 // Update Python script
107 //SMESH::TPythonDump() << _this() << ".SetUsePreestimatedLength( " << toUse << " )";
110 //=============================================================================
112 * Sets preestimation length
114 //=============================================================================
115 void StdMeshers_MaxLength_i::SetPreestimatedLength( CORBA::Double theLength )
117 ASSERT( myBaseImpl );
119 this->GetImpl()->SetPreestimatedLength( theLength );
121 catch ( SALOME_Exception& S_ex ) {
122 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
125 // this is an internal kitchen call - no Python dump
126 // Update Python script
127 //SMESH::TPythonDump() << _this() << ".SetPreestimatedLength( " << toUse << " )";
130 //=============================================================================
132 * StdMeshers_MaxLength_i::GetLength
136 //=============================================================================
137 CORBA::Double StdMeshers_MaxLength_i::GetLength()
139 ASSERT( myBaseImpl );
140 return this->GetImpl()->GetLength();
143 //=============================================================================
145 * StdMeshers_MaxLength_i::GetPreestimatedLength
147 //=============================================================================
148 CORBA::Double StdMeshers_MaxLength_i::GetPreestimatedLength()
150 ASSERT( myBaseImpl );
151 return this->GetImpl()->GetPreestimatedLength();
154 //=============================================================================
156 * Returns preestimation flag
158 //=============================================================================
159 CORBA::Boolean StdMeshers_MaxLength_i::GetUsePreestimatedLength()
161 ASSERT( myBaseImpl );
162 return this->GetImpl()->GetUsePreestimatedLength();
165 //================================================================================
167 * \brief Returns true if preestemated length is defined
169 //================================================================================
171 CORBA::Boolean StdMeshers_MaxLength_i::HavePreestimatedLength()
173 ASSERT( myBaseImpl );
174 return this->GetImpl()->HavePreestimatedLength();
177 //=============================================================================
179 * StdMeshers_MaxLength_i::GetImpl
183 //=============================================================================
184 ::StdMeshers_MaxLength* StdMeshers_MaxLength_i::GetImpl()
186 return ( ::StdMeshers_MaxLength* )myBaseImpl;
189 //================================================================================
191 * \brief Verify whether hypothesis supports given entity type
192 * \param type - dimension (see SMESH::Dimension enumeration)
193 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
195 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
197 //================================================================================
198 CORBA::Boolean StdMeshers_MaxLength_i::IsDimSupported( SMESH::Dimension type )
200 return type == SMESH::DIM_1D;
203 //================================================================================
205 * \brief Return method name corresponding to index of variable parameter
207 //================================================================================
209 std::string StdMeshers_MaxLength_i::getMethodOfParameter(const int, int) const