1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // NETGENPlugin : C++ implementation
24 // File : NETGENPlugin_Hypothesis_i.cxx
25 // Author : Michael Sazonov (OCN)
29 //=============================================================================
31 #include "NETGENPlugin_Hypothesis_i.hxx"
32 #include "SMESH_Gen.hxx"
33 #include "SMESH_PythonDump.hxx"
34 #include "GEOM_Object.hxx"
36 #include "Utils_CorbaException.hxx"
37 #include "utilities.h"
41 //=============================================================================
43 * NETGENPlugin_Hypothesis_i::NETGENPlugin_Hypothesis_i
47 //=============================================================================
48 NETGENPlugin_Hypothesis_i::
49 NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
51 ::SMESH_Gen* theGenImpl)
52 : SALOME::GenericObj_i( thePOA ),
53 SMESH_Hypothesis_i( thePOA )
55 MESSAGE( "NETGENPlugin_Hypothesis_i::NETGENPlugin_Hypothesis_i" );
56 myBaseImpl = new ::NETGENPlugin_Hypothesis (theGenImpl->GetANewId(),
61 //=============================================================================
63 * NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i
67 //=============================================================================
68 NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i()
70 MESSAGE( "NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i" );
73 //=============================================================================
75 * NETGENPlugin_Hypothesis_i::SetMaxSize
79 //=============================================================================
80 void NETGENPlugin_Hypothesis_i::SetMaxSize (CORBA::Double theValue)
82 MESSAGE("NETGENPlugin_Hypothesis_i::SetMaxSize");
84 this->GetImpl()->SetMaxSize(theValue);
85 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theValue << " )";
88 //=============================================================================
90 * NETGENPlugin_Hypothesis_i::GetMaxSize
94 //=============================================================================
95 CORBA::Double NETGENPlugin_Hypothesis_i::GetMaxSize()
97 MESSAGE("NETGENPlugin_Hypothesis_i::GetMaxSize");
99 return this->GetImpl()->GetMaxSize();
102 //=============================================================================
104 * NETGENPlugin_Hypothesis_i::SetSecondOrder
106 * Set SecondOrder flag
108 //=============================================================================
109 void NETGENPlugin_Hypothesis_i::SetSecondOrder (CORBA::Boolean theValue)
111 MESSAGE("NETGENPlugin_Hypothesis_i::SetSecondOrder");
113 this->GetImpl()->SetSecondOrder(theValue);
114 SMESH::TPythonDump() << _this() << ".SetSecondOrder( " << theValue << " )";
117 //=============================================================================
119 * NETGENPlugin_Hypothesis_i::GetSecondOrder
121 * Get SecondOrder flag
123 //=============================================================================
124 CORBA::Boolean NETGENPlugin_Hypothesis_i::GetSecondOrder()
126 MESSAGE("NETGENPlugin_Hypothesis_i::GetSecondOrder");
128 return this->GetImpl()->GetSecondOrder();
131 //=============================================================================
133 * NETGENPlugin_Hypothesis_i::SetOptimize
137 //=============================================================================
138 void NETGENPlugin_Hypothesis_i::SetOptimize (CORBA::Boolean theValue)
140 MESSAGE("NETGENPlugin_Hypothesis_i::SetOptimize");
142 this->GetImpl()->SetOptimize(theValue);
143 SMESH::TPythonDump() << _this() << ".SetOptimize( " << theValue << " )";
146 //=============================================================================
148 * NETGENPlugin_Hypothesis_i::GetOptimize
152 //=============================================================================
153 CORBA::Boolean NETGENPlugin_Hypothesis_i::GetOptimize()
155 MESSAGE("NETGENPlugin_Hypothesis_i::GetOptimize");
157 return this->GetImpl()->GetOptimize();
160 //=============================================================================
162 * NETGENPlugin_Hypothesis_i::SetFineness
166 //=============================================================================
167 void NETGENPlugin_Hypothesis_i::SetFineness (CORBA::Long theValue)
169 MESSAGE("NETGENPlugin_Hypothesis_i::SetFineness");
171 this->GetImpl()->SetFineness((::NETGENPlugin_Hypothesis::Fineness)theValue);
172 SMESH::TPythonDump() << _this() << ".SetFineness( " << theValue << " )";
175 //=============================================================================
177 * NETGENPlugin_Hypothesis_i::GetFineness
181 //=============================================================================
182 CORBA::Long NETGENPlugin_Hypothesis_i::GetFineness()
184 MESSAGE("NETGENPlugin_Hypothesis_i::GetFineness");
186 return this->GetImpl()->GetFineness();
189 //=============================================================================
191 * NETGENPlugin_Hypothesis_i::SetGrowthRate
195 //=============================================================================
196 void NETGENPlugin_Hypothesis_i::SetGrowthRate (CORBA::Double theValue)
198 MESSAGE("NETGENPlugin_Hypothesis_i::SetGrowthRate");
200 this->GetImpl()->SetGrowthRate(theValue);
201 SMESH::TPythonDump() << _this() << ".SetGrowthRate( " << theValue << " )";
204 //=============================================================================
206 * NETGENPlugin_Hypothesis_i::GetGrowthRate
210 //=============================================================================
211 CORBA::Double NETGENPlugin_Hypothesis_i::GetGrowthRate()
213 MESSAGE("NETGENPlugin_Hypothesis_i::GetGrowthRate");
215 return this->GetImpl()->GetGrowthRate();
218 //=============================================================================
220 * NETGENPlugin_Hypothesis_i::SetNbSegPerEdge
224 //=============================================================================
225 void NETGENPlugin_Hypothesis_i::SetNbSegPerEdge (CORBA::Double theValue)
227 MESSAGE("NETGENPlugin_Hypothesis_i::SetNbSegPerEdge");
229 this->GetImpl()->SetNbSegPerEdge(theValue);
230 SMESH::TPythonDump() << _this() << ".SetNbSegPerEdge( " << theValue << " )";
233 //=============================================================================
235 * NETGENPlugin_Hypothesis_i::GetNbSegPerEdge
239 //=============================================================================
240 CORBA::Double NETGENPlugin_Hypothesis_i::GetNbSegPerEdge()
242 MESSAGE("NETGENPlugin_Hypothesis_i::GetNbSegPerEdge");
244 return this->GetImpl()->GetNbSegPerEdge();
247 //=============================================================================
249 * NETGENPlugin_Hypothesis_i::SetNbSegPerRadius
253 //=============================================================================
254 void NETGENPlugin_Hypothesis_i::SetNbSegPerRadius (CORBA::Double theValue)
256 MESSAGE("NETGENPlugin_Hypothesis_i::SetNbSegPerRadius");
258 this->GetImpl()->SetNbSegPerRadius(theValue);
259 SMESH::TPythonDump() << _this() << ".SetNbSegPerRadius( " << theValue << " )";
262 //=============================================================================
264 * NETGENPlugin_Hypothesis_i::GetNbSegPerRadius
268 //=============================================================================
269 CORBA::Double NETGENPlugin_Hypothesis_i::GetNbSegPerRadius()
271 MESSAGE("NETGENPlugin_Hypothesis_i::GetNbSegPerRadius");
273 return this->GetImpl()->GetNbSegPerRadius();
276 //=============================================================================
278 void NETGENPlugin_Hypothesis_i::SetLocalSizeOnShape(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double localSize)
281 entry = GeomObj->GetStudyEntry();
282 SetLocalSizeOnEntry(entry.c_str(), localSize);
285 //=============================================================================
287 void NETGENPlugin_Hypothesis_i::SetLocalSizeOnEntry(const char* entry, CORBA::Double localSize)
289 bool valueChanged = false;
290 valueChanged = ( this->GetImpl()->GetLocalSizeOnEntry(entry) != localSize );
292 this->GetImpl()->SetLocalSizeOnEntry(entry, localSize);
294 SMESH::TPythonDump() << _this() << ".SetLocalSizeOnShape(" << entry << ", " << localSize << ")";
297 //=============================================================================
299 CORBA::Double NETGENPlugin_Hypothesis_i::GetLocalSizeOnEntry(const char* entry)
301 return this->GetImpl()->GetLocalSizeOnEntry(entry);
304 //=============================================================================
306 NETGENPlugin::string_array* NETGENPlugin_Hypothesis_i::GetLocalSizeEntries()
308 NETGENPlugin::string_array_var result = new NETGENPlugin::string_array();
309 const ::NETGENPlugin_Hypothesis::TLocalSize localSizes = this->GetImpl()->GetLocalSizesAndEntries();
310 result->length(localSizes.size());
311 ::NETGENPlugin_Hypothesis::TLocalSize::const_iterator it = localSizes.begin();
312 for (int i=0 ; it != localSizes.end() ; i++, it++)
314 string entry = (*it).first;
315 result[i] = CORBA::string_dup(entry.c_str());
317 return result._retn();
320 //=============================================================================
322 void NETGENPlugin_Hypothesis_i::UnsetLocalSizeOnEntry(const char* entry)
324 this->GetImpl()->UnsetLocalSizeOnEntry(entry);
325 SMESH::TPythonDump() << _this() << ".UnsetLocalSizeOnEntry(" << entry << ")";
328 //=============================================================================
330 * NETGENPlugin_Hypothesis_i::GetImpl
334 //=============================================================================
335 ::NETGENPlugin_Hypothesis* NETGENPlugin_Hypothesis_i::GetImpl()
337 MESSAGE("NETGENPlugin_Hypothesis_i::GetImpl");
338 return (::NETGENPlugin_Hypothesis*)myBaseImpl;
341 //================================================================================
343 * \brief Verify whether hypothesis supports given entity type
344 * \param type - dimension (see SMESH::Dimension enumeration)
345 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
347 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
349 //================================================================================
350 CORBA::Boolean NETGENPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
352 return type == SMESH::DIM_3D;