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
22 // File : SMESHGUI_MeshOp.cxx
23 // Author : Sergey LITONIN, Open CASCADE S.A.S.
26 #include "SMESHGUI_MeshOp.h"
29 #include "SMESHGUI_GEOMGenUtils.h"
30 #include "SMESHGUI_Hypotheses.h"
31 #include "SMESHGUI_HypothesesUtils.h"
32 #include "SMESHGUI_MeshDlg.h"
33 #include "SMESHGUI_Operations.h"
34 #include "SMESHGUI_ShapeByMeshDlg.h"
35 #include "SMESHGUI_Utils.h"
36 #include "SMESH_NumberFilter.hxx"
37 #include "SMESH_TypeFilter.hxx"
39 // SALOME GEOM includes
40 #include <GEOM_SelectionFilter.h>
42 #include <GeometryGUI.h>
43 #include <GEOM_wrap.hxx>
44 #include <GEOMImpl_Types.hxx>
46 // SALOME GUI includes
47 #include <SalomeApp_Tools.h>
48 #include <SalomeApp_Application.h>
49 #include <LightApp_Application.h>
50 #include <LightApp_SelectionMgr.h>
51 #include <LightApp_UpdateFlags.h>
52 #include <SUIT_MessageBox.h>
53 #include <SUIT_OverrideCursor.h>
54 #include <SUIT_Session.h>
55 #include <SALOME_InteractiveObject.hxx>
56 #include <SALOME_ListIO.hxx>
58 // SALOME KERNEL includes
59 #include <SALOMEDS_SComponent.hxx>
60 #include <SALOMEDS_SObject.hxx>
61 #include <SALOMEDS_Study.hxx>
62 #include <SALOMEDS_wrap.hxx>
65 #include <QStringList>
67 #include <QApplication>
71 #include <TopoDS_Shape.hxx>
72 #include <TopoDS_Shell.hxx>
73 #include <TopExp_Explorer.hxx>
74 #include <BRep_Tool.hxx>
76 //================================================================================
79 * \param theToCreate - if this parameter is true then operation is used for creation,
80 * for editing otherwise
82 * Initialize operation
84 //================================================================================
85 SMESHGUI_MeshOp::SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh )
86 : SMESHGUI_SelectionOp(),
89 myToCreate( theToCreate ),
90 myIsMesh( theIsMesh ),
91 myIsInvalidSubMesh( false )
93 if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists
94 GeometryGUI::InitGeomGen();
95 myIsOnGeometry = true;
99 //================================================================================
103 //================================================================================
104 SMESHGUI_MeshOp::~SMESHGUI_MeshOp()
110 //================================================================================
112 * \brief Gets dialog of this operation
113 * \retval LightApp_Dialog* - pointer to dialog of this operation
115 //================================================================================
116 LightApp_Dialog* SMESHGUI_MeshOp::dlg() const
121 //================================================================================
123 * \brief Creates or edits mesh
124 * \retval bool - TRUE if operation is performed successfully, FALSE otherwise
126 * Virtual slot redefined from the base class called when "Apply" button is clicked
127 * creates or edits mesh
129 //================================================================================
130 bool SMESHGUI_MeshOp::onApply()
132 if (SMESHGUI::isStudyLocked())
136 if ( !isValid( aMess ) )
140 SUIT_MessageBox::warning( myDlg, tr( "SMESH_WRN_WARNING" ), aMess );
144 bool aResult = false;
148 QStringList anEntryList;
149 if ( myToCreate && myIsMesh )
150 aResult = createMesh( aMess, anEntryList );
151 if (( myToCreate && !myIsMesh ) || myIsInvalidSubMesh )
152 aResult = createSubMesh( aMess, anEntryList );
153 else if ( !myToCreate )
154 aResult = editMeshOrSubMesh( aMess );
157 SMESHGUI::Modified();
158 update( UF_ObjBrowser | UF_Model );
159 if( LightApp_Application* anApp =
160 dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
161 myObjectToSelect = anApp->browseObjects( anEntryList, isApplyAndClose() );
164 catch ( const SALOME::SALOME_Exception& S_ex )
166 SalomeApp_Tools::QtCatchCorbaException( S_ex );
182 aMess = tr( "SMESH_OPERATION_FAILED" );
183 SUIT_MessageBox::warning( myDlg, tr( "SMESH_ERROR" ), aMess );
189 //================================================================================
191 * \brief Creates dialog if necessary and shows it
193 * Virtual method redefined from base class called when operation is started creates
194 * dialog if necessary and shows it, activates selection
196 //================================================================================
197 void SMESHGUI_MeshOp::startOperation()
199 myIgnoreAlgoSelection = false;
203 myDlg = new SMESHGUI_MeshDlg( myToCreate, myIsMesh );
204 for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ )
206 connect( myDlg->tab( i ), SIGNAL( createHyp( const int, const int ) ),
207 this, SLOT( onCreateHyp( const int, const int ) ) );
208 connect( myDlg->tab( i ), SIGNAL( editHyp( const int, const int ) ),
209 this, SLOT( onEditHyp( const int, const int ) ) );
210 connect( myDlg->tab( i ), SIGNAL( selectAlgo( const int ) ),
211 this, SLOT( onAlgoSelected( const int ) ) );
213 connect( myDlg, SIGNAL( hypoSet( const QString& )), SLOT( onHypoSet( const QString& )));
214 connect( myDlg, SIGNAL( geomSelectionByMesh( bool )), SLOT( onGeomSelectionByMesh( bool )));
215 connect( myDlg, SIGNAL( selectMeshType( const int, const int ) ), SLOT( onAlgoSetByMeshType( const int, const int)));
218 if ( myIsMesh ) myHelpFileName = "constructing_meshes.html";
219 else myHelpFileName = "constructing_submeshes.html";
222 myHelpFileName = "editing_meshes.html";
225 SMESHGUI_SelectionOp::startOperation();
227 // clear available hypotheses
229 for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ )
231 SMESHGUI_MeshTab* aTab = myDlg->tab( i );
233 aTab->setAvailableHyps( Algo, hypList );
234 aTab->setAvailableHyps( MainHyp, hypList );
235 aTab->setAvailableHyps( AddHyp, hypList );
236 aTab->setExistingHyps( MainHyp, hypList );
237 aTab->setExistingHyps( AddHyp, hypList );
238 myExistingHyps[ i ][ MainHyp ].clear();
239 myExistingHyps[ i ][ AddHyp ].clear();
244 myDlg->activateObject( myIsMesh ? SMESHGUI_MeshDlg::Geom : SMESHGUI_MeshDlg::Mesh );
248 myDlg->activateObject( SMESHGUI_MeshDlg::Obj );
251 updateMeshTypeList();
252 myDlg->setCurrentMeshType( MT_ANY );
254 myDlg->setCurrentTab( SMESH::DIM_3D );
255 myDlg->setGeomPopupEnabled(false);
260 myHasConcurrentSubBefore = false;
261 myObjectToSelect.clear();
264 //=================================================================================
266 * \brief Selects a recently created mesh or sub-mesh if necessary
268 * Virtual method redefined from base class called when operation is committed
269 * selects a recently created mesh or sub-mesh if necessary. Allows to perform
270 * selection when the custom selection filters are removed.
272 //=================================================================================
273 void SMESHGUI_MeshOp::commitOperation()
275 SMESHGUI_SelectionOp::commitOperation();
277 if ( !myObjectToSelect.isEmpty() ) {
278 if ( LightApp_SelectionMgr* aSelectionMgr = selectionMgr() ) {
279 SUIT_DataOwnerPtrList aList;
280 aList.append( new LightApp_DataOwner( myObjectToSelect ) );
281 aSelectionMgr->setSelected( aList );
286 //================================================================================
288 * \brief Creates selection filter
289 * \param theId - identifier of current selection widget
290 * \retval SUIT_SelectionFilter* - pointer to the created filter or null
292 * Creates selection filter in accordance with identifier of current selection widget
294 //================================================================================
295 SUIT_SelectionFilter* SMESHGUI_MeshOp::createFilter( const int theId ) const
297 if ( theId == SMESHGUI_MeshDlg::Geom )
299 // TColStd_MapOfInteger allTypesMap;
300 // for ( int i = 0; i < 10; i++ )
301 // allTypesMap.Add( i );
302 // return new SMESH_NumberFilter( "GEOM", TopAbs_SHAPE, 0, allTypesMap );
303 return new GEOM_SelectionFilter( (SalomeApp_Study*)study(), true );
305 else if ( theId == SMESHGUI_MeshDlg::Obj && !myToCreate )
306 return new SMESH_TypeFilter( SMESH::MESHorSUBMESH );
307 else if ( theId == SMESHGUI_MeshDlg::Mesh )
308 return new SMESH_TypeFilter( SMESH::MESH );
313 //================================================================================
315 * \brief check if selected shape is a sub-shape of the shape to mesh
316 * \retval bool - check result
318 //================================================================================
319 bool SMESHGUI_MeshOp::isSubshapeOk() const
321 if ( !myToCreate || myIsMesh ) // not submesh creation
325 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
326 _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toUtf8().data() );
327 if (!pMesh) return false;
329 SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
330 if (mesh->_is_nil()) return false;
332 // main shape of the mesh
333 GEOM::GEOM_Object_var mainGeom = mesh->GetShapeToMesh();
334 if (mainGeom->_is_nil()) return false;
338 myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
340 if (aGEOMs.count() > 0) {
341 GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
342 if (geomGen->_is_nil()) return false;
344 GEOM::GEOM_IGroupOperations_ptr op = geomGen->GetIGroupOperations();
345 if (op->_is_nil()) return false;
347 // check all selected shapes
348 QStringList::const_iterator aSubShapesIter = aGEOMs.begin();
349 for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++) {
350 QString aSubGeomEntry = (*aSubShapesIter);
351 _PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID(aSubGeomEntry.toUtf8().data());
352 if (!pSubGeom) return false;
354 GEOM::GEOM_Object_var aSubGeomVar =
355 GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
356 if (aSubGeomVar->_is_nil()) return false;
358 // skl for NPAL14695 - implementation of searching of mainObj
359 GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as
360 mainObj already exists! */
361 while( !mainObj->_is_nil()) {
362 CORBA::String_var entry1 = mainObj->GetEntry();
363 CORBA::String_var entry2 = mainGeom->GetEntry();
364 if (std::string( entry1.in() ) == entry2.in() )
366 mainObj = op->GetMainShape(mainObj);
368 if ( aSubGeomVar->GetShapeType() == GEOM::COMPOUND )
370 // is aSubGeomVar a compound of sub-shapes?
371 GEOM::GEOM_IShapesOperations_wrap sop = geomGen->GetIShapesOperations();
372 if (sop->_is_nil()) return false;
373 GEOM::ListOfLong_var ids = sop->GetAllSubShapesIDs( aSubGeomVar,
374 GEOM::SHAPE,/*sorted=*/false);
375 if ( ids->length() > 0 )
378 GEOM::GEOM_Object_var compSub = geomGen->AddSubShape( aSubGeomVar, ids );
379 if ( !compSub->_is_nil() )
381 GEOM::ListOfGO_var shared = sop->GetSharedShapes( mainGeom,
383 compSub->GetShapeType() );
384 geomGen->RemoveObject( compSub );
385 compSub->UnRegister();
386 if ( shared->length() > 0 ) {
387 geomGen->RemoveObject( shared[0] );
388 shared[0]->UnRegister();
390 return ( shared->length() > 0 );
400 //================================================================================
402 * \brief Return name of the algorithm that does not support sub-meshes and makes
403 * sub-mesh creation useless
404 * \retval char* - string is to be deleted!!!
406 //================================================================================
407 char* SMESHGUI_MeshOp::isSubmeshIgnored() const
409 if ( myToCreate && !myIsMesh ) {
411 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
412 QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
413 _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toUtf8().data() );
416 QStringList algoNames;
418 existingHyps(3, Algo, pMesh, algoNames, algoList);
419 if (!algoList.empty()) {
420 HypothesisData* algo =
421 SMESH::GetHypothesisData( SMESH::toQStr( algoList[0].first->GetName() ));
423 algo->InputTypes.empty() && // builds all dimensions it-self
424 !algo->IsSupportSubmeshes )
425 return CORBA::string_dup( algoNames[0].toUtf8().data() );
428 // GEOM::GEOM_Object_var geom;
429 // if (_PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toUtf8().data() ))
430 // geom = SMESH::SObjectToInterface<GEOM::GEOM_Object>( pGeom );
432 // if ( !geom->_is_nil() && geom->GetShapeType() >= GEOM::FACE ) { // WIRE, EDGE as well
433 existingHyps(2, Algo, pMesh, algoNames, algoList);
434 if (!algoList.empty()) {
435 HypothesisData* algo =
436 SMESH::GetHypothesisData( SMESH::toQStr( algoList[0].first->GetName() ));
438 algo->InputTypes.empty() && // builds all dimensions it-self
439 !algo->IsSupportSubmeshes )
440 return CORBA::string_dup( algoNames[0].toUtf8().data() );
448 //================================================================================
450 * \brief find an existing submesh by the selected shape
451 * \retval _PTR(SObject) - the found submesh SObject
453 //================================================================================
454 _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
456 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
457 _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toUtf8().data() );
458 if ( pMesh && !myGeom->_is_nil() ) {
460 switch ( myGeom->GetShapeType() ) {
461 case GEOM::VERTEX: tag = SMESH::Tag_SubMeshOnVertex; break;
462 case GEOM::EDGE: tag = SMESH::Tag_SubMeshOnEdge; break;
463 case GEOM::WIRE: tag = SMESH::Tag_SubMeshOnWire; break;
464 case GEOM::FACE: tag = SMESH::Tag_SubMeshOnFace; break;
465 case GEOM::SHELL: tag = SMESH::Tag_SubMeshOnShell; break;
466 case GEOM::SOLID: tag = SMESH::Tag_SubMeshOnSolid; break;
467 case GEOM::COMPOUND: tag = SMESH::Tag_SubMeshOnCompound; break;
470 _PTR(GenericAttribute) anAttr;
471 _PTR(SObject) aSubmeshRoot;
472 _PTR(Study) aStudy = SMESH::getStudy();
473 if ( pMesh->FindSubObject( tag, aSubmeshRoot ) )
475 _PTR(ChildIterator) smIter = aStudy->NewChildIterator( aSubmeshRoot );
476 for ( ; smIter->More(); smIter->Next() )
478 _PTR(SObject) aSmObj = smIter->Value();
479 if ( ! aSmObj->FindAttribute( anAttr, "AttributeIOR" ))
481 _PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSmObj);
482 for ( ; anIter1->More(); anIter1->Next()) {
483 _PTR(SObject) pGeom2 = anIter1->Value();
484 if ( pGeom2->ReferencedObject( pGeom2 ) &&
485 myGeomEntry == pGeom2->GetID().c_str() )
491 return _PTR(SObject)();
494 //================================================================================
496 * \brief Updates dialog's look and feel
498 * Virtual method redefined from the base class updates dialog's look and feel
500 //================================================================================
501 void SMESHGUI_MeshOp::selectionDone()
503 if (!dlg()->isVisible() || !myDlg->isEnabled())
506 SMESHGUI_SelectionOp::selectionDone();
509 myGeom = GEOM::GEOM_Object::_nil();
510 myIsInvalidSubMesh = false;
511 myIsOnGeometry = true;
515 // allow selecting multiple geom objects only for sub-mesh creation
517 myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aGEOMs );
518 int nbGeoms = aGEOMs.count();
521 myGeomEntry = aGEOMs[0];
522 _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( myGeomEntry.toUtf8().data() );
523 if ( nbGeoms > 1 && myToCreate && myIsMesh )
525 selectObject( pGeom );
529 myGeom = SMESH::SObjectToInterface< GEOM::GEOM_Object >( pGeom ); // creation case
532 QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
533 _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toUtf8().data() );
535 SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface< SMESH::SMESH_Mesh >( pObj );
536 SMESH::SMESH_subMesh_var subMesh;
538 if ( !myToCreate ) // edition: read hypotheses
542 subMesh = SMESH::SObjectToInterface< SMESH::SMESH_subMesh >( pObj );
543 myIsMesh = subMesh->_is_nil();
544 myGeom = SMESH::GetShapeOnMeshOrSubMesh( pObj );
545 myIsInvalidSubMesh = ( !myIsMesh && subMesh->GetId() < 1 );
546 if ( !mesh->_is_nil() && !mesh->HasShapeToMesh() )
548 myIsOnGeometry = false;
549 myGeom = GEOM::GEOM_Object::_nil();
551 if ( !myGeom->_is_nil() )
552 myGeomEntry = myGeom->GetStudyEntry();
554 myDlg->setTitile( myToCreate, myIsMesh );
555 myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !subMesh->_is_nil() );
556 myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, !myGeom->_is_nil() );
557 myDlg->objectWg( SMESHGUI_MeshDlg::Mesh, SMESHGUI_MeshDlg::Btn )->hide();
558 if ( myIsInvalidSubMesh )
560 // it is necessary to select a new geometry
561 myDlg->objectWg( SMESHGUI_MeshDlg::Geom, SMESHGUI_MeshDlg::Btn )->show();
562 myDlg->activateObject( SMESHGUI_MeshDlg::Geom );
566 myDlg->objectWg( SMESHGUI_MeshDlg::Geom, SMESHGUI_MeshDlg::Btn )->hide();
568 myDlg->updateGeometry();
575 else if ( !myIsMesh ) // sub-mesh creation
577 // if a submesh on the selected shape already exist, pass to submesh edition mode
578 if ( _PTR(SObject) pSubmesh = getSubmeshByGeom() ) {
579 subMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( pSubmesh );
580 bool editSubmesh = ( !subMesh->_is_nil() &&
581 SUIT_MessageBox::question( myDlg, tr( "SMESH_WARNING" ),
582 tr( "EDIT_SUBMESH_QUESTION"),
583 SUIT_MessageBox::Yes |
585 SUIT_MessageBox::No )
586 == SUIT_MessageBox::Yes );
589 selectionMgr()->clearFilters();
590 selectObject( pSubmesh );
591 SMESHGUI::GetSMESHGUI()->switchToOperation( SMESHOp::OpEditMeshOrSubMesh );
596 myDlg->selectObject( "", SMESHGUI_MeshDlg::Geom, "" );
597 selectObject( _PTR(SObject)() );
602 // discard selected mesh if submesh creation not allowed because of
603 // a global algorithm that does not support submeshes
604 if ( char* algoName = isSubmeshIgnored() ) {
605 SUIT_MessageBox::warning( myDlg, tr( "SMESH_ERROR" ),
606 tr("SUBMESH_NOT_ALLOWED").arg(algoName));
607 CORBA::string_free( algoName );
608 myDlg->selectObject( "", SMESHGUI_MeshDlg::Mesh, "" );
609 selectObject( _PTR(SObject)() );
614 // enable/disable popup for choice of geom selection way
616 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
617 if ( _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toLatin1().data() ))
619 mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
620 if ( !mesh->_is_nil() )
621 enable = /*( shapeDim > 1 ) && */( mesh->NbEdges() > 0 );
623 myDlg->setGeomPopupEnabled( enable );
625 //rnv: issue 21056: "Create Sub Mesh": focus should automatically switch to geometry
626 if ( pObj && myGeomEntry.isEmpty() )
627 myDlg->activateObject( SMESHGUI_MeshDlg::Geom );
630 setFilteredAlgoData();
633 catch ( const SALOME::SALOME_Exception& S_ex )
635 SalomeApp_Tools::QtCatchCorbaException( S_ex );
642 //================================================================================
644 * \brief Verifies validity of input data
645 * \param theMess - Output parameter intended for returning error message
646 * \retval bool - TRUE if input data is valid, false otherwise
648 * Verifies validity of input data. This method is called when "Apply" or "OK" button
649 * is pressed before mesh creation or editing.
651 //================================================================================
652 bool SMESHGUI_MeshOp::isValid( QString& theMess ) const
654 // Selected object to be edited
655 if ( !myToCreate && myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ) == "" )
657 theMess = tr( "THERE_IS_NO_OBJECT_FOR_EDITING" );
662 QString aMeshName = myDlg->objectText( SMESHGUI_MeshDlg::Obj ).trimmed();
663 if ( aMeshName.isEmpty() )
665 theMess = myIsMesh ? tr( "NAME_OF_MESH_IS_EMPTY" ) : tr( "NAME_OF_SUBMESH_IS_EMPTY" );
669 /* // Imported mesh, if create sub-mesh or edit mesh
670 if ( !myToCreate || ( myToCreate && !myIsMesh ))
672 QString aMeshEntry = myDlg->selectedObject
673 ( myToCreate ? SMESHGUI_MeshDlg::Mesh : SMESHGUI_MeshDlg::Obj );
674 if ( _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toUtf8().data() )) {
675 SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
676 if ( !mesh->_is_nil() && CORBA::is_nil( mesh->GetShapeToMesh() )) {
677 theMess = tr( "IMPORTED_MESH" );
684 if ( myToCreate || myIsInvalidSubMesh )
686 QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
687 if ( aGeomEntry.isEmpty() )
689 theMess = tr( myIsMesh ?
690 "GEOMETRY_OBJECT_IS_NOT_DEFINED_MESH" :
691 "GEOMETRY_OBJECT_IS_NOT_DEFINED_SUBMESH");
695 if ( SUIT_MessageBox::warning( myDlg, tr( "SMESH_WRN_WARNING" ), theMess,
696 SUIT_MessageBox::Yes, SUIT_MessageBox::No ) == SUIT_MessageBox::No )
703 _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toUtf8().data() );
704 if ( !pGeom || GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() )->_is_nil() )
706 theMess = tr( "GEOMETRY_OBJECT_IS_NULL" );
711 if ( !myIsMesh ) // i.e sub-mesh creation,
713 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
714 if ( aMeshEntry == "" )
716 theMess = tr( "MESH_IS_NOT_DEFINED" );
719 _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toUtf8().data() );
720 if ( !pMesh || SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() )->_is_nil() )
722 theMess = tr( "MESH_IS_NULL" );
725 if ( !isSubshapeOk() )
727 theMess = tr( "INVALID_SUBSHAPE" );
736 //================================================================================
738 * \brief check compatibility of the algorithm and another algorithm or hypothesis
739 * \param theAlgoData - algorithm data
740 * \param theHypData - hypothesis data
741 * \param theHypType - hypothesis type
742 * \retval bool - check result
744 //================================================================================
745 static bool isCompatible(const HypothesisData* theAlgoData,
746 const HypothesisData* theHypData,
747 const int theHypType)
752 if ( theHypType == SMESHGUI_MeshOp::Algo ) // compatibility of 2 algos
753 return SMESH::IsCompatibleAlgorithm( theAlgoData, theHypData );
755 bool isOptional; // compatibility of algo and hyp
756 return ( SMESH::IsAvailableHypothesis( theAlgoData, theHypData->TypeName, isOptional ));
759 //================================================================================
761 * \brief check compatibility of the geometry
762 * \param theAlgoData - to select hypos able to be used by this algo
763 * \param theDim - algo dimension
764 * \retval bool - check result
766 //================================================================================
767 bool SMESHGUI_MeshOp::isCompatibleToGeometry(HypothesisData* theAlgoData,
770 if ( theDim < 1 || myGeom->_is_nil() )
773 bool isApplicable = false;
774 if ( myGeomEntry == myLastGeomEntry && !myGeomEntry.isEmpty() ) {
775 THypLabelIsAppMap::const_iterator lab2isApp = myHypMapIsApplicable.find( theAlgoData->Label );
776 if ( lab2isApp != myHypMapIsApplicable.end() ) {
777 isApplicable = lab2isApp.value();
781 bool toCheckIsApplicableToAll = !myIsMesh;
782 if ( toCheckIsApplicableToAll )
783 toCheckIsApplicableToAll = ( myGeom->GetType() == GEOM_GROUP );
785 isApplicable = SMESH::IsApplicable( theAlgoData->TypeName, myGeom, toCheckIsApplicableToAll );
786 myHypMapIsApplicable.insert( theAlgoData->Label, isApplicable );
790 //================================================================================
792 * \brief check compatibility of the mesh type
793 * \param theAlgoData - to select hypos able to be used by this algo
794 * \param theDim - algo dimension
795 * \retval bool - check result
797 //================================================================================
798 bool SMESHGUI_MeshOp::isCompatibleToMeshType(HypothesisData* theAlgoData,
805 int curMeshType = myDlg->currentMeshType();
806 switch ( curMeshType ) {
816 case MT_QUADRILATERAL:
840 bool isAvailableAlgo = theAlgoData->OutputTypes.isEmpty();
841 QStringList::const_iterator inElemType = theAlgoData->OutputTypes.begin();
842 for ( ; inElemType != theAlgoData->OutputTypes.end(); inElemType++ )
844 if ( *inElemType == elemType )
846 isAvailableAlgo = true;
850 return isAvailableAlgo;
853 //================================================================================
855 * \brief Get available hypotheses or algorithms
856 * \param theDim - specifies dimension of returned hypotheses/algorifms
857 * \param theHypType - specifies whether algorims or hypotheses or additional ones
858 * are retrieved (possible values are in HypType enumeration)
859 * \param theHyps - output list of hypotheses' names
860 * \param thePrevAlgoData - to select hypos able to be used by previously algo (optional)
861 * \param theNextAlgoData - to select hypos able to be used by next algo (optional)
862 * \param theMeshType - type of mesh for filtering algorithms (optional)
864 * Get available hypotheses or algorithm in accordance with input parameters.
865 * Result (\a theHyps) optionally depends on the following:
866 * - selected algorithm(s)
867 * - selected geometry
868 * - selected mesh type
870 //================================================================================
871 void SMESHGUI_MeshOp::availableHyps( const int theDim,
872 const int theHypType,
873 QStringList& theHyps,
874 THypDataList& theDataList,
875 HypothesisData* thePrevAlgoData,
876 HypothesisData* theNextAlgoData,
877 const QString& theMeshType)
881 bool isAlgo = ( theHypType == Algo );
882 bool isAux = ( theHypType >= AddHyp );
883 QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux, myIsOnGeometry, !myIsMesh );
885 std::multimap< double, HypothesisData* > sortedHyps;
886 QStringList::const_iterator anIter;
887 for ( anIter = aHypTypeNameList.begin(); anIter != aHypTypeNameList.end(); ++anIter )
889 HypothesisData* aData = SMESH::GetHypothesisData( *anIter );
890 if ( isCompatible( thePrevAlgoData, aData, theHypType ) &&
891 isCompatible( theNextAlgoData, aData, theHypType ) &&
892 isCompatibleToGeometry( aData, theDim ) &&
893 isCompatibleToMeshType( aData, theDim ))
895 int groupID = aData->GroupID;
896 int priority = aData->Priority;
897 if ( groupID < 0 || groupID > 9 ) groupID = 9;
898 if ( priority < 0 || priority > 999 ) priority = 999;
900 sortedHyps.insert( std::make_pair( groupID + priority * 1e-3, aData ));
904 if ( !sortedHyps.empty() )
906 HypothesisData* aPrevGroup = SMESH::GetGroupTitle( sortedHyps.rbegin()->second, isAlgo );
907 std::multimap< double, HypothesisData* >::iterator key_hyp = sortedHyps.begin();
908 for ( ; key_hyp != sortedHyps.end(); ++key_hyp )
910 HypothesisData* aData = key_hyp->second;
911 HypothesisData* aGroup = SMESH::GetGroupTitle( aData, isAlgo );
912 if ( aPrevGroup != aGroup )
914 theDataList.append( aGroup );
915 theHyps.append( aGroup->Label );
918 theDataList.append( aData );
919 theHyps.append( aData->Label );
924 //================================================================================
926 * \brief Gets existing hypotheses or algorithms
927 * \param theDim - specifies dimension of returned hypotheses/algorifms
928 * \param theHypType - specifies whether algorims or hypotheses or additional ones
929 * are retrieved (possible values are in HypType enumeration)
930 * \param theFather - start object for finding ( may be component, mesh, or sub-mesh )
931 * \param theHyps - output list of names.
932 * \param theHypVars - output list of variables.
933 * \param theAlgoData - to select hypos able to be used by this algo (optional)
935 * Gets existing (i.e. already created) hypotheses or algorithm in accordance with
938 * WARNING: when using this method to get hyps existing in Mesh component,
939 * call availableHyps() before in order to get only hyps of available types
940 * that was filtered by availableHyps()
942 //================================================================================
943 void SMESHGUI_MeshOp::existingHyps( const int theDim,
944 const int theHypType,
945 _PTR(SObject) theFather,
946 QStringList& theHyps,
947 THypList& theHypList,
948 HypothesisData* theAlgoData) const
950 // Clear hypoheses list
957 _PTR(SObject) aHypRoot;
958 _PTR(GenericAttribute) anAttr;
959 _PTR(AttributeName) aName;
960 _PTR(AttributeIOR) anIOR;
962 const bool isMesh = !_CAST( SComponent, theFather );
965 aPart = theHypType == Algo ? SMESH::Tag_RefOnAppliedAlgorithms : SMESH::Tag_RefOnAppliedHypothesis;
967 aPart = theHypType == Algo ? SMESH::Tag_AlgorithmsRoot : SMESH::Tag_HypothesisRoot;
969 const bool isAux = ( theHypType >= AddHyp );
970 const bool allHyps = ( !isMesh && theHypType != Algo && theDim > -1);
972 if ( theFather->FindSubObject( aPart, aHypRoot ) )
974 _PTR(ChildIterator) anIter = SMESH::getStudy()->NewChildIterator( aHypRoot );
975 for ( ; anIter->More(); anIter->Next() )
977 _PTR(SObject) anObj = anIter->Value();
978 if ( isMesh ) // i.e. mesh or submesh
980 _PTR(SObject) aRefObj;
981 if ( anObj->ReferencedObject( aRefObj ) )
986 if ( anObj->FindAttribute( anAttr, "AttributeName" ) )
989 CORBA::Object_var aVar = _CAST(SObject,anObj)->GetObject();
990 if ( !CORBA::is_nil( aVar ) )
992 SMESH::SMESH_Hypothesis_var aHypVar = SMESH::SMESH_Hypothesis::_narrow( aVar );
993 if ( !aHypVar->_is_nil() )
995 CORBA::String_var hypType = aHypVar->GetName();
996 HypothesisData* aData = SMESH::GetHypothesisData( hypType.in() );
997 if ( !aData) continue;
998 if (( theDim == -1 || aData->Dim.contains( theDim ) ) &&
999 ( isCompatible ( theAlgoData, aData, theHypType )) &&
1000 ( theHypType == Algo || isAux == aData->IsAuxOrNeedHyp ) &&
1001 ( !allHyps || myAvailableHypData[theDim][theHypType].count(aData) ))
1003 std::string aHypName = aName->Value();
1004 theHyps.append( aHypName.c_str() );
1005 theHypList.append( THypItem( aHypVar, aHypName.c_str() ) );
1014 //================================================================================
1016 * \brief If create or edit a submesh, return a hypothesis holding parameters used
1017 * to mesh a sub-shape
1018 * \param aHypType - The hypothesis type name
1019 * \param aServerLib - Server library name
1020 * \param hypData - The structure holding the hypothesis type etc.
1021 * \retval SMESH::SMESH_Hypothesis_var - the hypothesis holding parameter values
1023 //================================================================================
1024 SMESH::SMESH_Hypothesis_var
1025 SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
1026 const QString& aServerLib ) const
1028 if ( aHypType.isEmpty() || aServerLib.isEmpty() )
1029 return SMESH::SMESH_Hypothesis::_nil();
1031 const int nbColonsInMeshEntry = 3;
1032 bool isSubMesh = myToCreate ?
1034 myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ).count(':') > nbColonsInMeshEntry;
1036 // get mesh and geom object
1037 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
1038 GEOM::GEOM_Object_var aGeomVar = GEOM::GEOM_Object::_nil();
1043 anEntry = myDlg->selectedObject
1044 ( myToCreate ? SMESHGUI_MeshDlg::Mesh : SMESHGUI_MeshDlg::Obj );
1045 if ( _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anEntry.toUtf8().data() ))
1047 CORBA::Object_ptr Obj = _CAST( SObject,pObj )->GetObject();
1048 if ( myToCreate ) // mesh and geom may be selected
1050 aMesh = SMESH::SMESH_Mesh::_narrow( Obj );
1051 anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
1052 if ( _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( anEntry.toUtf8().data() ))
1053 aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
1055 else // edition: sub-mesh may be selected
1057 SMESH::SMESH_subMesh_var sm = SMESH::SMESH_subMesh::_narrow( Obj );
1058 if ( !sm->_is_nil() ) {
1059 aMesh = sm->GetFather();
1060 aGeomVar = sm->GetSubShape();
1067 if ( !myToCreate ) // mesh to edit can be selected
1069 anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
1070 if ( _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( anEntry.toUtf8().data() ))
1072 aMesh = SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() );
1073 if ( !aMesh->_is_nil() )
1074 aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pMesh );
1077 if ( aGeomVar->_is_nil() ) {
1078 anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
1079 if ( _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( anEntry.toUtf8().data() ))
1081 aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
1086 SMESH::SMESH_Hypothesis_var hyp =
1087 SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toUtf8().data(),
1088 aServerLib.toUtf8().data(),
1091 /*byMesh = */isSubMesh);
1092 if ( hyp->_is_nil() && isSubMesh )
1093 hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
1094 aServerLib.toUtf8().data(),
1097 /*byMesh = */false);
1101 //================================================================================
1103 * \brief initialize a hypothesis creator
1105 //================================================================================
1107 void SMESHGUI_MeshOp::initHypCreator( SMESHGUI_GenericHypothesisCreator* theCreator )
1109 if ( !theCreator ) return;
1111 // Set shapes, of mesh and sub-mesh if any
1113 // get Entry of the Geom object
1114 QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
1115 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
1116 QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
1118 if ( myToCreate && myIsMesh )
1119 aMeshEntry = aGeomEntry;
1121 if ( aMeshEntry != aGeomEntry ) { // Get Geom object from Mesh of a sub-mesh being edited
1122 _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( aMeshEntry.toUtf8().data() );
1123 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
1124 aMeshEntry = ( aGeomVar->_is_nil() ) ? QString() : SMESH::toQStr( aGeomVar->GetStudyEntry() );
1127 if ( aMeshEntry == "" && aGeomEntry == "" ) { // get geom of an object being edited
1128 _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toUtf8().data() );
1130 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj, &isMesh );
1131 if ( !aGeomVar->_is_nil() )
1133 aGeomEntry = SMESH::toQStr( aGeomVar->GetStudyEntry() );
1135 aMeshEntry = aGeomEntry;
1139 if ( anObjEntry != "" && aGeomEntry != "" && aMeshEntry == "" ) {
1140 // take geometry from submesh being created
1141 _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toUtf8().data() );
1143 // if current object is sub-mesh
1144 SMESH::SMESH_subMesh_var aSubMeshVar =
1145 SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
1146 if ( !aSubMeshVar->_is_nil() ) {
1147 SMESH::SMESH_Mesh_var aMesh = aSubMeshVar->GetFather();
1148 if ( !aMesh->_is_nil() ) {
1149 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMesh );
1150 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
1151 if ( !aGeomVar->_is_nil() )
1152 aMeshEntry = SMESH::toQStr( aGeomVar->GetStudyEntry() );
1158 theCreator->setShapeEntry( aGeomEntry );
1159 if ( aMeshEntry != "" )
1160 theCreator->setMainShapeEntry( aMeshEntry );
1162 theCreator->setNoGeomMesh( !myIsOnGeometry && myIsMesh && !myToCreate );
1165 //================================================================================
1167 * \Brief Returns tab dimension
1168 * \param tab - the tab in the dlg
1169 * \param dlg - my dialogue
1170 * \retval int - dimension
1172 //================================================================================
1173 static int getTabDim (const QObject* tab, SMESHGUI_MeshDlg* dlg )
1176 for (int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++)
1177 if (tab == dlg->tab(i))
1182 //================================================================================
1184 * \brief Create hypothesis
1185 * \param theHypType - hypothesis category (main or additional)
1186 * \param theIndex - index of type of hypothesis to be created
1188 * Specifies dimension of hypothesis to be created (using sender() method),
1189 * specifies its type and calls method for hypothesis creation
1191 //================================================================================
1192 void SMESHGUI_MeshOp::onCreateHyp( const int theHypType, const int theIndex )
1194 // Specifies dimension of hypothesis to be created
1195 int aDim = getTabDim( sender(), myDlg );
1199 // Specifies type of hypothesis to be created
1200 THypDataList& dataList = myAvailableHypData[ aDim ][ theHypType ];
1201 if (theIndex < 0 || theIndex >= dataList.count())
1203 QString aHypTypeName = dataList[ theIndex ]->TypeName;
1205 // Create hypothesis
1206 createHypothesis(aDim, theHypType, aHypTypeName);
1211 QString GetUniqueName (const QStringList& theHypNames,
1212 const QString& theName,
1213 size_t theIteration = 1)
1215 QString aName = theName + "_" + QString::number( theIteration );
1216 if ( theHypNames.contains( aName ) )
1217 return GetUniqueName( theHypNames, theName, ++theIteration );
1222 //================================================================================
1224 * Create hypothesis and update dialog.
1225 * \param theDim - dimension of hypothesis to be created
1226 * \param theType - hypothesis category (algorithm, hypothesis, additional hypothesis)
1227 * \param theTypeName - specifies hypothesis to be created
1229 //================================================================================
1230 void SMESHGUI_MeshOp::createHypothesis(const int theDim,
1232 const QString& theTypeName)
1234 HypothesisData* aData = SMESH::GetHypothesisData(theTypeName);
1241 // get a unique hyp name
1242 QStringList aHypNames;
1243 TDim2Type2HypList::const_iterator aDimIter = myExistingHyps.begin();
1244 for ( ; aDimIter != myExistingHyps.end(); aDimIter++) {
1245 const TType2HypList& aType2HypList = aDimIter.value();
1246 TType2HypList::const_iterator aTypeIter = aType2HypList.begin();
1247 for ( ; aTypeIter != aType2HypList.end(); aTypeIter++) {
1248 const THypList& aHypList = aTypeIter.value();
1249 THypList::const_iterator anIter = aHypList.begin();
1250 for ( ; anIter != aHypList.end(); anIter++) {
1251 const THypItem& aHypItem = *anIter;
1252 const QString& aHypName = aHypItem.second;
1253 aHypNames.append(aHypName);
1257 QString aHypName = GetUniqueName( aHypNames, aData->Label);
1260 bool dialog = false;
1262 QString aClientLibName = aData->ClientLibName;
1263 if (aClientLibName == "") {
1264 // Call hypothesis creation server method (without GUI)
1265 SMESH::SMESH_Hypothesis_var aHyp =
1266 SMESH::CreateHypothesis(theTypeName, aHypName, false);
1270 // Get hypotheses creator client (GUI)
1271 SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
1273 // Create hypothesis
1276 // Get parameters appropriate to initialize a new hypothesis
1277 SMESH::SMESH_Hypothesis_var initParamHyp =
1278 getInitParamsHypothesis(theTypeName, aData->ServerLibName);
1280 removeCustomFilters(); // Issue 0020170
1282 // set shapes, of mesh and sub-mesh if any
1283 initHypCreator( aCreator );
1285 myDlg->setEnabled( false );
1286 aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
1291 SMESH::SMESH_Hypothesis_var aHyp =
1292 SMESH::CreateHypothesis(theTypeName, aHypName, false);
1301 //================================================================================
1303 * Necessary steps after hypothesis creation
1304 * \param result - creation result:
1307 * 2 = additional value meaning that slot is called not from dialog box
1309 //================================================================================
1310 void SMESHGUI_MeshOp::onHypoCreated( int result )
1314 int obj = myDlg->getActiveObject();
1315 onActivateObject( obj ); // Issue 0020170. Restore filters
1316 myDlg->setEnabled( true );
1319 _PTR(SComponent) aFather = SMESH::getStudy()->FindComponent("SMESH");
1321 int nbHyp = myExistingHyps[myDim][myType].count();
1322 HypothesisData* algoData = hypData( myDim, Algo, currentHyp( myDim, Algo ));
1323 QStringList aNewHyps;
1324 existingHyps(myDim, myType, aFather, aNewHyps, myExistingHyps[myDim][myType], algoData);
1325 if (aNewHyps.count() > nbHyp)
1327 for (int i = nbHyp; i < aNewHyps.count(); i++)
1328 myDlg->tab(myDim)->addHyp(myType, aNewHyps[i]);
1333 //================================================================================
1335 * \brief Calls plugin methods for hypothesis editing
1336 * \param theHypType - specifies whether main hypothesis or additional one
1338 * \param theIndex - index of existing hypothesis
1340 * Calls plugin methods for hypothesis editing
1342 //================================================================================
1343 void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
1345 // Speicfies dimension of hypothesis to be created
1346 int aDim = getTabDim( sender(), myDlg );
1350 const THypList& aList = myExistingHyps[ aDim ][ theHypType ];
1351 if ( theIndex < 0 || theIndex >= aList.count() )
1353 const THypItem& aHypItem = aList[ theIndex ];
1354 SMESH::SMESH_Hypothesis_var aHyp = aHypItem.first;
1355 if ( aHyp->_is_nil() )
1358 SMESHGUI_GenericHypothesisCreator* aCreator =
1359 SMESH::GetHypothesisCreator( SMESH::toQStr( aHyp->GetName() ));
1362 // set initial parameters
1363 SMESH::SMESH_Hypothesis_var initParamHyp =
1364 getInitParamsHypothesis( SMESH::toQStr( aHyp->GetName() ),
1365 SMESH::toQStr( aHyp->GetLibName() ));
1366 aCreator->setInitParamsHypothesis( initParamHyp );
1368 // set shapes, of mesh and sub-mesh if any
1369 initHypCreator( aCreator );
1371 removeCustomFilters(); // Issue 0020170
1372 myDlg->setEnabled( false );
1374 aCreator->edit( aHyp.in(), aHypItem.second, dlg(), this, SLOT( onHypoEdited( int ) ) );
1378 //================================================================================
1380 * Necessary steps after hypothesis edition
1381 * \param result - creation result:
1385 //================================================================================
1386 void SMESHGUI_MeshOp::onHypoEdited( int result )
1388 int obj = myDlg->getActiveObject();
1389 onActivateObject( obj ); // Issue 0020170. Restore filters
1390 myDlg->setEnabled( true );
1393 //================================================================================
1395 * \brief access to hypothesis data
1396 * \param theDim - hyp dimension
1397 * \param theHypType - hyp type (Algo,MainHyp or AddHyp)
1398 * \param theIndex - index in the list
1399 * \retval HypothesisData* - result data, may be 0
1401 //================================================================================
1402 HypothesisData* SMESHGUI_MeshOp::hypData( const int theDim,
1403 const int theHypType,
1406 if ( theDim > -1 && theDim <= SMESH::DIM_3D &&
1407 theHypType > -1 && theHypType < NbHypTypes &&
1408 theIndex > -1 && theIndex < myAvailableHypData[ theDim ][ theHypType ].count() )
1409 return myAvailableHypData[ theDim ][ theHypType ][ theIndex ];
1413 //================================================================================
1415 * \brief Update list of algorithms and hypotheses according to currently selected
1416 * algorithm, geometry and mesh type
1418 //================================================================================
1419 void SMESHGUI_MeshOp::setFilteredAlgoData()
1421 // keep current algorithms
1422 HypothesisData* curAlgos[ 4 ];
1423 for ( int dim = 0; dim <= 3; ++dim )
1424 curAlgos[ dim ] = hypData( dim, Algo, currentHyp( dim, Algo ));
1426 // find out myMaxShapeDim by checking algorithm applicability to geometry
1428 int curMeshType = myDlg->currentMeshType();
1429 myDlg->setCurrentMeshType( MT_ANY );
1430 QStringList algosAvailable;
1431 // get available algorithms taking into account geometry only
1432 if ( myGeom->_is_nil() )
1436 if ( myToCreate ) // readMesh() has done it if !myToCreate
1437 for ( int dim = 0; dim <= 3; ++dim )
1438 availableHyps( dim, Algo, algosAvailable, myAvailableHypData[ dim ][ Algo ] );
1442 if ( myGeomEntry != myLastGeomEntry )
1443 myHypMapIsApplicable.clear();
1445 for ( int dim = 0; dim <= 3; ++dim )
1447 availableHyps( dim, Algo, algosAvailable, myAvailableHypData[ dim ][ Algo ] );
1448 if ( algosAvailable.count() )
1449 myMaxShapeDim = dim;
1451 if ( !myGeomEntry.isEmpty() )
1452 myLastGeomEntry = myGeomEntry;
1454 myDlg->setMaxHypoDim( myMaxShapeDim );
1456 // set mesh types according to myMaxShapeDim
1457 updateMeshTypeList();
1459 // update available hypo-sets that depend on geometry and mesh type
1460 myDlg->setCurrentMeshType( Max( MT_ANY, curMeshType ));
1461 updateHypoSets(); // it sets myAvailableHypData by curMeshType
1463 // restore current algorithms according to changed myAvailableHypData
1464 algosAvailable.clear();
1465 for ( int dim = 0; dim <= 3; ++dim )
1467 int algoIndex = myAvailableHypData[ dim ][ Algo ].indexOf( curAlgos[ dim ]);
1468 while ( algosAvailable.count() <= algoIndex )
1469 algosAvailable << "";
1470 myDlg->tab( dim )->setAvailableHyps( Algo, algosAvailable );
1471 setCurrentHyp( dim, Algo, algoIndex );
1472 if ( algoIndex < 0 )
1473 curAlgos[ dim ] = 0;
1476 // find a selected algo, current or of highest dimension
1477 int algoDim = myDlg->currentTab();
1478 if ( !curAlgos[ algoDim ])
1479 for ( algoDim = SMESH::DIM_3D; algoDim >= SMESH::DIM_0D; algoDim-- )
1480 if ( curAlgos[ algoDim ] )
1482 if ( algoDim < SMESH::DIM_0D )
1483 algoDim = myMaxShapeDim;
1485 // set algorithms and hypotheses according to all parameters (mesh type etc)
1486 onAlgoSelected( currentHyp( algoDim, Algo ), algoDim );
1489 //================================================================================
1491 * \brief Set available algos and hypos according to the selected algorithm
1492 * \param theIndex - algorithm index
1493 * \param theDim - algorithm dimension
1495 //================================================================================
1496 void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
1499 if ( myIgnoreAlgoSelection )
1502 int curDim = getTabDim( sender(), myDlg );
1503 int aDim = theDim < 0 ? curDim : theDim;
1507 const bool isSubmesh = ( myToCreate ? !myIsMesh : myDlg->isObjectShown( SMESHGUI_MeshDlg::Mesh ));
1509 HypothesisData* algoData = hypData( aDim, Algo, theIndex );
1510 HypothesisData* algoByDim[4];
1511 algoByDim[ aDim ] = algoData;
1513 QStringList anAvailable;
1514 const int algoDim = aDim;
1516 // 2 loops: backward and forward from algo dimension (forward == to higher dimension)
1517 for ( int forward = 1; forward >= 0; --forward )
1519 int dim = algoDim, lastDim = SMESH::DIM_3D, dir = 1;
1521 dim = algoDim - 1; lastDim = SMESH::DIM_0D; dir = -1;
1523 //bool noCompatible = false;
1524 for ( ; dim * dir <= lastDim * dir; dim += dir)
1526 // if ( noCompatible ) // the selected algo has no compatible ones (like 1D2D3D algo)
1528 // anAvailable.clear();
1529 // myDlg->tab( dim )->setAvailableHyps( Algo, anAvailable );
1530 // myAvailableHypData[dim][Algo].clear();
1531 // algoByDim[ dim ] = 0;
1535 int algoIndex = currentHyp( dim, Algo );
1536 HypothesisData *curAlgo = hypData( dim, Algo, algoIndex );
1538 // set new available algorithms
1539 HypothesisData *prevAlgo = 0;
1540 if ( dim != algoDim )
1541 for ( int prevDim = dim + 1; prevDim <=3 && !prevAlgo; ++prevDim )
1542 prevAlgo = hypData( prevDim, Algo, currentHyp( prevDim, Algo ));
1543 availableHyps( dim, Algo, anAvailable, myAvailableHypData[dim][Algo], prevAlgo );
1544 myDlg->tab( dim )->setAvailableHyps( Algo, anAvailable );
1546 //noCompatible = ( prevAlgo && !forward && anAvailable.isEmpty() );
1549 algoIndex = myAvailableHypData[dim][Algo].indexOf( curAlgo );
1550 setCurrentHyp( dim, Algo, algoIndex, /*updateHyps=*/true );
1552 algoByDim[ dim ] = hypData( dim, Algo, algoIndex );
1555 // activate tabs according to algorithms availability
1556 if ( anAvailable.isEmpty() ) myDlg->disableTab( dim );
1557 else myDlg->enableTab( dim );
1560 } // loops backward and forward
1563 // set hypotheses corresponding to the found algorithms
1565 _PTR(SObject) pComp = SMESH::getStudy()->FindComponent("SMESH");
1567 for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
1569 if ( !isAccessibleDim( dim ))
1572 // get indices of selected hyps
1573 const int nbTypes = nbDlgHypTypes(dim);
1574 std::vector<int> hypIndexByType( nbTypes, -1 );
1575 for ( int dlgType = MainHyp; dlgType < nbTypes; dlgType++ )
1577 hypIndexByType[ dlgType ] = currentHyp( dim, dlgType );
1581 for ( int dlgType = MainHyp; dlgType < nbTypes; dlgType++ )
1583 const int type = Min( dlgType, AddHyp );
1584 myAvailableHypData[ dim ][ type ].clear();
1585 QStringList anAvailable, anExisting;
1587 HypothesisData* curAlgo = algoByDim[ dim ];
1588 int hypIndex = hypIndexByType[ dlgType ];
1590 SMESH::SMESH_Hypothesis_var curHyp;
1592 HypothesisData* hypData = 0;
1593 if ( hypIndex >= 0 && hypIndex < myExistingHyps[ dim ][ type ].count() )
1595 curHyp = myExistingHyps[ dim ][ type ][ hypIndex ].first;
1596 if ( !curHyp->_is_nil() )
1598 curHypType = SMESH::toQStr( curHyp->GetName() );
1599 hypData = SMESH::GetHypothesisData( curHypType );
1602 if ( !myToCreate && !curAlgo && !curHyp->_is_nil() ) // edition, algo not selected
1604 // try to find algo by selected hypothesis in order to keep it selected
1605 bool algoDeselectedByUser = ( theDim < 0 && aDim == dim );
1606 if ( !algoDeselectedByUser &&
1607 myObjHyps[ dim ][ type ].count() > 0 &&
1608 curHypType == SMESH::toQStr( myObjHyps[ dim ][ type ].first().first->GetName()) )
1610 for ( int i = 0; i < myAvailableHypData[ dim ][ Algo ].count(); ++i )
1612 curAlgo = myAvailableHypData[ dim ][ Algo ][ i ];
1613 if ( curAlgo && hypData && isCompatible( curAlgo, hypData, type ))
1621 // get hyps compatible with curAlgo
1622 bool defaulHypAvlbl = false;
1625 if ( hypData && !isCompatible( curAlgo, hypData, type ))
1626 curHyp = SMESH::SMESH_Hypothesis::_nil();
1627 availableHyps( dim, type, anAvailable, myAvailableHypData[ dim ][ type ], curAlgo );
1628 existingHyps ( dim, type, pComp, anExisting, myExistingHyps[ dim ][ type ], curAlgo );
1629 defaulHypAvlbl = ( type == MainHyp && !curAlgo->IsAuxOrNeedHyp );
1631 // set list of hypotheses
1632 if ( dlgType <= AddHyp )
1634 myDlg->tab( dim )->setAvailableHyps( type, anAvailable );
1635 myDlg->tab( dim )->setExistingHyps( type, anExisting, defaulHypAvlbl );
1637 // set current existing hypothesis
1638 if ( !curHyp->_is_nil() && !anExisting.isEmpty() )
1639 hypIndex = this->find( curHyp, myExistingHyps[ dim ][ type ]);
1642 if ( !isSubmesh && myToCreate && hypIndex < 0 && anExisting.count() == 1 && dim == curDim )
1644 // none is yet selected => select the sole existing if it is not optional
1645 CORBA::String_var hypTypeName = myExistingHyps[ dim ][ type ].first().first->GetName();
1646 bool isOptional = true;
1647 if ( algoByDim[ dim ] &&
1648 SMESH::IsAvailableHypothesis( algoByDim[ dim ], hypTypeName.in(), isOptional ) &&
1652 setCurrentHyp( dim, dlgType, hypIndex );
1658 //================================================================================
1660 * \brief Creates and selects hypothesis of hypotheses set
1661 * \param theSetName - The name of hypotheses set
1663 //================================================================================
1664 void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
1666 HypothesesSet* aHypoSet = SMESH::GetHypothesesSet(theSetName);
1671 for (int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++)
1673 setCurrentHyp(dim, Algo, -1);
1674 setCurrentHyp(dim, AddHyp, -1);
1675 setCurrentHyp(dim, MainHyp, -1);
1676 onAlgoSelected( -1, dim );
1679 for ( int isAlgo = 1; isAlgo >= 0; --isAlgo )
1680 for ( aHypoSet->init( isAlgo ); aHypoSet->more(); aHypoSet->next() )
1682 QString aHypoTypeName = aHypoSet->current();
1683 HypothesisData* aHypData = SMESH::GetHypothesisData( aHypoTypeName );
1687 int aDim = aHypData->Dim[0];
1688 // create or/and set
1691 int index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
1694 setCurrentHyp( aDim, Algo, index );
1695 onAlgoSelected( index, aDim );
1700 bool mainHyp = true;
1701 int index = myAvailableHypData[aDim][MainHyp].indexOf( aHypData );
1705 index = myAvailableHypData[aDim][AddHyp].indexOf( aHypData );
1708 createHypothesis( aDim, mainHyp ? MainHyp : AddHyp, aHypoTypeName );
1714 //================================================================================
1716 * \brief Creates mesh
1717 * \param theMess - Output parameter intended for returning error message
1718 * \param theEntryList - List of entries of published objects
1719 * \retval bool - TRUE if mesh is created, FALSE otherwise
1721 //================================================================================
1722 bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
1727 myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList );
1728 if ( aList.isEmpty() )
1730 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
1731 if ( aSMESHGen->_is_nil() )
1734 SMESH::SMESH_Mesh_var aMesh= aSMESHGen->CreateEmptyMesh();
1735 if ( aMesh->_is_nil() )
1738 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMesh.in() );
1740 SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) );
1741 theEntryList.append( aMeshSO->GetID().c_str() );
1746 if ( aList.count() > 1 )
1748 namePrefix = myDlg->objectText( SMESHGUI_MeshDlg::Obj );
1749 int i = namePrefix.length() - 1;
1750 while ( i > 0 && namePrefix[i].isDigit() )
1752 if ( i < namePrefix.length() - 1 )
1753 namePrefix.chop( namePrefix.length() - 1 - i );
1757 QStringList::Iterator it = aList.begin();
1758 for ( int i = 0; it!=aList.end(); it++, ++i )
1760 QString aGeomEntry = *it;
1761 _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toUtf8().data() );
1762 GEOM::GEOM_Object_var aGeomVar =
1763 GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
1765 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
1766 if ( aSMESHGen->_is_nil() )
1769 SUIT_OverrideCursor aWaitCursor;
1772 SMESH::SMESH_Mesh_var aMesh = aSMESHGen->CreateMesh( aGeomVar );
1773 if ( aMesh->_is_nil() )
1775 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMesh.in() );
1777 theEntryList.append( aMeshSO->GetID().c_str() );
1778 if ( i > 0 ) setDefaultName( namePrefix );
1779 SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) );
1782 for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ )
1784 if ( !isAccessibleDim( aDim )) continue;
1786 // assign hypotheses
1787 for ( int dlgType = MainHyp; dlgType < nbDlgHypTypes(aDim); dlgType++ )
1789 const int aHypIndex = currentHyp( aDim, dlgType );
1790 const int aHypType = Min( dlgType, AddHyp );
1791 if ( aHypIndex >= 0 && aHypIndex < myExistingHyps[ aDim ][ aHypType ].count() )
1793 SMESH::SMESH_Hypothesis_var aHypVar =
1794 myExistingHyps[ aDim ][ aHypType ][ aHypIndex ].first;
1795 if ( !aHypVar->_is_nil() )
1796 SMESH::AddHypothesisOnMesh( aMesh, aHypVar );
1799 // find or create algorithm
1800 SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( aDim );
1801 if ( !anAlgoVar->_is_nil() )
1802 SMESH::AddHypothesisOnMesh( aMesh, anAlgoVar );
1808 //================================================================================
1810 * \brief Create sub-mesh
1811 * \param theMess - Output parameter intended for returning error message
1812 * \param theEntryList - List of entries of published objects
1813 * \retval bool - TRUE if sub-mesh is created, FALSE otherwise
1815 //================================================================================
1816 bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList )
1820 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
1821 if ( aSMESHGen->_is_nil() )
1825 SMESH::SMESH_Mesh_var aMesh =
1826 SMESH::EntryToInterface<SMESH::SMESH_Mesh>( myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh ));
1827 if ( aMesh->_is_nil() && myIsInvalidSubMesh )
1829 SMESH::SMESH_subMesh_var aSMVar =
1830 SMESH::EntryToInterface<SMESH::SMESH_subMesh>( myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ));
1831 if ( !aSMVar->_is_nil() )
1832 aMesh = aSMVar->GetMesh();
1834 if ( aMesh->_is_nil() )
1837 // GEOM shape of the main mesh
1838 GEOM::GEOM_Object_var mainGeom = aMesh->GetShapeToMesh();
1840 // Name for the new sub-mesh
1841 QString aName = myDlg->objectText(SMESHGUI_MeshDlg::Obj);
1844 GEOM::GEOM_Object_var aGeomVar;
1846 myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
1847 if (aGEOMs.count() == 1)
1849 //QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
1850 QString aGeomEntry = aGEOMs.first();
1851 _PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toUtf8().data() );
1852 aGeomVar = GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
1854 else if (aGEOMs.count() > 1)
1856 // create a GEOM group
1857 GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( mainGeom );
1858 if ( !geomGen->_is_nil() ) {
1859 GEOM::GEOM_IGroupOperations_ptr op = geomGen->GetIGroupOperations();
1860 if ( !op->_is_nil() )
1862 // check and add all selected GEOM objects: they must be
1863 // a sub-shapes of the main GEOM and must be of one type
1865 TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
1866 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1867 aSeq->length(aGEOMs.count());
1868 QStringList::const_iterator aSubShapesIter = aGEOMs.begin();
1869 for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) {
1870 QString aSubGeomEntry = (*aSubShapesIter);
1871 _PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID(aSubGeomEntry.toUtf8().data());
1872 GEOM::GEOM_Object_var aSubGeomVar =
1873 GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
1874 TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aSubGeomVar->GetShapeType();
1876 aGroupType = aSubShapeType;
1878 if (aSubShapeType != aGroupType)
1879 aGroupType = TopAbs_SHAPE;
1881 aSeq[iSubSh] = aSubGeomVar;
1884 GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(mainGeom, aGroupType);
1885 op->UnionList(aGroupVar, aSeq);
1889 aGeomVar = GEOM::GEOM_Object::_duplicate( aGroupVar.in() );
1891 // publish the GEOM group in study
1892 QString aNewGeomGroupName ("Auto_group_for_");
1893 aNewGeomGroupName += aName;
1894 SALOMEDS::SObject_wrap aNewGroupSO =
1895 geomGen->AddInStudy( aGeomVar,
1896 aNewGeomGroupName.toUtf8().data(), mainGeom);
1903 if (aGeomVar->_is_nil())
1906 SUIT_OverrideCursor aWaitCursor;
1908 QString aNameOrID = aName;
1909 if ( myIsInvalidSubMesh )
1910 // pass a sub-mesh entry to mesh->GetSubMesh() to replace the invalid sub-mesh
1911 // by a valid one in an existing SO
1912 aNameOrID = myDlg->selectedObject(SMESHGUI_MeshDlg::Obj);
1915 SMESH::SMESH_subMesh_var aSubMeshVar = aMesh->GetSubMesh( aGeomVar, aNameOrID.toUtf8().data() );
1916 _PTR(SObject) aSubMeshSO = SMESH::FindSObject( aSubMeshVar.in() );
1918 SMESH::SetName( aSubMeshSO, aName.toUtf8().data() );
1919 theEntryList.append( aSubMeshSO->GetID().c_str() );
1922 for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ )
1924 if ( !isAccessibleDim( aDim )) continue;
1926 // find or create algorithm
1927 SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( aDim );
1928 if ( !anAlgoVar->_is_nil() )
1929 SMESH::AddHypothesisOnSubMesh( aSubMeshVar, anAlgoVar );
1930 // assign hypotheses
1931 for ( int dlgType = MainHyp; dlgType < nbDlgHypTypes(aDim); dlgType++ )
1933 const int aHypIndex = currentHyp( aDim, dlgType );
1934 const int aHypType = Min( dlgType, AddHyp );
1935 if ( aHypIndex >= 0 && aHypIndex < myExistingHyps[ aDim ][ aHypType ].count() )
1937 SMESH::SMESH_Hypothesis_var aHypVar =
1938 myExistingHyps[ aDim ][ aHypType ][ aHypIndex ].first;
1939 if ( !aHypVar->_is_nil() )
1940 SMESH::AddHypothesisOnSubMesh( aSubMeshVar, aHypVar );
1945 // deselect geometry: next submesh should be created on other sub-shape
1946 myDlg->clearSelection( SMESHGUI_MeshDlg::Geom );
1947 selectObject( _PTR(SObject)() );
1950 checkSubMeshConcurrency( aMesh, aSubMeshVar, /*askUser=*/true );
1955 //================================================================================
1957 * \brief Return index of current hypothesis or algorithm
1958 * \param theDim - dimension of hypothesis or algorithm
1959 * \param theHypType - Type of hypothesis (Algo, MainHyp, AddHyp)
1960 * \retval int - index of current hypothesis or algorithm, -1 if None selected
1962 //================================================================================
1963 int SMESHGUI_MeshOp::currentHyp( const int theDim, const int theHypType ) const
1965 if ( 0 <= theDim && theDim <= 3 )
1966 return myDlg->tab( theDim )->currentHyp( theHypType ) - 1;
1971 //================================================================================
1973 * \brief Checks if a hypothesis is selected
1975 //================================================================================
1977 bool SMESHGUI_MeshOp::isSelectedHyp( int theDim, int theHypType, int theIndex) const
1982 if ( theHypType < AddHyp ) // only one hyp can be selected
1983 return currentHyp( theDim, theHypType ) == theIndex;
1985 for ( int dlgHypType = AddHyp; dlgHypType < nbDlgHypTypes( theDim ); ++dlgHypType )
1986 if ( currentHyp( theDim, dlgHypType ) == theIndex )
1992 //================================================================================
1994 * \brief Returns nb of HypType's taking into account possible several
1995 * selected additional hypotheses which are coded as additional HypType's.
1997 //================================================================================
1999 int SMESHGUI_MeshOp::nbDlgHypTypes( const int dim ) const
2001 return NbHypTypes + myDlg->tab( dim )->nbAddHypTypes();
2004 //================================================================================
2006 * \brief Returns true if hypotheses of given dim can be assigned
2007 * \param theDim - hypotheses dimension
2008 * \retval bool - result
2010 //================================================================================
2011 bool SMESHGUI_MeshOp::isAccessibleDim( const int theDim ) const
2013 return myDlg->isTabEnabled( theDim );
2016 //================================================================================
2018 * \brief Sets current hypothesis or algorithms
2019 * \param theDim - dimension of hypothesis or algorithm
2020 * \param theHypType - Type of hypothesis (Algo, MainHyp, AddHyp)
2021 * \param theIndex - Index of hypothesis
2022 * \param updateHypsOnAlgoDeselection - to clear and disable hyps if algo deselected
2024 * Gets current hypothesis or algorithms
2026 //================================================================================
2027 void SMESHGUI_MeshOp::setCurrentHyp( const int theDim,
2028 const int theHypType,
2030 const bool updateHypsOnAlgoDeselection)
2032 myIgnoreAlgoSelection = true;
2033 myDlg->tab( theDim )->setCurrentHyp( theHypType, theIndex + 1 );
2034 myIgnoreAlgoSelection = false;
2036 if ( updateHypsOnAlgoDeselection && theHypType == Algo && theIndex < 0 )
2038 const QStringList noHyps;
2039 myDlg->tab( theDim )->setAvailableHyps( MainHyp, noHyps );
2040 myDlg->tab( theDim )->setExistingHyps ( MainHyp, noHyps );
2041 myDlg->tab( theDim )->setAvailableHyps( AddHyp, noHyps );
2042 myDlg->tab( theDim )->setExistingHyps ( AddHyp, noHyps );
2046 //================================================================================
2048 * \brief Generates default and sets mesh/submesh name
2050 * Generates and sets default mesh/submesh name(Mesh_1, Mesh_2, etc.)
2052 //================================================================================
2053 void SMESHGUI_MeshOp::setDefaultName( const QString& thePrefix ) const
2057 _PTR(Study) aStudy = SMESH::getStudy();
2060 QString aPrefix = thePrefix;
2061 if ( aPrefix.isEmpty() )
2062 aPrefix = tr( myIsMesh ? "SMESH_OBJECT_MESH" : "SMESH_SUBMESH" ) + "_";
2064 _PTR(SObject) anObj;
2067 aResName = aPrefix + QString::number( i++ );
2068 anObj = aStudy->FindObject( aResName.toUtf8().data() );
2072 QLineEdit* aControl = ( QLineEdit* )myDlg->objectWg(
2073 SMESHGUI_MeshDlg::Obj, SMESHGUI_MeshDlg::Control );
2074 aControl->setText( aResName );
2077 //================================================================================
2079 * \brief Gets algorithm or creates it if necessary
2080 * \param theDim - specifies dimension of returned hypotheses/algorifms
2081 * \retval SMESH::SMESH_Hypothesis_var - algorithm
2083 * Gets algorithm or creates it if necessary
2085 //================================================================================
2086 SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
2088 SMESH::SMESH_Hypothesis_var anAlgoVar;
2090 // get type of the selected algo
2091 int aHypIndex = currentHyp( theDim, Algo );
2092 THypDataList& dataList = myAvailableHypData[ theDim ][ Algo ];
2093 if ( aHypIndex < 0 || aHypIndex >= dataList.count())
2095 QString aHypName = dataList[ aHypIndex ]->TypeName;
2097 // get existing algorithms
2098 _PTR(SObject) pComp = SMESH::getStudy()->FindComponent("SMESH");
2100 existingHyps( theDim, Algo, pComp, tmp, myExistingHyps[ theDim ][ Algo ]);
2102 // look for an existing algo of such a type
2103 THypList& aHypVarList = myExistingHyps[ theDim ][ Algo ];
2104 THypList::iterator anIter = aHypVarList.begin();
2105 for ( ; anIter != aHypVarList.end(); anIter++)
2107 SMESH::SMESH_Hypothesis_var aHypVar = (*anIter).first;
2108 if ( !aHypVar->_is_nil() && aHypName == SMESH::toQStr( aHypVar->GetName() ))
2110 anAlgoVar = aHypVar;
2115 if (anAlgoVar->_is_nil())
2117 HypothesisData* aHypData = SMESH::GetHypothesisData( aHypName );
2120 QString aClientLibName = aHypData->ClientLibName;
2121 if ( aClientLibName.isEmpty() )
2123 // Call hypothesis creation server method (without GUI)
2124 SMESH::SMESH_Hypothesis_var aHyp =
2125 SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
2130 // Get hypotheses creator client (GUI)
2131 SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
2135 aCreator->create( true, aHypName, myDlg, 0, QString::null );
2137 SMESH::SMESH_Hypothesis_var aHyp =
2138 SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
2143 QStringList tmpList;
2144 _PTR(SComponent) aFather = SMESH::getStudy()->FindComponent( "SMESH" );
2145 existingHyps( theDim, Algo, aFather, tmpList, myExistingHyps[ theDim ][ Algo ] );
2148 THypList& aNewHypVarList = myExistingHyps[ theDim ][ Algo ];
2149 for ( anIter = aNewHypVarList.begin(); anIter != aNewHypVarList.end(); ++anIter )
2151 SMESH::SMESH_Hypothesis_var aHypVar = (*anIter).first;
2152 if ( !aHypVar->_is_nil() && aHypName == SMESH::toQStr( aHypVar->GetName() ))
2154 anAlgoVar = aHypVar;
2160 return anAlgoVar._retn();
2163 //================================================================================
2165 * \brief Reads parameters of an edited mesh/sub-mesh and assigns them to the dialog
2167 * Called when mesh is edited only.
2169 //================================================================================
2170 void SMESHGUI_MeshOp::readMesh()
2172 QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
2173 _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toUtf8().data() );
2177 if ( myIsOnGeometry )
2179 // Set name of mesh if current object is sub-mesh
2180 SMESH::SMESH_subMesh_var subMesh = SMESH::SObjectToInterface< SMESH::SMESH_subMesh >( pObj );
2181 if ( !subMesh->_is_nil() )
2183 SMESH::SMESH_Mesh_var aMesh = subMesh->GetFather();
2184 if ( !aMesh->_is_nil() )
2186 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMesh );
2187 QString aMeshName = name( aMeshSO );
2188 myDlg->setObjectText( SMESHGUI_MeshDlg::Mesh, aMeshName );
2190 myHasConcurrentSubBefore = checkSubMeshConcurrency( aMesh, subMesh );
2193 if ( !myIsInvalidSubMesh )
2195 // Set name of geometry object
2196 CORBA::String_var name = SMESH::GetGeomName( pObj );
2198 myDlg->setObjectText( SMESHGUI_MeshDlg::Geom, name.in() );
2202 // Get hypotheses and algorithms assigned to the mesh/sub-mesh
2203 QStringList anExisting, anAvailable;
2204 bool algoFound = false;
2205 const int dim1st = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_2D;
2206 for ( int dim = dim1st; dim <= SMESH::DIM_3D; ++dim )
2209 existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] );
2210 // find algo index among available ones
2212 anAvailable.clear();
2213 if ( myObjHyps[ dim ][ Algo ].count() > 0 )
2215 SMESH::SMESH_Hypothesis_var hyp = myObjHyps[ dim ][ Algo ].first().first;
2216 HypothesisData* algoData = SMESH::GetHypothesisData( SMESH::toQStr( hyp->GetName() ));
2217 availableHyps( dim, Algo, anAvailable, myAvailableHypData[ dim ][ Algo ] );
2218 aHypIndex = myAvailableHypData[ dim ][ Algo ].indexOf( algoData );
2219 // if ( aHypIndex < 0 && algoData ) {
2220 // // assigned algo is incompatible with other algorithms
2221 // myAvailableHypData[ dim ][ Algo ].push_back( algoData );
2222 // aHypIndex = myAvailableHypData[ dim ][ hypType ].count() - 1;
2224 algoFound = ( aHypIndex > -1 );
2226 myDlg->tab( dim )->setAvailableHyps( Algo, anAvailable );
2227 setCurrentHyp( dim, Algo, aHypIndex );
2228 // set existing and available hypothesis according to the selected algo
2229 if ( aHypIndex > -1 || !algoFound )
2230 onAlgoSelected( aHypIndex, dim );
2234 bool hypWithoutAlgo = false;
2235 for ( int dim = dim1st; dim <= SMESH::DIM_3D; ++dim )
2237 for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ )
2240 existingHyps( dim, hypType, pObj, anExisting, myObjHyps[ dim ][ hypType ] );
2241 if ( myObjHyps[ dim ][ hypType ].count() == 0 ) {
2242 setCurrentHyp( dim, hypType, -1 );
2244 for ( int i = 0, nb = myObjHyps[ dim ][ hypType ].count(); i < nb; ++i )
2246 // find index of required hypothesis among existing ones for this dimension and type
2247 int aHypIndex = find( myObjHyps[ dim ][ hypType ][ i ].first,
2248 myExistingHyps[ dim ][ hypType ] );
2249 if ( aHypIndex < 0 ) {
2250 // assigned hypothesis is incompatible with the algorithm
2251 if ( currentHyp( dim, Algo ) < 0 )
2252 { // none algo selected; it is edition for sure, of submesh maybe
2253 hypWithoutAlgo = true;
2254 myExistingHyps[ dim ][ hypType ].push_back( myObjHyps[ dim ][ hypType ][ i ] );
2255 anExisting.push_back( myObjHyps[ dim ][ hypType ][ i ].second );
2256 aHypIndex = myExistingHyps[ dim ][ hypType ].count() - 1;
2257 myDlg->tab( dim )->setExistingHyps( hypType, anExisting );
2260 setCurrentHyp( dim, hypType + i, aHypIndex );
2262 if ( hypType == MainHyp ) break; // only one main hyp allowed
2266 // make available other hyps of same type as one without algo
2267 if ( hypWithoutAlgo )
2268 onAlgoSelected( currentHyp( /*dim=*/0, Algo ), /*dim=*/0 );
2271 //================================================================================
2273 * \brief Gets name of object
2274 * \param theSO - SObject
2275 * \retval QString - name of object
2277 * Gets name of object
2279 //================================================================================
2280 QString SMESHGUI_MeshOp::name( _PTR(SObject) theSO ) const
2285 _PTR(GenericAttribute) anAttr;
2286 _PTR(AttributeName) aNameAttr;
2287 if ( theSO->FindAttribute( anAttr, "AttributeName" ) )
2290 aResName = aNameAttr->Value().c_str();
2296 //================================================================================
2298 * \brief Finds hypothesis in input list
2299 * \param theHyp - hypothesis to be found
2300 * \param theHypList - input list of hypotheses
2301 * \retval int - index of hypothesis or -1 if it is not found
2303 * Finds position of hypothesis in input list
2305 //================================================================================
2306 int SMESHGUI_MeshOp::find( const SMESH::SMESH_Hypothesis_var& theHyp,
2307 const THypList& theHypList ) const
2310 if ( !theHyp->_is_nil() )
2313 THypList::const_iterator anIter = theHypList.begin();
2314 for ( ; anIter != theHypList.end(); ++ anIter)
2316 if ( theHyp->_is_equivalent( (*anIter).first ) )
2327 //================================================================================
2329 * \brief Edits mesh or sub-mesh
2330 * \param theMess - Output parameter intended for returning error message
2331 * \retval bool - TRUE if mesh is edited successfully, FALSE otherwise
2333 * Assigns new name hypotheses and algorithms to the mesh or sub-mesh
2335 //================================================================================
2336 bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
2340 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
2341 if ( aSMESHGen->_is_nil() )
2344 QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
2345 _PTR(SObject) pObj = SMESH::getStudy()->FindObjectID( anObjEntry.toUtf8().data() );
2349 SUIT_OverrideCursor aWaitCursor;
2352 QString aName = myDlg->objectText( SMESHGUI_MeshDlg::Obj );
2353 SMESH::SetName( pObj, aName );
2354 int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_2D;
2356 // First, remove old algos in order to avoid messages on algorithm hiding
2357 for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
2359 if ( /*isAccessibleDim( dim ) &&*/ myObjHyps[ dim ][ Algo ].count() > 0 )
2361 SMESH::SMESH_Hypothesis_var anOldAlgo = myObjHyps[ dim ][ Algo ].first().first;
2362 SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
2363 if ( anAlgoVar->_is_nil() || // no new algo selected or
2364 SMESH::toQStr(anOldAlgo->GetName()) != SMESH::toQStr(anAlgoVar->GetName())) // algo change
2366 // remove old algorithm
2367 SMESH::RemoveHypothesisOrAlgorithmOnMesh ( pObj, myObjHyps[ dim ][ Algo ].first().first );
2368 myObjHyps[ dim ][ Algo ].clear();
2373 SALOMEDS_SObject* aSObject = _CAST(SObject, pObj);
2374 CORBA::Object_var anObject = aSObject->GetObject();
2375 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( anObject );
2376 SMESH::SMESH_subMesh_var aSubMeshVar = SMESH::SMESH_subMesh::_narrow( anObject );
2377 bool isMesh = !aMesh->_is_nil();
2378 if ( !isMesh && !aSubMeshVar->_is_nil() )
2379 aMesh = aSubMeshVar->GetFather();
2381 // Assign new algorithms and hypotheses
2382 for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
2384 //if ( !isAccessibleDim( dim )) continue;
2386 // find or create algorithm
2387 SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
2389 // assign new algorithm
2390 if ( !anAlgoVar->_is_nil() && // some algo selected and
2391 myObjHyps[ dim ][ Algo ].count() == 0 ) // no algo assigned
2394 SMESH::AddHypothesisOnMesh( aMesh, anAlgoVar );
2395 else if ( !aSubMeshVar->_is_nil() )
2396 SMESH::AddHypothesisOnSubMesh( aSubMeshVar, anAlgoVar );
2398 myObjHyps[ dim ][ Algo ].append( THypItem( anAlgoVar, aName) );
2401 // remove deselected hypotheses
2402 for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ )
2404 for ( int i = 0, nb = myObjHyps[ dim ][ hypType ].count(); i < nb; ++i )
2406 SMESH::SMESH_Hypothesis_var hyp = myObjHyps[ dim ][ hypType ][ i ].first;
2407 int hypIndex = this->find( hyp, myExistingHyps[ dim ][ hypType ]);
2408 if ( !isSelectedHyp( dim, hypType, hypIndex ) && !hyp->_is_nil() )
2410 SMESH::RemoveHypothesisOrAlgorithmOnMesh( pObj, hyp );
2414 // assign newly selected hypotheses
2415 for ( int dlgType = MainHyp; dlgType < nbDlgHypTypes(dim); dlgType++ )
2417 const int curIndex = currentHyp( dim, dlgType );
2418 const int hypType = Min( dlgType, AddHyp );
2419 if ( curIndex >= 0 && curIndex < myExistingHyps[ dim ][ hypType ].count() )
2421 SMESH::SMESH_Hypothesis_var hyp = myExistingHyps[ dim ][ hypType ][ curIndex ].first;
2423 bool isAssigned = ( this->find( hyp, myObjHyps[ dim ][ hypType ]) >= 0 );
2427 SMESH::AddHypothesisOnMesh (aMesh, hyp );
2428 else if ( !aSubMeshVar->_is_nil() )
2429 SMESH::AddHypothesisOnSubMesh ( aSubMeshVar, hyp );
2432 // reread all hypotheses of mesh
2433 QStringList anExisting;
2434 existingHyps( dim, hypType, pObj, anExisting, myObjHyps[ dim ][ hypType ] );
2438 myHasConcurrentSubBefore =
2439 checkSubMeshConcurrency( aMesh, aSubMeshVar, /*askUser=*/!myHasConcurrentSubBefore );
2444 //================================================================================
2446 * \brief Checks if a concurrent sub-meshes appear as result of sub-mesh
2447 * creation/edition and, if (askUser) , proposes the uses to set up a desired
2448 * order of sub-mesh computation.
2449 * Returns \c true if a sub-mesh concurrency detected.
2451 //================================================================================
2453 bool SMESHGUI_MeshOp::checkSubMeshConcurrency(SMESH::SMESH_Mesh_ptr mesh,
2454 SMESH::SMESH_subMesh_ptr submesh,
2457 if ( CORBA::is_nil( mesh ) || CORBA::is_nil( submesh ))
2460 bool isNewConcurrent = mesh->IsUnorderedSubMesh( submesh->GetId() );
2461 if ( isNewConcurrent && askUser )
2463 int butID = SUIT_MessageBox::warning( myDlg->parentWidget(), tr( "SMESH_WARNING" ),
2464 tr("CONCURRENT_SUBMESH_APPEARS"),
2465 tr("SMESH_BUT_YES"), tr("SMESH_BUT_NO"));
2468 _PTR(SObject) meshSO = SMESH::FindSObject( mesh );
2469 LightApp_SelectionMgr* aSelectionMgr = selectionMgr();
2470 if ( meshSO && aSelectionMgr )
2472 myDlg->setEnabled( false ); // disactivate selection
2473 selectionMgr()->clearFilters();
2474 selectObject( meshSO );
2475 SMESHGUI::GetSMESHGUI()->OnGUIEvent( SMESHOp::OpMeshOrder ); // MESH_ORDER
2476 qApp->processEvents();
2478 myDlg->setEnabled( true );
2479 int obj = myDlg->getActiveObject();
2480 onActivateObject( obj ); // restore filter
2483 selectObject( SMESH::FindSObject( submesh ));
2490 return isNewConcurrent;
2493 //================================================================================
2495 * \brief Verifies whether given operator is valid for this one
2496 * \param theOtherOp - other operation
2497 * \return Returns TRUE if the given operator is valid for this one, FALSE otherwise
2499 * method redefined from base class verifies whether given operator is valid for
2500 * this one (i.e. can be started "above" this operator). In current implementation method
2501 * returns false if theOtherOp operation is not intended for deleting objects or mesh
2504 //================================================================================
2505 bool SMESHGUI_MeshOp::isValid( SUIT_Operation* theOp ) const
2507 return SMESHGUI_Operation::isValid( theOp ) && !theOp->inherits( "SMESHGUI_MeshOp" );
2510 //================================================================================
2512 * \brief SLOT. Is called when the user selects a way of geometry selection
2513 * \param theByMesh - true if the user wants to find geometry by mesh element
2515 //================================================================================
2516 void SMESHGUI_MeshOp::onGeomSelectionByMesh( bool theByMesh )
2519 if ( !myShapeByMeshOp ) {
2520 myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp();
2521 connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
2522 SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
2523 connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
2524 SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
2526 // set mesh object to SMESHGUI_ShapeByMeshOp and start it
2527 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
2528 if ( _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( aMeshEntry.toUtf8().data() )) {
2529 SMESH::SMESH_Mesh_var aMesh =
2530 SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() );
2531 if ( !aMesh->_is_nil() ) {
2532 myDlg->hide(); // stop processing selection
2533 myShapeByMeshOp->setModule( getSMESHGUI() );
2534 myShapeByMeshOp->setStudy( 0 ); // it's really necessary
2535 myShapeByMeshOp->SetMesh( aMesh );
2536 myShapeByMeshOp->start();
2542 //================================================================================
2544 * \brief SLOT. Is called when Ok is pressed in SMESHGUI_ShapeByMeshDlg
2546 //================================================================================
2547 void SMESHGUI_MeshOp::onPublishShapeByMeshDlg(SUIT_Operation* op)
2549 if ( myShapeByMeshOp == op ) {
2550 SMESHGUI::GetSMESHGUI()->getApp()->updateObjectBrowser(); //MZN: 24.11.2006 IPAL13980 - Object Browser update added
2552 // Select a found geometry object
2553 GEOM::GEOM_Object_var aGeomVar = myShapeByMeshOp->GetShape();
2554 if ( !aGeomVar->_is_nil() )
2556 QString ID = SMESH::toQStr( aGeomVar->GetStudyEntry() );
2557 if ( _PTR(SObject) aGeomSO = SMESH::getStudy()->FindObjectID( ID.toUtf8().data() )) {
2558 selectObject( aGeomSO );
2565 //================================================================================
2567 * \brief SLOT. Is called when Close is pressed in SMESHGUI_ShapeByMeshDlg
2569 //================================================================================
2570 void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
2572 if ( myShapeByMeshOp == op && myDlg ) {
2577 //================================================================================
2579 * \brief Selects a SObject
2580 * \param theSObj - the SObject to select
2582 //================================================================================
2583 void SMESHGUI_MeshOp::selectObject( _PTR(SObject) theSObj ) const
2585 if ( LightApp_SelectionMgr* sm = selectionMgr() ) {
2586 SALOME_ListIO anIOList;
2588 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
2589 ( theSObj->GetID().c_str(), "SMESH", theSObj->GetName().c_str() );
2590 anIOList.Append( anIO );
2592 sm->setSelectedObjects( anIOList, false );
2595 //================================================================================
2597 * \brief Update available list of mesh types
2599 //================================================================================
2600 void SMESHGUI_MeshOp::updateMeshTypeList()
2602 QStringList meshTypes;
2603 meshTypes.append( tr( "MT_ANY" ) );
2604 if ( myMaxShapeDim >= 2 || myMaxShapeDim == -1 )
2606 meshTypes.append( tr( "MT_TRIANGULAR" ) );
2607 meshTypes.append( tr( "MT_QUADRILATERAL" ) );
2609 if ( myMaxShapeDim == 3 || myMaxShapeDim == -1 )
2611 meshTypes.append( tr( "MT_TETRAHEDRAL" ) );
2612 meshTypes.append( tr( "MT_HEXAHEDRAL" ) );
2615 myDlg->setAvailableMeshType( meshTypes );
2618 //================================================================================
2620 * \brief Update available list of hypothesis sets
2622 //================================================================================
2623 void SMESHGUI_MeshOp::updateHypoSets()
2625 // get available algorithms taking into account geometry and mesh type
2626 QStringList algosAvailable;
2627 if ( myDlg->currentMeshType() != MT_ANY )
2628 for ( int dim = 0; dim <= 3; ++dim )
2629 availableHyps( dim, Algo, algosAvailable, myAvailableHypData[ dim ][ Algo ] );
2631 THypDataList anAvailableAlgsData;
2632 QStringList aHypothesesSetsList = SMESH::GetHypothesesSets( myMaxShapeDim );
2633 QStringList aFilteredHypothesesSetsList;
2634 QStringList::const_iterator inHypoSetName = aHypothesesSetsList.begin();
2635 for ( ; inHypoSetName != aHypothesesSetsList.end(); ++inHypoSetName )
2637 HypothesesSet* currentHypoSet = SMESH::GetHypothesesSet( *inHypoSetName );
2638 bool isAvailable = false;
2639 for ( currentHypoSet->init( true ); currentHypoSet->more(); currentHypoSet->next() )
2641 isAvailable = false;
2642 if ( HypothesisData* algoDataIn = SMESH::GetHypothesisData( currentHypoSet->current() )) {
2643 for (int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++) {
2644 int aCurrentAvailableAlgo = myAvailableHypData[i][Algo].indexOf( algoDataIn );
2645 if ( aCurrentAvailableAlgo > -1 ) {
2655 aFilteredHypothesesSetsList.append( *inHypoSetName );
2657 myDlg->setHypoSets( aFilteredHypothesesSetsList );
2660 //================================================================================
2662 * \brief SLOT. Is called when the user select type of mesh
2663 * \param theTabIndex - Index of current active tab
2664 * \param theIndex - Index of current type of mesh
2666 //================================================================================
2667 void SMESHGUI_MeshOp::onAlgoSetByMeshType( const int theTabIndex, const int theIndex )
2669 setFilteredAlgoData();