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_ExtrusionAlongPathDlg.h"
57 #include "SMESHGUI_RevolutionDlg.h"
58 #include "SMESHGUI_TranslationDlg.h"
59 #include "SMESHGUI_RotationDlg.h"
60 #include "SMESHGUI_SymmetryDlg.h"
61 #include "SMESHGUI_SewingDlg.h"
62 #include "SMESHGUI_MergeNodesDlg.h"
63 #include "SMESHGUI_MeshPatternDlg.h"
64 #include "SMESHGUI_PrecisionDlg.h"
65 #include "SMESHGUI_Selection.h"
66 #include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
68 #include <SVTK_InteractorStyle.h>
69 #include <SVTK_RenderWindowInteractor.h>
71 #include "SMESH_Actor.h"
72 #include "SMESH_Object.h"
73 #include "SMESH_TypeFilter.hxx"
75 #include "SUIT_Tools.h"
76 #include "SUIT_MessageBox.h"
77 #include "SUIT_ResourceMgr.h"
78 #include "SUIT_FileDlg.h"
79 #include "SUIT_Desktop.h"
80 #include "SUIT_ResourceMgr.h"
81 #include "SUIT_OverrideCursor.h"
82 #include "SUIT_Study.h"
83 #include "SUIT_Session.h"
85 #include "SALOME_NamingService.hxx"
86 #include "SALOME_ListIteratorOfListIO.hxx"
87 #include "SALOME_InteractiveObject.hxx"
88 #include "SALOME_ListIO.hxx"
89 #include <SALOME_LifeCycleCORBA.hxx>
91 #include "OB_Browser.h"
93 #include "QtxPopupMgr.h"
95 #include "SalomeApp_Tools.h"
96 #include "SalomeApp_Study.h"
97 #include "SalomeApp_NameDlg.h"
98 #include "SalomeApp_DataOwner.h"
99 #include "SalomeApp_Application.h"
100 #include "SalomeApp_Preferences.h"
101 #include "SalomeApp_VTKSelector.h"
103 #include "SalomeApp_ImportOperation.h"
105 #include <SVTK_ViewWindow.h>
106 #include <SVTK_ViewModel.h>
108 #include <VTKViewer_ViewManager.h>
110 #include "SMESHGUI_Utils.h"
111 #include "SMESHGUI_GEOMGenUtils.h"
112 #include "SMESHGUI_MeshUtils.h"
113 #include "SMESHGUI_GroupUtils.h"
114 #include "SMESHGUI_FilterUtils.h"
115 #include "SMESHGUI_PatternUtils.h"
116 #include "SMESHGUI_VTKUtils.h"
118 #include "SALOMEconfig.h"
119 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
122 #define INCLUDE_MENUITEM_DEF
123 #include <qapplication.h>
124 #include <qlineedit.h>
125 #include <qmenudata.h>
126 #include <qmenubar.h>
127 #include <qpopupmenu.h>
130 #include <qpainter.h>
131 #include <qcheckbox.h>
132 #include <qcolordialog.h>
133 #include <qspinbox.h>
138 #include <qradiobutton.h>
140 #include <boost/shared_ptr.hpp>
142 #include <vtkRenderer.h>
143 #include <vtkRenderWindow.h>
144 #include <vtkActorCollection.h>
145 #include <vtkScalarBarActor.h>
146 #include <vtkUnstructuredGrid.h>
148 #include "utilities.h"
150 #include "SALOMEDS_Study.hxx"
151 #include "SALOMEDSClient_StudyBuilder.hxx"
152 #include "SALOMEDSClient_SComponent.hxx"
158 //=============================================================
159 void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
162 void ExportMeshToFile(int theCommandID);
164 void SetDisplayMode(int theCommandID);
166 void SetDisplayEntity(int theCommandID);
168 void Control( int theCommandID );
170 void SetDisplaySettings();
174 //=============================================================
175 void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
181 if(theCommandID == 113){
182 filter.append(QObject::tr("MED files (*.med)"));
183 filter.append(QObject::tr("All files (*)"));
184 }else if (theCommandID == 112){
185 filter.append(QObject::tr("IDEAS files (*.unv)"));
186 }else if (theCommandID == 111){
187 filter.append(QObject::tr("DAT files (*.dat)"));
189 QString filename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(),
192 QObject::tr("Import mesh"),
194 if(!filename.isEmpty()) {
195 SUIT_OverrideCursor wc;
196 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
199 SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
200 switch ( theCommandID ) {
203 aMeshes->length( 1 );
204 aMeshes[0] = theComponentMesh->CreateMeshesFromUNV(filename.latin1());
209 SMESH::DriverMED_ReadStatus res;
210 aMeshes = theComponentMesh->CreateMeshesFromMED(filename.latin1(),res);
211 if ( res != SMESH::DRS_OK ) {
213 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
214 QObject::tr("SMESH_WRN_WARNING"),
215 QObject::tr(QString("SMESH_DRS_%1").arg(res)),
216 QObject::tr("SMESH_BUT_OK"));
217 aMeshes->length( 0 );
224 bool isEmpty = false;
225 for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) {
226 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
228 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
229 _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
230 aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_IMPORTED");
231 if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
232 SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
239 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
240 QObject::tr("SMESH_WRN_WARNING"),
241 QObject::tr("SMESH_DRS_EMPTY"),
242 QObject::tr("SMESH_BUT_OK"));
246 SMESHGUI::GetSMESHGUI()->updateObjBrowser();
248 catch (const SALOME::SALOME_Exception& S_ex){
250 SalomeApp_Tools::QtCatchCorbaException(S_ex);
257 void ExportMeshToFile( int theCommandID )
259 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
260 SALOME_ListIO selected;
262 aSel->selectedObjects( selected );
264 if(selected.Extent()){
265 Handle(SALOME_InteractiveObject) anIObject = selected.First();
266 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
267 if ( !aMesh->_is_nil() ) {
268 QString aFilter, aTitle = QObject::tr("Export mesh");
269 QMap<QString, SMESH::MED_VERSION> aFilterMap;
270 switch ( theCommandID ) {
273 aFilterMap.insert( QObject::tr("MED 2.1 (*.med)"), SMESH::MED_V2_1 );
274 aFilterMap.insert( QObject::tr("MED 2.2 (*.med)"), SMESH::MED_V2_2 );
278 aFilter = QObject::tr("DAT files (*.dat)");
282 if(aMesh->NbPyramids()){
283 int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
284 QObject::tr("SMESH_WRN_WARNING"),
285 QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
286 QObject::tr("SMESH_BUT_YES"),
287 QObject::tr("SMESH_BUT_NO"),
292 aFilter = QObject::tr("IDEAS files (*.unv)");
299 SMESH::MED_VERSION aFormat;
301 if ( theCommandID != 122 && theCommandID != 125 )
302 aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), "", aFilter, aTitle, false);
306 for ( QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin(); it != aFilterMap.end(); ++it )
307 filters.push_back( it.key() );
309 SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
310 fd->setCaption( aTitle );
311 fd->setFilters( filters );
315 aFilename = fd->selectedFile();
316 aFormat = aFilterMap[fd->selectedFilter()];
318 if( !aFilename.isEmpty()
319 && (aMesh->NbPolygons()>0 or aMesh->NbPolyhedrons()>0)
320 && aFormat==SMESH::MED_V2_1){
321 int aRet = SUIT_MessageBox::warn2(SMESHGUI::desktop(),
322 QObject::tr("SMESH_WRN_WARNING"),
323 QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
324 QObject::tr("SMESH_BUT_YES"),
325 QObject::tr("SMESH_BUT_NO"),
334 if ( !aFilename.isEmpty() ) {
335 // Check whether the file already exists and delete it if yes
336 QFile aFile( aFilename );
337 if ( aFile.exists() )
339 SUIT_OverrideCursor wc;
340 switch ( theCommandID ) {
343 aMesh->ExportToMED( aFilename.latin1(), false, aFormat ); // currently, automatic groups are never created
347 aMesh->ExportDAT( aFilename.latin1() );
351 aMesh->ExportUNV( aFilename.latin1() );
361 inline void InverseEntityMode(unsigned int& theOutputMode,
362 unsigned int theMode)
364 bool anIsNotPresent = ~theOutputMode & theMode;
366 theOutputMode |= theMode;
368 theOutputMode &= ~theMode;
371 void SetDisplayEntity(int theCommandID){
372 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
373 SALOME_ListIO selected;
375 aSel->selectedObjects( selected );
377 if(selected.Extent() >= 1){
378 SALOME_ListIteratorOfListIO It( selected );
379 for(; It.More(); It.Next()){
380 Handle(SALOME_InteractiveObject) IObject = It.Value();
381 if(IObject->hasEntry()){
382 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
383 unsigned int aMode = anActor->GetEntityMode();
384 switch(theCommandID){
386 InverseEntityMode(aMode,SMESH_Actor::eEdges);
389 InverseEntityMode(aMode,SMESH_Actor::eFaces);
392 InverseEntityMode(aMode,SMESH_Actor::eVolumes);
395 aMode = SMESH_Actor::eAllEntity;
399 anActor->SetEntityMode(aMode);
406 void SetDisplayMode(int theCommandID){
407 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
408 SALOME_ListIO selected;
410 aSel->selectedObjects( selected );
412 if(selected.Extent() >= 1){
413 switch(theCommandID){
415 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
416 new SMESHGUI_ClippingDlg( SMESHGUI::GetSMESHGUI(), "", false );
420 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
421 new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI(), "", false );
424 SALOME_ListIteratorOfListIO It( selected );
425 for(; It.More(); It.Next()){
426 Handle(SALOME_InteractiveObject) IObject = It.Value();
427 if(IObject->hasEntry()){
428 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
429 switch(theCommandID){
431 anActor->SetRepresentation(SMESH_Actor::eEdge);
434 anActor->SetRepresentation(SMESH_Actor::eSurface);
437 if(anActor->IsShrunk())
440 anActor->SetShrink();
443 anActor->SetRepresentation(SMESH_Actor::ePoint);
447 anActor->GetSufaceColor(color[0], color[1], color[2]);
448 int c0 = int (color[0] * 255);
449 int c1 = int (color[1] * 255);
450 int c2 = int (color[2] * 255);
451 QColor c(c0, c1, c2);
454 anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
455 c0 = int (edgecolor[0] * 255);
456 c1 = int (edgecolor[1] * 255);
457 c2 = int (edgecolor[2] * 255);
458 QColor e(c0, c1, c2);
460 float backfacecolor[3];
461 anActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
462 c0 = int (backfacecolor[0] * 255);
463 c1 = int (backfacecolor[1] * 255);
464 c2 = int (backfacecolor[2] * 255);
465 QColor b(c0, c1, c2);
468 anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
469 c0 = int (nodecolor[0] * 255);
470 c1 = int (nodecolor[1] * 255);
471 c2 = int (nodecolor[2] * 255);
472 QColor n(c0, c1, c2);
474 int Edgewidth = (int)anActor->GetLineWidth();
477 int intValue = int(anActor->GetNodeSize());
478 float Shrink = anActor->GetShrinkFactor();
480 SMESHGUI_Preferences_ColorDlg *aDlg =
481 new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI(), "" );
482 aDlg->SetColor(1, c);
483 aDlg->SetColor(2, e);
484 aDlg->SetColor(3, n);
485 aDlg->SetColor(4, b);
486 aDlg->SetIntValue(1, Edgewidth);
487 aDlg->SetIntValue(2, intValue);
488 aDlg->SetIntValue(3, int(Shrink*100.));
490 QColor color = aDlg->GetColor(1);
491 QColor edgecolor = aDlg->GetColor(2);
492 QColor nodecolor = aDlg->GetColor(3);
493 QColor backfacecolor = aDlg->GetColor(4);
494 /* actor color and backface color */
495 anActor->SetSufaceColor(float (color.red()) / 255.,
496 float (color.green()) / 255.,
497 float (color.blue()) / 255.);
498 anActor->SetBackSufaceColor(float (backfacecolor.red()) / 255.,
499 float (backfacecolor.green()) / 255.,
500 float (backfacecolor.blue()) / 255.);
503 anActor->SetEdgeColor(float (edgecolor.red()) / 255.,
504 float (edgecolor.green()) / 255.,
505 float (edgecolor.blue()) / 255.);
507 /* Shrink factor and size edges */
508 anActor->SetShrinkFactor(aDlg->GetIntValue(3) / 100.);
509 anActor->SetLineWidth(aDlg->GetIntValue(1));
511 /* Nodes color and size */
512 anActor->SetNodeColor(float (nodecolor.red()) / 255.,
513 float (nodecolor.green()) / 255.,
514 float (nodecolor.blue()) / 255.);
515 anActor->SetNodeSize(aDlg->GetIntValue(2));
524 SMESH::RepaintCurrentView();
529 void SetDisplaySettings()
531 SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
535 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
536 SMESHGUI_Preferences_ColorDlg *aDlg =
537 new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI(), "" );
539 QColor color = mgr->colorValue( "SMESH", "fill_color", QColor(0, 170, 255) );
540 aDlg->SetColor(1, color);
542 color = mgr->colorValue( "SMESH", "outline_color", QColor(0, 170, 255) );
543 aDlg->SetColor(2, color);
545 color = mgr->colorValue( "SMESH", "node_color", Qt::red );
546 aDlg->SetColor(3, color);
548 color = mgr->colorValue( "SMESH", "backface_color", Qt::blue );
549 aDlg->SetColor(4, color);
551 int iVal = mgr->integerValue( "SMESH", "element_width", 1 );
552 aDlg->SetIntValue(1, iVal);
554 iVal = mgr->integerValue( "SMESH", "node_size", 3 );
555 aDlg->SetIntValue(2, iVal);
557 iVal = mgr->integerValue( "SMESH", "shrink_coeff", 75 );
558 aDlg->SetIntValue(3, iVal);
561 mgr->setValue( "SMESH", "fill_color", aDlg->GetColor(1) );
562 mgr->setValue( "SMESH", "outline_color", aDlg->GetColor(2) );
563 mgr->setValue( "SMESH", "node_color", aDlg->GetColor(3) );
564 mgr->setValue( "SMESH", "backface_color", aDlg->GetColor(4) );
566 mgr->setValue( "SMESH", "element_width", aDlg->GetIntValue(1) );
567 mgr->setValue( "SMESH", "node_size", aDlg->GetIntValue(2) );
568 mgr->setValue( "SMESH", "shrink_coeff", aDlg->GetIntValue(3) );
575 void Control( int theCommandID )
577 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
578 SALOME_ListIO selected;
580 aSel->selectedObjects( selected );
582 if( !selected.IsEmpty() ){
583 Handle(SALOME_InteractiveObject) anIO = selected.First();
586 SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
587 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())){
588 switch ( theCommandID ){
590 aTitle = QObject::tr( "LENGTH_EDGES" );
591 aControl = SMESH_Actor::eLength;
594 aTitle = QObject::tr( "LENGTH2D_EDGES" );
595 aControl = SMESH_Actor::eLength2D;
598 aTitle = QObject::tr( "FREE_EDGES" );
599 aControl = SMESH_Actor::eFreeEdges;
602 aTitle = QObject::tr( "FREE_BORDERS" );
603 aControl = SMESH_Actor::eFreeBorders;
606 aTitle = QObject::tr( "MULTI_BORDERS" );
607 aControl = SMESH_Actor::eMultiConnection;
610 aTitle = QObject::tr( "MULTI2D_BORDERS" );
611 aControl = SMESH_Actor::eMultiConnection2D;
614 aTitle = QObject::tr( "AREA_ELEMENTS" );
615 aControl = SMESH_Actor::eArea;
618 aTitle = QObject::tr( "TAPER_ELEMENTS" );
619 aControl = SMESH_Actor::eTaper;
622 aTitle = QObject::tr( "ASPECTRATIO_ELEMENTS" );
623 aControl = SMESH_Actor::eAspectRatio;
626 aTitle = QObject::tr( "ASPECTRATIO_3D_ELEMENTS" );
627 aControl = SMESH_Actor::eAspectRatio3D;
630 aTitle = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
631 aControl = SMESH_Actor::eMinimumAngle;
634 aTitle = QObject::tr( "WARP_ELEMENTS" );
635 aControl = SMESH_Actor::eWarping;
638 aTitle = QObject::tr( "SKEW_ELEMENTS" );
639 aControl = SMESH_Actor::eSkew;
642 anActor->SetControlMode(aControl);
643 anActor->GetScalarBarActor()->SetTitle(aTitle.latin1());
650 bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
651 MeshObjectType theType,
652 const QString theInTypeName,
653 QString & theOutTypeName)
655 SMESH_TypeFilter aTypeFilter( theType );
657 if( !theIO.IsNull() )
659 entry = theIO->getEntry();
660 SalomeApp_DataOwner owner( entry );
661 if ( aTypeFilter.isOk( &owner )) {
662 theOutTypeName = theInTypeName;
670 QString CheckTypeObject(const Handle(SALOME_InteractiveObject) & theIO)
672 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
673 _PTR(SObject) aSObj = aStudy->FindObjectID(theIO->getEntry());
675 _PTR(SComponent) aSComp = aSObj->GetFatherComponent();
676 CORBA::String_var anID = aSComp->GetID().c_str();
677 if (!strcmp(anID.in(),theIO->getEntry()))
683 CheckOIType ( theIO, HYPOTHESIS, "Hypothesis", aTypeName ) ||
684 CheckOIType ( theIO, ALGORITHM, "Algorithm", aTypeName ) ||
685 CheckOIType ( theIO, MESH, "Mesh", aTypeName ) ||
686 CheckOIType ( theIO, SUBMESH, "SubMesh", aTypeName ) ||
687 CheckOIType ( theIO, GROUP, "Group", aTypeName )
695 QString CheckHomogeneousSelection()
697 //SUIT_Study* aStudy = SMESH::GetActiveStudy();
698 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
699 SALOME_ListIO selected;
701 aSel->selectedObjects( selected );
703 QString RefType = CheckTypeObject(selected.First());
704 SALOME_ListIteratorOfListIO It(selected);
705 for (; It.More(); It.Next())
707 Handle(SALOME_InteractiveObject) IObject = It.Value();
708 QString Type = CheckTypeObject(IObject);
709 if (Type.compare(RefType) != 0)
710 return "Heterogeneous Selection";
718 // VSR 17/11/04: check if all objects selected belong to SMESH component --> start
719 SalomeApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
720 SALOME_ListIO selected; aSel->selectedObjects( selected );
722 QString aParentComponent = QString::null;
723 for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
725 QString cur = anIt.Value()->getComponentDataType();
726 if( aParentComponent.isNull() )
727 aParentComponent = cur;
728 else if( !aParentComponent.isEmpty() && aParentComponent!=cur )
729 aParentComponent = "";
732 if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() ) {
733 SUIT_MessageBox::warn1 ( SMESHGUI::desktop(),
734 QObject::tr("ERR_ERROR"),
735 QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ),
736 QObject::tr("BUT_OK") );
739 // VSR 17/11/04: check if all objects selected belong to SMESH component <-- finish
740 if (SUIT_MessageBox::warn2
741 (SMESHGUI::desktop(),
742 QObject::tr("SMESH_WRN_WARNING"),
743 QObject::tr("SMESH_REALLY_DELETE"),
744 QObject::tr("SMESH_BUT_YES"), QObject::tr("SMESH_BUT_NO"), 1, 0, 0) != 1)
747 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
748 SUIT_ViewManager* vm = anApp->activeViewManager();
749 int nbSf = vm->getViewsCount();
751 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
752 _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
753 _PTR(GenericAttribute) anAttr;
754 _PTR(AttributeIOR) anIOR;
756 SALOME_ListIteratorOfListIO It(selected);
758 aStudyBuilder->NewCommand(); // There is a transaction
759 for(; It.More(); It.Next()){
760 Handle(SALOME_InteractiveObject) IObject = It.Value();
761 if(IObject->hasEntry()){
762 _PTR(SObject) SO = aStudy->FindObjectID(IObject->getEntry());
764 /* Erase child graphical objects */
765 _PTR(ChildIterator) it = aStudy->NewChildIterator(SO);
766 for(it->InitEx(true); it->More(); it->Next()){
767 _PTR(SObject) CSO = it->Value();
768 if(CSO->FindAttribute(anAttr, "AttributeIOR")){
771 QPtrVector<SUIT_ViewWindow> aViews = vm->getViews();
772 for(int i = 0; i < nbSf; i++){
773 SUIT_ViewWindow *sf = aViews[i];
774 CORBA::String_var anEntry = CSO->GetID().c_str();
775 if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.in())){
776 SMESH::RemoveActor(sf,anActor);
782 /* Erase main graphical object */
783 QPtrVector<SUIT_ViewWindow> aViews = vm->getViews();
784 for(int i = 0; i < nbSf; i++){
785 SUIT_ViewWindow *sf = aViews[i];
786 if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,IObject->getEntry())){
787 SMESH::RemoveActor(sf,anActor);
791 // Remove object(s) from data structures
792 _PTR(SObject) obj = aStudy->FindObjectID(IObject->getEntry());
794 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( obj ) );
795 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( obj ) );
796 QString objType = CheckTypeObject(IObject);
797 if ( !aGroup->_is_nil() ) { // DELETE GROUP
798 SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh();
799 aMesh->RemoveGroup( aGroup );
801 else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH
802 SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
803 aMesh->RemoveSubMesh( aSubMesh );
805 else if ( objType == "Hypothesis" || objType == "Algorithm" ) {// DELETE HYPOTHESIS
806 SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
807 aStudyBuilder->RemoveObjectWithChildren( obj );
809 else {// default action: remove SObject from the study
810 // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH
811 //SUIT_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy);
813 aStudyBuilder->RemoveObjectWithChildren( obj );
818 } /* IObject->hasEntry() */
820 aStudyBuilder->CommitCommand();
822 /* Clear any previous selection */
824 aSel->setSelectedObjects( l1 );
826 SMESHGUI::GetSMESHGUI()->updateObjBrowser();
831 Standard_EXPORT CAM_Module* createModule()
833 return new SMESHGUI();
837 SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil();
839 //=============================================================================
843 //=============================================================================
844 SMESHGUI::SMESHGUI() :
845 SalomeApp_Module( "SMESH" )
847 if ( CORBA::is_nil( myComponentSMESH ) )
849 SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( getApp()->namingService() );
850 Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "SMESH" );
851 myComponentSMESH = SMESH::SMESH_Gen::_narrow( comp );
854 myActiveDialogBox = 0 ;
857 SMESH::GetFilterManager();
860 /* load resources for all available meshers */
861 SMESH::InitAvailableHypotheses();
864 //=============================================================================
868 //=============================================================================
869 SMESHGUI::~SMESHGUI()
871 SMESH::GetFilterManager()->Destroy();
874 //=============================================================================
878 //=============================================================================
879 SalomeApp_SelectionMgr* SMESHGUI::selectionMgr()
881 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
883 return dynamic_cast<SalomeApp_SelectionMgr*>( anApp->selectionMgr() );
888 bool SMESHGUI::automaticUpdate()
890 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
894 return resMgr->booleanValue( "SMESH", "auto_update", false );
897 //=============================================================================
901 //=============================================================================
902 SUIT_ResourceMgr* SMESHGUI::resourceMgr()
904 return dynamic_cast<SUIT_ResourceMgr*>( SUIT_Session::session()->resourceMgr() );
907 //=============================================================================
911 //=============================================================================
912 SMESHGUI* SMESHGUI::GetSMESHGUI()
914 SMESHGUI* smeshMod = 0;
915 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
918 CAM_Module* module = app->module( "Mesh" );
919 smeshMod = dynamic_cast<SMESHGUI*>( module );
922 if ( smeshMod && smeshMod->application() && smeshMod->application()->activeStudy() )
924 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( smeshMod->application()->activeStudy() );
927 _PTR(Study) aStudy = study->studyDS();
929 GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
938 Standard_EXPORT SMESHGUI* GetComponentGUI()
940 return SMESHGUI::GetSMESHGUI();
944 //=============================================================================
948 //=============================================================================
949 void SMESHGUI::SetState(int aState)
954 //=============================================================================
958 //=============================================================================
959 void SMESHGUI::ResetState()
964 //=============================================================================
968 //=============================================================================
969 void SMESHGUI::EmitSignalDeactivateDialog()
971 emit SignalDeactivateActiveDialog();
974 //=============================================================================
978 //=============================================================================
979 void SMESHGUI::EmitSignalStudyFrameChanged()
981 emit SignalStudyFrameChanged();
984 //=============================================================================
988 //=============================================================================
989 void SMESHGUI::EmitSignalCloseAllDialogs()
991 emit SignalCloseAllDialogs();
994 //=============================================================================
998 //=============================================================================
999 QDialog *SMESHGUI::GetActiveDialogBox()
1001 return myActiveDialogBox;
1004 //=============================================================================
1008 //=============================================================================
1009 void SMESHGUI::SetActiveDialogBox(QDialog * aDlg)
1011 myActiveDialogBox = (QDialog *) aDlg;
1015 //=============================================================================
1019 //=============================================================================
1020 SUIT_Desktop* SMESHGUI::desktop()
1022 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
1024 return app->desktop();
1029 //=============================================================================
1033 //=============================================================================
1034 SalomeApp_Study* SMESHGUI::activeStudy()
1036 SUIT_Application* app = SUIT_Session::session()->activeApplication();
1038 return dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
1043 //=============================================================================
1047 //=============================================================================
1048 bool SMESHGUI::DefineDlgPosition(QWidget * aDlg, int &x, int &y)
1050 /* Here the position is on the bottom right corner - 10 */
1051 // aDlg->resize(QSize().expandedTo(aDlg->minimumSizeHint()));
1053 SUIT_Desktop *PP = desktop();
1054 x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10);
1055 y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10);
1059 //=============================================================================
1063 //=============================================================================
1064 static int isStudyLocked(_PTR(Study) theStudy){
1065 return theStudy->GetProperties()->IsLocked();
1068 static bool checkLock(_PTR(Study) theStudy) {
1069 if (isStudyLocked(theStudy)) {
1070 SUIT_MessageBox::warn1 ( SMESHGUI::desktop(),
1071 QObject::tr("WRN_WARNING"),
1072 QObject::tr("WRN_STUDY_LOCKED"),
1073 QObject::tr("BUT_OK") );
1079 //=======================================================================
1080 //function : CheckActiveStudyLocked
1082 //=======================================================================
1084 bool SMESHGUI::isActiveStudyLocked()
1086 _PTR(Study) aStudy = activeStudy()->studyDS();
1087 return checkLock( aStudy );
1090 //=============================================================================
1094 //=============================================================================
1095 bool SMESHGUI::OnGUIEvent( int theCommandID )
1097 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( application() );
1101 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
1102 SUIT_ResourceMgr* mgr = resourceMgr();
1106 SUIT_ViewWindow* view = application()->desktop()->activeWindow();
1107 SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
1109 QAction* act = action( theCommandID );
1111 switch (theCommandID) {
1113 if(checkLock(aStudy)) break;
1121 if(checkLock(aStudy)) break;
1122 ::ImportMeshesFromFile(GetSMESHGen(),theCommandID);
1126 case 122: // EXPORT MED
1133 ::ExportMeshToFile(theCommandID);
1137 case 200: // SCALAR BAR
1139 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1140 SALOME_ListIO selected;
1142 aSel->selectedObjects( selected );
1144 if( selected.Extent() ) {
1145 Handle(SALOME_InteractiveObject) anIO = selected.First();
1146 if( anIO->hasEntry() ) {
1147 if( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) {
1148 anActor->SetControlMode( SMESH_Actor::eNone );
1156 SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( this );
1160 case 1134: // Clipping
1161 case 1133: // Tranparency
1162 case 1132: // Colors / Size
1169 ::SetDisplayMode(theCommandID);
1175 case 219: // Volumes
1176 case 220: // All Entity
1177 ::SetDisplayEntity(theCommandID);
1182 if(checkLock(aStudy)) break;
1183 SMESH::UpdateView();
1186 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1187 aSel->setSelectedObjects( l );
1192 case 301: // DISPLAY
1193 case 302: // DISPLAY ONLY
1195 SMESH::EDisplaing anAction;
1196 switch(theCommandID){
1197 case 300: anAction = SMESH::eErase; break;
1198 case 301: anAction = SMESH::eDisplay; break;
1199 case 302: anAction = SMESH::eDisplayOnly; break;
1202 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1203 SALOME_ListIO selected;
1205 aSel->selectedObjects( selected );
1208 SALOME_ListIteratorOfListIO It(selected);
1209 for (; It.More(); It.Next()) {
1210 Handle(SALOME_InteractiveObject) IOS = It.Value();
1211 if (IOS->hasEntry()) {
1212 SMESH::UpdateView(anAction,IOS->getEntry());
1217 aSel->setSelectedObjects( l1 );
1223 if(checkLock(aStudy)) break;
1226 EmitSignalDeactivateDialog();
1228 new SMESHGUI_NodesDlg(this);
1231 SUIT_MessageBox::warn1(desktop(),
1232 tr("SMESH_WRN_WARNING"),
1233 tr("SMESH_WRN_VIEWER_VTK"),
1234 tr("SMESH_BUT_OK"));
1239 case 2151: // FILTER
1243 EmitSignalDeactivateDialog();
1244 new SMESHGUI_FilterDlg( this, SMESH::EDGE );
1249 case 406: // MOVE NODE
1253 SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
1254 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1258 if(checkLock(aStudy)) break;
1259 new SMESHGUI_MoveNodesDlg(this);
1263 case 701: // COMPUTE MESH
1265 if(checkLock(aStudy)) break;
1267 SalomeApp_SelectionMgr *Sel = selectionMgr();
1268 SALOME_ListIO selected; Sel->selectedObjects( selected );
1270 int nbSel = selected.Extent();
1275 SMESH::SMESH_Mesh_var aMesh;
1276 SMESH::SMESH_subMesh_var aSubMesh;
1277 Handle(SALOME_InteractiveObject) IObject = selected.First();
1278 if (IObject->hasEntry()){
1279 _PTR(SObject) aMeshSObj = aStudy->FindObjectID(IObject->getEntry());
1280 GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh( aMeshSObj );
1281 if ( aShapeObject->_is_nil() ) {
1286 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(aMeshSObj);
1287 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(aMeshSObj);
1289 if (!aMesh->_is_nil()){
1290 GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
1291 if (!refShapeObject->_is_nil()) {
1292 if(!GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject)){
1293 SUIT_MessageBox::warn1(desktop(),
1294 tr("SMESH_WRN_WARNING"),
1295 tr("SMESH_WRN_MISSING_PARAMETERS"),
1296 tr("SMESH_BUT_OK"));
1300 if (GetSMESHGen()->Compute(aMesh,refShapeObject))
1301 SMESH::ModifiedMesh(aMeshSObj,true);
1302 // TO Do : change icon of all submeshes
1304 SUIT_MessageBox::warn1(desktop(),
1305 tr("SMESH_WRN_WARNING"),
1306 tr("SMESH_WRN_COMPUTE_FAILED"),
1307 tr("SMESH_BUT_OK"));
1309 catch(const SALOME::SALOME_Exception & S_ex){
1310 SalomeApp_Tools::QtCatchCorbaException(S_ex);
1313 }else if(!aSubMesh->_is_nil()){
1314 aMesh = aSubMesh->GetFather();
1315 GEOM::GEOM_Object_var refShapeObject = SMESH::GetShapeOnMeshOrSubMesh(aMeshSObj);
1316 if(!refShapeObject->_is_nil()){
1317 bool compute = GetSMESHGen()->IsReadyToCompute(aMesh,refShapeObject);
1319 SUIT_MessageBox::warn1(desktop(),
1320 tr("SMESH_WRN_WARNING"),
1321 tr("SMESH_WRN_MISSING_PARAMETERS"),
1322 tr("SMESH_BUT_OK"));
1326 if ( GetSMESHGen()->Compute(aMesh,refShapeObject) )
1327 SMESH::ModifiedMesh(aMeshSObj,true);
1328 // TO Do : change icon of all submeshes
1330 SUIT_MessageBox::warn1(desktop(),
1331 tr("SMESH_WRN_WARNING"),
1332 tr("SMESH_WRN_COMPUTE_FAILED"),
1333 tr("SMESH_BUT_OK"));
1334 }catch(const SALOME::SALOME_Exception & S_ex){
1335 SalomeApp_Tools::QtCatchCorbaException(S_ex);
1341 CORBA::Long anId = aStudy->StudyId();
1342 TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,IObject->getEntry());
1343 if ( automaticUpdate() && aVisualObj){
1344 aVisualObj->Update();
1345 SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
1347 anActor = SMESH::CreateActor(aStudy,IObject->getEntry());
1349 SMESH::DisplayActor(view,anActor); //apo
1355 SUIT_MessageBox::warn1(desktop(),
1356 tr("SMESH_WRN_WARNING"),
1357 tr("SMESH_WRN_VIEWER_VTK"),
1358 tr("SMESH_BUT_OK"));
1364 case 702: // ADD SUB MESH
1366 if(checkLock(aStudy)) break;
1368 EmitSignalDeactivateDialog();
1369 new SMESHGUI_AddSubMeshDlg( this );
1372 SUIT_MessageBox::warn1(desktop(),
1373 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1374 tr("SMESH_BUT_OK"));
1379 case 703: // INIT MESH
1381 if(checkLock(aStudy)) break;
1382 EmitSignalDeactivateDialog();
1383 new SMESHGUI_InitMeshDlg( this );
1387 case 704: // EDIT Hypothesis
1389 if(checkLock(aStudy)) break;
1390 EmitSignalDeactivateDialog();
1391 new SMESHGUI_EditHypothesesDlg( this );
1395 case 705: // EDIT Global Hypothesis
1397 if(checkLock(aStudy)) break;
1398 EmitSignalDeactivateDialog();
1399 new SMESHGUI_EditHypothesesDlg( this );
1403 case 706: // EDIT Local Hypothesis
1405 if(checkLock(aStudy)) break;
1406 EmitSignalDeactivateDialog();
1407 new SMESHGUI_EditHypothesesDlg( this );
1411 case 407: // DIAGONAL INVERSION
1412 case 408: // Delete diagonal
1416 SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
1417 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1421 if ( checkLock( aStudy ) )
1424 /*Standard_Boolean aRes;
1425 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
1426 if ( aMesh->_is_nil() )
1428 SUIT_MessageBox::warn1(GetDesktop(), tr( "SMESH_WRN_WARNING" ),
1429 tr( "SMESH_BAD_SELECTION" ), tr( "SMESH_BUT_OK" ) );
1433 EmitSignalDeactivateDialog();
1434 if ( theCommandID == 407 )
1435 new SMESHGUI_TrianglesInversionDlg(this);
1437 new SMESHGUI_UnionOfTwoTrianglesDlg(this);
1440 case 409: // Change orientation
1441 case 410: // Union of triangles
1442 case 411: // Cutting of quadrangles
1446 SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
1447 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1451 if ( checkLock( aStudy ) )
1454 EmitSignalDeactivateDialog();
1455 SMESHGUI_MultiEditDlg* aDlg = NULL;
1456 if ( theCommandID == 409 )
1457 aDlg = new SMESHGUI_ChangeOrientationDlg(this);
1458 else if ( theCommandID == 410 )
1459 aDlg = new SMESHGUI_UnionOfTrianglesDlg(this);
1461 aDlg = new SMESHGUI_CuttingOfQuadsDlg(this);
1464 DefineDlgPosition( aDlg, x, y );
1469 case 412: // Smoothing
1471 if(checkLock(aStudy)) break;
1473 EmitSignalDeactivateDialog();
1474 new SMESHGUI_SmoothingDlg( this );
1477 SUIT_MessageBox::warn1(desktop(),
1478 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1479 tr("SMESH_BUT_OK"));
1483 case 413: // Extrusion
1485 if (checkLock(aStudy)) break;
1487 EmitSignalDeactivateDialog();
1488 new SMESHGUI_ExtrusionDlg ( this );
1490 SUIT_MessageBox::warn1(desktop(),
1491 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1492 tr("SMESH_BUT_OK"));
1496 case 414: // Revolution
1498 if(checkLock(aStudy)) break;
1500 EmitSignalDeactivateDialog();
1501 new SMESHGUI_RevolutionDlg( this );
1504 SUIT_MessageBox::warn1(desktop(),
1505 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1506 tr("SMESH_BUT_OK"));
1510 case 415: // Pattern mapping
1512 if ( checkLock( aStudy ) )
1516 EmitSignalDeactivateDialog();
1517 new SMESHGUI_MeshPatternDlg( this );
1520 SUIT_MessageBox::warn1(desktop(),
1521 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1522 tr("SMESH_BUT_OK"));
1526 case 416: // Extrusion along a path
1528 if (checkLock(aStudy)) break;
1530 EmitSignalDeactivateDialog();
1531 new SMESHGUI_ExtrusionAlongPathDlg( this );
1533 SUIT_MessageBox::warn1(desktop(),
1534 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
1535 tr("SMESH_BUT_OK"));
1539 case 801: // CREATE GROUP
1543 SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
1544 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1548 if(checkLock(aStudy)) break;
1549 EmitSignalDeactivateDialog();
1550 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
1552 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1553 SALOME_ListIO selected;
1555 aSel->selectedObjects( selected );
1557 int nbSel = selected.Extent();
1559 // check if mesh is selected
1560 aMesh = SMESH::GetMeshByIO( selected.First() );
1562 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", aMesh);
1567 case 802: // CONSTRUCT GROUP
1571 SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
1572 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1576 if(checkLock(aStudy)) break;
1577 EmitSignalDeactivateDialog();
1579 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1580 SALOME_ListIO selected;
1582 aSel->selectedObjects( selected );
1584 int nbSel = selected.Extent();
1586 // check if submesh is selected
1587 Handle(SALOME_InteractiveObject) IObject = selected.First();
1588 if (IObject->hasEntry()) {
1589 _PTR(SObject) aSObj = aStudy->FindObjectID(IObject->getEntry());
1591 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( aSObj ) );
1592 if (!aSubMesh->_is_nil()) {
1594 SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
1595 // get submesh elements list by types
1596 SMESH::long_array_var aNodes = aSubMesh->GetElementsByType(SMESH::NODE);
1597 SMESH::long_array_var aEdges = aSubMesh->GetElementsByType(SMESH::EDGE);
1598 SMESH::long_array_var aFaces = aSubMesh->GetElementsByType(SMESH::FACE);
1599 SMESH::long_array_var aVolumes = aSubMesh->GetElementsByType(SMESH::VOLUME);
1600 // create group for each type o elements
1601 QString aName = IObject->getName();
1602 if (aNodes->length() > 0) {
1603 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::NODE, aName + "_Nodes");
1604 aGroup->Add(aNodes.inout());
1606 if (aEdges->length() > 0) {
1607 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::EDGE, aName + "_Edges");
1608 aGroup->Add(aEdges.inout());
1610 if (aFaces->length() > 0) {
1611 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::FACE, aName + "_Faces");
1612 aGroup->Add(aFaces.inout());
1614 if (aVolumes->length() > 0) {
1615 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::VOLUME, aName + "_Volumes");
1616 aGroup->Add(aVolumes.inout());
1620 }catch(const SALOME::SALOME_Exception & S_ex){
1621 SalomeApp_Tools::QtCatchCorbaException(S_ex);
1630 case 803: // EDIT GROUP
1634 SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
1635 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1639 if(checkLock(aStudy)) break;
1640 EmitSignalDeactivateDialog();
1642 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1643 SALOME_ListIO selected;
1645 aSel->selectedObjects( selected );
1647 SALOME_ListIteratorOfListIO It (selected);
1648 int nbSelectedGroups = 0;
1649 for ( ; It.More(); It.Next() )
1651 SMESH::SMESH_Group_var aGroup =
1652 SMESH::IObjectToInterface<SMESH::SMESH_Group>(It.Value());
1653 if (!aGroup->_is_nil()) {
1655 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", aGroup);
1659 if (nbSelectedGroups == 0)
1661 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", SMESH::SMESH_Group::_nil());
1667 case 804: // Add elements to group
1669 if(checkLock(aStudy)) break;
1670 if (myState == 800) {
1671 SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
1672 if (aDlg) aDlg->onAdd();
1677 case 805: // Remove elements from group
1679 if(checkLock(aStudy)) break;
1680 if (myState == 800) {
1681 SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
1682 if (aDlg) aDlg->onRemove();
1687 case 810: // Union Groups
1688 case 811: // Intersect groups
1689 case 812: // Cut groups
1693 SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
1694 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1698 if ( checkLock( aStudy ) )
1701 EmitSignalDeactivateDialog();
1704 if ( theCommandID == 810 ) aMode = SMESHGUI_GroupOpDlg::UNION;
1705 else if ( theCommandID == 811 ) aMode = SMESHGUI_GroupOpDlg::INTERSECT;
1706 else aMode = SMESHGUI_GroupOpDlg::CUT;
1708 ( new SMESHGUI_GroupOpDlg( this, aMode ) )->show();
1712 case 813: // Delete groups with their contents
1716 SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
1717 tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
1721 if ( checkLock( aStudy ) )
1724 EmitSignalDeactivateDialog();
1726 new SMESHGUI_DeleteGroupDlg( this );
1730 case 900: // MESH INFOS
1732 EmitSignalDeactivateDialog();
1733 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1734 SALOME_ListIO selected;
1736 aSel->selectedObjects( selected );
1738 if ( selected.Extent() > 1 ) { // a dlg for each IO
1740 SALOME_ListIteratorOfListIO It (selected);
1741 for ( ; It.More(); It.Next() ) {
1742 IOs.Clear(); IOs.Append( It.Value() );
1743 aSel->setSelectedObjects( IOs );
1744 new SMESHGUI_MeshInfosDlg(this, "", false);
1746 // restore selection
1747 aSel->setSelectedObjects( selected );
1750 new SMESHGUI_MeshInfosDlg(this, "", false);
1754 case 902: // STANDARD MESH INFOS
1756 EmitSignalDeactivateDialog();
1757 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1758 SALOME_ListIO selected;
1760 aSel->selectedObjects( selected );
1762 if ( selected.Extent() > 1 ) { // a dlg for each IO
1764 SALOME_ListIteratorOfListIO It (selected);
1765 for ( ; It.More(); It.Next() ) {
1767 IOs.Append( It.Value() );
1768 aSel->setSelectedObjects( IOs );
1769 new SMESHGUI_StandardMeshInfosDlg( this, "", false);
1771 // restore selection
1772 aSel->setSelectedObjects( selected );
1775 new SMESHGUI_StandardMeshInfosDlg( this, "", false);
1779 case 1001: // AUTOMATIC UPDATE PREFERENCES
1781 // if (act->isOn()) {
1782 // mgr->setValue( "SMESH", "AutomaticUpdate", true );
1783 // myAutomaticUpdate = true;
1786 // mgr->setValue( "SMESH", "AutomaticUpdate", false );
1787 // myAutomaticUpdate = false;
1792 case 1003: // MESH PREFERENCES
1794 ::SetDisplaySettings();
1800 SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( this );
1806 ( new SMESHGUI_PrecisionDlg( this ) )->exec();
1813 mgr->setValue( "SMESH", "display_entity", true );
1816 mgr->setValue( "SMESH", "display_entity", false );
1822 SMESHGUI_Preferences_SelectionDlg* aDlg =
1823 new SMESHGUI_Preferences_SelectionDlg( this );
1825 QColor aColor = mgr->colorValue( "SMESH", "highlight_color", Qt::cyan );
1826 aDlg->SetColor(1, aColor);
1828 aColor = mgr->colorValue( "SMESH", "selection_element_color", Qt::yellow );
1829 aDlg->SetColor(2, aColor);
1831 aColor = mgr->colorValue( "SMESH", "selection_object_color", Qt::white );
1832 aDlg->SetColor(3, aColor);
1834 aDlg->SetWidth(1, mgr->integerValue( "SMESH", "highlight_width", 5 ) );
1835 aDlg->SetWidth(2, mgr->integerValue( "SMESH", "selection_width", 5 ) );
1836 aDlg->SetPrecision(1, mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ) );
1837 aDlg->SetPrecision(2, mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 ) );
1840 QColor aPreColor = aDlg->GetColor(1),
1841 aSelColor = aDlg->GetColor(2),
1842 aHiColor = aDlg->GetColor(3);
1843 int aPreWidth = aDlg->GetWidth(1),
1844 aSelWidth = aDlg->GetWidth(2);
1845 double aTolNodes = aDlg->GetPrecision(1),
1846 aTolItems = aDlg->GetPrecision(2);
1848 mgr->setValue( "SMESH", "highlight_color", aPreColor );
1849 mgr->setValue( "SMESH", "selection_element_color", aSelColor );
1850 mgr->setValue( "SMESH", "selection_object_color", aHiColor );
1852 mgr->setValue( "SMESH", "highlight_width", aPreWidth );
1853 mgr->setValue( "SMESH", "selection_width", aSelWidth );
1854 mgr->setValue( "SMESH", "selection_precision_node", aTolNodes );
1855 mgr->setValue( "SMESH", "selection_precision_element", aTolItems );
1857 // update current study settings
1858 SMESH::UpdateSelectionProp( this );
1861 // update VTK viewer properties
1862 SVTK_RenderWindowInteractor* anInteractor =
1863 dynamic_cast<SVTK_RenderWindowInteractor*>( vtkwnd->getRWInteractor() );
1865 anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
1866 aSelColor.blue()/255., aSelWidth);
1867 anInteractor->SetSelectionTolerance(aTolNodes, aTolItems);
1868 SVTK_InteractorStyle* aStyle =
1869 dynamic_cast<SVTK_InteractorStyle*>( anInteractor->GetInteractorStyle() );
1872 aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
1873 aPreColor.blue()/255., aPreWidth);
1876 vtkRenderer* aRenderer = vtkwnd->getRenderer();
1877 vtkActorCollection *aCollection = aRenderer->GetActors();
1878 aCollection->InitTraversal();
1879 while(vtkActor *anAct = aCollection->GetNextActor()){
1880 if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
1881 anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
1882 aHiColor.blue()/255.);
1883 anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
1884 aPreColor.blue()/255.);
1893 case 1100: // EDIT HYPOTHESIS
1895 if(checkLock(aStudy)) break;
1897 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1898 SALOME_ListIO selected;
1900 aSel->selectedObjects( selected );
1902 int nbSel = selected.Extent();
1905 SMESH::SMESH_Hypothesis_var Hyp = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(selected.First());
1907 /* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */
1908 /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects */
1909 /* Warning : however by internal mechanism all subMeshes icons are changed ! */
1910 if ( !Hyp->_is_nil() )
1912 char* sName = Hyp->GetName();
1913 SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(sName);
1916 aCreator->EditHypothesis(Hyp);
1924 updateObjBrowser( true );
1928 case 1101: // RENAME
1930 if ( checkLock( aStudy ) )
1933 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1934 SALOME_ListIO selected;
1936 aSel->selectedObjects( selected );
1938 SALOME_ListIteratorOfListIO It( selected );
1939 for ( ; It.More(); It.Next() )
1941 Handle(SALOME_InteractiveObject) IObject = It.Value();
1942 _PTR(SObject) obj = aStudy->FindObjectID( IObject->getEntry() );
1943 _PTR(GenericAttribute) anAttr;
1944 _PTR(AttributeName) aName;
1947 if ( obj->FindAttribute(anAttr, "AttributeName") )
1950 QString newName = QString(aName->Value().c_str());
1951 newName = SalomeApp_NameDlg::getName( desktop(), newName );
1952 if ( !newName.isEmpty() )
1954 //old source: aStudy->renameIObject( IObject, newName );
1955 aName->SetValue( newName.latin1() );
1957 // if current object is group update group's name
1958 SMESH::SMESH_GroupBase_var aGroup =
1959 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
1960 if (!aGroup->_is_nil() )
1961 aGroup->SetName( newName.latin1() );
1971 case 1102: // REMOVE HYPOTHESIS / ALGORITHMS
1973 if(checkLock(aStudy)) break;
1974 SUIT_OverrideCursor wc;
1976 SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1977 SALOME_ListIO selected;
1979 aSel->selectedObjects( selected );
1981 SALOME_ListIteratorOfListIO It(selected);
1982 for (int i = 0; It.More(); It.Next(), i++) {
1983 Handle(SALOME_InteractiveObject) IObject = It.Value();
1984 SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
1987 aSel->setSelectedObjects( l1 );
1992 case 401: // GEOM::EDGE
1993 case 4021: // TRIANGLE
1995 case 4023: // POLYGON
1999 if(checkLock(aStudy)) break;
2001 EmitSignalDeactivateDialog();
2002 SMDSAbs_ElementType type = SMDSAbs_Edge;
2004 switch (theCommandID) {
2005 case 4021: // TRIANGLE
2006 type = SMDSAbs_Face; nbNodes = 3; break;
2008 type = SMDSAbs_Face; nbNodes = 4; break;
2010 type = SMDSAbs_Volume; nbNodes = 4; break;
2011 case 4023: // POLYGON
2012 type = SMDSAbs_Face; nbNodes = 5; break; // 5 - identificator for POLYGON
2014 type = SMDSAbs_Volume; nbNodes = 8; break;
2015 case 4033: // POLYHEDRE
2016 type = SMDSAbs_Volume; nbNodes = 9; break; // 9 - identificator for POLYHEDRE
2019 new SMESHGUI_AddMeshElementDlg( this, "", type, nbNodes);
2022 SUIT_MessageBox::warn1(desktop(),
2023 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2024 tr("SMESH_BUT_OK"));
2028 case 4033: // POLYHEDRON
2030 if(checkLock(aStudy)) break;
2032 EmitSignalDeactivateDialog();
2033 new SMESHGUI_CreatePolyhedralVolumeDlg(this, "", FALSE );
2036 SUIT_MessageBox::warn1(SMESHGUI::desktop(),
2037 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2038 tr("SMESH_BUT_OK"));
2042 case 4041: // REMOVES NODES
2044 if(checkLock(aStudy)) break;
2046 EmitSignalDeactivateDialog();
2047 new SMESHGUI_RemoveNodesDlg(this);
2050 SUIT_MessageBox::warn1(desktop(),
2051 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2052 tr("SMESH_BUT_OK"));
2056 case 4042: // REMOVES ELEMENTS
2058 if(checkLock(aStudy)) break;
2060 EmitSignalDeactivateDialog();
2061 new SMESHGUI_RemoveElementsDlg(this);
2065 SUIT_MessageBox::warn1(desktop(),
2066 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2067 tr("SMESH_BUT_OK"));
2071 case 4051: // RENUMBERING NODES
2073 if(checkLock(aStudy)) break;
2075 EmitSignalDeactivateDialog();
2076 new SMESHGUI_RenumberingDlg( this, "", 0);
2080 SUIT_MessageBox::warn1(desktop(),
2081 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2082 tr("SMESH_BUT_OK"));
2086 case 4052: // RENUMBERING ELEMENTS
2088 if(checkLock(aStudy)) break;
2090 EmitSignalDeactivateDialog();
2091 new SMESHGUI_RenumberingDlg( this, "", 1);
2095 SUIT_MessageBox::warn1(desktop(),
2096 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2097 tr("SMESH_BUT_OK"));
2101 case 4061: // TRANSLATION
2103 if(checkLock(aStudy)) break;
2105 EmitSignalDeactivateDialog();
2106 new SMESHGUI_TranslationDlg( this );
2109 SUIT_MessageBox::warn1(desktop(),
2110 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2111 tr("SMESH_BUT_OK"));
2115 case 4062: // ROTATION
2117 if(checkLock(aStudy)) break;
2119 EmitSignalDeactivateDialog();
2120 new SMESHGUI_RotationDlg( this );
2123 SUIT_MessageBox::warn1(desktop(),
2124 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2125 tr("SMESH_BUT_OK"));
2129 case 4063: // SYMMETRY
2131 if(checkLock(aStudy)) break;
2133 EmitSignalDeactivateDialog();
2134 new SMESHGUI_SymmetryDlg( this );
2137 SUIT_MessageBox::warn1(desktop(),
2138 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2139 tr("SMESH_BUT_OK"));
2143 case 4064: // SEWING
2145 if(checkLock(aStudy)) break;
2147 EmitSignalDeactivateDialog();
2148 new SMESHGUI_SewingDlg( this );
2151 SUIT_MessageBox::warn1(desktop(),
2152 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2153 tr("SMESH_BUT_OK"));
2157 case 4065: // MERGE NODES
2159 if(checkLock(aStudy)) break;
2161 EmitSignalDeactivateDialog();
2162 new SMESHGUI_MergeNodesDlg( this );
2165 SUIT_MessageBox::warn1(desktop(),
2166 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
2167 tr("SMESH_BUT_OK"));
2173 case 5000: // HYPOTHESIS
2175 if(checkLock(aStudy)) break;
2176 EmitSignalDeactivateDialog();
2177 new SMESHGUI_CreateHypothesesDlg ( this, "", FALSE, false );
2182 if(checkLock(aStudy)) break;
2183 EmitSignalDeactivateDialog();
2184 new SMESHGUI_CreateHypothesesDlg ( this, "", FALSE, true);
2188 case 5105: // Library of selection filters
2190 static QValueList<int> aTypes;
2191 if ( aTypes.isEmpty() )
2193 aTypes.append( SMESH::NODE );
2194 aTypes.append( SMESH::EDGE );
2195 aTypes.append( SMESH::FACE );
2196 aTypes.append( SMESH::VOLUME );
2198 new SMESHGUI_FilterLibraryDlg( this, SMESH::GetDesktop( this ), aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
2202 case 6017: // CONTROLS
2217 SalomeApp_SelectionMgr* mgr = selectionMgr();
2218 SALOME_ListIO selected; mgr->selectedObjects( selected );
2220 if ( selected.Extent() == 1 && selected.First()->hasEntry() ) {
2221 _PTR(SObject) SO = aStudy->FindObjectID( selected.First()->getEntry() );
2223 CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
2224 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
2225 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
2226 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
2227 if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
2228 ::Control( theCommandID );
2233 SUIT_MessageBox::warn1(desktop(),
2234 tr( "SMESH_WRN_WARNING" ),
2235 tr( "SMESH_BAD_SELECTION" ),
2236 tr( "SMESH_BUT_OK" ) );
2240 SUIT_MessageBox::warn1(desktop(),
2241 tr( "SMESH_WRN_WARNING" ),
2242 tr( "NOT_A_VTK_VIEWER" ),
2243 tr( "SMESH_BUT_OK" ) );
2248 SalomeApp_SelectionMgr* mgr = selectionMgr();
2249 SALOME_ListIO selected; mgr->selectedObjects( selected );
2251 if (selected.Extent() == 1) {
2252 Handle(SALOME_InteractiveObject) anIObject = selected.First();
2253 if(anIObject->hasEntry())
2254 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
2255 anActor->SetPointsLabeled( !anActor->GetPointsLabeled() );
2262 SalomeApp_SelectionMgr* mgr = selectionMgr();
2263 SALOME_ListIO selected; mgr->selectedObjects( selected );
2265 if (selected.Extent() == 1) {
2266 Handle(SALOME_InteractiveObject) anIObject = selected.First();
2267 if(anIObject->hasEntry())
2268 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
2269 anActor->SetCellsLabeled( !anActor->GetCellsLabeled() );
2274 case 10001: // DISPLAY MODE PREFERENCE
2278 action( 10002 )->setOn( false );
2279 action( 10004 )->setOn( false );
2280 action( 10003 )->setOn( true );
2281 mgr->setValue( "SMESH", "display_mode", "Wireframe");
2287 action( 10001 )->setOn( false );
2288 action( 10004 )->setOn( false );
2289 action( 10003 )->setOn( true );
2290 mgr->setValue( "SMESH", "display_mode", "Shading");
2295 mgr->setValue( "SMESH", "display_mode", "Shrink" );
2301 action( 10001 )->setOn( false );
2302 action( 10002 )->setOn( false );
2303 action( 10003 )->setOn( false );
2304 mgr->setValue( "SMESH", "display_mode", "Nodes" );
2310 //updateObjBrowser();
2314 //=============================================================================
2318 //=============================================================================
2319 bool SMESHGUI::OnMousePress( QMouseEvent * pe, SUIT_ViewWindow * wnd )
2324 //=============================================================================
2328 //=============================================================================
2329 bool SMESHGUI::OnMouseMove( QMouseEvent * pe, SUIT_ViewWindow * wnd )
2334 //=============================================================================
2338 //=============================================================================
2339 bool SMESHGUI::OnKeyPress( QKeyEvent * pe, SUIT_ViewWindow * wnd )
2344 //=============================================================================
2348 //=============================================================================
2349 bool SMESHGUI::SetSettings(SUIT_Desktop* parent)
2351 SMESHGUI::GetSMESHGUI();
2353 SUIT_ResourceMgr* mgr = resourceMgr();
2358 QString DisplayMode = "Shading";
2359 if ( mgr->hasValue("SMESH","display_mode") )
2360 DisplayMode = mgr->stringValue("SMESH","display_mode");
2362 mgr->setValue("SMESH","display_mode", "Shading");
2364 bool Shrink = false;
2365 if ( mgr->hasValue("SMESH","display_mode") )
2366 Shrink = mgr->stringValue("SMESH","display_mode") == "Shrink";
2368 if (DisplayMode == "Wireframe") {
2370 action( 10004 )->setOn( false );
2371 action( 10002 )->setOn( false );
2372 action( 10001 )->setOn( true );
2373 action( 10003 )->setOn( true );
2375 else if (DisplayMode == "Nodes") {
2377 action( 10004 )->setOn( true );
2378 action( 10002 )->setOn( false );
2379 action( 10001 )->setOn( false );
2380 action( 10003 )->setOn( false );
2383 // default is shading
2384 action( 10004 )->setOn( false );
2385 action( 10002 )->setOn( true );
2386 action( 10001 )->setOn( false );
2387 action( 10003 )->setOn( true );
2390 action( 10003 )->setOn( Shrink );
2393 // if ( mgr->booleanValue( "SMESH","AutomaticUpdate", false ) ) {
2394 // action( 1001 )->setOn( true );
2395 // myAutomaticUpdate = true;
2398 // action( 1001 )->setOn( false );
2399 // myAutomaticUpdate = false;
2402 if ( mgr->booleanValue( "SMESH","display_entity", false ) )
2403 action( 10071 )->setOn( true );
2405 action( 10071 )->setOn( false );
2408 SMESH::UpdateSelectionProp( this );
2411 action( 111 )->setEnabled( false ); // IMPORT DAT
2413 //action( 112 )->setEnabled( false );
2414 //parent->menuBar()->setItemEnabled(112, false); // IMPORT UNV
2419 //=============================================================================
2420 /*! Method: BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
2421 * Purpose: ensures that the actor for the given <theIO> exists in the active VTK view
2423 //=============================================================================
2424 void SMESHGUI::BuildPresentation( const Handle(SALOME_InteractiveObject) & theIO,
2425 SUIT_ViewWindow* wnd )
2427 if(theIO->hasEntry()){
2428 //SUIT_ViewWindow* wnd = SMESH::GetActiveWindow();
2429 SMESH::UpdateView(wnd,SMESH::eDisplay,theIO->getEntry());
2433 //=======================================================================
2434 // function : createSMESHAction
2436 //=======================================================================
2437 void SMESHGUI::createSMESHAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle )
2440 QWidget* parent = application()->desktop();
2441 SUIT_ResourceMgr* resMgr = resourceMgr();
2443 if ( icon_id.length() )
2444 pix = resMgr->loadPixmap( "SMESH", tr( icon_id ) );
2446 pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_" )+po_id ), false );
2447 if ( !pix.isNull() )
2448 icon = QIconSet( pix );
2450 QString tooltip = tr( QString( "TOP_" )+po_id ),
2451 menu = tr( QString( "MEN_" )+po_id ),
2452 status_bar = tr( QString( "STB_" )+po_id );
2454 createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) );
2457 //=======================================================================
2458 // function : createPopupItem
2460 //=======================================================================
2461 void SMESHGUI::createPopupItem( const int id,
2462 const QString& clients,
2463 const QString& types,
2464 const QString& theRule,
2469 parentId = popupMgr()->actionId( action( pId ) );
2471 if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) )
2472 popupMgr()->insert( action( id ), parentId, 0 );
2474 QChar lc = QtxPopupMgr::Selection::defEquality();
2475 QString rule = "(%1) and (%2) and (%3)";
2476 rule = rule.arg( QString( "%1>0" ).arg( QtxPopupMgr::Selection::defSelCountParam() ) );
2477 rule = rule.arg( QString( "%1client in {%2}" ).arg( lc ).arg( clients ) );
2478 rule = rule.arg( QString( "%1type in {%2}" ).arg( lc ).arg( types ) );
2481 bool cont = myRules.contains( id );
2483 rule = QString( "%1 or (%2)" ).arg( myRules[ id ] ).arg( rule );
2485 popupMgr()->setRule( action( id ), rule, true );
2486 myRules[ id ] = QString( cont ? "%1" : "(%1)" ).arg( rule );
2489 //=======================================================================
2490 // function : initialize
2492 //=======================================================================
2493 void SMESHGUI::initialize( CAM_Application* app )
2495 SalomeApp_Module::initialize( app );
2497 // SUIT_ResourceMgr* mgr = app->resourceMgr();
2499 /* Automatic Update flag */
2500 // myAutomaticUpdate = mgr->booleanValue( "SMESH", "AutomaticUpdate", myAutomaticUpdate );
2502 // ----- create actions --------------
2504 createSMESHAction( 111, "DAT", "", (CTRL+Key_B) );
2505 createSMESHAction( 112, "UNV", "", (CTRL+Key_U) );
2506 createSMESHAction( 113, "MED", "", (CTRL+Key_M) );
2507 createSMESHAction( 114, "NUM" );
2508 createSMESHAction( 121, "DAT" );
2509 createSMESHAction( 122, "MED" );
2510 createSMESHAction( 123, "UNV" );
2511 createSMESHAction( 124, "EXPORT_DAT" );
2512 createSMESHAction( 125, "EXPORT_MED" );
2513 createSMESHAction( 126, "EXPORT_UNV" );
2514 createSMESHAction( 33, "DELETE", "ICON_DELETE" );
2515 createSMESHAction( 5105, "SEL_FILTER_LIB" );
2516 createSMESHAction( 5000, "CREATE_HYPO", "ICON_HYPO" );
2517 createSMESHAction( 5010, "CREATE_ALG", "ICON_PATTERN_2d" );
2518 createSMESHAction( 701, "COMPUTE", "ICON_COMPUTE" );
2519 createSMESHAction( 702, "LOCAL_HYPO", "ICON_DLG_ADD_SUBMESH" );
2520 createSMESHAction( 703, "GLOBAL_HYPO", "ICON_DLG_INIT_MESH" );
2521 createSMESHAction( 704, "EDIT_HYPO", "ICON_DLG_EDIT_MESH" );
2522 createSMESHAction( 705, "EDIT_GLOBAL_HYPO","ICON_DLG_EDIT_MESH" );
2523 createSMESHAction( 706, "EDIT_LOCAL_HYPO", "ICON_DLG_EDIT_MESH" );
2524 createSMESHAction( 801, "CREATE_GROUP", "ICON_SMESH_TREE_GROUP" );
2525 createSMESHAction( 802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" );
2526 createSMESHAction( 803, "EDIT_GROUP", "ICON_EDIT_GROUP" );
2527 createSMESHAction( 804, "ADD" );
2528 createSMESHAction( 805, "REMOVE" );
2529 createSMESHAction( 810, "UN_GROUP", "ICON_UNION" );
2530 createSMESHAction( 811, "INT_GROUP", "ICON_INTERSECT" );
2531 createSMESHAction( 812, "CUT_GROUP", "ICON_CUT" );
2532 createSMESHAction( 813, "DEL_GROUP", "ICON_DEL_GROUP" );
2533 createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" );
2534 createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" );
2535 createSMESHAction( 6001, "LENGTH", "ICON_LENGTH" , 0, true );
2536 createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE" , 0, true );
2537 createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D" , 0, true );
2538 createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION" , 0, true );
2539 createSMESHAction( 6011, "AREA", "ICON_AREA" , 0, true );
2540 createSMESHAction( 6012, "TAPER", "ICON_TAPER" , 0, true );
2541 createSMESHAction( 6013, "ASPECT", "ICON_ASPECT" , 0, true );
2542 createSMESHAction( 6014, "MIN_ANG", "ICON_ANGLE" , 0, true );
2543 createSMESHAction( 6015, "WARP", "ICON_WARP" , 0, true );
2544 createSMESHAction( 6016, "SKEW", "ICON_SKEW", 0, true );
2545 createSMESHAction( 6017, "ASPECT_3D", "ICON_ASPECT_3D", 0, true );
2546 createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
2547 createSMESHAction( 6019, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
2548 createSMESHAction( 400, "NODE", "ICON_DLG_NODE" );
2549 createSMESHAction( 401, "EDGE", "ICON_DLG_EDGE" );
2550 createSMESHAction( 4021, "TRIANGLE", "ICON_DLG_TRIANGLE" );
2551 createSMESHAction( 4022, "QUAD", "ICON_DLG_QUADRANGLE" );
2552 createSMESHAction( 4023, "POLYGON", "ICON_DLG_POLYGON" );
2553 createSMESHAction( 4031, "TETRA", "ICON_DLG_TETRAS" );
2554 createSMESHAction( 4032, "HEXA", "ICON_DLG_HEXAS" );
2555 createSMESHAction( 4041, "REMOVE_NODES", "ICON_DLG_REM_NODE" );
2556 createSMESHAction( 4042, "REMOVE_ELEMENTS", "ICON_DLG_REM_ELEMENT" );
2557 createSMESHAction( 4051, "RENUM_NODES", "ICON_DLG_RENUMBERING_NODES" );
2558 createSMESHAction( 4052, "RENUM_ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" );
2559 createSMESHAction( 4061, "TRANS", "ICON_SMESH_TRANSLATION_VECTOR" );
2560 createSMESHAction( 4062, "ROT", "ICON_DLG_ROTATION" );
2561 createSMESHAction( 4063, "SYM", "ICON_SMESH_SYMMETRY_PLANE" );
2562 createSMESHAction( 4064, "SEW", "ICON_SMESH_SEWING_FREEBORDERS" );
2563 createSMESHAction( 4065, "MERGE", "ICON_SMESH_MERGE_NODES" );
2564 createSMESHAction( 406, "MOVE", "ICON_DLG_MOVE_NODE" );
2565 createSMESHAction( 407, "INV", "ICON_DLG_MESH_DIAGONAL" );
2566 createSMESHAction( 408, "UNION2", "ICON_UNION2TRI" );
2567 createSMESHAction( 409, "ORIENT", "ICON_DLG_MESH_ORIENTATION" );
2568 createSMESHAction( 410, "UNION", "ICON_UNIONTRI" );
2569 createSMESHAction( 411, "CUT", "ICON_CUTQUAD" );
2570 createSMESHAction( 412, "SMOOTH", "ICON_DLG_SMOOTHING" );
2571 createSMESHAction( 413, "EXTRUSION", "ICON_EXTRUSION" );
2572 createSMESHAction( 414, "REVOLUTION", "ICON_REVOLUTION" );
2573 createSMESHAction( 415, "MAP", "ICON_MAP" );
2574 createSMESHAction( 416, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" );
2575 createSMESHAction( 10001, "WIRE", "ICON_WIRE", 0, true );
2576 createSMESHAction( 10002, "SHADE", "ICON_SHADE", 0, true );
2577 createSMESHAction( 10003, "SHRINK", "ICON_SHRINK", 0, true );
2578 createSMESHAction( 10004, "NODES", "ICON_POINTS", 0, true );
2579 createSMESHAction( 1001, "AUTO_UPD", "", 0, true );
2580 createSMESHAction( 1003, "COLORS" );
2581 createSMESHAction( 1005, "SCALAR_BAR" );
2582 createSMESHAction( 1006, "SELECTION" );
2583 createSMESHAction( 10070, "PRECISION", "", 0, true );
2584 createSMESHAction( 10071, "DISP_ENT", "", 0, true );
2585 createSMESHAction( 200, "RESET" );
2586 createSMESHAction( 201, "SCALAR_BAR_PROP" );
2587 createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true );
2588 createSMESHAction( 212, "SHADE", "ICON_SHADE", 0, true );
2589 createSMESHAction( 213, "SHRINK", "ICON_SHRINK", 0, true );
2590 createSMESHAction( 214, "UPDATE", "ICON_UPDATE" );
2591 createSMESHAction( 215, "NODES", "ICON_POINTS", 0, true );
2592 createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE", 0, true );
2593 createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE", 0, true );
2594 createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
2595 createSMESHAction( 220, "ALL" );
2596 createSMESHAction( 1100, "EDIT_HYPO" );
2597 createSMESHAction( 1101, "RENAME" );
2598 createSMESHAction( 9010, "NUM_NODES", "", 0, true );
2599 createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true );
2600 createSMESHAction( 1131, "DISPMODE" );
2601 createSMESHAction( 1132, "COLORS" );
2602 createSMESHAction( 1133, "TRANSP" );
2603 createSMESHAction( 1134, "CLIP" );
2604 createSMESHAction( 1135, "DISP_ENT" );
2605 createSMESHAction( 2000, "CTRL" );
2607 createSMESHAction( 300, "ERASE" );
2608 createSMESHAction( 301, "DISPLAY" );
2609 createSMESHAction( 302, "DISPLAY_ONLY" );
2610 createSMESHAction( 4033, "POLYHEDRON", "ICON_DLG_POLYHEDRON" );
2612 // ----- create menu --------------
2613 int fileId = createMenu( tr( "MEN_FILE" ), -1, 1 ),
2614 editId = createMenu( tr( "MEN_EDIT" ), -1, 3 ),
2615 toolsId = createMenu( tr( "MEN_TOOLS" ), -1, 5, 10 ),
2616 hypoId = createMenu( tr( "MEN_HYPO" ), -1, 50, 10 ),
2617 meshId = createMenu( tr( "MEN_MESH" ), -1, 70, 10 ),
2618 ctrlId = createMenu( tr( "MEN_CTRL" ), -1, 60, 10 ),
2619 modifyId = createMenu( tr( "MEN_MODIFY" ), -1, 40, 10 ),
2620 prefId = createMenu( tr( "MEN_PREF" ), -1, 4, 10 ),
2621 viewId = createMenu( tr( "MEN_VIEW" ), -1, 2 );
2623 createMenu( separator(), fileId );
2625 int importId = createMenu( tr( "MEN_IMPORT" ), fileId, 11, 10 ),
2626 exportId = createMenu( tr( "MEN_EXPORT" ), fileId, 12, 10 ),
2628 addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ),
2629 removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
2630 renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
2631 transfId = createMenu( tr( "MEN_TRANSF" ), modifyId, 405 ),
2633 meshPrefId = createMenu( tr( "MEN_MESH" ), prefId, 100 ),
2635 dispModeId = createMenu( tr( "MEN_DISPMODE" ), meshPrefId, 1000 ),
2636 qualityId = createMenu( tr( "MEN_QUALITY" ), meshPrefId, 1007 );
2638 createMenu( 111, importId, -1 );
2639 createMenu( 112, importId, -1 );
2640 createMenu( 113, importId, -1 );
2642 createMenu( 121, exportId, -1 );
2643 createMenu( 122, exportId, -1 );
2644 createMenu( 123, exportId, -1 );
2646 createMenu( separator(), fileId, 10 );
2648 createMenu( 33, editId, -1 );
2650 createMenu( 5105, toolsId, -1 );
2652 createMenu( 5000, hypoId, -1 );
2653 createMenu( 5010, hypoId, -1 );
2655 createMenu( 703, meshId, -1 );
2656 createMenu( 702, meshId, -1 );
2657 createMenu( 704, meshId, -1 );
2658 createMenu( separator(), meshId, -1 );
2659 createMenu( 701, meshId, -1 );
2660 createMenu( separator(), meshId, -1 );
2661 createMenu( 801, meshId, -1 );
2662 createMenu( 802, meshId, -1 );
2663 createMenu( 803, meshId, -1 );
2664 createMenu( separator(), meshId, -1 );
2665 createMenu( 810, meshId, -1 );
2666 createMenu( 811, meshId, -1 );
2667 createMenu( 812, meshId, -1 );
2668 createMenu( separator(), meshId, -1 );
2669 createMenu( 813, meshId, -1 );
2670 createMenu( separator(), meshId, -1 );
2671 createMenu( 900, meshId, -1 );
2672 createMenu( 902, meshId, -1 );
2673 createMenu( separator(), meshId, -1 );
2675 createMenu( 6003, ctrlId, -1 );
2676 createMenu( 6001, ctrlId, -1 );
2677 createMenu( 6004, ctrlId, -1 );
2678 createMenu( separator(), ctrlId, -1 );
2679 createMenu( 6002, ctrlId, -1 );
2680 createMenu( 6018, ctrlId, -1 );
2681 createMenu( 6019, ctrlId, -1 );
2682 createMenu( 6011, ctrlId, -1 );
2683 createMenu( 6012, ctrlId, -1 );
2684 createMenu( 6013, ctrlId, -1 );
2685 createMenu( 6014, ctrlId, -1 );
2686 createMenu( 6015, ctrlId, -1 );
2687 createMenu( 6016, ctrlId, -1 );
2688 createMenu( separator(), ctrlId, -1 );
2689 createMenu( 6017, ctrlId, -1 );
2690 createMenu( separator(), ctrlId, -1 );
2692 createMenu( 400, addId, -1 );
2693 createMenu( 401, addId, -1 );
2694 createMenu( 4021, addId, -1 );
2695 createMenu( 4022, addId, -1 );
2696 createMenu( 4023, addId, -1 );
2697 createMenu( 4031, addId, -1 );
2698 createMenu( 4032, addId, -1 );
2699 createMenu( 4033, addId, -1 );
2701 createMenu( 4041, removeId, -1 );
2702 createMenu( 4042, removeId, -1 );
2704 createMenu( 4051, renumId, -1 );
2705 createMenu( 4052, renumId, -1 );
2707 createMenu( 4061, transfId, -1 );
2708 createMenu( 4062, transfId, -1 );
2709 createMenu( 4063, transfId, -1 );
2710 createMenu( 4064, transfId, -1 );
2711 createMenu( 4065, transfId, -1 );
2713 createMenu( 406, modifyId, -1 );
2714 createMenu( 407, modifyId, -1 );
2715 createMenu( 408, modifyId, -1 );
2716 createMenu( 409, modifyId, -1 );
2717 createMenu( 410, modifyId, -1 );
2718 createMenu( 411, modifyId, -1 );
2719 createMenu( 412, modifyId, -1 );
2720 createMenu( 413, modifyId, -1 );
2721 createMenu( 416, modifyId, -1 );
2722 createMenu( 414, modifyId, -1 );
2723 createMenu( 415, modifyId, -1 );
2725 createMenu( 10001, dispModeId, -1 );
2726 createMenu( 10002, dispModeId, -1 );
2727 createMenu( 10004, dispModeId, -1 );
2728 createMenu( 10003, dispModeId, -1 );
2730 createMenu( 1001, prefId, -1 );
2731 createMenu( separator(), prefId, -1 );
2732 createMenu( 1003, prefId, -1 );
2733 createMenu( separator(), prefId, -1 );
2734 createMenu( 1005, prefId, -1 );
2735 createMenu( separator(), prefId, -1 );
2736 createMenu( 1006, prefId, -1 );
2737 createMenu( separator(), prefId, -1 );
2739 createMenu( 10070, qualityId, -1 );
2740 createMenu( 10071, qualityId, -1 );
2742 createMenu( separator(), prefId, -1 );
2744 createMenu( 214, viewId, -1 );
2746 // ----- create toolbars --------------
2747 int meshTb = createTool( tr( "TB_MESH" ) ),
2748 hypoTb = createTool( tr( "TB_HYPO" ) ),
2749 ctrlTb = createTool( tr( "TB_CTRL" ) ),
2750 addRemTb = createTool( tr( "TB_ADD_REMOVE" ) ),
2751 modifyTb = createTool( tr( "TB_MODIFY" ) ),
2752 dispModeTb = createTool( tr( "TB_DISP_MODE" ) );
2754 createTool( 703, meshTb );
2755 createTool( 702, meshTb );
2756 createTool( 704, meshTb );
2757 createTool( separator(), meshTb );
2758 createTool( 701, meshTb );
2759 createTool( separator(), meshTb );
2760 createTool( 801, meshTb );
2761 createTool( 802, meshTb );
2762 createTool( 803, meshTb );
2763 createTool( separator(), meshTb );
2764 createTool( 900, meshTb );
2765 createTool( 902, meshTb );
2766 createTool( separator(), meshTb );
2768 createTool( 5000, hypoTb );
2769 createTool( 5010, hypoTb );
2771 createTool( 6001, ctrlTb );
2772 createTool( 6003, ctrlTb );
2773 createTool( 6004, ctrlTb );
2774 createTool( separator(), ctrlTb );
2775 createTool( 6002, ctrlTb );
2776 createTool( 6018, ctrlTb );
2777 createTool( 6019, ctrlTb );
2778 createTool( 6011, ctrlTb );
2779 createTool( 6012, ctrlTb );
2780 createTool( 6013, ctrlTb );
2781 createTool( 6014, ctrlTb );
2782 createTool( 6015, ctrlTb );
2783 createTool( 6016, ctrlTb );
2784 createTool( separator(), ctrlTb );
2785 createTool( 6017, ctrlTb );
2786 createTool( separator(), ctrlTb );
2788 createTool( 400, addRemTb );
2789 createTool( 401, addRemTb );
2790 createTool( 4021, addRemTb );
2791 createTool( 4022, addRemTb );
2792 createTool( 4023, addRemTb );
2793 createTool( 4031, addRemTb );
2794 createTool( 4032, addRemTb );
2795 createTool( 4033, addRemTb );
2796 createTool( separator(), addRemTb );
2797 createTool( 4041, addRemTb );
2798 createTool( 4042, addRemTb );
2799 createTool( separator(), addRemTb );
2800 createTool( 4051, addRemTb );
2801 createTool( 4052, addRemTb );
2802 createTool( separator(), addRemTb );
2803 createTool( 4061, addRemTb );
2804 createTool( 4062, addRemTb );
2805 createTool( 4063, addRemTb );
2806 createTool( 4064, addRemTb );
2807 createTool( 4065, addRemTb );
2808 createTool( separator(), addRemTb );
2810 createTool( 406, modifyTb );
2811 createTool( 407, modifyTb );
2812 createTool( 408, modifyTb );
2813 createTool( 409, modifyTb );
2814 createTool( 410, modifyTb );
2815 createTool( 411, modifyTb );
2816 createTool( 412, modifyTb );
2817 createTool( 413, modifyTb );
2818 createTool( 416, modifyTb );
2819 createTool( 414, modifyTb );
2820 createTool( 415, modifyTb );
2822 createTool( 214, dispModeTb );
2826 QString OB = "'ObjectBrowser'",
2827 View = "'" + SVTK_Viewer::Type() + "'",
2829 mesh = pat.arg( SMESHGUI_Selection::typeName( MESH ) ),
2830 group = pat.arg( SMESHGUI_Selection::typeName( GROUP ) ),
2831 hypo = pat.arg( SMESHGUI_Selection::typeName( HYPOTHESIS ) ),
2832 algo = pat.arg( SMESHGUI_Selection::typeName( ALGORITHM ) ),
2833 elems = QString( "'%1' '%2' '%3' '%4' '%5'" ).
2834 arg( SMESHGUI_Selection::typeName( SUBMESH_VERTEX ) ).
2835 arg( SMESHGUI_Selection::typeName( SUBMESH_EDGE ) ).
2836 arg( SMESHGUI_Selection::typeName( SUBMESH_FACE ) ).
2837 arg( SMESHGUI_Selection::typeName( SUBMESH_SOLID ) ).
2838 arg( SMESHGUI_Selection::typeName( SUBMESH_COMPOUND ) ),
2840 mesh_group = mesh + " " + subMesh + " " + group,
2841 hyp_alg = hypo + " " + algo;
2843 // popup for object browser
2845 createPopupItem( 705, OB, mesh, "&& isComputable"); // EDIT_GLOBAL_HYPO
2846 createPopupItem( 706, OB, subMesh, "&& isComputable" ); // EDIT_LOCAL_HYPO
2847 createPopupItem( 803, OB, group ); // EDIT_GROUP
2848 popupMgr()->insert( separator(), -1, 0 );
2849 createPopupItem( 701, OB, mesh, "&& isComputable" ); // COMPUTE
2850 createPopupItem( 214, OB, mesh_group ); // UPDATE
2851 createPopupItem( 900, OB, mesh_group ); // ADV_INFO
2852 createPopupItem( 902, OB, mesh ); // STD_INFO
2853 popupMgr()->insert( separator(), -1, 0 );
2854 createPopupItem( 801, OB, mesh ); // CREATE_GROUP
2855 createPopupItem( 802, OB, subMesh ); // CONSTRUCT_GROUP
2856 popupMgr()->insert( separator(), -1, 0 );
2857 createPopupItem( 1100, OB, hypo ); // EDIT HYPOTHESIS
2858 createPopupItem( 1102, OB, hyp_alg, "&& hasReference" ); // REMOVE HYPOTHESIS / ALGORITHMS
2859 createPopupItem( 1101, OB, mesh_group + " " + hyp_alg ); // RENAME
2860 popupMgr()->insert( separator(), -1, 0 );
2861 createPopupItem( 125, OB, mesh ); // EXPORT_MED
2862 createPopupItem( 126, OB, mesh ); // EXPORT_UNV
2863 createPopupItem( 33, OB, subMesh + " " + group ); // DELETE
2864 popupMgr()->insert( separator(), -1, 0 );
2867 createPopupItem( 803, View, group ); // EDIT_GROUP
2868 createPopupItem( 804, View, elems ); // ADD
2869 createPopupItem( 805, View, elems ); // REMOVE
2870 popupMgr()->insert( separator(), -1, 0 );
2871 createPopupItem( 214, View, mesh_group ); // UPDATE
2872 createPopupItem( 900, View, mesh_group ); // ADV_INFO
2873 createPopupItem( 902, View, mesh ); // STD_INFO
2874 popupMgr()->insert( separator(), -1, 0 );
2878 isInvisible("not( isVisible )"),
2879 isEmpty("numberOfNodes = 0"),
2880 isNotEmpty("numberOfNodes <> 0"),
2882 // has nodes, edges, etc in VISIBLE! actor
2883 hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
2884 hasElems("(count( elemTypes ) > 0)"),
2885 hasDifferentElems("(count( elemTypes ) > 1)"),
2886 hasEdges("({'Edge'} in elemTypes)"),
2887 hasFaces("({'Face'} in elemTypes)"),
2888 hasVolumes("({'Volume'} in elemTypes)");
2890 QString aSelCount = QString( "%1 = 1" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
2891 QString lc = QtxPopupMgr::Selection::defEquality();
2892 QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
2893 QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( mesh_group );
2894 QString aMeshInVTK = aClient + "&&" + aType;// + "&&" + aSelCount;
2896 //-------------------------------------------------
2898 //-------------------------------------------------
2899 anId = popupMgr()->insert( tr( "MEN_NUM" ), -1, -1 );
2901 popupMgr()->insert( action( 9010 ), anId, -1 );
2902 popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&&" + hasNodes, true );
2903 popupMgr()->setRule( action( 9010 ), "{'Point'} in labeledTypes", false );
2905 popupMgr()->insert( action( 9011 ), anId, -1 );
2906 popupMgr()->setRule( action( 9011 ), aMeshInVTK + "&&" + hasElems, true );
2907 popupMgr()->setRule( action( 9011 ), "{'Cell'} in labeledTypes", false );
2909 popupMgr()->insert( separator(), -1, -1 );
2911 //-------------------------------------------------
2913 //-------------------------------------------------
2914 anId = popupMgr()->insert( tr( "MEN_DISPMODE" ), -1, -1 );
2916 popupMgr()->insert( action( 211 ), anId, -1 ); // WIRE
2917 popupMgr()->setRule( action( 211 ), aMeshInVTK + "&&" + hasElems, true );
2918 popupMgr()->setRule( action( 211 ), "displayMode = 'eEdge'", false );
2920 popupMgr()->insert( action( 212 ), anId, -1 ); // SHADE
2921 popupMgr()->setRule( action( 212 ),aMeshInVTK+ "&& (" + hasFaces + "||" + hasVolumes + ")",true);
2922 popupMgr()->setRule( action( 212 ), "displayMode = 'eSurface'", false );
2924 popupMgr()->insert( action( 215 ), anId, -1 ); // POINTS
2925 popupMgr()->setRule( action( 215 ), aMeshInVTK + "&&" + hasNodes, true );
2926 popupMgr()->setRule( action( 215 ), "displayMode = 'ePoint'", false );
2928 popupMgr()->insert( separator(), anId, -1 );
2930 popupMgr()->insert( action( 213 ), anId, -1 ); // SHRINK
2931 popupMgr()->setRule( action( 213 ), aMeshInVTK + "&& shrinkMode <> 'IsNotShrinkable' && displayMode <> 'ePoint'",true);
2932 popupMgr()->setRule( action( 213 ), "shrinkMode = 'IsShrunk'", false );
2934 //-------------------------------------------------
2936 //-------------------------------------------------
2937 QString aDiffElemsInVTK = aMeshInVTK + "&&" + hasDifferentElems;
2939 anId = popupMgr()->insert( tr( "MEN_DISP_ENT" ), -1, -1 );
2941 popupMgr()->insert( action( 217 ), anId, -1 ); // EDGES
2942 popupMgr()->setRule( action( 217 ), aDiffElemsInVTK + "&&" + hasEdges, true );
2943 popupMgr()->setRule( action( 217 ), "{'Edge'} in entityMode", false );
2945 popupMgr()->insert( action( 218 ), anId, -1 ); // FACES
2946 popupMgr()->setRule( action( 218 ), aDiffElemsInVTK + "&&" + hasFaces, true );
2947 popupMgr()->setRule( action( 218 ), "{'Face'} in entityMode", false );
2949 popupMgr()->insert( action( 219 ), anId, -1 ); // VOLUMES
2950 popupMgr()->setRule( action( 219 ), aDiffElemsInVTK + "&&" + hasVolumes, true );
2951 popupMgr()->setRule( action( 219 ), "{'Volume'} in entityMode", false );
2953 popupMgr()->insert( separator(), anId, -1 );
2955 popupMgr()->insert( action( 220 ), anId, -1 ); // ALL
2956 popupMgr()->setRule( action( 220 ), aDiffElemsInVTK + "&& not( elemTypes in entityMode )", true );
2958 //-------------------------------------------------
2960 //-------------------------------------------------
2961 popupMgr()->insert( action( 1132 ), -1, -1 );
2962 popupMgr()->setRule( action( 1132 ), aMeshInVTK + "&& isVisible", true );
2964 //-------------------------------------------------
2966 //-------------------------------------------------
2967 popupMgr()->insert( action( 1133 ), -1, -1 );
2968 popupMgr()->setRule( action( 1133 ), aMeshInVTK + "&& isVisible", true );
2970 //-------------------------------------------------
2972 //-------------------------------------------------
2973 popupMgr()->insert( action( 1134 ), -1, -1 );
2974 popupMgr()->setRule( action( 1134 ), aMeshInVTK + "&& isVisible", true );
2976 popupMgr()->insert( separator(), -1, -1 );
2978 //-------------------------------------------------
2980 //-------------------------------------------------
2982 aMeshInVtkHasEdges = aMeshInVTK + "&&" + hasEdges,
2983 aMeshInVtkHasFaces = aMeshInVTK + "&&" + hasFaces,
2984 aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes;
2986 anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 );
2988 popupMgr()->insert( action( 200 ), anId, -1 ); // RESET
2989 popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", true );
2991 popupMgr()->insert( separator(), anId, -1 );
2993 popupMgr()->insert( action( 6003 ), anId, -1 ); // FREE_BORDER
2994 popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, true );
2995 popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeEdges'", false );
2997 popupMgr()->insert( action( 6001 ), anId, -1 ); // LENGTH
2998 popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, true );
2999 popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", false );
3001 popupMgr()->insert( action( 6004 ), anId, -1 ); // CONNECTION
3002 popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, true );
3003 popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", false );
3005 popupMgr()->insert( separator(), anId, -1 );
3007 popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE
3008 popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, true );
3009 popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeBorders'", false );
3011 popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D
3012 popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, true );
3013 popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", false );
3015 popupMgr()->insert( action( 6019 ), anId, -1 ); // CONNECTION_2D
3016 popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, true );
3017 popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", false );
3019 popupMgr()->insert( action( 6011 ), anId, -1 ); // AREA
3020 popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, true );
3021 popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", false );
3023 popupMgr()->insert( action( 6012 ), anId, -1 ); // TAPER
3024 popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, true );
3025 popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", false );
3027 popupMgr()->insert( action( 6013 ), anId, -1 ); // ASPECT
3028 popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, true );
3029 popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", false );
3031 popupMgr()->insert( action( 6014 ), anId, -1 ); // MIN_ANG
3032 popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, true );
3033 popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", false );
3035 popupMgr()->insert( action( 6015 ), anId, -1 ); // WARP
3036 popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, true );
3037 popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", false );
3039 popupMgr()->insert( action( 6016 ), anId, -1 ); // SKEW
3040 popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, true );
3041 popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", false );
3043 popupMgr()->insert( separator(), anId, -1 );
3045 popupMgr()->insert( action( 6017 ), anId, -1 ); // ASPECT_3D
3046 popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, true );
3047 popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", false );
3049 popupMgr()->insert( separator(), anId, -1 );
3051 popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP
3052 popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", true );
3054 popupMgr()->insert( separator(), -1, -1 );
3056 //-------------------------------------------------
3058 //-------------------------------------------------
3059 aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
3060 QString anActiveVTK = QString("activeView = '%1'").arg(VTKViewer_Viewer::Type());
3061 QString aRule = aClient + " and " + aType + " and " + aSelCount + " and " + anActiveVTK;
3062 popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
3063 popupMgr()->setRule( action( 301 ), aRule + "&&" + isNotEmpty + "&&" + isInvisible, true);
3065 popupMgr()->insert( action( 300 ), -1, -1 ); // ERASE
3066 popupMgr()->setRule( action( 300 ), aRule + "&&" + isNotEmpty + "&& isVisible", true );
3068 popupMgr()->insert( action( 302 ), -1, -1 ); // DISPLAY_ONLY
3069 popupMgr()->setRule( action( 302 ), aRule + "&&" + isNotEmpty, true );
3071 popupMgr()->insert( separator(), -1, -1 );
3073 connect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
3074 this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
3077 bool SMESHGUI::activateModule( SUIT_Study* study )
3079 bool res = SalomeApp_Module::activateModule( study );
3081 setMenuShown( true );
3082 setToolShown( true );
3083 SetSettings( desktop() );
3088 bool SMESHGUI::deactivateModule( SUIT_Study* study )
3090 setMenuShown( false );
3091 setToolShown( false );
3093 EmitSignalCloseAllDialogs();
3095 return SalomeApp_Module::deactivateModule( study );
3098 void SMESHGUI::OnGUIEvent()
3100 const QObject* obj = sender();
3101 if ( !obj || !obj->inherits( "QAction" ) )
3103 int id = actionId((QAction*)obj);
3108 SMESH::SMESH_Gen_var SMESHGUI::GetSMESHGen()
3110 if ( CORBA::is_nil( myComponentSMESH ) )
3112 SMESHGUI aGUI; //SRN BugID: IPAL9186: Create an instance of SMESHGUI to initialize myComponentSMESH
3113 return aGUI.myComponentSMESH;
3115 return myComponentSMESH;
3118 QString SMESHGUI::engineIOR() const
3120 CORBA::ORB_var anORB = getApp()->orb();
3121 CORBA::String_var anIOR = anORB->object_to_string(GetSMESHGen());
3125 void SMESHGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ )
3127 SMESHGUI_Selection sel;
3128 sel.init( client, selectionMgr() );
3129 popupMgr()->updatePopup( menu, &sel );
3132 void SMESHGUI::windows( QMap<int, int>& aMap ) const
3134 aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::DockLeft );
3135 aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::DockBottom );
3138 void SMESHGUI::viewManagers( QStringList& list ) const
3140 list.append( SVTK_Viewer::Type() );
3143 void SMESHGUI::onViewManagerAdded( SUIT_ViewManager* mgr )
3145 if ( dynamic_cast<VTKViewer_ViewManager*>( mgr ) )
3146 SMESH::UpdateSelectionProp( this );
3149 void SMESHGUI::createPreferences()
3151 int genTab = addPreference( tr( "PREF_TAB_GENERAL" ) );
3153 int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab );
3154 addPreference( tr( "PREF_DISPLAY_ENTITY" ), qaGroup, SalomeApp_Preferences::Bool, "Mesh", "display_entity" );
3155 addPreference( tr( "PREF_AUTO_UPDATE" ), qaGroup, SalomeApp_Preferences::Bool, "Mesh", "auto_update" );
3157 int precGroup = addPreference( tr( "PREF_GROUP_PRECISION" ), genTab );
3158 setPreferenceProperty( precGroup, "columns", 1 );
3160 addPreference( tr( "PREF_PRECISION_USE" ), precGroup, SalomeApp_Preferences::Bool );
3161 int prec = addPreference( tr( "PREF_PRECISION_VALUE" ), precGroup, SalomeApp_Preferences::IntSpin, "SMESH", "controls_precision" );
3163 setPreferenceProperty( prec, "min", 0 );
3164 setPreferenceProperty( prec, "max", 16 );
3166 int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
3167 int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
3169 addPreference( tr( "PREF_COLOR" ), nodeGroup, SalomeApp_Preferences::Color, "SMESH", "node_color" );
3170 int nodeSz = addPreference( tr( "PREF_SIZE" ), nodeGroup, SalomeApp_Preferences::IntSpin, "SMESH", "node_size" );
3172 setPreferenceProperty( nodeSz, "min", 1 );
3173 setPreferenceProperty( nodeSz, "max", 5 );
3175 int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab );
3177 addPreference( tr( "PREF_FILL" ), elemGroup, SalomeApp_Preferences::Color, "SMESH", "fill_color" );
3178 addPreference( tr( "PREF_OUTLINE" ), elemGroup, SalomeApp_Preferences::Color, "SMESH", "outline_color" );
3179 addPreference( tr( "PREF_BACKFACE" ), elemGroup, SalomeApp_Preferences::Color, "SMESH", "backface_color" );
3180 addPreference( "", elemGroup, SalomeApp_Preferences::Space );
3182 int elemW = addPreference( tr( "PREF_WIDTH" ), elemGroup, SalomeApp_Preferences::IntSpin, "SMESH", "element_width" );
3183 int shrink = addPreference( tr( "PREF_SHRINK_COEFF" ), elemGroup, SalomeApp_Preferences::IntSpin, "SMESH", "shrink_coeff" );
3185 setPreferenceProperty( elemW, "min", 1 );
3186 setPreferenceProperty( elemW, "max", 5 );
3188 setPreferenceProperty( shrink, "min", 0 );
3189 setPreferenceProperty( shrink, "max", 100 );
3191 int selTab = addPreference( tr( "PREF_TAB_SELECTION" ) );
3193 int selGroup = addPreference( tr( "PREF_GROUP_SELECTION" ), selTab );
3195 addPreference( tr( "PREF_OBJECT_COLOR" ), selGroup, SalomeApp_Preferences::Color, "SMESH", "selection_object_color" );
3196 addPreference( tr( "PREF_ELEMENT_COLOR" ), selGroup, SalomeApp_Preferences::Color, "SMESH", "selection_element_color" );
3197 int selW = addPreference( tr( "PREF_WIDTH" ), selGroup, SalomeApp_Preferences::IntSpin, "SMESH", "selection_width" );
3199 setPreferenceProperty( selW, "min", 1 );
3200 setPreferenceProperty( selW, "max", 5 );
3202 int preGroup = addPreference( tr( "PREF_GROUP_PRESELECTION" ), selTab );
3204 addPreference( tr( "PREF_HIGHLIGHT_COLOR" ), preGroup, SalomeApp_Preferences::Color, "SMESH", "highlight_color" );
3205 int preW = addPreference( tr( "PREF_WIDTH" ), preGroup, SalomeApp_Preferences::IntSpin, "SMESH", "highlight_width" );
3207 setPreferenceProperty( preW, "min", 1 );
3208 setPreferenceProperty( preW, "max", 5 );
3210 int precSelGroup = addPreference( tr( "PREF_GROUP_PRECISION" ), selTab );
3212 addPreference( tr( "PREF_NODES" ), precSelGroup, SalomeApp_Preferences::Double, "SMESH", "selection_precision_node" );
3213 addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, SalomeApp_Preferences::Double, "SMESH", "selection_precision_element" );
3215 int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
3216 int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
3218 int tfont = addPreference( tr( "SMESH_TITLE" ), fontGr, SalomeApp_Preferences::Font, "SMESH", "scalar_bar_title_font" );
3219 addPreference( tr( "SMESH_TITLE" ), fontGr, SalomeApp_Preferences::Color, "SMESH", "scalar_bar_title_color" );
3220 int lfont = addPreference( tr( "SMESH_LABELS" ), fontGr, SalomeApp_Preferences::Font, "SMESH", "scalar_bar_label_font" );
3221 addPreference( tr( "SMESH_LABELS" ), fontGr, SalomeApp_Preferences::Color, "SMESH", "scalar_bar_label_color" );
3224 fam.append( tr( "SMESH_FONT_ARIAL" ) );
3225 fam.append( tr( "SMESH_FONT_COURIER" ) );
3226 fam.append( tr( "SMESH_FONT_TIMES" ) );
3227 int wflag = ( QtxListResourceEdit::FontItem::All & ( ~( QtxListResourceEdit::FontItem::Size | QtxListResourceEdit::FontItem::UserSize ) ) );
3229 setPreferenceProperty( tfont, "families", fam );
3230 setPreferenceProperty( tfont, "system", false );
3231 setPreferenceProperty( tfont, "widget_flags", wflag );
3232 setPreferenceProperty( lfont, "families", fam );
3233 setPreferenceProperty( lfont, "system", false );
3234 setPreferenceProperty( lfont, "widget_flags", wflag );
3236 int colorsLabelsGr = addPreference( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), sbarTab );
3238 int numcol = addPreference( tr( "SMESH_NUMBEROFCOLORS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "SMESH", "scalar_bar_num_colors" );
3239 setPreferenceProperty( numcol, "min", 2 );
3240 setPreferenceProperty( numcol, "max", 256 );
3242 int numlab = addPreference( tr( "SMESH_NUMBEROFLABELS" ), colorsLabelsGr, SalomeApp_Preferences::IntSpin, "SMESH", "scalar_bar_num_labels" );
3243 setPreferenceProperty( numlab, "min", 2 );
3244 setPreferenceProperty( numlab, "max", 65 );
3246 int orientGr = addPreference( tr( "SMESH_ORIENTATION" ), sbarTab );
3247 int orient = addPreference( tr( "SMESH_ORIENTATION" ), orientGr, SalomeApp_Preferences::Selector, "SMESH", "scalar_bar_orientation" );
3248 QStringList orients;
3249 orients.append( tr( "SMESH_VERTICAL" ) );
3250 orients.append( tr( "SMESH_HORIZONTAL" ) );
3251 QValueList<QVariant> indices; indices.append( 0 ); indices.append( 1 );
3252 setPreferenceProperty( orient, "strings", orients );
3253 setPreferenceProperty( orient, "indexes", indices );
3255 int posVSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_VERTICAL" ), sbarTab );
3256 int xv = addPreference( tr( "SMESH_X_SCALARBAR" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_x" );
3257 int yv = addPreference( tr( "SMESH_Y_SCALARBAR" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_y" );
3258 int wv = addPreference( tr( "SMESH_WIDTH" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_width" );
3259 int hv = addPreference( tr( "SMESH_HEIGHT" ), posVSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_height" );
3260 setPreferenceProperty( xv, "step", 0.1 );
3261 setPreferenceProperty( yv, "step", 0.1 );
3262 setPreferenceProperty( wv, "step", 0.1 );
3263 setPreferenceProperty( hv, "step", 0.1 );
3265 int posHSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_HORIZONTAL" ), sbarTab );
3266 int xh = addPreference( tr( "SMESH_X_SCALARBAR" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_x" );
3267 int yh = addPreference( tr( "SMESH_Y_SCALARBAR" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_y" );
3268 int wh = addPreference( tr( "SMESH_WIDTH" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_width" );
3269 int hh = addPreference( tr( "SMESH_HEIGHT" ), posHSizeGr, SalomeApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_height" );
3270 setPreferenceProperty( xh, "step", 0.1 );
3271 setPreferenceProperty( yh, "step", 0.1 );
3272 setPreferenceProperty( wh, "step", 0.1 );
3273 setPreferenceProperty( hh, "step", 0.1 );
3276 void SMESHGUI::preferencesChanged( const QString&, const QString& )