1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESHGUI_MeshOp.cxx
23 // Author : Sergey LITONIN, Open CASCADE S.A.S.
26 #include "SMESHGUI_MeshOp.h"
29 #include "SMESHGUI_MeshDlg.h"
30 #include "SMESHGUI_ShapeByMeshDlg.h"
31 #include "SMESHGUI_HypothesesUtils.h"
32 #include "SMESHGUI_Hypotheses.h"
33 #include "SMESHGUI_Utils.h"
34 #include "SMESHGUI_GEOMGenUtils.h"
36 #include <SMESH_TypeFilter.hxx>
37 #include <SMESH_NumberFilter.hxx>
39 // SALOME GEOM includes
40 #include <GEOM_SelectionFilter.h>
42 #include <GeometryGUI.h>
43 #include <GEOM_wrap.hxx>
45 // SALOME GUI includes
46 #include <SalomeApp_Tools.h>
47 #include <SalomeApp_Application.h>
48 #include <LightApp_Application.h>
49 #include <LightApp_SelectionMgr.h>
50 #include <LightApp_UpdateFlags.h>
51 #include <SUIT_MessageBox.h>
52 #include <SUIT_OverrideCursor.h>
53 #include <SUIT_Session.h>
54 #include <SALOME_InteractiveObject.hxx>
55 #include <SALOME_ListIO.hxx>
57 // SALOME KERNEL includes
58 #include <SALOMEDS_SComponent.hxx>
59 #include <SALOMEDS_SObject.hxx>
60 #include <SALOMEDS_Study.hxx>
61 #include <SALOMEDS_wrap.hxx>
64 #include <QStringList>
69 #include <TopoDS_Shape.hxx>
70 #include <TopoDS_Shell.hxx>
71 #include <TopExp_Explorer.hxx>
72 #include <BRep_Tool.hxx>
75 #include <SALOMEconfig.h>
76 #include CORBA_CLIENT_HEADER(SMESH_Gen)
78 //================================================================================
81 * \param theToCreate - if this parameter is true then operation is used for creation,
82 * for editing otherwise
84 * Initialize operation
86 //================================================================================
87 SMESHGUI_MeshOp::SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh )
88 : SMESHGUI_SelectionOp(),
89 myToCreate( theToCreate ),
90 myIsMesh( theIsMesh ),
95 if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists
96 GeometryGUI::InitGeomGen();
97 myIsOnGeometry = true;
101 //================================================================================
105 //================================================================================
106 SMESHGUI_MeshOp::~SMESHGUI_MeshOp()
112 //================================================================================
114 * \brief Gets dialog of this operation
115 * \retval LightApp_Dialog* - pointer to dialog of this operation
117 //================================================================================
118 LightApp_Dialog* SMESHGUI_MeshOp::dlg() const
123 //================================================================================
125 * \brief Creates or edits mesh
126 * \retval bool - TRUE if operation is performed successfully, FALSE otherwise
128 * Virtual slot redefined from the base class called when "Apply" button is clicked
129 * creates or edits mesh
131 //================================================================================
132 bool SMESHGUI_MeshOp::onApply()
138 if ( !isValid( aMess ) )
142 SUIT_MessageBox::warning( myDlg, tr( "SMESH_WRN_WARNING" ), aMess );
146 bool aResult = false;
150 QStringList anEntryList;
151 if ( myToCreate && myIsMesh )
152 aResult = createMesh( aMess, anEntryList );
153 if ( myToCreate && !myIsMesh )
154 aResult = createSubMesh( aMess, anEntryList );
155 else if ( !myToCreate )
156 aResult = editMeshOrSubMesh( aMess );
159 SMESHGUI::Modified();
160 update( UF_ObjBrowser | UF_Model );
161 if( LightApp_Application* anApp =
162 dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
163 myObjectToSelect = anApp->browseObjects( anEntryList, isApplyAndClose() );
166 catch ( const SALOME::SALOME_Exception& S_ex )
168 SalomeApp_Tools::QtCatchCorbaException( S_ex );
184 aMess = tr( "SMESH_OPERATION_FAILED" );
185 SUIT_MessageBox::warning( myDlg, tr( "SMESH_ERROR" ), aMess );
191 //================================================================================
193 * \brief Creates dialog if necessary and shows it
195 * Virtual method redefined from base class called when operation is started creates
196 * dialog if necessary and shows it, activates selection
198 //================================================================================
199 void SMESHGUI_MeshOp::startOperation()
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)));
217 if ( myIsMesh ) myHelpFileName = "constructing_meshes_page.html";
218 else myHelpFileName = "constructing_submeshes_page.html";
219 else myHelpFileName = "editing_meshes_page.html";
221 SMESHGUI_SelectionOp::startOperation();
222 // iterate through dimensions and get available algoritms, set them to the dialog
223 _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
224 for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ )
226 SMESHGUI_MeshTab* aTab = myDlg->tab( i );
228 // clear available hypotheses
229 aTab->setAvailableHyps( MainHyp, hypList );
230 aTab->setAvailableHyps( AddHyp, hypList );
231 aTab->setExistingHyps( MainHyp, hypList );
232 aTab->setExistingHyps( AddHyp, hypList );
233 myExistingHyps[ i ][ MainHyp ].clear();
234 myExistingHyps[ i ][ AddHyp ].clear();
236 availableHyps( i, Algo, hypList, myAvailableHypData[i][Algo] );
237 aTab->setAvailableHyps( Algo, hypList );
242 myDlg->activateObject( myIsMesh ? SMESHGUI_MeshDlg::Geom : SMESHGUI_MeshDlg::Mesh );
245 myDlg->activateObject( SMESHGUI_MeshDlg::Obj );
247 myDlg->setCurrentTab( SMESH::DIM_3D );
249 QStringList TypeMeshList;
250 createMeshTypeList( TypeMeshList );
251 setAvailableMeshType( TypeMeshList );
254 myDlg->setGeomPopupEnabled(false);
257 myIgnoreAlgoSelection = false;
259 myObjectToSelect.clear();
262 //=================================================================================
264 * \brief Selects a recently created mesh or sub-mesh if necessary
266 * Virtual method redefined from base class called when operation is commited
267 * selects a recently created mesh or sub-mesh if necessary. Allows to perform
268 * selection when the custom selection filters are removed.
270 //=================================================================================
271 void SMESHGUI_MeshOp::commitOperation()
273 SMESHGUI_SelectionOp::commitOperation();
275 if ( !myObjectToSelect.isEmpty() ) {
276 if ( LightApp_SelectionMgr* aSelectionMgr = selectionMgr() ) {
277 SUIT_DataOwnerPtrList aList;
278 aList.append( new LightApp_DataOwner( myObjectToSelect ) );
279 aSelectionMgr->setSelected( aList );
284 //================================================================================
286 * \brief Creates selection filter
287 * \param theId - identifier of current selection widget
288 * \retval SUIT_SelectionFilter* - pointer to the created filter or null
290 * Creates selection filter in accordance with identifier of current selection widget
292 //================================================================================
293 SUIT_SelectionFilter* SMESHGUI_MeshOp::createFilter( const int theId ) const
295 if ( theId == SMESHGUI_MeshDlg::Geom )
297 // TColStd_MapOfInteger allTypesMap;
298 // for ( int i = 0; i < 10; i++ )
299 // allTypesMap.Add( i );
300 // return new SMESH_NumberFilter( "GEOM", TopAbs_SHAPE, 0, allTypesMap );
301 return new GEOM_SelectionFilter( (SalomeApp_Study*)study(), true );
303 else if ( theId == SMESHGUI_MeshDlg::Obj && !myToCreate )
304 return new SMESH_TypeFilter( SMESH::MESHorSUBMESH );
305 else if ( theId == SMESHGUI_MeshDlg::Mesh )
306 return new SMESH_TypeFilter( SMESH::MESH );
311 //================================================================================
313 * \brief check if selected shape is a sub-shape of the shape to mesh
314 * \retval bool - check result
316 //================================================================================
317 bool SMESHGUI_MeshOp::isSubshapeOk() const
319 if ( !myToCreate || myIsMesh ) // not submesh creation
323 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
324 _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
325 if (!pMesh) return false;
327 SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
328 if (mesh->_is_nil()) return false;
330 // main shape of the mesh
331 GEOM::GEOM_Object_var mainGeom = mesh->GetShapeToMesh();
332 if (mainGeom->_is_nil()) return false;
336 myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
338 if (aGEOMs.count() > 0) {
339 GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
340 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
341 if (geomGen->_is_nil() || !aStudy) return false;
343 GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(aStudy->StudyId());
344 if (op->_is_nil()) return false;
346 // check all selected shapes
347 QStringList::const_iterator aSubShapesIter = aGEOMs.begin();
348 for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++) {
349 QString aSubGeomEntry = (*aSubShapesIter);
350 _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data());
351 if (!pSubGeom) return false;
353 GEOM::GEOM_Object_var aSubGeomVar =
354 GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
355 if (aSubGeomVar->_is_nil()) return false;
357 // skl for NPAL14695 - implementation of searching of mainObj
358 GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as
359 mainObj already exists! */
361 if (mainObj->_is_nil())
363 CORBA::String_var entry1 = mainObj->GetEntry();
364 CORBA::String_var entry2 = mainGeom->GetEntry();
365 if (std::string( entry1.in() ) == entry2.in() )
367 mainObj = op->GetMainShape(mainObj);
375 //================================================================================
377 * \brief Return name of the algorithm that does not support submeshes and makes
378 * submesh creation useless
379 * \retval char* - string is to be deleted!!!
381 //================================================================================
382 char* SMESHGUI_MeshOp::isSubmeshIgnored() const
384 if ( myToCreate && !myIsMesh ) {
386 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
387 QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
388 _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
391 QStringList algoNames;
393 existingHyps(3, Algo, pMesh, algoNames, algoList);
394 if (!algoList.empty()) {
395 HypothesisData* algo = SMESH::GetHypothesisData( algoList[0].first->GetName() );
397 algo->InputTypes.empty() && // builds all dimensions it-self
398 !algo->IsSupportSubmeshes )
399 return CORBA::string_dup( algoNames[0].toLatin1().data() );
402 // GEOM::GEOM_Object_var geom;
403 // if (_PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() ))
404 // geom = SMESH::SObjectToInterface<GEOM::GEOM_Object>( pGeom );
406 // if ( !geom->_is_nil() && geom->GetShapeType() >= GEOM::FACE ) { // WIRE, EDGE as well
407 existingHyps(2, Algo, pMesh, algoNames, algoList);
408 if (!algoList.empty()) {
409 HypothesisData* algo = SMESH::GetHypothesisData( algoList[0].first->GetName() );
411 algo->InputTypes.empty() && // builds all dimensions it-self
412 !algo->IsSupportSubmeshes )
413 return CORBA::string_dup( algoNames[0].toLatin1().data() );
421 //================================================================================
423 * \brief find an existing submesh by the selected shape
424 * \retval _PTR(SObject) - the found submesh SObject
426 //================================================================================
427 _PTR(SObject) SMESHGUI_MeshOp::getSubmeshByGeom() const
429 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
430 QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
431 _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
432 _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
433 if ( pMesh && pGeom ) {
434 GEOM::GEOM_Object_var geom = SMESH::SObjectToInterface<GEOM::GEOM_Object>( pGeom );
435 if ( !geom->_is_nil() ) {
437 switch ( geom->GetShapeType() ) {
438 case GEOM::VERTEX: tag = SMESH::Tag_SubMeshOnVertex; break;
439 case GEOM::EDGE: tag = SMESH::Tag_SubMeshOnEdge; break;
440 case GEOM::WIRE: tag = SMESH::Tag_SubMeshOnWire; break;
441 case GEOM::FACE: tag = SMESH::Tag_SubMeshOnFace; break;
442 case GEOM::SHELL: tag = SMESH::Tag_SubMeshOnShell; break;
443 case GEOM::SOLID: tag = SMESH::Tag_SubMeshOnSolid; break;
444 case GEOM::COMPOUND: tag = SMESH::Tag_SubMeshOnCompound; break;
447 _PTR(GenericAttribute) anAttr;
448 _PTR(SObject) aSubmeshRoot;
449 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
450 if ( pMesh->FindSubObject( tag, aSubmeshRoot ) )
452 _PTR(ChildIterator) smIter = aStudy->NewChildIterator( aSubmeshRoot );
453 for ( ; smIter->More(); smIter->Next() )
455 _PTR(SObject) aSmObj = smIter->Value();
456 if ( ! aSmObj->FindAttribute( anAttr, "AttributeIOR" ))
458 _PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSmObj);
459 for ( ; anIter1->More(); anIter1->Next()) {
460 _PTR(SObject) pGeom2 = anIter1->Value();
461 if ( pGeom2->ReferencedObject( pGeom2 ) &&
462 pGeom2->GetID() == pGeom->GetID() )
469 return _PTR(SObject)();
472 //================================================================================
474 * \brief Updates dialog's look and feel
476 * Virtual method redefined from the base class updates dialog's look and feel
478 //================================================================================
479 void SMESHGUI_MeshOp::selectionDone()
481 if (!dlg()->isVisible() || !myDlg->isEnabled())
484 SMESHGUI_SelectionOp::selectionDone();
488 myIsOnGeometry = true;
490 //Check geometry for mesh
491 QString anObjEntry = myDlg->selectedObject(SMESHGUI_MeshDlg::Obj);
492 _PTR(SObject) pObj = studyDS()->FindObjectID(anObjEntry.toLatin1().data());
495 SMESH::SMESH_Mesh_var aMeshVar =
496 SMESH::SMESH_Mesh::_narrow(_CAST(SObject,pObj)->GetObject());
497 if (!aMeshVar->_is_nil()) {
498 if (!myToCreate && !aMeshVar->HasShapeToMesh())
499 myIsOnGeometry = false;
505 // Enable tabs according to shape dimension
510 myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
511 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
513 if (aGEOMs.count() > 0) {
514 // one or more GEOM shape selected
515 aSeq->length(aGEOMs.count());
516 QStringList::const_iterator aSubShapesIter = aGEOMs.begin();
518 for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) {
519 QString aSubGeomEntry = (*aSubShapesIter);
520 _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data());
521 GEOM::GEOM_Object_var aSubGeomVar =
522 GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
523 aSeq[iSubSh] = aSubGeomVar;
526 // get geometry by selected sub-mesh
527 QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
528 _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
529 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
530 if (!aGeomVar->_is_nil()) {
536 if (aSeq->length() > 0) {
538 for (int iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) {
539 GEOM::GEOM_Object_var aGeomVar = aSeq[iss];
540 switch ( aGeomVar->GetShapeType() ) {
541 case GEOM::SOLID: shapeDim = 3; break;
543 // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab
545 // TopoDS_Shape aShape;
546 // bool isClosed = GEOMBase::GetShape(aGeomVar, aShape) && /*aShape.Closed()*/BRep_Tool::IsClosed(aShape);
547 // shapeDim = qMax(isClosed ? 3 : 2, shapeDim);
550 case GEOM::FACE: shapeDim = qMax(2, shapeDim); break;
552 case GEOM::EDGE: shapeDim = qMax(1, shapeDim); break;
553 case GEOM::VERTEX: shapeDim = qMax(0, shapeDim); break;
557 if (GEOMBase::GetShape(aGeomVar, aShape))
559 TopExp_Explorer exp (aShape, TopAbs_SOLID);
563 // Bug 0016155: EDF PAL 447: If the shape is a Shell, disable 3D tab
564 // else if ( exp.Init( aShape, TopAbs_SHELL ), exp.More() )
567 // for (; exp.More() && shapeDim == 2; exp.Next()) {
568 // if (/*exp.Current().Closed()*/BRep_Tool::IsClosed(exp.Current()))
572 else if ( exp.Init( aShape, TopAbs_FACE ), exp.More() )
573 shapeDim = qMax(2, shapeDim);
574 else if ( exp.Init( aShape, TopAbs_EDGE ), exp.More() )
575 shapeDim = qMax(1, shapeDim);
576 else if ( exp.Init( aShape, TopAbs_VERTEX ), exp.More() )
577 shapeDim = qMax(0, shapeDim);
585 for (int i = SMESH::DIM_3D; i > shapeDim; i--) {
586 // reset algos before disabling tabs (0020138)
587 onAlgoSelected(-1, i);
589 myDlg->setMaxHypoDim( shapeDim );
590 myMaxShapeDim = shapeDim;
591 myDlg->setHypoSets( SMESH::GetHypothesesSets( shapeDim, "" ));
593 if (!myToCreate) // edition: read hypotheses
597 SMESH::SMESH_subMesh_var aVar =
598 SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
599 myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, !aVar->_is_nil() );
600 myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, true );
601 myDlg->objectWg( SMESHGUI_MeshDlg::Mesh, SMESHGUI_MeshDlg::Btn )->hide();
602 myDlg->objectWg( SMESHGUI_MeshDlg::Geom, SMESHGUI_MeshDlg::Btn )->hide();
603 myDlg->updateGeometry();
610 else if ( !myIsMesh ) // submesh creation
612 // if a submesh on the selected shape already exist, pass to submesh edition mode
613 if ( _PTR(SObject) pSubmesh = getSubmeshByGeom() ) {
614 SMESH::SMESH_subMesh_var sm =
615 SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( pSubmesh );
616 bool editSubmesh = ( !sm->_is_nil() &&
617 SUIT_MessageBox::question( myDlg, tr( "SMESH_WARNING" ),
618 tr( "EDIT_SUBMESH_QUESTION"),
619 SUIT_MessageBox::Yes |
621 SUIT_MessageBox::No )
622 == SUIT_MessageBox::Yes );
625 selectionMgr()->clearFilters();
626 selectObject( pSubmesh );
627 SMESHGUI::GetSMESHGUI()->switchToOperation(704);
632 myDlg->selectObject( "", SMESHGUI_MeshDlg::Geom, "" );
633 selectObject( _PTR(SObject)() );
638 // discard selected mesh if submesh creation not allowed because of
639 // a global algorithm that does not support submeshes
640 if ( char* algoName = isSubmeshIgnored() ) {
641 SUIT_MessageBox::warning( myDlg, tr( "SMESH_ERROR" ),
642 tr("SUBMESH_NOT_ALLOWED").arg(algoName));
643 CORBA::string_free( algoName );
644 myDlg->selectObject( "", SMESHGUI_MeshDlg::Mesh, "" );
645 selectObject( _PTR(SObject)() );
650 // enable/disable popup for choice of geom selection way
652 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
653 if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() )) {
654 SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
655 if ( !mesh->_is_nil() ) {
656 //rnv: issue 21056: EDF 1608 SMESH: Dialog Box "Create Sub Mesh": focus should automatically switch to geometry
657 QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
658 _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
659 if ( !pGeom || GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() )->_is_nil() )
660 myDlg->activateObject(SMESHGUI_MeshDlg::Geom);
661 enable = ( shapeDim > 1 ) && ( mesh->NbEdges() > 0 );
664 myDlg->setGeomPopupEnabled( enable );
667 else { // no geometry defined
668 myDlg->enableTab( SMESH::DIM_3D );
670 availableHyps( SMESH::DIM_3D, Algo, hypList,
671 myAvailableHypData[SMESH::DIM_3D][Algo]);
673 SMESHGUI_MeshTab* aTab = myDlg->tab( SMESH::DIM_3D );
674 aTab->setAvailableHyps( Algo, hypList );
675 for (int i = SMESH::DIM_0D;i < SMESH::DIM_3D; ++i) {
676 myDlg->disableTab(i);
679 //Hide labels and fields (Mesh ang Geometry)
680 myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, false );
681 myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, false );
685 QStringList TypeMeshList;
686 createMeshTypeList( TypeMeshList );
687 setAvailableMeshType( TypeMeshList );
689 catch ( const SALOME::SALOME_Exception& S_ex )
691 SalomeApp_Tools::QtCatchCorbaException( S_ex );
698 //================================================================================
700 * \brief Verifies validity of input data
701 * \param theMess - Output parameter intended for returning error message
702 * \retval bool - TRUE if input data is valid, false otherwise
704 * Verifies validity of input data. This method is called when "Apply" or "OK" button
705 * is pressed before mesh creation or editing.
707 //================================================================================
708 bool SMESHGUI_MeshOp::isValid( QString& theMess ) const
710 // Selected object to be edited
711 if ( !myToCreate && myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ) == "" )
713 theMess = tr( "THERE_IS_NO_OBJECT_FOR_EDITING" );
718 QString aMeshName = myDlg->objectText( SMESHGUI_MeshDlg::Obj ).trimmed();
719 if ( aMeshName.isEmpty() )
721 theMess = myIsMesh ? tr( "NAME_OF_MESH_IS_EMPTY" ) : tr( "NAME_OF_SUBMESH_IS_EMPTY" );
725 /* // Imported mesh, if create sub-mesh or edit mesh
726 if ( !myToCreate || ( myToCreate && !myIsMesh ))
728 QString aMeshEntry = myDlg->selectedObject
729 ( myToCreate ? SMESHGUI_MeshDlg::Mesh : SMESHGUI_MeshDlg::Obj );
730 if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() )) {
731 SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( pMesh );
732 if ( !mesh->_is_nil() && CORBA::is_nil( mesh->GetShapeToMesh() )) {
733 theMess = tr( "IMPORTED_MESH" );
742 QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
743 if ( aGeomEntry == "" )
745 theMess = tr( "GEOMETRY_OBJECT_IS_NOT_DEFINED" );
747 if ( SUIT_MessageBox::warning( myDlg, tr( "SMESH_WRN_WARNING" ), theMess,
748 SUIT_MessageBox::Yes, SUIT_MessageBox::No ) == SUIT_MessageBox::No )
755 _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
756 if ( !pGeom || GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() )->_is_nil() )
758 theMess = tr( "GEOMETRY_OBJECT_IS_NULL" );
763 if ( !myIsMesh ) // i.e sub-mesh creation,
765 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
766 if ( aMeshEntry == "" )
768 theMess = tr( "MESH_IS_NOT_DEFINED" );
771 _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
772 if ( !pMesh || SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() )->_is_nil() )
774 theMess = tr( "MESH_IS_NULL" );
777 if ( !isSubshapeOk() )
779 theMess = tr( "INVALID_SUBSHAPE" );
788 //================================================================================
790 * \brief check compatibility of the algorithm and another algorithm or hypothesis
791 * \param theAlgoData - algorithm data
792 * \param theHypData - hypothesis data
793 * \param theHypType - hypothesis type
794 * \param theHypTypeName - hypothesis type name, must be provided if 2-nd arg is not algo
795 * \retval bool - check result
797 //================================================================================
798 static bool isCompatible(const HypothesisData* theAlgoData,
799 const HypothesisData* theHypData,
800 const int theHypType)
805 if ( theHypType == SMESHGUI_MeshOp::Algo )
806 return SMESH::IsCompatibleAlgorithm( theAlgoData, theHypData );
809 return ( SMESH::IsAvailableHypothesis( theAlgoData, theHypData->TypeName, isOptional ));
812 //================================================================================
814 * \brief Gets available hypotheses or algorithms
815 * \param theDim - specifies dimension of returned hypotheses/algorifms
816 * \param theHypType - specifies whether algorims or hypotheses or additional ones
817 * are retrieved (possible values are in HypType enumeration)
818 * \param theHyps - Output list of hypotheses' names
819 * \param theAlgoData - to select hypos able to be used by this algo (optional)
821 * Gets available hypotheses or algorithm in accordance with input parameters
823 //================================================================================
824 void SMESHGUI_MeshOp::availableHyps( const int theDim,
825 const int theHypType,
826 QStringList& theHyps,
827 THypDataList& theDataList,
828 HypothesisData* theAlgoData ) const
832 bool isAlgo = ( theHypType == Algo );
833 bool isAux = ( theHypType == AddHyp );
834 QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux, myIsOnGeometry );
836 QStringList::const_iterator anIter;
837 for ( anIter = aHypTypeNameList.begin(); anIter != aHypTypeNameList.end(); ++anIter )
839 HypothesisData* aData = SMESH::GetHypothesisData( *anIter );
840 if ( isCompatible ( theAlgoData, aData, theHypType )) {
841 theDataList.append( aData );
842 theHyps.append( aData->Label );
847 //================================================================================
849 * \brief Gets existing hypotheses or algorithms
850 * \param theDim - specifies dimension of returned hypotheses/algorifms
851 * \param theHypType - specifies whether algorims or hypotheses or additional ones
852 * are retrieved (possible values are in HypType enumeration)
853 * \param theFather - start object for finding ( may be component, mesh, or sub-mesh )
854 * \param theHyps - output list of names.
855 * \param theHypVars - output list of variables.
856 * \param theAlgoData - to select hypos able to be used by this algo (optional)
858 * Gets existing (i.e. already created) hypotheses or algorithm in accordance with
861 //================================================================================
862 void SMESHGUI_MeshOp::existingHyps( const int theDim,
863 const int theHypType,
864 _PTR(SObject) theFather,
865 QStringList& theHyps,
866 THypList& theHypList,
867 HypothesisData* theAlgoData)
869 // Clear hypoheses list
876 const bool isAux = ( theHypType == AddHyp );
878 _PTR(SObject) aHypRoot;
879 _PTR(GenericAttribute) anAttr;
880 _PTR(AttributeName) aName;
881 _PTR(AttributeIOR) anIOR;
883 bool isMesh = !_CAST( SComponent, theFather );
886 aPart = theHypType == Algo ? SMESH::Tag_RefOnAppliedAlgorithms : SMESH::Tag_RefOnAppliedHypothesis;
888 aPart = theHypType == Algo ? SMESH::Tag_AlgorithmsRoot : SMESH::Tag_HypothesisRoot;
890 if ( theFather->FindSubObject( aPart, aHypRoot ) )
892 _PTR(ChildIterator) anIter =
893 SMESH::GetActiveStudyDocument()->NewChildIterator( aHypRoot );
894 for ( ; anIter->More(); anIter->Next() )
896 _PTR(SObject) anObj = anIter->Value();
897 if ( isMesh ) // i.e. mesh or submesh
899 _PTR(SObject) aRefObj;
900 if ( anObj->ReferencedObject( aRefObj ) )
905 if ( anObj->FindAttribute( anAttr, "AttributeName" ) )
908 CORBA::Object_var aVar = _CAST(SObject,anObj)->GetObject();
909 if ( !CORBA::is_nil( aVar ) )
911 SMESH::SMESH_Hypothesis_var aHypVar = SMESH::SMESH_Hypothesis::_narrow( aVar );
912 if ( !aHypVar->_is_nil() )
914 CORBA::String_var hypType = aHypVar->GetName();
915 HypothesisData* aData = SMESH::GetHypothesisData( hypType.in() );
916 if ( !aData) continue;
917 if ( ( theDim == -1 || aData->Dim.contains( theDim ) ) &&
918 ( isCompatible ( theAlgoData, aData, theHypType )) &&
919 ( isAux == aData->IsAux ))
921 std::string aHypName = aName->Value();
922 theHyps.append( aHypName.c_str() );
923 theHypList.append( THypItem( aHypVar, aHypName.c_str() ) );
932 //================================================================================
934 * \brief If create or edit a submesh, return a hypothesis holding parameters used
935 * to mesh a sub-shape
936 * \param aHypType - The hypothesis type name
937 * \param aServerLib - Server library name
938 * \param hypData - The structure holding the hypothesis type etc.
939 * \retval SMESH::SMESH_Hypothesis_var - the hypothesis holding parameter values
941 //================================================================================
942 SMESH::SMESH_Hypothesis_var
943 SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
944 const QString& aServerLib ) const
946 if ( aHypType.isEmpty() || aServerLib.isEmpty() )
947 return SMESH::SMESH_Hypothesis::_nil();
949 const int nbColonsInMeshEntry = 3;
950 bool isSubMesh = myToCreate ?
952 myDlg->selectedObject( SMESHGUI_MeshDlg::Obj ).count(':') > nbColonsInMeshEntry;
954 // get mesh and geom object
955 SMESH::SMESH_Mesh_var aMeshVar = SMESH::SMESH_Mesh::_nil();
956 GEOM::GEOM_Object_var aGeomVar = GEOM::GEOM_Object::_nil();
961 anEntry = myDlg->selectedObject
962 ( myToCreate ? SMESHGUI_MeshDlg::Mesh : SMESHGUI_MeshDlg::Obj );
963 if ( _PTR(SObject) pObj = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
965 CORBA::Object_ptr Obj = _CAST( SObject,pObj )->GetObject();
966 if ( myToCreate ) // mesh and geom may be selected
968 aMeshVar = SMESH::SMESH_Mesh::_narrow( Obj );
969 anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
970 if ( _PTR(SObject) pGeom = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
971 aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
973 else // edition: sub-mesh may be selected
975 SMESH::SMESH_subMesh_var sm = SMESH::SMESH_subMesh::_narrow( Obj );
976 if ( !sm->_is_nil() ) {
977 aMeshVar = sm->GetFather();
978 aGeomVar = sm->GetSubShape();
985 if ( !myToCreate ) // mesh to edit can be selected
987 anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
988 if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
990 aMeshVar = SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() );
991 if ( !aMeshVar->_is_nil() )
992 aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pMesh );
995 if ( aGeomVar->_is_nil() ) {
996 anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
997 if ( _PTR(SObject) pGeom = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
999 aGeomVar= GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
1004 SMESH::SMESH_Hypothesis_var hyp =
1005 SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
1006 aServerLib.toLatin1().data(),
1009 /*byMesh = */isSubMesh);
1010 if ( hyp->_is_nil() && isSubMesh )
1011 hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
1012 aServerLib.toLatin1().data(),
1015 /*byMesh = */false);
1019 //================================================================================
1021 * \Brief Returns tab dimention
1022 * \param tab - the tab in the dlg
1023 * \param dlg - my dialogue
1024 * \retval int - dimention
1026 //================================================================================
1027 static int getTabDim (const QObject* tab, SMESHGUI_MeshDlg* dlg )
1030 for (int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++)
1031 if (tab == dlg->tab(i))
1036 //================================================================================
1038 * \brief Create hypothesis
1039 * \param theHypType - hypothesis category (main or additional)
1040 * \param theIndex - index of type of hypothesis to be cerated
1042 * Specifies dimension of hypothesis to be created (using sender() method),
1043 * specifies its type and calls method for hypothesis creation
1045 //================================================================================
1046 void SMESHGUI_MeshOp::onCreateHyp( const int theHypType, const int theIndex )
1048 // Specifies dimension of hypothesis to be created
1049 int aDim = getTabDim( sender(), myDlg );
1053 // Specifies type of hypothesis to be created
1054 THypDataList& dataList = myAvailableHypData[ aDim ][ theHypType ];
1055 if (theIndex < 0 || theIndex >= dataList.count())
1057 QString aHypTypeName = dataList[ theIndex ]->TypeName;
1059 // Create hypothesis
1060 createHypothesis(aDim, theHypType, aHypTypeName);
1065 QString GetUniqueName (const QStringList& theHypNames,
1066 const QString& theName,
1067 size_t theIteration = 1)
1069 QString aName = theName + "_" + QString::number( theIteration );
1070 if ( theHypNames.contains( aName ) )
1071 return GetUniqueName( theHypNames, theName, ++theIteration );
1076 //================================================================================
1078 * Create hypothesis and update dialog.
1079 * \param theDim - dimension of hypothesis to be created
1080 * \param theType - hypothesis category (algorithm, hypothesis, additional hypothesis)
1081 * \param theTypeName - specifies hypothesis to be created
1083 //================================================================================
1084 void SMESHGUI_MeshOp::createHypothesis(const int theDim,
1086 const QString& theTypeName)
1088 HypothesisData* aData = SMESH::GetHypothesisData(theTypeName);
1094 QStringList aHypNames;
1095 TDim2Type2HypList::const_iterator aDimIter = myExistingHyps.begin();
1096 for ( ; aDimIter != myExistingHyps.end(); aDimIter++) {
1097 const TType2HypList& aType2HypList = aDimIter.value();
1098 TType2HypList::const_iterator aTypeIter = aType2HypList.begin();
1099 for ( ; aTypeIter != aType2HypList.end(); aTypeIter++) {
1100 const THypList& aHypList = aTypeIter.value();
1101 THypList::const_iterator anIter = aHypList.begin();
1102 for ( ; anIter != aHypList.end(); anIter++) {
1103 const THypItem& aHypItem = *anIter;
1104 const QString& aHypName = aHypItem.second;
1105 aHypNames.append(aHypName);
1109 QString aHypName = GetUniqueName( aHypNames, aData->Label);
1112 bool dialog = false;
1114 QString aClientLibName = aData->ClientLibName;
1115 if (aClientLibName == "") {
1116 // Call hypothesis creation server method (without GUI)
1117 SMESH::SMESH_Hypothesis_var aHyp =
1118 SMESH::CreateHypothesis(theTypeName, aHypName, false);
1122 // Get hypotheses creator client (GUI)
1123 SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
1125 // Create hypothesis
1127 // Get parameters appropriate to initialize a new hypothesis
1128 SMESH::SMESH_Hypothesis_var initParamHyp =
1129 getInitParamsHypothesis(theTypeName, aData->ServerLibName);
1131 removeCustomFilters(); // Issue 0020170
1133 // Get Entry of the Geom object
1134 QString aGeomEntry = "";
1135 QString aMeshEntry = "";
1136 QString anObjEntry = "";
1137 aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
1138 aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
1139 anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
1141 if ( myToCreate && myIsMesh )
1142 aMeshEntry = aGeomEntry;
1144 if ( aMeshEntry != aGeomEntry ) { // Get Geom object from Mesh of a sub-mesh being edited
1145 _PTR(SObject) pObj = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
1146 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
1147 aMeshEntry = ( aGeomVar->_is_nil() ) ? "" : aMeshEntry = aGeomVar->GetStudyEntry();
1150 if ( aMeshEntry == "" && aGeomEntry == "" ) { // get geom of an object being edited
1151 _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
1153 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj, &isMesh );
1154 if ( !aGeomVar->_is_nil() )
1156 aGeomEntry = aGeomVar->GetStudyEntry();
1158 aMeshEntry = aGeomEntry;
1162 if ( anObjEntry != "" && aGeomEntry != "" && aMeshEntry == "" ) {
1163 // take geometry from submesh being created
1164 _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
1166 // if current object is sub-mesh
1167 SMESH::SMESH_subMesh_var aSubMeshVar =
1168 SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
1169 if ( !aSubMeshVar->_is_nil() ) {
1170 SMESH::SMESH_Mesh_var aMeshVar = aSubMeshVar->GetFather();
1171 if ( !aMeshVar->_is_nil() ) {
1172 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar );
1173 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
1174 if ( !aGeomVar->_is_nil() )
1175 aMeshEntry = aGeomVar->GetStudyEntry();
1181 aCreator->setShapeEntry( aGeomEntry );
1182 if ( aMeshEntry != "" )
1183 aCreator->setMainShapeEntry( aMeshEntry );
1184 myDlg->setEnabled( false );
1185 aCreator->create(initParamHyp, aHypName, myDlg, this, SLOT( onHypoCreated( int ) ) );
1189 SMESH::SMESH_Hypothesis_var aHyp =
1190 SMESH::CreateHypothesis(theTypeName, aHypName, false);
1199 //================================================================================
1201 * Necessary steps after hypothesis creation
1202 * \param result - creation result:
1205 * 2 = additional value meaning that slot is called not from dialog box
1207 //================================================================================
1208 void SMESHGUI_MeshOp::onHypoCreated( int result )
1212 int obj = myDlg->getActiveObject();
1213 onActivateObject( obj ); // Issue 0020170. Restore filters
1214 myDlg->setEnabled( true );
1217 _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
1219 int nbHyp = myExistingHyps[myDim][myType].count();
1220 HypothesisData* algoData = hypData( myDim, Algo, currentHyp( myDim, Algo ));
1221 QStringList aNewHyps;
1222 existingHyps(myDim, myType, aFather, aNewHyps, myExistingHyps[myDim][myType], algoData);
1223 if (aNewHyps.count() > nbHyp)
1225 for (int i = nbHyp; i < aNewHyps.count(); i++)
1226 myDlg->tab(myDim)->addHyp(myType, aNewHyps[i]);
1229 if( result!=2 && myHypoSet )
1233 //================================================================================
1235 * \brief Calls plugin methods for hypothesis editing
1236 * \param theHypType - specifies whether main hypothesis or additional one
1238 * \param theIndex - index of existing hypothesis
1240 * Calls plugin methods for hypothesis editing
1242 //================================================================================
1243 void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
1245 // Speicfies dimension of hypothesis to be created
1246 int aDim = getTabDim( sender(), myDlg );
1250 const THypList& aList = myExistingHyps[ aDim ][ theHypType ];
1251 if ( theIndex < 0 || theIndex >= aList.count() )
1253 const THypItem& aHypItem = aList[ theIndex ];
1254 SMESH::SMESH_Hypothesis_var aHyp = aHypItem.first;
1255 if ( aHyp->_is_nil() )
1258 SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
1261 // Get initial parameters
1262 SMESH::SMESH_Hypothesis_var initParamHyp =
1263 getInitParamsHypothesis( aHyp->GetName(), aHyp->GetLibName());
1264 aCreator->setInitParamsHypothesis( initParamHyp );
1266 // Get Entry of the Geom object
1267 QString aGeomEntry = "";
1268 QString aMeshEntry = "";
1269 QString anObjEntry = "";
1270 aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
1271 aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
1272 anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
1274 if ( myToCreate && myIsMesh )
1275 aMeshEntry = aGeomEntry;
1277 if ( aMeshEntry != aGeomEntry ) { // Get Geom object from Mesh of a sub-mesh being edited
1278 _PTR(SObject) pObj = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
1279 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
1280 aMeshEntry = ( aGeomVar->_is_nil() ) ? "" : aMeshEntry = aGeomVar->GetStudyEntry();
1283 if ( aMeshEntry == "" && aGeomEntry == "" ) { // get geom of an object being edited
1284 _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
1286 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj, &isMesh );
1287 if ( !aGeomVar->_is_nil() )
1289 aGeomEntry = aGeomVar->GetStudyEntry();
1291 aMeshEntry = aGeomEntry;
1295 if ( anObjEntry != "" && aGeomEntry != "" && aMeshEntry == "" ) {
1296 // take geometry from submesh being created
1297 _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
1299 // if current object is sub-mesh
1300 SMESH::SMESH_subMesh_var aSubMeshVar =
1301 SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
1302 if ( !aSubMeshVar->_is_nil() ) {
1303 SMESH::SMESH_Mesh_var aMeshVar = aSubMeshVar->GetFather();
1304 if ( !aMeshVar->_is_nil() ) {
1305 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar );
1306 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( aMeshSO );
1307 if ( !aGeomVar->_is_nil() )
1308 aMeshEntry = aGeomVar->GetStudyEntry();
1314 aCreator->setShapeEntry( aGeomEntry );
1315 if ( aMeshEntry != "" )
1316 aCreator->setMainShapeEntry( aMeshEntry );
1317 removeCustomFilters(); // Issue 0020170
1318 myDlg->setEnabled( false );
1319 aCreator->edit( aHyp.in(), aHypItem.second, dlg(), this, SLOT( onHypoEdited( int ) ) );
1323 //================================================================================
1325 * Necessary steps after hypothesis edition
1326 * \param result - creation result:
1330 //================================================================================
1331 void SMESHGUI_MeshOp::onHypoEdited( int result )
1333 int obj = myDlg->getActiveObject();
1334 onActivateObject( obj ); // Issue 0020170. Restore filters
1335 myDlg->setEnabled( true );
1338 //================================================================================
1340 * \brief access to hypothesis data
1341 * \param theDim - hyp dimension
1342 * \param theHypType - hyp type (Algo,MainHyp or AddHyp)
1343 * \param theIndex - index in the list
1344 * \retval HypothesisData* - result data, may be 0
1346 //================================================================================
1347 HypothesisData* SMESHGUI_MeshOp::hypData( const int theDim,
1348 const int theHypType,
1351 if ( theDim > -1 && theDim <= SMESH::DIM_3D &&
1352 theHypType > -1 && theHypType < NbHypTypes &&
1353 theIndex > -1 && theIndex < myAvailableHypData[ theDim ][ theHypType ].count() )
1354 return myAvailableHypData[ theDim ][ theHypType ][ theIndex ];
1358 //================================================================================
1360 * \brief Set available algos and hypos according to the selected algorithm
1361 * \param theIndex - algorithm index
1363 //================================================================================
1364 void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
1367 if ( myIgnoreAlgoSelection )
1370 int aDim = theDim < 0 ? getTabDim( sender(), myDlg ): theDim;
1374 // find highest available dimension, all algos of this dimension are available for choice
1376 for (int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++)
1377 if (isAccessibleDim( i ))
1382 const bool isSubmesh = ( myToCreate ? !myIsMesh : myDlg->isObjectShown( SMESHGUI_MeshDlg::Mesh ));
1384 HypothesisData* algoData = hypData( aDim, Algo, theIndex );
1385 HypothesisData* algoByDim[4];
1386 algoByDim[ aDim ] = algoData;
1388 QStringList anAvailable;
1389 if ( !algoData ) { // all algos becomes available
1390 availableHyps( aDim, Algo, anAvailable, myAvailableHypData[ aDim ][ Algo ]);
1391 myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable );
1393 // check that tab enable, if algorithm building needed algo is one less than dimension
1394 if ( algoData && myIsOnGeometry && !algoData->InputTypes.isEmpty() &&
1395 ( aDim > SMESH::DIM_0D ) && !isAccessibleDim( aDim - 1 ) ){
1396 myDlg->enableTab( aDim - 1 );
1398 if ( (myDlg->currentMeshType() != MT_ANY) &&
1399 (( !algoData && ( aDim > SMESH::DIM_0D ) && isAccessibleDim( aDim - 1 )) ||
1400 ( algoData && myIsOnGeometry && algoData->InputTypes.isEmpty() &&
1401 ( aDim > SMESH::DIM_0D ) && isAccessibleDim( aDim - 1 ) ) ) ){
1402 for (int i = aDim - 1; i >= SMESH::DIM_0D; i--){
1403 if ( isAccessibleDim( i ) ) myDlg->disableTab( i );
1406 // check that algorithms of other dimentions are compatible with
1409 // 2 loops: backward and forward from algo dimension
1410 for ( int forward = false; forward <= true; ++forward )
1412 int dim = aDim + 1, lastDim = SMESH::DIM_3D, dir = 1;
1414 dim = aDim - 1; lastDim = SMESH::DIM_0D; dir = -1;
1416 HypothesisData* prevAlgo = algoData;
1417 bool noCompatible = false;
1418 for ( ; dim * dir <= lastDim * dir; dim += dir)
1420 if ( !isAccessibleDim( dim ))
1422 if ( noCompatible ) { // the selected algo has no compatible ones
1423 anAvailable.clear();
1424 myDlg->tab( dim )->setAvailableHyps( Algo, anAvailable );
1425 myAvailableHypData[dim][Algo].clear();
1426 algoByDim[ dim ] = 0;
1429 // get currently selected algo
1430 int algoIndex = currentHyp( dim, Algo );
1431 HypothesisData* curAlgo = hypData( dim, Algo, algoIndex );
1432 if ( curAlgo ) { // some algo selected
1433 if ( !isCompatible( prevAlgo, curAlgo, Algo ))
1436 // set new available algoritms
1437 availableHyps( dim, Algo, anAvailable, myAvailableHypData[dim][Algo], prevAlgo );
1438 HypothesisData* soleCompatible = 0;
1439 if ( anAvailable.count() == 1 )
1440 soleCompatible = myAvailableHypData[dim][Algo][0];
1441 if ( dim == aTopDim && prevAlgo ) // all available algoritms should be selectable any way
1442 availableHyps( dim, Algo, anAvailable, myAvailableHypData[dim][Algo], 0 );
1443 myDlg->tab( dim )->setAvailableHyps( Algo, anAvailable );
1444 noCompatible = anAvailable.isEmpty();
1446 // restore previously selected algo
1447 algoIndex = myAvailableHypData[dim][Algo].indexOf( curAlgo );
1448 if ( !isSubmesh && algoIndex < 0 && soleCompatible && !forward && dim != SMESH::DIM_0D)
1449 // select the sole compatible algo
1450 algoIndex = myAvailableHypData[dim][Algo].indexOf( soleCompatible );
1451 setCurrentHyp( dim, Algo, algoIndex );
1453 // remember current algo
1454 prevAlgo = algoByDim[ dim ] = hypData( dim, Algo, algoIndex );
1458 // set hypotheses corresponding to the found algoritms
1460 _PTR(SObject) pObj = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
1462 for ( int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++ )
1464 if ( !isAccessibleDim( dim ))
1466 for ( int type = MainHyp; type < NbHypTypes; type++ )
1468 myAvailableHypData[ dim ][ type ].clear();
1469 QStringList anAvailable, anExisting;
1471 HypothesisData* curAlgo = algoByDim[ dim ];
1472 int hypIndex = currentHyp( dim, type );
1474 SMESH::SMESH_Hypothesis_var curHyp;
1475 if ( hypIndex >= 0 && hypIndex < myExistingHyps[ dim ][ type ].count() )
1476 curHyp = myExistingHyps[ dim ][ type ][ hypIndex ].first;
1478 if ( !myToCreate && !curAlgo && !curHyp->_is_nil() ) { // edition, algo not selected
1479 // try to find algo by selected hypothesis in order to keep it selected
1480 bool algoDeselectedByUser = ( theDim < 0 && aDim == dim );
1481 CORBA::String_var curHypType = curHyp->GetName();
1482 if ( !algoDeselectedByUser &&
1483 myObjHyps[ dim ][ type ].count() > 0 &&
1484 !strcmp( curHypType, myObjHyps[ dim ][ type ].first().first->GetName()) )
1486 HypothesisData* hypData = SMESH::GetHypothesisData( curHyp->GetName() );
1487 for (int i = 0; i < myAvailableHypData[ dim ][ Algo ].count(); ++i) {
1488 curAlgo = myAvailableHypData[ dim ][ Algo ][ i ];
1489 if (curAlgo && hypData && isCompatible(curAlgo, hypData, type))
1496 // get hyps compatible with curAlgo
1499 // check if a selected hyp is compatible with the curAlgo
1500 if ( !curHyp->_is_nil() ) {
1501 HypothesisData* hypData = SMESH::GetHypothesisData( curHyp->GetName() );
1502 if ( !isCompatible( curAlgo, hypData, type ))
1503 curHyp = SMESH::SMESH_Hypothesis::_nil();
1505 existingHyps( dim, type, pObj, anExisting, myExistingHyps[ dim ][ type ], curAlgo);
1506 availableHyps( dim, type, anAvailable, myAvailableHypData[ dim ][ type ], curAlgo);
1508 // set list of hypotheses
1509 myDlg->tab( dim )->setAvailableHyps( type, anAvailable );
1510 myDlg->tab( dim )->setExistingHyps( type, anExisting );
1512 // set current existing hypothesis
1513 if ( !curHyp->_is_nil() && !anExisting.isEmpty() )
1514 hypIndex = this->find( curHyp, myExistingHyps[ dim ][ type ]);
1517 if ( !isSubmesh && hypIndex < 0 && anExisting.count() == 1 ) {
1518 // none is yet selected => select the sole existing if it is not optional
1519 CORBA::String_var hypTypeName = myExistingHyps[ dim ][ type ].first().first->GetName();
1520 bool isOptional = true;
1521 if ( algoByDim[ dim ] &&
1522 SMESH::IsAvailableHypothesis( algoByDim[ dim ], hypTypeName.in(), isOptional ) &&
1526 setCurrentHyp( dim, type, hypIndex );
1531 //================================================================================
1533 * \brief Creates and selects hypothesis of hypotheses set
1534 * \param theSetName - The name of hypotheses set
1536 //================================================================================
1537 void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
1539 myHypoSet = SMESH::GetHypothesesSet(theSetName);
1544 for (int dim = SMESH::DIM_0D; dim <= SMESH::DIM_3D; dim++) {
1545 setCurrentHyp(dim, Algo, -1);
1546 setCurrentHyp(dim, AddHyp, -1);
1547 setCurrentHyp(dim, MainHyp, -1);
1550 myHypoSet->init(true); //algorithms
1552 myHypoSet->init(false); //hypotheses
1557 //================================================================================
1559 * \brief One step of hypothesis/algorithm list creation
1561 * Creates a hypothesis or an algorithm for current item of internal list of names myHypoSet
1563 //================================================================================
1564 void SMESHGUI_MeshOp::processSet()
1567 if( !myHypoSet->more() )
1570 bool isAlgo = myHypoSet->isAlgo();
1571 QString aHypoTypeName = myHypoSet->current();
1572 HypothesisData* aHypData = SMESH::GetHypothesisData(aHypoTypeName);
1579 int aDim = aHypData->Dim[0];
1580 // create or/and set
1583 int index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
1586 QStringList anAvailable;
1587 availableHyps( aDim, Algo, anAvailable, myAvailableHypData[aDim][Algo] );
1588 myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable );
1589 index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
1591 setCurrentHyp( aDim, Algo, index );
1592 onAlgoSelected( index, aDim );
1597 bool mainHyp = true;
1598 QStringList anAvailable;
1599 availableHyps( aDim, MainHyp, anAvailable, myAvailableHypData[aDim][MainHyp] );
1600 myDlg->tab( aDim )->setAvailableHyps( MainHyp, anAvailable );
1601 int index = myAvailableHypData[aDim][MainHyp].indexOf( aHypData );
1605 index = myAvailableHypData[aDim][AddHyp].indexOf( aHypData );
1608 createHypothesis(aDim, mainHyp ? MainHyp : AddHyp, aHypoTypeName);
1614 //================================================================================
1616 * \brief Creates mesh
1617 * \param theMess - Output parameter intended for returning error message
1618 * \param theEntryList - List of entries of published objects
1619 * \retval bool - TRUE if mesh is created, FALSE otherwise
1623 //================================================================================
1624 bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
1628 //QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
1629 //QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
1632 myDlg->selectedObject( SMESHGUI_MeshDlg::Geom, aList );
1633 if ( aList.isEmpty() )
1635 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
1636 if ( aSMESHGen->_is_nil() )
1639 SMESH::SMESH_Mesh_var aMeshVar= aSMESHGen->CreateEmptyMesh();
1640 if ( aMeshVar->_is_nil() )
1643 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar.in() );
1645 SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) );
1646 theEntryList.append( aMeshSO->GetID().c_str() );
1650 QStringList::Iterator it = aList.begin();
1651 for ( ; it!=aList.end(); it++)
1653 QString aGeomEntry = *it;
1654 _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
1655 GEOM::GEOM_Object_var aGeomVar =
1656 GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
1658 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
1659 if ( aSMESHGen->_is_nil() )
1662 SUIT_OverrideCursor aWaitCursor;
1665 SMESH::SMESH_Mesh_var aMeshVar = aSMESHGen->CreateMesh( aGeomVar );
1666 if ( aMeshVar->_is_nil() )
1668 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar.in() );
1670 SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) );
1671 theEntryList.append( aMeshSO->GetID().c_str() );
1674 for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ ) {
1675 if ( !isAccessibleDim( aDim )) continue;
1677 // assign hypotheses
1678 for ( int aHypType = MainHyp; aHypType <= AddHyp; aHypType++ ) {
1679 int aHypIndex = currentHyp( aDim, aHypType );
1680 if ( aHypIndex >= 0 && aHypIndex < myExistingHyps[ aDim ][ aHypType ].count() ) {
1681 SMESH::SMESH_Hypothesis_var aHypVar = myExistingHyps[ aDim ][ aHypType ][ aHypIndex ].first;
1682 if ( !aHypVar->_is_nil() )
1683 SMESH::AddHypothesisOnMesh( aMeshVar, aHypVar );
1686 // find or create algorithm
1687 SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( aDim );
1688 if ( !anAlgoVar->_is_nil() )
1689 SMESH::AddHypothesisOnMesh( aMeshVar, anAlgoVar );
1695 //================================================================================
1697 * \brief Creates sub-mesh
1698 * \param theMess - Output parameter intended for returning error message
1699 * \param theEntryList - List of entries of published objects
1700 * \retval bool - TRUE if sub-mesh is created, FALSE otherwise
1704 //================================================================================
1705 bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList )
1709 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
1710 if ( aSMESHGen->_is_nil() )
1714 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
1715 _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() );
1716 SMESH::SMESH_Mesh_var aMeshVar =
1717 SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() );
1718 if (aMeshVar->_is_nil())
1721 // GEOM shape of the main mesh
1722 GEOM::GEOM_Object_var mainGeom = aMeshVar->GetShapeToMesh();
1724 // Name for the new sub-mesh
1725 QString aName = myDlg->objectText(SMESHGUI_MeshDlg::Obj);
1728 GEOM::GEOM_Object_var aGeomVar;
1730 myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
1731 if (aGEOMs.count() == 1)
1733 //QString aGeomEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
1734 QString aGeomEntry = aGEOMs.first();
1735 _PTR(SObject) pGeom = studyDS()->FindObjectID( aGeomEntry.toLatin1().data() );
1736 aGeomVar = GEOM::GEOM_Object::_narrow( _CAST( SObject,pGeom )->GetObject() );
1738 else if (aGEOMs.count() > 1)
1740 // create a GEOM group
1741 GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
1742 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1743 if (!geomGen->_is_nil() && aStudy) {
1744 GEOM::GEOM_IGroupOperations_wrap op =
1745 geomGen->GetIGroupOperations(aStudy->StudyId());
1746 if (!op->_is_nil()) {
1747 // check and add all selected GEOM objects: they must be
1748 // a sub-shapes of the main GEOM and must be of one type
1750 TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
1751 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1752 aSeq->length(aGEOMs.count());
1753 QStringList::const_iterator aSubShapesIter = aGEOMs.begin();
1754 for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++, iSubSh++) {
1755 QString aSubGeomEntry = (*aSubShapesIter);
1756 _PTR(SObject) pSubGeom = studyDS()->FindObjectID(aSubGeomEntry.toLatin1().data());
1757 GEOM::GEOM_Object_var aSubGeomVar =
1758 GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
1759 TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aSubGeomVar->GetShapeType();
1761 aGroupType = aSubShapeType;
1763 if (aSubShapeType != aGroupType)
1764 aGroupType = TopAbs_SHAPE;
1766 aSeq[iSubSh] = aSubGeomVar;
1769 GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(mainGeom, aGroupType);
1770 op->UnionList(aGroupVar, aSeq);
1774 aGeomVar = GEOM::GEOM_Object::_duplicate( aGroupVar.in() );
1776 // publish the GEOM group in study
1777 QString aNewGeomGroupName ("Auto_group_for_");
1778 aNewGeomGroupName += aName;
1779 SALOMEDS::Study_var aStudyVar = _CAST(Study, aStudy)->GetStudy();
1780 SALOMEDS::SObject_wrap aNewGroupSO =
1781 geomGen->AddInStudy( aStudyVar, aGeomVar,
1782 aNewGeomGroupName.toLatin1().data(), mainGeom);
1789 if (aGeomVar->_is_nil())
1792 SUIT_OverrideCursor aWaitCursor;
1795 SMESH::SMESH_subMesh_var aSubMeshVar = aMeshVar->GetSubMesh( aGeomVar, aName.toLatin1().data() );
1796 _PTR(SObject) aSubMeshSO = SMESH::FindSObject( aSubMeshVar.in() );
1798 SMESH::SetName( aSubMeshSO, aName.toLatin1().data() );
1799 theEntryList.append( aSubMeshSO->GetID().c_str() );
1802 for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ )
1804 if ( !isAccessibleDim( aDim )) continue;
1806 // find or create algorithm
1807 SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( aDim );
1808 if ( !anAlgoVar->_is_nil() )
1809 SMESH::AddHypothesisOnSubMesh( aSubMeshVar, anAlgoVar );
1810 // assign hypotheses
1811 for ( int aHypType = MainHyp; aHypType <= AddHyp; aHypType++ )
1813 int aHypIndex = currentHyp( aDim, aHypType );
1814 if ( aHypIndex >= 0 && aHypIndex < myExistingHyps[ aDim ][ aHypType ].count() )
1816 SMESH::SMESH_Hypothesis_var aHypVar =
1817 myExistingHyps[ aDim ][ aHypType ][ aHypIndex ].first;
1818 if ( !aHypVar->_is_nil() )
1819 SMESH::AddHypothesisOnSubMesh( aSubMeshVar, aHypVar );
1824 // deselect geometry: next submesh should be created on other sub-shape
1825 myDlg->clearSelection( SMESHGUI_MeshDlg::Geom );
1826 selectObject( _PTR(SObject)() );
1832 //================================================================================
1834 * \brief Gets current hypothesis or algorithms
1835 * \param theDim - dimension of hypothesis or algorithm
1836 * \param theHypType - Type of hypothesis (Algo, MainHyp, AddHyp)
1837 * \retval int - current hypothesis or algorithms
1839 * Gets current hypothesis or algorithms
1841 //================================================================================
1842 int SMESHGUI_MeshOp::currentHyp( const int theDim, const int theHypType ) const
1844 return myDlg->tab( theDim )->currentHyp( theHypType ) - 1;
1847 //================================================================================
1849 * \brief Returns true if hypotheses of given dim can be assigned
1850 * \param theDim - hypotheses dimension
1851 * \retval bool - result
1853 //================================================================================
1854 bool SMESHGUI_MeshOp::isAccessibleDim( const int theDim ) const
1856 return myDlg->isTabEnabled( theDim );
1859 //================================================================================
1861 * \brief Sets current hypothesis or algorithms
1862 * \param theDim - dimension of hypothesis or algorithm
1863 * \param theHypType - Type of hypothesis (Algo, MainHyp, AddHyp)
1864 * \param theIndex - Index of hypothesis
1866 * Gets current hypothesis or algorithms
1868 //================================================================================
1869 void SMESHGUI_MeshOp::setCurrentHyp( const int theDim,
1870 const int theHypType,
1871 const int theIndex )
1873 myIgnoreAlgoSelection = true;
1874 myDlg->tab( theDim )->setCurrentHyp( theHypType, theIndex + 1 );
1875 myIgnoreAlgoSelection = false;
1878 //================================================================================
1880 * \brief Generates default and sets mesh/submesh name
1882 * Generates and sets default mesh/submesh name(Mesh_1, Mesh_2, etc.)
1884 //================================================================================
1885 void SMESHGUI_MeshOp::setDefaultName() const
1889 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1891 QString aPrefix = tr( myIsMesh ? "SMESH_OBJECT_MESH" : "SMESH_SUBMESH" ) + "_";
1892 _PTR(SObject) anObj;
1895 aResName = aPrefix + QString::number( i++ );
1896 anObj = aStudy->FindObject( aResName.toLatin1().data() );
1900 QLineEdit* aControl = ( QLineEdit* )myDlg->objectWg(
1901 SMESHGUI_MeshDlg::Obj, SMESHGUI_MeshDlg::Control );
1902 aControl->setText( aResName );
1905 //================================================================================
1907 * \brief Gets algorithm or creates it if necessary
1908 * \param theDim - specifies dimension of returned hypotheses/algorifms
1909 * \retval SMESH::SMESH_Hypothesis_var - algorithm
1911 * Gets algorithm or creates it if necessary
1913 //================================================================================
1914 SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
1916 SMESH::SMESH_Hypothesis_var anAlgoVar;
1918 // get type of the selected algo
1919 int aHypIndex = currentHyp( theDim, Algo );
1920 THypDataList& dataList = myAvailableHypData[ theDim ][ Algo ];
1921 if ( aHypIndex < 0 || aHypIndex >= dataList.count())
1923 QString aHypName = dataList[ aHypIndex ]->TypeName;
1925 // get existing algoritms
1926 _PTR(SObject) pObj = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
1928 existingHyps( theDim, Algo, pObj, tmp, myExistingHyps[ theDim ][ Algo ]);
1930 // look for an existing algo of such a type
1931 THypList& aHypVarList = myExistingHyps[ theDim ][ Algo ];
1932 THypList::iterator anIter = aHypVarList.begin();
1933 for ( ; anIter != aHypVarList.end(); anIter++)
1935 SMESH::SMESH_Hypothesis_var aHypVar = (*anIter).first;
1936 CORBA::String_var aName = aHypVar->GetName();
1937 if ( !aHypVar->_is_nil() && !strcmp(aHypName.toLatin1().data(), aName) )
1939 anAlgoVar = aHypVar;
1944 if (anAlgoVar->_is_nil())
1946 HypothesisData* aHypData = SMESH::GetHypothesisData( aHypName );
1949 QString aClientLibName = aHypData->ClientLibName;
1950 if ( aClientLibName.isEmpty() )
1952 // Call hypothesis creation server method (without GUI)
1953 SMESH::SMESH_Hypothesis_var aHyp =
1954 SMESH::CreateHypothesis(aHypName, aHypName, true);
1959 // Get hypotheses creator client (GUI)
1960 SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
1964 aCreator->create( true, aHypName, myDlg, 0, QString::null );
1966 SMESH::SMESH_Hypothesis_var aHyp =
1967 SMESH::CreateHypothesis(aHypName, aHypName, true);
1971 QStringList tmpList;
1972 _PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
1973 existingHyps( theDim, Algo, aFather, tmpList, myExistingHyps[ theDim ][ Algo ] );
1976 THypList& aNewHypVarList = myExistingHyps[ theDim ][ Algo ];
1977 for ( anIter = aNewHypVarList.begin(); anIter != aNewHypVarList.end(); ++anIter )
1979 SMESH::SMESH_Hypothesis_var aHypVar = (*anIter).first;
1980 CORBA::String_var aName = aHypVar->GetName();
1981 if ( !aHypVar->_is_nil() && !strcmp(aHypName.toLatin1().data(), aName) )
1983 anAlgoVar = aHypVar;
1989 return anAlgoVar._retn();
1992 //================================================================================
1994 * \brief Reads parameters of an edited mesh and assigns them to the dialog
1996 * Called when mesh is edited only.
1998 //================================================================================
1999 void SMESHGUI_MeshOp::readMesh()
2001 QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
2002 _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
2006 if (myIsOnGeometry) {
2007 // Get name of mesh if current object is sub-mesh
2008 SMESH::SMESH_subMesh_var aSubMeshVar =
2009 SMESH::SMESH_subMesh::_narrow( _CAST( SObject,pObj )->GetObject() );
2010 if ( !aSubMeshVar->_is_nil() )
2012 SMESH::SMESH_Mesh_var aMeshVar = aSubMeshVar->GetFather();
2013 if ( !aMeshVar->_is_nil() )
2015 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar );
2016 QString aMeshName = name( aMeshSO );
2017 myDlg->setObjectText( SMESHGUI_MeshDlg::Mesh, aMeshName );
2021 // Get name of geometry object
2022 GEOM::GEOM_Object_var aGeomVar = SMESH::GetShapeOnMeshOrSubMesh( pObj );
2023 if ( !aGeomVar->_is_nil() )
2025 _PTR(SObject) aGeomSO = studyDS()->FindObjectID( aGeomVar->GetStudyEntry() );
2026 QString aShapeName = name( aGeomSO );
2027 myDlg->setObjectText( SMESHGUI_MeshDlg::Geom, aShapeName );
2031 // Get hypotheses and algorithms assigned to the mesh/sub-mesh
2032 QStringList anExisting;
2033 const int lastDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
2034 for ( int dim = SMESH::DIM_3D; dim >= lastDim; --dim )
2037 existingHyps( dim, Algo, pObj, anExisting, myObjHyps[ dim ][ Algo ] );
2038 // find algo index among available ones
2040 if ( myObjHyps[ dim ][ Algo ].count() > 0 )
2042 SMESH::SMESH_Hypothesis_var aVar = myObjHyps[ dim ][ Algo ].first().first;
2043 HypothesisData* algoData = SMESH::GetHypothesisData( aVar->GetName() );
2044 aHypIndex = myAvailableHypData[ dim ][ Algo ].indexOf ( algoData );
2045 // if ( aHypIndex < 0 && algoData ) {
2046 // // assigned algo is incompatible with other algorithms
2047 // myAvailableHypData[ dim ][ Algo ].push_back( algoData );
2048 // aHypIndex = myAvailableHypData[ dim ][ hypType ].count() - 1;
2051 setCurrentHyp( dim, Algo, aHypIndex );
2052 // set existing and available hypothesis according to the selected algo
2053 onAlgoSelected( aHypIndex, dim );
2057 bool hypWithoutAlgo = false;
2058 for ( int dim = SMESH::DIM_3D; dim >= lastDim; --dim )
2060 for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ )
2063 existingHyps( dim, hypType, pObj, anExisting, myObjHyps[ dim ][ hypType ] );
2064 // find index of requered hypothesis among existing ones for this dimension and type
2066 if ( myObjHyps[ dim ][ hypType ].count() > 0 ) {
2067 aHypIndex = find( myObjHyps[ dim ][ hypType ].first().first,
2068 myExistingHyps[ dim ][ hypType ] );
2069 if ( aHypIndex < 0 ) {
2070 // assigned hypothesis is incompatible with the algorithm
2071 if ( currentHyp( dim, Algo ) < 0 )
2072 { // none algo selected; it is edition for sure, of submesh maybe
2073 hypWithoutAlgo = true;
2074 myExistingHyps[ dim ][ hypType ].push_back( myObjHyps[ dim ][ hypType ].first() );
2075 aHypIndex = myExistingHyps[ dim ][ hypType ].count() - 1;
2076 myDlg->tab( dim )->setExistingHyps( hypType, anExisting );
2080 setCurrentHyp( dim, hypType, aHypIndex );
2083 // make available other hyps of same type as one without algo
2084 if ( hypWithoutAlgo )
2085 onAlgoSelected( currentHyp( 0, Algo ), 0 );
2088 //================================================================================
2090 * \brief Gets name of object
2091 * \param theSO - SObject
2092 * \retval QString - name of object
2094 * Gets name of object
2096 //================================================================================
2097 QString SMESHGUI_MeshOp::name( _PTR(SObject) theSO ) const
2102 _PTR(GenericAttribute) anAttr;
2103 _PTR(AttributeName) aNameAttr;
2104 if ( theSO->FindAttribute( anAttr, "AttributeName" ) )
2107 aResName = aNameAttr->Value().c_str();
2113 //================================================================================
2115 * \brief Finds hypothesis in input list
2116 * \param theHyp - hypothesis to be found
2117 * \param theHypList - input list of hypotheses
2118 * \retval int - index of hypothesis or -1 if it is not found
2120 * Finds position of hypothesis in input list
2122 //================================================================================
2123 int SMESHGUI_MeshOp::find( const SMESH::SMESH_Hypothesis_var& theHyp,
2124 const THypList& theHypList ) const
2127 if ( !theHyp->_is_nil() )
2130 THypList::const_iterator anIter = theHypList.begin();
2131 for ( ; anIter != theHypList.end(); ++ anIter)
2133 if ( theHyp->_is_equivalent( (*anIter).first ) )
2144 //================================================================================
2146 * \brief Edits mesh or sub-mesh
2147 * \param theMess - Output parameter intended for returning error message
2148 * \retval bool - TRUE if mesh is edited succesfully, FALSE otherwise
2150 * Assigns new name hypotheses and algoriths to the mesh or sub-mesh
2152 //================================================================================
2153 bool SMESHGUI_MeshOp::editMeshOrSubMesh( QString& theMess )
2157 SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
2158 if ( aSMESHGen->_is_nil() )
2161 QString anObjEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Obj );
2162 _PTR(SObject) pObj = studyDS()->FindObjectID( anObjEntry.toLatin1().data() );
2166 SUIT_OverrideCursor aWaitCursor;
2169 QString aName = myDlg->objectText( SMESHGUI_MeshDlg::Obj );
2170 SMESH::SetName( pObj, aName );
2171 int aDim = ( myIsOnGeometry ) ? SMESH::DIM_0D : SMESH::DIM_3D;
2173 // First, remove old algos in order to avoid messages on algorithm hiding
2174 for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
2176 if ( isAccessibleDim( dim ) && myObjHyps[ dim ][ Algo ].count() > 0 )
2178 SMESH::SMESH_Hypothesis_var anOldAlgo = myObjHyps[ dim ][ Algo ].first().first;
2179 SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
2180 if ( anAlgoVar->_is_nil() || // no new algo selected or
2181 strcmp(anOldAlgo->GetName(), anAlgoVar->GetName()) ) // algo change
2183 // remove old algorithm
2184 SMESH::RemoveHypothesisOrAlgorithmOnMesh ( pObj, myObjHyps[ dim ][ Algo ].first().first );
2185 myObjHyps[ dim ][ Algo ].clear();
2190 // Assign new algorithms and hypotheses
2191 for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
2193 if ( !isAccessibleDim( dim )) continue;
2195 // find or create algorithm
2196 SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
2198 // assign new algorithm
2199 if ( !anAlgoVar->_is_nil() && // some algo selected and
2200 myObjHyps[ dim ][ Algo ].count() == 0 ) // no algo assigned
2202 SALOMEDS_SObject* aSObject = _CAST(SObject, pObj);
2203 CORBA::Object_var anObject = aSObject->GetObject();
2204 SMESH::SMESH_Mesh_var aMeshVar = SMESH::SMESH_Mesh::_narrow( anObject );
2205 bool isMesh = !aMeshVar->_is_nil();
2207 SMESH::AddHypothesisOnMesh( aMeshVar, anAlgoVar );
2209 SMESH::SMESH_subMesh_var aVar =
2210 SMESH::SMESH_subMesh::_narrow( _CAST(SObject,pObj)->GetObject() );
2211 if ( !aVar->_is_nil() )
2212 SMESH::AddHypothesisOnSubMesh( aVar, anAlgoVar );
2214 myObjHyps[ dim ][ Algo ].append( THypItem( anAlgoVar, aName) );
2217 // assign hypotheses
2218 for ( int hypType = MainHyp; hypType <= AddHyp; hypType++ )
2220 int aNewHypIndex = currentHyp( dim, hypType );
2221 int anOldHypIndex = -1;
2223 // remove old hypotheses
2224 if ( myObjHyps[ dim ][ hypType ].count() > 0 )
2226 anOldHypIndex = find( myObjHyps[ dim ][ hypType ].first().first,
2227 myExistingHyps[ dim ][ hypType ] );
2228 if ( aNewHypIndex != anOldHypIndex || // different hyps
2229 anOldHypIndex == -1 ) // hyps of different algos
2231 SMESH::RemoveHypothesisOrAlgorithmOnMesh
2232 ( pObj, myObjHyps[ dim ][ hypType ].first().first );
2233 myObjHyps[ dim ][ hypType ].clear();
2237 // assign new hypotheses
2238 if ( aNewHypIndex != anOldHypIndex && aNewHypIndex != -1 )
2240 SMESH::SMESH_Mesh_var aMeshVar =
2241 SMESH::SMESH_Mesh::_narrow( _CAST(SObject,pObj)->GetObject() );
2242 bool isMesh = !aMeshVar->_is_nil();
2245 SMESH::AddHypothesisOnMesh
2246 (aMeshVar, myExistingHyps[ dim ][ hypType ][ aNewHypIndex ].first );
2250 SMESH::SMESH_subMesh_var aVar =
2251 SMESH::SMESH_subMesh::_narrow( _CAST(SObject,pObj)->GetObject() );
2252 if ( !aVar->_is_nil() )
2253 SMESH::AddHypothesisOnSubMesh
2254 ( aVar, myExistingHyps[ dim ][ hypType ][ aNewHypIndex ].first );
2257 // reread all hypotheses of mesh if necessary
2258 QStringList anExisting;
2259 existingHyps( dim, hypType, pObj, anExisting, myObjHyps[ dim ][ hypType ] );
2266 //================================================================================
2268 * \brief Verifies whether given operator is valid for this one
2269 * \param theOtherOp - other operation
2270 * \return Returns TRUE if the given operator is valid for this one, FALSE otherwise
2272 * method redefined from base class verifies whether given operator is valid for
2273 * this one (i.e. can be started "above" this operator). In current implementation method
2274 * retuns false if theOtherOp operation is not intended for deleting objects or mesh
2277 //================================================================================
2278 bool SMESHGUI_MeshOp::isValid( SUIT_Operation* theOp ) const
2280 return SMESHGUI_Operation::isValid( theOp ) && !theOp->inherits( "SMESHGUI_MeshOp" );
2283 //================================================================================
2285 * \brief SLOT. Is called when the user selects a way of geometry selection
2286 * \param theByMesh - true if the user wants to find geometry by mesh element
2288 //================================================================================
2289 void SMESHGUI_MeshOp::onGeomSelectionByMesh( bool theByMesh )
2292 if ( !myShapeByMeshOp ) {
2293 myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp();
2294 connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
2295 SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
2296 connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
2297 SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
2299 // set mesh object to SMESHGUI_ShapeByMeshOp and start it
2300 QString aMeshEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Mesh );
2301 if ( _PTR(SObject) pMesh = studyDS()->FindObjectID( aMeshEntry.toLatin1().data() )) {
2302 SMESH::SMESH_Mesh_var aMeshVar =
2303 SMESH::SMESH_Mesh::_narrow( _CAST( SObject,pMesh )->GetObject() );
2304 if ( !aMeshVar->_is_nil() ) {
2305 myDlg->hide(); // stop processing selection
2306 myShapeByMeshOp->setModule( getSMESHGUI() );
2307 myShapeByMeshOp->setStudy( 0 ); // it's really necessary
2308 myShapeByMeshOp->SetMesh( aMeshVar );
2309 myShapeByMeshOp->start();
2315 //================================================================================
2317 * \brief SLOT. Is called when Ok is pressed in SMESHGUI_ShapeByMeshDlg
2319 //================================================================================
2320 void SMESHGUI_MeshOp::onPublishShapeByMeshDlg(SUIT_Operation* op)
2322 if ( myShapeByMeshOp == op ) {
2323 SMESHGUI::GetSMESHGUI()->getApp()->updateObjectBrowser(); //MZN: 24.11.2006 IPAL13980 - Object Browser update added
2325 // Select a found geometry object
2326 GEOM::GEOM_Object_var aGeomVar = myShapeByMeshOp->GetShape();
2327 if ( !aGeomVar->_is_nil() )
2329 QString ID = aGeomVar->GetStudyEntry();
2330 if ( _PTR(SObject) aGeomSO = studyDS()->FindObjectID( ID.toLatin1().data() )) {
2331 selectObject( aGeomSO );
2338 //================================================================================
2340 * \brief SLOT. Is called when Close is pressed in SMESHGUI_ShapeByMeshDlg
2342 //================================================================================
2343 void SMESHGUI_MeshOp::onCloseShapeByMeshDlg(SUIT_Operation* op)
2345 if ( myShapeByMeshOp == op && myDlg ) {
2350 //================================================================================
2352 * \brief Selects a SObject
2353 * \param theSObj - the SObject to select
2355 //================================================================================
2356 void SMESHGUI_MeshOp::selectObject( _PTR(SObject) theSObj ) const
2358 if ( LightApp_SelectionMgr* sm = selectionMgr() ) {
2359 SALOME_ListIO anIOList;
2361 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
2362 ( theSObj->GetID().c_str(), "SMESH", theSObj->GetName().c_str() );
2363 anIOList.Append( anIO );
2365 sm->setSelectedObjects( anIOList, false );
2368 //================================================================================
2370 * \brief Create available list types of mesh
2371 * \param theTypeMesh - Output list of available types of mesh
2373 //================================================================================
2374 void SMESHGUI_MeshOp::createMeshTypeList( QStringList& theTypeMesh)
2376 theTypeMesh.clear();
2377 theTypeMesh.append( tr( "MT_ANY" ) );
2378 if ( myIsOnGeometry && ( myMaxShapeDim >= 2 || myMaxShapeDim == -1 ) )
2380 theTypeMesh.append( tr( "MT_TRIANGULAR" ) );
2381 theTypeMesh.append( tr( "MT_QUADRILATERAL" ) );
2383 if ( myIsOnGeometry && ( myMaxShapeDim == 3 || myMaxShapeDim == -1 ) )
2385 theTypeMesh.append( tr( "MT_TETRAHEDRAL" ) );
2386 theTypeMesh.append( tr( "MT_HEXAHEDRAL" ) );
2390 //================================================================================
2392 * \brief Set available types of mesh
2393 * \param theTypeMesh - List of available types of mesh
2395 //================================================================================
2396 void SMESHGUI_MeshOp::setAvailableMeshType( const QStringList& theTypeMesh )
2398 myDlg->setAvailableMeshType( theTypeMesh );
2401 //================================================================================
2403 * \brief SLOT. Is called when the user select type of mesh
2404 * \param theTabIndex - Index of current active tab
2405 * \param theIndex - Index of current type of mesh
2407 //================================================================================
2408 void SMESHGUI_MeshOp::onAlgoSetByMeshType( const int theTabIndex, const int theIndex)
2411 if ( !myIsOnGeometry ) return;
2412 THypDataList anAvailableAlgsData;
2413 QStringList anAvailableAlgs;
2414 QString anCompareType = "ANY";
2415 bool isAvailableChoiceAlgo = false;
2416 int anCurrentAvailableAlgo = 0;
2418 switch ( theIndex ) {
2421 for ( int dim = SMESH::DIM_2D; dim <= SMESH::DIM_3D; dim++ )
2423 isNone = currentHyp( dim, Algo ) < 0;
2424 isAvailableChoiceAlgo = false;
2425 // retrieves a list of available algorithms from resources
2426 availableHyps( dim, Algo, anAvailableAlgs, anAvailableAlgsData );
2427 //return current algo in current tab
2428 if ( !isNone && !myAvailableHypData[dim][Algo].empty() ){
2429 for (int i = 0 ; i < anAvailableAlgsData.count(); i++)
2431 HypothesisData* algoAny = anAvailableAlgsData.at(i);
2432 HypothesisData* algoCur = myAvailableHypData[dim][Algo].at( currentHyp( dim, Algo ) );
2433 QString tem = algoAny->Label;
2434 if ( algoAny->Label == algoCur->Label ){
2435 isAvailableChoiceAlgo = true;
2436 anCurrentAvailableAlgo = i;
2441 else if ( !isNone ){
2442 isAvailableChoiceAlgo = true;
2443 anCurrentAvailableAlgo = currentHyp( dim, Algo );
2445 //set new algorithm list and select the current algorithm
2446 myAvailableHypData[dim][Algo] = anAvailableAlgsData;
2447 myDlg->tab( dim )->setAvailableHyps( Algo, anAvailableAlgs );
2448 if ( isAvailableChoiceAlgo )
2449 setCurrentHyp( dim, Algo, anCurrentAvailableAlgo );
2451 int aMaxShapeDim = ( myMaxShapeDim == -1 ) ? SMESH::DIM_3D : myMaxShapeDim;
2452 for ( int i = SMESH::DIM_0D; i <= aMaxShapeDim; i++ ) {
2453 myDlg->enableTab( i );
2455 myDlg->setCurrentTab( theTabIndex );
2456 myDlg->setHypoSets( SMESH::GetHypothesesSets( aMaxShapeDim, "" ) );
2459 case MT_TRIANGULAR:{
2460 aDim = SMESH::DIM_2D;
2461 anCompareType = "TRIA";
2464 case MT_QUADRILATERAL:{
2465 aDim = SMESH::DIM_2D;
2466 anCompareType = "QUAD";
2469 case MT_TETRAHEDRAL:{
2470 aDim = SMESH::DIM_3D;
2471 anCompareType = "TETRA";
2474 case MT_HEXAHEDRAL:{
2475 aDim = SMESH::DIM_3D;
2476 anCompareType = "HEXA";
2481 if ( anCompareType != "ANY" )
2483 QString anCurrentAlgo;
2484 bool isReqDisBound = true;
2485 isNone = currentHyp( aDim, Algo ) < 0;
2486 // retrieves a list of available algorithms from resources
2487 availableHyps( aDim, Algo, anAvailableAlgs, anAvailableAlgsData );
2488 // finding algorithm which is selected
2489 if ( !isNone && !myAvailableHypData[aDim][Algo].empty() &&
2490 myAvailableHypData[aDim][Algo].count() != anAvailableAlgsData.count() ){
2491 anCurrentAlgo = myAvailableHypData[aDim][Algo].at( currentHyp( aDim, Algo ) )->Label;
2492 isReqDisBound = myAvailableHypData[aDim][Algo].at( currentHyp( aDim, Algo ) )->InputTypes.isEmpty();
2494 else if ( !isNone ){
2495 anCurrentAlgo = anAvailableAlgsData.at( currentHyp( aDim, Algo ) )->Label;
2496 isReqDisBound = anAvailableAlgsData.at( currentHyp( aDim, Algo ) )->InputTypes.isEmpty();
2498 anAvailableAlgs.clear();
2499 myAvailableHypData[aDim][Algo].clear();
2500 // finding and adding algorithm depending on the type mesh
2501 for ( int i = 0 ; i < anAvailableAlgsData.count(); i++ )
2503 HypothesisData* algoIn = anAvailableAlgsData.at( i );
2504 bool isAvailableAlgo = ( algoIn->OutputTypes.count() == 0 );
2505 QStringList::const_iterator inElemType = algoIn->OutputTypes.begin();
2506 for ( ; inElemType != algoIn->OutputTypes.end(); inElemType++ )
2508 if ( *inElemType == anCompareType ){
2509 isAvailableAlgo = true;
2513 if ( isAvailableAlgo || algoIn->OutputTypes.count()==0 ){
2514 anAvailableAlgs.append( algoIn->Label );
2515 myAvailableHypData[aDim][Algo].append( algoIn );
2517 //algorithm will be active, if the chosen algorithm available in the current mesh type
2518 if ( !isNone && isAvailableAlgo && algoIn->Label == anCurrentAlgo ){
2519 isAvailableChoiceAlgo = true;
2520 anCurrentAvailableAlgo = anAvailableAlgs.count() - 1 ;
2523 //set new algorithm list and select the current algorithm
2524 myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailableAlgs );
2525 if ( isAvailableChoiceAlgo )
2526 setCurrentHyp( aDim, Algo, anCurrentAvailableAlgo );
2527 int aMaxShapeDim = ( myMaxShapeDim == -1 ) ? SMESH::DIM_3D : myMaxShapeDim;
2528 if ( isNone || isReqDisBound || !isAvailableChoiceAlgo ) {
2529 for ( int i = SMESH::DIM_0D; i <= aMaxShapeDim; i++ ) {
2531 myDlg->disableTab( i );
2532 setCurrentHyp(i, Algo, -1);
2536 else if ( !isNone ){
2537 if ( aDim == SMESH::DIM_2D){
2538 myDlg->disableTab( SMESH::DIM_3D );
2539 setCurrentHyp( SMESH::DIM_3D, Algo, -1);
2541 for ( int i = aMaxShapeDim; i > SMESH::DIM_0D; i-- )
2543 isReqDisBound = ( currentHyp( i, Algo ) < 0 ) ? true : myAvailableHypData[i][Algo].at( currentHyp( i, Algo ) )->InputTypes.isEmpty();
2544 if ( aMaxShapeDim != i && isReqDisBound) {
2545 for (int j = i - 1; j >= SMESH::DIM_0D; j--){
2546 myDlg->disableTab( j );
2547 setCurrentHyp( j , Algo, -1 );
2553 myDlg->setHypoSets( SMESH::GetHypothesesSets( aDim, anCompareType ) );
2554 myDlg->enableTab( aDim );
2555 myDlg->setCurrentTab( aDim );