1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 // File : SMESHGUI.cxx
23 // Author : Nicolas REJNERI
28 #include "SMESHGUI_InitMeshDlg.h"
29 #include "SMESHGUI_AddSubMeshDlg.h"
30 #include "SMESHGUI_NodesDlg.h"
31 #include "SMESHGUI_TransparencyDlg.h"
32 #include "SMESHGUI_ClippingDlg.h"
33 #include "SMESHGUI_GroupDlg.h"
34 #include "SMESHGUI_RemoveNodesDlg.h"
35 #include "SMESHGUI_RemoveElementsDlg.h"
36 #include "SMESHGUI_MeshInfosDlg.h"
37 #include "SMESHGUI_StandardMeshInfosDlg.h"
38 #include "SMESHGUI_Preferences_ColorDlg.h"
39 #include "SMESHGUI_Preferences_ScalarBarDlg.h"
40 #include "SMESHGUI_Preferences_SelectionDlg.h"
41 #include "SMESHGUI_Hypotheses.h"
42 #include "SMESHGUI_HypothesesUtils.h"
43 #include "SMESHGUI_MoveNodesDlg.h"
44 #include "SMESHGUI_AddMeshElementDlg.h"
45 #include "SMESHGUI_EditHypothesesDlg.h"
46 #include "SMESHGUI_CreateHypothesesDlg.h"
47 #include "SMESHGUI_FilterDlg.h"
48 #include "SMESHGUI_FilterLibraryDlg.h"
49 #include "SMESHGUI_SingleEditDlg.h"
50 #include "SMESHGUI_MultiEditDlg.h"
51 #include "SMESHGUI_GroupOpDlg.h"
52 #include "SMESHGUI_DeleteGroupDlg.h"
53 #include "SMESHGUI_SmoothingDlg.h"
54 #include "SMESHGUI_RenumberingDlg.h"
55 #include "SMESHGUI_ExtrusionDlg.h"
56 #include "SMESHGUI_RevolutionDlg.h"
57 #include "SMESHGUI_TranslationDlg.h"
58 #include "SMESHGUI_RotationDlg.h"
59 #include "SMESHGUI_SymmetryDlg.h"
60 #include "SMESHGUI_SewingDlg.h"
61 #include "SMESHGUI_MergeNodesDlg.h"
62 #include "SMESHGUI_MeshPatternDlg.h"
63 #include "SMESHGUI_PrecisionDlg.h"
65 #include "VTKViewer_ViewFrame.h"
66 #include "VTKViewer_InteractorStyleSALOME.h"
67 #include "VTKViewer_RenderWindowInteractor.h"
69 #include "SMESH_Actor.h"
70 #include "SMESH_Object.h"
73 #include "QAD_Tools.h"
74 #include "QAD_Config.h"
75 #include "QAD_Settings.h"
76 #include "QAD_RightFrame.h"
77 #include "QAD_MessageBox.h"
78 #include "QAD_Resource.h"
79 #include "QAD_FileDlg.h"
80 #include "QAD_Desktop.h"
81 #include "QAD_ResourceMgr.h"
82 #include "QAD_WaitCursor.h"
84 #include "SALOME_NamingService.hxx"
85 #include "SALOME_ListIteratorOfListIO.hxx"
86 #include "SALOME_InteractiveObject.hxx"
88 #include "SALOMEGUI_Desktop.h"
89 #include "SALOMEGUI_NameDlg.h"
90 #include "SALOMEGUI_ImportOperation.h"
91 #include "SALOMEGUI_QtCatchCorbaException.hxx"
93 #include "SMESHGUI_Utils.h"
94 #include "SMESHGUI_SMESHGenUtils.h"
95 #include "SMESHGUI_GEOMGenUtils.h"
96 #include "SMESHGUI_MeshUtils.h"
97 #include "SMESHGUI_GroupUtils.h"
98 #include "SMESHGUI_FilterUtils.h"
99 #include "SMESHGUI_PatternUtils.h"
100 #include "SMESHGUI_VTKUtils.h"
102 #include "SALOMEconfig.h"
103 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
106 #define INCLUDE_MENUITEM_DEF
107 #include <qapplication.h>
108 #include <qlineedit.h>
109 #include <qmenudata.h>
110 #include <qmenubar.h>
111 #include <qpopupmenu.h>
114 #include <qpainter.h>
115 #include <qcheckbox.h>
116 #include <qcolordialog.h>
117 #include <qspinbox.h>
121 #include <qradiobutton.h>
123 #include <boost/shared_ptr.hpp>
125 #include <vtkRenderer.h>
126 #include <vtkRenderWindow.h>
127 #include <vtkActorCollection.h>
128 #include <vtkScalarBarActor.h>
130 #include "utilities.h"
136 //=============================================================
137 void ImportMeshesFromFile(QAD_Desktop * parent,
138 SMESH::SMESH_Gen_ptr theComponentMesh,
141 void ExportMeshToFile(QAD_Desktop * parent, int theCommandID);
143 void SetDisplayMode(int theCommandID);
145 void SetDisplayEntity(int theCommandID);
147 void Control( int theCommandID );
149 void SetDisplaySettings();
153 //=============================================================
154 void ImportMeshesFromFile(QAD_Desktop * parent,
155 SMESH::SMESH_Gen_ptr theComponentMesh,
161 if(theCommandID == 113){
162 filter.append(QObject::tr("MED files (*.med)"));
163 filter.append(QObject::tr("All files (*)"));
164 }else if (theCommandID == 112){
165 filter.append(QObject::tr("IDEAS files (*.unv)"));
166 }else if (theCommandID == 111){
167 filter.append(QObject::tr("DAT files (*.dat)"));
169 QString filename = QAD_FileDlg::getFileName(parent,
172 QObject::tr("Import mesh"),
174 if(!filename.isEmpty()) {
176 SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
179 SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
180 switch ( theCommandID ) {
183 aMeshes->length( 1 );
184 aMeshes[0] = theComponentMesh->CreateMeshesFromUNV(filename.latin1());
189 SMESH::DriverMED_ReadStatus res;
190 aMeshes = theComponentMesh->CreateMeshesFromMED(filename.latin1(),res);
191 if ( res != SMESH::DRS_OK ) {
193 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
194 QObject::tr("SMESH_WRN_WARNING"),
195 QObject::tr(QString("SMESH_DRS_%1").arg(res)),
196 QObject::tr("SMESH_BUT_OK"));
197 aMeshes->length( 0 );
204 bool isEmpty = false;
205 for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) {
206 SALOMEDS::SObject_var aMeshSO = SMESH::FindSObject( aMeshes[i] );
207 if ( !aMeshSO->_is_nil() ) {
208 SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
209 SALOMEDS::AttributePixMap_var aPixmap = SALOMEDS::AttributePixMap::_narrow( aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" ) );
210 aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_IMPORTED");
211 if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
212 SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
219 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
220 QObject::tr("SMESH_WRN_WARNING"),
221 QObject::tr("SMESH_DRS_EMPTY"),
222 QObject::tr("SMESH_BUT_OK"));
226 catch (const SALOME::SALOME_Exception& S_ex){
228 QtCatchCorbaException(S_ex);
235 void ExportMeshToFile(QAD_Desktop * parent, int theCommandID)
237 SALOME_Selection *aSel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
238 if(aSel->IObjectCount()){
239 Handle(SALOME_InteractiveObject) anIObject = aSel->firstIObject();
240 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
241 if ( !aMesh->_is_nil() ) {
242 QString aFilter, aTitle = QObject::tr("Export mesh");
243 QMap<QString, SMESH::MED_VERSION> aFilterMap;
244 switch ( theCommandID ) {
246 aFilterMap.insert( QObject::tr("MED 2.1 (*.med)"), SMESH::MED_V2_1 );
247 aFilterMap.insert( QObject::tr("MED 2.2 (*.med)"), SMESH::MED_V2_2 );
250 aFilter = QObject::tr("DAT files (*.dat)");
253 if(aMesh->NbPyramids()){
254 int aRet = QAD_MessageBox::warn2(QAD_Application::getDesktop(),
255 QObject::tr("SMESH_WRN_WARNING"),
256 QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
257 QObject::tr("SMESH_BUT_YES"),
258 QObject::tr("SMESH_BUT_NO"),
263 aFilter = QObject::tr("IDEAS files (*.unv)");
270 SMESH::MED_VERSION aFormat;
272 if ( theCommandID != 122)
273 aFilename = QAD_FileDlg::getFileName(parent, "", aFilter, aTitle, false);
277 for ( QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin(); it != aFilterMap.end(); ++it )
278 filters.push_back( it.key() );
280 QAD_FileDlg* fd = new QAD_FileDlg( parent, false, true, true );
281 fd->setCaption( aTitle );
282 fd->setFilters( filters );
284 aFilename = fd->selectedFile();
285 aFormat = aFilterMap[fd->selectedFilter()];
288 if ( !aFilename.isEmpty() ) {
289 // Check whether the file already exists and delete it if yes
290 QFile aFile( aFilename );
291 if ( aFile.exists() )
294 switch ( theCommandID ) {
296 aMesh->ExportToMED( aFilename.latin1(), false, aFormat ); // currently, automatic groups are never created
299 aMesh->ExportDAT( aFilename.latin1() );
302 aMesh->ExportUNV( aFilename.latin1() );
312 inline void InverseEntityMode(unsigned int& theOutputMode,
313 unsigned int theMode)
315 bool anIsNotPresent = ~theOutputMode & theMode;
317 theOutputMode |= theMode;
319 theOutputMode &= ~theMode;
322 void SetDisplayEntity(int theCommandID){
323 SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
324 if(Sel->IObjectCount() >= 1){
325 SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
326 for(; It.More(); It.Next()){
327 Handle(SALOME_InteractiveObject) IObject = It.Value();
328 if(IObject->hasEntry()){
329 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
330 unsigned int aMode = anActor->GetEntityMode();
331 switch(theCommandID){
333 InverseEntityMode(aMode,SMESH_Actor::eEdges);
336 InverseEntityMode(aMode,SMESH_Actor::eFaces);
339 InverseEntityMode(aMode,SMESH_Actor::eVolumes);
342 aMode = SMESH_Actor::eAllEntity;
346 anActor->SetEntityMode(aMode);
353 void SetDisplayMode(int theCommandID){
354 SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
355 if(Sel->IObjectCount() >= 1){
356 switch(theCommandID){
358 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
359 new SMESHGUI_ClippingDlg(QAD_Application::getDesktop(),"",false);
363 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
364 new SMESHGUI_TransparencyDlg(QAD_Application::getDesktop(),"",false);
367 SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
368 for(; It.More(); It.Next()){
369 Handle(SALOME_InteractiveObject) IObject = It.Value();
370 if(IObject->hasEntry()){
371 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
372 switch(theCommandID){
374 anActor->SetRepresentation(SMESH_Actor::eEdge);
377 anActor->SetRepresentation(SMESH_Actor::eSurface);
380 if(anActor->IsShrunk())
383 anActor->SetShrink();
386 anActor->SetRepresentation(SMESH_Actor::ePoint);
390 anActor->GetSufaceColor(color[0], color[1], color[2]);
391 int c0 = int (color[0] * 255);
392 int c1 = int (color[1] * 255);
393 int c2 = int (color[2] * 255);
394 QColor c(c0, c1, c2);
397 anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
398 c0 = int (edgecolor[0] * 255);
399 c1 = int (edgecolor[1] * 255);
400 c2 = int (edgecolor[2] * 255);
401 QColor e(c0, c1, c2);
403 float backfacecolor[3];
404 anActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
405 c0 = int (backfacecolor[0] * 255);
406 c1 = int (backfacecolor[1] * 255);
407 c2 = int (backfacecolor[2] * 255);
408 QColor b(c0, c1, c2);
411 anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
412 c0 = int (nodecolor[0] * 255);
413 c1 = int (nodecolor[1] * 255);
414 c2 = int (nodecolor[2] * 255);
415 QColor n(c0, c1, c2);
417 int Edgewidth = (int)anActor->GetLineWidth();
420 int intValue = int(anActor->GetNodeSize());
421 float Shrink = anActor->GetShrinkFactor();
423 SMESHGUI_Preferences_ColorDlg *aDlg =
424 new SMESHGUI_Preferences_ColorDlg(QAD_Application::getDesktop(),"");
425 aDlg->SetColor(1, c);
426 aDlg->SetColor(2, e);
427 aDlg->SetColor(3, n);
428 aDlg->SetColor(4, b);
429 aDlg->SetIntValue(1, Edgewidth);
430 aDlg->SetIntValue(2, intValue);
431 aDlg->SetIntValue(3, int(Shrink*100.));
433 QColor color = aDlg->GetColor(1);
434 QColor edgecolor = aDlg->GetColor(2);
435 QColor nodecolor = aDlg->GetColor(3);
436 QColor backfacecolor = aDlg->GetColor(4);
437 /* actor color and backface color */
438 anActor->SetSufaceColor(float (color.red()) / 255.,
439 float (color.green()) / 255.,
440 float (color.blue()) / 255.);
441 anActor->SetBackSufaceColor(float (backfacecolor.red()) / 255.,
442 float (backfacecolor.green()) / 255.,
443 float (backfacecolor.blue()) / 255.);
446 anActor->SetEdgeColor(float (edgecolor.red()) / 255.,
447 float (edgecolor.green()) / 255.,
448 float (edgecolor.blue()) / 255.);
450 /* Shrink factor and size edges */
451 anActor->SetShrinkFactor(aDlg->GetIntValue(3) / 100.);
452 anActor->SetLineWidth(aDlg->GetIntValue(1));
454 /* Nodes color and size */
455 anActor->SetNodeColor(float (nodecolor.red()) / 255.,
456 float (nodecolor.green()) / 255.,
457 float (nodecolor.blue()) / 255.);
458 anActor->SetNodeSize(aDlg->GetIntValue(2));
467 SMESH::RepaintCurrentView();
472 void SetDisplaySettings()
474 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
475 SMESHGUI_Preferences_ColorDlg *aDlg =
476 new SMESHGUI_Preferences_ColorDlg(QAD_Application::getDesktop(), "");
479 QString SCr, SCg, SCb;
480 SCr = QAD_CONFIG->getSetting("SMESH:SettingsFillColorRed");
481 SCg = QAD_CONFIG->getSetting("SMESH:SettingsFillColorGreen");
482 SCb = QAD_CONFIG->getSetting("SMESH:SettingsFillColorBlue");
483 if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
484 color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
485 else color = QColor(0, 170, 255);
486 aDlg->SetColor(1, color);
488 SCr = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorRed");
489 SCg = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorGreen");
490 SCb = QAD_CONFIG->getSetting("SMESH:SettingsOutlineColorBlue");
491 if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
492 color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
493 else color = QColor(0, 170, 255);
494 aDlg->SetColor(2, color);
496 SCr = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorRed");
497 SCg = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorGreen");
498 SCb = QAD_CONFIG->getSetting("SMESH:SettingsNodeColorBlue");
499 if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
500 color = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
501 else color = Qt::red;
502 aDlg->SetColor(3, color);
504 QString SBr = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorRed");
505 QString SBg = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorGreen");
506 QString SBb = QAD_CONFIG->getSetting("SMESH:SettingsBackFaceColorBlue");
507 if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
508 color = QColor(SBr.toInt(), SBg.toInt(), SBb.toInt());
509 else color = Qt::blue;
510 aDlg->SetColor(4, color);
512 QString intValue = QAD_CONFIG->getSetting("SMESH:SettingsWidth");
513 if (intValue.isEmpty()) intValue = "1";
514 aDlg->SetIntValue(1, intValue.toInt());
515 intValue = QAD_CONFIG->getSetting("SMESH:SettingsNodesSize");
516 if (intValue.isEmpty()) intValue = "3";
517 aDlg->SetIntValue(2, intValue.toInt());
518 intValue = QAD_CONFIG->getSetting("SMESH:SettingsShrinkCoeff");
519 if (intValue.isEmpty()) intValue = "75";
520 aDlg->SetIntValue(3, intValue.toInt());
523 QColor colorFill = aDlg->GetColor(1);
524 QAD_CONFIG->addSetting("SMESH:SettingsFillColorRed", colorFill.red());
525 QAD_CONFIG->addSetting("SMESH:SettingsFillColorGreen", colorFill.green());
526 QAD_CONFIG->addSetting("SMESH:SettingsFillColorBlue", colorFill.blue());
528 QColor colorOutline = aDlg->GetColor(2);
529 QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorRed", colorOutline.red());
530 QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorGreen", colorOutline.green());
531 QAD_CONFIG->addSetting("SMESH:SettingsOutlineColorBlue", colorOutline.blue());
533 QColor colorNode = aDlg->GetColor(3);
534 QAD_CONFIG->addSetting("SMESH:SettingsNodeColorRed", colorNode.red());
535 QAD_CONFIG->addSetting("SMESH:SettingsNodeColorGreen", colorNode.green());
536 QAD_CONFIG->addSetting("SMESH:SettingsNodeColorBlue", colorNode.blue());
538 QColor colorBackFace = aDlg->GetColor(4);
539 QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorRed", colorBackFace.red());
540 QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorGreen", colorBackFace.green());
541 QAD_CONFIG->addSetting("SMESH:SettingsBackFaceColorBlue", colorBackFace.blue());
543 int width = aDlg->GetIntValue(1);
544 QAD_CONFIG->addSetting("SMESH:SettingsWidth", width);
546 int nodes_size = aDlg->GetIntValue(2);
547 QAD_CONFIG->addSetting("SMESH:SettingsNodesSize", nodes_size);
549 int shrink_coeff = aDlg->GetIntValue(3);
550 QAD_CONFIG->addSetting("SMESH:SettingsShrinkCoeff", shrink_coeff);
557 void Control( int theCommandID )
559 SALOME_Selection *Sel = SALOME_Selection::Selection( SMESH::GetActiveStudy()->getSelection() );
561 Handle(SALOME_InteractiveObject) anIO = Sel->firstIObject();
564 SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
565 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())){
566 switch ( theCommandID ){
568 aTitle = QObject::tr( "LENGTH_EDGES" );
569 aControl = SMESH_Actor::eLength;
572 aTitle = QObject::tr( "LENGTH2D_EDGES" );
573 aControl = SMESH_Actor::eLength2D;
576 aTitle = QObject::tr( "FREE_EDGES" );
577 aControl = SMESH_Actor::eFreeEdges;
580 aTitle = QObject::tr( "FREE_BORDERS" );
581 aControl = SMESH_Actor::eFreeBorders;
584 aTitle = QObject::tr( "MULTI_BORDERS" );
585 aControl = SMESH_Actor::eMultiConnection;
588 aTitle = QObject::tr( "AREA_ELEMENTS" );
589 aControl = SMESH_Actor::eArea;
592 aTitle = QObject::tr( "TAPER_ELEMENTS" );
593 aControl = SMESH_Actor::eTaper;
596 aTitle = QObject::tr( "ASPECTRATIO_ELEMENTS" );
597 aControl = SMESH_Actor::eAspectRatio;
600 aTitle = QObject::tr( "ASPECTRATIO_3D_ELEMENTS" );
601 aControl = SMESH_Actor::eAspectRatio3D;
604 aTitle = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
605 aControl = SMESH_Actor::eMinimumAngle;
608 aTitle = QObject::tr( "WARP_ELEMENTS" );
609 aControl = SMESH_Actor::eWarping;
612 aTitle = QObject::tr( "SKEW_ELEMENTS" );
613 aControl = SMESH_Actor::eSkew;
616 anActor->SetControlMode(aControl);
617 anActor->GetScalarBarActor()->SetTitle(aTitle.latin1());
624 bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
625 MeshObjectType theType,
626 const QString theInTypeName,
627 QString & theOutTypeName)
629 SMESH_TypeFilter aTypeFilter( theType );
630 if ( aTypeFilter.IsOk( theIO )) {
631 theOutTypeName = theInTypeName;
638 QString CheckTypeObject(const Handle(SALOME_InteractiveObject) & theIO)
640 SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
641 SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(theIO->getEntry());
642 if (!aSObj->_is_nil()) {
643 SALOMEDS::SComponent_var aSComp = aSObj->GetFatherComponent();
644 CORBA::String_var anID = aSComp->GetID();
645 if (!strcmp(anID.in(),theIO->getEntry()))
651 CheckOIType ( theIO, HYPOTHESIS, "Hypothesis", aTypeName ) ||
652 CheckOIType ( theIO, ALGORITHM, "Algorithm", aTypeName ) ||
653 CheckOIType ( theIO, MESH, "Mesh", aTypeName ) ||
654 CheckOIType ( theIO, SUBMESH, "SubMesh", aTypeName ) ||
655 CheckOIType ( theIO, GROUP, "Group", aTypeName )
663 QString CheckHomogeneousSelection()
665 QAD_Study* aStudy = SMESH::GetActiveStudy();
666 SALOME_Selection *aSel = SALOME_Selection::Selection(aStudy->getSelection());
669 SALOME_ListIteratorOfListIO Itinit(aSel->StoredIObjects());
670 for (; Itinit.More(); Itinit.Next())
672 List.Append(Itinit.Value());
675 QString RefType = CheckTypeObject(aSel->firstIObject());
676 SALOME_ListIteratorOfListIO It(List);
677 for (; It.More(); It.Next())
679 Handle(SALOME_InteractiveObject) IObject = It.Value();
680 QString Type = CheckTypeObject(IObject);
681 if (Type.compare(RefType) != 0)
682 return "Heterogeneous Selection";
685 aSel->ClearIObjects();
686 SALOME_ListIteratorOfListIO It1(List);
687 for (; It1.More(); It1.Next())
689 int res = aSel->AddIObject(It1.Value());
691 aStudy->highlight(It1.Value(), false);
693 aStudy->highlight(It1.Value(), true);
700 // VSR 17/11/04: check if all objects selected belong to SMESH component --> start
701 QString aParentComponent = ((SALOMEGUI_Desktop*)QAD_Application::getDesktop())->getComponentFromSelection();
702 if ( aParentComponent != QAD_Application::getDesktop()->getActiveComponent() ) {
703 QAD_MessageBox::warn1 ( QAD_Application::getDesktop(),
704 QObject::tr("ERR_ERROR"),
705 QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg(QAD_Application::getDesktop()->getComponentUserName( "SMESH" )),
706 QObject::tr("BUT_OK") );
709 // VSR 17/11/04: check if all objects selected belong to SMESH component <-- finish
710 if (QAD_MessageBox::warn2
711 (QAD_Application::getDesktop(),
712 QObject::tr("SMESH_WRN_WARNING"),
713 QObject::tr("SMESH_REALLY_DELETE"),
714 QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"), 1, 0, 0) != 1)
717 QAD_Study* anActiveStudy = SMESH::GetActiveStudy();
718 int nbSf = anActiveStudy->getStudyFramesCount();
720 SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument();
721 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
722 SALOMEDS::GenericAttribute_var anAttr;
723 SALOMEDS::AttributeIOR_var anIOR;
725 SALOME_Selection *Sel = SALOME_Selection::Selection(anActiveStudy->getSelection());
726 SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
727 for(; It.More(); It.Next()){
728 Handle(SALOME_InteractiveObject) IObject = It.Value();
729 if(IObject->hasEntry()){
730 SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry());
732 /* Erase child graphical objects */
733 SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
734 for(; it->More(); it->Next()){
735 SALOMEDS::SObject_var CSO = it->Value();
736 if(CSO->FindAttribute(anAttr, "AttributeIOR")){
737 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
739 for(int i = 0; i < nbSf; i++){
740 QAD_StudyFrame *sf = anActiveStudy->getStudyFrame(i);
741 CORBA::String_var anEntry = CSO->GetID();
742 if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.in())){
743 SMESH::RemoveActor(sf,anActor);
749 /* Erase main graphical object */
750 for(int i = 0; i < nbSf; i++){
751 QAD_StudyFrame *sf = anActiveStudy->getStudyFrame(i);
752 if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,IObject->getEntry())){
753 SMESH::RemoveActor(sf,anActor);
757 // Remove object(s) from data structures
758 SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
760 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(obj->GetObject());
761 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(obj->GetObject());
763 if ( !aGroup->_is_nil() ) { // DELETE GROUP
764 SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh();
765 aMesh->RemoveGroup( aGroup );
767 else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH
768 SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
769 aMesh->RemoveSubMesh( aSubMesh );
771 else {// default action: remove SObject from the study
772 // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH
773 //QAD_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy);
775 aStudyBuilder->RemoveObjectWithChildren( obj );
780 } /* IObject->hasEntry() */
783 /* Clear any previous selection */
784 Sel->ClearIObjects();
785 anActiveStudy->updateObjBrowser();
791 //=============================================================================
795 //=============================================================================
796 class CustomItem : public QCustomMenuItem
799 CustomItem(const QString& s, const QFont& f) : myString(s), myFont(f) {}
802 void paint(QPainter* p, const QColorGroup& cg, bool act, bool /*enabled*/, int x, int y, int w, int h)
805 p->fillRect( x, y, w, h, act ? cg.highlight() : cg.mid() );
806 p->setPen( act ? cg.highlightedText() : cg.buttonText() );
807 p->setFont( myFont );
808 p->drawText( x, y, w, h, AlignHCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, myString );
814 return QFontMetrics( myFont ).size( AlignHCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, myString );
817 bool fullSpan() const
827 //=============================================================================
831 //=============================================================================
832 SMESHGUI::SMESHGUI( const QString& theName, QObject* theParent ) :
833 SALOMEGUI( theName, theParent )
835 myActiveDialogBox = 0 ;
838 SMESH::GetSMESHGen();
839 SMESH::GetFilterManager();
842 /* load resources for all available meshers */
843 SMESH::InitAvailableHypotheses();
846 //=============================================================================
850 //=============================================================================
851 SMESHGUI::~SMESHGUI()
853 SMESH::GetFilterManager()->Destroy();
856 //=============================================================================
860 //=============================================================================
861 SMESHGUI* SMESHGUI::GetSMESHGUI()
863 static SMESHGUI aSMESHGUI;
864 aSMESHGUI.myActiveStudy = SMESH::GetActiveStudy();
865 SMESH::GetSMESHGen()->SetCurrentStudy( SMESH::GetActiveStudyDocument() );
867 /* Automatic Update flag */
868 aSMESHGUI.myAutomaticUpdate = ( QAD_CONFIG->getSetting( "SMESH:AutomaticUpdate" ).compare( "true" ) == 0 );
875 Standard_EXPORT SALOMEGUI* GetComponentGUI() {
876 return SMESHGUI::GetSMESHGUI();
880 //=============================================================================
884 //=============================================================================
885 void SMESHGUI::SetState(int aState)
887 this->myState = aState;
891 //=============================================================================
895 //=============================================================================
896 void SMESHGUI::ResetState()
902 //=============================================================================
906 //=============================================================================
907 void SMESHGUI::EmitSignalDeactivateDialog()
909 emit this->SignalDeactivateActiveDialog();
913 //=============================================================================
917 //=============================================================================
918 void SMESHGUI::EmitSignalStudyFrameChanged()
920 emit this->SignalStudyFrameChanged();
924 //=============================================================================
928 //=============================================================================
929 void SMESHGUI::EmitSignalCloseAllDialogs()
931 emit SignalCloseAllDialogs();
935 //=============================================================================
939 //=============================================================================
940 QDialog *SMESHGUI::GetActiveDialogBox()
942 return this->myActiveDialogBox;
945 //=============================================================================
949 //=============================================================================
950 void SMESHGUI::SetActiveDialogBox(QDialog * aDlg)
952 this->myActiveDialogBox = (QDialog *) aDlg;
956 //=============================================================================
960 //=============================================================================
961 QAD_Study *SMESHGUI::GetActiveStudy()
963 return this->myActiveStudy;
966 //=============================================================================
970 //=============================================================================
971 QAD_Desktop *SMESHGUI::GetDesktop()
973 return QAD_Application::getDesktop();
976 //=============================================================================
980 //=============================================================================
981 bool SMESHGUI::ActiveStudyChanged(QAD_Desktop* parent)
983 MESSAGE("SMESHGUI::activeStudyChanged init.");
984 QAD_Study* prevStudy = myActiveStudy;
985 /* Create or retrieve an object SMESHGUI */
986 MESSAGE("Active study changed : prev study =" << prevStudy);
987 SMESHGUI::GetSMESHGUI();
988 EmitSignalStudyFrameChanged();
989 MESSAGE("Active study changed : active study =" << myActiveStudy);
990 if ( prevStudy != myActiveStudy ) {
991 EmitSignalCloseAllDialogs();
992 MESSAGE("Active study changed : SMESHGUI nullified" << endl);
994 SMESH::UpdateSelectionProp();
996 MESSAGE("SMESHGUI::activeStudyChanged done.");
1000 //=============================================================================
1004 //=============================================================================
1005 bool SMESHGUI::DefineDlgPosition(QWidget * aDlg, int &x, int &y)
1007 /* Here the position is on the bottom right corner - 10 */
1008 // aDlg->resize(QSize().expandedTo(aDlg->minimumSizeHint()));
1010 QAD_Desktop *PP = QAD_Application::getDesktop();
1011 x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10);
1012 y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10);
1016 //=============================================================================
1020 //=============================================================================
1021 static int isStudyLocked(const SALOMEDS::Study_var& theStudy){
1022 return theStudy->GetProperties()->IsLocked();
1025 static bool checkLock(const SALOMEDS::Study_var& theStudy) {
1026 if (isStudyLocked(theStudy)) {
1027 QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
1028 QObject::tr("WRN_WARNING"),
1029 QObject::tr("WRN_STUDY_LOCKED"),
1030 QObject::tr("BUT_OK") );
1036 //=======================================================================
1037 //function : CheckActiveStudyLocked
1039 //=======================================================================
1041 bool SMESHGUI::ActiveStudyLocked()
1043 SALOMEDS::Study_var aStudy = myActiveStudy->getStudyDocument();
1044 return checkLock( aStudy );
1047 //=============================================================================
1051 //=============================================================================
1052 bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
1054 SALOMEDS::Study_var aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
1056 switch (theCommandID) {
1058 if(checkLock(aStudy)) break;
1066 if(checkLock(aStudy)) break;
1067 ::ImportMeshesFromFile(parent,SMESH::GetSMESHGen(),theCommandID);
1071 case 122: // EXPORT MED
1075 ::ExportMeshToFile(parent, theCommandID);
1079 case 200: // SCALAR BAR
1081 SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
1082 if( Sel && Sel->IObjectCount() ) {
1083 Handle(SALOME_InteractiveObject) anIO = Sel->firstIObject();
1084 if( anIO->hasEntry() ) {
1085 if( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) {
1086 anActor->SetControlMode( SMESH_Actor::eNone );
1094 SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
1095 SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( parent, Sel );
1099 case 1134: // Clipping
1100 case 1133: // Tranparency
1101 case 1132: // Colors / Size
1108 ::SetDisplayMode(theCommandID);
1114 case 219: // Volumes
1115 case 220: // All Entity
1116 ::SetDisplayEntity(theCommandID);
1121 if(checkLock(aStudy)) break;
1122 SMESH::UpdateView();
1127 case 301: // DISPLAY
1128 case 302: // DISPLAY ONLY
1130 SMESH::EDisplaing anAction;
1131 switch(theCommandID){
1132 case 300: anAction = SMESH::eErase; break;
1133 case 301: anAction = SMESH::eDisplay; break;
1134 case 302: anAction = SMESH::eDisplayOnly; break;
1137 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1138 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1139 SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
1140 for (; It.More(); It.Next()) {
1141 Handle(SALOME_InteractiveObject) IOS = It.Value();
1142 if (IOS->hasEntry()) {
1143 SMESH::UpdateView(anAction,IOS->getEntry());
1147 Sel->ClearIObjects();
1153 if(checkLock(aStudy)) break;
1154 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1155 EmitSignalDeactivateDialog();
1156 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1157 new SMESHGUI_NodesDlg(parent, "", Sel);
1160 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1161 tr("SMESH_WRN_WARNING"),
1162 tr("SMESH_WRN_VIEWER_VTK"),
1163 tr("SMESH_BUT_OK"));
1168 case 2151: // FILTER
1170 if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
1172 EmitSignalDeactivateDialog();
1173 new SMESHGUI_FilterDlg( parent, SMESH::EDGE );
1178 case 406: // MOVE NODE
1180 if ( myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
1182 QAD_MessageBox::warn1( GetDesktop(), tr( "SMESH_WRN_WARNING" ),
1183 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1187 if(checkLock(aStudy)) break;
1188 SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
1189 new SMESHGUI_MoveNodesDlg( parent, Sel );
1193 case 701: // COMPUTE MESH
1195 if(checkLock(aStudy)) break;
1196 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1197 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1198 int nbSel = Sel->IObjectCount();
1203 SMESH::SMESH_Mesh_var aMesh;
1204 SMESH::SMESH_subMesh_var aSubMesh;
1205 Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
1206 if (IObject->hasEntry()){
1207 SALOMEDS::SObject_var aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
1208 GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj );
1209 if ( aShapeObject->_is_nil() ) {
1213 if(!aMeshSObj->_is_nil()) {
1214 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj);
1215 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj);
1217 if (!aMesh->_is_nil()){
1218 GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
1219 if (!refShapeObject->_is_nil()) {
1220 if(!SMESH::GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject)){
1221 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1222 tr("SMESH_WRN_WARNING"),
1223 tr("SMESH_WRN_MISSING_PARAMETERS"),
1224 tr("SMESH_BUT_OK"));
1228 if (SMESH::GetSMESHGen()->Compute(aMesh,refShapeObject))
1229 SMESH::ModifiedMesh(aMeshSObj,true);
1230 // TO Do : change icon of all submeshes
1232 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1233 tr("SMESH_WRN_WARNING"),
1234 tr("SMESH_WRN_COMPUTE_FAILED"),
1235 tr("SMESH_BUT_OK"));
1237 catch(const SALOME::SALOME_Exception & S_ex){
1238 QtCatchCorbaException(S_ex);
1241 }else if(!aSubMesh->_is_nil()){
1242 aMesh = aSubMesh->GetFather();
1243 GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
1244 if(!refShapeObject->_is_nil()){
1245 bool compute = SMESH::GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject);
1247 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1248 tr("SMESH_WRN_WARNING"),
1249 tr("SMESH_WRN_MISSING_PARAMETERS"),
1250 tr("SMESH_BUT_OK"));
1254 if ( SMESH::GetSMESHGen()->Compute(aMesh,refShapeObject) )
1255 SMESH::ModifiedMesh(aMeshSObj,true);
1256 // TO Do : change icon of all submeshes
1258 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1259 tr("SMESH_WRN_WARNING"),
1260 tr("SMESH_WRN_COMPUTE_FAILED"),
1261 tr("SMESH_BUT_OK"));
1262 }catch(const SALOME::SALOME_Exception & S_ex){
1263 QtCatchCorbaException(S_ex);
1269 CORBA::Long anId = aStudy->StudyId();
1270 TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry());
1271 if(myAutomaticUpdate && aVisualObj){
1272 aVisualObj->Update();
1273 SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
1275 anActor = SMESH::CreateActor(aStudy,IObject->getEntry());
1277 SMESH::DisplayActor(myActiveStudy->getActiveStudyFrame(),anActor); //apo
1283 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1284 tr("SMESH_WRN_WARNING"),
1285 tr("SMESH_WRN_VIEWER_VTK"),
1286 tr("SMESH_BUT_OK"));
1291 case 702: // ADD SUB MESH
1293 if(checkLock(aStudy)) break;
1294 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1295 EmitSignalDeactivateDialog();
1296 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1297 new SMESHGUI_AddSubMeshDlg(parent, "", Sel);
1300 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1301 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1302 tr("SMESH_BUT_OK"));
1307 case 703: // INIT MESH
1309 if(checkLock(aStudy)) break;
1310 EmitSignalDeactivateDialog();
1311 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1312 new SMESHGUI_InitMeshDlg(parent, "", Sel);
1316 case 704: // EDIT Hypothesis
1318 if(checkLock(aStudy)) break;
1319 EmitSignalDeactivateDialog();
1320 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1321 new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
1325 case 705: // EDIT Global Hypothesis
1327 if(checkLock(aStudy)) break;
1328 EmitSignalDeactivateDialog();
1329 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1330 new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
1334 case 706: // EDIT Local Hypothesis
1336 if(checkLock(aStudy)) break;
1337 EmitSignalDeactivateDialog();
1338 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1339 new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
1343 case 407: // DIAGONAL INVERSION
1344 case 408: // Delete diagonal
1346 if ( myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
1348 QAD_MessageBox::warn1( GetDesktop(), tr( "SMESH_WRN_WARNING" ),
1349 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1353 if ( checkLock( aStudy ) )
1356 SALOME_Selection *aSel =
1357 SALOME_Selection::Selection( myActiveStudy->getSelection() );
1358 /*Standard_Boolean aRes;
1359 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
1360 if ( aMesh->_is_nil() )
1362 QAD_MessageBox::warn1(GetDesktop(), tr( "SMESH_WRN_WARNING" ),
1363 tr( "SMESH_BAD_SELECTION" ), tr( "SMESH_BUT_OK" ) );
1367 EmitSignalDeactivateDialog();
1368 if ( theCommandID == 407 )
1369 new SMESHGUI_TrianglesInversionDlg( parent, aSel );
1371 new SMESHGUI_UnionOfTwoTrianglesDlg( parent, aSel );
1374 case 409: // Change orientation
1375 case 410: // Union of triangles
1376 case 411: // Cutting of quadrangles
1378 if ( myActiveStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK )
1380 QAD_MessageBox::warn1( GetDesktop(), tr( "SMESH_WRN_WARNING" ),
1381 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1385 if ( checkLock( aStudy ) )
1388 SALOME_Selection *aSel =
1389 SALOME_Selection::Selection( myActiveStudy->getSelection() );
1391 EmitSignalDeactivateDialog();
1392 SMESHGUI_MultiEditDlg* aDlg;
1393 if ( theCommandID == 409 )
1394 aDlg = new SMESHGUI_ChangeOrientationDlg( parent, aSel );
1395 else if ( theCommandID == 410 )
1396 aDlg = new SMESHGUI_UnionOfTrianglesDlg( parent, aSel );
1398 aDlg = new SMESHGUI_CuttingOfQuadsDlg( parent, aSel );
1401 DefineDlgPosition( aDlg, x, y );
1406 case 412: // Smoothing
1408 if(checkLock(aStudy)) break;
1409 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1410 EmitSignalDeactivateDialog();
1411 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1412 new SMESHGUI_SmoothingDlg(parent, "", Sel);
1415 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1416 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1417 tr("SMESH_BUT_OK"));
1421 case 413: // Extrusion
1423 if(checkLock(aStudy)) break;
1424 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1425 EmitSignalDeactivateDialog();
1426 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1427 new SMESHGUI_ExtrusionDlg(parent, "", Sel);
1430 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1431 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1432 tr("SMESH_BUT_OK"));
1436 case 414: // Revolution
1438 if(checkLock(aStudy)) break;
1439 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1440 EmitSignalDeactivateDialog();
1441 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1442 new SMESHGUI_RevolutionDlg(parent, "", Sel);
1445 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1446 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1447 tr("SMESH_BUT_OK"));
1451 case 415: // Pattern mapping
1453 if ( checkLock( aStudy ) )
1455 if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
1457 EmitSignalDeactivateDialog();
1458 SALOME_Selection *Sel = SALOME_Selection::Selection(
1459 myActiveStudy->getSelection() );
1460 new SMESHGUI_MeshPatternDlg( parent, Sel );
1463 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1464 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1465 tr("SMESH_BUT_OK"));
1469 case 801: // CREATE GROUP
1471 if(checkLock(aStudy)) break;
1472 EmitSignalDeactivateDialog();
1473 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
1474 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1475 int nbSel = Sel->IObjectCount();
1477 // check if mesh is selected
1478 aMesh = SMESH::GetMeshByIO(Sel->firstIObject());
1480 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg(parent, "", Sel, aMesh);
1485 case 802: // CONSTRUCT GROUP
1487 if(checkLock(aStudy)) break;
1488 EmitSignalDeactivateDialog();
1489 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1490 int nbSel = Sel->IObjectCount();
1492 // check if submesh is selected
1493 Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
1494 if (IObject->hasEntry()) {
1495 SALOMEDS::SObject_var aSObj = aStudy->FindObjectID(IObject->getEntry());
1496 if(!aSObj->_is_nil()) {
1497 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(aSObj->GetObject());
1498 if (!aSubMesh->_is_nil()) {
1500 SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
1501 // get submesh elements list by types
1502 SMESH::long_array_var aNodes = aSubMesh->GetElementsByType(SMESH::NODE);
1503 SMESH::long_array_var aEdges = aSubMesh->GetElementsByType(SMESH::EDGE);
1504 SMESH::long_array_var aFaces = aSubMesh->GetElementsByType(SMESH::FACE);
1505 SMESH::long_array_var aVolumes = aSubMesh->GetElementsByType(SMESH::VOLUME);
1506 // create group for each type o elements
1507 QString aName = IObject->getName();
1508 if (aNodes->length() > 0) {
1509 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::NODE, aName);
1510 aGroup->Add(aNodes.inout());
1512 if (aEdges->length() > 0) {
1513 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::EDGE, aName);
1514 aGroup->Add(aEdges.inout());
1516 if (aFaces->length() > 0) {
1517 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::FACE, aName);
1518 aGroup->Add(aFaces.inout());
1520 if (aVolumes->length() > 0) {
1521 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::VOLUME, aName);
1522 aGroup->Add(aVolumes.inout());
1524 myActiveStudy->updateObjBrowser(true);
1525 }catch(const SALOME::SALOME_Exception & S_ex){
1526 QtCatchCorbaException(S_ex);
1535 case 803: // EDIT GROUP
1537 if(checkLock(aStudy)) break;
1538 EmitSignalDeactivateDialog();
1539 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1540 SALOME_ListIO IOs; IOs = Sel->StoredIObjects(); // list copy
1541 SALOME_ListIteratorOfListIO It (IOs);
1542 int nbSelectedGroups = 0;
1543 for ( ; It.More(); It.Next() )
1545 SMESH::SMESH_Group_var aGroup =
1546 SMESH::IObjectToInterface<SMESH::SMESH_Group>(It.Value());
1547 if (!aGroup->_is_nil()) {
1549 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg(parent, "", Sel, aGroup);
1553 if (nbSelectedGroups == 0)
1555 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg(parent, "", Sel, SMESH::SMESH_Group::_nil());
1561 case 804: // Add elements to group
1563 if(checkLock(aStudy)) break;
1564 if (myState == 800) {
1565 SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
1566 if (aDlg) aDlg->onAdd();
1571 case 805: // Remove elements from group
1573 if(checkLock(aStudy)) break;
1574 if (myState == 800) {
1575 SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
1576 if (aDlg) aDlg->onRemove();
1581 case 810: // Union Groups
1582 case 811: // Intersect groups
1583 case 812: // Cut groups
1585 if ( checkLock( aStudy ) )
1588 EmitSignalDeactivateDialog();
1589 SALOME_Selection *Sel = SALOME_Selection::Selection(
1590 myActiveStudy->getSelection() );
1593 if ( theCommandID == 810 ) aMode = SMESHGUI_GroupOpDlg::UNION;
1594 else if ( theCommandID == 811 ) aMode = SMESHGUI_GroupOpDlg::INTERSECT;
1595 else aMode = SMESHGUI_GroupOpDlg::CUT;
1597 ( new SMESHGUI_GroupOpDlg( parent, Sel, aMode ) )->show();
1601 case 813: // Delete groups with their contents
1603 if ( checkLock( aStudy ) )
1606 EmitSignalDeactivateDialog();
1607 SALOME_Selection *Sel = SALOME_Selection::Selection(
1608 myActiveStudy->getSelection() );
1610 ( new SMESHGUI_DeleteGroupDlg( parent, Sel ) )->show();
1614 case 900: // MESH INFOS
1616 EmitSignalDeactivateDialog();
1617 SALOME_Selection *Sel =
1618 SALOME_Selection::Selection(myActiveStudy->getSelection());
1619 if ( Sel->IObjectCount() > 1 ) { // a dlg for each IO
1620 SALOME_ListIO IOs; IOs = Sel->StoredIObjects(); // list copy
1621 SALOME_ListIteratorOfListIO It (IOs);
1622 for ( ; It.More(); It.Next() ) {
1623 Sel->ClearIObjects();
1624 Sel->AddIObject( It.Value() );
1625 new SMESHGUI_MeshInfosDlg(parent, "", false);
1627 // restore selection
1628 Sel->ClearIObjects();
1629 for (It.Initialize( IOs ) ; It.More(); It.Next() )
1630 Sel->AddIObject( It.Value() );
1633 new SMESHGUI_MeshInfosDlg(parent, "", false);
1637 case 902: // STANDARD MESH INFOS
1639 EmitSignalDeactivateDialog();
1640 SALOME_Selection *Sel =
1641 SALOME_Selection::Selection(myActiveStudy->getSelection());
1642 if ( Sel->IObjectCount() > 1 ) { // a dlg for each IO
1643 SALOME_ListIO IOs; IOs = Sel->StoredIObjects(); // list copy
1644 SALOME_ListIteratorOfListIO It (IOs);
1645 for ( ; It.More(); It.Next() ) {
1646 Sel->ClearIObjects();
1647 Sel->AddIObject( It.Value() );
1648 new SMESHGUI_StandardMeshInfosDlg(parent, "", false);
1650 // restore selection
1651 Sel->ClearIObjects();
1652 for (It.Initialize( IOs ) ; It.More(); It.Next() )
1653 Sel->AddIObject( It.Value() );
1656 new SMESHGUI_StandardMeshInfosDlg(parent, "", false);
1660 case 1001: // AUTOMATIC UPDATE PREFERENCES
1662 parent->menuBar()->setItemChecked(1001, !parent->menuBar()->isItemChecked(1001));
1663 if (parent->menuBar()->isItemChecked(1001)) {
1664 QAD_CONFIG->addSetting("SMESH:AutomaticUpdate", "true");
1665 myAutomaticUpdate = true;
1668 QAD_CONFIG->addSetting("SMESH:AutomaticUpdate", "false");
1669 myAutomaticUpdate = false;
1674 case 1003: // MESH PREFERENCES
1676 ::SetDisplaySettings();
1682 SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( parent );
1688 ( new SMESHGUI_PrecisionDlg( parent ) )->exec();
1694 parent->menuBar()->setItemChecked(10071, !parent->menuBar()->isItemChecked(10071));
1695 if (parent->menuBar()->isItemChecked(10071)) {
1696 QAD_CONFIG->addSetting("SMESH:DispayEntity","true");
1699 QAD_CONFIG->addSetting("SMESH:DispayEntity","false");
1705 SMESHGUI_Preferences_SelectionDlg* aDlg =
1706 new SMESHGUI_Preferences_SelectionDlg(parent);
1709 QString SCr, SCg, SCb;
1710 SCr = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorRed");
1711 SCg = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorGreen");
1712 SCb = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectColorBlue");
1713 if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
1714 aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
1715 else aColor = Qt::cyan;
1716 aDlg->SetColor(1, aColor);
1718 SCr = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorRed");
1719 SCg = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorGreen");
1720 SCb = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectColorBlue");
1721 if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
1722 aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
1723 else aColor = Qt::yellow;
1724 aDlg->SetColor(2, aColor);
1726 SCr = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorRed");
1727 SCg = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorGreen");
1728 SCb = QAD_CONFIG->getSetting("SMESH:SettingsSelectColorBlue");
1729 if (!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty())
1730 aColor = QColor(SCr.toInt(), SCg.toInt(), SCb.toInt());
1731 else aColor = Qt::white;
1732 aDlg->SetColor(3, aColor);
1734 QString SW1 = QAD_CONFIG->getSetting("SMESH:SettingsPreSelectWidth");
1735 if (SW1.isEmpty()) SW1 = "5";
1736 aDlg->SetWidth(1, SW1.toInt());
1738 QString SW2 = QAD_CONFIG->getSetting("SMESH:SettingsItemSelectWidth");
1739 if (SW2.isEmpty()) SW2 = "5";
1740 aDlg->SetWidth(2, SW2.toInt());
1742 QString SP1 = QAD_CONFIG->getSetting("SMESH:SettingsNodeSelectTol");
1743 if (SP1.isEmpty()) SP1 = "0.025";
1744 aDlg->SetPrecision(1, SP1.toDouble());
1746 QString SP2 = QAD_CONFIG->getSetting("SMESH:SettingsElementsSelectTol");
1747 if (SP2.isEmpty()) SP2 = "0.001";
1748 aDlg->SetPrecision(2, SP2.toDouble());
1751 QColor aPreColor = aDlg->GetColor(1);
1752 QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorRed", aPreColor.red());
1753 QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorGreen", aPreColor.green());
1754 QAD_CONFIG->addSetting("SMESH:SettingsPreSelectColorBlue", aPreColor.blue());
1756 QColor aSelColor = aDlg->GetColor(2);
1757 QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorRed", aSelColor.red());
1758 QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorGreen", aSelColor.green());
1759 QAD_CONFIG->addSetting("SMESH:SettingsItemSelectColorBlue", aSelColor.blue());
1761 QColor aHiColor = aDlg->GetColor(3);
1762 QAD_CONFIG->addSetting("SMESH:SettingsSelectColorRed", aHiColor.red());
1763 QAD_CONFIG->addSetting("SMESH:SettingsSelectColorGreen", aHiColor.green());
1764 QAD_CONFIG->addSetting("SMESH:SettingsSelectColorBlue", aHiColor.blue());
1766 int aPreWidth = aDlg->GetWidth(1);
1767 QAD_CONFIG->addSetting("SMESH:SettingsPreSelectWidth", aPreWidth);
1768 int aSelWidth = aDlg->GetWidth(2);
1769 QAD_CONFIG->addSetting("SMESH:SettingsItemSelectWidth", aSelWidth);
1771 double aTolNodes = aDlg->GetPrecision(1);
1772 QAD_CONFIG->addSetting("SMESH:SettingsNodeSelectTol", aTolNodes);
1773 double aTolItems = aDlg->GetPrecision(2);
1774 QAD_CONFIG->addSetting("SMESH:SettingsElementsSelectTol", aTolItems);
1776 // update current study settings
1777 SMESH::UpdateSelectionProp();
1779 QAD_StudyFrame* studyFrame = myActiveStudy->getActiveStudyFrame();
1780 if (studyFrame->getTypeView() == VIEW_VTK) {
1781 VTKViewer_ViewFrame* aViewFrame = SMESH::GetVtkViewFrame(studyFrame);
1782 // update VTK viewer properties
1783 VTKViewer_RenderWindowInteractor* anInteractor = aViewFrame->getRWInteractor();
1785 anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
1786 aSelColor.blue()/255., aSelWidth);
1787 anInteractor->SetSelectionTolerance(aTolNodes, aTolItems);
1788 VTKViewer_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
1790 aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
1791 aPreColor.blue()/255., aPreWidth);
1794 vtkRenderer* aRenderer = aViewFrame->getRenderer();
1795 vtkActorCollection *aCollection = aRenderer->GetActors();
1796 aCollection->InitTraversal();
1797 while(vtkActor *anAct = aCollection->GetNextActor()){
1798 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
1799 anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
1800 aHiColor.blue()/255.);
1801 anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
1802 aPreColor.blue()/255.);
1811 case 1100: // EDIT HYPOTHESIS
1813 if(checkLock(aStudy)) break;
1814 SALOME_Selection *Sel =
1815 SALOME_Selection::Selection(myActiveStudy->getSelection());
1816 int nbSel = Sel->IObjectCount();
1819 SMESH::SMESH_Hypothesis_var Hyp = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(Sel->firstIObject());
1821 /* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */
1822 /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects */
1823 /* Warning : however by internal mechanism all subMeshes icons are changed ! */
1824 if ( !Hyp->_is_nil() )
1826 char* sName = Hyp->GetName();
1827 SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(sName);
1830 aCreator->EditHypothesis(Hyp);
1841 case 1101: // RENAME
1843 if ( checkLock( aStudy ) )
1846 SALOME_Selection *Sel =
1847 SALOME_Selection::Selection( myActiveStudy->getSelection() );
1849 SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
1850 for ( ; It.More(); It.Next() )
1852 Handle(SALOME_InteractiveObject) IObject = It.Value();
1853 SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
1854 SALOMEDS::GenericAttribute_var anAttr;
1855 SALOMEDS::AttributeName_var aName;
1856 if ( !obj->_is_nil() )
1858 if ( obj->FindAttribute(anAttr, "AttributeName") )
1860 aName = SALOMEDS::AttributeName::_narrow( anAttr );
1861 QString newName = QString(aName->Value());
1862 newName = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), newName );
1863 if ( !newName.isEmpty() )
1865 myActiveStudy->renameIObject( IObject, newName );
1867 // if current object is group update group's name
1868 SMESH::SMESH_GroupBase_var aGroup =
1869 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
1870 if (!aGroup->_is_nil() )
1871 aGroup->SetName( newName.latin1() );
1879 case 1102: // REMOVE HYPOTHESIS / ALGORITHMS
1881 if(checkLock(aStudy)) break;
1883 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1884 SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
1885 for (int i = 0; It.More(); It.Next(), i++) {
1886 Handle(SALOME_InteractiveObject) IObject = It.Value();
1887 SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
1889 Sel->ClearIObjects();
1890 myActiveStudy->updateObjBrowser(true);
1894 case 401: // GEOM::EDGE
1895 case 4021: // TRIANGLE
1900 if(checkLock(aStudy)) break;
1901 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1902 EmitSignalDeactivateDialog();
1903 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1904 SMDSAbs_ElementType type = SMDSAbs_Edge;
1906 switch (theCommandID) {
1907 case 4021: // TRIANGLE
1908 type = SMDSAbs_Face; nbNodes = 3; break;
1910 type = SMDSAbs_Face; nbNodes = 4; break;
1912 type = SMDSAbs_Volume; nbNodes = 4; break;
1914 type = SMDSAbs_Volume; nbNodes = 8; break;
1917 new SMESHGUI_AddMeshElementDlg(parent, "", Sel, type, nbNodes);
1920 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1921 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1922 tr("SMESH_BUT_OK"));
1927 case 4041: // REMOVES NODES
1929 if(checkLock(aStudy)) break;
1930 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1931 EmitSignalDeactivateDialog();
1932 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1933 new SMESHGUI_RemoveNodesDlg(parent, "", Sel);
1936 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1937 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1938 tr("SMESH_BUT_OK"));
1942 case 4042: // REMOVES ELEMENTS
1944 if(checkLock(aStudy)) break;
1945 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1946 EmitSignalDeactivateDialog();
1947 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1948 new SMESHGUI_RemoveElementsDlg(parent, "", Sel);
1952 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1953 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1954 tr("SMESH_BUT_OK"));
1958 case 4051: // RENUMBERING NODES
1960 if(checkLock(aStudy)) break;
1961 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1962 EmitSignalDeactivateDialog();
1963 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1964 new SMESHGUI_RenumberingDlg(parent, "", Sel, 0);
1968 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1969 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1970 tr("SMESH_BUT_OK"));
1974 case 4052: // RENUMBERING ELEMENTS
1976 if(checkLock(aStudy)) break;
1977 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1978 EmitSignalDeactivateDialog();
1979 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1980 new SMESHGUI_RenumberingDlg(parent, "", Sel, 1);
1984 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
1985 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1986 tr("SMESH_BUT_OK"));
1990 case 4061: // TRANSLATION
1992 if(checkLock(aStudy)) break;
1993 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
1994 EmitSignalDeactivateDialog();
1995 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
1996 new SMESHGUI_TranslationDlg(parent, "", Sel);
1999 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
2000 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2001 tr("SMESH_BUT_OK"));
2005 case 4062: // ROTATION
2007 if(checkLock(aStudy)) break;
2008 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
2009 EmitSignalDeactivateDialog();
2010 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
2011 new SMESHGUI_RotationDlg(parent, "", Sel);
2014 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
2015 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2016 tr("SMESH_BUT_OK"));
2020 case 4063: // SYMMETRY
2022 if(checkLock(aStudy)) break;
2023 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
2024 EmitSignalDeactivateDialog();
2025 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
2026 new SMESHGUI_SymmetryDlg(parent, "", Sel);
2029 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
2030 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2031 tr("SMESH_BUT_OK"));
2035 case 4064: // SEWING
2037 if(checkLock(aStudy)) break;
2038 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
2039 EmitSignalDeactivateDialog();
2040 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
2041 new SMESHGUI_SewingDlg(parent, "", Sel);
2044 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
2045 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2046 tr("SMESH_BUT_OK"));
2050 case 4065: // MERGE NODES
2052 if(checkLock(aStudy)) break;
2053 if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
2054 EmitSignalDeactivateDialog();
2055 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
2056 new SMESHGUI_MergeNodesDlg(parent, "", Sel);
2059 QAD_MessageBox::warn1(QAD_Application::getDesktop(),
2060 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2061 tr("SMESH_BUT_OK"));
2067 case 5000: // HYPOTHESIS
2069 if(checkLock(aStudy)) break;
2070 EmitSignalDeactivateDialog();
2071 new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, false);
2076 if(checkLock(aStudy)) break;
2077 EmitSignalDeactivateDialog();
2078 new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, true);
2082 case 5105: // Library of selection filters
2084 static QValueList<int> aTypes;
2085 if ( aTypes.isEmpty() )
2087 aTypes.append( SMESH::NODE );
2088 aTypes.append( SMESH::EDGE );
2089 aTypes.append( SMESH::FACE );
2090 aTypes.append( SMESH::VOLUME );
2092 new SMESHGUI_FilterLibraryDlg( parent, aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
2096 case 6017: // CONTROLS
2108 if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
2109 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
2110 if ( Sel->IObjectCount() == 1 && Sel->firstIObject()->hasEntry() ) {
2111 SALOMEDS::SObject_var SO = aStudy->FindObjectID( Sel->firstIObject()->getEntry() );
2112 if ( !SO->_is_nil() ) {
2113 CORBA::Object_var aObject = SO->GetObject();
2114 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
2115 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
2116 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
2117 if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
2118 ::Control( theCommandID );
2123 QAD_MessageBox::warn1(GetDesktop(),
2124 tr( "SMESH_WRN_WARNING" ),
2125 tr( "SMESH_BAD_SELECTION" ),
2126 tr( "SMESH_BUT_OK" ) );
2130 QAD_MessageBox::warn1(GetDesktop(),
2131 tr( "SMESH_WRN_WARNING" ),
2132 tr( "NOT_A_VTK_VIEWER" ),
2133 tr( "SMESH_BUT_OK" ) );
2138 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
2139 if (Sel->IObjectCount() == 1) {
2140 Handle(SALOME_InteractiveObject) anIObject = Sel->firstIObject();
2141 if(anIObject->hasEntry())
2142 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
2143 anActor->SetPointsLabeled( !anActor->GetPointsLabeled() );
2150 SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
2151 if (Sel->IObjectCount() == 1) {
2152 Handle(SALOME_InteractiveObject) anIObject = Sel->firstIObject();
2153 if(anIObject->hasEntry())
2154 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
2155 anActor->SetCellsLabeled( !anActor->GetCellsLabeled() );
2160 case 10001: // DISPLAY MODE PREFERENCE
2163 parent->menuBar()->setItemChecked(10001, true);
2164 parent->menuBar()->setItemChecked(10002, false);
2165 parent->menuBar()->setItemChecked(10004, false);
2166 parent->menuBar()->setItemEnabled(10003, true);
2167 QAD_CONFIG->addSetting("SMESH:DisplayMode", "Wireframe");
2172 parent->menuBar()->setItemChecked(10002, true);
2173 parent->menuBar()->setItemChecked(10001, false);
2174 parent->menuBar()->setItemChecked(10004, false);
2175 parent->menuBar()->setItemEnabled(10003, true);
2176 QAD_CONFIG->addSetting("SMESH:DisplayMode", "Shading");
2181 parent->menuBar()->setItemChecked(10003,!parent->menuBar()->isItemChecked(10003));
2182 QAD_CONFIG->addSetting("SMESH:Shrink", parent->menuBar()->isItemChecked(10003) ? "yes" : "no");
2187 parent->menuBar()->setItemChecked(10001, false);
2188 parent->menuBar()->setItemChecked(10004, true);
2189 parent->menuBar()->setItemChecked(10002, false);
2190 parent->menuBar()->setItemEnabled(10003, false);
2191 QAD_CONFIG->addSetting("SMESH:DisplayMode", "Nodes");
2197 myActiveStudy->updateObjBrowser(true);
2201 //=============================================================================
2205 //=============================================================================
2206 bool SMESHGUI::OnMousePress(QMouseEvent * pe, QAD_Desktop * parent,
2207 QAD_StudyFrame * studyFrame)
2212 //=============================================================================
2216 //=============================================================================
2217 bool SMESHGUI::OnMouseMove(QMouseEvent * pe, QAD_Desktop * parent,
2218 QAD_StudyFrame * studyFrame)
2223 //=============================================================================
2227 //=============================================================================
2228 bool SMESHGUI::OnKeyPress(QKeyEvent * pe, QAD_Desktop * parent,
2229 QAD_StudyFrame * studyFrame)
2234 //=============================================================================
2238 //=============================================================================
2239 bool SMESHGUI::SetSettings(QAD_Desktop * parent)
2241 MESSAGE("SMESHGUI::SetSettings.");
2242 SMESHGUI::GetSMESHGUI();
2245 QString DisplayMode = "Shading";
2246 if ( QAD_CONFIG->hasSetting("SMESH:DisplayMode") )
2247 DisplayMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
2249 QAD_CONFIG->addSetting("SMESH:DisplayMode", "Shading");
2251 bool Shrink = false;
2252 if ( QAD_CONFIG->hasSetting("SMESH:Shrink") )
2253 Shrink = QAD_CONFIG->getSetting("SMESH:Shrink") == "yes";
2255 if (DisplayMode == "Wireframe") {
2257 parent->menuBar()->setItemChecked(10004, false);
2258 parent->menuBar()->setItemChecked(10002, false);
2259 parent->menuBar()->setItemChecked(10001, true);
2260 parent->menuBar()->setItemEnabled(10003, true);
2262 else if (DisplayMode == "Nodes") {
2264 parent->menuBar()->setItemChecked(10004, true);
2265 parent->menuBar()->setItemChecked(10002, false);
2266 parent->menuBar()->setItemChecked(10001, false);
2267 parent->menuBar()->setItemEnabled(10003, false);
2270 // default is shading
2271 parent->menuBar()->setItemChecked(10004, false);
2272 parent->menuBar()->setItemChecked(10002, true);
2273 parent->menuBar()->setItemChecked(10001, false);
2274 parent->menuBar()->setItemEnabled(10003, true);
2276 parent->menuBar()->setItemChecked(10003, Shrink);
2278 /* Automatic Update */
2279 QString AutoUpdate = QAD_CONFIG->getSetting("SMESH:AutomaticUpdate");
2280 if (AutoUpdate.compare("true") == 0) {
2281 parent->menuBar()->setItemChecked(1001, true);
2282 myAutomaticUpdate = true;
2285 parent->menuBar()->setItemChecked(1001, false);
2286 myAutomaticUpdate = false;
2289 QString anIsDisplayEntity = QAD_CONFIG->getSetting("SMESH:DispayEntity");
2290 if(anIsDisplayEntity.compare("true") == 0)
2291 parent->menuBar()->setItemChecked(10071,true);
2293 parent->menuBar()->setItemChecked(10071,false);
2296 SMESH::UpdateSelectionProp();
2299 parent->menuBar()->setItemEnabled(111, false); // IMPORT DAT
2300 //parent->menuBar()->setItemEnabled(112, false); // IMPORT UNV
2305 //=============================================================================
2309 //=============================================================================
2310 void SMESHGUI::DefinePopup(QString & theContext, QString & theParent, QString & theObject)
2312 // NRI : Temporary added
2313 // if ( myStudy->GetProperties()->IsLocked() ) {
2314 // theObject = "NothingSelected";
2315 // theContext = "NothingSelected";
2319 SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
2320 int nbSel = Sel->IObjectCount();
2323 theObject = "NothingSelected";
2324 theContext = "NothingSelected";
2327 if ( myState == 800 && Sel->HasIndex( Sel->firstIObject() ) )
2328 theObject = "Elements";
2330 theObject = ::CheckTypeObject( Sel->firstIObject() );
2334 theObject = ::CheckHomogeneousSelection();
2339 //=============================================================================
2343 //=============================================================================
2344 bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
2345 const QString& theParent, const QString& theObject)
2347 // get active study frame
2348 QAD_StudyFrame* studyFrame = myActiveStudy->getActiveStudyFrame();
2350 // get parent component which selected object(s) belongs to
2351 QString parentComp = ( (SALOMEGUI_Desktop*)parent )->getComponentFromSelection();
2354 SALOME_Selection* Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
2355 int nbSel = Sel->IObjectCount();
2360 else if ( nbSel == 1 ) {
2361 if ( parentComp != parent->getActiveComponent() ) {
2362 // object not belongs to SMESH module - remove all commands except common Display/Erase...
2364 int id = popup->idAt( 0 );
2365 if ( id <= QAD_TopLabel_Popup_ID )
2366 popup->removeItemAt( 0 );
2372 // get selected interactive object
2373 Handle(SALOME_InteractiveObject) IObject = Sel->firstIObject();
2374 SALOMEDS::SObject_var SO = SMESH::GetActiveStudyDocument()->FindObjectID( IObject->getEntry() );
2375 // find popup menu's TopLabel item
2376 int topItem = popup->indexOf( QAD_TopLabel_Popup_ID );
2377 if ( topItem >= 0 ) {
2378 if ( theParent == "Viewer" ) {
2379 // set bold font for popup menu's TopLabel item (Viewer popup)
2380 QFont fnt = popup->font(); fnt.setBold( TRUE );
2381 popup->removeItem( QAD_TopLabel_Popup_ID );
2382 popup->insertItem( new CustomItem( QString( IObject->getName() ), fnt ), QAD_TopLabel_Popup_ID, topItem );
2384 else if ( theParent == "ObjectBrowser" ) {
2385 // remove popup menu's TopLabel item (Object Browser popup)
2386 popup->removeItem( QAD_TopLabel_Popup_ID );
2390 if ( theObject == "Hypothesis" || theObject == "Algorithm" ) {
2391 // remove Display/Erase commands
2392 popup->removeItem( QAD_Display_Popup_ID );
2393 popup->removeItem( QAD_DisplayOnly_Popup_ID );
2394 popup->removeItem( QAD_Erase_Popup_ID );
2395 // remove "Unassign ..." command if hyp/algo is not assigned
2396 if ( SO->_is_nil() || !IObject->hasReference()/* !IsReferencedObject( SO ) */)
2397 popup->removeItem( 1102 );
2399 else if ( theObject == "Mesh" || theObject == "SubMesh" || theObject == "Group" ) {
2401 GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( SO );
2402 if ( aShapeObject->_is_nil() ) {
2404 popup->removeItem( 701 ); // Compute
2405 popup->removeItem( 705 ); // Edit hypothesis
2406 popup->removeItem( 706 ); // ...
2408 SMESH::SMESH_GroupOnGeom_var aGeomGroup =
2409 SMESH::SMESH_GroupOnGeom::_narrow( SO->GetObject() );
2410 if ( !aGeomGroup->_is_nil() ) // group linked on geometry
2411 popup->removeItem( 803 ); // EDIT GROUP
2413 SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
2414 // if object has actor
2415 if ( anActor && studyFrame->getTypeView() == VIEW_VTK ) {
2416 VTKViewer_RenderWindowInteractor* myRenderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
2417 if ( myRenderInter->isVisible( IObject ) ) {
2418 popup->removeItem( QAD_Display_Popup_ID );
2419 popup->setItemChecked( 9010, anActor->GetPointsLabeled() ); // Numbering / Display Nodes #
2420 popup->setItemChecked( 9011, anActor->GetCellsLabeled() ); // Numbering / Display Elements #
2421 TVisualObjPtr aVisualObj = anActor->GetObject();
2422 int aNbEdges = aVisualObj->GetNbEntities(SMDSAbs_Edge);
2423 int aNbFaces = aVisualObj->GetNbEntities(SMDSAbs_Face);
2424 int aNbVolumes = aVisualObj->GetNbEntities(SMDSAbs_Volume);
2426 QMenuItem* mi = popup->findItem( 1131 );
2427 if ( mi && mi->popup() ) {
2428 int prType = anActor->GetRepresentation();
2429 // Display Mode / Wireframe
2430 if(aNbVolumes == 0 && aNbFaces == 0 && aNbEdges == 0){
2431 mi->popup()->removeItem( 211 );
2433 mi->popup()->setItemChecked( 211, prType == SMESH_Actor::eEdge );
2435 // Display Mode / Shading
2436 if(aNbFaces == 0 && aNbVolumes == 0){
2437 mi->popup()->removeItem( 212 );
2439 mi->popup()->setItemChecked( 212, prType == SMESH_Actor::eSurface );
2441 // Display Mode / Points
2442 mi->popup()->setItemChecked( 215, prType == SMESH_Actor::ePoint );
2443 // Display Mode / Shrink
2444 bool isShrunk = anActor->IsShrunk();
2445 bool isShrunkable = anActor->IsShrunkable();
2446 mi->popup()->setItemChecked( 213, isShrunk );
2447 mi->popup()->setItemEnabled( 213, prType != SMESH_Actor::ePoint && isShrunkable);
2451 mi = popup->findItem( 1135 );
2452 if ( mi && mi->popup() ) {
2453 QPopupMenu* aPopup = mi->popup();
2454 unsigned int aMode = anActor->GetEntityMode();
2457 aPopup->removeItem( 219 );
2459 aPopup->setItemChecked( 219, aMode & SMESH_Actor::eVolumes );
2462 aPopup->removeItem( 218 );
2464 aPopup->setItemChecked( 218, aMode & SMESH_Actor::eFaces );
2468 aPopup->removeItem( 217 );
2470 aPopup->setItemChecked( 217, aMode & SMESH_Actor::eEdges );
2473 bool aIsRemove = (aNbVolumes == 0 || aMode & SMESH_Actor::eVolumes);
2474 aIsRemove &= (aNbFaces == 0 || aMode & SMESH_Actor::eFaces);
2475 aIsRemove &= (aNbEdges == 0 || aMode & SMESH_Actor::eEdges);
2478 aPopup->removeItem( 220 );
2482 mi = popup->findItem( 2000 );
2483 if ( mi && mi->popup() ) {
2484 SMESH_Actor::eControl cMode = anActor->GetControlMode();
2486 case SMESH_Actor::eLength:
2487 mi->popup()->setItemChecked( 6001, true ); break;
2488 case SMESH_Actor::eLength2D:
2489 mi->popup()->setItemChecked( 6018, true ); break;
2490 case SMESH_Actor::eFreeEdges:
2491 mi->popup()->setItemChecked( 6002, true );
2492 mi->popup()->removeItem( 201 );
2494 case SMESH_Actor::eFreeBorders:
2495 mi->popup()->setItemChecked( 6003, true );
2496 mi->popup()->removeItem( 201 );
2498 case SMESH_Actor::eMultiConnection:
2499 mi->popup()->setItemChecked( 6004, true ); break;
2500 case SMESH_Actor::eArea:
2501 mi->popup()->setItemChecked( 6011, true ); break;
2502 case SMESH_Actor::eTaper:
2503 mi->popup()->setItemChecked( 6012, true ); break;
2504 case SMESH_Actor::eAspectRatio:
2505 mi->popup()->setItemChecked( 6013, true ); break;
2506 case SMESH_Actor::eAspectRatio3D:
2507 mi->popup()->setItemChecked( 6017, true ); break;
2508 case SMESH_Actor::eMinimumAngle:
2509 mi->popup()->setItemChecked( 6014, true ); break;
2510 case SMESH_Actor::eWarping:
2511 mi->popup()->setItemChecked( 6015, true ); break;
2512 case SMESH_Actor::eSkew:
2513 mi->popup()->setItemChecked( 6016, true ); break;
2514 case SMESH_Actor::eNone:
2516 mi->popup()->removeItem( 200 );
2517 mi->popup()->removeItem( 201 );
2520 TVisualObjPtr aVisualObj = anActor->GetObject();
2522 mi->popup()->removeItem( 6001 );
2523 mi->popup()->removeItem( 6003 );
2524 mi->popup()->removeItem( 6004 );
2527 mi->popup()->removeItem( 6018 );
2528 mi->popup()->removeItem( 6002 );
2529 mi->popup()->removeItem( 6011 );
2530 mi->popup()->removeItem( 6012 );
2531 mi->popup()->removeItem( 6013 );
2532 mi->popup()->removeItem( 6014 );
2533 mi->popup()->removeItem( 6015 );
2534 mi->popup()->removeItem( 6016 );
2536 if(aNbVolumes == 0){
2537 mi->popup()->removeItem( 6017 );
2539 if(aNbFaces == 0 && aNbEdges == 0 && aNbVolumes == 0)
2540 popup->removeItem( 2000 ); // Scalar Bar
2544 popup->removeItem( QAD_Erase_Popup_ID );
2545 popup->removeItem( 114 ); // Numbering popup menu
2546 popup->removeItem( 1131 ); // Display mode
2547 popup->removeItem( 1132 ); // Color / size
2548 popup->removeItem( 1133 ); // Transparency
2549 popup->removeItem( 1134 ); // Clipping
2550 popup->removeItem( 2000 ); // Scalar Bar
2554 // object doesn't have actor
2555 CORBA::Object_var anObject = SO->GetObject();
2556 bool bDisplay = false;
2557 if ( !CORBA::is_nil( anObject ) ) {
2558 SMESH::SMESH_Mesh_var aMeshObj = SMESH::SMESH_Mesh::_narrow( anObject );
2559 if ( !aMeshObj->_is_nil() && ( aMeshObj->NbNodes() > 0 || aMeshObj->NbFaces() > 0 || aMeshObj->NbVolumes() > 0 ) )
2561 SMESH::SMESH_subMesh_var aSubMeshObj = SMESH::SMESH_subMesh::_narrow( anObject );
2562 if ( !aSubMeshObj->_is_nil() && ( aSubMeshObj->GetNumberOfNodes(false) > 0 || aSubMeshObj->GetNumberOfElements() > 0 ) )
2564 SMESH::SMESH_GroupBase_var aGroupObj = SMESH::SMESH_GroupBase::_narrow( anObject );
2565 if ( !aGroupObj->_is_nil() && aGroupObj->Size() > 0 )
2569 popup->removeItem( QAD_Display_Popup_ID );
2570 popup->removeItem( QAD_DisplayOnly_Popup_ID );
2572 popup->removeItem( QAD_Erase_Popup_ID );
2573 popup->removeItem( 114 ); // Numbering popup menu
2574 popup->removeItem( 1131 ); // Display mode
2575 popup->removeItem( 1132 ); // Color / size
2576 popup->removeItem( 1133 ); // Transparency
2577 popup->removeItem( 1134 ); // Clipping
2578 popup->removeItem( 2000 ); // Scalar Bar
2581 else if( theObject!="Component" ) {
2582 // another SMESH object
2583 popup->removeItem( QAD_Display_Popup_ID );
2584 popup->removeItem( QAD_DisplayOnly_Popup_ID );
2585 popup->removeItem( QAD_Erase_Popup_ID );
2590 // multiple selection
2591 if ( parentComp != parent->getActiveComponent() ) {
2592 // object not belongs to SMESH module - remove all commands except common Display/Erase...
2594 int id = popup->idAt( 0 );
2595 if ( id <= QAD_TopLabel_Popup_ID )
2596 popup->removeItemAt( 0 );
2600 if ( parentComp.isNull() ) {
2601 // objects from different components are selected
2602 popup->removeItem( QAD_DisplayOnly_Popup_ID );
2603 popup->removeItem( QAD_Display_Popup_ID );
2604 popup->removeItem( QAD_Erase_Popup_ID );
2608 QString type = ::CheckHomogeneousSelection();
2609 if ( type != "Heterogeneous Selection" ) {
2610 int topItem = popup->indexOf( QAD_TopLabel_Popup_ID );
2611 if ( topItem >= 0 ) {
2612 // set bold font for popup menu's TopLabel item
2613 QFont fnt = popup->font(); fnt.setBold( TRUE );
2614 popup->removeItem( QAD_TopLabel_Popup_ID );
2615 popup->insertItem( new CustomItem( QString("%1 ").arg( nbSel ) + type + "(s) ", fnt ), QAD_TopLabel_Popup_ID, topItem );
2623 //=============================================================================
2624 /*! Method: BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
2625 * Purpose: ensures that the actor for the given <theIO> exists in the active VTK view
2627 //=============================================================================
2628 void SMESHGUI::BuildPresentation( const Handle(SALOME_InteractiveObject) & theIO,
2631 if(theIO->hasEntry()){
2632 QAD_Study* aStudy = SMESHGUI::GetSMESHGUI()->GetActiveStudy();
2633 QAD_StudyFrame *aStudyFrame = aStudy->getActiveStudyFrame();
2634 SMESH::UpdateView(aStudyFrame,SMESH::eDisplay,theIO->getEntry());
2638 void SMESHGUI::SupportedViewType(int *buffer, int bufferSize)
2640 if (!buffer || !bufferSize)
2642 buffer[0] = (int)VIEW_VTK;
2645 void SMESHGUI::Deactivate()
2647 if ( SMESHGUI::GetSMESHGUI() ) {
2648 SMESHGUI::GetSMESHGUI()->EmitSignalCloseAllDialogs();