1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESHGUI.cxx
23 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
25 #include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
27 #undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
32 #include "SMESHGUI_AddMeshElementDlg.h"
33 #include "SMESHGUI_AddQuadraticElementDlg.h"
34 #include "SMESHGUI_BuildCompoundDlg.h"
35 #include "SMESHGUI_ClippingDlg.h"
36 #include "SMESHGUI_ComputeDlg.h"
37 #include "SMESHGUI_ConvToQuadOp.h"
38 #include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
39 #include "SMESHGUI_DeleteGroupDlg.h"
40 #include "SMESHGUI_Displayer.h"
41 #include "SMESHGUI_MergeDlg.h"
42 #include "SMESHGUI_ExtrusionAlongPathDlg.h"
43 #include "SMESHGUI_ExtrusionDlg.h"
44 #include "SMESHGUI_FileInfoDlg.h"
45 #include "SMESHGUI_FileValidator.h"
46 #include "SMESHGUI_FilterDlg.h"
47 #include "SMESHGUI_FilterLibraryDlg.h"
48 #include "SMESHGUI_FindElemByPointDlg.h"
49 #include "SMESHGUI_GroupDlg.h"
50 #include "SMESHGUI_GroupOnShapeDlg.h"
51 #include "SMESHGUI_GroupOpDlg.h"
52 #include "SMESHGUI_Hypotheses.h"
53 #include "SMESHGUI_Make2DFrom3DOp.h"
54 #include "SMESHGUI_MakeNodeAtPointDlg.h"
55 #include "SMESHGUI_Measurements.h"
56 #include "SMESHGUI_MeshInfo.h"
57 #include "SMESHGUI_MeshOp.h"
58 #include "SMESHGUI_MeshOrderOp.h"
59 #include "SMESHGUI_MeshPatternDlg.h"
60 #include "SMESHGUI_MultiEditDlg.h"
61 #include "SMESHGUI_NodesDlg.h"
62 #include "SMESHGUI_Preferences_ColorDlg.h"
63 #include "SMESHGUI_Preferences_ScalarBarDlg.h"
64 #include "SMESHGUI_RemoveElementsDlg.h"
65 #include "SMESHGUI_RemoveNodesDlg.h"
66 #include "SMESHGUI_RenumberingDlg.h"
67 #include "SMESHGUI_RevolutionDlg.h"
68 #include "SMESHGUI_RotationDlg.h"
69 #include "SMESHGUI_Selection.h"
70 #include "SMESHGUI_SewingDlg.h"
71 #include "SMESHGUI_SingleEditDlg.h"
72 #include "SMESHGUI_SmoothingDlg.h"
73 #include "SMESHGUI_SymmetryDlg.h"
74 #include "SMESHGUI_TranslationDlg.h"
75 #include "SMESHGUI_ScaleDlg.h"
76 #include "SMESHGUI_TransparencyDlg.h"
77 #include "SMESHGUI_DuplicateNodesDlg.h"
78 #include "SMESHGUI_CopyMeshDlg.h"
79 #include "SMESHGUI_ReorientFacesDlg.h"
81 #include "SMESHGUI_Utils.h"
82 #include "SMESHGUI_MeshUtils.h"
83 #include "SMESHGUI_GroupUtils.h"
84 #include "SMESHGUI_FilterUtils.h"
85 #include "SMESHGUI_PatternUtils.h"
86 #include "SMESHGUI_VTKUtils.h"
87 #include "SMESHGUI_HypothesesUtils.h"
89 #include <SMESH_version.h>
91 #include <SMESH_Client.hxx>
92 #include <SMESH_Actor.h>
93 #include <SMESH_ScalarBarActor.h>
94 #include <SMESH_ActorUtils.h>
95 #include <SMESH_TypeFilter.hxx>
96 #include "SMESH_ControlsDef.hxx"
98 // SALOME GUI includes
99 #include <SalomeApp_Tools.h>
100 #include <SalomeApp_Study.h>
101 #include <SalomeApp_Application.h>
102 #include <SalomeApp_CheckFileDlg.h>
103 #include <SalomeApp_DataObject.h>
105 #include <LightApp_DataOwner.h>
106 #include <LightApp_Preferences.h>
107 #include <LightApp_SelectionMgr.h>
108 #include <LightApp_UpdateFlags.h>
109 #include <LightApp_NameDlg.h>
111 #include <SVTK_ViewWindow.h>
112 #include <SVTK_ViewModel.h>
113 #include <SVTK_ViewManager.h>
115 #include <VTKViewer_Algorithm.h>
117 #include <SUIT_MessageBox.h>
118 #include <SUIT_ResourceMgr.h>
119 #include <SUIT_FileDlg.h>
120 #include <SUIT_Desktop.h>
121 #include <SUIT_OverrideCursor.h>
122 #include <SUIT_Session.h>
124 #include <QtxPopupMgr.h>
125 #include <QtxFontEdit.h>
127 #include <SALOME_ListIO.hxx>
128 #include <SALOME_ListIteratorOfListIO.hxx>
130 #ifndef DISABLE_PLOT2DVIEWER
131 #include <SPlot2d_ViewModel.h>
132 #include <SPlot2d_Histogram.h>
136 #include <SALOMEconfig.h>
137 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
138 #include CORBA_CLIENT_HEADER(SMESH_MeshEditor)
139 #include CORBA_CLIENT_HEADER(SMESH_Measurements)
142 // #define INCLUDE_MENUITEM_DEF // VSR commented ????????
143 #include <QApplication>
145 #include <QTextStream>
148 #include <boost/shared_ptr.hpp>
151 #include <vtkCamera.h>
152 #include <vtkRenderer.h>
153 #include <vtkPlane.h>
154 #include <vtkCallbackCommand.h>
155 #include <vtkLookupTable.h>
157 // SALOME KERNEL includes
158 #include <SALOMEDS_Study.hxx>
159 #include <SALOMEDSClient_StudyBuilder.hxx>
160 #include <SALOMEDSClient_SComponent.hxx>
161 #include <SALOMEDSClient_ClientFactory.hxx>
162 #include <SALOMEDSClient_IParameters.hxx>
165 #include <Standard_ErrorHandler.hxx>
166 #include <NCollection_DataMap.hxx>
168 //To disable automatic genericobj management, the following line should be commented.
169 //Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
170 #define WITHGENERICOBJ
174 //=============================================================
175 void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
178 void ExportMeshToFile(int theCommandID);
180 void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap);
182 void SetDisplayEntity(int theCommandID);
184 void Control( int theCommandID );
188 //=============================================================
189 void ImportMeshesFromFile( SMESH::SMESH_Gen_ptr theComponentMesh,
193 std::string myExtension;
195 if ( theCommandID == 113 ) {
196 filter.append( QObject::tr( "MED_FILES_FILTER" ) + " (*.med)" );
197 filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" );
199 else if ( theCommandID == 112 ) {
200 filter.append( QObject::tr( "IDEAS_FILES_FILTER" ) + " (*.unv)" );
202 else if ( theCommandID == 111 ) {
203 filter.append( QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)" );
205 else if ( theCommandID == 115 ) {
206 filter.append( QObject::tr( "STL_ASCII_FILES_FILTER" ) + " (*.stl)" );
208 else if ( theCommandID == 116 ) {
209 filter.append( QObject::tr( "CGNS_FILES_FILTER" ) + " (*.cgns)" );
211 else if ( theCommandID == 117 ) {
212 filter.append( QObject::tr( "SAUV files (*.sauv*)" ) );
213 filter.append( QObject::tr( "All files (*)" ) );
215 else if ( theCommandID == 118 ) {
216 filter.append( QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)" );
217 filter.append( QObject::tr( "GMF_BINARY_FILES_FILTER") + " (*.meshb)" );
220 QString anInitialPath = "";
221 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
222 anInitialPath = QDir::currentPath();
224 QStringList filenames = SUIT_FileDlg::getOpenFileNames( SMESHGUI::desktop(),
227 QObject::tr( "SMESH_IMPORT_MESH" ) );
228 if ( filenames.count() > 0 ) {
229 SUIT_OverrideCursor wc;
230 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
233 QStringList anEntryList;
234 bool isEmpty = false;
235 for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) {
236 QString filename = *it;
237 SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
239 switch ( theCommandID ) {
242 // DAT format (currently unsupported)
243 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
244 arg( QObject::tr( "SMESH_ERR_NOT_SUPPORTED_FORMAT" ) ) );
250 aMeshes->length( 1 );
251 aMeshes[0] = theComponentMesh->CreateMeshesFromUNV( filename.toLatin1().constData() );
252 if ( aMeshes[0]->_is_nil() )
253 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
254 arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
260 SMESH::DriverMED_ReadStatus res;
261 aMeshes = theComponentMesh->CreateMeshesFromMED( filename.toLatin1().constData(), res );
262 if ( res != SMESH::DRS_OK ) {
263 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
264 arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
271 aMeshes->length( 1 );
272 aMeshes[0] = theComponentMesh->CreateMeshesFromSTL( filename.toLatin1().constData() );
273 if ( aMeshes[0]->_is_nil() ) {
274 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
275 arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
282 SMESH::DriverMED_ReadStatus res;
283 aMeshes = theComponentMesh->CreateMeshesFromCGNS( filename.toLatin1().constData(), res );
284 if ( res != SMESH::DRS_OK ) {
285 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
286 arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
293 SMESH::DriverMED_ReadStatus res;
294 aMeshes = theComponentMesh->CreateMeshesFromSAUV( filename.toLatin1().constData(), res );
295 if ( res != SMESH::DRS_OK ) {
296 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
297 arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
304 SMESH::ComputeError_var res;
305 aMeshes->length( 1 );
306 aMeshes[0] = theComponentMesh->CreateMeshesFromGMF( filename.toLatin1().constData(), res.out() );
307 if ( res->code != SMESH::DRS_OK ) {
308 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
309 arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res->code ).toLatin1().data() ) ) );
310 if ( strlen( res->comment.in() ) > 0 ) {
311 errors.back() += ": ";
312 errors.back() += res->comment.in();
319 catch ( const SALOME::SALOME_Exception& S_ex ) {
320 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
321 arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
324 for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) {
325 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
327 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
328 _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
329 aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
330 if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
331 SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
333 anEntryList.append( aMeshSO->GetID().c_str() );
335 #ifdef WITHGENERICOBJ
336 // obj has been published in study. Its refcount has been incremented.
337 // It is safe to decrement its refcount
338 // so that it will be destroyed when the entry in study will be removed
339 aMeshes[i]->UnRegister();
348 // update Object browser
349 SMESHGUI::GetSMESHGUI()->updateObjBrowser();
351 // browse to the published meshes
352 if( LightApp_Application* anApp =
353 dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
354 anApp->browseObjects( anEntryList );
356 // show Error message box if there were errors
357 if ( errors.count() > 0 ) {
358 SUIT_MessageBox::critical( SMESHGUI::desktop(),
359 QObject::tr( "SMESH_ERROR" ),
360 QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
363 // show warning message box, if some imported mesh is empty
365 SUIT_MessageBox::warning( SMESHGUI::desktop(),
366 QObject::tr( "SMESH_WRN_WARNING" ),
367 QObject::tr( "SMESH_DRS_SOME_EMPTY" ) );
372 //================================================================================
374 * \brief Export selected meshes or groups into a file
376 //================================================================================
378 void ExportMeshToFile( int theCommandID )
380 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
381 SALOME_ListIO selected;
383 aSel->selectedObjects( selected );
385 const bool isMED = ( theCommandID == 122 || theCommandID == 125 );
386 const bool isDAT = ( theCommandID == 121 || theCommandID == 124 );
387 const bool isUNV = ( theCommandID == 123 || theCommandID == 126 );
388 const bool isSTL = ( theCommandID == 140 || theCommandID == 141 );
389 const bool isCGNS= ( theCommandID == 142 || theCommandID == 143 );
390 const bool isSAUV= ( theCommandID == 144 || theCommandID == 145 );
391 const bool isGMF = ( theCommandID == 146 || theCommandID == 147 );
393 // actually, the following condition can't be met (added for insurance)
394 if( selected.Extent() == 0 ||
395 ( selected.Extent() > 1 && !isMED && !isSTL ))
398 // get mesh object from selection and check duplication of their names
399 bool hasDuplicatedMeshNames = false;
400 QList< QPair< SMESH::SMESH_IDSource_var, QString > > aMeshList;
401 QList< QPair< SMESH::SMESH_IDSource_var, QString > >::iterator aMeshIter;
402 SALOME_ListIteratorOfListIO It( selected );
403 for( ; It.More(); It.Next() )
405 Handle(SALOME_InteractiveObject) anIObject = It.Value();
406 SMESH::SMESH_IDSource_var aMeshItem = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(anIObject);
407 if ( aMeshItem->_is_nil() ) {
408 SUIT_MessageBox::warning( SMESHGUI::desktop(),
409 QObject::tr( "SMESH_WRN_WARNING" ),
410 QObject::tr( "SMESH_BAD_MESH_SELECTION" ));
414 QString aMeshName = anIObject->getName();
416 // check for name duplications
417 if ( !hasDuplicatedMeshNames )
418 for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
419 if( aMeshName == (*aMeshIter).second ) {
420 hasDuplicatedMeshNames = true;
425 aMeshList.append( QPair< SMESH::SMESH_IDSource_var, QString >( aMeshItem, aMeshName ) );
428 if( hasDuplicatedMeshNames && isMED ) {
429 int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
430 QObject::tr("SMESH_WRN_WARNING"),
431 QObject::tr("SMESH_EXPORT_MED_DUPLICATED_MESH_NAMES"),
432 QObject::tr("SMESH_BUT_YES"),
433 QObject::tr("SMESH_BUT_NO"), 0, 1);
438 aMeshIter = aMeshList.begin();
439 SMESH::SMESH_IDSource_var aMeshOrGroup = (*aMeshIter).first;
440 SMESH::SMESH_Mesh_var aMesh = aMeshOrGroup->GetMesh();
441 QString aMeshName = (*aMeshIter).second;
443 if ( isMED || isCGNS || isSAUV ) // formats where group names must be unique
445 // check for equal group names within each mesh
446 for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
447 SMESH::SMESH_Mesh_var aMeshItem = SMESH::SMESH_Mesh::_narrow( (*aMeshIter).first );
448 if ( !aMeshItem->_is_nil() && aMeshItem->HasDuplicatedGroupNamesMED()) {
449 int aRet = SUIT_MessageBox::warning
450 (SMESHGUI::desktop(),
451 QObject::tr("SMESH_WRN_WARNING"),
452 QObject::tr("SMESH_EXPORT_MED_DUPLICATED_GRP").arg((*aMeshIter).second),
453 QObject::tr("SMESH_BUT_YES"),
454 QObject::tr("SMESH_BUT_NO"), 0, 1);
461 // Warn the user about presence of not supported elements
463 std::vector< SMESH::EntityType > notSupportedElemTypes, presentNotSupported;
467 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Quadrangle );
468 notSupportedElemTypes.push_back( SMESH::Entity_BiQuad_Quadrangle );
469 notSupportedElemTypes.push_back( SMESH::Entity_Polygon );
470 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polygon );
471 notSupportedElemTypes.push_back( SMESH::Entity_Tetra );
472 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Tetra );
473 notSupportedElemTypes.push_back( SMESH::Entity_Pyramid );
474 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Pyramid );
475 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Hexa );
476 notSupportedElemTypes.push_back( SMESH::Entity_TriQuad_Hexa );
477 notSupportedElemTypes.push_back( SMESH::Entity_Penta );
478 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Penta );
479 notSupportedElemTypes.push_back( SMESH::Entity_Hexagonal_Prism );
480 notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra );
481 notSupportedElemTypes.push_back( SMESH::Entity_0D );
482 notSupportedElemTypes.push_back( SMESH::Entity_Ball );
487 notSupportedElemTypes.push_back( SMESH::Entity_Polygon );
488 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polygon );
489 notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra );
490 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polyhedra );
491 notSupportedElemTypes.push_back( SMESH::Entity_Pyramid );
492 notSupportedElemTypes.push_back( SMESH::Entity_Hexagonal_Prism );
493 notSupportedElemTypes.push_back( SMESH::Entity_0D );
494 notSupportedElemTypes.push_back( SMESH::Entity_Ball );
499 notSupportedElemTypes.push_back( SMESH::Entity_Edge );
500 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Edge );
501 notSupportedElemTypes.push_back( SMESH::Entity_0D );
502 notSupportedElemTypes.push_back( SMESH::Entity_Ball );
507 notSupportedElemTypes.push_back( SMESH::Entity_Ball );
512 notSupportedElemTypes.push_back( SMESH::Entity_Ball );
513 notSupportedElemTypes.push_back( SMESH::Entity_BiQuad_Quadrangle );
514 notSupportedElemTypes.push_back( SMESH::Entity_TriQuad_Hexa );
515 notSupportedElemTypes.push_back( SMESH::Entity_Hexagonal_Prism );
516 notSupportedElemTypes.push_back( SMESH::Entity_Polygon );
517 notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra );
522 notSupportedElemTypes.push_back( SMESH::Entity_0D );
523 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Quadrangle );
524 notSupportedElemTypes.push_back( SMESH::Entity_Polygon );
525 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polygon );
526 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Pyramid );
527 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Hexa );
528 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Penta );
529 notSupportedElemTypes.push_back( SMESH::Entity_Hexagonal_Prism );
530 notSupportedElemTypes.push_back( SMESH::Entity_Polyhedra );
531 notSupportedElemTypes.push_back( SMESH::Entity_Quad_Polyhedra );
532 notSupportedElemTypes.push_back( SMESH::Entity_Ball );
534 if ( ! notSupportedElemTypes.empty() )
536 SMESH::long_array_var nbElems = aMeshOrGroup->GetMeshInfo();
537 for ( size_t iType = 0; iType < notSupportedElemTypes.size(); ++iType )
538 if ( nbElems[ notSupportedElemTypes[ iType ]] > 0 )
539 presentNotSupported.push_back( notSupportedElemTypes[ iType ]);
541 if ( !presentNotSupported.empty() )
544 const char* typeMsg[SMESH::Entity_Last] = { "SMESH_NODES",
545 "SMESH_ELEMS0D","SMESH_EDGES","SMESH_QUADRATIC_EDGES","SMESH_TRIANGLES",
546 "SMESH_QUADRATIC_TRIANGLES","SMESH_QUADRANGLES","SMESH_QUADRATIC_QUADRANGLES",
547 "SMESH_BIQUADRATIC_QUADRANGLES","SMESH_POLYGONS","SMESH_QUADRATIC_POLYGONS",
548 "SMESH_TETRAHEDRA","SMESH_QUADRATIC_TETRAHEDRONS","SMESH_PYRAMIDS",
549 "SMESH_QUADRATIC_PYRAMIDS","SMESH_HEXAHEDRA","SMESH_QUADRATIC_HEXAHEDRONS",
550 "SMESH_TRIQUADRATIC_HEXAHEDRONS","SMESH_PENTAHEDRA","SMESH_QUADRATIC_PENTAHEDRONS",
551 "SMESH_OCTAHEDRA","SMESH_POLYEDRONS","SMESH_QUADRATIC_POLYEDRONS","SMESH_BALLS"
553 QString andStr = " " + QObject::tr("SMESH_AND") + " ", comma(", ");
554 for ( size_t iType = 0; iType < presentNotSupported.size(); ++iType ) {
555 typeNames += QObject::tr( typeMsg[ presentNotSupported[ iType ]]);
556 if ( iType != presentNotSupported.size() - 1 )
557 typeNames += ( iType == presentNotSupported.size() - 2 ) ? andStr : comma;
559 int aRet = SUIT_MessageBox::warning
560 (SMESHGUI::desktop(),
561 QObject::tr("SMESH_WRN_WARNING"),
562 QObject::tr("EXPORT_NOT_SUPPORTED").arg(aMeshName).arg(format).arg(typeNames),
563 QObject::tr("SMESH_BUT_YES"),
564 QObject::tr("SMESH_BUT_NO"), 0, 1);
569 // Get parameters of export operation
572 SMESH::MED_VERSION aFormat;
573 // Init the parameters with the default values
574 bool aIsASCII_STL = true;
575 bool toCreateGroups = false;
576 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
578 toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
579 bool toOverwrite = true;
581 QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
582 QString anInitialPath = "";
583 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
584 anInitialPath = QDir::currentPath();
586 // Get a file name to write in and additional otions
587 if ( isUNV || isDAT || isGMF ) // Export w/o options
590 aFilter = QObject::tr( "IDEAS_FILES_FILTER" ) + " (*.unv)";
592 aFilter = QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)";
594 aFilter = QObject::tr( "GMF_ASCII_FILES_FILTER" ) + " (*.mesh)" +
595 ";;" + QObject::tr( "GMF_BINARY_FILES_FILTER" ) + " (*.meshb)";
596 if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
597 aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(),
598 anInitialPath + QString("/") + aMeshName,
599 aFilter, aTitle, false);
601 else if ( isCGNS )// Export to CGNS
603 SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
604 fd->setWindowTitle( aTitle );
605 fd->setNameFilter( QObject::tr( "CGNS_FILES_FILTER" ) + " (*.cgns)" );
606 if ( !anInitialPath.isEmpty() )
607 fd->setDirectory( anInitialPath );
608 fd->selectFile(aMeshName);
609 SMESHGUI_FileValidator* fv = new SMESHGUI_FileValidator( fd );
610 fd->setValidator( fv );
613 aFilename = fd->selectedFile();
614 toOverwrite = fv->isOverwrite();
618 else if ( isSTL ) // Export to STL
620 QMap<QString, int> aFilterMap;
621 aFilterMap.insert( QObject::tr( "STL_ASCII_FILES_FILTER" ) + " (*.stl)", 1 );
622 aFilterMap.insert( QObject::tr( "STL_BIN_FILES_FILTER" ) + " (*.stl)", 0 );
625 QMap<QString, int>::const_iterator it = aFilterMap.begin();
626 for ( ; it != aFilterMap.end(); ++it )
627 filters.push_back( it.key() );
629 SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
630 fd->setWindowTitle( aTitle );
631 fd->setNameFilters( filters );
632 fd->selectNameFilter( QObject::tr( "STL_ASCII_FILES_FILTER" ) + " (*.stl)" );
633 if ( !anInitialPath.isEmpty() )
634 fd->setDirectory( anInitialPath );
635 fd->selectFile(aMeshName);
639 aFilename = fd->selectedFile();
640 aIsASCII_STL = (aFilterMap[fd->selectedNameFilter()]) == 1 ? true: false;
645 else if ( isMED || isSAUV ) // Export to MED or SAUV
647 QMap<QString, SMESH::MED_VERSION> aFilterMap;
648 //QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2));
650 QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
651 //aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v21 ) + " (*.med)", SMESH::MED_V2_1 );
652 aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v22 ) + " (*.med)", SMESH::MED_V2_2 );
655 aFilterMap.insert("All files (*)", SMESH::MED_V2_1 );
656 aFilterMap.insert("SAUV files (*.sauv)", SMESH::MED_V2_2 );
657 aFilterMap.insert("SAUV files (*.sauve)", SMESH::MED_V2_1 );
661 QString aDefaultFilter;
662 QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin();
663 for ( ; it != aFilterMap.end(); ++it ) {
664 filters.push_back( it.key() );
665 if (it.value() == SMESH::MED_V2_2)
666 aDefaultFilter = it.key();
669 SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
670 ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
671 fd->setWindowTitle( aTitle );
672 fd->setNameFilters( filters );
673 fd->selectNameFilter(aDefaultFilter);
674 fd->SetChecked(toCreateGroups);
675 if ( !anInitialPath.isEmpty() )
676 fd->setDirectory( anInitialPath );
677 fd->selectFile(aMeshName);
679 SMESHGUI_FileValidator* fv = new SMESHGUI_FileValidator( fd );
680 fd->setValidator( fv );
685 aFilename = fd->selectedFile();
687 aFilename = QString::null;
690 aFormat = aFilterMap[fd->selectedNameFilter()];
691 toOverwrite = fv->isOverwrite();
693 if ( !aFilename.isEmpty() ) {
694 // med-2.1 does not support poly elements
695 if ( aFormat==SMESH::MED_V2_1 )
696 for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
697 SMESH::SMESH_IDSource_var aMeshItem = (*aMeshIter).first;
698 SMESH::long_array_var nbElems = aMeshItem->GetMeshInfo();
699 if ( nbElems[ SMESH::Entity_Polygon ] + nbElems[ SMESH::Entity_Quad_Polygon ] +
700 nbElems[ SMESH::Entity_Polyhedra ] + nbElems[ SMESH::Entity_Quad_Polyhedra ])
702 int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
703 QObject::tr("SMESH_WRN_WARNING"),
704 QObject::tr("SMESH_EXPORT_MED_V2_1").arg((*aMeshIter).second),
705 QObject::tr("SMESH_BUT_YES"),
706 QObject::tr("SMESH_BUT_NO"), 0, 1);
714 // can't append to an existing using other format
715 SMESH::MED_VERSION aVersion = SMESH::MED_V2_1;
716 bool isVersionOk = SMESHGUI::GetSMESHGen()->GetMEDVersion( aFilename.toLatin1().constData(), aVersion );
717 if( !isVersionOk || aVersion != aFormat ) {
718 int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
719 QObject::tr("SMESH_WRN_WARNING"),
720 QObject::tr("SMESH_EXPORT_MED_VERSION_COLLISION").arg(aFilename),
721 QObject::tr("SMESH_BUT_YES"),
722 QObject::tr("SMESH_BUT_NO"), 0, 1);
729 QStringList aMeshNamesCollisionList;
730 SMESH::string_array_var aMeshNames = SMESHGUI::GetSMESHGen()->GetMeshNames( aFilename.toLatin1().constData() );
731 for( int i = 0, n = aMeshNames->length(); i < n; i++ ) {
732 QString anExistingMeshName( aMeshNames[ i ] );
733 for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
734 QString anExportMeshName = (*aMeshIter).second;
735 if( anExportMeshName == anExistingMeshName ) {
736 aMeshNamesCollisionList.append( anExportMeshName );
741 if( !aMeshNamesCollisionList.isEmpty() ) {
742 QString aMeshNamesCollisionString = aMeshNamesCollisionList.join( ", " );
743 int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
744 QObject::tr("SMESH_WRN_WARNING"),
745 QObject::tr("SMESH_EXPORT_MED_MESH_NAMES_COLLISION").arg(aMeshNamesCollisionString),
746 QObject::tr("SMESH_BUT_YES"),
747 QObject::tr("SMESH_BUT_NO"),
748 QObject::tr("SMESH_BUT_CANCEL"), 0, 2);
757 toCreateGroups = fd->IsChecked();
767 if ( !aFilename.isEmpty() ) {
768 // Check whether the file already exists and delete it if yes
769 QFile aFile( aFilename );
770 if ( aFile.exists() && toOverwrite )
772 SUIT_OverrideCursor wc;
775 // Renumbering is not needed since SMDS redesign in V6.2.0 (Nov 2010)
776 // bool Renumber = false;
777 // // PAL 14172 : Check of we have to renumber or not from the preferences before export
779 // Renumber= resMgr->booleanValue("renumbering");
781 // SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
782 // aMeshEditor->RenumberNodes();
783 // aMeshEditor->RenumberElements();
784 // if ( SMESHGUI::automaticUpdate() )
785 // SMESH::UpdateView();
789 aMeshIter = aMeshList.begin();
790 for( int aMeshIndex = 0; aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ )
792 SMESH::SMESH_IDSource_var aMeshOrGroup = (*aMeshIter).first;
793 SMESH::SMESH_Mesh_var aMeshItem = aMeshOrGroup->GetMesh();
794 if ( aMeshOrGroup->_is_equivalent( aMeshItem ))
795 aMeshItem->ExportToMEDX( aFilename.toLatin1().data(), toCreateGroups,
796 aFormat, toOverwrite && aMeshIndex == 0 );
798 aMeshItem->ExportPartToMED( aMeshOrGroup, aFilename.toLatin1().data(), toCreateGroups,
799 aFormat, toOverwrite && aMeshIndex == 0 );
804 for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ )
806 SMESH::SMESH_Mesh_var aMeshItem = SMESH::SMESH_Mesh::_narrow( (*aMeshIter).first );
807 if( !aMeshItem->_is_nil() )
808 aMeshItem->ExportSAUV( aFilename.toLatin1().data(), toCreateGroups );
813 if ( aMeshOrGroup->_is_equivalent( aMesh ))
814 aMesh->ExportDAT( aFilename.toLatin1().data() );
816 aMesh->ExportPartToDAT( aMeshOrGroup, aFilename.toLatin1().data() );
820 if ( aMeshOrGroup->_is_equivalent( aMesh ))
821 aMesh->ExportUNV( aFilename.toLatin1().data() );
823 aMesh->ExportPartToUNV( aMeshOrGroup, aFilename.toLatin1().data() );
827 if ( aMeshOrGroup->_is_equivalent( aMesh ))
828 aMesh->ExportSTL( aFilename.toLatin1().data(), aIsASCII_STL );
830 aMesh->ExportPartToSTL( aMeshOrGroup, aFilename.toLatin1().data(), aIsASCII_STL );
834 aMeshIter = aMeshList.begin();
835 for( int aMeshIndex = 0; aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ )
837 SMESH::SMESH_IDSource_var aMeshOrGroup = (*aMeshIter).first;
838 SMESH::SMESH_Mesh_var aMeshItem = aMeshOrGroup->GetMesh();
839 aMeshItem->ExportCGNS( aMeshOrGroup,
840 aFilename.toLatin1().data(),
841 toOverwrite && aMeshIndex == 0 );
846 aMesh->ExportGMF( aMeshOrGroup, aFilename.toLatin1().data() );
849 catch (const SALOME::SALOME_Exception& S_ex){
851 SUIT_MessageBox::warning(SMESHGUI::desktop(),
852 QObject::tr("SMESH_WRN_WARNING"),
853 QObject::tr("SMESH_EXPORT_FAILED"));
859 inline void InverseEntityMode(unsigned int& theOutputMode,
860 unsigned int theMode)
862 bool anIsNotPresent = ~theOutputMode & theMode;
864 theOutputMode |= theMode;
866 theOutputMode &= ~theMode;
869 void SetDisplayEntity(int theCommandID){
870 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
871 SALOME_ListIO selected;
873 aSel->selectedObjects( selected );
875 if(selected.Extent() >= 1){
876 SALOME_ListIteratorOfListIO It( selected );
877 for( ; It.More(); It.Next()){
878 Handle(SALOME_InteractiveObject) IObject = It.Value();
879 if(IObject->hasEntry()){
880 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
881 unsigned int aMode = anActor->GetEntityMode();
882 switch(theCommandID){
884 InverseEntityMode(aMode,SMESH_Actor::eBallElem);
887 InverseEntityMode(aMode,SMESH_Actor::e0DElements);
890 InverseEntityMode(aMode,SMESH_Actor::eEdges);
893 InverseEntityMode(aMode,SMESH_Actor::eFaces);
896 InverseEntityMode(aMode,SMESH_Actor::eVolumes);
899 aMode = SMESH_Actor::eAllEntity;
903 anActor->SetEntityMode(aMode);
911 SALOME_ListIO selected;
912 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
916 LightApp_SelectionMgr* aSel = app->selectionMgr();
917 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
918 if( !aSel || !appStudy )
921 aSel->selectedObjects( selected );
922 if( selected.IsEmpty() )
925 Handle(SALOME_InteractiveObject) anIObject = selected.First();
927 _PTR(Study) aStudy = appStudy->studyDS();
928 _PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
929 SMESH::SMESH_Mesh_var aMainObject = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
930 if( aMainObject->_is_nil() )
933 aMainObject->SetAutoColor( true ); // mesh groups are re-colored here
935 SMESH::ListOfGroups aListOfGroups = *aMainObject->GetGroups();
936 for( int i = 0, n = aListOfGroups.length(); i < n; i++ )
938 SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
939 SALOMEDS::Color aColor = aGroupObject->GetColor();
940 _PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
942 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str())) {
943 switch ( aGroupObject->GetType ()) {
945 anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break;
947 anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
949 anActor->Set0DColor( aColor.R, aColor.G, aColor.B ); break;
951 anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
955 SMESH::GetColor("SMESH", "fill_color", c, delta, "0,170,255|-100");
956 anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta );
962 SMESH::RepaintCurrentView();
965 QString functorToString( SMESH::Controls::FunctorPtr f )
967 QString type = QObject::tr( "UNKNOWN_CONTROL" );
968 if ( dynamic_cast< SMESH::Controls::Volume* >( f.get() ) )
969 type = QObject::tr( "VOLUME_3D_ELEMENTS" );
970 else if ( dynamic_cast< SMESH::Controls::MaxElementLength2D* >( f.get() ) )
971 type = QObject::tr( "MAX_ELEMENT_LENGTH_2D" );
972 else if ( dynamic_cast< SMESH::Controls::MaxElementLength3D* >( f.get() ) )
973 type = QObject::tr( "MAX_ELEMENT_LENGTH_3D" );
974 else if ( dynamic_cast< SMESH::Controls::MinimumAngle* >( f.get() ) )
975 type = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
976 else if ( dynamic_cast< SMESH::Controls::AspectRatio* >( f.get() ) )
977 type = QObject::tr( "ASPECTRATIO_ELEMENTS" );
978 else if ( dynamic_cast< SMESH::Controls::AspectRatio3D* >( f.get() ) )
979 type = QObject::tr( "ASPECTRATIO_3D_ELEMENTS" );
980 else if ( dynamic_cast< SMESH::Controls::Warping* >( f.get() ) )
981 type = QObject::tr( "WARP_ELEMENTS" );
982 else if ( dynamic_cast< SMESH::Controls::Taper* >( f.get() ) )
983 type = QObject::tr( "TAPER_ELEMENTS" );
984 else if ( dynamic_cast< SMESH::Controls::Skew* >( f.get() ) )
985 type = QObject::tr( "SKEW_ELEMENTS" );
986 else if ( dynamic_cast< SMESH::Controls::Area* >( f.get() ) )
987 type = QObject::tr( "AREA_ELEMENTS" );
988 else if ( dynamic_cast< SMESH::Controls::Length* >( f.get() ) )
989 type = QObject::tr( "LENGTH_EDGES" );
990 else if ( dynamic_cast< SMESH::Controls::Length2D* >( f.get() ) )
991 type = QObject::tr( "LENGTH2D_EDGES" );
992 else if ( dynamic_cast< SMESH::Controls::MultiConnection* >( f.get() ) )
993 type = QObject::tr( "MULTI_BORDERS" );
994 else if ( dynamic_cast< SMESH::Controls::MultiConnection2D* >( f.get() ) )
995 type = QObject::tr( "MULTI2D_BORDERS" );
996 else if ( dynamic_cast< SMESH::Controls::FreeNodes* >( f.get() ) )
997 type = QObject::tr( "FREE_NODES" );
998 else if ( dynamic_cast< SMESH::Controls::FreeEdges* >( f.get() ) )
999 type = QObject::tr( "FREE_EDGES" );
1000 else if ( dynamic_cast< SMESH::Controls::FreeBorders* >( f.get() ) )
1001 type = QObject::tr( "FREE_BORDERS" );
1002 else if ( dynamic_cast< SMESH::Controls::FreeFaces* >( f.get() ) )
1003 type = QObject::tr( "FREE_FACES" );
1004 else if ( dynamic_cast< SMESH::Controls::BareBorderVolume* >( f.get() ) )
1005 type = QObject::tr( "BARE_BORDER_VOLUME" );
1006 else if ( dynamic_cast< SMESH::Controls::BareBorderFace* >( f.get() ) )
1007 type = QObject::tr( "BARE_BORDER_FACE" );
1008 else if ( dynamic_cast< SMESH::Controls::OverConstrainedVolume* >( f.get() ) )
1009 type = QObject::tr( "OVER_CONSTRAINED_VOLUME" );
1010 else if ( dynamic_cast< SMESH::Controls::OverConstrainedFace* >( f.get() ) )
1011 type = QObject::tr( "OVER_CONSTRAINED_FACE" );
1012 else if ( dynamic_cast< SMESH::Controls::CoincidentNodes* >( f.get() ) )
1013 type = QObject::tr( "EQUAL_NODE" );
1014 else if ( dynamic_cast< SMESH::Controls::CoincidentElements1D* >( f.get() ) )
1015 type = QObject::tr( "EQUAL_EDGE" );
1016 else if ( dynamic_cast< SMESH::Controls::CoincidentElements2D* >( f.get() ) )
1017 type = QObject::tr( "EQUAL_FACE" );
1018 else if ( dynamic_cast< SMESH::Controls::CoincidentElements3D* >( f.get() ) )
1019 type = QObject::tr( "EQUAL_VOLUME" );
1023 void SaveDistribution()
1025 LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
1026 SALOME_ListIO selected;
1028 aSel->selectedObjects( selected );
1030 if ( selected.Extent() == 1 ) {
1031 Handle(SALOME_InteractiveObject) anIO = selected.First();
1032 if ( anIO->hasEntry() ) {
1033 SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
1034 if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
1035 SMESH_ScalarBarActor* aScalarBarActor = anActor->GetScalarBarActor();
1036 SMESH::Controls::FunctorPtr aFunctor = anActor->GetFunctor();
1037 if ( aScalarBarActor && aFunctor ) {
1038 SMESH::Controls::NumericalFunctor* aNumFun = dynamic_cast<SMESH::Controls::NumericalFunctor*>( aFunctor.get() );
1040 std::vector<int> elements;
1041 SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
1042 if ( mesh->_is_nil() ) {
1043 SMESH::SMESH_IDSource_var idSource =
1044 SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(anIO);
1045 if ( !idSource->_is_nil() )
1047 SMESH::long_array_var ids = idSource->GetIDs();
1048 elements.resize( ids->length() );
1049 for ( unsigned i = 0; i < elements.size(); ++i )
1050 elements[i] = ids[i];
1053 int nbIntervals = aScalarBarActor->GetMaximumNumberOfColors();
1054 vtkLookupTable* lookupTable =
1055 static_cast<vtkLookupTable*>(aScalarBarActor->GetLookupTable());
1056 double * minmax = lookupTable->GetRange();
1057 std::vector<int> nbEvents;
1058 std::vector<double> funValues;
1059 aNumFun->GetHistogram( nbIntervals, nbEvents, funValues, elements, minmax );
1060 QString anInitialPath = "";
1061 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
1062 anInitialPath = QDir::currentPath();
1063 QString aMeshName = anIO->getName();
1065 filter.append( QObject::tr( "TEXT_FILES_FILTER" ) + " (*.txt)" );
1066 filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" );
1067 QString aFilename = anInitialPath + "/" + aMeshName + "_" +
1068 functorToString( aFunctor ).toLower().simplified().replace( QRegExp( " |-" ), "_" ) + ".txt";
1069 aFilename = SUIT_FileDlg::getFileName( SMESHGUI::desktop(),
1072 QObject::tr( "SMESH_SAVE_DISTRIBUTION" ),
1074 if ( !aFilename.isEmpty() ) {
1075 QFile f( aFilename );
1076 if ( f.open( QFile::WriteOnly | QFile::Truncate ) ) {
1077 QTextStream out( &f );
1078 out << "# Mesh: " << aMeshName << endl;
1079 out << "# Control: " << functorToString( aFunctor ) << endl;
1081 out.setFieldWidth( 10 );
1082 for ( int i = 0; i < qMin( nbEvents.size(), funValues.size()-1 ); i++ )
1083 out << funValues[i] << "\t" << funValues[i+1] << "\t" << nbEvents[i] << endl;
1094 void ShowDistribution() {
1095 LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
1096 SALOME_ListIO selected;
1098 aSel->selectedObjects( selected );
1100 if ( selected.Extent() == 1 ) {
1101 Handle(SALOME_InteractiveObject) anIO = selected.First();
1102 if ( anIO->hasEntry() ) {
1103 SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
1104 if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
1105 SMESH_ScalarBarActor *aScalarBarActor = anActor->GetScalarBarActor();
1106 aScalarBarActor->SetDistributionVisibility(!aScalarBarActor->GetDistributionVisibility());
1112 #ifndef DISABLE_PLOT2DVIEWER
1113 void PlotDistribution() {
1114 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
1118 LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
1119 SALOME_ListIO selected;
1121 aSel->selectedObjects( selected );
1123 if ( selected.Extent() == 1 ) {
1124 Handle(SALOME_InteractiveObject) anIO = selected.First();
1125 if ( anIO->hasEntry() ) {
1126 //Find Actor by entry before getting Plot2d viewer,
1127 //because after call getViewManager( Plot2d_Viewer::Type(), true ) active window is Plot2d Viewer
1128 SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
1130 SUIT_ViewManager* aViewManager = app->getViewManager( Plot2d_Viewer::Type(), true ); // create if necessary
1135 SPlot2d_Viewer* aView = dynamic_cast<SPlot2d_Viewer*>(aViewManager->getViewModel());
1139 Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame();
1143 if ( anActor && anActor->GetControlMode() != SMESH_Actor::eNone ) {
1144 SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
1145 QString functorName = functorToString( anActor->GetFunctor());
1146 QString aHistogramName("%1 : %2");
1147 aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
1148 aHistogram->setName(aHistogramName);
1149 aHistogram->setHorTitle(functorName);
1150 aHistogram->setVerTitle(QObject::tr("DISTRIBUTION_NB_ENT"));
1151 aPlot->displayObject(aHistogram, true);
1156 #endif //DISABLE_PLOT2DVIEWER
1158 void DisableAutoColor(){
1159 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1160 SALOME_ListIO selected;
1162 aSel->selectedObjects( selected );
1164 if(selected.Extent()){
1165 Handle(SALOME_InteractiveObject) anIObject = selected.First();
1166 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
1167 if ( !aMesh->_is_nil() ) {
1168 aMesh->SetAutoColor( false );
1173 void SetDisplayMode(int theCommandID, SMESHGUI_StudyId2MarkerMap& theMarkerMap)
1175 SALOME_ListIO selected;
1176 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
1180 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1181 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
1182 if( !aSel || !appStudy )
1185 if( theCommandID == 1134 ) { // Clipping dialog can be activated without selection
1186 if( SMESHGUI* aModule = SMESHGUI::GetSMESHGUI() ) {
1187 aModule->EmitSignalDeactivateDialog();
1188 if( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( aModule ) )
1189 (new SMESHGUI_ClippingDlg( aModule, aViewWindow ))->show();
1194 _PTR(Study) aStudy = appStudy->studyDS();
1196 aSel->selectedObjects( selected );
1198 if(selected.Extent() >= 1){
1199 switch(theCommandID){
1201 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
1202 (new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show();
1206 QColor c, e, b, n, c0D, cBall, o, outl, selection, preselection;
1208 int size0D = 0, ballSize = 0;
1210 vtkFloatingPointType Shrink = 0.0;
1211 vtkFloatingPointType faces_orientation_scale = 0.0;
1212 bool faces_orientation_3dvectors = false;
1214 VTK::MarkerType aMarkerTypeCurrent = VTK::MT_NONE;
1215 VTK::MarkerScale aMarkerScaleCurrent = VTK::MS_NONE;
1216 int aMarkerTextureCurrent = 0;
1218 SALOME_ListIteratorOfListIO It( selected );
1219 for( ; It.More(); It.Next()){
1220 Handle(SALOME_InteractiveObject) IObject = It.Value();
1221 if(IObject->hasEntry()){
1222 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
1223 vtkFloatingPointType color[3];
1224 anActor->GetSufaceColor(color[0], color[1], color[2],delta);
1225 int c0 = int (color[0] * 255);
1226 int c1 = int (color[1] * 255);
1227 int c2 = int (color[2] * 255);
1228 c.setRgb(c0, c1, c2);
1230 vtkFloatingPointType edgecolor[3];
1231 anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
1232 c0 = int (edgecolor[0] * 255);
1233 c1 = int (edgecolor[1] * 255);
1234 c2 = int (edgecolor[2] * 255);
1235 e.setRgb(c0, c1, c2);
1237 vtkFloatingPointType nodecolor[3];
1238 anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
1239 c0 = int (nodecolor[0] * 255);
1240 c1 = int (nodecolor[1] * 255);
1241 c2 = int (nodecolor[2] * 255);
1242 n.setRgb(c0, c1, c2);
1244 vtkFloatingPointType color0D[3];
1245 anActor->Get0DColor(color0D[0], color0D[1], color0D[2]);
1246 c0 = int (color0D[0] * 255);
1247 c1 = int (color0D[1] * 255);
1248 c2 = int (color0D[2] * 255);
1249 c0D.setRgb(c0, c1, c2);
1251 vtkFloatingPointType ballcolor[3];
1252 anActor->GetBallColor(ballcolor[0], ballcolor[1], ballcolor[2]);
1253 c0 = int (ballcolor[0] * 255);
1254 c1 = int (ballcolor[1] * 255);
1255 c2 = int (ballcolor[2] * 255);
1256 cBall.setRgb(c0, c1, c2);
1258 vtkFloatingPointType outlineColor[3];
1259 anActor->GetOutlineColor(outlineColor[0], outlineColor[1], outlineColor[2]);
1260 c0 = int (outlineColor[0] * 255);
1261 c1 = int (outlineColor[1] * 255);
1262 c2 = int (outlineColor[2] * 255);
1263 outl.setRgb(c0, c1, c2);
1265 vtkFloatingPointType hColor[3];
1266 anActor->GetHighlightColor(hColor[0], hColor[1], hColor[2]);
1267 c0 = int (hColor[0] * 255);
1268 c1 = int (hColor[1] * 255);
1269 c2 = int (hColor[2] * 255);
1270 selection.setRgb(c0, c1, c2);
1272 vtkFloatingPointType phColor[3];
1273 anActor->GetPreHighlightColor(phColor[0], phColor[1], phColor[2]);
1274 c0 = int (phColor[0] * 255);
1275 c1 = int (phColor[1] * 255);
1276 c2 = int (phColor[2] * 255);
1277 preselection.setRgb(c0, c1, c2);
1279 size0D = (int)anActor->Get0DSize();
1282 ballSize = (int)anActor->GetBallSize();
1285 Edgewidth = (int)anActor->GetLineWidth();
1288 Shrink = anActor->GetShrinkFactor();
1290 vtkFloatingPointType faces_orientation_color[3];
1291 anActor->GetFacesOrientationColor(faces_orientation_color);
1292 c0 = int (faces_orientation_color[0] * 255);
1293 c1 = int (faces_orientation_color[1] * 255);
1294 c2 = int (faces_orientation_color[2] * 255);
1295 o.setRgb(c0, c1, c2);
1297 faces_orientation_scale = anActor->GetFacesOrientationScale();
1298 faces_orientation_3dvectors = anActor->GetFacesOrientation3DVectors();
1300 aMarkerTypeCurrent = anActor->GetMarkerType();
1301 aMarkerScaleCurrent = anActor->GetMarkerScale();
1302 aMarkerTextureCurrent = anActor->GetMarkerTexture();
1304 // even if there are multiple objects in the selection,
1305 // we need only the first one to get values for the dialog
1311 SMESHGUI_Preferences_ColorDlg *aDlg =
1312 new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI() );
1313 aDlg->SetBooleanValue(1, faces_orientation_3dvectors);
1314 aDlg->SetColor(1, c);
1315 aDlg->SetColor(2, e);
1316 aDlg->SetColor(3, n);
1317 aDlg->SetColor(4, outl);
1318 aDlg->SetColor(5, c0D);
1319 aDlg->SetColor(6, cBall);
1320 aDlg->SetColor(7, o);
1321 aDlg->SetColor(8, selection);
1322 aDlg->SetColor(9, preselection);
1323 aDlg->SetDeltaBrightness(delta);
1324 aDlg->SetDoubleValue(1, faces_orientation_scale);
1325 aDlg->SetIntValue(1, Edgewidth);
1326 aDlg->SetIntValue(2, int(Shrink*100.));
1327 aDlg->SetIntValue(3, size0D);
1328 aDlg->SetIntValue(4, ballSize);
1330 aDlg->setCustomMarkerMap( theMarkerMap[ aStudy->StudyId() ] );
1332 if( aMarkerTypeCurrent != VTK::MT_USER )
1333 aDlg->setStandardMarker( aMarkerTypeCurrent, aMarkerScaleCurrent );
1335 aDlg->setCustomMarker( aMarkerTextureCurrent );
1338 QColor color = aDlg->GetColor(1);
1339 QColor edgecolor = aDlg->GetColor(2);
1340 QColor nodecolor = aDlg->GetColor(3);
1341 QColor outlinecolor = aDlg->GetColor(4);
1342 QColor color0D = aDlg->GetColor(5);
1343 QColor ballcolor = aDlg->GetColor(6);
1344 QColor faces_orientation_color = aDlg->GetColor(7);
1345 QColor selectioncolor = aDlg->GetColor(8);
1346 QColor preSelectioncolor = aDlg->GetColor(9);
1347 int delta = aDlg->GetDeltaBrightness();
1350 theMarkerMap[ aStudy->StudyId() ] = aDlg->getCustomMarkerMap();
1352 SALOME_ListIteratorOfListIO It( selected );
1353 for( ; It.More(); It.Next()){
1354 Handle(SALOME_InteractiveObject) IObject = It.Value();
1355 if(IObject->hasEntry()){
1356 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
1357 /* actor color and backface color */
1358 anActor->SetSufaceColor(vtkFloatingPointType (color.red()) / 255.,
1359 vtkFloatingPointType (color.green()) / 255.,
1360 vtkFloatingPointType (color.blue()) / 255.,
1363 anActor->SetEdgeColor(vtkFloatingPointType (edgecolor.red()) / 255.,
1364 vtkFloatingPointType (edgecolor.green()) / 255.,
1365 vtkFloatingPointType (edgecolor.blue()) / 255.);
1367 anActor->SetOutlineColor(vtkFloatingPointType (outlinecolor.red()) / 255.,
1368 vtkFloatingPointType (outlinecolor.green()) / 255.,
1369 vtkFloatingPointType (outlinecolor.blue()) / 255.);
1372 anActor->SetHighlightColor(vtkFloatingPointType (selectioncolor.red()) / 255.,
1373 vtkFloatingPointType (selectioncolor.green()) / 255.,
1374 vtkFloatingPointType (selectioncolor.blue()) / 255.);
1376 anActor->SetPreHighlightColor(vtkFloatingPointType (preSelectioncolor.red()) / 255.,
1377 vtkFloatingPointType (preSelectioncolor.green()) / 255.,
1378 vtkFloatingPointType (preSelectioncolor.blue()) / 255.);
1381 /* Shrink factor and size edges */
1382 anActor->SetShrinkFactor(aDlg->GetIntValue(2) / 100.);
1383 anActor->SetLineWidth(aDlg->GetIntValue(1));
1385 /* Nodes color and size */
1386 anActor->SetNodeColor(vtkFloatingPointType (nodecolor.red()) / 255.,
1387 vtkFloatingPointType (nodecolor.green()) / 255.,
1388 vtkFloatingPointType (nodecolor.blue()) / 255.);
1391 anActor->Set0DColor(vtkFloatingPointType (color0D.red()) / 255.,
1392 vtkFloatingPointType (color0D.green()) / 255.,
1393 vtkFloatingPointType (color0D.blue()) / 255.);
1394 anActor->Set0DSize(aDlg->GetIntValue(3));
1397 anActor->SetBallColor(vtkFloatingPointType (ballcolor.red()) / 255.,
1398 vtkFloatingPointType (ballcolor.green()) / 255.,
1399 vtkFloatingPointType (ballcolor.blue()) / 255.);
1400 anActor->SetBallSize(aDlg->GetIntValue(4));
1402 /* Faces orientation */
1403 vtkFloatingPointType c[3] = {vtkFloatingPointType(faces_orientation_color.redF()),
1404 vtkFloatingPointType(faces_orientation_color.greenF()),
1405 vtkFloatingPointType(faces_orientation_color.blueF())};
1406 anActor->SetFacesOrientationColor(c);
1407 anActor->SetFacesOrientationScale(aDlg->GetDoubleValue(1));
1408 anActor->SetFacesOrientation3DVectors(aDlg->GetBooleanValue(1));
1410 VTK::MarkerType aMarkerTypeNew = aDlg->getMarkerType();
1411 VTK::MarkerScale aMarkerScaleNew = aDlg->getStandardMarkerScale();
1412 int aMarkerTextureNew = aDlg->getCustomMarkerID();
1413 if( aMarkerTypeNew != VTK::MT_USER )
1414 anActor->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
1416 const VTK::MarkerMap& aMarkerMap = theMarkerMap[ aStudy->StudyId() ];
1417 VTK::MarkerMap::const_iterator anIter = aMarkerMap.find( aMarkerTextureNew );
1418 if( anIter != aMarkerMap.end() )
1419 anActor->SetMarkerTexture( aMarkerTextureNew, anIter->second.second );
1422 SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
1423 if( !aGroupObject->_is_nil() )
1425 SMESH::ElementType anElementType = aGroupObject->GetType();
1427 switch( anElementType )
1429 case SMESH::NODE: aColor = nodecolor; break;
1430 case SMESH::EDGE: aColor = edgecolor; break;
1431 default: aColor = color; break;
1434 SALOMEDS::Color aGroupColor;
1435 aGroupColor.R = (float)aColor.red() / 255.0;
1436 aGroupColor.G = (float)aColor.green() / 255.0;
1437 aGroupColor.B = (float)aColor.blue() / 255.0;
1438 aGroupObject->SetColor( aGroupColor );
1443 SMESH::RepaintCurrentView();
1449 SALOME_ListIteratorOfListIO It( selected );
1450 for( ; It.More(); It.Next()){
1451 Handle(SALOME_InteractiveObject) IObject = It.Value();
1452 if(IObject->hasEntry()){
1453 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
1454 switch(theCommandID){
1456 anActor->SetRepresentation(SMESH_Actor::eEdge);
1459 anActor->SetRepresentation(SMESH_Actor::eSurface);
1462 if(anActor->IsShrunk())
1463 anActor->UnShrink();
1465 anActor->SetShrink();
1468 anActor->SetRepresentation(SMESH_Actor::ePoint);
1471 if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eLines)
1472 anActor->SetQuadratic2DRepresentation(SMESH_Actor::eLines);
1475 if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eArcs)
1476 anActor->SetQuadratic2DRepresentation(SMESH_Actor::eArcs);
1482 SMESH::RepaintCurrentView();
1486 void Control( int theCommandID )
1488 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1489 SALOME_ListIO selected;
1491 aSel->selectedObjects( selected );
1493 if( !selected.IsEmpty() ){
1494 Handle(SALOME_InteractiveObject) anIO = selected.First();
1496 SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
1497 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())) {
1498 switch ( theCommandID ){
1500 aControl = SMESH_Actor::eLength;
1503 aControl = SMESH_Actor::eLength2D;
1506 aControl = SMESH_Actor::eFreeEdges;
1509 aControl = SMESH_Actor::eFreeBorders;
1512 aControl = SMESH_Actor::eMultiConnection;
1515 aControl = SMESH_Actor::eFreeNodes;
1518 aControl = SMESH_Actor::eMultiConnection2D;
1521 aControl = SMESH_Actor::eArea;
1524 aControl = SMESH_Actor::eTaper;
1527 aControl = SMESH_Actor::eAspectRatio;
1530 aControl = SMESH_Actor::eAspectRatio3D;
1533 aControl = SMESH_Actor::eMinimumAngle;
1536 aControl = SMESH_Actor::eWarping;
1539 aControl = SMESH_Actor::eSkew;
1542 aControl = SMESH_Actor::eVolume3D;
1545 aControl = SMESH_Actor::eFreeFaces;
1548 aControl = SMESH_Actor::eMaxElementLength2D;
1551 aControl = SMESH_Actor::eMaxElementLength3D;
1554 aControl = SMESH_Actor::eBareBorderVolume;
1557 aControl = SMESH_Actor::eBareBorderFace;
1560 aControl = SMESH_Actor::eOverConstrainedVolume;
1563 aControl = SMESH_Actor::eOverConstrainedFace;
1566 aControl = SMESH_Actor::eCoincidentNodes;
1569 aControl = SMESH_Actor::eCoincidentElems1D;
1572 aControl = SMESH_Actor:: eCoincidentElems2D;
1575 aControl = SMESH_Actor::eCoincidentElems3D;
1579 anActor->SetControlMode(aControl);
1580 anActor->GetScalarBarActor()->SetTitle( functorToString( anActor->GetFunctor() ).toLatin1().constData() );
1581 SMESH::RepaintCurrentView();
1582 #ifndef DISABLE_PLOT2DVIEWER
1583 if(anActor->GetPlot2Histogram()) {
1584 SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
1585 QString functorName = functorToString( anActor->GetFunctor());
1586 QString aHistogramName("%1 : %2");
1587 aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
1588 aHistogram->setName(aHistogramName);
1589 aHistogram->setHorTitle(functorName);
1590 SMESH::ProcessIn2DViewers(anActor);
1599 bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
1600 MeshObjectType theType,
1601 const QString theInTypeName,
1602 QString & theOutTypeName)
1604 SMESH_TypeFilter aTypeFilter( theType );
1606 if( !theIO.IsNull() )
1608 entry = theIO->getEntry();
1609 LightApp_DataOwner owner( entry );
1610 if ( aTypeFilter.isOk( &owner )) {
1611 theOutTypeName = theInTypeName;
1619 QString CheckTypeObject(const Handle(SALOME_InteractiveObject) & theIO)
1621 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1622 _PTR(SObject) aSObj = aStudy->FindObjectID(theIO->getEntry());
1624 _PTR(SComponent) aSComp = aSObj->GetFatherComponent();
1625 CORBA::String_var anID = aSComp->GetID().c_str();
1626 if (!strcmp(anID.in(),theIO->getEntry()))
1632 CheckOIType ( theIO, HYPOTHESIS, "Hypothesis", aTypeName ) ||
1633 CheckOIType ( theIO, ALGORITHM, "Algorithm", aTypeName ) ||
1634 CheckOIType ( theIO, MESH, "Mesh", aTypeName ) ||
1635 CheckOIType ( theIO, SUBMESH, "SubMesh", aTypeName ) ||
1636 CheckOIType ( theIO, GROUP, "Group", aTypeName )
1644 QString CheckHomogeneousSelection()
1646 //SUIT_Study* aStudy = SMESH::GetActiveStudy();
1647 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1648 SALOME_ListIO selected;
1650 aSel->selectedObjects( selected );
1652 QString RefType = CheckTypeObject(selected.First());
1653 SALOME_ListIteratorOfListIO It(selected);
1654 for ( ; It.More(); It.Next())
1656 Handle(SALOME_InteractiveObject) IObject = It.Value();
1657 QString Type = CheckTypeObject(IObject);
1658 if (Type.compare(RefType) != 0)
1659 return "Heterogeneous Selection";
1666 void SMESHGUI::OnEditDelete()
1668 // VSR 17/11/04: check if all objects selected belong to SMESH component --> start
1669 LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
1670 SALOME_ListIO selected; aSel->selectedObjects( selected, QString::null, false );
1672 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
1673 _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
1674 _PTR(GenericAttribute) anAttr;
1675 _PTR(AttributeIOR) anIOR;
1677 int objectCount = 0;
1679 QString aParentComponent = QString::null;
1680 Handle(SALOME_InteractiveObject) anIO;
1681 for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
1683 anIO = anIt.Value();
1684 QString cur = anIO->getComponentDataType();
1685 _PTR(SObject) aSO = aStudy->FindObjectID(anIO->getEntry());
1687 // check if object is reference
1688 _PTR(SObject) aRefSObj;
1689 aNameList.append("\n - ");
1690 if ( aSO->ReferencedObject( aRefSObj ) ) {
1691 QString aRefName = QString::fromStdString ( aRefSObj->GetName() );
1692 aNameList.append( aRefName );
1693 cur = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
1696 aNameList.append(anIO->getName());
1700 if( aParentComponent.isNull() )
1701 aParentComponent = cur;
1702 else if( !aParentComponent.isEmpty() && aParentComponent!=cur )
1703 aParentComponent = "";
1706 if ( objectCount == 0 )
1707 return; // No Valid Objects Selected
1709 if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() ) {
1710 SUIT_MessageBox::warning( SMESHGUI::desktop(),
1711 QObject::tr("ERR_ERROR"),
1712 QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ) );
1715 // VSR 17/11/04: check if all objects selected belong to SMESH component <-- finish
1716 if (SUIT_MessageBox::warning
1717 (SMESHGUI::desktop(),
1718 QObject::tr("SMESH_WRN_WARNING"),
1719 QObject::tr("SMESH_REALLY_DELETE").arg( objectCount ).arg( aNameList ),
1720 SUIT_MessageBox::Yes | SUIT_MessageBox::No,
1721 SUIT_MessageBox::Yes) != SUIT_MessageBox::Yes)
1724 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
1726 // Put the whole hierarchy of sub-objects of the selected SO's into a list and
1727 // then treat them all starting from the deepest objects (at list back)
1728 std::list< _PTR(SObject) > listSO;
1729 SALOME_ListIteratorOfListIO It(selected);
1730 for( ; It.More(); It.Next()) // loop on selected IO's
1732 Handle(SALOME_InteractiveObject) IObject = It.Value();
1733 if(IObject->hasEntry()) {
1734 _PTR(SObject) aSO = aStudy->FindObjectID(IObject->getEntry());
1736 // disable removal of "SMESH" component object
1737 if(aSO->FindAttribute(anAttr, "AttributeIOR")){
1739 if ( engineIOR() == anIOR->Value().c_str() )
1742 //Check the referenced object
1743 _PTR(SObject) aRefSObject;
1744 if ( aSO && aSO->ReferencedObject( aRefSObject ) )
1745 aSO = aRefSObject; // Delete main Object instead of reference
1747 listSO.push_back( aSO );
1748 std::list< _PTR(SObject) >::iterator itSO = listSO.begin();
1749 for ( ; itSO != listSO.end(); ++itSO ) {
1750 _PTR(ChildIterator) it = aStudy->NewChildIterator( *itSO );
1751 for (it->InitEx(false); it->More(); it->Next())
1752 listSO.push_back( it->Value() );
1756 // Check if none of objects to delete is referred from outside
1757 std::list< _PTR(SObject) >::reverse_iterator ritSO;
1758 for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO )
1760 _PTR(SObject) SO = *ritSO;
1761 if ( !SO ) continue;
1762 std::vector<_PTR(SObject)> aReferences = aStudy->FindDependances( *ritSO );
1763 for (size_t i = 0; i < aReferences.size(); i++) {
1764 _PTR(SComponent) aComponent = aReferences[i]->GetFatherComponent();
1765 std::string type = aComponent->ComponentDataType();
1766 if ( type != "SMESH" )
1768 SUIT_MessageBox::warning( anApp->desktop(),
1769 QObject::tr("WRN_WARNING"),
1770 QObject::tr("DEP_OBJECT") );
1771 return; // outside SMESH, there is an object depending on a SMESH object
1776 // Treat SO's in the list starting from the back
1777 aStudyBuilder->NewCommand(); // There is a transaction
1778 for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO )
1780 _PTR(SObject) SO = *ritSO;
1781 if ( !SO ) continue;
1782 std::string anEntry = SO->GetID();
1784 /** Erase graphical object **/
1785 if(SO->FindAttribute(anAttr, "AttributeIOR")){
1786 ViewManagerList aViewMenegers = anApp->viewManagers();
1787 ViewManagerList::const_iterator it = aViewMenegers.begin();
1788 for( ; it != aViewMenegers.end(); it++) {
1789 SUIT_ViewManager* vm = *it;
1790 int nbSf = vm ? vm->getViewsCount() : 0;
1792 QVector<SUIT_ViewWindow*> aViews = vm->getViews();
1793 for(int i = 0; i < nbSf; i++){
1794 SUIT_ViewWindow *sf = aViews[i];
1795 if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
1796 SMESH::RemoveActor(sf,anActor);
1802 /** Remove an object from data structures **/
1803 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO ));
1804 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( SO ));
1805 if ( !aGroup->_is_nil() ) { // DELETE GROUP
1806 SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh();
1807 aMesh->RemoveGroup( aGroup );
1809 else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH
1810 SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
1811 aMesh->RemoveSubMesh( aSubMesh );
1813 _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh);
1815 SMESH::ModifiedMesh(aMeshSO, false, aMesh->NbNodes()==0);
1818 Handle(SALOME_InteractiveObject) IObject = new SALOME_InteractiveObject
1819 ( anEntry.c_str(), engineIOR().toLatin1().data(), SO->GetName().c_str() );
1820 QString objType = CheckTypeObject(IObject);
1821 if ( objType == "Hypothesis" || objType == "Algorithm" ) {// DELETE HYPOTHESIS
1822 SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
1823 aStudyBuilder->RemoveObjectWithChildren( SO );
1825 else {// default action: remove SObject from the study
1826 // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH
1827 //SUIT_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy);
1829 aStudyBuilder->RemoveObjectWithChildren( SO );
1833 } /* listSO back loop */
1835 aStudyBuilder->CommitCommand();
1837 /* Clear any previous selection */
1839 aSel->setSelectedObjects( l1 );
1841 SMESHGUI::GetSMESHGUI()->updateObjBrowser();
1846 SMESHGUI_EXPORT CAM_Module* createModule()
1848 return new SMESHGUI();
1851 SMESHGUI_EXPORT char* getModuleVersion() {
1852 return (char*)SMESH_VERSION_STR;
1856 SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil();
1858 //=============================================================================
1862 //=============================================================================
1863 SMESHGUI::SMESHGUI() :
1864 SalomeApp_Module( "SMESH" ),
1865 LightApp_Module( "SMESH" )
1867 if ( CORBA::is_nil( myComponentSMESH ) )
1869 CORBA::Boolean anIsEmbeddedMode;
1870 myComponentSMESH = SMESH_Client::GetSMESHGen(getApp()->orb(),anIsEmbeddedMode);
1871 MESSAGE("-------------------------------> anIsEmbeddedMode=" << anIsEmbeddedMode);
1873 // 0019923: EDF 765 SMESH : default values of hypothesis
1874 SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
1875 int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation", 10 );
1876 myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
1877 nbSeg = aResourceMgr->integerValue( "SMESH", "nb_segments_per_edge", 15 );
1878 myComponentSMESH->SetDefaultNbSegments( nbSeg );
1880 const char* options[] = { "historical_python_dump", "forget_mesh_on_hyp_modif" };
1881 for ( size_t i = 0; i < sizeof(options)/sizeof(char*); ++i )
1882 if ( aResourceMgr->hasValue( "SMESH", options[i] ))
1884 QString val = aResourceMgr->stringValue( "SMESH", options[i] );
1885 myComponentSMESH->SetOption( options[i], val.toLatin1().constData() );
1889 myActiveDialogBox = 0;
1890 myFilterLibraryDlg = 0;
1894 myEventCallbackCommand = vtkCallbackCommand::New();
1895 myEventCallbackCommand->Delete();
1896 myEventCallbackCommand->SetClientData( this );
1897 myEventCallbackCommand->SetCallback( SMESHGUI::ProcessEvents );
1900 SMESH::GetFilterManager();
1901 SMESH::GetPattern();
1902 SMESH::GetMeasurements();
1904 /* load resources for all available meshers */
1905 SMESH::InitAvailableHypotheses();
1908 //=============================================================================
1912 //=============================================================================
1913 SMESHGUI::~SMESHGUI()
1915 #ifdef WITHGENERICOBJ
1916 SMESH::GetFilterManager()->UnRegister();
1917 SMESH::GetMeasurements()->UnRegister();
1919 SMESH::GetFilterManager() = SMESH::FilterManager::_nil();
1920 SMESH::GetMeasurements() = SMESH::Measurements::_nil();
1923 //=============================================================================
1927 //=============================================================================
1928 LightApp_SelectionMgr* SMESHGUI::selectionMgr()
1930 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
1932 return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
1937 //=============================================================================
1941 //=============================================================================
1942 bool SMESHGUI::automaticUpdate(unsigned int requestedSize, bool* limitExceeded)
1944 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1948 bool autoUpdate = resMgr->booleanValue( "SMESH", "auto_update", false );
1949 long updateLimit = resMgr->integerValue( "SMESH", "update_limit", 500000 );
1950 bool exceeded = updateLimit > 0 && requestedSize > updateLimit;
1951 if ( limitExceeded ) *limitExceeded = autoUpdate && exceeded;
1952 return autoUpdate && !exceeded;
1955 //=============================================================================
1959 //=============================================================================
1960 SUIT_ResourceMgr* SMESHGUI::resourceMgr()
1962 return dynamic_cast<SUIT_ResourceMgr*>( SUIT_Session::session()->resourceMgr() );
1965 //=============================================================================
1969 //=============================================================================
1970 SMESHGUI* SMESHGUI::GetSMESHGUI()
1972 SMESHGUI* smeshMod = 0;
1973 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
1976 CAM_Module* module = app->module( "Mesh" );
1977 smeshMod = dynamic_cast<SMESHGUI*>( module );
1980 if ( smeshMod && smeshMod->application() && smeshMod->application()->activeStudy() )
1982 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( smeshMod->application()->activeStudy() );
1985 _PTR(Study) aStudy = study->studyDS();
1987 GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
1996 Standard_EXPORT SMESHGUI* GetComponentGUI()
1998 return SMESHGUI::GetSMESHGUI();
2002 //=============================================================================
2006 //=============================================================================
2007 void SMESHGUI::SetState(int aState)
2012 //=============================================================================
2016 //=============================================================================
2017 void SMESHGUI::ResetState()
2022 //=============================================================================
2026 //=============================================================================
2027 void SMESHGUI::EmitSignalDeactivateDialog()
2029 emit SignalDeactivateActiveDialog();
2032 //=============================================================================
2036 //=============================================================================
2037 void SMESHGUI::EmitSignalStudyFrameChanged()
2039 emit SignalStudyFrameChanged();
2042 //=============================================================================
2046 //=============================================================================
2047 void SMESHGUI::EmitSignalCloseAllDialogs()
2049 emit SignalCloseAllDialogs();
2052 //=============================================================================
2056 //=============================================================================
2057 void SMESHGUI::EmitSignalVisibilityChanged()
2059 emit SignalVisibilityChanged();
2062 //=============================================================================
2066 //=============================================================================
2067 QDialog *SMESHGUI::GetActiveDialogBox()
2069 return myActiveDialogBox;
2072 //=============================================================================
2076 //=============================================================================
2077 void SMESHGUI::SetActiveDialogBox(QDialog * aDlg)
2079 myActiveDialogBox = (QDialog *) aDlg;
2083 //=============================================================================
2087 //=============================================================================
2088 SUIT_Desktop* SMESHGUI::desktop()
2090 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
2092 return app->desktop();
2097 //=============================================================================
2101 //=============================================================================
2102 SalomeApp_Study* SMESHGUI::activeStudy()
2104 SUIT_Application* app = SUIT_Session::session()->activeApplication();
2106 return dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
2111 //=============================================================================
2115 //=============================================================================
2116 void SMESHGUI::Modified( bool theIsUpdateActions )
2118 if( SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() ) ) {
2119 if( SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) ) {
2120 appStudy->Modified();
2121 if( theIsUpdateActions )
2122 app->updateActions();
2127 //=============================================================================
2131 //=============================================================================
2132 bool SMESHGUI::DefineDlgPosition(QWidget * aDlg, int &x, int &y)
2134 /* Here the position is on the bottom right corner - 10 */
2135 // aDlg->resize(QSize().expandedTo(aDlg->minimumSizeHint()));
2137 SUIT_Desktop *PP = desktop();
2138 x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10);
2139 y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10);
2143 //=============================================================================
2147 //=============================================================================
2148 static int isStudyLocked(_PTR(Study) theStudy){
2149 return theStudy->GetProperties()->IsLocked();
2152 static bool checkLock(_PTR(Study) theStudy) {
2153 if (isStudyLocked(theStudy)) {
2154 SUIT_MessageBox::warning( SMESHGUI::desktop(),
2155 QObject::tr("WRN_WARNING"),
2156 QObject::tr("WRN_STUDY_LOCKED") );
2162 //=======================================================================
2163 //function : CheckActiveStudyLocked
2165 //=======================================================================
2167 bool SMESHGUI::isActiveStudyLocked()
2169 _PTR(Study) aStudy = activeStudy()->studyDS();
2170 return checkLock( aStudy );
2173 //=============================================================================
2177 //=============================================================================
2178 bool SMESHGUI::OnGUIEvent( int theCommandID )
2180 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( application() );
2184 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
2185 SUIT_ResourceMgr* mgr = resourceMgr();
2189 if (CORBA::is_nil(GetSMESHGen()->GetCurrentStudy())) {
2190 GetSMESHGen()->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
2193 SUIT_ViewWindow* view = application()->desktop()->activeWindow();
2194 SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
2196 //QAction* act = action( theCommandID );
2198 switch (theCommandID) {
2200 if(checkLock(aStudy)) break;
2212 if(checkLock(aStudy)) break;
2213 ::ImportMeshesFromFile(GetSMESHGen(),theCommandID);
2217 case 150: //MED FILE INFORMATION
2219 SALOME_ListIO selected;
2220 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2222 aSel->selectedObjects( selected );
2223 if( selected.Extent() )
2225 Handle(SALOME_InteractiveObject) anIObject = selected.First();
2226 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
2227 if ( !aMesh->_is_nil() )
2229 SMESHGUI_FileInfoDlg dlg( desktop(), aMesh->GetMEDFileInfo() );
2236 case 122: // EXPORT MED
2251 ::ExportMeshToFile(theCommandID);
2255 case 200: // SCALAR BAR
2257 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2258 SALOME_ListIO selected;
2260 aSel->selectedObjects( selected );
2262 if( selected.Extent() ) {
2263 Handle(SALOME_InteractiveObject) anIO = selected.First();
2264 if( anIO->hasEntry() ) {
2265 if( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) {
2266 anActor->SetControlMode( SMESH_Actor::eNone );
2267 #ifndef DISABLE_PLOT2DVIEWER
2268 SMESH::ProcessIn2DViewers(anActor,SMESH::RemoveFrom2dViewer);
2277 SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( this );
2282 // dump control distribution data to the text file
2283 ::SaveDistribution();
2289 // show/ distribution
2290 ::ShowDistribution();
2294 #ifndef DISABLE_PLOT2DVIEWER
2297 // plot distribution
2298 ::PlotDistribution();
2309 ::DisableAutoColor();
2312 case 1134: // Clipping
2313 case 1133: // Tranparency
2314 case 1132: // Display preferences (colors, shrink size, line width, ...)
2321 ::SetDisplayMode(theCommandID, myMarkerMap);
2324 //2D quadratic representation
2327 ::SetDisplayMode(theCommandID, myMarkerMap);
2331 case 216: // 0D elements
2334 case 219: // Volumes
2335 case 220: // All Entity
2337 ::SetDisplayEntity(theCommandID);
2340 case 221: // Orientation of faces
2342 LightApp_SelectionMgr* mgr = selectionMgr();
2343 SALOME_ListIO selected; mgr->selectedObjects( selected );
2345 SALOME_ListIteratorOfListIO it(selected);
2346 for( ; it.More(); it.Next()) {
2347 Handle(SALOME_InteractiveObject) anIObject = it.Value();
2348 if(anIObject->hasEntry()) {
2349 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
2350 anActor->SetFacesOriented( !anActor->GetFacesOriented() );
2359 if(checkLock(aStudy)) break;
2361 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
2364 SMESH::UpdateView();
2366 catch (std::bad_alloc) { // PAL16774 (Crash after display of many groups)
2367 SMESH::OnVisuException();
2369 catch (...) { // PAL16774 (Crash after display of many groups)
2370 SMESH::OnVisuException();
2374 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2375 aSel->selectedObjects( l );
2376 aSel->setSelectedObjects( l );
2381 case 301: // DISPLAY
2382 case 302: // DISPLAY ONLY
2384 SMESH::EDisplaing anAction;
2385 switch (theCommandID) {
2386 case 300: anAction = SMESH::eErase; break;
2387 case 301: anAction = SMESH::eDisplay; break;
2388 case 302: anAction = SMESH::eDisplayOnly; break;
2391 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2392 SALOME_ListIO sel_objects, to_process;
2394 aSel->selectedObjects( sel_objects );
2396 if( theCommandID==302 )
2398 MESSAGE("anAction = SMESH::eDisplayOnly");
2399 startOperation( myEraseAll );
2402 extractContainers( sel_objects, to_process );
2405 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
2409 SALOME_ListIteratorOfListIO It( to_process );
2410 for ( ; It.More(); It.Next()) {
2412 Handle(SALOME_InteractiveObject) IOS = It.Value();
2413 if (IOS->hasEntry()) {
2415 if (!SMESH::UpdateView(anAction, IOS->getEntry())) {
2416 SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
2417 break; // PAL16774 (Crash after display of many groups)
2419 if (anAction == SMESH::eDisplayOnly)
2421 MESSAGE("anAction = SMESH::eDisplayOnly");
2422 anAction = SMESH::eDisplay;
2428 // PAL13338 + PAL15161 -->
2429 if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy)) {
2430 MESSAGE("anAction = SMESH::eDisplayOnly");
2431 SMESH::UpdateView();
2432 SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
2434 // PAL13338 + PAL15161 <--
2436 catch (...) { // PAL16774 (Crash after display of many groups)
2437 SMESH::OnVisuException();
2440 if (anAction == SMESH::eErase) {
2441 MESSAGE("anAction == SMESH::eErase");
2443 aSel->setSelectedObjects( l1 );
2446 aSel->setSelectedObjects( to_process );
2453 if(checkLock(aStudy)) break;
2456 EmitSignalDeactivateDialog();
2458 ( new SMESHGUI_NodesDlg( this ) )->show();
2461 SUIT_MessageBox::warning(desktop(),
2462 tr("SMESH_WRN_WARNING"),
2463 tr("SMESH_WRN_VIEWER_VTK"));
2468 case 2151: // FILTER
2472 EmitSignalDeactivateDialog();
2473 ( new SMESHGUI_FilterDlg( this, SMESH::EDGE ) )->show();
2478 case 701: // COMPUTE MESH
2479 case 711: // PRECOMPUTE MESH
2480 case 712: // EVALUATE MESH
2481 case 713: // MESH ORDER
2482 case 702: // Create mesh
2483 case 703: // Create sub-mesh
2484 case 704: // Edit mesh/sub-mesh
2485 startOperation( theCommandID );
2487 case 705: // copy mesh
2489 if (checkLock(aStudy)) break;
2490 EmitSignalDeactivateDialog();
2491 ( new SMESHGUI_CopyMeshDlg( this ) )->show();
2494 case 710: // Build compound mesh
2496 if (checkLock(aStudy)) break;
2497 EmitSignalDeactivateDialog();
2498 ( new SMESHGUI_BuildCompoundDlg( this ) )->show();
2502 case 407: // DIAGONAL INVERSION
2503 case 408: // Delete diagonal
2507 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
2508 tr( "NOT_A_VTK_VIEWER" ) );
2512 if ( checkLock( aStudy ) )
2515 /*Standard_Boolean aRes;
2516 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
2517 if ( aMesh->_is_nil() )
2519 SUIT_MessageBox::warning(GetDesktop(), tr( "SMESH_WRN_WARNING" ),
2520 tr( "SMESH_BAD_SELECTION" ) );
2524 EmitSignalDeactivateDialog();
2525 if ( theCommandID == 407 )
2526 ( new SMESHGUI_TrianglesInversionDlg( this ) )->show();
2528 ( new SMESHGUI_UnionOfTwoTrianglesDlg( this ) )->show();
2531 case 409: // Change orientation
2532 case 410: // Union of triangles
2533 case 411: // Cutting of quadrangles
2534 case 419: // Splitting volumes into tetrahedra
2538 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
2539 tr( "NOT_A_VTK_VIEWER" ) );
2543 if ( checkLock( aStudy ) )
2546 EmitSignalDeactivateDialog();
2547 SMESHGUI_MultiEditDlg* aDlg = NULL;
2548 if ( theCommandID == 409 )
2549 aDlg = new SMESHGUI_ChangeOrientationDlg(this);
2550 else if ( theCommandID == 410 )
2551 aDlg = new SMESHGUI_UnionOfTrianglesDlg(this);
2552 else if ( theCommandID == 419 )
2553 aDlg = new SMESHGUI_CuttingIntoTetraDlg(this);
2555 aDlg = new SMESHGUI_CuttingOfQuadsDlg(this);
2560 case 412: // Smoothing
2562 if(checkLock(aStudy)) break;
2564 EmitSignalDeactivateDialog();
2565 ( new SMESHGUI_SmoothingDlg( this ) )->show();
2568 SUIT_MessageBox::warning(desktop(),
2569 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2573 case 413: // Extrusion
2575 if (checkLock(aStudy)) break;
2577 EmitSignalDeactivateDialog();
2578 ( new SMESHGUI_ExtrusionDlg ( this ) )->show();
2580 SUIT_MessageBox::warning(desktop(),
2581 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2585 case 414: // Revolution
2587 if(checkLock(aStudy)) break;
2589 EmitSignalDeactivateDialog();
2590 ( new SMESHGUI_RevolutionDlg( this ) )->show();
2593 SUIT_MessageBox::warning(desktop(),
2594 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2598 case 415: // Pattern mapping
2600 if ( checkLock( aStudy ) )
2604 EmitSignalDeactivateDialog();
2605 ( new SMESHGUI_MeshPatternDlg( this ) )->show();
2608 SUIT_MessageBox::warning(desktop(),
2609 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2613 case 416: // Extrusion along a path
2615 if (checkLock(aStudy)) break;
2617 EmitSignalDeactivateDialog();
2618 ( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show();
2620 SUIT_MessageBox::warning(desktop(),
2621 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2625 case 417: // Convert mesh to quadratic
2626 case 418: // create 2D mesh from 3D
2627 case 420: // Reorient faces
2628 case 806: // CREATE GEO GROUP
2630 startOperation( theCommandID );
2633 case 801: // CREATE GROUP
2637 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
2638 tr( "NOT_A_VTK_VIEWER" ) );
2642 if(checkLock(aStudy)) break;
2643 EmitSignalDeactivateDialog();
2644 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
2646 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2647 SALOME_ListIO selected;
2649 aSel->selectedObjects( selected );
2651 int nbSel = selected.Extent();
2653 // check if mesh is selected
2654 aMesh = SMESH::GetMeshByIO( selected.First() );
2656 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aMesh);
2661 case 802: // CONSTRUCT GROUP
2665 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
2666 tr( "NOT_A_VTK_VIEWER" ) );
2670 if(checkLock(aStudy)) break;
2671 EmitSignalDeactivateDialog();
2673 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2674 SALOME_ListIO selected;
2676 aSel->selectedObjects( selected );
2678 int nbSel = selected.Extent();
2680 // check if submesh is selected
2681 Handle(SALOME_InteractiveObject) IObject = selected.First();
2682 if (IObject->hasEntry()) {
2683 _PTR(SObject) aSObj = aStudy->FindObjectID(IObject->getEntry());
2685 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( aSObj ) );
2686 if (!aSubMesh->_is_nil()) {
2688 SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
2689 // get submesh elements list by types
2690 SMESH::long_array_var aNodes = aSubMesh->GetElementsByType(SMESH::NODE);
2691 SMESH::long_array_var aEdges = aSubMesh->GetElementsByType(SMESH::EDGE);
2692 SMESH::long_array_var aFaces = aSubMesh->GetElementsByType(SMESH::FACE);
2693 SMESH::long_array_var aVolumes = aSubMesh->GetElementsByType(SMESH::VOLUME);
2694 // create group for each type o elements
2695 QString aName = IObject->getName();
2696 QStringList anEntryList;
2697 if (aNodes->length() > 0) {
2698 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::NODE, aName + "_Nodes");
2699 aGroup->Add(aNodes.inout());
2700 if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
2701 anEntryList.append( aSObject->GetID().c_str() );
2703 if (aEdges->length() > 0) {
2704 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::EDGE, aName + "_Edges");
2705 aGroup->Add(aEdges.inout());
2706 if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
2707 anEntryList.append( aSObject->GetID().c_str() );
2709 if (aFaces->length() > 0) {
2710 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::FACE, aName + "_Faces");
2711 aGroup->Add(aFaces.inout());
2712 if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
2713 anEntryList.append( aSObject->GetID().c_str() );
2715 if (aVolumes->length() > 0) {
2716 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::VOLUME, aName + "_Volumes");
2717 aGroup->Add(aVolumes.inout());
2718 if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
2719 anEntryList.append( aSObject->GetID().c_str() );
2722 anApp->browseObjects( anEntryList );
2724 catch(const SALOME::SALOME_Exception & S_ex){
2725 SalomeApp_Tools::QtCatchCorbaException(S_ex);
2732 SUIT_MessageBox::warning(desktop(),
2733 tr("SMESH_WRN_WARNING"),
2734 tr("SMESH_WRN_NO_AVAILABLE_DATA"));
2739 case 803: // EDIT GROUP
2743 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
2744 tr( "NOT_A_VTK_VIEWER" ) );
2748 if(checkLock(aStudy)) break;
2749 EmitSignalDeactivateDialog();
2751 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2752 SALOME_ListIO selected;
2754 aSel->selectedObjects( selected );
2756 SALOME_ListIteratorOfListIO It (selected);
2757 int nbSelectedGroups = 0;
2758 for ( ; It.More(); It.Next() )
2760 SMESH::SMESH_GroupBase_var aGroup =
2761 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(It.Value());
2762 if (!aGroup->_is_nil()) {
2764 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aGroup);
2768 if (nbSelectedGroups == 0)
2770 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, SMESH::SMESH_GroupBase::_nil());
2776 case 804: // Add elements to group
2778 if(checkLock(aStudy)) break;
2779 if (myState == 800) {
2780 SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
2781 if (aDlg) aDlg->onAdd();
2786 case 805: // Remove elements from group
2788 if(checkLock(aStudy)) break;
2789 if (myState == 800) {
2790 SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
2791 if (aDlg) aDlg->onRemove();
2796 case 815: // Edit GEOM GROUP as standalone
2800 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
2801 tr( "NOT_A_VTK_VIEWER" ) );
2805 if(checkLock(aStudy)) break;
2806 EmitSignalDeactivateDialog();
2808 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2809 SALOME_ListIO selected;
2811 aSel->selectedObjects( selected );
2813 SALOME_ListIteratorOfListIO It (selected);
2814 for ( ; It.More(); It.Next() )
2816 SMESH::SMESH_GroupOnGeom_var aGroup =
2817 SMESH::IObjectToInterface<SMESH::SMESH_GroupOnGeom>(It.Value());
2818 if (!aGroup->_is_nil()) {
2819 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aGroup, true );
2824 SMESH::SMESH_GroupOnFilter_var aGroup =
2825 SMESH::IObjectToInterface<SMESH::SMESH_GroupOnFilter>(It.Value());
2826 if (!aGroup->_is_nil()) {
2827 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aGroup, true );
2835 case 810: // Union Groups
2836 case 811: // Intersect groups
2837 case 812: // Cut groups
2841 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
2842 tr( "NOT_A_VTK_VIEWER" ) );
2846 if ( checkLock( aStudy ) )
2849 EmitSignalDeactivateDialog();
2851 SMESHGUI_GroupOpDlg* aDlg = 0;
2852 if ( theCommandID == 810 )
2853 aDlg = new SMESHGUI_UnionGroupsDlg( this );
2854 else if ( theCommandID == 811 )
2855 aDlg = new SMESHGUI_IntersectGroupsDlg( this );
2857 aDlg = new SMESHGUI_CutGroupsDlg( this );
2864 case 814: // Create groups of entities from existing groups of superior dimensions
2866 if ( checkLock( aStudy ) )
2869 EmitSignalDeactivateDialog();
2870 SMESHGUI_GroupOpDlg* aDlg = new SMESHGUI_DimGroupDlg( this );
2876 case 813: // Delete groups with their contents
2880 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
2881 tr( "NOT_A_VTK_VIEWER" ) );
2885 if ( checkLock( aStudy ) )
2888 EmitSignalDeactivateDialog();
2890 ( new SMESHGUI_DeleteGroupDlg( this ) )->show();
2894 case 900: // MESH INFOS
2895 case 903: // WHAT IS
2897 int page = theCommandID == 900 ? SMESHGUI_MeshInfoDlg::BaseInfo : SMESHGUI_MeshInfoDlg::ElemInfo;
2898 EmitSignalDeactivateDialog();
2899 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2900 SALOME_ListIO selected;
2902 aSel->selectedObjects( selected );
2904 if ( selected.Extent() > 1 ) { // a dlg for each IO
2905 SALOME_ListIteratorOfListIO It( selected );
2906 for ( ; It.More(); It.Next() ) {
2907 SMESHGUI_MeshInfoDlg* dlg = new SMESHGUI_MeshInfoDlg( SMESHGUI::desktop(), page );
2908 dlg->showInfo( It.Value() );
2913 SMESHGUI_MeshInfoDlg* dlg = new SMESHGUI_MeshInfoDlg( SMESHGUI::desktop(), page );
2919 case 904: // FIND ELEM
2921 startOperation( theCommandID );
2925 case 1100: // EDIT HYPOTHESIS
2927 if(checkLock(aStudy)) break;
2929 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2930 SALOME_ListIO selected;
2932 aSel->selectedObjects( selected );
2934 int nbSel = selected.Extent();
2937 Handle(SALOME_InteractiveObject) anIObject = selected.First();
2938 SMESH::SMESH_Hypothesis_var aHypothesis = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(anIObject);
2940 /* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */
2941 /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects */
2942 /* Warning : however by internal mechanism all subMeshes icons are changed ! */
2943 if ( !aHypothesis->_is_nil() )
2946 //SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
2947 SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
2949 aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop(), this, SLOT( onHypothesisEdit( int ) ) );
2959 case 1102: // REMOVE HYPOTHESIS / ALGORITHMS
2961 if(checkLock(aStudy)) break;
2962 SUIT_OverrideCursor wc;
2964 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2965 SALOME_ListIO selected;
2967 aSel->selectedObjects( selected, QString::null, false );
2969 SALOME_ListIteratorOfListIO It(selected);
2970 for (int i = 0; It.More(); It.Next(), i++) {
2971 Handle(SALOME_InteractiveObject) IObject = It.Value();
2972 SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
2975 aSel->setSelectedObjects( l1 );
2981 case 4009: // ELEM0D
2983 case 4021: // TRIANGLE
2985 case 4023: // POLYGON
2989 case 4134: // PYRAMID
2990 case 4135: // OCTA12
2992 if(checkLock(aStudy)) break;
2994 EmitSignalDeactivateDialog();
2995 SMDSAbs_EntityType type = SMDSEntity_Edge;
2996 switch (theCommandID) {
2997 case 4008: type = SMDSEntity_Ball; break;
2998 case 4009: type = SMDSEntity_0D; break;
2999 case 4021: type = SMDSEntity_Triangle; break;
3000 case 4022: type = SMDSEntity_Quadrangle; break;
3001 case 4031: type = SMDSEntity_Tetra; break;
3002 case 4023: type = SMDSEntity_Polygon; break;
3003 case 4032: type = SMDSEntity_Hexa; break;
3004 case 4133: type = SMDSEntity_Penta; break;
3005 case 4134: type = SMDSEntity_Pyramid; break;
3006 case 4135: type = SMDSEntity_Hexagonal_Prism; break;
3009 ( new SMESHGUI_AddMeshElementDlg( this, type ) )->show();
3012 SUIT_MessageBox::warning(desktop(),
3013 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3017 case 4033: // POLYHEDRON
3019 if(checkLock(aStudy)) break;
3021 EmitSignalDeactivateDialog();
3022 ( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show();
3025 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3026 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3030 case 4034: // QUADRATIC EDGE
3031 case 4035: // QUADRATIC TRIANGLE
3032 case 4036: // QUADRATIC QUADRANGLE
3033 case 4136: // BIQUADRATIC QUADRANGLE
3034 case 4037: // QUADRATIC TETRAHEDRON
3035 case 4038: // QUADRATIC PYRAMID
3036 case 4039: // QUADRATIC PENTAHEDRON
3037 case 4040: // QUADRATIC HEXAHEDRON
3038 case 4140: // TRIQUADRATIC HEXAHEDRON
3040 if(checkLock(aStudy)) break;
3042 EmitSignalDeactivateDialog();
3043 SMDSAbs_EntityType type;
3045 switch (theCommandID) {
3047 type = SMDSEntity_Quad_Edge; break;
3049 type = SMDSEntity_Quad_Triangle; break;
3051 type = SMDSEntity_Quad_Quadrangle; break;
3053 type = SMDSEntity_BiQuad_Quadrangle; break;
3055 type = SMDSEntity_Quad_Tetra; break;
3057 type = SMDSEntity_Quad_Pyramid; break;
3059 type = SMDSEntity_Quad_Penta; break;
3061 type = SMDSEntity_Quad_Hexa;
3063 type = SMDSEntity_TriQuad_Hexa;
3067 ( new SMESHGUI_AddQuadraticElementDlg( this, type ) )->show();
3070 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3071 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3075 case 4041: // REMOVES NODES
3077 if(checkLock(aStudy)) break;
3079 EmitSignalDeactivateDialog();
3080 ( new SMESHGUI_RemoveNodesDlg( this ) )->show();
3083 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3084 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3088 case 4042: // REMOVES ELEMENTS
3090 if(checkLock(aStudy)) break;
3092 EmitSignalDeactivateDialog();
3093 ( new SMESHGUI_RemoveElementsDlg( this ) )->show();
3097 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3098 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3102 case 4043: { // CLEAR_MESH
3104 if(checkLock(aStudy)) break;
3106 SALOME_ListIO selected;
3107 if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
3108 aSel->selectedObjects( selected );
3110 SUIT_OverrideCursor wc;
3111 SALOME_ListIteratorOfListIO It (selected);
3112 for ( ; It.More(); It.Next() )
3114 Handle(SALOME_InteractiveObject) IOS = It.Value();
3115 SMESH::SMESH_Mesh_var aMesh =
3116 SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IOS);
3117 if ( aMesh->_is_nil()) continue;
3119 SMESH::RemoveVisualObjectWithActors(IOS->getEntry(), true);
3121 _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
3122 SMESH::ModifiedMesh( aMeshSObj, false, true);
3123 // hide groups and submeshes
3124 _PTR(ChildIterator) anIter =
3125 SMESH::GetActiveStudyDocument()->NewChildIterator( aMeshSObj );
3126 for ( anIter->InitEx(true); anIter->More(); anIter->Next() )
3128 _PTR(SObject) so = anIter->Value();
3129 SMESH::RemoveVisualObjectWithActors(so->GetID().c_str(), true);
3132 catch (const SALOME::SALOME_Exception& S_ex){
3134 SalomeApp_Tools::QtCatchCorbaException(S_ex);
3138 SMESH::UpdateView();
3142 case 4044: // REMOVE ORPHAN NODES
3144 if(checkLock(aStudy)) break;
3145 SALOME_ListIO selected;
3146 if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
3147 aSel->selectedObjects( selected );
3148 if ( selected.Extent() == 1 ) {
3149 Handle(SALOME_InteractiveObject) anIO = selected.First();
3150 SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(anIO);
3151 if ( !aMesh->_is_nil() ) {
3152 bool confirm = SUIT_MessageBox::question( SMESHGUI::desktop(),
3153 tr( "SMESH_WARNING" ),
3154 tr( "REMOVE_ORPHAN_NODES_QUESTION"),
3155 SUIT_MessageBox::Yes |
3156 SUIT_MessageBox::No,
3157 SUIT_MessageBox::No ) == SUIT_MessageBox::Yes;
3160 SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
3161 int removed = aMeshEditor->RemoveOrphanNodes();
3162 SUIT_MessageBox::information(SMESHGUI::desktop(),
3163 tr("SMESH_INFORMATION"),
3164 tr("NB_NODES_REMOVED").arg(removed));
3165 if ( removed > 0 ) {
3166 SMESH::UpdateView();
3167 SMESHGUI::Modified();
3170 catch (const SALOME::SALOME_Exception& S_ex) {
3171 SalomeApp_Tools::QtCatchCorbaException(S_ex);
3180 case 4051: // RENUMBERING NODES
3182 if(checkLock(aStudy)) break;
3184 EmitSignalDeactivateDialog();
3185 ( new SMESHGUI_RenumberingDlg( this, 0 ) )->show();
3189 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3190 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3194 case 4052: // RENUMBERING ELEMENTS
3196 if(checkLock(aStudy)) break;
3198 EmitSignalDeactivateDialog();
3199 ( new SMESHGUI_RenumberingDlg( this, 1 ) )->show();
3203 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3204 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3208 case 4061: // TRANSLATION
3210 if(checkLock(aStudy)) break;
3212 EmitSignalDeactivateDialog();
3213 ( new SMESHGUI_TranslationDlg( this ) )->show();
3216 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3217 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3221 case 4062: // ROTATION
3223 if(checkLock(aStudy)) break;
3225 EmitSignalDeactivateDialog();
3226 ( new SMESHGUI_RotationDlg( this ) )->show();
3229 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3230 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3234 case 4063: // SYMMETRY
3236 if(checkLock(aStudy)) break;
3238 EmitSignalDeactivateDialog();
3239 ( new SMESHGUI_SymmetryDlg( this ) )->show();
3242 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3243 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3247 case 4064: // SEWING
3249 if(checkLock(aStudy)) break;
3251 EmitSignalDeactivateDialog();
3252 ( new SMESHGUI_SewingDlg( this ) )->show();
3255 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3256 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3260 case 4065: // MERGE NODES
3262 if(checkLock(aStudy)) break;
3264 EmitSignalDeactivateDialog();
3265 ( new SMESHGUI_MergeDlg( this, 0 ) )->show();
3268 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3269 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3273 case 4066: // MERGE EQUAL ELEMENTS
3275 if (checkLock(aStudy)) break;
3277 EmitSignalDeactivateDialog();
3278 ( new SMESHGUI_MergeDlg( this, 1 ) )->show();
3280 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3281 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3286 case 4067: // MAKE MESH PASS THROUGH POINT
3287 startOperation( 4067 );
3292 if(checkLock(aStudy)) break;
3294 EmitSignalDeactivateDialog();
3295 ( new SMESHGUI_ScaleDlg( this ) )->show();
3298 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3299 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3304 case 4069: // DUPLICATE NODES
3306 if(checkLock(aStudy)) break;
3308 EmitSignalDeactivateDialog();
3309 ( new SMESHGUI_DuplicateNodesDlg( this ) )->show();
3312 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3313 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
3318 case 5105: // Library of selection filters
3320 static QList<int> aTypes;
3321 if ( aTypes.isEmpty() )
3323 aTypes.append( SMESH::NODE );
3324 aTypes.append( SMESH::EDGE );
3325 aTypes.append( SMESH::FACE );
3326 aTypes.append( SMESH::VOLUME );
3328 if (!myFilterLibraryDlg)
3329 myFilterLibraryDlg = new SMESHGUI_FilterLibraryDlg( this, SMESH::GetDesktop( this ), aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
3330 else if (myFilterLibraryDlg->isHidden())
3331 myFilterLibraryDlg->Init( aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
3332 myFilterLibraryDlg->raise();
3336 case 6017: // CONTROLS
3364 LightApp_SelectionMgr* mgr = selectionMgr();
3365 SALOME_ListIO selected; mgr->selectedObjects( selected );
3367 if ( selected.Extent() == 1 && selected.First()->hasEntry() ) {
3368 _PTR(SObject) SO = aStudy->FindObjectID( selected.First()->getEntry() );
3370 CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
3371 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
3372 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
3373 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
3374 if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
3375 ::Control( theCommandID );
3380 SUIT_MessageBox::warning(desktop(),
3381 tr( "SMESH_WRN_WARNING" ),
3382 tr( "SMESH_BAD_SELECTION" ) );
3386 SUIT_MessageBox::warning(desktop(),
3387 tr( "SMESH_WRN_WARNING" ),
3388 tr( "NOT_A_VTK_VIEWER" ) );
3393 LightApp_SelectionMgr* mgr = selectionMgr();
3394 SALOME_ListIO selected; mgr->selectedObjects( selected );
3396 SALOME_ListIteratorOfListIO it(selected);
3397 for( ; it.More(); it.Next()) {
3398 Handle(SALOME_InteractiveObject) anIObject = it.Value();
3399 if(anIObject->hasEntry()) {
3400 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
3401 anActor->SetPointsLabeled( !anActor->GetPointsLabeled() );
3409 LightApp_SelectionMgr* mgr = selectionMgr();
3410 SALOME_ListIO selected; mgr->selectedObjects( selected );
3412 SALOME_ListIteratorOfListIO it(selected);
3413 for( ; it.More(); it.Next()) {
3414 Handle(SALOME_InteractiveObject) anIObject = it.Value();
3415 if(anIObject->hasEntry())
3416 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
3417 anActor->SetCellsLabeled( !anActor->GetCellsLabeled() );
3425 int page = theCommandID == 501 ? SMESHGUI_MeasureDlg::MinDistance : SMESHGUI_MeasureDlg::BoundingBox;
3426 EmitSignalDeactivateDialog();
3427 SMESHGUI_MeasureDlg* dlg = new SMESHGUI_MeasureDlg( SMESHGUI::desktop(), page );
3433 anApp->updateActions(); //SRN: To update a Save button in the toolbar
3434 //updateObjBrowser();
3438 //=============================================================================
3442 //=============================================================================
3443 bool SMESHGUI::OnMousePress( QMouseEvent * pe, SUIT_ViewWindow * wnd )
3448 //=============================================================================
3452 //=============================================================================
3453 bool SMESHGUI::OnMouseMove( QMouseEvent * pe, SUIT_ViewWindow * wnd )
3458 //=============================================================================
3462 //=============================================================================
3463 bool SMESHGUI::OnKeyPress( QKeyEvent * pe, SUIT_ViewWindow * wnd )
3468 //=============================================================================
3469 /*! Method: BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
3470 * Purpose: ensures that the actor for the given <theIO> exists in the active VTK view
3472 //=============================================================================
3473 void SMESHGUI::BuildPresentation( const Handle(SALOME_InteractiveObject) & theIO,
3474 SUIT_ViewWindow* wnd )
3476 if(theIO->hasEntry()){
3477 //SUIT_ViewWindow* wnd = SMESH::GetActiveWindow();
3478 SMESH::UpdateView(wnd,SMESH::eDisplay,theIO->getEntry());
3482 //=======================================================================
3483 // function : createSMESHAction
3485 //=======================================================================
3486 void SMESHGUI::createSMESHAction( const int id, const QString& po_id, const QString& icon_id,
3487 const int key, const bool toggle, const QString& shortcutAction )
3490 QWidget* parent = application()->desktop();
3491 SUIT_ResourceMgr* resMgr = resourceMgr();
3493 if ( !icon_id.isEmpty() )
3494 pix = resMgr->loadPixmap( "SMESH", tr( icon_id.toLatin1().data() ) );
3496 pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data() ), false );
3497 if ( !pix.isNull() )
3498 icon = QIcon( pix );
3500 QString tooltip = tr( QString( "TOP_%1" ).arg( po_id ).toLatin1().data() ),
3501 menu = tr( QString( "MEN_%1" ).arg( po_id ).toLatin1().data() ),
3502 status_bar = tr( QString( "STB_%1" ).arg( po_id ).toLatin1().data() );
3504 createAction( id, tooltip, icon, menu, status_bar, key, parent,
3505 toggle, this, SLOT( OnGUIEvent() ), shortcutAction );
3508 //=======================================================================
3509 // function : createPopupItem
3511 //=======================================================================
3512 void SMESHGUI::createPopupItem( const int id,
3513 const QString& clients,
3514 const QString& types,
3515 const QString& theRule,
3520 parentId = popupMgr()->actionId( action( pId ) );
3522 if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) )
3523 popupMgr()->insert( action( id ), parentId, 0 );
3525 QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality();
3526 QString dc = "selcount"; // VSR : insetad of QtxPopupSelection::defSelCountParam()
3527 QString rule = "(%1) and (%2) and (%3)";
3528 rule = rule.arg( QString( "%1>0" ).arg( dc ) );
3529 if( clients.isEmpty() )
3530 rule = rule.arg( QString( "true" ) );
3532 rule = rule.arg( QString( "%1client in {%2}" ).arg( lc ).arg( clients ) );
3533 rule = rule.arg( QString( "%1type in {%2}" ).arg( lc ).arg( types ) );
3536 bool cont = myRules.contains( id );
3538 rule = QString( "%1 or (%2)" ).arg( myRules[ id ] ).arg( rule );
3540 popupMgr()->setRule( action( id ), rule, QtxPopupMgr::VisibleRule );
3541 myRules[ id ] = QString( cont ? "%1" : "(%1)" ).arg( rule );
3544 //=======================================================================
3545 // function : initialize
3547 //=======================================================================
3548 void SMESHGUI::initialize( CAM_Application* app )
3550 SalomeApp_Module::initialize( app );
3552 // SUIT_ResourceMgr* mgr = app->resourceMgr();
3554 /* Automatic Update flag */
3555 // myAutomaticUpdate = mgr->booleanValue( "SMESH", "AutomaticUpdate", myAutomaticUpdate );
3557 // ----- create actions --------------
3559 //createSMESHAction( 111, "IMPORT_DAT", "", (Qt::CTRL+Qt::Key_B) );
3560 createSMESHAction( 112, "IMPORT_UNV", "", (Qt::CTRL+Qt::Key_U) );
3561 createSMESHAction( 113, "IMPORT_MED", "", (Qt::CTRL+Qt::Key_M) );
3562 createSMESHAction( 114, "NUM" );
3563 createSMESHAction( 115, "IMPORT_STL" );
3564 createSMESHAction( 116, "IMPORT_CGNS" );
3565 createSMESHAction( 117, "IMPORT_SAUV" );
3566 createSMESHAction( 118, "IMPORT_GMF" );
3567 createSMESHAction( 121, "DAT" );
3568 createSMESHAction( 122, "MED" );
3569 createSMESHAction( 123, "UNV" );
3570 createSMESHAction( 140, "STL" );
3571 createSMESHAction( 142, "CGNS");
3572 createSMESHAction( 144, "SAUV");
3573 createSMESHAction( 146, "GMF" );
3574 createSMESHAction( 124, "EXPORT_DAT" );
3575 createSMESHAction( 125, "EXPORT_MED" );
3576 createSMESHAction( 126, "EXPORT_UNV" );
3577 createSMESHAction( 141, "EXPORT_STL" );
3578 createSMESHAction( 143, "EXPORT_CGNS");
3579 createSMESHAction( 145, "EXPORT_SAUV");
3580 createSMESHAction( 147, "EXPORT_GMF" );
3581 createSMESHAction( 150, "FILE_INFO" );
3582 createSMESHAction( 33, "DELETE", "ICON_DELETE", Qt::Key_Delete );
3583 createSMESHAction( 5105, "SEL_FILTER_LIB" );
3584 createSMESHAction( 701, "COMPUTE", "ICON_COMPUTE" );
3585 createSMESHAction( 702, "CREATE_MESH", "ICON_DLG_INIT_MESH" );
3586 createSMESHAction( 703, "CREATE_SUBMESH", "ICON_DLG_ADD_SUBMESH" );
3587 createSMESHAction( 704, "EDIT_MESHSUBMESH","ICON_DLG_EDIT_MESH" );
3588 createSMESHAction( 705, "COPY_MESH", "ICON_COPY_MESH" );
3589 createSMESHAction( 710, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" );
3590 createSMESHAction( 711, "PRECOMPUTE", "ICON_PRECOMPUTE" );
3591 createSMESHAction( 712, "EVALUATE", "ICON_COMPUTE" );
3592 createSMESHAction( 713, "MESH_ORDER", "ICON_COMPUTE" );
3593 createSMESHAction( 806, "CREATE_GEO_GROUP","ICON_CREATE_GEO_GROUP" );
3594 createSMESHAction( 801, "CREATE_GROUP", "ICON_CREATE_GROUP" );
3595 createSMESHAction( 802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" );
3596 createSMESHAction( 803, "EDIT_GROUP", "ICON_EDIT_GROUP" );
3597 createSMESHAction( 815, "EDIT_GEOMGROUP_AS_GROUP", "ICON_EDIT_GROUP" );
3598 createSMESHAction( 804, "ADD" );
3599 createSMESHAction( 805, "REMOVE" );
3600 createSMESHAction( 810, "UN_GROUP", "ICON_UNION" );
3601 createSMESHAction( 811, "INT_GROUP", "ICON_INTERSECT" );
3602 createSMESHAction( 812, "CUT_GROUP", "ICON_CUT" );
3603 createSMESHAction( 814, "UNDERLYING_ELEMS","ICON_UNDERLYING_ELEMS" );
3604 createSMESHAction( 813, "DEL_GROUP", "ICON_DEL_GROUP" );
3605 createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" );
3606 //createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" );
3607 //createSMESHAction( 903, "WHAT_IS", "ICON_WHAT_IS" ); // VSR: issue #0021242 (eliminate "Mesh Element Information" command)
3608 createSMESHAction( 904, "FIND_ELEM", "ICON_FIND_ELEM" );
3609 createSMESHAction( 6001, "LENGTH", "ICON_LENGTH", 0, true );
3610 createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE", 0, true );
3611 createSMESHAction( 6021, "FREE_FACES", "ICON_FREE_FACES", 0, true );
3612 createSMESHAction( 6022, "MAX_ELEMENT_LENGTH_2D", "ICON_MAX_ELEMENT_LENGTH_2D", 0, true );
3613 createSMESHAction( 6023, "MAX_ELEMENT_LENGTH_3D", "ICON_MAX_ELEMENT_LENGTH_3D", 0, true );
3614 createSMESHAction( 6024, "BARE_BORDER_VOLUME", "ICON_BARE_BORDER_VOLUME", 0, true );
3615 createSMESHAction( 6025, "BARE_BORDER_FACE", "ICON_BARE_BORDER_FACE", 0, true );
3616 createSMESHAction( 6026, "OVER_CONSTRAINED_VOLUME","ICON_OVER_CONSTRAINED_VOLUME", 0, true );
3617 createSMESHAction( 6027, "OVER_CONSTRAINED_FACE", "ICON_OVER_CONSTRAINED_FACE", 0, true );
3618 createSMESHAction( 6028, "EQUAL_NODE", "ICON_EQUAL_NODE", 0, true );
3619 createSMESHAction( 6029, "EQUAL_EDGE", "ICON_EQUAL_EDGE", 0, true );
3620 createSMESHAction( 6030, "EQUAL_FACE", "ICON_EQUAL_FACE", 0, true );
3621 createSMESHAction( 6031, "EQUAL_VOLUME", "ICON_EQUAL_VOLUME", 0, true );
3622 createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D", 0, true );
3623 createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION", 0, true );
3624 createSMESHAction( 6005, "FREE_NODE", "ICON_FREE_NODE", 0, true );
3625 createSMESHAction( 6011, "AREA", "ICON_AREA", 0, true );
3626 createSMESHAction( 6012, "TAPER", "ICON_TAPER", 0, true );
3627 createSMESHAction( 6013, "ASPECT", "ICON_ASPECT", 0, true );
3628 createSMESHAction( 6014, "MIN_ANG", "ICON_ANGLE", 0, true );
3629 createSMESHAction( 6015, "WARP", "ICON_WARP", 0, true );
3630 createSMESHAction( 6016, "SKEW", "ICON_SKEW", 0, true );
3631 createSMESHAction( 6017, "ASPECT_3D", "ICON_ASPECT_3D", 0, true );
3632 createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
3633 createSMESHAction( 6019, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
3634 createSMESHAction( 6009, "VOLUME_3D", "ICON_VOLUME_3D", 0, true );
3635 createSMESHAction( 4000, "NODE", "ICON_DLG_NODE" );
3636 createSMESHAction( 4009, "ELEM0D", "ICON_DLG_ELEM0D" );
3637 createSMESHAction( 4008, "BALL", "ICON_DLG_BALL" );
3638 createSMESHAction( 4010, "EDGE", "ICON_DLG_EDGE" );
3639 createSMESHAction( 4021, "TRIANGLE", "ICON_DLG_TRIANGLE" );
3640 createSMESHAction( 4022, "QUAD", "ICON_DLG_QUADRANGLE" );
3641 createSMESHAction( 4023, "POLYGON", "ICON_DLG_POLYGON" );
3642 createSMESHAction( 4031, "TETRA", "ICON_DLG_TETRAS" );
3643 createSMESHAction( 4032, "HEXA", "ICON_DLG_HEXAS" );
3644 createSMESHAction( 4133, "PENTA", "ICON_DLG_PENTA" );
3645 createSMESHAction( 4134, "PYRAMID", "ICON_DLG_PYRAMID" );
3646 createSMESHAction( 4135, "OCTA", "ICON_DLG_OCTA" );
3647 createSMESHAction( 4033, "POLYHEDRON", "ICON_DLG_POLYHEDRON" );
3648 createSMESHAction( 4034, "QUADRATIC_EDGE", "ICON_DLG_QUADRATIC_EDGE" );
3649 createSMESHAction( 4035, "QUADRATIC_TRIANGLE", "ICON_DLG_QUADRATIC_TRIANGLE" );
3650 createSMESHAction( 4036, "QUADRATIC_QUADRANGLE", "ICON_DLG_QUADRATIC_QUADRANGLE" );
3651 createSMESHAction( 4136, "BIQUADRATIC_QUADRANGLE", "ICON_DLG_BIQUADRATIC_QUADRANGLE" );
3652 createSMESHAction( 4037, "QUADRATIC_TETRAHEDRON", "ICON_DLG_QUADRATIC_TETRAHEDRON" );
3653 createSMESHAction( 4038, "QUADRATIC_PYRAMID", "ICON_DLG_QUADRATIC_PYRAMID" );
3654 createSMESHAction( 4039, "QUADRATIC_PENTAHEDRON", "ICON_DLG_QUADRATIC_PENTAHEDRON" );
3655 createSMESHAction( 4040, "QUADRATIC_HEXAHEDRON", "ICON_DLG_QUADRATIC_HEXAHEDRON" );
3656 createSMESHAction( 4140, "TRIQUADRATIC_HEXAHEDRON", "ICON_DLG_TRIQUADRATIC_HEXAHEDRON" );
3657 createSMESHAction( 4041, "REMOVE_NODES", "ICON_DLG_REM_NODE" );
3658 createSMESHAction( 4042, "REMOVE_ELEMENTS", "ICON_DLG_REM_ELEMENT" );
3659 createSMESHAction( 4044, "REMOVE_ORPHAN_NODES", "ICON_DLG_REM_ORPHAN_NODES" );
3660 createSMESHAction( 4043, "CLEAR_MESH" , "ICON_CLEAR_MESH" );
3661 createSMESHAction( 4051, "RENUM_NODES", "ICON_DLG_RENUMBERING_NODES" );
3662 createSMESHAction( 4052, "RENUM_ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" );
3663 createSMESHAction( 4061, "TRANS", "ICON_SMESH_TRANSLATION_VECTOR" );
3664 createSMESHAction( 4062, "ROT", "ICON_DLG_MESH_ROTATION" );
3665 createSMESHAction( 4063, "SYM", "ICON_SMESH_SYMMETRY_PLANE" );
3666 createSMESHAction( 4064, "SEW", "ICON_SMESH_SEWING_FREEBORDERS" );
3667 createSMESHAction( 4065, "MERGE", "ICON_SMESH_MERGE_NODES" );
3668 createSMESHAction( 4066, "MERGE_ELEMENTS", "ICON_DLG_MERGE_ELEMENTS" );
3669 createSMESHAction( 4067, "MESH_THROU_POINT","ICON_DLG_MOVE_NODE" );
3670 createSMESHAction( 4068, "SCALE", "ICON_DLG_MESH_SCALE" );
3671 createSMESHAction( 4069, "DUPLICATE_NODES", "ICON_SMESH_DUPLICATE_NODES" );
3672 createSMESHAction( 407, "INV", "ICON_DLG_MESH_DIAGONAL" );
3673 createSMESHAction( 408, "UNION2", "ICON_UNION2TRI" );
3674 createSMESHAction( 409, "ORIENT", "ICON_DLG_MESH_ORIENTATION" );
3675 createSMESHAction( 410, "UNION", "ICON_UNIONTRI" );
3676 createSMESHAction( 411, "CUT", "ICON_CUTQUAD" );
3677 createSMESHAction( 412, "SMOOTH", "ICON_DLG_SMOOTHING" );
3678 createSMESHAction( 413, "EXTRUSION", "ICON_EXTRUSION" );
3679 createSMESHAction( 414, "REVOLUTION", "ICON_REVOLUTION" );
3680 createSMESHAction( 415, "MAP", "ICON_MAP" );
3681 createSMESHAction( 416, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" );
3682 createSMESHAction( 417, "CONV_TO_QUAD", "ICON_CONV_TO_QUAD" );
3683 createSMESHAction( 418, "2D_FROM_3D", "ICON_2D_FROM_3D" );
3684 createSMESHAction( 419, "SPLIT_TO_TETRA", "ICON_SPLIT_TO_TETRA" );
3685 createSMESHAction( 420, "REORIENT_2D", "ICON_REORIENT_2D" );
3686 createSMESHAction( 200, "RESET" );
3687 createSMESHAction( 201, "SCALAR_BAR_PROP" );
3688 createSMESHAction( 2021, "SAVE_DISTRIBUTION" );
3689 createSMESHAction( 2022, "SHOW_DISTRIBUTION","",0, true );
3690 #ifndef DISABLE_PLOT2DVIEWER
3691 createSMESHAction( 2023, "PLOT_DISTRIBUTION" );
3693 createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true );
3694 createSMESHAction( 212, "SHADE", "ICON_SHADE", 0, true );
3695 createSMESHAction( 213, "SHRINK", "ICON_SHRINK", 0, true );
3696 createSMESHAction( 214, "UPDATE", "ICON_UPDATE" );
3697 createSMESHAction( 215, "NODES", "ICON_POINTS", 0, true );
3698 createSMESHAction( 222, "BALLS", "ICON_DLG_BALL", 0, true );
3699 createSMESHAction( 216, "ELEMS0D", "ICON_DLG_ELEM0D", 0, true );
3700 createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE", 0, true );
3701 createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE", 0, true );
3702 createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
3703 createSMESHAction( 220, "ALL" );
3704 createSMESHAction( 221, "FACE_ORIENTATION", "", 0, true );
3706 createSMESHAction( 231, "LINE_REPRESENTATION", "", 0, true );
3707 createSMESHAction( 232, "ARC_REPRESENTATION", "", 0, true );
3709 createSMESHAction( 1100, "EDIT_HYPO" );
3710 createSMESHAction( 1102, "UNASSIGN" );
3711 createSMESHAction( 9010, "NUM_NODES", "", 0, true );
3712 createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true );
3713 createSMESHAction( 1131, "DISPMODE" );
3714 createSMESHAction( 1132, "COLORS" );
3715 createSMESHAction( 1133, "TRANSP" );
3716 createSMESHAction( 1134, "CLIP" );
3717 createSMESHAction( 1135, "DISP_ENT" );
3718 createSMESHAction( 1136, "AUTO_COLOR" );
3719 createSMESHAction( 1137, "DISABLE_AUTO_COLOR" );
3720 createSMESHAction( 2000, "CTRL" );
3722 createSMESHAction( 501, "MEASURE_MIN_DIST", "ICON_MEASURE_MIN_DIST" );
3723 createSMESHAction( 502, "MEASURE_BND_BOX", "ICON_MEASURE_BND_BOX" );
3725 createSMESHAction( 300, "HIDE" );
3726 createSMESHAction( 301, "SHOW" );
3727 createSMESHAction( 302, "DISPLAY_ONLY" );
3729 // ----- create menu --------------
3730 int fileId = createMenu( tr( "MEN_FILE" ), -1, 1 ),
3731 editId = createMenu( tr( "MEN_EDIT" ), -1, 3 ),
3732 toolsId = createMenu( tr( "MEN_TOOLS" ), -1, 5, 50 ),
3733 meshId = createMenu( tr( "MEN_MESH" ), -1, 70, 10 ),
3734 ctrlId = createMenu( tr( "MEN_CTRL" ), -1, 60, 10 ),
3735 modifyId = createMenu( tr( "MEN_MODIFY" ), -1, 40, 10 ),
3736 measureId = createMenu( tr( "MEN_MEASURE" ), -1, 50, 10 ),
3737 viewId = createMenu( tr( "MEN_VIEW" ), -1, 2 );
3739 createMenu( separator(), fileId );
3741 int importId = createMenu( tr( "MEN_IMPORT" ), fileId, -1, 10 ),
3742 exportId = createMenu( tr( "MEN_EXPORT" ), fileId, -1, 10 ),
3743 nodeId = createMenu( tr( "MEN_NODE_CTRL" ), ctrlId, -1, 10 ),
3744 edgeId = createMenu( tr( "MEN_EDGE_CTRL" ), ctrlId, -1, 10 ),
3745 faceId = createMenu( tr( "MEN_FACE_CTRL" ), ctrlId, -1, 10 ),
3746 volumeId = createMenu( tr( "MEN_VOLUME_CTRL" ), ctrlId, -1, 10 ),
3747 addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ),
3748 removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
3749 renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
3750 transfId = createMenu( tr( "MEN_TRANSF" ), modifyId, 405 );
3752 //createMenu( 111, importId, -1 );
3753 createMenu( 112, importId, -1 );
3754 createMenu( 113, importId, -1 );
3755 createMenu( 115, importId, -1 );
3757 createMenu( 116, importId, -1 );
3759 createMenu( 117, importId, -1 );
3760 createMenu( 118, importId, -1 );
3761 createMenu( 121, exportId, -1 );
3762 createMenu( 122, exportId, -1 );
3763 createMenu( 123, exportId, -1 );
3764 createMenu( 140, exportId, -1 ); // export to STL
3766 createMenu( 142, exportId, -1 ); // export to CGNS
3768 createMenu( 144, exportId, -1 ); // export to SAUV
3769 createMenu( 146, exportId, -1 ); // export to GMF
3770 createMenu( separator(), fileId, 10 );
3772 createMenu( 33, editId, -1 );
3774 createMenu( 5105, toolsId, -1 );
3776 createMenu( 702, meshId, -1 ); // "Mesh" menu
3777 createMenu( 703, meshId, -1 );
3778 createMenu( 704, meshId, -1 );
3779 createMenu( 710, meshId, -1 );
3780 createMenu( 705, meshId, -1 );
3781 createMenu( separator(), meshId, -1 );
3782 createMenu( 701, meshId, -1 );
3783 createMenu( 711, meshId, -1 );
3784 createMenu( 712, meshId, -1 );
3785 createMenu( 713, meshId, -1 );
3786 createMenu( separator(), meshId, -1 );
3787 createMenu( 801, meshId, -1 );
3788 createMenu( 806, meshId, -1 );
3789 createMenu( 802, meshId, -1 );
3790 createMenu( 803, meshId, -1 );
3791 createMenu( 815, meshId, -1 );
3792 createMenu( separator(), meshId, -1 );
3793 createMenu( 810, meshId, -1 );
3794 createMenu( 811, meshId, -1 );
3795 createMenu( 812, meshId, -1 );
3796 createMenu( separator(), meshId, -1 );
3797 createMenu( 814, meshId, -1 );
3798 createMenu( separator(), meshId, -1 );
3799 createMenu( 900, meshId, -1 );
3800 //createMenu( 902, meshId, -1 );
3801 //createMenu( 903, meshId, -1 ); // VSR: issue #0021242 (eliminate "Mesh Element Information" command)
3802 createMenu( 904, meshId, -1 );
3803 createMenu( separator(), meshId, -1 );
3805 createMenu( 6005, nodeId, -1 );
3806 createMenu( 6028, nodeId, -1 );
3807 createMenu( 6002, edgeId, -1 );
3808 createMenu( 6003, edgeId, -1 );
3809 createMenu( 6001, edgeId, -1 );
3810 createMenu( 6004, edgeId, -1 );
3811 createMenu( 6029, edgeId, -1 );
3812 createMenu( 6021, faceId, -1 );
3813 createMenu( 6025, faceId, -1 );
3814 createMenu( 6027, faceId, -1 );
3815 createMenu( 6018, faceId, -1 );
3816 createMenu( 6019, faceId, -1 );
3817 createMenu( 6011, faceId, -1 );
3818 createMenu( 6012, faceId, -1 );
3819 createMenu( 6013, faceId, -1 );
3820 createMenu( 6014, faceId, -1 );
3821 createMenu( 6015, faceId, -1 );
3822 createMenu( 6016, faceId, -1 );
3823 createMenu( 6022, faceId, -1 );
3824 createMenu( 6030, faceId, -1 );
3825 createMenu( 6017, volumeId, -1 );
3826 createMenu( 6009, volumeId, -1 );
3827 createMenu( 6023, volumeId, -1 );
3828 createMenu( 6024, volumeId, -1 );
3829 createMenu( 6026, volumeId, -1 );
3830 createMenu( 6031, volumeId, -1 );
3832 createMenu( 4000, addId, -1 );
3833 createMenu( 4009, addId, -1 );
3834 createMenu( 4008, addId, -1 );
3835 createMenu( 4010, addId, -1 );
3836 createMenu( 4021, addId, -1 );
3837 createMenu( 4022, addId, -1 );
3838 createMenu( 4023, addId, -1 );
3839 createMenu( 4031, addId, -1 );
3840 createMenu( 4032, addId, -1 );
3841 createMenu( 4133, addId, -1 );
3842 createMenu( 4134, addId, -1 );
3843 createMenu( 4135, addId, -1 );
3844 createMenu( 4033, addId, -1 );
3845 createMenu( separator(), addId, -1 );
3846 createMenu( 4034, addId, -1 );
3847 createMenu( 4035, addId, -1 );
3848 createMenu( 4036, addId, -1 );
3849 createMenu( 4136, addId, -1 );
3850 createMenu( 4037, addId, -1 );
3851 createMenu( 4038, addId, -1 );
3852 createMenu( 4039, addId, -1 );
3853 createMenu( 4040, addId, -1 );
3854 createMenu( 4140, addId, -1 );
3856 createMenu( 4041, removeId, -1 );
3857 createMenu( 4042, removeId, -1 );
3858 createMenu( 4044, removeId, -1 );
3859 createMenu( separator(), removeId, -1 );
3860 createMenu( 813, removeId, -1 );
3861 createMenu( separator(), removeId, -1 );
3862 createMenu( 4043, removeId, -1 );
3864 createMenu( 4051, renumId, -1 );
3865 createMenu( 4052, renumId, -1 );
3867 createMenu( 4061, transfId, -1 );
3868 createMenu( 4062, transfId, -1 );
3869 createMenu( 4063, transfId, -1 );
3870 createMenu( 4068, transfId, -1 );
3871 createMenu( 4064, transfId, -1 );
3872 createMenu( 4065, transfId, -1 );
3873 createMenu( 4066, transfId, -1 );
3874 createMenu( 4069, transfId, -1 );
3876 createMenu( 4067,modifyId, -1 );
3877 createMenu( 407, modifyId, -1 );
3878 createMenu( 408, modifyId, -1 );
3879 createMenu( 409, modifyId, -1 );
3880 createMenu( 420, modifyId, -1 );
3881 createMenu( 410, modifyId, -1 );
3882 createMenu( 411, modifyId, -1 );
3883 createMenu( 419, modifyId, -1 );
3884 createMenu( 412, modifyId, -1 );
3885 createMenu( 413, modifyId, -1 );
3886 createMenu( 416, modifyId, -1 );
3887 createMenu( 414, modifyId, -1 );
3888 createMenu( 415, modifyId, -1 );
3889 createMenu( 417, modifyId, -1 );
3890 createMenu( 418, modifyId, -1 );
3892 createMenu( 501, measureId, -1 );
3893 createMenu( 502, measureId, -1 );
3894 createMenu( 214, viewId, -1 );
3896 // ----- create toolbars --------------
3897 int meshTb = createTool( tr( "TB_MESH" ) ),
3898 ctrlTb = createTool( tr( "TB_CTRL" ) ),
3899 addRemTb = createTool( tr( "TB_ADD_REMOVE" ) ),
3900 modifyTb = createTool( tr( "TB_MODIFY" ) ),
3901 dispModeTb = createTool( tr( "TB_DISP_MODE" ) );
3903 createTool( 702, meshTb );
3904 createTool( 703, meshTb );
3905 createTool( 704, meshTb );
3906 createTool( 710, meshTb );
3907 createTool( 705, meshTb );
3908 createTool( separator(), meshTb );
3909 createTool( 701, meshTb );
3910 createTool( 711, meshTb );
3911 createTool( 712, meshTb );
3912 createTool( 713, meshTb );
3913 createTool( separator(), meshTb );
3914 createTool( 801, meshTb );
3915 createTool( 806, meshTb );
3916 createTool( 802, meshTb );
3917 createTool( 803, meshTb );
3918 //createTool( 815, meshTb );
3919 createTool( separator(), meshTb );
3920 createTool( 900, meshTb );
3921 //createTool( 902, meshTb );
3922 //createTool( 903, meshTb ); // VSR: issue #0021242 (eliminate "Mesh Element Information" command)
3923 createTool( 904, meshTb );
3924 createTool( separator(), meshTb );
3926 createTool( 6005, ctrlTb );
3927 createTool( 6028, ctrlTb );
3928 createTool( separator(), ctrlTb );
3929 createTool( 6002, ctrlTb );
3930 createTool( 6003, ctrlTb );
3931 createTool( 6001, ctrlTb );
3932 createTool( 6004, ctrlTb );
3933 createTool( 6029, ctrlTb );
3934 createTool( separator(), ctrlTb );
3935 createTool( 6021, ctrlTb );
3936 createTool( 6025, ctrlTb );
3937 createTool( 6027, ctrlTb );
3938 createTool( 6018, ctrlTb );
3939 createTool( 6019, ctrlTb );
3940 createTool( 6011, ctrlTb );
3941 createTool( 6012, ctrlTb );
3942 createTool( 6013, ctrlTb );
3943 createTool( 6014, ctrlTb );
3944 createTool( 6015, ctrlTb );
3945 createTool( 6016, ctrlTb );
3946 createTool( 6022, ctrlTb );
3947 createTool( 6030, ctrlTb );
3948 createTool( separator(), ctrlTb );
3949 createTool( 6017, ctrlTb );
3950 createTool( 6009, ctrlTb );
3951 createTool( 6023, ctrlTb );
3952 createTool( 6024, ctrlTb );
3953 createTool( 6026, ctrlTb );
3954 createTool( 6031, ctrlTb );
3955 createTool( separator(), ctrlTb );
3957 createTool( 4000, addRemTb );
3958 createTool( 4009, addRemTb );
3959 createTool( 4008, addRemTb );
3960 createTool( 4010, addRemTb );
3961 createTool( 4021, addRemTb );
3962 createTool( 4022, addRemTb );
3963 createTool( 4023, addRemTb );
3964 createTool( 4031, addRemTb );
3965 createTool( 4032, addRemTb );
3966 createTool( 4133, addRemTb );
3967 createTool( 4134, addRemTb );
3968 createTool( 4135, addRemTb );
3969 createTool( 4033, addRemTb );
3970 createTool( separator(), addRemTb );
3971 createTool( 4034, addRemTb );
3972 createTool( 4035, addRemTb );
3973 createTool( 4036, addRemTb );
3974 createTool( 4136, addRemTb );
3975 createTool( 4037, addRemTb );
3976 createTool( 4038, addRemTb );
3977 createTool( 4039, addRemTb );
3978 createTool( 4040, addRemTb );
3979 createTool( 4140, addRemTb );
3980 createTool( separator(), addRemTb );
3981 createTool( 4041, addRemTb );
3982 createTool( 4042, addRemTb );
3983 createTool( 4044, addRemTb );
3984 createTool( 4043, addRemTb );
3985 createTool( separator(), addRemTb );
3986 createTool( 4051, addRemTb );
3987 createTool( 4052, addRemTb );
3988 createTool( separator(), addRemTb );
3989 createTool( 4061, addRemTb );
3990 createTool( 4062, addRemTb );
3991 createTool( 4063, addRemTb );
3992 createTool( 4068, addRemTb );
3993 createTool( 4064, addRemTb );
3994 createTool( 4065, addRemTb );
3995 createTool( 4066, addRemTb );
3996 createTool( 4069, addRemTb );
3997 createTool( separator(), addRemTb );
3999 createTool( 4067,modifyTb );
4000 createTool( 407, modifyTb );
4001 createTool( 408, modifyTb );
4002 createTool( 409, modifyTb );
4003 createTool( 420, modifyTb );
4004 createTool( 410, modifyTb );
4005 createTool( 411, modifyTb );
4006 createTool( 419, modifyTb );
4007 createTool( 412, modifyTb );
4008 createTool( 413, modifyTb );
4009 createTool( 416, modifyTb );
4010 createTool( 414, modifyTb );
4011 createTool( 415, modifyTb );
4012 createTool( 417, modifyTb );
4013 createTool( 418, modifyTb );
4015 createTool( 214, dispModeTb );
4017 QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality();
4018 QString dc = "selcount"; // VSR : instead of QtxPopupSelection::defSelCountParam()
4021 QString OB = "'ObjectBrowser'",
4022 View = "'" + SVTK_Viewer::Type() + "'",
4024 mesh = pat.arg( SMESHGUI_Selection::typeName( MESH ) ),
4025 group = pat.arg( SMESHGUI_Selection::typeName( GROUP ) ),
4026 hypo = pat.arg( SMESHGUI_Selection::typeName( HYPOTHESIS ) ),
4027 algo = pat.arg( SMESHGUI_Selection::typeName( ALGORITHM ) ),
4028 elems = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ).
4029 arg( SMESHGUI_Selection::typeName( SUBMESH_VERTEX ) ).
4030 arg( SMESHGUI_Selection::typeName( SUBMESH_EDGE ) ).
4031 arg( SMESHGUI_Selection::typeName( SUBMESH_FACE ) ).
4032 arg( SMESHGUI_Selection::typeName( SUBMESH_SOLID ) ).
4033 arg( SMESHGUI_Selection::typeName( SUBMESH_COMPOUND ) ).
4034 arg( SMESHGUI_Selection::typeName( SUBMESH ) ),
4036 mesh_part = mesh + " " + subMesh + " " + group,
4037 mesh_group = mesh + " " + group,
4038 hyp_alg = hypo + " " + algo;
4040 // popup for object browser
4042 isInvisible("not( isVisible )"),
4043 isEmpty("numberOfNodes = 0"),
4044 isNotEmpty("numberOfNodes <> 0"),
4046 // has nodes, edges, etc in VISIBLE! actor
4047 hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
4048 hasElems("(count( elemTypes ) > 0)"),
4049 hasDifferentElems("(count( elemTypes ) > 1)"),
4050 hasBalls("({'BallElem'} in elemTypes)"),
4051 hasElems0d("({'Elem0d'} in elemTypes)"),
4052 hasEdges("({'Edge'} in elemTypes)"),
4053 hasFaces("({'Face'} in elemTypes)"),
4054 hasVolumes("({'Volume'} in elemTypes)");
4056 createPopupItem( 150, OB, mesh, "&& selcount=1 && isImported" ); // FILE INFORMATION
4057 createPopupItem( 703, OB, mesh, "&& isComputable"); // CREATE_SUBMESH
4058 createPopupItem( 704, OB, mesh, "&& isComputable"); // EDIT_MESHSUBMESH
4059 createPopupItem( 704, OB, subMesh, "&& isComputable" ); // EDIT_MESHSUBMESH
4060 createPopupItem( 803, OB, group ); // EDIT_GROUP
4061 createPopupItem( 815, OB, group, "&& groupType != 'Group'" ); // EDIT AS STANDALONE
4063 popupMgr()->insert( separator(), -1, 0 );
4064 createPopupItem( 701, OB, mesh, "&& isComputable" ); // COMPUTE
4065 createPopupItem( 711, OB, mesh, "&& isComputable && isPreComputable" ); // PRECOMPUTE
4066 createPopupItem( 712, OB, mesh, "&& isComputable" ); // EVALUATE
4067 createPopupItem( 713, OB, mesh, "&& isComputable" ); // MESH ORDER
4068 createPopupItem( 214, OB, mesh_part ); // UPDATE
4069 createPopupItem( 900, OB, mesh_part ); // ADV_INFO
4070 createPopupItem( 904, OB, mesh_group ); // FIND_ELEM
4071 popupMgr()->insert( separator(), -1, 0 );
4072 createPopupItem( 801, OB, mesh ); // CREATE_GROUP
4073 createPopupItem( 806, OB, mesh ); // CREATE_GEO_GROUP
4074 createPopupItem( 802, OB, subMesh ); // CONSTRUCT_GROUP
4075 popupMgr()->insert( separator(), -1, 0 );
4076 createPopupItem( 1100, OB, hypo); // EDIT HYPOTHESIS
4077 createPopupItem( 1102, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS
4078 popupMgr()->insert( separator(), -1, 0 );
4079 createPopupItem( 4043, OB, mesh ); // CLEAR_MESH
4080 popupMgr()->insert( separator(), -1, 0 );
4081 createPopupItem( 417, OB, mesh + " " + subMesh ); // convert to quadratic
4082 createPopupItem( 418, OB, mesh + " " + group, // create 2D mesh from 3D
4084 popupMgr()->insert( separator(), -1, 0 );
4086 QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
4087 QString multiple_non_empty = QString( " && %1>0 && numberOfNodes>0" ).arg( dc );
4088 QString only_one_2D = only_one_non_empty + " && dim>1";
4090 createPopupItem( 125, OB, mesh_group, multiple_non_empty ); // EXPORT_MED
4091 createPopupItem( 126, OB, mesh_group, only_one_non_empty ); // EXPORT_UNV
4092 createPopupItem( 141, OB, mesh_group, only_one_2D ); // EXPORT_STL
4094 createPopupItem( 143, OB, mesh_group, multiple_non_empty ); // EXPORT_CGNS
4096 createPopupItem( 145, OB, mesh_group, multiple_non_empty ); // EXPORT_SAUV
4097 createPopupItem( 33, OB, mesh_part + " " + hyp_alg ); // DELETE
4098 createPopupItem( 813, OB, group ); // DEL_GROUP with contents
4099 popupMgr()->insert( separator(), -1, 0 );
4102 createPopupItem( 803, View, group ); // EDIT_GROUP
4103 createPopupItem( 804, View, elems ); // ADD
4104 createPopupItem( 805, View, elems ); // REMOVE
4106 popupMgr()->insert( separator(), -1, 0 );
4107 createPopupItem( 214, View, mesh_part ); // UPDATE
4108 createPopupItem( 900, View, mesh_part ); // ADV_INFO
4109 createPopupItem( 904, View, mesh ); // FIND_ELEM
4110 popupMgr()->insert( separator(), -1, 0 );
4112 createPopupItem( 1136, OB + " " + View, mesh, "&& (not isAutoColor)" ); // AUTO_COLOR
4113 createPopupItem( 1137, OB + " " + View, mesh, "&& isAutoColor" ); // DISABLE_AUTO_COLOR
4114 popupMgr()->insert( separator(), -1, 0 );
4117 QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
4118 QString aType = QString( "%1type in {%2}" ).arg( lc );
4119 aType = aType.arg( mesh_part );
4120 QString aMeshInVTK = aClient + "&&" + aType;
4122 aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
4123 QString anActiveVTK = QString("activeView = '%1'").arg(SVTK_Viewer::Type());
4124 QString aSelCount = QString( "%1 > 0" ).arg( dc );
4126 //-------------------------------------------------
4128 //-------------------------------------------------
4129 anId = popupMgr()->insert( tr( "MEN_NUM" ), -1, -1 );
4131 popupMgr()->insert( action( 9010 ), anId, -1 );
4132 popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&& isVisible &&" + hasNodes, QtxPopupMgr::VisibleRule );
4133 popupMgr()->setRule( action( 9010 ), "{'Point'} in labeledTypes", QtxPopupMgr::ToggleRule );
4135 popupMgr()->insert( action( 9011 ), anId, -1 );
4136 popupMgr()->setRule( action( 9011 ), aMeshInVTK + "&& isVisible &&" + hasElems, QtxPopupMgr::VisibleRule );
4137 popupMgr()->setRule( action( 9011 ), "{'Cell'} in labeledTypes", QtxPopupMgr::ToggleRule );
4139 popupMgr()->insert( separator(), -1, -1 );
4141 //-------------------------------------------------
4143 //-------------------------------------------------
4144 anId = popupMgr()->insert( tr( "MEN_DISPMODE" ), -1, -1 );
4146 popupMgr()->insert( action( 211 ), anId, -1 ); // WIRE
4147 popupMgr()->setRule( action( 211 ), aMeshInVTK + "&&" + hasElems, QtxPopupMgr::VisibleRule );
4148 popupMgr()->setRule( action( 211 ), "displayMode = 'eEdge'", QtxPopupMgr::ToggleRule );
4150 popupMgr()->insert( action( 212 ), anId, -1 ); // SHADE
4151 popupMgr()->setRule( action( 212 ),aMeshInVTK+ "&& (" + hasFaces + "||" + hasVolumes + ")", QtxPopupMgr::VisibleRule);
4152 popupMgr()->setRule( action( 212 ), "displayMode = 'eSurface'", QtxPopupMgr::ToggleRule );
4154 popupMgr()->insert( action( 215 ), anId, -1 ); // POINTS
4155 popupMgr()->setRule( action( 215 ), aMeshInVTK + "&&" + hasNodes, QtxPopupMgr::VisibleRule );
4156 popupMgr()->setRule( action( 215 ), "displayMode = 'ePoint'", QtxPopupMgr::ToggleRule );
4158 popupMgr()->insert( separator(), anId, -1 );
4160 popupMgr()->insert( action( 213 ), anId, -1 ); // SHRINK
4161 popupMgr()->setRule( action( 213 ), aMeshInVTK + "&& shrinkMode <> 'IsNotShrinkable' && displayMode <> 'ePoint'", QtxPopupMgr::VisibleRule);
4162 popupMgr()->setRule( action( 213 ), "shrinkMode = 'IsShrunk'", QtxPopupMgr::ToggleRule );
4164 //-------------------------------------------------
4166 //-------------------------------------------------
4167 QString aDiffElemsInVTK = aMeshInVTK + "&&" + hasDifferentElems;
4169 anId = popupMgr()->insert( tr( "MEN_DISP_ENT" ), -1, -1 );
4171 popupMgr()->insert( action(216), anId, -1 ); // ELEMS 0D
4172 popupMgr()->setRule(action(216), aDiffElemsInVTK + "&& isVisible &&" + hasElems0d, QtxPopupMgr::VisibleRule);
4173 popupMgr()->setRule(action(216), "{'Elem0d'} in entityMode", QtxPopupMgr::ToggleRule);
4175 popupMgr()->insert( action( 217 ), anId, -1 ); // EDGES
4176 popupMgr()->setRule( action( 217 ), aDiffElemsInVTK + "&& isVisible &&" + hasEdges, QtxPopupMgr::VisibleRule );
4177 popupMgr()->setRule( action( 217 ), "{'Edge'} in entityMode", QtxPopupMgr::ToggleRule );
4179 popupMgr()->insert( action( 218 ), anId, -1 ); // FACES
4180 popupMgr()->setRule( action( 218 ), aDiffElemsInVTK + "&& isVisible &&" + hasFaces, QtxPopupMgr::VisibleRule );
4181 popupMgr()->setRule( action( 218 ), "{'Face'} in entityMode", QtxPopupMgr::ToggleRule );
4183 popupMgr()->insert( action( 219 ), anId, -1 ); // VOLUMES
4184 popupMgr()->setRule( action( 219 ), aDiffElemsInVTK + "&& isVisible &&" + hasVolumes, QtxPopupMgr::VisibleRule );
4185 popupMgr()->setRule( action( 219 ), "{'Volume'} in entityMode", QtxPopupMgr::ToggleRule );
4187 popupMgr()->insert( action( 222 ), anId, -1 ); // BALLS
4188 popupMgr()->setRule( action( 222 ), aDiffElemsInVTK + "&& isVisible &&" + hasBalls, QtxPopupMgr::VisibleRule );
4189 popupMgr()->setRule( action( 222 ), "{'BallElem'} in entityMode", QtxPopupMgr::ToggleRule );
4191 popupMgr()->insert( separator(), anId, -1 );
4193 popupMgr()->insert( action( 220 ), anId, -1 ); // ALL
4194 popupMgr()->setRule( action( 220 ), aDiffElemsInVTK + "&& isVisible && not( elemTypes in entityMode )", QtxPopupMgr::VisibleRule );
4197 //-------------------------------------------------
4198 // Representation of the 2D Quadratic elements
4199 //-------------------------------------------------
4200 anId = popupMgr()->insert( tr( "MEN_QUADRATIC_REPRESENT" ), -1, -1 );
4201 popupMgr()->insert( action( 231 ), anId, -1 ); // LINE REPRESENTATION
4202 popupMgr()->setRule( action( 231 ), aMeshInVTK + "and isVisible",QtxPopupMgr::VisibleRule );
4203 popupMgr()->setRule( action( 231 ), "quadratic2DMode = 'eLines'", QtxPopupMgr::ToggleRule );
4205 popupMgr()->insert( action( 232 ), anId, -1 ); // ARC REPRESENTATION
4206 popupMgr()->setRule( action( 232 ), aMeshInVTK + "and isVisible", QtxPopupMgr::VisibleRule );
4207 popupMgr()->setRule( action( 232 ), "quadratic2DMode = 'eArcs'", QtxPopupMgr::ToggleRule );
4209 //-------------------------------------------------
4210 // Orientation of faces
4211 //-------------------------------------------------
4212 popupMgr()->insert( action( 221 ), -1, -1 );
4213 popupMgr()->setRule( action( 221 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule);
4214 popupMgr()->setRule( action( 221 ), "facesOrientationMode = 'IsOriented'", QtxPopupMgr::ToggleRule );
4216 //-------------------------------------------------
4218 //-------------------------------------------------
4219 popupMgr()->insert( action( 1132 ), -1, -1 );
4220 popupMgr()->setRule( action( 1132 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule );
4222 //-------------------------------------------------
4224 //-------------------------------------------------
4225 popupMgr()->insert( action( 1133 ), -1, -1 );
4226 popupMgr()->setRule( action( 1133 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule );
4228 //-------------------------------------------------
4230 //-------------------------------------------------
4232 aMeshInVtkHasNodes = aMeshInVTK + "&&" + hasNodes,
4233 aMeshInVtkHasEdges = aMeshInVTK + "&&" + hasEdges,
4234 aMeshInVtkHasFaces = aMeshInVTK + "&&" + hasFaces,
4235 aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes;
4237 anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 );
4239 popupMgr()->insert( action( 200 ), anId, -1 ); // RESET
4240 popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
4242 popupMgr()->insert( separator(), anId, -1 );
4244 int aSubId = popupMgr()->insert( tr( "MEN_NODE_CTRL" ), anId, -1 ); // NODE CONTROLS
4246 popupMgr()->insert( action( 6005 ), aSubId, -1 ); // FREE_NODE
4247 popupMgr()->setRule( action( 6005 ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule );
4248 popupMgr()->setRule( action( 6005 ), "controlMode = 'eFreeNodes'", QtxPopupMgr::ToggleRule );
4250 popupMgr()->insert ( action( 6028 ), aSubId, -1 ); // EQUAL_NODE
4251 popupMgr()->setRule( action( 6028 ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule );
4252 popupMgr()->setRule( action( 6028 ), "controlMode = 'eCoincidentNodes'", QtxPopupMgr::ToggleRule);
4254 aSubId = popupMgr()->insert( tr( "MEN_EDGE_CTRL" ), anId, -1 ); // EDGE CONTROLS
4256 popupMgr()->insert( action( 6002 ), aSubId, -1 ); // FREE_EDGE
4257 popupMgr()->setRule( action( 6002 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
4258 popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeEdges'", QtxPopupMgr::ToggleRule );
4260 popupMgr()->insert( action( 6003 ), aSubId, -1 ); // FREE_BORDER
4261 popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
4262 popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeBorders'", QtxPopupMgr::ToggleRule );
4264 popupMgr()->insert( action( 6001 ), aSubId, -1 ); // LENGTH
4265 popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
4266 popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", QtxPopupMgr::ToggleRule );
4268 popupMgr()->insert( action( 6004 ), aSubId, -1 ); // CONNECTION
4269 popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
4270 popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", QtxPopupMgr::ToggleRule );
4271 popupMgr()->insert ( action( 6029 ), aSubId, -1 ); // EQUAL_EDGE
4272 popupMgr()->setRule( action( 6029 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
4273 popupMgr()->setRule( action( 6029 ), "controlMode = 'eCoincidentElems1D'", QtxPopupMgr::ToggleRule);
4275 aSubId = popupMgr()->insert( tr( "MEN_FACE_CTRL" ), anId, -1 ); // FACE CONTROLS
4277 popupMgr()->insert ( action( 6021 ), aSubId, -1 ); // FREE_FACE
4278 popupMgr()->setRule( action( 6021 ), aMeshInVtkHasFaces /*aMeshInVtkHasVolumes*/,
4279 QtxPopupMgr::VisibleRule );
4280 popupMgr()->setRule( action( 6021 ), "controlMode = 'eFreeFaces'", QtxPopupMgr::ToggleRule );
4282 popupMgr()->insert ( action( 6018 ), aSubId, -1 ); // LENGTH_2D
4283 popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4284 popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", QtxPopupMgr::ToggleRule );
4286 popupMgr()->insert ( action( 6019 ), aSubId, -1 ); // CONNECTION_2D
4287 popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4288 popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", QtxPopupMgr::ToggleRule );
4290 popupMgr()->insert ( action( 6011 ), aSubId, -1 ); // AREA
4291 popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4292 popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", QtxPopupMgr::ToggleRule );
4294 popupMgr()->insert ( action( 6012 ), aSubId, -1 ); // TAPER
4295 popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4296 popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", QtxPopupMgr::ToggleRule );
4298 popupMgr()->insert ( action( 6013 ), aSubId, -1 ); // ASPECT
4299 popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4300 popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", QtxPopupMgr::ToggleRule );
4302 popupMgr()->insert ( action( 6014 ), aSubId, -1 ); // MIN_ANG
4303 popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4304 popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", QtxPopupMgr::ToggleRule );
4306 popupMgr()->insert ( action( 6015 ), aSubId, -1 ); // WARP
4307 popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4308 popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", QtxPopupMgr::ToggleRule );
4310 popupMgr()->insert ( action( 6016 ), aSubId, -1 ); // SKEW
4311 popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4312 popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", QtxPopupMgr::ToggleRule );
4314 popupMgr()->insert ( action( 6022 ), aSubId, -1 ); // MAX_ELEMENT_LENGTH_2D
4315 popupMgr()->setRule( action( 6022 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4316 popupMgr()->setRule( action( 6022 ), "controlMode = 'eMaxElementLength2D'", QtxPopupMgr::ToggleRule );
4318 popupMgr()->insert ( action( 6025 ), aSubId, -1 ); // BARE_BORDER_FACE
4319 popupMgr()->setRule( action( 6025 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4320 popupMgr()->setRule( action( 6025 ), "controlMode = 'eBareBorderFace'", QtxPopupMgr::ToggleRule );
4322 popupMgr()->insert ( action( 6027 ), aSubId, -1 ); // OVER_CONSTRAINED_FACE
4323 popupMgr()->setRule( action( 6027 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4324 popupMgr()->setRule( action( 6027 ), "controlMode = 'eOverConstrainedFace'", QtxPopupMgr::ToggleRule );
4325 popupMgr()->insert ( action( 6030 ), aSubId, -1 ); // EQUAL_FACE
4326 popupMgr()->setRule( action( 6030 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
4327 popupMgr()->setRule( action( 6030 ), "controlMode = 'eCoincidentElems2D'", QtxPopupMgr::ToggleRule );
4329 aSubId = popupMgr()->insert( tr( "MEN_VOLUME_CTRL" ), anId, -1 ); // VOLUME CONTROLS
4331 popupMgr()->insert ( action( 6017 ), aSubId, -1 ); // ASPECT_3D
4332 popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
4333 popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", QtxPopupMgr::ToggleRule );
4335 popupMgr()->insert ( action( 6009 ), aSubId, -1 ); // VOLUME_3D
4336 popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
4337 popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", QtxPopupMgr::ToggleRule );
4339 popupMgr()->insert ( action( 6023 ), aSubId, -1 ); // MAX_ELEMENT_LENGTH_3D
4340 popupMgr()->setRule( action( 6023 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
4341 popupMgr()->setRule( action( 6023 ), "controlMode = 'eMaxElementLength3D'", QtxPopupMgr::ToggleRule );
4343 popupMgr()->insert ( action( 6024 ), aSubId, -1 ); // BARE_BORDER_VOLUME
4344 popupMgr()->setRule( action( 6024 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
4345 popupMgr()->setRule( action( 6024 ), "controlMode = 'eBareBorderVolume'", QtxPopupMgr::ToggleRule );
4347 popupMgr()->insert ( action( 6026 ), aSubId, -1 ); // OVER_CONSTRAINED_VOLUME
4348 popupMgr()->setRule( action( 6026 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
4349 popupMgr()->setRule( action( 6026 ), "controlMode = 'eOverConstrainedVolume'", QtxPopupMgr::ToggleRule );
4351 popupMgr()->insert ( action( 6031 ), aSubId, -1 ); // EQUAL_VOLUME
4352 popupMgr()->setRule( action( 6031 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
4353 popupMgr()->setRule( action( 6031 ), "controlMode = 'eCoincidentElems3D'", QtxPopupMgr::ToggleRule );
4355 popupMgr()->insert( separator(), anId, -1 );
4357 popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP
4358 popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
4360 popupMgr()->insert( separator(), anId, -1 );
4362 aSubId = popupMgr()->insert( tr( "MEN_DISTRIBUTION_CTRL" ), anId, -1 ); // NODE CONTROLS
4364 popupMgr()->insert( action( 2021 ), aSubId, -1 ); // SAVE_DISTRIBUTION
4365 popupMgr()->setRule( action( 2021 ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
4367 popupMgr()->insert( action( 2022 ), aSubId, -1 ); // SHOW_DISTRIBUTION
4368 popupMgr()->setRule( action( 2022 ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
4369 popupMgr()->setRule( action( 2022 ), aMeshInVTK + "&& isNumFunctor && isDistributionVisible", QtxPopupMgr::ToggleRule);
4371 #ifndef DISABLE_PLOT2DVIEWER
4372 popupMgr()->insert( action( 2023 ), aSubId, -1 ); // PLOT_DISTRIBUTION
4373 popupMgr()->setRule( action( 2023 ), aMeshInVTK + "&& isNumFunctor", QtxPopupMgr::VisibleRule );
4376 //-------------------------------------------------
4378 //-------------------------------------------------
4379 popupMgr()->insert( separator(), -1, -1 );
4380 QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " +
4381 aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
4382 popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
4383 popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), QtxPopupMgr::VisibleRule );
4385 popupMgr()->insert( action( 300 ), -1, -1 ); // ERASE
4386 popupMgr()->setRule( action( 300 ), aRule.arg( "and isVisible" ), QtxPopupMgr::VisibleRule );
4388 popupMgr()->insert( action( 302 ), -1, -1 ); // DISPLAY_ONLY
4389 popupMgr()->setRule( action( 302 ), aRule.arg( "" ), QtxPopupMgr::VisibleRule );
4391 popupMgr()->insert( separator(), -1, -1 );
4393 //-------------------------------------------------
4395 //-------------------------------------------------
4396 popupMgr()->insert( action( 1134 ), -1, -1 );
4397 popupMgr()->setRule( action( 1134 ), "client='VTKViewer'", QtxPopupMgr::VisibleRule );
4399 popupMgr()->insert( separator(), -1, -1 );
4401 connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ),
4402 this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
4404 connect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
4405 this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
4408 //================================================================================
4410 * \brief Return true if SMESH or GEOM objects are selected.
4411 * Is called form LightApp_Module::activateModule() which clear selection if
4412 * not isSelectionCompatible()
4414 //================================================================================
4416 bool SMESHGUI::isSelectionCompatible()
4418 bool isCompatible = true;
4419 SALOME_ListIO selected;
4420 if ( LightApp_SelectionMgr *Sel = selectionMgr() )
4421 Sel->selectedObjects( selected );
4423 SALOME_ListIteratorOfListIO It( selected );
4424 for ( ; isCompatible && It.More(); It.Next())
4426 ( strcmp("GEOM", It.Value()->getComponentDataType()) == 0 ) ||
4427 ( strcmp("SMESH", It.Value()->getComponentDataType()) == 0 );
4429 return isCompatible;
4433 bool SMESHGUI::reusableOperation( const int id )
4435 // compute, evaluate and precompute are not reusable operations
4436 return ( id == 701 || id == 711 || id == 712 ) ? false : SalomeApp_Module::reusableOperation( id );
4439 bool SMESHGUI::activateModule( SUIT_Study* study )
4441 bool res = SalomeApp_Module::activateModule( study );
4443 setMenuShown( true );
4444 setToolShown( true );
4446 // import Python module that manages SMESH plugins (need to be here because SalomePyQt API uses active module)
4447 PyGILState_STATE gstate = PyGILState_Ensure();
4448 PyObject* pluginsmanager=PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
4449 if(pluginsmanager==NULL)
4453 PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"smesh",tr("MEN_MESH").toStdString().c_str(),tr("SMESH_PLUGINS_OTHER").toStdString().c_str());
4458 PyGILState_Release(gstate);
4459 // end of GEOM plugins loading
4461 // Reset actions accelerator keys
4462 //action(111)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); // Import DAT
4463 action(112)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)); // Import UNV
4464 action(113)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); // Import MED
4466 action( 33)->setEnabled(true); // Delete: Key_Delete
4468 // 0020210. Make SMESH_Gen update meshes at switching GEOM->SMESH
4469 GetSMESHGen()->SetCurrentStudy(SALOMEDS::Study::_nil());
4470 if ( SalomeApp_Study* s = dynamic_cast<SalomeApp_Study*>( study ))
4471 if ( _PTR(Study) aStudy = s->studyDS()) {
4472 GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
4473 updateObjBrowser(); // objects can be removed
4476 // get all view currently opened in the study and connect their signals to
4477 // the corresponding slots of the class.
4478 SUIT_Desktop* aDesk = study->application()->desktop();
4480 QList<SUIT_ViewWindow*> wndList = aDesk->windows();
4481 SUIT_ViewWindow* wnd;
4482 foreach ( wnd, wndList )
4489 bool SMESHGUI::deactivateModule( SUIT_Study* study )
4491 setMenuShown( false );
4492 setToolShown( false );
4494 EmitSignalCloseAllDialogs();
4496 // Unset actions accelerator keys
4497 //action(111)->setShortcut(QKeySequence()); // Import DAT
4498 action(112)->setShortcut(QKeySequence()); // Import UNV
4499 action(113)->setShortcut(QKeySequence()); // Import MED
4501 action( 33)->setEnabled(false); // Delete: Key_Delete
4503 return SalomeApp_Module::deactivateModule( study );
4506 void SMESHGUI::studyClosed( SUIT_Study* s )
4508 SMESH::RemoveVisuData( s->id() );
4509 SalomeApp_Module::studyClosed( s );
4512 void SMESHGUI::OnGUIEvent()
4514 const QObject* obj = sender();
4515 if ( !obj || !obj->inherits( "QAction" ) )
4517 int id = actionId((QAction*)obj);
4522 SMESH::SMESH_Gen_var SMESHGUI::GetSMESHGen()
4524 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
4525 if ( CORBA::is_nil( myComponentSMESH ) )
4527 SMESHGUI aGUI; //SRN BugID: IPAL9186: Create an instance of SMESHGUI to initialize myComponentSMESH
4529 aGUI.myComponentSMESH->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
4530 return aGUI.myComponentSMESH;
4533 myComponentSMESH->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
4534 return myComponentSMESH;
4537 QString SMESHGUI::engineIOR() const
4539 CORBA::ORB_var anORB = getApp()->orb();
4540 CORBA::String_var anIOR = anORB->object_to_string(GetSMESHGen());
4541 return QString( anIOR.in() );
4544 void SMESHGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
4546 SalomeApp_Module::contextMenuPopup( client, menu, title );
4548 selectionMgr()->selectedObjects( lst );
4549 if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
4550 Handle(SALOME_InteractiveObject) io = lst.First();
4551 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
4552 _PTR(Study) study = appStudy->studyDS();
4553 _PTR(SObject) obj = study->FindObjectID( io->getEntry() );
4555 QString aName = QString( obj->GetName().c_str() );
4556 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
4557 aName.remove( (aName.length() - 1), 1 );
4563 LightApp_Selection* SMESHGUI::createSelection() const
4565 return new SMESHGUI_Selection();
4568 void SMESHGUI::windows( QMap<int, int>& aMap ) const
4570 aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
4571 aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
4574 void SMESHGUI::viewManagers( QStringList& list ) const
4576 list.append( SVTK_Viewer::Type() );
4579 void SMESHGUI::onViewManagerActivated( SUIT_ViewManager* mgr )
4581 if ( dynamic_cast<SVTK_ViewManager*>( mgr ) ) {
4582 SMESH::UpdateSelectionProp( this );
4584 QVector<SUIT_ViewWindow*> aViews = mgr->getViews();
4585 for(int i = 0; i < aViews.count() ; i++){
4586 SUIT_ViewWindow *sf = aViews[i];
4592 void SMESHGUI::onViewManagerRemoved( SUIT_ViewManager* theViewManager )
4594 if( theViewManager && theViewManager->getType() == SVTK_Viewer::Type() )
4595 myClippingPlaneInfoMap.erase( theViewManager );
4598 void SMESHGUI::addActorAsObserver( SMESH_Actor* theActor )
4600 theActor->AddObserver( SMESH::DeleteActorEvent,
4601 myEventCallbackCommand.GetPointer(),
4605 void SMESHGUI::ProcessEvents( vtkObject* theObject,
4606 unsigned long theEvent,
4607 void* theClientData,
4610 if( SMESHGUI* aSMESHGUI = reinterpret_cast<SMESHGUI*>( theClientData ) ) {
4611 if( theObject && theEvent == SMESH::DeleteActorEvent ) {
4612 if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( theObject ) ) {
4613 SMESHGUI_ClippingPlaneInfoMap& aClippingPlaneInfoMap = aSMESHGUI->getClippingPlaneInfoMap();
4614 SMESHGUI_ClippingPlaneInfoMap::iterator anIter1 = aClippingPlaneInfoMap.begin();
4615 for( ; anIter1 != aClippingPlaneInfoMap.end(); anIter1++ ) {
4616 SMESHGUI_ClippingPlaneInfoList& aClippingPlaneInfoList = anIter1->second;
4617 SMESHGUI_ClippingPlaneInfoList::iterator anIter2 = aClippingPlaneInfoList.begin();
4618 for( ; anIter2 != aClippingPlaneInfoList.end(); anIter2++ ) {
4619 SMESH::ClippingPlaneInfo& aClippingPlaneInfo = *anIter2;
4620 std::list<vtkActor*>& anActorList = aClippingPlaneInfo.ActorList;
4621 SMESH::TActorList::iterator anIter3 = anActorList.begin();
4622 for ( ; anIter3 != anActorList.end(); anIter3++ ) {
4623 if( anActor == *anIter3 ) {
4624 anActorList.erase( anIter3 );
4635 void SMESHGUI::createPreferences()
4637 // General tab ------------------------------------------------------------------------
4638 int genTab = addPreference( tr( "PREF_TAB_GENERAL" ) );
4640 int autoUpdate = addPreference( tr( "PREF_AUTO_UPDATE" ), genTab, LightApp_Preferences::Auto, "SMESH", "auto_update" );
4641 int lim = addPreference( tr( "PREF_UPDATE_LIMIT" ), autoUpdate, LightApp_Preferences::IntSpin, "SMESH", "update_limit" );
4642 setPreferenceProperty( lim, "min", 0 );
4643 setPreferenceProperty( lim, "max", 100000000 );
4644 setPreferenceProperty( lim, "step", 1000 );
4645 setPreferenceProperty( lim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
4647 int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab );
4648 setPreferenceProperty( qaGroup, "columns", 2 );
4649 addPreference( tr( "PREF_DISPLAY_ENTITY" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "display_entity" );
4650 addPreference( tr( "PREF_PRECISION_USE" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "use_precision" );
4651 int prec = addPreference( tr( "PREF_PRECISION_VALUE" ), qaGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_precision" );
4652 setPreferenceProperty( prec, "min", 0 );
4653 setPreferenceProperty( prec, "max", 16 );
4654 int doubleNodesTol = addPreference( tr( "PREF_EQUAL_NODES_TOL" ), qaGroup, LightApp_Preferences::DblSpin, "SMESH", "equal_nodes_tolerance" );
4655 setPreferenceProperty( doubleNodesTol, "precision", 10 );
4656 setPreferenceProperty( doubleNodesTol, "min", 0.0000000001 );
4657 setPreferenceProperty( doubleNodesTol, "max", 1000000.0 );
4658 setPreferenceProperty( doubleNodesTol, "step", 0.0000001 );
4660 int dispgroup = addPreference( tr( "PREF_DISPLAY_MODE" ), genTab );
4661 setPreferenceProperty( dispgroup, "columns", 2 );
4662 int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), dispgroup, LightApp_Preferences::Selector, "SMESH", "display_mode" );
4664 modes.append( tr("MEN_WIRE") );
4665 modes.append( tr("MEN_SHADE") );
4666 modes.append( tr("MEN_NODES") );
4667 modes.append( tr("MEN_SHRINK") );
4668 QList<QVariant> indices;
4669 indices.append( 0 );
4670 indices.append( 1 );
4671 indices.append( 2 );
4672 indices.append( 3 );
4673 setPreferenceProperty( dispmode, "strings", modes );
4674 setPreferenceProperty( dispmode, "indexes", indices );
4676 int arcgroup = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), genTab );
4677 setPreferenceProperty( arcgroup, "columns", 2 );
4678 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), arcgroup, LightApp_Preferences::Selector, "SMESH", "quadratic_mode" );
4679 QStringList quadraticModes;
4680 quadraticModes.append(tr("MEN_LINE_REPRESENTATION"));
4681 quadraticModes.append(tr("MEN_ARC_REPRESENTATION"));
4683 indices.append( 0 );
4684 indices.append( 1 );
4685 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
4686 setPreferenceProperty( quadraticmode, "indexes", indices );
4688 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), arcgroup, LightApp_Preferences::IntSpin,
4689 "SMESH", "max_angle" );
4690 setPreferenceProperty( maxAngle, "min", 1 );
4691 setPreferenceProperty( maxAngle, "max", 90 );
4695 int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
4696 setPreferenceProperty( exportgroup, "columns", 2 );
4697 addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" );
4698 addPreference( tr( "PREF_RENUMBER" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "renumbering" );
4700 int computeGroup = addPreference( tr( "PREF_GROUP_COMPUTE" ), genTab );
4701 setPreferenceProperty( computeGroup, "columns", 2 );
4702 int notifyMode = addPreference( tr( "PREF_NOTIFY_MODE" ), computeGroup, LightApp_Preferences::Selector, "SMESH", "show_result_notification" );
4704 modes.append( tr( "PREF_NOTIFY_NEVER" ) );
4705 modes.append( tr( "PREF_NOTIFY_ERROR" ) );
4706 modes.append( tr( "PREF_NOTIFY_ALWAYS" ) );
4708 indices.append( 0 );
4709 indices.append( 1 );
4710 indices.append( 2 );
4711 setPreferenceProperty( notifyMode, "strings", modes );
4712 setPreferenceProperty( notifyMode, "indexes", indices );
4714 int infoGroup = addPreference( tr( "PREF_GROUP_INFO" ), genTab );
4715 setPreferenceProperty( infoGroup, "columns", 4 );
4716 int elemInfo = addPreference( tr( "PREF_ELEM_INFO" ), infoGroup, LightApp_Preferences::Selector, "SMESH", "mesh_elem_info" );
4718 modes.append( tr( "PREF_ELEM_INFO_SIMPLE" ) );
4719 modes.append( tr( "PREF_ELEM_INFO_TREE" ) );
4721 indices.append( 0 );
4722 indices.append( 1 );
4723 setPreferenceProperty( elemInfo, "strings", modes );
4724 setPreferenceProperty( elemInfo, "indexes", indices );
4725 int nodesLim = addPreference( tr( "PREF_GPP_NODES_LIMIT" ), infoGroup, LightApp_Preferences::IntSpin, "SMESH", "info_groups_nodes_limit" );
4726 setPreferenceProperty( nodesLim, "min", 0 );
4727 setPreferenceProperty( nodesLim, "max", 10000000 );
4728 setPreferenceProperty( nodesLim, "step", 10000 );
4729 setPreferenceProperty( nodesLim, "special", tr( "PREF_UPDATE_LIMIT_NOLIMIT" ) );
4731 int segGroup = addPreference( tr( "PREF_GROUP_SEGMENT_LENGTH" ), genTab );
4732 setPreferenceProperty( segGroup, "columns", 2 );
4733 int segLen = addPreference( tr( "PREF_SEGMENT_LENGTH" ), segGroup, LightApp_Preferences::IntSpin,
4734 "SMESH", "segmentation" );
4735 setPreferenceProperty( segLen, "min", 1 );
4736 setPreferenceProperty( segLen, "max", 10000000 );
4737 int nbSeg = addPreference( tr( "PREF_NB_SEGMENTS" ), segGroup, LightApp_Preferences::IntSpin,
4738 "SMESH", "nb_segments_per_edge" );
4739 setPreferenceProperty( nbSeg, "min", 1 );
4740 setPreferenceProperty( nbSeg, "max", 10000000 );
4742 int loadGroup = addPreference( tr( "SMESH_PREF_MESH_LOADING" ), genTab );
4743 addPreference( tr( "PREF_FORGET_MESH_AT_HYP_MODIF" ), loadGroup, LightApp_Preferences::Bool,
4744 "SMESH", "forget_mesh_on_hyp_modif" );
4747 // Quantities with individual precision settings
4748 int precGroup = addPreference( tr( "SMESH_PREF_GROUP_PRECISION" ), genTab );
4749 setPreferenceProperty( precGroup, "columns", 2 );
4751 const int nbQuantities = 6;
4752 int precs[nbQuantities], ii = 0;
4753 precs[ii++] = addPreference( tr( "SMESH_PREF_length_precision" ), precGroup,
4754 LightApp_Preferences::IntSpin, "SMESH", "length_precision" );
4755 precs[ii++] = addPreference( tr( "SMESH_PREF_angle_precision" ), precGroup,
4756 LightApp_Preferences::IntSpin, "SMESH", "angle_precision" );
4757 precs[ii++] = addPreference( tr( "SMESH_PREF_len_tol_precision" ), precGroup,
4758 LightApp_Preferences::IntSpin, "SMESH", "len_tol_precision" );
4759 precs[ii++] = addPreference( tr( "SMESH_PREF_parametric_precision" ), precGroup,
4760 LightApp_Preferences::IntSpin, "SMESH", "parametric_precision" );
4761 precs[ii++] = addPreference( tr( "SMESH_PREF_area_precision" ), precGroup,
4762 LightApp_Preferences::IntSpin, "SMESH", "area_precision" );
4763 precs[ii ] = addPreference( tr( "SMESH_PREF_vol_precision" ), precGroup,
4764 LightApp_Preferences::IntSpin, "SMESH", "vol_precision" );
4766 // Set property for precision value for spinboxes
4767 for ( ii = 0; ii < nbQuantities; ii++ ){
4768 setPreferenceProperty( precs[ii], "min", -14 );
4769 setPreferenceProperty( precs[ii], "max", 14 );
4770 setPreferenceProperty( precs[ii], "precision", 2 );
4773 int previewGroup = addPreference( tr( "SMESH_PREF_GROUP_PREVIEW" ), genTab );
4774 setPreferenceProperty( previewGroup, "columns", 2 );
4775 int chunkSize = addPreference( tr( "PREF_PREVIEW_CHUNK_SIZE" ), previewGroup, LightApp_Preferences::IntSpin, "SMESH", "preview_actor_chunk_size" );
4776 setPreferenceProperty( chunkSize, "min", 0 );
4777 setPreferenceProperty( chunkSize, "max", 1000 );
4778 setPreferenceProperty( chunkSize, "step", 50 );
4780 int pyDumpGroup = addPreference( tr( "PREF_PYTHON_DUMP" ), genTab );
4781 addPreference( tr( "PREF_HISTORICAL_PYTHON_DUMP" ), pyDumpGroup, LightApp_Preferences::Bool, "SMESH", "historical_python_dump" );
4783 // Mesh tab ------------------------------------------------------------------------
4784 int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
4785 int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
4786 setPreferenceProperty( nodeGroup, "columns", 3 );
4788 addPreference( tr( "PREF_COLOR" ), nodeGroup, LightApp_Preferences::Color, "SMESH", "node_color" );
4790 int typeOfMarker = addPreference( tr( "PREF_TYPE_OF_MARKER" ), nodeGroup, LightApp_Preferences::Selector, "SMESH", "type_of_marker" );
4792 SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
4793 QList<QVariant> aMarkerTypeIndicesList;
4794 QList<QVariant> aMarkerTypeIconsList;
4795 for ( int i = VTK::MT_POINT; i < VTK::MT_USER; i++ ) {
4796 QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
4797 QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
4798 aMarkerTypeIndicesList << i;
4799 aMarkerTypeIconsList << pixmap;
4801 setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
4802 setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
4804 int markerScale = addPreference( tr( "PREF_MARKER_SCALE" ), nodeGroup, LightApp_Preferences::Selector, "SMESH", "marker_scale" );
4806 QList<QVariant> aMarkerScaleIndicesList;
4807 QStringList aMarkerScaleValuesList;
4808 for ( int i = VTK::MS_10; i <= VTK::MS_70; i++ ) {
4809 aMarkerScaleIndicesList << i;
4810 aMarkerScaleValuesList << QString::number( (i-(int)VTK::MS_10)*0.5 + 1.0 );
4812 setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
4813 setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
4815 int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab );
4816 setPreferenceProperty( elemGroup, "columns", 2 );
4818 int ColorId = addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::BiColor, "SMESH", "fill_color" );
4819 addPreference( tr( "PREF_COLOR_0D" ), elemGroup, LightApp_Preferences::Color, "SMESH", "elem0d_color" );
4820 addPreference( tr( "PREF_BALL_COLOR" ), elemGroup, LightApp_Preferences::Color, "SMESH", "ball_elem_color" );
4821 addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
4822 addPreference( tr( "PREF_WIREFRAME" ), elemGroup, LightApp_Preferences::Color, "SMESH", "wireframe_color" );
4824 setPreferenceProperty( ColorId, "text", tr("PREF_BACKFACE") );
4826 int grpGroup = addPreference( tr( "PREF_GROUP_GROUPS" ), meshTab );
4827 setPreferenceProperty( grpGroup, "columns", 2 );
4829 addPreference( tr( "PREF_GRP_NAMES" ), grpGroup, LightApp_Preferences::Color, "SMESH", "group_name_color" );
4831 int size0d = addPreference(tr("PREF_SIZE_0D"), elemGroup,
4832 LightApp_Preferences::IntSpin, "SMESH", "elem0d_size");
4833 int ballSize = addPreference(tr("PREF_BALL_SIZE"), elemGroup,
4834 LightApp_Preferences::IntSpin, "SMESH", "ball_elem_size");
4835 int elemW = addPreference(tr("PREF_WIDTH"), elemGroup,
4836 LightApp_Preferences::IntSpin, "SMESH", "element_width");
4837 int shrink = addPreference(tr("PREF_SHRINK_COEFF"), elemGroup,
4838 LightApp_Preferences::IntSpin, "SMESH", "shrink_coeff");
4840 setPreferenceProperty( size0d, "min", 1 );
4841 setPreferenceProperty( size0d, "max", 10 );
4843 setPreferenceProperty( ballSize, "min", 1 );
4844 setPreferenceProperty( ballSize, "max", 10 );
4846 setPreferenceProperty( elemW, "min", 1 );
4847 setPreferenceProperty( elemW, "max", 5 );
4849 setPreferenceProperty( shrink, "min", 0 );
4850 setPreferenceProperty( shrink, "max", 100 );
4852 int orientGroup = addPreference( tr( "PREF_GROUP_FACES_ORIENTATION" ), meshTab );
4853 setPreferenceProperty( orientGroup, "columns", 1 );
4855 addPreference( tr( "PREF_ORIENTATION_COLOR" ), orientGroup, LightApp_Preferences::Color, "SMESH", "orientation_color" );
4856 int orientScale = addPreference( tr( "PREF_ORIENTATION_SCALE" ), orientGroup, LightApp_Preferences::DblSpin, "SMESH", "orientation_scale" );
4858 setPreferenceProperty( orientScale, "min", 0.05 );
4859 setPreferenceProperty( orientScale, "max", 0.5 );
4860 setPreferenceProperty( orientScale, "step", 0.05 );
4862 addPreference( tr( "PREF_ORIENTATION_3D_VECTORS" ), orientGroup, LightApp_Preferences::Bool, "SMESH", "orientation_3d_vectors" );
4864 // Selection tab ------------------------------------------------------------------------
4865 int selTab = addPreference( tr( "PREF_TAB_SELECTION" ) );
4867 int selGroup = addPreference( tr( "PREF_GROUP_SELECTION" ), selTab );
4868 setPreferenceProperty( selGroup, "columns", 2 );
4870 addPreference( tr( "PREF_OBJECT_COLOR" ), selGroup, LightApp_Preferences::Color, "SMESH", "selection_object_color" );
4871 addPreference( tr( "PREF_ELEMENT_COLOR" ), selGroup, LightApp_Preferences::Color, "SMESH", "selection_element_color" );
4873 int preGroup = addPreference( tr( "PREF_GROUP_PRESELECTION" ), selTab );
4874 setPreferenceProperty( preGroup, "columns", 2 );
4876 addPreference( tr( "PREF_HIGHLIGHT_COLOR" ), preGroup, LightApp_Preferences::Color, "SMESH", "highlight_color" );
4878 int precSelGroup = addPreference( tr( "PREF_GROUP_PRECISION" ), selTab );
4879 setPreferenceProperty( precSelGroup, "columns", 2 );
4881 addPreference( tr( "PREF_NODES" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_node" );
4882 addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_element" );
4883 addPreference( tr( "PREF_OBJECTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_object" );
4885 // Scalar Bar tab ------------------------------------------------------------------------
4886 int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
4887 int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
4888 setPreferenceProperty( fontGr, "columns", 2 );
4890 addVtkFontPref( tr( "SMESH_TITLE" ), fontGr, "scalar_bar_title_font" );
4891 addPreference( tr( "PREF_TITLE_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_title_color" );
4893 addVtkFontPref( tr( "SMESH_LABELS" ), fontGr, "scalar_bar_label_font" );
4894 addPreference( tr( "PREF_LABELS_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" );
4896 int colorsLabelsGr = addPreference( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), sbarTab );
4897 setPreferenceProperty( colorsLabelsGr, "columns", 2 );
4899 int numcol = addPreference( tr( "SMESH_NUMBEROFCOLORS" ), colorsLabelsGr, LightApp_Preferences::IntSpin, "SMESH", "scalar_bar_num_colors" );
4900 setPreferenceProperty( numcol, "min", 2 );
4901 setPreferenceProperty( numcol, "max", 256 );
4903 int numlab = addPreference( tr( "SMESH_NUMBEROFLABELS" ), colorsLabelsGr, LightApp_Preferences::IntSpin, "SMESH", "scalar_bar_num_labels" );
4904 setPreferenceProperty( numlab, "min", 2 );
4905 setPreferenceProperty( numlab, "max", 65 );
4907 int orientGr = addPreference( tr( "SMESH_ORIENTATION" ), sbarTab );
4908 setPreferenceProperty( orientGr, "columns", 2 );
4909 int orient = addPreference( tr( "SMESH_ORIENTATION" ), orientGr, LightApp_Preferences::Selector, "SMESH", "scalar_bar_orientation" );
4910 QStringList orients;
4911 orients.append( tr( "SMESH_VERTICAL" ) );
4912 orients.append( tr( "SMESH_HORIZONTAL" ) );
4913 indices.clear(); indices.append( 0 ); indices.append( 1 );
4914 setPreferenceProperty( orient, "strings", orients );
4915 setPreferenceProperty( orient, "indexes", indices );
4917 int posVSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_VERTICAL" ), sbarTab );
4918 setPreferenceProperty( posVSizeGr, "columns", 2 );
4919 int xv = addPreference( tr( "SMESH_X_SCALARBAR" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_x" );
4920 int yv = addPreference( tr( "SMESH_Y_SCALARBAR" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_y" );
4921 int wv = addPreference( tr( "SMESH_WIDTH" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_width" );
4922 int hv = addPreference( tr( "SMESH_HEIGHT" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_height" );
4923 setPreferenceProperty( xv, "step", 0.1 );
4924 setPreferenceProperty( xv, "min", 0.0 );
4925 setPreferenceProperty( xv, "max", 1.0 );
4926 setPreferenceProperty( yv, "step", 0.1 );
4927 setPreferenceProperty( yv, "min", 0.0 );
4928 setPreferenceProperty( yv, "max", 1.0 );
4929 setPreferenceProperty( wv, "step", 0.1 );
4930 setPreferenceProperty( wv, "min", 0.0 );
4931 setPreferenceProperty( wv, "max", 1.0 );
4932 setPreferenceProperty( hv, "min", 0.0 );
4933 setPreferenceProperty( hv, "max", 1.0 );
4934 setPreferenceProperty( hv, "step", 0.1 );
4936 int posHSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_HORIZONTAL" ), sbarTab );
4937 setPreferenceProperty( posHSizeGr, "columns", 2 );
4938 int xh = addPreference( tr( "SMESH_X_SCALARBAR" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_x" );
4939 int yh = addPreference( tr( "SMESH_Y_SCALARBAR" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_y" );
4940 int wh = addPreference( tr( "SMESH_WIDTH" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_width" );
4941 int hh = addPreference( tr( "SMESH_HEIGHT" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_height" );
4942 setPreferenceProperty( xv, "min", 0.0 );
4943 setPreferenceProperty( xv, "max", 1.0 );
4944 setPreferenceProperty( xv, "step", 0.1 );
4945 setPreferenceProperty( xh, "min", 0.0 );
4946 setPreferenceProperty( xh, "max", 1.0 );
4947 setPreferenceProperty( xh, "step", 0.1 );
4948 setPreferenceProperty( yh, "min", 0.0 );
4949 setPreferenceProperty( yh, "max", 1.0 );
4950 setPreferenceProperty( yh, "step", 0.1 );
4951 setPreferenceProperty( wh, "min", 0.0 );
4952 setPreferenceProperty( wh, "max", 1.0 );
4953 setPreferenceProperty( wh, "step", 0.1 );
4954 setPreferenceProperty( hh, "min", 0.0 );
4955 setPreferenceProperty( hh, "max", 1.0 );
4956 setPreferenceProperty( hh, "step", 0.1 );
4958 int distributionGr = addPreference( tr( "SMESH_DISTRIBUTION_SCALARBAR" ), sbarTab, LightApp_Preferences::Auto, "SMESH", "distribution_visibility" );
4959 int coloringType = addPreference( tr( "SMESH_DISTRIBUTION_COLORING_TYPE" ), distributionGr, LightApp_Preferences::Selector, "SMESH", "distribution_coloring_type" );
4960 setPreferenceProperty( distributionGr, "columns", 3 );
4962 types.append( tr( "SMESH_MONOCOLOR" ) );
4963 types.append( tr( "SMESH_MULTICOLOR" ) );
4964 indices.clear(); indices.append( 0 ); indices.append( 1 );
4965 setPreferenceProperty( coloringType, "strings", types );
4966 setPreferenceProperty( coloringType, "indexes", indices );
4967 addPreference( tr( "SMESH_DISTRIBUTION_COLOR" ), distributionGr, LightApp_Preferences::Color, "SMESH", "distribution_color" );
4971 void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
4973 if( sect=="SMESH" ) {
4974 float sbX1,sbY1,sbW,sbH;
4975 float aTol = 1.00000009999999;
4976 std::string aWarning;
4977 SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
4978 if( name=="selection_object_color" || name=="selection_element_color" ||
4979 name=="highlight_color" ||
4980 name=="selection_precision_node" || name=="selection_precision_element" ||
4981 name=="selection_precision_object")
4982 SMESH::UpdateSelectionProp( this );
4983 else if (name == QString("scalar_bar_vertical_x") || name == QString("scalar_bar_vertical_width")){
4984 sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1);
4985 sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW);
4986 if(sbX1+sbW > aTol){
4987 aWarning = "Origin and Size Vertical: X+Width > 1\n";
4990 aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
4991 aResourceMgr->setValue("SMESH", "scalar_bar_vertical_width", sbW);
4994 else if(name == QString("scalar_bar_vertical_y") || name == QString("scalar_bar_vertical_height")){
4995 sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_y", sbY1);
4996 sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_height",sbH);
4997 if(sbY1+sbH > aTol){
4998 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4999 aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1);
5000 aResourceMgr->setValue("SMESH", "scalar_bar_vertical_height",sbH);
5003 else if(name == QString("scalar_bar_horizontal_x") || name == QString("scalar_bar_horizontal_width")){
5004 sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_x", sbX1);
5005 sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW);
5006 if(sbX1+sbW > aTol){
5007 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
5010 aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1);
5011 aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW);
5014 else if(name == QString("scalar_bar_horizontal_y") || name == QString("scalar_bar_horizontal_height")){
5015 sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_y", sbY1);
5016 sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_height",sbH);
5017 if(sbY1+sbH > aTol){
5018 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
5021 aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1);
5022 aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
5025 else if ( name == "segmentation" ) {
5026 int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation", 10 );
5027 myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
5029 else if ( name == "nb_segments_per_edge" ) {
5030 int nbSeg = aResourceMgr->integerValue( "SMESH", "nb_segments_per_edge", 15 );
5031 myComponentSMESH->SetDefaultNbSegments( nbSeg );
5033 else if ( name == "historical_python_dump" ||
5034 name == "forget_mesh_on_hyp_modif") {
5035 QString val = aResourceMgr->stringValue( "SMESH", name );
5036 myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() );
5039 if(aWarning.size() != 0){
5040 aWarning += "The default values are applied instead.";
5041 SUIT_MessageBox::warning(SMESHGUI::desktop(),
5042 QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"),
5043 QObject::tr(aWarning.c_str()));
5048 //================================================================================
5050 * \brief Update something in accordance with update flags
5051 * \param theFlags - update flags
5053 * Update viewer or/and object browser etc. in accordance with update flags ( see
5054 * LightApp_UpdateFlags enumeration ).
5056 //================================================================================
5057 void SMESHGUI::update( const int flags )
5059 if ( (flags & UF_Viewer) | (flags & UF_Forced) )
5060 SMESH::UpdateView();
5062 SalomeApp_Module::update( flags );
5065 //================================================================================
5067 * \brief Set default selection mode
5069 * SLOT called when operation commited. Sets default selection mode
5071 //================================================================================
5072 void SMESHGUI::onOperationCommited( SUIT_Operation* )
5074 SVTK_ViewWindow* vtkWnd =
5075 dynamic_cast<SVTK_ViewWindow*>( application()->desktop()->activeWindow() );
5077 vtkWnd->SetSelectionMode( ActorSelection );
5080 //================================================================================
5082 * \brief Set default selection mode
5084 * SLOT called when operation aborted. Sets default selection mode
5086 //================================================================================
5087 void SMESHGUI::onOperationAborted( SUIT_Operation* )
5089 SVTK_ViewWindow* vtkWnd =
5090 dynamic_cast<SVTK_ViewWindow*>( application()->desktop()->activeWindow() );
5092 vtkWnd->SetSelectionMode( ActorSelection );
5095 //================================================================================
5097 * \brief Creates operation with given identifier
5098 * \param id - identifier of operation to be started
5099 * \return Pointer on created operation or NULL if operation is not created
5101 * Virtual method redefined from the base class creates operation with given id.
5102 * It is called called automatically from startOperation method of base class.
5104 //================================================================================
5105 LightApp_Operation* SMESHGUI::createOperation( const int id ) const
5107 LightApp_Operation* op = 0;
5108 // to do : create operation here
5111 case 417: //convert to quadratic
5112 op = new SMESHGUI_ConvToQuadOp();
5114 case 418: // create 2D mesh as boundary on 3D
5115 op = new SMESHGUI_Make2DFrom3DOp();
5117 case 420: // Reorient faces
5118 op = new SMESHGUI_ReorientFacesOp();
5120 case 701: // Compute mesh
5121 op = new SMESHGUI_ComputeOp();
5123 case 702: // Create mesh
5124 op = new SMESHGUI_MeshOp( true, true );
5126 case 703: // Create sub-mesh
5127 op = new SMESHGUI_MeshOp( true, false );
5129 case 704: // Edit mesh/sub-mesh
5130 op = new SMESHGUI_MeshOp( false );
5132 case 711: // Precompute mesh
5133 op = new SMESHGUI_PrecomputeOp();
5135 case 712: // Evaluate mesh
5136 op = new SMESHGUI_EvaluateOp();
5138 case 713: // Evaluate mesh
5139 op = new SMESHGUI_MeshOrderOp();
5141 case 806: // Create group on geom
5142 op = new SMESHGUI_GroupOnShapeOp();
5144 case 904: // Find element
5145 op = new SMESHGUI_FindElemByPointOp();
5147 case 4067: // make mesh pass through point
5148 op = new SMESHGUI_MakeNodeAtPointOp();
5155 op = SalomeApp_Module::createOperation( id );
5159 //================================================================================
5161 * \brief Stops current operations and starts a given one
5162 * \param id - The id of the operation to start
5164 //================================================================================
5166 void SMESHGUI::switchToOperation(int id)
5168 if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() )
5169 activeStudy()->abortAllOperations();
5170 startOperation( id );
5173 LightApp_Displayer* SMESHGUI::displayer()
5176 myDisplayer = new SMESHGUI_Displayer( getApp() );
5180 SALOMEDS::Color SMESHGUI::getUniqueColor( const QList<SALOMEDS::Color>& theReservedColors )
5183 int aTolerance = 64;
5184 int anIterations = 0;
5190 if( anIterations % aPeriod == 0 )
5193 if( aTolerance < 1 )
5197 aHue = (int)( 360.0 * rand() / RAND_MAX );
5200 QList<SALOMEDS::Color>::const_iterator it = theReservedColors.constBegin();
5201 QList<SALOMEDS::Color>::const_iterator itEnd = theReservedColors.constEnd();
5202 for( ; it != itEnd; ++it )
5204 SALOMEDS::Color anAutoColor = *it;
5205 QColor aQColor( (int)( anAutoColor.R * 255.0 ), (int)( anAutoColor.G * 255.0 ), (int)( anAutoColor.B * 255.0 ) );
5208 aQColor.getHsv( &h, &s, &v );
5209 if( abs( h - aHue ) < aTolerance )
5221 aColor.setHsv( aHue, 255, 255 );
5223 SALOMEDS::Color aSColor;
5224 aSColor.R = (double)aColor.red() / 255.0;
5225 aSColor.G = (double)aColor.green() / 255.0;
5226 aSColor.B = (double)aColor.blue() / 255.0;
5231 const char gSeparator = '_'; // character used to separate parameter names
5232 const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b)
5233 const char gPathSep = '|'; // character used to separate paths
5236 * \brief Store visual parameters
5238 * This method is called just before the study document is saved.
5239 * Store visual parameters in AttributeParameter attribue(s)
5241 void SMESHGUI::storeVisualParameters (int savePoint)
5243 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
5244 if (!appStudy || !appStudy->studyDS())
5246 _PTR(Study) studyDS = appStudy->studyDS();
5248 // componentName is used for encoding of entries when storing them in IParameters
5249 std::string componentName = myComponentSMESH->ComponentDataType();
5250 //_PTR(SComponent) aSComponent = studyDS->FindComponent("SMESH");
5251 //if (!aSComponent) return;
5254 _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative",
5255 componentName.c_str(),
5257 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
5259 // store map of custom markers
5260 const VTK::MarkerMap& aMarkerMap = myMarkerMap[ studyDS->StudyId() ];
5261 if( !aMarkerMap.empty() )
5263 VTK::MarkerMap::const_iterator anIter = aMarkerMap.begin();
5264 for( ; anIter != aMarkerMap.end(); anIter++ )
5266 int anId = anIter->first;
5267 VTK::MarkerData aMarkerData = anIter->second;
5268 std::string aMarkerFileName = aMarkerData.first;
5269 VTK::MarkerTexture aMarkerTexture = aMarkerData.second;
5270 if( aMarkerTexture.size() < 3 )
5271 continue; // should contain at least width, height and the first value
5273 QString aPropertyName( "texture" );
5274 aPropertyName += gSeparator;
5275 aPropertyName += QString::number( anId );
5277 QString aPropertyValue = aMarkerFileName.c_str();
5278 aPropertyValue += gPathSep;
5280 VTK::MarkerTexture::const_iterator aTextureIter = aMarkerTexture.begin();
5281 ushort aWidth = *aTextureIter++;
5282 ushort aHeight = *aTextureIter++;
5283 aPropertyValue += QString::number( aWidth ); aPropertyValue += gDigitsSep;
5284 aPropertyValue += QString::number( aHeight ); aPropertyValue += gDigitsSep;
5285 for( ; aTextureIter != aMarkerTexture.end(); aTextureIter++ )
5286 aPropertyValue += QString::number( *aTextureIter );
5288 ip->setProperty( aPropertyName.toStdString(), aPropertyValue.toStdString() );
5292 // viewers counters are used for storing view_numbers in IParameters
5295 // main cycle to store parameters of displayed objects
5296 QList<SUIT_ViewManager*> lst;
5297 QList<SUIT_ViewManager*>::Iterator it;
5298 getApp()->viewManagers(lst);
5299 for (it = lst.begin(); it != lst.end(); it++)
5301 SUIT_ViewManager* vman = *it;
5302 QString vType = vman->getType();
5304 // saving VTK actors properties
5305 if (vType == SVTK_Viewer::Type())
5307 // store the clipping planes attached to the view manager
5308 SMESHGUI_ClippingPlaneInfoList aClippingPlaneInfoList;
5309 SMESHGUI_ClippingPlaneInfoMap::const_iterator anIter = myClippingPlaneInfoMap.find( vman );
5310 if( anIter != myClippingPlaneInfoMap.end() )
5311 aClippingPlaneInfoList = anIter->second;
5313 if( !aClippingPlaneInfoList.empty() ) {
5314 SMESHGUI_ClippingPlaneInfoList::const_iterator anIter = aClippingPlaneInfoList.begin();
5315 for( int anId = 0; anIter != aClippingPlaneInfoList.end(); anIter++, anId++ )
5317 const SMESH::ClippingPlaneInfo& aClippingPlaneInfo = *anIter;
5318 SMESH::OrientedPlane* aPlane = aClippingPlaneInfo.Plane;
5320 QString aPropertyName( "ClippingPlane" );
5321 aPropertyName += gSeparator;
5322 aPropertyName += QString::number( vtkViewers );
5323 aPropertyName += gSeparator;
5324 aPropertyName += QString::number( anId );
5326 QString aPropertyValue = QString::number( (int)aPlane->GetOrientation() ).toLatin1().constData();
5327 aPropertyValue += gDigitsSep;
5328 aPropertyValue += QString::number( aPlane->GetDistance() ).toLatin1().constData();
5329 aPropertyValue += gDigitsSep;
5330 aPropertyValue += QString::number( aPlane->myAngle[0] ).toLatin1().constData();
5331 aPropertyValue += gDigitsSep;
5332 aPropertyValue += QString::number( aPlane->myAngle[1] ).toLatin1().constData();
5334 ip->setProperty( aPropertyName.toStdString(), aPropertyValue.toStdString() );
5338 QVector<SUIT_ViewWindow*> views = vman->getViews();
5339 for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++)
5341 if (SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>(views[i]))
5343 VTK::ActorCollectionCopy aCopy(vtkView->getRenderer()->GetActors());
5344 vtkActorCollection* allActors = aCopy.GetActors();
5345 allActors->InitTraversal();
5346 while (vtkActor* actor = allActors->GetNextActor())
5348 if (actor->GetVisibility()) // store only visible actors
5350 SMESH_Actor* aSmeshActor = 0;
5351 if (actor->IsA("SMESH_Actor"))
5352 aSmeshActor = SMESH_Actor::SafeDownCast(actor);
5353 if (aSmeshActor && aSmeshActor->hasIO())
5355 Handle(SALOME_InteractiveObject) io = aSmeshActor->getIO();
5358 // entry is "encoded" = it does NOT contain component adress,
5359 // since it is a subject to change on next component loading
5360 std::string entry = ip->encodeEntry(io->getEntry(), componentName);
5362 std::string param, vtkParam = vType.toLatin1().data();
5363 vtkParam += gSeparator;
5364 vtkParam += QString::number(vtkViewers).toLatin1().data();
5365 vtkParam += gSeparator;
5368 param = vtkParam + "Visibility";
5369 ip->setParameter(entry, param, "On");
5372 param = vtkParam + "Representation";
5373 ip->setParameter(entry, param, QString::number
5374 ((int)aSmeshActor->GetRepresentation()).toLatin1().data());
5377 param = vtkParam + "IsShrunk";
5378 ip->setParameter(entry, param, QString::number
5379 ((int)aSmeshActor->IsShrunk()).toLatin1().data());
5381 // Displayed entities
5382 unsigned int aMode = aSmeshActor->GetEntityMode();
5383 bool isE = aMode & SMESH_Actor::eEdges;
5384 bool isF = aMode & SMESH_Actor::eFaces;
5385 bool isV = aMode & SMESH_Actor::eVolumes;
5387 QString modeStr ("e");
5388 modeStr += gDigitsSep; modeStr += QString::number(isE);
5389 modeStr += gDigitsSep; modeStr += "f";
5390 modeStr += gDigitsSep; modeStr += QString::number(isF);
5391 modeStr += gDigitsSep; modeStr += "v";
5392 modeStr += gDigitsSep; modeStr += QString::number(isV);
5394 param = vtkParam + "Entities";
5395 ip->setParameter(entry, param, modeStr.toLatin1().data());
5397 // Colors (surface:edge:)
5398 vtkFloatingPointType r, g, b;
5401 aSmeshActor->GetSufaceColor(r, g, b, delta);
5402 QString colorStr ("surface");
5403 colorStr += gDigitsSep; colorStr += QString::number(r);
5404 colorStr += gDigitsSep; colorStr += QString::number(g);
5405 colorStr += gDigitsSep; colorStr += QString::number(b);
5407 colorStr += gDigitsSep; colorStr += "backsurface";
5408 colorStr += gDigitsSep; colorStr += QString::number(delta);
5411 aSmeshActor->GetEdgeColor(r, g, b);
5412 colorStr += gDigitsSep; colorStr += "edge";
5413 colorStr += gDigitsSep; colorStr += QString::number(r);
5414 colorStr += gDigitsSep; colorStr += QString::number(g);
5415 colorStr += gDigitsSep; colorStr += QString::number(b);
5417 aSmeshActor->GetNodeColor(r, g, b);
5418 colorStr += gDigitsSep; colorStr += "node";
5419 colorStr += gDigitsSep; colorStr += QString::number(r);
5420 colorStr += gDigitsSep; colorStr += QString::number(g);
5421 colorStr += gDigitsSep; colorStr += QString::number(b);
5423 aSmeshActor->GetOutlineColor(r, g, b);
5424 colorStr += gDigitsSep; colorStr += "outline";
5425 colorStr += gDigitsSep; colorStr += QString::number(r);
5426 colorStr += gDigitsSep; colorStr += QString::number(g);
5427 colorStr += gDigitsSep; colorStr += QString::number(b);
5429 param = vtkParam + "Colors";
5430 ip->setParameter(entry, param, colorStr.toLatin1().data());
5432 // Sizes of lines and points
5433 QString sizeStr ("line");
5434 sizeStr += gDigitsSep; sizeStr += QString::number((int)aSmeshActor->GetLineWidth());
5435 sizeStr += gDigitsSep; sizeStr += "shrink";
5436 sizeStr += gDigitsSep; sizeStr += QString::number(aSmeshActor->GetShrinkFactor());
5438 param = vtkParam + "Sizes";
5439 ip->setParameter(entry, param, sizeStr.toLatin1().data());
5444 VTK::MarkerType aMarkerType = aSmeshActor->GetMarkerType();
5445 if( aMarkerType == VTK::MT_USER ) {
5446 markerStr += "custom";
5447 markerStr += gDigitsSep;
5448 markerStr += QString::number( aSmeshActor->GetMarkerTexture() );
5452 markerStr += gDigitsSep;
5453 markerStr += QString::number( (int)aMarkerType );
5454 markerStr += gDigitsSep;
5455 markerStr += QString::number( (int)aSmeshActor->GetMarkerScale() );
5458 param = vtkParam + "PointMarker";
5459 ip->setParameter(entry, param, markerStr.toLatin1().data());
5462 param = vtkParam + "Opacity";
5463 ip->setParameter(entry, param,
5464 QString::number(aSmeshActor->GetOpacity()).toLatin1().data());
5467 param = vtkParam + "ClippingPlane";
5469 if( !aClippingPlaneInfoList.empty() ) {
5470 SMESHGUI_ClippingPlaneInfoList::const_iterator anIter1 = aClippingPlaneInfoList.begin();
5471 for( int anId = 0; anIter1 != aClippingPlaneInfoList.end(); anIter1++, anId++ )
5473 const SMESH::ClippingPlaneInfo& aClippingPlaneInfo = *anIter1;
5474 std::list<vtkActor*> anActorList = aClippingPlaneInfo.ActorList;
5475 SMESH::TActorList::iterator anIter2 = anActorList.begin();
5476 for ( ; anIter2 != anActorList.end(); anIter2++ ) {
5477 if( aSmeshActor == *anIter2 ) {
5478 ip->setParameter( entry, param + QString::number( ++aPlaneId ).toLatin1().constData(),
5479 QString::number( anId ).toLatin1().constData() );
5486 ip->setParameter( entry, param, "Off" );
5487 } // if (io->hasEntry())
5488 } // SMESH_Actor && hasIO
5490 } // while.. actors traversal
5494 } // if (SVTK view model)
5495 } // for (viewManagers)
5498 // data structures for clipping planes processing
5501 vtkIdType Orientation;
5502 vtkFloatingPointType Distance;
5503 vtkFloatingPointType Angle[2];
5505 typedef std::list<TPlaneData> TPlaneDataList;
5506 typedef std::map<int, TPlaneDataList> TPlaneDataMap;
5508 typedef std::list<vtkActor*> TActorList;
5511 TActorList ActorList;
5512 SUIT_ViewManager* ViewManager;
5514 typedef std::list<TPlaneInfo> TPlaneInfoList;
5515 typedef std::map<int, TPlaneInfoList> TPlaneInfoMap;
5518 * \brief Restore visual parameters
5520 * This method is called after the study document is opened.
5521 * Restore visual parameters from AttributeParameter attribue(s)
5523 void SMESHGUI::restoreVisualParameters (int savePoint)
5525 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
5526 if (!appStudy || !appStudy->studyDS())
5528 _PTR(Study) studyDS = appStudy->studyDS();
5530 // componentName is used for encoding of entries when storing them in IParameters
5531 std::string componentName = myComponentSMESH->ComponentDataType();
5532 //_PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM");
5533 //if (!aSComponent) return;
5536 _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative",
5537 componentName.c_str(),
5539 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
5541 // restore map of custom markers and map of clipping planes
5542 VTK::MarkerMap& aMarkerMap = myMarkerMap[ studyDS->StudyId() ];
5543 TPlaneDataMap aPlaneDataMap;
5545 std::vector<std::string> properties = ip->getProperties();
5546 for (std::vector<std::string>::iterator propIt = properties.begin(); propIt != properties.end(); ++propIt)
5548 std::string property = *propIt;
5549 QString aPropertyName( property.c_str() );
5550 QString aPropertyValue( ip->getProperty( property ).c_str() );
5552 QStringList aPropertyNameList = aPropertyName.split( gSeparator, QString::SkipEmptyParts );
5553 if( aPropertyNameList.isEmpty() )
5556 QString aPropertyType = aPropertyNameList[0];
5557 if( aPropertyType == "texture" )
5559 if( aPropertyNameList.size() != 2 )
5563 int anId = aPropertyNameList[1].toInt( &ok );
5564 if( !ok || anId < 1 )
5567 QStringList aPropertyValueList = aPropertyValue.split( gPathSep, QString::SkipEmptyParts );
5568 if( aPropertyValueList.size() != 2 )
5571 std::string aMarkerFileName = aPropertyValueList[0].toStdString();
5572 QString aMarkerTextureString = aPropertyValueList[1];
5573 QStringList aMarkerTextureStringList = aMarkerTextureString.split( gDigitsSep, QString::SkipEmptyParts );
5574 if( aMarkerTextureStringList.size() != 3 )
5578 ushort aWidth = aMarkerTextureStringList[0].toUShort( &ok );
5583 ushort aHeight = aMarkerTextureStringList[1].toUShort( &ok );
5587 VTK::MarkerTexture aMarkerTexture;
5588 aMarkerTexture.push_back( aWidth );
5589 aMarkerTexture.push_back( aHeight );
5591 QString aMarkerTextureData = aMarkerTextureStringList[2];
5592 for( int i = 0, n = aMarkerTextureData.length(); i < n; i++ )
5594 QChar aChar = aMarkerTextureData.at( i );
5595 if( aChar.isDigit() )
5596 aMarkerTexture.push_back( aChar.digitValue() );
5599 aMarkerMap[ anId ] = VTK::MarkerData( aMarkerFileName, aMarkerTexture );
5601 else if( aPropertyType == "ClippingPlane" )
5603 if( aPropertyNameList.size() != 3 )
5607 int aViewId = aPropertyNameList[1].toInt( &ok );
5608 if( !ok || aViewId < 0 )
5612 int aClippingPlaneId = aPropertyNameList[2].toInt( &ok );
5613 if( !ok || aClippingPlaneId < 0 )
5616 QStringList aPropertyValueList = aPropertyValue.split( gDigitsSep, QString::SkipEmptyParts );
5617 if( aPropertyValueList.size() != 4 )
5620 TPlaneData aPlaneData;
5621 aPlaneData.Id = aClippingPlaneId;
5624 aPlaneData.Orientation = aPropertyValueList[0].toInt( &ok );
5629 aPlaneData.Distance = aPropertyValueList[1].toDouble( &ok );
5634 aPlaneData.Angle[0] = aPropertyValueList[2].toDouble( &ok );
5639 aPlaneData.Angle[1] = aPropertyValueList[3].toDouble( &ok );
5643 TPlaneDataList& aPlaneDataList = aPlaneDataMap[ aViewId ];
5644 aPlaneDataList.push_back( aPlaneData );
5648 TPlaneInfoMap aPlaneInfoMap;
5650 std::vector<std::string> entries = ip->getEntries();
5652 for (std::vector<std::string>::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt)
5654 // entry is a normal entry - it should be "decoded" (setting base adress of component)
5655 QString entry (ip->decodeEntry(*entIt).c_str());
5657 // Check that the entry corresponds to a real object in the Study
5658 // as the object may be deleted or modified after the visual state is saved.
5659 _PTR(SObject) so = studyDS->FindObjectID(entry.toLatin1().data());
5660 if (!so) continue; //Skip the not existent entry
5662 std::vector<std::string> paramNames = ip->getAllParameterNames( *entIt );
5663 std::vector<std::string> paramValues = ip->getAllParameterValues( *entIt );
5665 std::vector<std::string>::iterator namesIt = paramNames.begin();
5666 std::vector<std::string>::iterator valuesIt = paramValues.begin();
5668 // actors are stored in a map after displaying of them for
5669 // quicker access in the future: map < viewID to actor >
5670 NCollection_DataMap<int, SMESH_Actor*> vtkActors;
5672 for (; namesIt != paramNames.end(); ++namesIt, ++valuesIt)
5674 // visual parameters are stored in strings as follows: ViewerType_ViewIndex_ParamName.
5675 // '_' is used as separator and should not be used in viewer type or parameter names.
5676 QStringList lst = QString((*namesIt).c_str()).split(gSeparator, QString::SkipEmptyParts);
5677 if (lst.size() != 3)
5680 QString viewerTypStr = lst[0];
5681 QString viewIndexStr = lst[1];
5682 QString paramNameStr = lst[2];
5685 int viewIndex = viewIndexStr.toUInt(&ok);
5686 if (!ok) // bad conversion of view index to integer
5690 if (viewerTypStr == SVTK_Viewer::Type())
5692 SMESH_Actor* aSmeshActor = 0;
5693 if (vtkActors.IsBound(viewIndex))
5694 aSmeshActor = vtkActors.Find(viewIndex);
5696 QList<SUIT_ViewManager*> lst;
5697 getApp()->viewManagers(viewerTypStr, lst);
5699 // SVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
5700 SUIT_ViewManager* vman = NULL;
5701 if (viewIndex >= 0 && viewIndex < lst.count())
5702 vman = lst.at(viewIndex);
5704 if (paramNameStr == "Visibility")
5706 if (!aSmeshActor && displayer() && vman)
5708 SUIT_ViewModel* vmodel = vman->getViewModel();
5709 // SVTK view model can be casted to SALOME_View
5710 displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));
5712 // store displayed actor in a temporary map for quicker
5713 // access later when restoring other parameters
5714 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
5715 vtkRenderer* Renderer = vtkView->getRenderer();
5716 VTK::ActorCollectionCopy aCopy(Renderer->GetActors());
5717 vtkActorCollection* theActors = aCopy.GetActors();
5718 theActors->InitTraversal();
5719 bool isFound = false;
5720 vtkActor *ac = theActors->GetNextActor();
5721 for (; ac != NULL && !isFound; ac = theActors->GetNextActor()) {
5722 if (ac->IsA("SMESH_Actor")) {
5723 SMESH_Actor* aGeomAc = SMESH_Actor::SafeDownCast(ac);
5724 if (aGeomAc->hasIO()) {
5725 Handle(SALOME_InteractiveObject) io =
5726 Handle(SALOME_InteractiveObject)::DownCast(aGeomAc->getIO());
5727 if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) {
5729 vtkActors.Bind(viewIndex, aGeomAc);
5735 } // if (paramNameStr == "Visibility")
5738 // the rest properties "work" with SMESH_Actor
5741 QString val ((*valuesIt).c_str());
5744 if (paramNameStr == "Representation") {
5745 aSmeshActor->SetRepresentation((SMESH_Actor::EReperesent)val.toInt());
5748 else if (paramNameStr == "IsShrunk") {
5750 if (!aSmeshActor->IsShrunk())
5751 aSmeshActor->SetShrink();
5754 if (aSmeshActor->IsShrunk())
5755 aSmeshActor->UnShrink();
5758 // Displayed entities
5759 else if (paramNameStr == "Entities") {
5760 QStringList mode = val.split(gDigitsSep, QString::SkipEmptyParts);
5761 if (mode.count() == 6) {
5762 if (mode[0] != "e" || mode[2] != "f" || mode[4] != "v") {
5763 MESSAGE("Invalid order of data in Entities, must be: "
5764 "e:0/1:f:0/1:v:0/1");
5767 unsigned int aMode = aSmeshActor->GetEntityMode();
5768 unsigned int aNewMode =
5769 (int(SMESH_Actor::eEdges ) * mode[1].toInt()) |
5770 (int(SMESH_Actor::eFaces ) * mode[3].toInt()) |
5771 (int(SMESH_Actor::eVolumes) * mode[5].toInt());
5772 if (aNewMode != aMode)
5773 aSmeshActor->SetEntityMode(aNewMode);
5778 else if (paramNameStr == "Colors") {
5779 QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts);
5780 if (colors.count() == 16 || colors.count() == 18 ) {
5781 if (colors[0] != "surface" || colors[4] != "backsurface" ||
5782 (colors[8] != "edge" && colors[6] != "edge" ) || (colors[12] != "node" && colors[10] != "node") ||
5783 (colors.count() == 18 && colors[14] != "outline")) {
5784 MESSAGE("Invalid order of data in Colors, must be: "
5785 "surface:r:g:b:backsurface:r:g:b:edge:r:g:b:node:r:g:b or surface:r:g:b:backsurface:delta:edge:r:g:b:node:r:g:b:outline:r:g:b");
5791 vtkFloatingPointType otr,otg,otb;
5792 //Old case backsurface color is independent
5793 if( colors.count() == 16 ) {
5795 SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "0,170,255|-100" ) ;
5796 er = colors[9].toFloat();
5797 eg = colors[10].toFloat();
5798 eb = colors[11].toFloat();
5800 nr = colors[13].toFloat();
5801 ng = colors[14].toFloat();
5802 nb = colors[15].toFloat();
5803 SMESH::GetColor("SMESH", "outline_color", otr, otg, otb, QColor( 0, 70, 0 ) );
5805 //New case backsurface color depends on surface color
5806 delta = colors[5].toInt();
5808 er = colors[7].toFloat();
5809 eg = colors[8].toFloat();
5810 eb = colors[9].toFloat();
5812 nr = colors[11].toFloat();
5813 ng = colors[12].toFloat();
5814 nb = colors[13].toFloat();
5816 otr = colors[15].toFloat();
5817 otg = colors[16].toFloat();
5818 otb = colors[17].toFloat();
5820 aSmeshActor->SetSufaceColor(colors[1].toFloat(), colors[2].toFloat(), colors[3].toFloat(), delta);
5821 aSmeshActor->SetEdgeColor(er,eg,eb);
5822 aSmeshActor->SetNodeColor(nr,ng,nb);
5823 aSmeshActor->SetOutlineColor(otr,otg,otb);
5827 // Sizes of lines and points
5828 else if (paramNameStr == "Sizes") {
5829 QStringList sizes = val.split(gDigitsSep, QString::SkipEmptyParts);
5830 if (sizes.count() == 4) {
5831 if (sizes[0] != "line" || sizes[2] != "shrink") {
5832 MESSAGE("Invalid order of data in Sizes, must be: "
5833 "line:int:shrink:float");
5836 aSmeshActor->SetLineWidth(sizes[1].toInt());
5837 aSmeshActor->SetShrinkFactor(sizes[3].toFloat());
5840 else if (sizes.count() == 6) { // just to support old format
5841 if (sizes[0] != "line" || sizes[2] != "node" || sizes[4] != "shrink") {
5842 MESSAGE("Invalid order of data in Sizes, must be: "
5843 "line:int:node:int:shrink:float");
5846 aSmeshActor->SetLineWidth(sizes[1].toInt());
5847 //aSmeshActor->SetNodeSize(sizes[3].toInt()); // made obsolete
5848 aSmeshActor->SetShrinkFactor(sizes[5].toFloat());
5853 else if (paramNameStr == "PointMarker") {
5854 QStringList data = val.split(gDigitsSep, QString::SkipEmptyParts);
5855 if( data.count() >= 2 ) {
5857 int aParam1 = data[1].toInt( &ok );
5859 if( data[0] == "std" && data.count() == 3 ) {
5860 int aParam2 = data[2].toInt( &ok );
5861 aSmeshActor->SetMarkerStd( (VTK::MarkerType)aParam1, (VTK::MarkerScale)aParam2 );
5863 else if( data[0] == "custom" ) {
5864 VTK::MarkerMap::const_iterator markerIt = aMarkerMap.find( aParam1 );
5865 if( markerIt != aMarkerMap.end() ) {
5866 VTK::MarkerData aMarkerData = markerIt->second;
5867 aSmeshActor->SetMarkerTexture( aParam1, aMarkerData.second );
5874 else if (paramNameStr == "Opacity") {
5875 aSmeshActor->SetOpacity(val.toFloat());
5878 else if (paramNameStr.startsWith("ClippingPlane")) {
5879 QStringList vals = val.split(gDigitsSep, QString::SkipEmptyParts);
5880 // old format - val looks like "Off" or "0:0.5:0:0" (orientation, distance, two angles)
5881 // new format - val looks like "Off" or "0" (plane id)
5882 // (note: in new format "Off" value is used only for consistency,
5883 // so it is processed together with values in old format)
5884 bool anIsOldFormat = ( vals.count() == 4 || val == "Off" );
5885 if( anIsOldFormat ) {
5886 if (paramNameStr == "ClippingPlane1" || val == "Off")
5887 aSmeshActor->RemoveAllClippingPlanes();
5889 SMESH::Orientation anOrientation = (SMESH::Orientation)vals[0].toInt();
5890 double aDistance = vals[1].toFloat();
5891 vtkFloatingPointType anAngle[2];
5892 anAngle[0] = vals[2].toFloat();
5893 anAngle[1] = vals[3].toFloat();
5895 QList<SUIT_ViewManager*> lst;
5896 getApp()->viewManagers(viewerTypStr, lst);
5897 // SVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
5898 if (viewIndex >= 0 && viewIndex < lst.count()) {
5899 SUIT_ViewManager* vman = lst.at(viewIndex);
5900 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
5902 SMESHGUI_ClippingPlaneInfoList& aClippingPlaneInfoList = myClippingPlaneInfoMap[ vman ];
5904 SMESH::TActorList anActorList;
5905 anActorList.push_back( aSmeshActor );
5906 SMESH::OrientedPlane* aPlane =
5907 SMESHGUI_ClippingDlg::AddPlane(anActorList, vtkView, anOrientation, aDistance, anAngle);
5909 SMESH::ClippingPlaneInfo aClippingPlaneInfo;
5910 aClippingPlaneInfo.Plane = aPlane;
5911 aClippingPlaneInfo.ActorList = anActorList;
5912 aClippingPlaneInfoList.push_back( aClippingPlaneInfo );
5919 int aPlaneId = val.toInt( &ok );
5920 if( ok && aPlaneId >= 0 ) {
5921 bool anIsDefinedPlane = false;
5922 TPlaneInfoList& aPlaneInfoList = aPlaneInfoMap[ viewIndex ];
5923 TPlaneInfoList::iterator anIter = aPlaneInfoList.begin();
5924 for( ; anIter != aPlaneInfoList.end(); anIter++ ) {
5925 TPlaneInfo& aPlaneInfo = *anIter;
5926 if( aPlaneInfo.PlaneId == aPlaneId ) {
5927 aPlaneInfo.ActorList.push_back( aSmeshActor );
5928 anIsDefinedPlane = true;
5932 if( !anIsDefinedPlane ) {
5933 TPlaneInfo aPlaneInfo;
5934 aPlaneInfo.PlaneId = aPlaneId;
5935 aPlaneInfo.ActorList.push_back( aSmeshActor );
5936 aPlaneInfo.ViewManager = vman;
5938 // to make the list sorted by plane id
5939 anIter = aPlaneInfoList.begin();
5940 for( ; anIter != aPlaneInfoList.end(); anIter++ ) {
5941 const TPlaneInfo& aPlaneInfoRef = *anIter;
5942 if( aPlaneInfoRef.PlaneId > aPlaneId )
5945 aPlaneInfoList.insert( anIter, aPlaneInfo );
5950 } // if (aSmeshActor)
5951 } // other parameters than Visibility
5953 } // for names/parameters iterator
5954 } // for entries iterator
5956 // take into account planes with empty list of actors referred to them
5957 QList<SUIT_ViewManager*> aVMList;
5958 getApp()->viewManagers(SVTK_Viewer::Type(), aVMList);
5960 TPlaneDataMap::const_iterator aPlaneDataIter = aPlaneDataMap.begin();
5961 for( ; aPlaneDataIter != aPlaneDataMap.end(); aPlaneDataIter++ ) {
5962 int aViewId = aPlaneDataIter->first;
5963 if( aViewId >= 0 && aViewId < aVMList.count() ) {
5964 SUIT_ViewManager* aViewManager = aVMList.at( aViewId );
5966 const TPlaneDataList& aPlaneDataList = aPlaneDataIter->second;
5968 TPlaneInfoList& aPlaneInfoList = aPlaneInfoMap[ aViewId ];
5969 TPlaneDataList::const_iterator anIter2 = aPlaneDataList.begin();
5970 for( ; anIter2 != aPlaneDataList.end(); anIter2++ ) {
5971 const TPlaneData& aPlaneData = *anIter2;
5972 int aPlaneId = aPlaneData.Id;
5974 bool anIsFound = false;
5975 TPlaneInfoList::const_iterator anIter3 = aPlaneInfoList.begin();
5976 for( ; anIter3 != aPlaneInfoList.end(); anIter3++ ) {
5977 const TPlaneInfo& aPlaneInfo = *anIter3;
5978 if( aPlaneInfo.PlaneId == aPlaneId ) {
5985 TPlaneInfo aPlaneInfo; // ActorList field is empty
5986 aPlaneInfo.PlaneId = aPlaneId;
5987 aPlaneInfo.ViewManager = aViewManager;
5989 // to make the list sorted by plane id
5990 TPlaneInfoList::iterator anIter4 = aPlaneInfoList.begin();
5991 for( ; anIter4 != aPlaneInfoList.end(); anIter4++ ) {
5992 const TPlaneInfo& aPlaneInfoRef = *anIter4;
5993 if( aPlaneInfoRef.PlaneId > aPlaneId )
5996 aPlaneInfoList.insert( anIter4, aPlaneInfo );
6002 // add clipping planes to actors according to the restored parameters
6003 // and update the clipping plane map
6004 TPlaneInfoMap::const_iterator anIter1 = aPlaneInfoMap.begin();
6005 for( ; anIter1 != aPlaneInfoMap.end(); anIter1++ ) {
6006 int aViewId = anIter1->first;
6007 const TPlaneInfoList& aPlaneInfoList = anIter1->second;
6009 TPlaneDataMap::const_iterator anIter2 = aPlaneDataMap.find( aViewId );
6010 if( anIter2 == aPlaneDataMap.end() )
6012 const TPlaneDataList& aPlaneDataList = anIter2->second;
6014 TPlaneInfoList::const_iterator anIter3 = aPlaneInfoList.begin();
6015 for( ; anIter3 != aPlaneInfoList.end(); anIter3++ ) {
6016 const TPlaneInfo& aPlaneInfo = *anIter3;
6017 int aPlaneId = aPlaneInfo.PlaneId;
6018 const TActorList& anActorList = aPlaneInfo.ActorList;
6019 SUIT_ViewManager* aViewManager = aPlaneInfo.ViewManager;
6023 SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>( aViewManager->getActiveView() );
6027 SMESHGUI_ClippingPlaneInfoList& aClippingPlaneInfoList = myClippingPlaneInfoMap[ aViewManager ];
6029 TPlaneDataList::const_iterator anIter4 = aPlaneDataList.begin();
6030 for( ; anIter4 != aPlaneDataList.end(); anIter4++ ) {
6031 const TPlaneData& aPlaneData = *anIter4;
6032 if( aPlaneData.Id == aPlaneId ) {
6033 SMESH::OrientedPlane* aPlane =
6034 SMESHGUI_ClippingDlg::AddPlane( anActorList,
6036 (SMESH::Orientation)aPlaneData.Orientation,
6037 aPlaneData.Distance,
6040 SMESH::ClippingPlaneInfo aClippingPlaneInfo;
6041 aClippingPlaneInfo.Plane = aPlane;
6042 aClippingPlaneInfo.ActorList = anActorList;
6043 aClippingPlaneInfoList.push_back( aClippingPlaneInfo );
6051 // update all VTK views
6052 QList<SUIT_ViewManager*> lst;
6053 getApp()->viewManagers(lst);
6054 for (QList<SUIT_ViewManager*>::Iterator it = lst.begin(); it != lst.end(); it++) {
6055 SUIT_ViewModel* vmodel = (*it)->getViewModel();
6056 if (vmodel && vmodel->getType() == SVTK_Viewer::Type()) {
6057 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView();
6058 vtkView->getRenderer()->ResetCameraClippingRange();
6065 \brief Adds preferences for dfont of VTK viewer
6067 \param pIf group identifier
6068 \param param parameter
6069 \return identifier of preferences
6071 int SMESHGUI::addVtkFontPref( const QString& label, const int pId, const QString& param )
6073 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "SMESH", param );
6075 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
6078 fam.append( tr( "SMESH_FONT_ARIAL" ) );
6079 fam.append( tr( "SMESH_FONT_COURIER" ) );
6080 fam.append( tr( "SMESH_FONT_TIMES" ) );
6082 setPreferenceProperty( tfont, "fonts", fam );
6084 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
6085 setPreferenceProperty( tfont, "features", f );
6091 \brief Actions after hypothesis edition
6092 Updates object browser after hypothesis edition
6094 void SMESHGUI::onHypothesisEdit( int result )
6097 SMESHGUI::Modified();
6098 updateObjBrowser( true );
6103 \brief Signal handler closing(SUIT_ViewWindow*) of a view
6104 \param pview view being closed
6106 void SMESHGUI::onViewClosed( SUIT_ViewWindow* pview ) {
6107 #ifndef DISABLE_PLOT2DVIEWER
6108 //Crear all Plot2d Viewers if need.
6109 SMESH::ClearPlot2Viewers(pview);
6113 void SMESHGUI::message( const QString& msg )
6116 QStringList data = msg.split("/");
6117 if ( data.count() > 0 ) {
6118 if ( data.first() == "mesh_loading" ) {
6120 QString entry = data.count() > 1 ? data[1] : QString();
6121 if ( entry.isEmpty() )
6124 _PTR(Study) study = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() )->studyDS();
6126 _PTR(SObject) obj = study->FindObjectID( entry.toLatin1().constData() );
6129 name = obj->GetName().c_str();
6130 if ( name.isEmpty() )
6133 if ( data.last() == "stop" )
6134 application()->putInfo( tr( "MESH_LOADING_MSG_FINISHED" ).arg( name ) );
6136 application()->putInfo( tr( "MESH_LOADING_MSG" ).arg( name ) );
6137 QApplication::processEvents();
6143 \brief Connects or disconnects signals about activating and cloning view on the module slots
6144 \param pview view which is connected/disconnected
6146 void SMESHGUI::connectView( const SUIT_ViewWindow* pview ) {
6150 SUIT_ViewManager* viewMgr = pview->getViewManager();
6152 disconnect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ),
6153 this, SLOT( onViewClosed( SUIT_ViewWindow* ) ) );
6155 connect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ),
6156 this, SLOT( onViewClosed( SUIT_ViewWindow* ) ) );
6161 \brief Return \c true if object can be renamed
6163 bool SMESHGUI::renameAllowed( const QString& entry) const {
6164 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( application() );
6168 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() );
6172 SalomeApp_DataObject* obj = dynamic_cast<SalomeApp_DataObject*>(appStudy->findObjectByEntry(entry));
6177 if(appStudy->isComponent(entry) || obj->isReference())
6180 // check type to prevent renaming of inappropriate objects
6181 int aType = SMESHGUI_Selection::type(qPrintable(entry), SMESH::GetActiveStudyDocument());
6182 if (aType == MESH || aType == GROUP ||
6183 aType == SUBMESH || aType == SUBMESH_COMPOUND ||
6184 aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||
6185 aType == SUBMESH_EDGE || aType == SUBMESH_VERTEX ||
6186 aType == HYPOTHESIS || aType == ALGORITHM)
6193 Rename object by entry.
6194 \param entry entry of the object
6195 \param name new name of the object
6196 \brief Return \c true if rename operation finished successfully, \c false otherwise.
6198 bool SMESHGUI::renameObject( const QString& entry, const QString& name) {
6200 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( application() );
6204 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() );
6209 _PTR(Study) aStudy = appStudy->studyDS();
6214 bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
6216 SUIT_MessageBox::warning ( anApp->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
6221 _PTR(SObject) obj = aStudy->FindObjectID( qPrintable(entry) );
6222 _PTR(GenericAttribute) anAttr;
6223 _PTR(AttributeName) aName;
6225 if ( obj->FindAttribute(anAttr, "AttributeName") ) {
6227 // check type to prevent renaming of inappropriate objects
6228 int aType = SMESHGUI_Selection::type( qPrintable(entry), SMESH::GetActiveStudyDocument() );
6229 if (aType == MESH || aType == GROUP ||
6230 aType == SUBMESH || aType == SUBMESH_COMPOUND ||
6231 aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||
6232 aType == SUBMESH_EDGE || aType == SUBMESH_VERTEX ||
6233 aType == HYPOTHESIS || aType == ALGORITHM) {
6234 if ( !name.isEmpty() ) {
6235 SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), qPrintable(name) );
6237 // update name of group object and its actor
6238 Handle(SALOME_InteractiveObject) IObject =
6239 new SALOME_InteractiveObject ( qPrintable(entry), "SMESH", qPrintable(name) );
6241 SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
6242 if( !aGroupObject->_is_nil() ) {
6243 aGroupObject->SetName( qPrintable(name) );
6244 if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( qPrintable(entry) ) )
6245 anActor->setName( qPrintable(name) );