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
20 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
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,
46 ::SMESH_Gen* theGenImpl )
47 : SALOME::GenericObj_i( thePOA ),
48 SMESH_Hypothesis_i( thePOA )
50 myBaseImpl = new ::StdMeshers_MaxLength( theGenImpl->GetANewId(),
55 //=============================================================================
57 * StdMeshers_MaxLength_i::~StdMeshers_MaxLength_i
61 //=============================================================================
63 StdMeshers_MaxLength_i::~StdMeshers_MaxLength_i()
67 //=============================================================================
69 * StdMeshers_MaxLength_i::SetLength
73 //=============================================================================
74 void StdMeshers_MaxLength_i::SetLength( CORBA::Double theLength )
75 throw ( SALOME::SALOME_Exception )
79 this->GetImpl()->SetLength( theLength );
81 catch ( SALOME_Exception& S_ex ) {
82 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
86 // Update Python script
87 SMESH::TPythonDump() << _this() << ".SetLength( " << SMESH::TVar(theLength) << " )";
90 //=============================================================================
92 * Sets preestimation flag
94 //=============================================================================
95 void StdMeshers_MaxLength_i::SetUsePreestimatedLength( CORBA::Boolean toUse )
96 throw ( SALOME::SALOME_Exception )
100 this->GetImpl()->SetUsePreestimatedLength( toUse );
102 catch ( SALOME_Exception& S_ex ) {
103 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
107 // this is an internal kitchen call - no Python dump
108 // Update Python script
109 //SMESH::TPythonDump() << _this() << ".SetUsePreestimatedLength( " << toUse << " )";
112 //=============================================================================
114 * Sets preestimation length
116 //=============================================================================
117 void StdMeshers_MaxLength_i::SetPreestimatedLength( CORBA::Double theLength )
119 ASSERT( myBaseImpl );
121 this->GetImpl()->SetPreestimatedLength( theLength );
123 catch ( SALOME_Exception& S_ex ) {
124 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
127 // this is an internal kitchen call - no Python dump
128 // Update Python script
129 //SMESH::TPythonDump() << _this() << ".SetPreestimatedLength( " << toUse << " )";
132 //=============================================================================
134 * StdMeshers_MaxLength_i::GetLength
138 //=============================================================================
139 CORBA::Double StdMeshers_MaxLength_i::GetLength()
141 ASSERT( myBaseImpl );
142 return this->GetImpl()->GetLength();
145 //=============================================================================
147 * StdMeshers_MaxLength_i::GetPreestimatedLength
149 //=============================================================================
150 CORBA::Double StdMeshers_MaxLength_i::GetPreestimatedLength()
152 ASSERT( myBaseImpl );
153 return this->GetImpl()->GetPreestimatedLength();
156 //=============================================================================
158 * Returns preestimation flag
160 //=============================================================================
161 CORBA::Boolean StdMeshers_MaxLength_i::GetUsePreestimatedLength()
163 ASSERT( myBaseImpl );
164 return this->GetImpl()->GetUsePreestimatedLength();
167 //================================================================================
169 * \brief Returns true if preestemated length is defined
171 //================================================================================
173 CORBA::Boolean StdMeshers_MaxLength_i::HavePreestimatedLength()
175 ASSERT( myBaseImpl );
176 return this->GetImpl()->HavePreestimatedLength();
179 //=============================================================================
181 * StdMeshers_MaxLength_i::GetImpl
185 //=============================================================================
186 ::StdMeshers_MaxLength* StdMeshers_MaxLength_i::GetImpl()
188 return ( ::StdMeshers_MaxLength* )myBaseImpl;
191 //================================================================================
193 * \brief Verify whether hypothesis supports given entity type
194 * \param type - dimension (see SMESH::Dimension enumeration)
195 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
197 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
199 //================================================================================
200 CORBA::Boolean StdMeshers_MaxLength_i::IsDimSupported( SMESH::Dimension type )
202 return type == SMESH::DIM_1D;
205 //================================================================================
207 * \brief Return method name corresponding to index of variable parameter
209 //================================================================================
211 std::string StdMeshers_MaxLength_i::getMethodOfParameter(const int, int) const