1 // Copyright (C) 2007-2019 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, or (at your option) any later version.
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_2D_i.cxx
25 // Author : Michael Sazonov (OCN)
28 //=============================================================================
30 #include "NETGENPlugin_Hypothesis_2D_i.hxx"
32 #include <SMESH_Gen.hxx>
33 #include <SMESH_Gen_i.hxx>
34 #include <SMESH_Group_i.hxx>
35 #include <SMESH_Group.hxx>
36 #include <SMESH_PythonDump.hxx>
38 //=============================================================================
40 * NETGENPlugin_Hypothesis_2D_i::NETGENPlugin_Hypothesis_2D_i
44 //=============================================================================
45 NETGENPlugin_Hypothesis_2D_i::
46 NETGENPlugin_Hypothesis_2D_i (PortableServer::POA_ptr thePOA,
47 ::SMESH_Gen* theGenImpl)
48 : SALOME::GenericObj_i( thePOA ),
49 SMESH_Hypothesis_i( thePOA ),
50 NETGENPlugin_Hypothesis_i( thePOA, theGenImpl )
53 delete (::NETGENPlugin_Hypothesis*)myBaseImpl;
54 myBaseImpl = new ::NETGENPlugin_Hypothesis_2D (theGenImpl->GetANewId(),
58 //=============================================================================
60 * NETGENPlugin_Hypothesis_2D_i::~NETGENPlugin_Hypothesis_2D_i
64 //=============================================================================
65 NETGENPlugin_Hypothesis_2D_i::~NETGENPlugin_Hypothesis_2D_i()
69 //=============================================================================
71 * NETGENPlugin_Hypothesis_2D_i::GetImpl
75 //=============================================================================
76 ::NETGENPlugin_Hypothesis_2D* NETGENPlugin_Hypothesis_2D_i::GetImpl()
78 return (::NETGENPlugin_Hypothesis_2D*)myBaseImpl;
81 //================================================================================
83 * \brief Verify whether hypothesis supports given entity type
84 * \param type - dimension (see SMESH::Dimension enumeration)
85 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
87 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
89 //================================================================================
90 CORBA::Boolean NETGENPlugin_Hypothesis_2D_i::IsDimSupported( SMESH::Dimension type )
92 return type == SMESH::DIM_2D;
96 //=============================================================================
98 * NETGENPlugin_RemesherHypothesis_2D_i::NETGENPlugin_RemesherHypothesis_2D_i
102 //=============================================================================
103 NETGENPlugin_RemesherHypothesis_2D_i::
104 NETGENPlugin_RemesherHypothesis_2D_i (PortableServer::POA_ptr thePOA,
105 ::SMESH_Gen* theGenImpl)
106 : SALOME::GenericObj_i( thePOA ),
107 SMESH_Hypothesis_i( thePOA ),
108 NETGENPlugin_Hypothesis_2D_i( thePOA, theGenImpl )
110 myBaseImpl = new ::NETGENPlugin_RemesherHypothesis_2D (theGenImpl->GetANewId(),
114 //================================================================================
116 * \brief Verify whether hypothesis supports given entity type
117 * \param type - dimension (see SMESH::Dimension enumeration)
118 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
120 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
122 //================================================================================
123 CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::IsDimSupported( SMESH::Dimension type )
125 return type == SMESH::DIM_2D;
128 //=============================================================================
130 * NETGENPlugin_RemesherHypothesis_2D_i::GetImpl
134 //=============================================================================
135 ::NETGENPlugin_RemesherHypothesis_2D* NETGENPlugin_RemesherHypothesis_2D_i::GetImpl()
137 return (::NETGENPlugin_RemesherHypothesis_2D*)myBaseImpl;
140 //================================================================================
142 * \brief Set ridge angle
144 //================================================================================
146 void NETGENPlugin_RemesherHypothesis_2D_i::SetRidgeAngle( CORBA::Double angle )
148 if ( GetRidgeAngle() != angle )
150 GetImpl()->SetRidgeAngle( angle );
152 SMESH::TPythonDump() << _this() << ".SetRidgeAngle( " << SMESH::TVar(angle) << " )";
156 //================================================================================
158 * \brief Return ridge angle
160 //================================================================================
162 CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRidgeAngle()
164 return GetImpl()->GetRidgeAngle();
167 void NETGENPlugin_RemesherHypothesis_2D_i::SetEdgeCornerAngle(CORBA::Double angle )
169 if ( GetEdgeCornerAngle() != angle )
171 GetImpl()->SetEdgeCornerAngle( angle );
173 SMESH::TPythonDump() << _this() << ".SetEdgeCornerAngle( " << SMESH::TVar(angle) << " )";
177 CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetEdgeCornerAngle()
179 return GetImpl()->GetEdgeCornerAngle();
182 void NETGENPlugin_RemesherHypothesis_2D_i::SetChartAngle(CORBA::Double angle )
184 if ( GetChartAngle() != angle )
186 GetImpl()->SetChartAngle( angle );
188 SMESH::TPythonDump() << _this() << ".SetChartAngle( " << SMESH::TVar(angle) << " )";
192 CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetChartAngle()
194 return GetImpl()->GetChartAngle();
197 void NETGENPlugin_RemesherHypothesis_2D_i::SetOuterChartAngle(CORBA::Double angle )
199 if ( GetOuterChartAngle() != angle )
201 GetImpl()->SetOuterChartAngle( angle );
203 SMESH::TPythonDump() << _this() << ".SetOuterChartAngle( " << SMESH::TVar(angle) << " )";
207 CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetOuterChartAngle()
209 return GetImpl()->GetOuterChartAngle();
212 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHChartDistFactor(CORBA::Double f )
214 if ( GetRestHChartDistFactor() != f )
216 GetImpl()->SetRestHChartDistFactor( f );
218 SMESH::TPythonDump() << _this() << ".SetRestHChartDistFactor( " << SMESH::TVar(f) << " )";
222 CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHChartDistFactor()
224 return GetImpl()->GetRestHChartDistFactor();
227 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHChartDistEnable(CORBA::Boolean enable )
229 if ( GetRestHChartDistEnable() != enable )
231 GetImpl()->SetRestHChartDistEnable( enable );
233 SMESH::TPythonDump() << _this() << ".SetRestHChartDistEnable( " << enable << " )";
237 CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHChartDistEnable()
239 return GetImpl()->GetRestHChartDistEnable();
242 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHLineLengthFactor(CORBA::Double f )
244 if ( GetRestHLineLengthFactor() != f )
246 GetImpl()->SetRestHLineLengthFactor( f );
248 SMESH::TPythonDump() << _this() << ".SetRestHLineLengthFactor( " << SMESH::TVar(f) << " )";
252 CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHLineLengthFactor()
254 return GetImpl()->GetRestHLineLengthFactor();
257 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHLineLengthEnable(CORBA::Boolean enable )
259 if ( GetRestHLineLengthEnable() != enable )
261 GetImpl()->SetRestHLineLengthEnable( enable );
263 SMESH::TPythonDump() << _this() << ".SetRestHLineLengthEnable( " << enable << " )";
267 CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHLineLengthEnable()
269 return GetImpl()->GetRestHLineLengthEnable();
272 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHCloseEdgeFactor(CORBA::Double f )
274 if ( GetRestHCloseEdgeFactor() != f )
276 GetImpl()->SetRestHCloseEdgeFactor( f );
278 SMESH::TPythonDump() << _this() << ".SetRestHCloseEdgeFactor( " << SMESH::TVar(f) << " )";
282 CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHCloseEdgeFactor()
284 return GetImpl()->GetRestHCloseEdgeFactor();
287 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHCloseEdgeEnable(CORBA::Boolean enable )
289 if ( GetRestHCloseEdgeEnable() != enable )
291 GetImpl()->SetRestHCloseEdgeEnable( enable );
293 SMESH::TPythonDump() << _this() << ".SetRestHCloseEdgeEnable( " << enable << " )";
297 CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHCloseEdgeEnable()
299 return GetImpl()->GetRestHCloseEdgeEnable();
302 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfCurvFactor(CORBA::Double f )
304 if ( GetRestHSurfCurvFactor() != f )
306 GetImpl()->SetRestHSurfCurvFactor( f );
308 SMESH::TPythonDump() << _this() << ".SetRestHSurfCurvFactor( " << SMESH::TVar(f) << " )";
312 CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfCurvFactor()
314 return GetImpl()->GetRestHSurfCurvFactor();
317 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfCurvEnable(CORBA::Boolean enable )
319 if ( GetRestHSurfCurvEnable() != enable )
321 GetImpl()->SetRestHSurfCurvEnable( enable );
323 SMESH::TPythonDump() << _this() << ".SetRestHSurfCurvEnable( " << enable << " )";
327 CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfCurvEnable()
329 return GetImpl()->GetRestHSurfCurvEnable();
332 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHEdgeAngleFactor(CORBA::Double f )
334 if ( GetRestHEdgeAngleFactor() != f )
336 GetImpl()->SetRestHEdgeAngleFactor( f );
338 SMESH::TPythonDump() << _this() << ".SetRestHEdgeAngleFactor( " << SMESH::TVar(f) << " )";
342 CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHEdgeAngleFactor()
344 return GetImpl()->GetRestHEdgeAngleFactor();
347 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHEdgeAngleEnable(CORBA::Boolean enable )
349 if ( GetRestHEdgeAngleEnable() != enable )
351 GetImpl()->SetRestHEdgeAngleEnable( enable );
353 SMESH::TPythonDump() << _this() << ".SetRestHEdgeAngleEnable( " << enable << " )";
357 CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHEdgeAngleEnable()
359 return GetImpl()->GetRestHEdgeAngleEnable();
362 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfMeshCurvFactor(CORBA::Double f )
364 if ( GetRestHSurfMeshCurvFactor() != f )
366 GetImpl()->SetRestHSurfMeshCurvFactor( f );
368 SMESH::TPythonDump() << _this() << ".SetRestHSurfMeshCurvFactor( " << SMESH::TVar(f) << " )";
372 CORBA::Double NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfMeshCurvFactor()
374 return GetImpl()->GetRestHSurfMeshCurvFactor();
377 void NETGENPlugin_RemesherHypothesis_2D_i::SetRestHSurfMeshCurvEnable(CORBA::Boolean enable )
379 if ( GetRestHSurfMeshCurvEnable() != enable )
381 GetImpl()->SetRestHSurfMeshCurvEnable( enable );
383 SMESH::TPythonDump() << _this() << ".SetRestHSurfMeshCurvEnable( " << enable << " )";
387 CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetRestHSurfMeshCurvEnable()
389 return GetImpl()->GetRestHSurfMeshCurvEnable();
392 void NETGENPlugin_RemesherHypothesis_2D_i::SetKeepExistingEdges( CORBA::Boolean toKeep )
394 if ( GetKeepExistingEdges() != toKeep )
396 GetImpl()->SetKeepExistingEdges( toKeep );
398 SMESH::TPythonDump() << _this() << ".SetKeepExistingEdges( " << toKeep << " )";
402 CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetKeepExistingEdges()
404 return GetImpl()->GetKeepExistingEdges();
407 void NETGENPlugin_RemesherHypothesis_2D_i::SetMakeGroupsOfSurfaces( CORBA::Boolean toMake )
409 if ( GetMakeGroupsOfSurfaces() != toMake )
411 GetImpl()->SetMakeGroupsOfSurfaces( toMake );
413 SMESH::TPythonDump() << _this() << ".SetMakeGroupsOfSurfaces( " << toMake << " )";
417 CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetMakeGroupsOfSurfaces()
419 return GetImpl()->GetMakeGroupsOfSurfaces();
423 NETGENPlugin_RemesherHypothesis_2D_i::SetFixedEdgeGroup( SMESH::SMESH_GroupBase_ptr edgeGroup )
425 const SMESH_Group * group = 0;
426 if ( SMESH_GroupBase_i* group_i = SMESH::DownCast< SMESH_GroupBase_i* >( edgeGroup ))
428 if ( group_i->GetType() == SMESH::EDGE )
429 group = group_i->GetSmeshGroup();
432 int id = group ? group->GetID() : -1;
433 if ( id != GetImpl()->GetFixedEdgeGroupID() )
435 GetImpl()->SetFixedEdgeGroup( group );
436 SMESH::TPythonDump() << _this() << ".SetFixedEdgeGroup( " << edgeGroup << " )";
440 SMESH::SMESH_GroupBase_ptr
441 NETGENPlugin_RemesherHypothesis_2D_i::GetFixedEdgeGroup( SMESH::SMESH_Mesh_ptr mesh )
443 SMESH::SMESH_GroupBase_var resGroup;
444 if ( SMESH_Mesh_i* mesh_i = SMESH::DownCast< SMESH_Mesh_i* >( mesh ))
446 const std::map<int, SMESH::SMESH_GroupBase_ptr>& groups = mesh_i->getGroups();
447 std::map<int, SMESH::SMESH_GroupBase_ptr>::const_iterator i_gr =
448 groups.find( GetImpl()->GetFixedEdgeGroupID() );
449 if ( i_gr != groups.end() && i_gr->second->GetType() == SMESH::EDGE )
450 resGroup = SMESH::SMESH_GroupBase::_duplicate( i_gr->second );
452 return resGroup._retn();
455 void NETGENPlugin_RemesherHypothesis_2D_i::SetLoadMeshOnCancel( CORBA::Boolean toMake )
457 if ( GetLoadMeshOnCancel() != toMake )
459 GetImpl()->SetLoadMeshOnCancel( toMake );
461 SMESH::TPythonDump() << _this() << ".SetLoadMeshOnCancel( " << toMake << " )";
465 CORBA::Boolean NETGENPlugin_RemesherHypothesis_2D_i::GetLoadMeshOnCancel()
467 return GetImpl()->GetLoadMeshOnCancel();