1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESHGUI.cxx
23 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
28 #include "SMESHGUI_NodesDlg.h"
29 #include "SMESHGUI_TransparencyDlg.h"
30 #include "SMESHGUI_ClippingDlg.h"
31 #include "SMESHGUI_GroupDlg.h"
32 #include "SMESHGUI_RemoveNodesDlg.h"
33 #include "SMESHGUI_RemoveElementsDlg.h"
34 #include "SMESHGUI_MeshInfosDlg.h"
35 #include "SMESHGUI_StandardMeshInfosDlg.h"
36 #include "SMESHGUI_WhatIsDlg.h"
37 #include "SMESHGUI_Preferences_ColorDlg.h"
38 #include "SMESHGUI_Preferences_ScalarBarDlg.h"
39 #include "SMESHGUI_Hypotheses.h"
40 #include "SMESHGUI_MoveNodesDlg.h"
41 #include "SMESHGUI_AddMeshElementDlg.h"
42 #include "SMESHGUI_AddQuadraticElementDlg.h"
43 #include "SMESHGUI_FilterDlg.h"
44 #include "SMESHGUI_FilterLibraryDlg.h"
45 #include "SMESHGUI_SingleEditDlg.h"
46 #include "SMESHGUI_MultiEditDlg.h"
47 #include "SMESHGUI_GroupOpDlg.h"
48 #include "SMESHGUI_DeleteGroupDlg.h"
49 #include "SMESHGUI_SmoothingDlg.h"
50 #include "SMESHGUI_RenumberingDlg.h"
51 #include "SMESHGUI_ExtrusionDlg.h"
52 #include "SMESHGUI_ExtrusionAlongPathDlg.h"
53 #include "SMESHGUI_RevolutionDlg.h"
54 #include "SMESHGUI_TranslationDlg.h"
55 #include "SMESHGUI_RotationDlg.h"
56 #include "SMESHGUI_SymmetryDlg.h"
57 #include "SMESHGUI_SewingDlg.h"
58 #include "SMESHGUI_EditMeshDlg.h"
59 #include "SMESHGUI_MeshPatternDlg.h"
60 #include "SMESHGUI_Selection.h"
61 #include "SMESHGUI_CreatePolyhedralVolumeDlg.h"
62 #include "SMESHGUI_ConvToQuadOp.h"
63 #include "SMESHGUI_MeshOp.h"
64 #include "SMESHGUI_Displayer.h"
65 #include "SMESHGUI_MakeNodeAtPointDlg.h"
66 #include "SMESHGUI_BuildCompoundDlg.h"
67 #include "SMESHGUI_ComputeDlg.h"
68 #include "SMESHGUI_FileInfoDlg.h"
70 #include "SMESHGUI_Utils.h"
71 #include "SMESHGUI_MeshUtils.h"
72 #include "SMESHGUI_GroupUtils.h"
73 #include "SMESHGUI_FilterUtils.h"
74 #include "SMESHGUI_PatternUtils.h"
75 #include "SMESHGUI_VTKUtils.h"
76 #include "SMESHGUI_HypothesesUtils.h"
78 #include <SMESH_Client.hxx>
79 #include <SMESH_Actor.h>
80 #include <SMESH_TypeFilter.hxx>
82 // SALOME GUI includes
83 #include <SalomeApp_Tools.h>
84 #include <SalomeApp_Study.h>
85 #include <SalomeApp_Application.h>
86 #include <SalomeApp_CheckFileDlg.h>
88 #include <LightApp_DataOwner.h>
89 #include <LightApp_Preferences.h>
90 #include <LightApp_SelectionMgr.h>
91 #include <LightApp_UpdateFlags.h>
92 #include <LightApp_NameDlg.h>
94 #include <SVTK_ViewWindow.h>
95 #include <SVTK_ViewModel.h>
96 #include <SVTK_ViewManager.h>
98 #include <SUIT_MessageBox.h>
99 #include <SUIT_ResourceMgr.h>
100 #include <SUIT_FileDlg.h>
101 #include <SUIT_Desktop.h>
102 #include <SUIT_OverrideCursor.h>
103 #include <SUIT_Session.h>
105 #include <QtxPopupMgr.h>
106 #include <QtxFontEdit.h>
108 #include <SALOME_ListIO.hxx>
109 #include <SALOME_ListIteratorOfListIO.hxx>
112 #include <SALOMEconfig.h>
113 #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
114 #include CORBA_CLIENT_HEADER(SMESH_MeshEditor)
117 // #define INCLUDE_MENUITEM_DEF // VSR commented ????????
121 #include <boost/shared_ptr.hpp>
124 #include <vtkScalarBarActor.h>
126 // SALOME KERNEL includes
127 #include <SALOMEDS_Study.hxx>
128 #include <SALOMEDSClient_StudyBuilder.hxx>
129 #include <SALOMEDSClient_SComponent.hxx>
132 #include <Standard_ErrorHandler.hxx>
136 //=============================================================
137 void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
140 void ExportMeshToFile(int theCommandID);
142 void SetDisplayMode(int theCommandID);
144 void SetDisplayEntity(int theCommandID);
146 void Control( int theCommandID );
150 //=============================================================
151 void ImportMeshesFromFile( SMESH::SMESH_Gen_ptr theComponentMesh,
155 std::string myExtension;
157 if ( theCommandID == 113 ) {
158 filter.append( QObject::tr( "MED files (*.med)" ) );
159 filter.append( QObject::tr( "All files (*)" ) );
161 else if ( theCommandID == 112 ) {
162 filter.append( QObject::tr( "IDEAS files (*.unv)" ) );
164 else if ( theCommandID == 111 ) {
165 filter.append( QObject::tr( "DAT files (*.dat)" ) );
168 QString anInitialPath = "";
169 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
170 anInitialPath = QDir::currentPath();
172 QStringList filenames = SUIT_FileDlg::getOpenFileNames( SMESHGUI::desktop(),
175 QObject::tr( "SMESH_IMPORT_MESH" ) );
176 if ( filenames.count() > 0 ) {
177 SUIT_OverrideCursor wc;
178 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
181 bool isEmpty = false;
182 for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) {
183 QString filename = *it;
184 SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
186 switch ( theCommandID ) {
189 // DAT format (currently unsupported)
190 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
191 arg( QObject::tr( "SMESH_ERR_NOT_SUPPORTED_FORMAT" ) ) );
197 aMeshes->length( 1 );
198 aMeshes[0] = theComponentMesh->CreateMeshesFromUNV( filename.toLatin1().constData() );
199 if ( aMeshes[0]->_is_nil() )
200 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
201 arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
207 SMESH::DriverMED_ReadStatus res;
208 aMeshes = theComponentMesh->CreateMeshesFromMED( filename.toLatin1().constData(), res );
209 if ( res != SMESH::DRS_OK ) {
210 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
211 arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
217 catch ( const SALOME::SALOME_Exception& S_ex ) {
218 errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
219 arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
222 for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) {
223 _PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
225 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
226 _PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
227 aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
228 if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
229 SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
237 // update Object browser
238 SMESHGUI::GetSMESHGUI()->updateObjBrowser();
240 // show Error message box if there were errors
241 if ( errors.count() > 0 ) {
242 SUIT_MessageBox::critical( SMESHGUI::desktop(),
243 QObject::tr( "SMESH_ERROR" ),
244 QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
247 // show warning message box, if some imported mesh is empty
249 SUIT_MessageBox::warning( SMESHGUI::desktop(),
250 QObject::tr( "SMESH_WRN_WARNING" ),
251 QObject::tr( "SMESH_DRS_SOME_EMPTY" ) );
256 void ExportMeshToFile( int theCommandID )
258 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
259 SALOME_ListIO selected;
261 aSel->selectedObjects( selected );
263 if(selected.Extent()){
264 Handle(SALOME_InteractiveObject) anIObject = selected.First();
265 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
266 if ( !aMesh->_is_nil() ) {
267 QString aFilter, aTitle = QObject::tr("Export mesh");
268 QMap<QString, SMESH::MED_VERSION> aFilterMap;
269 QMap<QString, int> aFilterMapSTL;
270 switch ( theCommandID ) {
274 if (aMesh->HasDuplicatedGroupNamesMED()) {
275 int aRet = SUIT_MessageBox::warning
276 (SMESHGUI::desktop(),
277 QObject::tr("SMESH_WRN_WARNING"),
278 QObject::tr("SMESH_EXPORT_MED_DUPLICATED_GRP").arg(anIObject->getName()),
279 SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
280 if (aRet != SUIT_MessageBox::Yes)
284 QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2));
285 QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
286 aFilterMap.insert( QString("MED ") + v21 + " (*.med)", SMESH::MED_V2_1 );
287 aFilterMap.insert( QString("MED ") + v22 + " (*.med)", SMESH::MED_V2_2 );
292 aFilter = QObject::tr("DAT files (*.dat)");
297 if (aMesh->NbPyramids()) {
298 int aRet = SUIT_MessageBox::warning
299 (SMESHGUI::desktop(),
300 QObject::tr("SMESH_WRN_WARNING"),
301 QObject::tr("SMESH_EXPORT_UNV").arg(anIObject->getName()),
302 SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
303 if (aRet != SUIT_MessageBox::Yes)
306 aFilter = QObject::tr("IDEAS files (*.unv)");
314 there must be check on others mesh elements not equal triangles
316 if (aMesh->NbTriangles() < 1) {
317 SUIT_MessageBox::warning
318 (SMESHGUI::desktop(),
319 QObject::tr("SMESH_WRN_WARNING"),
320 QObject::tr("SMESH_EXPORT_STL1").arg(anIObject->getName()));
323 if (!(aMesh->NbElements() - aMesh->NbTriangles())) {
324 int aRet = SUIT_MessageBox::warning
325 (SMESHGUI::desktop(),
326 QObject::tr("SMESH_WRN_WARNING"),
327 QObject::tr("SMESH_EXPORT_STL2").arg(anIObject->getName()),
328 SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
329 if (aRet != SUIT_MessageBox::Yes)
333 aFilterMapSTL.insert( QObject::tr("STL ASCII (*.stl)"), 1 ); // 1 - ASCII mode
334 aFilterMapSTL.insert( QObject::tr("STL Binary (*.stl)"), 0 ); // 0 - Binary mode
342 SMESH::MED_VERSION aFormat;
343 // Init the parameter with the default value
344 bool aIsASCII_STL = true;
345 bool toCreateGroups = false;
346 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
348 toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
350 QString anInitialPath = "";
351 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
352 anInitialPath = QDir::currentPath();
354 if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141) {
355 if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
356 aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), anInitialPath + QString("/") + anIObject->getName(),
357 aFilter, aTitle, false);
359 else if(theCommandID == 140 || theCommandID == 141) { // Export to STL
361 QMap<QString, int>::const_iterator it = aFilterMapSTL.begin();
362 for ( ; it != aFilterMapSTL.end(); ++it )
363 filters.push_back( it.key() );
365 SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
366 fd->setWindowTitle( aTitle );
367 fd->setFilters( filters );
368 fd->selectFilter( QObject::tr("STL ASCII (*.stl)") );
369 if ( !anInitialPath.isEmpty() )
370 fd->setDirectory( anInitialPath );
371 fd->selectFile(anIObject->getName());
375 aFilename = fd->selectedFile();
376 aIsASCII_STL = (aFilterMapSTL[fd->selectedFilter()]) == 1 ? true: false;
381 else { // Export to MED
383 QString aDefaultFilter;
384 QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin();
385 for ( ; it != aFilterMap.end(); ++it ) {
386 filters.push_back( it.key() );
387 if (it.value() == SMESH::MED_V2_2)
388 aDefaultFilter = it.key();
391 //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
392 SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
393 ( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
394 fd->setWindowTitle( aTitle );
395 fd->setFilters( filters );
396 //fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") );
397 fd->selectFilter(aDefaultFilter);
398 fd->SetChecked(toCreateGroups);
399 if ( !anInitialPath.isEmpty() )
400 fd->setDirectory( anInitialPath );
401 fd->selectFile(anIObject->getName());
405 aFilename = fd->selectedFile();
406 aFormat = aFilterMap[fd->selectedFilter()];
408 if ( !aFilename.isEmpty()
409 && (aMesh->NbPolygons()>0 || aMesh->NbPolyhedrons()>0)
410 && aFormat==SMESH::MED_V2_1) {
411 int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
412 QObject::tr("SMESH_WRN_WARNING"),
413 QObject::tr("SMESH_EXPORT_MED_V2_1").arg(anIObject->getName()),
414 SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::Yes);
415 if (aRet != SUIT_MessageBox::Yes) {
420 toCreateGroups = fd->IsChecked();
423 if ( !aFilename.isEmpty() ) {
424 // Check whether the file already exists and delete it if yes
425 QFile aFile( aFilename );
426 if ( aFile.exists() )
428 SUIT_OverrideCursor wc;
431 bool Renumber = false;
432 // PAL 14172 : Check of we have to renumber or not from the preferences before export
434 Renumber= resMgr->booleanValue("SMESH","renumbering");
436 SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
437 aMeshEditor->RenumberNodes();
438 aMeshEditor->RenumberElements();
439 if ( SMESHGUI::automaticUpdate() )
442 switch ( theCommandID ) {
445 aMesh->ExportToMED( aFilename.toLatin1().data(), toCreateGroups, aFormat );
449 aMesh->ExportDAT( aFilename.toLatin1().data() );
453 aMesh->ExportUNV( aFilename.toLatin1().data() );
457 aMesh->ExportSTL( aFilename.toLatin1().data(), aIsASCII_STL );
463 catch (const SALOME::SALOME_Exception& S_ex){
465 SUIT_MessageBox::warning(SMESHGUI::desktop(),
466 QObject::tr("SMESH_WRN_WARNING"),
467 QObject::tr("SMESH_EXPORT_FAILED"));
475 inline void InverseEntityMode(unsigned int& theOutputMode,
476 unsigned int theMode)
478 bool anIsNotPresent = ~theOutputMode & theMode;
480 theOutputMode |= theMode;
482 theOutputMode &= ~theMode;
485 void SetDisplayEntity(int theCommandID){
486 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
487 SALOME_ListIO selected;
489 aSel->selectedObjects( selected );
491 if(selected.Extent() >= 1){
492 SALOME_ListIteratorOfListIO It( selected );
493 for( ; It.More(); It.Next()){
494 Handle(SALOME_InteractiveObject) IObject = It.Value();
495 if(IObject->hasEntry()){
496 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
497 unsigned int aMode = anActor->GetEntityMode();
498 switch(theCommandID){
500 InverseEntityMode(aMode,SMESH_Actor::eEdges);
503 InverseEntityMode(aMode,SMESH_Actor::eFaces);
506 InverseEntityMode(aMode,SMESH_Actor::eVolumes);
509 aMode = SMESH_Actor::eAllEntity;
513 anActor->SetEntityMode(aMode);
521 SALOME_ListIO selected;
522 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
526 LightApp_SelectionMgr* aSel = app->selectionMgr();
527 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
528 if( !aSel || !appStudy )
531 aSel->selectedObjects( selected );
532 if( selected.IsEmpty() )
535 Handle(SALOME_InteractiveObject) anIObject = selected.First();
537 _PTR(Study) aStudy = appStudy->studyDS();
538 _PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
539 SMESH::SMESH_Mesh_var aMainObject = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
540 if( aMainObject->_is_nil() )
543 aMainObject->SetAutoColor( true );
545 QList<SALOMEDS::Color> aReservedColors;
547 SMESH::ListOfGroups aListOfGroups = *aMainObject->GetGroups();
548 for( int i = 0, n = aListOfGroups.length(); i < n; i++ )
550 SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
551 SALOMEDS::Color aCurrentColor = aGroupObject->GetColor();
553 SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors );
554 aGroupObject->SetColor( aColor );
555 aReservedColors.append( aColor );
557 _PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
558 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str()))
560 if( aGroupObject->GetType() == SMESH::NODE )
561 anActor->SetNodeColor( aColor.R, aColor.G, aColor.B );
562 else if( aGroupObject->GetType() == SMESH::EDGE )
563 anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B );
565 anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
569 SMESH::RepaintCurrentView();
572 void DisableAutoColor(){
573 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
574 SALOME_ListIO selected;
576 aSel->selectedObjects( selected );
578 if(selected.Extent()){
579 Handle(SALOME_InteractiveObject) anIObject = selected.First();
580 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
581 if ( !aMesh->_is_nil() ) {
582 aMesh->SetAutoColor( false );
587 void SetDisplayMode(int theCommandID){
588 SALOME_ListIO selected;
589 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
593 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
594 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
595 if( !aSel || !appStudy )
598 _PTR(Study) aStudy = appStudy->studyDS();
600 aSel->selectedObjects( selected );
602 if(selected.Extent() >= 1){
603 switch(theCommandID){
605 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
606 (new SMESHGUI_ClippingDlg( SMESHGUI::GetSMESHGUI() ))->show();
610 SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
611 (new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show();
614 SALOME_ListIteratorOfListIO It( selected );
615 for( ; It.More(); It.Next()){
616 Handle(SALOME_InteractiveObject) IObject = It.Value();
617 if(IObject->hasEntry()){
618 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
619 switch(theCommandID){
621 anActor->SetRepresentation(SMESH_Actor::eEdge);
624 anActor->SetRepresentation(SMESH_Actor::eSurface);
627 if(anActor->IsShrunk())
630 anActor->SetShrink();
633 anActor->SetRepresentation(SMESH_Actor::ePoint);
636 vtkFloatingPointType color[3];
637 anActor->GetSufaceColor(color[0], color[1], color[2]);
638 int c0 = int (color[0] * 255);
639 int c1 = int (color[1] * 255);
640 int c2 = int (color[2] * 255);
641 QColor c(c0, c1, c2);
643 vtkFloatingPointType edgecolor[3];
644 anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
645 c0 = int (edgecolor[0] * 255);
646 c1 = int (edgecolor[1] * 255);
647 c2 = int (edgecolor[2] * 255);
648 QColor e(c0, c1, c2);
650 vtkFloatingPointType backfacecolor[3];
651 anActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
652 c0 = int (backfacecolor[0] * 255);
653 c1 = int (backfacecolor[1] * 255);
654 c2 = int (backfacecolor[2] * 255);
655 QColor b(c0, c1, c2);
657 vtkFloatingPointType nodecolor[3];
658 anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
659 c0 = int (nodecolor[0] * 255);
660 c1 = int (nodecolor[1] * 255);
661 c2 = int (nodecolor[2] * 255);
662 QColor n(c0, c1, c2);
664 int Edgewidth = (int)anActor->GetLineWidth();
667 int intValue = int(anActor->GetNodeSize());
668 vtkFloatingPointType Shrink = anActor->GetShrinkFactor();
670 SMESHGUI_Preferences_ColorDlg *aDlg =
671 new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI() );
672 aDlg->SetColor(1, c);
673 aDlg->SetColor(2, e);
674 aDlg->SetColor(3, n);
675 aDlg->SetColor(4, b);
676 aDlg->SetIntValue(1, Edgewidth);
677 aDlg->SetIntValue(2, intValue);
678 aDlg->SetIntValue(3, int(Shrink*100.));
680 QColor color = aDlg->GetColor(1);
681 QColor edgecolor = aDlg->GetColor(2);
682 QColor nodecolor = aDlg->GetColor(3);
683 QColor backfacecolor = aDlg->GetColor(4);
684 /* actor color and backface color */
685 anActor->SetSufaceColor(vtkFloatingPointType (color.red()) / 255.,
686 vtkFloatingPointType (color.green()) / 255.,
687 vtkFloatingPointType (color.blue()) / 255.);
688 anActor->SetBackSufaceColor(vtkFloatingPointType (backfacecolor.red()) / 255.,
689 vtkFloatingPointType (backfacecolor.green()) / 255.,
690 vtkFloatingPointType (backfacecolor.blue()) / 255.);
693 anActor->SetEdgeColor(vtkFloatingPointType (edgecolor.red()) / 255.,
694 vtkFloatingPointType (edgecolor.green()) / 255.,
695 vtkFloatingPointType (edgecolor.blue()) / 255.);
697 /* Shrink factor and size edges */
698 anActor->SetShrinkFactor(aDlg->GetIntValue(3) / 100.);
699 anActor->SetLineWidth(aDlg->GetIntValue(1));
701 /* Nodes color and size */
702 anActor->SetNodeColor(vtkFloatingPointType (nodecolor.red()) / 255.,
703 vtkFloatingPointType (nodecolor.green()) / 255.,
704 vtkFloatingPointType (nodecolor.blue()) / 255.);
705 anActor->SetNodeSize(aDlg->GetIntValue(2));
707 SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
708 if( !aGroupObject->_is_nil() )
710 SALOMEDS::Color aColor;
711 aColor.R = (float)color.red() / 255.0;
712 aColor.G = (float)color.green() / 255.0;
713 aColor.B = (float)color.blue() / 255.0;
714 aGroupObject->SetColor( aColor );
724 SMESH::RepaintCurrentView();
728 void Control( int theCommandID )
730 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
731 SALOME_ListIO selected;
733 aSel->selectedObjects( selected );
735 if( !selected.IsEmpty() ){
736 Handle(SALOME_InteractiveObject) anIO = selected.First();
739 SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
740 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())){
741 switch ( theCommandID ){
743 aTitle = QObject::tr( "LENGTH_EDGES" );
744 aControl = SMESH_Actor::eLength;
747 aTitle = QObject::tr( "LENGTH2D_EDGES" );
748 aControl = SMESH_Actor::eLength2D;
751 aTitle = QObject::tr( "FREE_EDGES" );
752 aControl = SMESH_Actor::eFreeEdges;
755 aTitle = QObject::tr( "FREE_BORDERS" );
756 aControl = SMESH_Actor::eFreeBorders;
759 aTitle = QObject::tr( "MULTI_BORDERS" );
760 aControl = SMESH_Actor::eMultiConnection;
763 aTitle = QObject::tr( "MULTI2D_BORDERS" );
764 aControl = SMESH_Actor::eMultiConnection2D;
767 aTitle = QObject::tr( "AREA_ELEMENTS" );
768 aControl = SMESH_Actor::eArea;
771 aTitle = QObject::tr( "TAPER_ELEMENTS" );
772 aControl = SMESH_Actor::eTaper;
775 aTitle = QObject::tr( "ASPECTRATIO_ELEMENTS" );
776 aControl = SMESH_Actor::eAspectRatio;
779 aTitle = QObject::tr( "ASPECTRATIO_3D_ELEMENTS" );
780 aControl = SMESH_Actor::eAspectRatio3D;
783 aTitle = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
784 aControl = SMESH_Actor::eMinimumAngle;
787 aTitle = QObject::tr( "WARP_ELEMENTS" );
788 aControl = SMESH_Actor::eWarping;
791 aTitle = QObject::tr( "SKEW_ELEMENTS" );
792 aControl = SMESH_Actor::eSkew;
795 aTitle = QObject::tr( "SMESH_VOLUME" );
796 aControl = SMESH_Actor::eVolume3D;
799 anActor->SetControlMode(aControl);
800 anActor->GetScalarBarActor()->SetTitle(aTitle.toLatin1().data());
801 SMESH::RepaintCurrentView();
808 bool CheckOIType(const Handle(SALOME_InteractiveObject) & theIO,
809 MeshObjectType theType,
810 const QString theInTypeName,
811 QString & theOutTypeName)
813 SMESH_TypeFilter aTypeFilter( theType );
815 if( !theIO.IsNull() )
817 entry = theIO->getEntry();
818 LightApp_DataOwner owner( entry );
819 if ( aTypeFilter.isOk( &owner )) {
820 theOutTypeName = theInTypeName;
828 QString CheckTypeObject(const Handle(SALOME_InteractiveObject) & theIO)
830 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
831 _PTR(SObject) aSObj = aStudy->FindObjectID(theIO->getEntry());
833 _PTR(SComponent) aSComp = aSObj->GetFatherComponent();
834 CORBA::String_var anID = aSComp->GetID().c_str();
835 if (!strcmp(anID.in(),theIO->getEntry()))
841 CheckOIType ( theIO, HYPOTHESIS, "Hypothesis", aTypeName ) ||
842 CheckOIType ( theIO, ALGORITHM, "Algorithm", aTypeName ) ||
843 CheckOIType ( theIO, MESH, "Mesh", aTypeName ) ||
844 CheckOIType ( theIO, SUBMESH, "SubMesh", aTypeName ) ||
845 CheckOIType ( theIO, GROUP, "Group", aTypeName )
853 QString CheckHomogeneousSelection()
855 //SUIT_Study* aStudy = SMESH::GetActiveStudy();
856 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
857 SALOME_ListIO selected;
859 aSel->selectedObjects( selected );
861 QString RefType = CheckTypeObject(selected.First());
862 SALOME_ListIteratorOfListIO It(selected);
863 for ( ; It.More(); It.Next())
865 Handle(SALOME_InteractiveObject) IObject = It.Value();
866 QString Type = CheckTypeObject(IObject);
867 if (Type.compare(RefType) != 0)
868 return "Heterogeneous Selection";
875 void SMESHGUI::OnEditDelete()
877 // VSR 17/11/04: check if all objects selected belong to SMESH component --> start
878 LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
879 SALOME_ListIO selected; aSel->selectedObjects( selected, QString::null, false );
881 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
882 _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
883 _PTR(GenericAttribute) anAttr;
884 _PTR(AttributeIOR) anIOR;
887 QString aParentComponent = QString::null;
888 for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
890 _PTR(SObject) aSO = aStudy->FindObjectID(anIt.Value()->getEntry());
892 // check if object is not reference
893 _PTR(SObject) refobj;
894 if ( !aSO->ReferencedObject( refobj ) )
898 QString cur = anIt.Value()->getComponentDataType();
899 if( aParentComponent.isNull() )
900 aParentComponent = cur;
901 else if( !aParentComponent.isEmpty() && aParentComponent!=cur )
902 aParentComponent = "";
905 if ( objectCount == 0 )
906 return; // No Valid Objects Selected
908 if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() ) {
909 SUIT_MessageBox::warning( SMESHGUI::desktop(),
910 QObject::tr("ERR_ERROR"),
911 QObject::tr("NON_SMESH_OBJECTS_SELECTED").arg( SMESHGUI::GetSMESHGUI()->moduleName() ) );
914 // VSR 17/11/04: check if all objects selected belong to SMESH component <-- finish
915 if (SUIT_MessageBox::warning
916 (SMESHGUI::desktop(),
917 QObject::tr("SMESH_WRN_WARNING"),
918 QObject::tr("SMESH_REALLY_DELETE"),
919 SUIT_MessageBox::Yes | SUIT_MessageBox::No,
920 SUIT_MessageBox::Yes) != SUIT_MessageBox::Yes)
923 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
924 SUIT_ViewManager* vm = anApp->activeViewManager();
925 int nbSf = vm->getViewsCount();
927 SALOME_ListIteratorOfListIO It(selected);
929 aStudyBuilder->NewCommand(); // There is a transaction
930 for( ; It.More(); It.Next()){ // loop on selected IO's
931 Handle(SALOME_InteractiveObject) IObject = It.Value();
932 if(IObject->hasEntry()) {
933 _PTR(SObject) aSO = aStudy->FindObjectID(IObject->getEntry());
935 // disable removal of "SMESH" component object
936 if(aSO->FindAttribute(anAttr, "AttributeIOR")){
938 if ( engineIOR() == anIOR->Value().c_str() )
942 _PTR(SObject) refobj;
943 if ( aSO && aSO->ReferencedObject( refobj ) )
944 continue; // skip references
946 // put the whole hierarchy of sub-objects of the selected SO into a list and
947 // then treat them all starting from the deepest objects (at list back)
949 std::list< _PTR(SObject) > listSO;
950 listSO.push_back( aSO );
951 std::list< _PTR(SObject) >::iterator itSO = listSO.begin();
952 for ( ; itSO != listSO.end(); ++itSO ) {
953 _PTR(ChildIterator) it = aStudy->NewChildIterator( *itSO );
954 for (it->InitEx(false); it->More(); it->Next())
955 listSO.push_back( it->Value() );
958 // treat SO's in the list starting from the back
960 std::list< _PTR(SObject) >::reverse_iterator ritSO = listSO.rbegin();
961 for ( ; ritSO != listSO.rend(); ++ritSO ) {
962 _PTR(SObject) SO = *ritSO;
964 std::string anEntry = SO->GetID();
966 /** Erase graphical object **/
967 if(SO->FindAttribute(anAttr, "AttributeIOR")){
968 QVector<SUIT_ViewWindow*> aViews = vm->getViews();
969 for(int i = 0; i < nbSf; i++){
970 SUIT_ViewWindow *sf = aViews[i];
971 if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
972 SMESH::RemoveActor(sf,anActor);
977 /** Remove an object from data structures **/
978 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO ));
979 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( SO ));
980 if ( !aGroup->_is_nil() ) { // DELETE GROUP
981 SMESH::SMESH_Mesh_var aMesh = aGroup->GetMesh();
982 aMesh->RemoveGroup( aGroup );
984 else if ( !aSubMesh->_is_nil() ) { // DELETE SUBMESH
985 SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
986 aMesh->RemoveSubMesh( aSubMesh );
988 _PTR(SObject) aMeshSO = SMESH::FindSObject(aMesh);
990 SMESH::ModifiedMesh(aMeshSO, false, aMesh->NbNodes()==0);
993 IObject = new SALOME_InteractiveObject
994 ( anEntry.c_str(), engineIOR().toLatin1().data(), SO->GetName().c_str() );
995 QString objType = CheckTypeObject(IObject);
996 if ( objType == "Hypothesis" || objType == "Algorithm" ) {// DELETE HYPOTHESIS
997 SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
998 aStudyBuilder->RemoveObjectWithChildren( SO );
1000 else {// default action: remove SObject from the study
1001 // san - it's no use opening a transaction here until UNDO/REDO is provided in SMESH
1002 //SUIT_Operation *op = new SALOMEGUI_ImportOperation(myActiveStudy);
1004 aStudyBuilder->RemoveObjectWithChildren( SO );
1008 } /* listSO back loop */
1009 } /* IObject->hasEntry() */
1011 aStudyBuilder->CommitCommand();
1013 /* Clear any previous selection */
1015 aSel->setSelectedObjects( l1 );
1017 SMESHGUI::GetSMESHGUI()->updateObjBrowser();
1022 SMESHGUI_EXPORT CAM_Module* createModule()
1024 return new SMESHGUI();
1028 SMESH::SMESH_Gen_var SMESHGUI::myComponentSMESH = SMESH::SMESH_Gen::_nil();
1030 //=============================================================================
1034 //=============================================================================
1035 SMESHGUI::SMESHGUI() :
1036 SalomeApp_Module( "SMESH" )
1038 if ( CORBA::is_nil( myComponentSMESH ) )
1040 CORBA::Boolean anIsEmbeddedMode;
1041 myComponentSMESH = SMESH_Client::GetSMESHGen(getApp()->orb(),anIsEmbeddedMode);
1044 myActiveDialogBox = 0;
1045 myFilterLibraryDlg = 0;
1049 SMESH::GetFilterManager();
1050 SMESH::GetPattern();
1052 /* load resources for all available meshers */
1053 SMESH::InitAvailableHypotheses();
1056 //=============================================================================
1060 //=============================================================================
1061 SMESHGUI::~SMESHGUI()
1063 SMESH::GetFilterManager()->Destroy();
1064 SMESH::GetFilterManager() = SMESH::FilterManager::_nil();
1067 //=============================================================================
1071 //=============================================================================
1072 LightApp_SelectionMgr* SMESHGUI::selectionMgr()
1074 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
1076 return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
1081 bool SMESHGUI::automaticUpdate()
1083 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1087 return resMgr->booleanValue( "SMESH", "auto_update", false );
1090 //=============================================================================
1094 //=============================================================================
1095 SUIT_ResourceMgr* SMESHGUI::resourceMgr()
1097 return dynamic_cast<SUIT_ResourceMgr*>( SUIT_Session::session()->resourceMgr() );
1100 //=============================================================================
1104 //=============================================================================
1105 SMESHGUI* SMESHGUI::GetSMESHGUI()
1107 SMESHGUI* smeshMod = 0;
1108 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
1111 CAM_Module* module = app->module( "Mesh" );
1112 smeshMod = dynamic_cast<SMESHGUI*>( module );
1115 if ( smeshMod && smeshMod->application() && smeshMod->application()->activeStudy() )
1117 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( smeshMod->application()->activeStudy() );
1120 _PTR(Study) aStudy = study->studyDS();
1122 GetSMESHGen()->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() );
1131 Standard_EXPORT SMESHGUI* GetComponentGUI()
1133 return SMESHGUI::GetSMESHGUI();
1137 //=============================================================================
1141 //=============================================================================
1142 void SMESHGUI::SetState(int aState)
1147 //=============================================================================
1151 //=============================================================================
1152 void SMESHGUI::ResetState()
1157 //=============================================================================
1161 //=============================================================================
1162 void SMESHGUI::EmitSignalDeactivateDialog()
1164 emit SignalDeactivateActiveDialog();
1167 //=============================================================================
1171 //=============================================================================
1172 void SMESHGUI::EmitSignalStudyFrameChanged()
1174 emit SignalStudyFrameChanged();
1177 //=============================================================================
1181 //=============================================================================
1182 void SMESHGUI::EmitSignalCloseAllDialogs()
1184 emit SignalCloseAllDialogs();
1187 //=============================================================================
1191 //=============================================================================
1192 QDialog *SMESHGUI::GetActiveDialogBox()
1194 return myActiveDialogBox;
1197 //=============================================================================
1201 //=============================================================================
1202 void SMESHGUI::SetActiveDialogBox(QDialog * aDlg)
1204 myActiveDialogBox = (QDialog *) aDlg;
1208 //=============================================================================
1212 //=============================================================================
1213 SUIT_Desktop* SMESHGUI::desktop()
1215 SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
1217 return app->desktop();
1222 //=============================================================================
1226 //=============================================================================
1227 SalomeApp_Study* SMESHGUI::activeStudy()
1229 SUIT_Application* app = SUIT_Session::session()->activeApplication();
1231 return dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
1236 //=============================================================================
1240 //=============================================================================
1241 bool SMESHGUI::DefineDlgPosition(QWidget * aDlg, int &x, int &y)
1243 /* Here the position is on the bottom right corner - 10 */
1244 // aDlg->resize(QSize().expandedTo(aDlg->minimumSizeHint()));
1246 SUIT_Desktop *PP = desktop();
1247 x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10);
1248 y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10);
1252 //=============================================================================
1256 //=============================================================================
1257 static int isStudyLocked(_PTR(Study) theStudy){
1258 return theStudy->GetProperties()->IsLocked();
1261 static bool checkLock(_PTR(Study) theStudy) {
1262 if (isStudyLocked(theStudy)) {
1263 SUIT_MessageBox::warning( SMESHGUI::desktop(),
1264 QObject::tr("WRN_WARNING"),
1265 QObject::tr("WRN_STUDY_LOCKED") );
1271 //=======================================================================
1272 //function : CheckActiveStudyLocked
1274 //=======================================================================
1276 bool SMESHGUI::isActiveStudyLocked()
1278 _PTR(Study) aStudy = activeStudy()->studyDS();
1279 return checkLock( aStudy );
1282 //=============================================================================
1286 //=============================================================================
1287 bool SMESHGUI::OnGUIEvent( int theCommandID )
1289 SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( application() );
1293 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
1294 SUIT_ResourceMgr* mgr = resourceMgr();
1298 if (CORBA::is_nil(GetSMESHGen()->GetCurrentStudy())) {
1299 GetSMESHGen()->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
1302 SUIT_ViewWindow* view = application()->desktop()->activeWindow();
1303 SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
1305 //QAction* act = action( theCommandID );
1307 switch (theCommandID) {
1309 if(checkLock(aStudy)) break;
1317 if(checkLock(aStudy)) break;
1318 ::ImportMeshesFromFile(GetSMESHGen(),theCommandID);
1322 case 150: //MED FILE INFORMATION
1324 SALOME_ListIO selected;
1325 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1327 aSel->selectedObjects( selected );
1328 if( selected.Extent() )
1330 Handle(SALOME_InteractiveObject) anIObject = selected.First();
1331 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
1332 if ( !aMesh->_is_nil() )
1334 SMESHGUI_FileInfoDlg dlg( desktop(), aMesh->GetMEDFileInfo() );
1341 case 122: // EXPORT MED
1350 ::ExportMeshToFile(theCommandID);
1354 case 200: // SCALAR BAR
1356 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1357 SALOME_ListIO selected;
1359 aSel->selectedObjects( selected );
1361 if( selected.Extent() ) {
1362 Handle(SALOME_InteractiveObject) anIO = selected.First();
1363 if( anIO->hasEntry() ) {
1364 if( SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() ) ) {
1365 anActor->SetControlMode( SMESH_Actor::eNone );
1373 SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( this );
1383 ::DisableAutoColor();
1386 case 1134: // Clipping
1387 case 1133: // Tranparency
1388 case 1132: // Colors / Size
1395 ::SetDisplayMode(theCommandID);
1401 case 219: // Volumes
1402 case 220: // All Entity
1403 ::SetDisplayEntity(theCommandID);
1408 if(checkLock(aStudy)) break;
1410 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
1413 SMESH::UpdateView();
1415 catch (std::bad_alloc) { // PAL16774 (Crash after display of many groups)
1416 SMESH::OnVisuException();
1418 catch (...) { // PAL16774 (Crash after display of many groups)
1419 SMESH::OnVisuException();
1423 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1424 aSel->selectedObjects( l );
1425 aSel->setSelectedObjects( l );
1430 case 301: // DISPLAY
1431 case 302: // DISPLAY ONLY
1433 SMESH::EDisplaing anAction;
1434 switch (theCommandID) {
1435 case 300: anAction = SMESH::eErase; break;
1436 case 301: anAction = SMESH::eDisplay; break;
1437 case 302: anAction = SMESH::eDisplayOnly; break;
1440 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1441 SALOME_ListIO sel_objects, to_process;
1443 aSel->selectedObjects( sel_objects );
1445 if( theCommandID==302 )
1446 startOperation( myEraseAll );
1448 extractContainers( sel_objects, to_process );
1451 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
1455 SALOME_ListIteratorOfListIO It( to_process );
1456 for ( ; It.More(); It.Next()) {
1457 Handle(SALOME_InteractiveObject) IOS = It.Value();
1458 if (IOS->hasEntry()) {
1459 if (!SMESH::UpdateView(anAction, IOS->getEntry()))
1460 break; // PAL16774 (Crash after display of many groups)
1461 if (anAction == SMESH::eDisplayOnly)
1462 anAction = SMESH::eDisplay;
1467 // PAL13338 + PAL15161 -->
1468 if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy))
1469 SMESH::UpdateView();
1470 // PAL13338 + PAL15161 <--
1472 catch (...) { // PAL16774 (Crash after display of many groups)
1473 SMESH::OnVisuException();
1476 if (anAction == SMESH::eErase) {
1478 aSel->setSelectedObjects( l1 );
1481 aSel->setSelectedObjects( to_process );
1488 if(checkLock(aStudy)) break;
1491 EmitSignalDeactivateDialog();
1493 ( new SMESHGUI_NodesDlg( this ) )->show();
1496 SUIT_MessageBox::warning(desktop(),
1497 tr("SMESH_WRN_WARNING"),
1498 tr("SMESH_WRN_VIEWER_VTK"));
1503 case 2151: // FILTER
1507 EmitSignalDeactivateDialog();
1508 ( new SMESHGUI_FilterDlg( this, SMESH::EDGE ) )->show();
1513 case 406: // MOVE NODE
1517 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
1518 tr( "NOT_A_VTK_VIEWER" ) );
1522 if(checkLock(aStudy)) break;
1523 ( new SMESHGUI_MoveNodesDlg( this ) )->show();
1527 case 701: // COMPUTE MESH
1529 if (checkLock(aStudy)) break;
1531 startOperation( 701 );
1535 case 702: // Create mesh
1536 startOperation( 702 );
1538 case 703: // Create sub-mesh
1539 startOperation( 703 );
1541 case 704: // Edit mesh/sub-mesh
1542 startOperation( 704 );
1544 case 710: // Build compound mesh
1546 if (checkLock(aStudy)) break;
1547 EmitSignalDeactivateDialog();
1548 ( new SMESHGUI_BuildCompoundDlg( this ) )->show();
1552 case 407: // DIAGONAL INVERSION
1553 case 408: // Delete diagonal
1557 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
1558 tr( "NOT_A_VTK_VIEWER" ) );
1562 if ( checkLock( aStudy ) )
1565 /*Standard_Boolean aRes;
1566 SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
1567 if ( aMesh->_is_nil() )
1569 SUIT_MessageBox::warning(GetDesktop(), tr( "SMESH_WRN_WARNING" ),
1570 tr( "SMESH_BAD_SELECTION" ) );
1574 EmitSignalDeactivateDialog();
1575 if ( theCommandID == 407 )
1576 ( new SMESHGUI_TrianglesInversionDlg( this ) )->show();
1578 ( new SMESHGUI_UnionOfTwoTrianglesDlg( this ) )->show();
1581 case 409: // Change orientation
1582 case 410: // Union of triangles
1583 case 411: // Cutting of quadrangles
1587 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
1588 tr( "NOT_A_VTK_VIEWER" ) );
1592 if ( checkLock( aStudy ) )
1595 EmitSignalDeactivateDialog();
1596 SMESHGUI_MultiEditDlg* aDlg = NULL;
1597 if ( theCommandID == 409 )
1598 aDlg = new SMESHGUI_ChangeOrientationDlg(this);
1599 else if ( theCommandID == 410 )
1600 aDlg = new SMESHGUI_UnionOfTrianglesDlg(this);
1602 aDlg = new SMESHGUI_CuttingOfQuadsDlg(this);
1607 case 412: // Smoothing
1609 if(checkLock(aStudy)) break;
1611 EmitSignalDeactivateDialog();
1612 ( new SMESHGUI_SmoothingDlg( this ) )->show();
1615 SUIT_MessageBox::warning(desktop(),
1616 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
1620 case 413: // Extrusion
1622 if (checkLock(aStudy)) break;
1624 EmitSignalDeactivateDialog();
1625 ( new SMESHGUI_ExtrusionDlg ( this ) )->show();
1627 SUIT_MessageBox::warning(desktop(),
1628 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
1632 case 414: // Revolution
1634 if(checkLock(aStudy)) break;
1636 EmitSignalDeactivateDialog();
1637 ( new SMESHGUI_RevolutionDlg( this ) )->show();
1640 SUIT_MessageBox::warning(desktop(),
1641 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
1645 case 415: // Pattern mapping
1647 if ( checkLock( aStudy ) )
1651 EmitSignalDeactivateDialog();
1652 ( new SMESHGUI_MeshPatternDlg( this ) )->show();
1655 SUIT_MessageBox::warning(desktop(),
1656 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
1660 case 416: // Extrusion along a path
1662 if (checkLock(aStudy)) break;
1664 EmitSignalDeactivateDialog();
1665 ( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show();
1667 SUIT_MessageBox::warning(desktop(),
1668 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
1672 case 417: // Convert mesh to quadratic
1674 startOperation( 417 );
1675 /* if (checkLock(aStudy)) break;
1677 EmitSignalDeactivateDialog();
1678 new SMESHGUI_ConvToQuadDlg();
1680 SUIT_MessageBox::warning(desktop(),
1681 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
1685 case 801: // CREATE GROUP
1689 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
1690 tr( "NOT_A_VTK_VIEWER" ) );
1694 if(checkLock(aStudy)) break;
1695 EmitSignalDeactivateDialog();
1696 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
1698 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1699 SALOME_ListIO selected;
1701 aSel->selectedObjects( selected );
1703 int nbSel = selected.Extent();
1705 // check if mesh is selected
1706 aMesh = SMESH::GetMeshByIO( selected.First() );
1708 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aMesh);
1713 case 802: // CONSTRUCT GROUP
1717 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
1718 tr( "NOT_A_VTK_VIEWER" ) );
1722 if(checkLock(aStudy)) break;
1723 EmitSignalDeactivateDialog();
1725 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1726 SALOME_ListIO selected;
1728 aSel->selectedObjects( selected );
1730 int nbSel = selected.Extent();
1732 // check if submesh is selected
1733 Handle(SALOME_InteractiveObject) IObject = selected.First();
1734 if (IObject->hasEntry()) {
1735 _PTR(SObject) aSObj = aStudy->FindObjectID(IObject->getEntry());
1737 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( SMESH::SObjectToObject( aSObj ) );
1738 if (!aSubMesh->_is_nil()) {
1740 SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
1741 // get submesh elements list by types
1742 SMESH::long_array_var aNodes = aSubMesh->GetElementsByType(SMESH::NODE);
1743 SMESH::long_array_var aEdges = aSubMesh->GetElementsByType(SMESH::EDGE);
1744 SMESH::long_array_var aFaces = aSubMesh->GetElementsByType(SMESH::FACE);
1745 SMESH::long_array_var aVolumes = aSubMesh->GetElementsByType(SMESH::VOLUME);
1746 // create group for each type o elements
1747 QString aName = IObject->getName();
1748 if (aNodes->length() > 0) {
1749 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::NODE, aName + "_Nodes");
1750 aGroup->Add(aNodes.inout());
1752 if (aEdges->length() > 0) {
1753 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::EDGE, aName + "_Edges");
1754 aGroup->Add(aEdges.inout());
1756 if (aFaces->length() > 0) {
1757 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::FACE, aName + "_Faces");
1758 aGroup->Add(aFaces.inout());
1760 if (aVolumes->length() > 0) {
1761 SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::VOLUME, aName + "_Volumes");
1762 aGroup->Add(aVolumes.inout());
1767 catch(const SALOME::SALOME_Exception & S_ex){
1768 SalomeApp_Tools::QtCatchCorbaException(S_ex);
1775 SUIT_MessageBox::warning(desktop(),
1776 tr("SMESH_WRN_WARNING"),
1777 tr("SMESH_WRN_NO_AVAILABLE_DATA"));
1782 case 803: // EDIT GROUP
1786 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
1787 tr( "NOT_A_VTK_VIEWER" ) );
1791 if(checkLock(aStudy)) break;
1792 EmitSignalDeactivateDialog();
1794 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1795 SALOME_ListIO selected;
1797 aSel->selectedObjects( selected );
1799 SALOME_ListIteratorOfListIO It (selected);
1800 int nbSelectedGroups = 0;
1801 for ( ; It.More(); It.Next() )
1803 SMESH::SMESH_GroupBase_var aGroup =
1804 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(It.Value());
1805 if (!aGroup->_is_nil()) {
1807 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, aGroup);
1811 if (nbSelectedGroups == 0)
1813 SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, SMESH::SMESH_GroupBase::_nil());
1819 case 804: // Add elements to group
1821 if(checkLock(aStudy)) break;
1822 if (myState == 800) {
1823 SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
1824 if (aDlg) aDlg->onAdd();
1829 case 805: // Remove elements from group
1831 if(checkLock(aStudy)) break;
1832 if (myState == 800) {
1833 SMESHGUI_GroupDlg *aDlg = (SMESHGUI_GroupDlg*) myActiveDialogBox;
1834 if (aDlg) aDlg->onRemove();
1839 case 810: // Union Groups
1840 case 811: // Intersect groups
1841 case 812: // Cut groups
1845 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
1846 tr( "NOT_A_VTK_VIEWER" ) );
1850 if ( checkLock( aStudy ) )
1853 EmitSignalDeactivateDialog();
1856 if ( theCommandID == 810 ) aMode = SMESHGUI_GroupOpDlg::UNION;
1857 else if ( theCommandID == 811 ) aMode = SMESHGUI_GroupOpDlg::INTERSECT;
1858 else aMode = SMESHGUI_GroupOpDlg::CUT;
1860 ( new SMESHGUI_GroupOpDlg( this, aMode ) )->show();
1864 case 813: // Delete groups with their contents
1868 SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ),
1869 tr( "NOT_A_VTK_VIEWER" ) );
1873 if ( checkLock( aStudy ) )
1876 EmitSignalDeactivateDialog();
1878 ( new SMESHGUI_DeleteGroupDlg( this ) )->show();
1882 case 900: // MESH INFOS
1884 EmitSignalDeactivateDialog();
1885 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1886 SALOME_ListIO selected;
1888 aSel->selectedObjects( selected );
1890 if ( selected.Extent() > 1 ) { // a dlg for each IO
1892 SALOME_ListIteratorOfListIO It (selected);
1893 for ( ; It.More(); It.Next() ) {
1894 IOs.Clear(); IOs.Append( It.Value() );
1895 aSel->setSelectedObjects( IOs );
1896 ( new SMESHGUI_MeshInfosDlg( this ) )->show();
1898 // restore selection
1899 aSel->setSelectedObjects( selected );
1902 ( new SMESHGUI_MeshInfosDlg( this ) )->show();
1906 case 902: // STANDARD MESH INFOS
1908 EmitSignalDeactivateDialog();
1909 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1910 SALOME_ListIO selected;
1912 aSel->selectedObjects( selected );
1914 if ( selected.Extent() > 1 ) { // a dlg for each IO
1916 SALOME_ListIteratorOfListIO It (selected);
1917 for ( ; It.More(); It.Next() ) {
1919 IOs.Append( It.Value() );
1920 aSel->setSelectedObjects( IOs );
1921 ( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
1923 // restore selection
1924 aSel->setSelectedObjects( selected );
1927 ( new SMESHGUI_StandardMeshInfosDlg( this ) )->show();
1931 case 903: // WHAT IS
1933 EmitSignalDeactivateDialog();
1934 ( new SMESHGUI_WhatIsDlg( this ) )->show();
1938 case 1100: // EDIT HYPOTHESIS
1940 if(checkLock(aStudy)) break;
1942 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1943 SALOME_ListIO selected;
1945 aSel->selectedObjects( selected );
1947 int nbSel = selected.Extent();
1950 Handle(SALOME_InteractiveObject) anIObject = selected.First();
1951 SMESH::SMESH_Hypothesis_var aHypothesis = SMESH::IObjectToInterface<SMESH::SMESH_Hypothesis>(anIObject);
1953 /* Look for all mesh objects that have this hypothesis affected in order to flag as ModifiedMesh */
1954 /* At end below '...->updateObjBrowser(true)' will change icon of mesh objects */
1955 /* Warning : however by internal mechanism all subMeshes icons are changed ! */
1956 if ( !aHypothesis->_is_nil() )
1958 SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
1960 aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop() );
1967 updateObjBrowser( true );
1971 case 1101: // RENAME
1973 if ( checkLock( aStudy ) )
1976 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
1977 SALOME_ListIO selected;
1979 aSel->selectedObjects( selected );
1981 bool isAny = false; // iss there any appropriate object selected
1983 SALOME_ListIteratorOfListIO It( selected );
1984 for ( ; It.More(); It.Next() )
1986 Handle(SALOME_InteractiveObject) IObject = It.Value();
1987 _PTR(SObject) obj = aStudy->FindObjectID( IObject->getEntry() );
1988 _PTR(GenericAttribute) anAttr;
1989 _PTR(AttributeName) aName;
1992 if ( obj->FindAttribute(anAttr, "AttributeName") )
1995 QString newName = QString(aName->Value().c_str());
1997 // check type to prevent renaming of inappropriate objects
1998 int aType = SMESHGUI_Selection::type(IObject->getEntry(), aStudy);
1999 if (aType == MESH || aType == GROUP ||
2000 aType == SUBMESH || aType == SUBMESH_COMPOUND ||
2001 aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||
2002 aType == SUBMESH_EDGE || aType == SUBMESH_VERTEX ||
2003 aType == HYPOTHESIS || aType == ALGORITHM)
2006 newName = LightApp_NameDlg::getName(desktop(), newName);
2007 if ( !newName.isEmpty() )
2009 //old source: aStudy->renameIObject( IObject, newName );
2010 aName->SetValue( newName.toLatin1().constData() );
2012 // if current object is group update group's name
2013 SMESH::SMESH_GroupBase_var aGroup =
2014 SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
2015 if (!aGroup->_is_nil() )
2016 aGroup->SetName( newName.toLatin1().constData() );
2026 SUIT_MessageBox::warning(desktop(),
2027 QObject::tr("SMESH_WRN_WARNING"),
2028 QObject::tr("SMESH_WRN_NO_APPROPRIATE_SELECTION"));
2033 case 1102: // REMOVE HYPOTHESIS / ALGORITHMS
2035 if(checkLock(aStudy)) break;
2036 SUIT_OverrideCursor wc;
2038 LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
2039 SALOME_ListIO selected;
2041 aSel->selectedObjects( selected, QString::null, false );
2043 SALOME_ListIteratorOfListIO It(selected);
2044 for (int i = 0; It.More(); It.Next(), i++) {
2045 Handle(SALOME_InteractiveObject) IObject = It.Value();
2046 SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
2049 aSel->setSelectedObjects( l1 );
2054 case 401: // GEOM::EDGE
2055 case 4021: // TRIANGLE
2057 case 4023: // POLYGON
2061 if(checkLock(aStudy)) break;
2063 EmitSignalDeactivateDialog();
2064 SMDSAbs_ElementType type = SMDSAbs_Edge;
2066 switch (theCommandID) {
2067 case 4021: // TRIANGLE
2068 type = SMDSAbs_Face; nbNodes = 3; break;
2070 type = SMDSAbs_Face; nbNodes = 4; break;
2072 type = SMDSAbs_Volume; nbNodes = 4; break;
2073 case 4023: // POLYGON
2074 type = SMDSAbs_Face; nbNodes = 5; break; // 5 - identificator for POLYGON
2076 type = SMDSAbs_Volume; nbNodes = 8; break;
2077 case 4033: // POLYHEDRE
2078 type = SMDSAbs_Volume; nbNodes = 9; break; // 9 - identificator for POLYHEDRE
2081 ( new SMESHGUI_AddMeshElementDlg( this, type, nbNodes ) )->show();
2084 SUIT_MessageBox::warning(desktop(),
2085 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2089 case 4033: // POLYHEDRON
2091 if(checkLock(aStudy)) break;
2093 EmitSignalDeactivateDialog();
2094 ( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show();
2097 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2098 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2102 case 4034: // QUADRATIC EDGE
2103 case 4035: // QUADRATIC TRIANGLE
2104 case 4036: // QUADRATIC QUADRANGLE
2105 case 4037: // QUADRATIC TETRAHEDRON
2106 case 4038: // QUADRATIC PYRAMID
2107 case 4039: // QUADRATIC PENTAHEDRON
2108 case 4040: // QUADRATIC HEXAHEDRON
2110 if(checkLock(aStudy)) break;
2112 EmitSignalDeactivateDialog();
2115 switch (theCommandID) {
2117 type = QUAD_EDGE; break;
2119 type = QUAD_TRIANGLE; break;
2121 type = QUAD_QUADRANGLE; break;
2123 type = QUAD_TETRAHEDRON; break;
2125 type = QUAD_PYRAMID; break;
2127 type = QUAD_PENTAHEDRON; break;
2129 type = QUAD_HEXAHEDRON;
2133 ( new SMESHGUI_AddQuadraticElementDlg( this, type ) )->show();
2136 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2137 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2141 case 4041: // REMOVES NODES
2143 if(checkLock(aStudy)) break;
2145 EmitSignalDeactivateDialog();
2146 ( new SMESHGUI_RemoveNodesDlg( this ) )->show();
2149 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2150 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2154 case 4042: // REMOVES ELEMENTS
2156 if(checkLock(aStudy)) break;
2158 EmitSignalDeactivateDialog();
2159 ( new SMESHGUI_RemoveElementsDlg( this ) )->show();
2163 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2164 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2168 case 4043: { // CLEAR_MESH
2170 if(checkLock(aStudy)) break;
2172 SALOME_ListIO selected;
2173 if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
2174 aSel->selectedObjects( selected );
2176 SUIT_OverrideCursor wc;
2177 SALOME_ListIteratorOfListIO It (selected);
2178 for ( ; It.More(); It.Next() )
2180 Handle(SALOME_InteractiveObject) IOS = It.Value();
2181 SMESH::SMESH_Mesh_var aMesh =
2182 SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IOS);
2183 if ( aMesh->_is_nil()) continue;
2185 SMESH::UpdateView(SMESH::eErase, IOS->getEntry());
2187 _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
2188 SMESH::ModifiedMesh( aMeshSObj, false, true);
2189 // hide groups and submeshes
2190 _PTR(ChildIterator) anIter =
2191 SMESH::GetActiveStudyDocument()->NewChildIterator( aMeshSObj );
2192 for ( anIter->InitEx(true); anIter->More(); anIter->Next() )
2194 _PTR(SObject) so = anIter->Value();
2195 SMESH::UpdateView(SMESH::eErase, so->GetID().c_str());
2198 catch (const SALOME::SALOME_Exception& S_ex){
2200 SalomeApp_Tools::QtCatchCorbaException(S_ex);
2204 SMESH::UpdateView();
2208 case 4051: // RENUMBERING NODES
2210 if(checkLock(aStudy)) break;
2212 EmitSignalDeactivateDialog();
2213 ( new SMESHGUI_RenumberingDlg( this, 0 ) )->show();
2217 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2218 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2222 case 4052: // RENUMBERING ELEMENTS
2224 if(checkLock(aStudy)) break;
2226 EmitSignalDeactivateDialog();
2227 ( new SMESHGUI_RenumberingDlg( this, 1 ) )->show();
2231 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2232 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2236 case 4061: // TRANSLATION
2238 if(checkLock(aStudy)) break;
2240 EmitSignalDeactivateDialog();
2241 ( new SMESHGUI_TranslationDlg( this ) )->show();
2244 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2245 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2249 case 4062: // ROTATION
2251 if(checkLock(aStudy)) break;
2253 EmitSignalDeactivateDialog();
2254 ( new SMESHGUI_RotationDlg( this ) )->show();
2257 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2258 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2262 case 4063: // SYMMETRY
2264 if(checkLock(aStudy)) break;
2266 EmitSignalDeactivateDialog();
2267 ( new SMESHGUI_SymmetryDlg( this ) )->show();
2270 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2271 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2275 case 4064: // SEWING
2277 if(checkLock(aStudy)) break;
2279 EmitSignalDeactivateDialog();
2280 ( new SMESHGUI_SewingDlg( this ) )->show();
2283 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2284 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2288 case 4065: // MERGE NODES
2290 if(checkLock(aStudy)) break;
2292 EmitSignalDeactivateDialog();
2293 ( new SMESHGUI_EditMeshDlg( this, 0 ) )->show();
2296 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2297 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2301 case 4066: // MERGE EQUAL ELEMENTS
2303 if (checkLock(aStudy)) break;
2305 EmitSignalDeactivateDialog();
2306 ( new SMESHGUI_EditMeshDlg( this, 1 ) )->show();
2308 SUIT_MessageBox::warning(SMESHGUI::desktop(),
2309 tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"));
2314 case 4067: // MAKE MESH PASS THROUGH POINT
2315 startOperation( 4067 );
2318 case 5105: // Library of selection filters
2320 static QList<int> aTypes;
2321 if ( aTypes.isEmpty() )
2323 aTypes.append( SMESH::NODE );
2324 aTypes.append( SMESH::EDGE );
2325 aTypes.append( SMESH::FACE );
2326 aTypes.append( SMESH::VOLUME );
2328 if (!myFilterLibraryDlg)
2329 myFilterLibraryDlg = new SMESHGUI_FilterLibraryDlg( this, SMESH::GetDesktop( this ), aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
2330 else if (myFilterLibraryDlg->isHidden())
2331 myFilterLibraryDlg->Init( aTypes, SMESHGUI_FilterLibraryDlg::EDIT );
2332 myFilterLibraryDlg->raise();
2336 case 6017: // CONTROLS
2352 LightApp_SelectionMgr* mgr = selectionMgr();
2353 SALOME_ListIO selected; mgr->selectedObjects( selected );
2355 if ( selected.Extent() == 1 && selected.First()->hasEntry() ) {
2356 _PTR(SObject) SO = aStudy->FindObjectID( selected.First()->getEntry() );
2358 CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
2359 SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
2360 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
2361 SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
2362 if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
2363 ::Control( theCommandID );
2368 SUIT_MessageBox::warning(desktop(),
2369 tr( "SMESH_WRN_WARNING" ),
2370 tr( "SMESH_BAD_SELECTION" ) );
2374 SUIT_MessageBox::warning(desktop(),
2375 tr( "SMESH_WRN_WARNING" ),
2376 tr( "NOT_A_VTK_VIEWER" ) );
2381 LightApp_SelectionMgr* mgr = selectionMgr();
2382 SALOME_ListIO selected; mgr->selectedObjects( selected );
2384 SALOME_ListIteratorOfListIO it(selected);
2385 for( ; it.More(); it.Next()) {
2386 Handle(SALOME_InteractiveObject) anIObject = it.Value();
2387 if(anIObject->hasEntry()) {
2388 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
2389 anActor->SetPointsLabeled( !anActor->GetPointsLabeled() );
2397 LightApp_SelectionMgr* mgr = selectionMgr();
2398 SALOME_ListIO selected; mgr->selectedObjects( selected );
2400 if (selected.Extent() == 1) {
2401 Handle(SALOME_InteractiveObject) anIObject = selected.First();
2402 if(anIObject->hasEntry())
2403 if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIObject->getEntry())){
2404 anActor->SetCellsLabeled( !anActor->GetCellsLabeled() );
2411 anApp->updateActions(); //SRN: To update a Save button in the toolbar
2412 //updateObjBrowser();
2416 //=============================================================================
2420 //=============================================================================
2421 bool SMESHGUI::OnMousePress( QMouseEvent * pe, SUIT_ViewWindow * wnd )
2426 //=============================================================================
2430 //=============================================================================
2431 bool SMESHGUI::OnMouseMove( QMouseEvent * pe, SUIT_ViewWindow * wnd )
2436 //=============================================================================
2440 //=============================================================================
2441 bool SMESHGUI::OnKeyPress( QKeyEvent * pe, SUIT_ViewWindow * wnd )
2446 //=============================================================================
2447 /*! Method: BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO)
2448 * Purpose: ensures that the actor for the given <theIO> exists in the active VTK view
2450 //=============================================================================
2451 void SMESHGUI::BuildPresentation( const Handle(SALOME_InteractiveObject) & theIO,
2452 SUIT_ViewWindow* wnd )
2454 if(theIO->hasEntry()){
2455 //SUIT_ViewWindow* wnd = SMESH::GetActiveWindow();
2456 SMESH::UpdateView(wnd,SMESH::eDisplay,theIO->getEntry());
2460 //=======================================================================
2461 // function : createSMESHAction
2463 //=======================================================================
2464 void SMESHGUI::createSMESHAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle )
2467 QWidget* parent = application()->desktop();
2468 SUIT_ResourceMgr* resMgr = resourceMgr();
2470 if ( !icon_id.isEmpty() )
2471 pix = resMgr->loadPixmap( "SMESH", tr( icon_id.toLatin1().data() ) );
2473 pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data() ), false );
2474 if ( !pix.isNull() )
2475 icon = QIcon( pix );
2477 QString tooltip = tr( QString( "TOP_%1" ).arg( po_id ).toLatin1().data() ),
2478 menu = tr( QString( "MEN_%1" ).arg( po_id ).toLatin1().data() ),
2479 status_bar = tr( QString( "STB_%1" ).arg( po_id ).toLatin1().data() );
2481 createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() ) );
2484 //=======================================================================
2485 // function : createPopupItem
2487 //=======================================================================
2488 void SMESHGUI::createPopupItem( const int id,
2489 const QString& clients,
2490 const QString& types,
2491 const QString& theRule,
2496 parentId = popupMgr()->actionId( action( pId ) );
2498 if( !popupMgr()->contains( popupMgr()->actionId( action( id ) ) ) )
2499 popupMgr()->insert( action( id ), parentId, 0 );
2501 QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality();
2502 QString dc = "selcount"; // VSR : insetad of QtxPopupSelection::defSelCountParam()
2503 QString rule = "(%1) and (%2) and (%3)";
2504 rule = rule.arg( QString( "%1>0" ).arg( dc ) );
2505 if( clients.isEmpty() )
2506 rule = rule.arg( QString( "true" ) );
2508 rule = rule.arg( QString( "%1client in {%2}" ).arg( lc ).arg( clients ) );
2509 rule = rule.arg( QString( "%1type in {%2}" ).arg( lc ).arg( types ) );
2512 bool cont = myRules.contains( id );
2514 rule = QString( "%1 or (%2)" ).arg( myRules[ id ] ).arg( rule );
2516 popupMgr()->setRule( action( id ), rule, QtxPopupMgr::VisibleRule );
2517 myRules[ id ] = QString( cont ? "%1" : "(%1)" ).arg( rule );
2520 //=======================================================================
2521 // function : initialize
2523 //=======================================================================
2524 void SMESHGUI::initialize( CAM_Application* app )
2526 SalomeApp_Module::initialize( app );
2528 // SUIT_ResourceMgr* mgr = app->resourceMgr();
2530 /* Automatic Update flag */
2531 // myAutomaticUpdate = mgr->booleanValue( "SMESH", "AutomaticUpdate", myAutomaticUpdate );
2533 // ----- create actions --------------
2535 createSMESHAction( 111, "DAT", "", (Qt::CTRL+Qt::Key_B) );
2536 createSMESHAction( 112, "UNV", "", (Qt::CTRL+Qt::Key_U) );
2537 createSMESHAction( 113, "MED", "", (Qt::CTRL+Qt::Key_M) );
2538 createSMESHAction( 114, "NUM" );
2539 createSMESHAction( 121, "DAT" );
2540 createSMESHAction( 122, "MED" );
2541 createSMESHAction( 123, "UNV" );
2542 createSMESHAction( 140, "STL" );
2543 createSMESHAction( 124, "EXPORT_DAT" );
2544 createSMESHAction( 125, "EXPORT_MED" );
2545 createSMESHAction( 126, "EXPORT_UNV" );
2546 createSMESHAction( 141, "EXPORT_STL" );
2547 createSMESHAction( 150, "FILE_INFO" );
2548 createSMESHAction( 33, "DELETE", "ICON_DELETE", Qt::Key_Delete );
2549 createSMESHAction( 5105, "SEL_FILTER_LIB" );
2550 createSMESHAction( 701, "COMPUTE", "ICON_COMPUTE" );
2551 createSMESHAction( 702, "CREATE_MESH", "ICON_DLG_INIT_MESH" );
2552 createSMESHAction( 703, "CREATE_SUBMESH", "ICON_DLG_ADD_SUBMESH" );
2553 createSMESHAction( 704, "EDIT_MESHSUBMESH","ICON_DLG_EDIT_MESH" );
2554 createSMESHAction( 710, "BUILD_COMPOUND", "ICON_BUILD_COMPOUND" );
2555 createSMESHAction( 801, "CREATE_GROUP", "ICON_CREATE_GROUP" );
2556 createSMESHAction( 802, "CONSTRUCT_GROUP", "ICON_CONSTRUCT_GROUP" );
2557 createSMESHAction( 803, "EDIT_GROUP", "ICON_EDIT_GROUP" );
2558 createSMESHAction( 804, "ADD" );
2559 createSMESHAction( 805, "REMOVE" );
2560 createSMESHAction( 810, "UN_GROUP", "ICON_UNION" );
2561 createSMESHAction( 811, "INT_GROUP", "ICON_INTERSECT" );
2562 createSMESHAction( 812, "CUT_GROUP", "ICON_CUT" );
2563 createSMESHAction( 813, "DEL_GROUP", "ICON_DEL_GROUP" );
2564 createSMESHAction( 900, "ADV_INFO", "ICON_ADV_INFO" );
2565 createSMESHAction( 902, "STD_INFO", "ICON_STD_INFO" );
2566 createSMESHAction( 903, "WHAT_IS", "ICON_WHAT_IS" );
2567 createSMESHAction( 6001, "LENGTH", "ICON_LENGTH", 0, true );
2568 createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE", 0, true );
2569 createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D", 0, true );
2570 createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION", 0, true );
2571 createSMESHAction( 6011, "AREA", "ICON_AREA", 0, true );
2572 createSMESHAction( 6012, "TAPER", "ICON_TAPER", 0, true );
2573 createSMESHAction( 6013, "ASPECT", "ICON_ASPECT", 0, true );
2574 createSMESHAction( 6014, "MIN_ANG", "ICON_ANGLE", 0, true );
2575 createSMESHAction( 6015, "WARP", "ICON_WARP", 0, true );
2576 createSMESHAction( 6016, "SKEW", "ICON_SKEW", 0, true );
2577 createSMESHAction( 6017, "ASPECT_3D", "ICON_ASPECT_3D", 0, true );
2578 createSMESHAction( 6018, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
2579 createSMESHAction( 6019, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
2580 createSMESHAction( 6009, "VOLUME_3D", "ICON_VOLUME_3D", 0, true );
2581 createSMESHAction( 400, "NODE", "ICON_DLG_NODE" );
2582 createSMESHAction( 401, "EDGE", "ICON_DLG_EDGE" );
2583 createSMESHAction( 4021, "TRIANGLE", "ICON_DLG_TRIANGLE" );
2584 createSMESHAction( 4022, "QUAD", "ICON_DLG_QUADRANGLE" );
2585 createSMESHAction( 4023, "POLYGON", "ICON_DLG_POLYGON" );
2586 createSMESHAction( 4031, "TETRA", "ICON_DLG_TETRAS" );
2587 createSMESHAction( 4032, "HEXA", "ICON_DLG_HEXAS" );
2588 createSMESHAction( 4041, "REMOVE_NODES", "ICON_DLG_REM_NODE" );
2589 createSMESHAction( 4042, "REMOVE_ELEMENTS", "ICON_DLG_REM_ELEMENT" );
2590 createSMESHAction( 4043, "CLEAR_MESH" , "ICON_CLEAR_MESH" );
2591 createSMESHAction( 4051, "RENUM_NODES", "ICON_DLG_RENUMBERING_NODES" );
2592 createSMESHAction( 4052, "RENUM_ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" );
2593 createSMESHAction( 4061, "TRANS", "ICON_SMESH_TRANSLATION_VECTOR" );
2594 createSMESHAction( 4062, "ROT", "ICON_DLG_MESH_ROTATION" );
2595 createSMESHAction( 4063, "SYM", "ICON_SMESH_SYMMETRY_PLANE" );
2596 createSMESHAction( 4064, "SEW", "ICON_SMESH_SEWING_FREEBORDERS" );
2597 createSMESHAction( 4065, "MERGE", "ICON_SMESH_MERGE_NODES" );
2598 createSMESHAction( 4066, "MERGE_ELEMENTS", "ICON_DLG_MERGE_ELEMENTS" );
2599 createSMESHAction( 4067, "MESH_THROU_POINT","ICON_DLG_MESH_THROU_POINT" );
2600 createSMESHAction( 406, "MOVE", "ICON_DLG_MOVE_NODE" );
2601 createSMESHAction( 407, "INV", "ICON_DLG_MESH_DIAGONAL" );
2602 createSMESHAction( 408, "UNION2", "ICON_UNION2TRI" );
2603 createSMESHAction( 409, "ORIENT", "ICON_DLG_MESH_ORIENTATION" );
2604 createSMESHAction( 410, "UNION", "ICON_UNIONTRI" );
2605 createSMESHAction( 411, "CUT", "ICON_CUTQUAD" );
2606 createSMESHAction( 412, "SMOOTH", "ICON_DLG_SMOOTHING" );
2607 createSMESHAction( 413, "EXTRUSION", "ICON_EXTRUSION" );
2608 createSMESHAction( 414, "REVOLUTION", "ICON_REVOLUTION" );
2609 createSMESHAction( 415, "MAP", "ICON_MAP" );
2610 createSMESHAction( 416, "EXTRUSION_ALONG", "ICON_EXTRUSION_ALONG" );
2611 createSMESHAction( 417, "CONV_TO_QUAD", "ICON_CONV_TO_QUAD" );
2612 createSMESHAction( 200, "RESET" );
2613 createSMESHAction( 201, "SCALAR_BAR_PROP" );
2614 createSMESHAction( 211, "WIRE", "ICON_WIRE", 0, true );
2615 createSMESHAction( 212, "SHADE", "ICON_SHADE", 0, true );
2616 createSMESHAction( 213, "SHRINK", "ICON_SHRINK", 0, true );
2617 createSMESHAction( 214, "UPDATE", "ICON_UPDATE" );
2618 createSMESHAction( 215, "NODES", "ICON_POINTS", 0, true );
2619 createSMESHAction( 217, "EDGES", "ICON_DLG_EDGE", 0, true );
2620 createSMESHAction( 218, "FACES", "ICON_DLG_TRIANGLE", 0, true );
2621 createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
2622 createSMESHAction( 220, "ALL" );
2623 createSMESHAction( 1100, "EDIT_HYPO" );
2624 createSMESHAction( 1101, "RENAME", "", Qt::Key_F2 );
2625 createSMESHAction( 1102, "UNASSIGN" );
2626 createSMESHAction( 9010, "NUM_NODES", "", 0, true );
2627 createSMESHAction( 9011, "NUM_ELEMENTS", "", 0, true );
2628 createSMESHAction( 1131, "DISPMODE" );
2629 createSMESHAction( 1132, "COLORS" );
2630 createSMESHAction( 1133, "TRANSP" );
2631 createSMESHAction( 1134, "CLIP" );
2632 createSMESHAction( 1135, "DISP_ENT" );
2633 createSMESHAction( 1136, "AUTO_COLOR" );
2634 createSMESHAction( 1137, "DISABLE_AUTO_COLOR" );
2635 createSMESHAction( 2000, "CTRL" );
2637 createSMESHAction( 300, "ERASE" );
2638 createSMESHAction( 301, "DISPLAY" );
2639 createSMESHAction( 302, "DISPLAY_ONLY" );
2640 createSMESHAction( 4033, "POLYHEDRON", "ICON_DLG_POLYHEDRON" );
2641 createSMESHAction( 4034, "QUADRATIC_EDGE", "ICON_DLG_QUADRATIC_EDGE" );
2642 createSMESHAction( 4035, "QUADRATIC_TRIANGLE", "ICON_DLG_QUADRATIC_TRIANGLE" );
2643 createSMESHAction( 4036, "QUADRATIC_QUADRANGLE", "ICON_DLG_QUADRATIC_QUADRANGLE" );
2644 createSMESHAction( 4037, "QUADRATIC_TETRAHEDRON", "ICON_DLG_QUADRATIC_TETRAHEDRON" );
2645 createSMESHAction( 4038, "QUADRATIC_PYRAMID", "ICON_DLG_QUADRATIC_PYRAMID" );
2646 createSMESHAction( 4039, "QUADRATIC_PENTAHEDRON", "ICON_DLG_QUADRATIC_PENTAHEDRON" );
2647 createSMESHAction( 4040, "QUADRATIC_HEXAHEDRON", "ICON_DLG_QUADRATIC_HEXAHEDRON" );
2649 // ----- create menu --------------
2650 int fileId = createMenu( tr( "MEN_FILE" ), -1, 1 ),
2651 editId = createMenu( tr( "MEN_EDIT" ), -1, 3 ),
2652 toolsId = createMenu( tr( "MEN_TOOLS" ), -1, 5, 50 ),
2653 meshId = createMenu( tr( "MEN_MESH" ), -1, 70, 10 ),
2654 ctrlId = createMenu( tr( "MEN_CTRL" ), -1, 60, 10 ),
2655 modifyId = createMenu( tr( "MEN_MODIFY" ), -1, 40, 10 ),
2656 viewId = createMenu( tr( "MEN_VIEW" ), -1, 2 );
2658 createMenu( separator(), fileId );
2660 int importId = createMenu( tr( "MEN_IMPORT" ), fileId, 11, 10 ),
2661 exportId = createMenu( tr( "MEN_EXPORT" ), fileId, 12, 10 ),
2662 addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ),
2663 removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
2664 renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
2665 transfId = createMenu( tr( "MEN_TRANSF" ), modifyId, 405 );
2667 createMenu( 111, importId, -1 );
2668 createMenu( 112, importId, -1 );
2669 createMenu( 113, importId, -1 );
2671 createMenu( 121, exportId, -1 );
2672 createMenu( 122, exportId, -1 );
2673 createMenu( 123, exportId, -1 );
2674 createMenu( 140, exportId, -1 ); // export to stl STL
2676 createMenu( separator(), fileId, 10 );
2678 createMenu( 33, editId, -1 );
2680 createMenu( 5105, toolsId, -1 );
2682 createMenu( 702, meshId, -1 ); // "Mesh" menu
2683 createMenu( 703, meshId, -1 );
2684 createMenu( 704, meshId, -1 );
2685 createMenu( 710, meshId, -1 );
2686 createMenu( separator(), meshId, -1 );
2687 createMenu( 701, meshId, -1 );
2688 createMenu( separator(), meshId, -1 );
2689 createMenu( 801, meshId, -1 );
2690 createMenu( 802, meshId, -1 );
2691 createMenu( 803, meshId, -1 );
2692 createMenu( separator(), meshId, -1 );
2693 createMenu( 810, meshId, -1 );
2694 createMenu( 811, meshId, -1 );
2695 createMenu( 812, meshId, -1 );
2696 createMenu( separator(), meshId, -1 );
2697 createMenu( 813, meshId, -1 );
2698 createMenu( separator(), meshId, -1 );
2699 createMenu( 900, meshId, -1 );
2700 createMenu( 902, meshId, -1 );
2701 createMenu( 903, meshId, -1 );
2702 createMenu( separator(), meshId, -1 );
2704 createMenu( 6003, ctrlId, -1 );
2705 createMenu( 6001, ctrlId, -1 );
2706 createMenu( 6004, ctrlId, -1 );
2707 createMenu( separator(), ctrlId, -1 );
2708 createMenu( 6002, ctrlId, -1 );
2709 createMenu( 6018, ctrlId, -1 );
2710 createMenu( 6019, ctrlId, -1 );
2711 createMenu( 6011, ctrlId, -1 );
2712 createMenu( 6012, ctrlId, -1 );
2713 createMenu( 6013, ctrlId, -1 );
2714 createMenu( 6014, ctrlId, -1 );
2715 createMenu( 6015, ctrlId, -1 );
2716 createMenu( 6016, ctrlId, -1 );
2717 createMenu( separator(), ctrlId, -1 );
2718 createMenu( 6017, ctrlId, -1 );
2719 createMenu( 6009, ctrlId, -1 );
2720 createMenu( separator(), ctrlId, -1 );
2722 createMenu( 400, addId, -1 );
2723 createMenu( 401, addId, -1 );
2724 createMenu( 4021, addId, -1 );
2725 createMenu( 4022, addId, -1 );
2726 createMenu( 4023, addId, -1 );
2727 createMenu( 4031, addId, -1 );
2728 createMenu( 4032, addId, -1 );
2729 createMenu( 4033, addId, -1 );
2730 createMenu( separator(), addId, -1 );
2731 createMenu( 4034, addId, -1 );
2732 createMenu( 4035, addId, -1 );
2733 createMenu( 4036, addId, -1 );
2734 createMenu( 4037, addId, -1 );
2735 createMenu( 4038, addId, -1 );
2736 createMenu( 4039, addId, -1 );
2737 createMenu( 4040, addId, -1 );
2739 createMenu( 4041, removeId, -1 );
2740 createMenu( 4042, removeId, -1 );
2741 createMenu( 4043, removeId, -1 );
2743 createMenu( 4051, renumId, -1 );
2744 createMenu( 4052, renumId, -1 );
2746 createMenu( 4061, transfId, -1 );
2747 createMenu( 4062, transfId, -1 );
2748 createMenu( 4063, transfId, -1 );
2749 createMenu( 4064, transfId, -1 );
2750 createMenu( 4065, transfId, -1 );
2751 createMenu( 4066, transfId, -1 );
2753 createMenu( 406, modifyId, -1 );
2754 createMenu( 4067,modifyId, -1 );
2755 createMenu( 407, modifyId, -1 );
2756 createMenu( 408, modifyId, -1 );
2757 createMenu( 409, modifyId, -1 );
2758 createMenu( 410, modifyId, -1 );
2759 createMenu( 411, modifyId, -1 );
2760 createMenu( 412, modifyId, -1 );
2761 createMenu( 413, modifyId, -1 );
2762 createMenu( 416, modifyId, -1 );
2763 createMenu( 414, modifyId, -1 );
2764 createMenu( 415, modifyId, -1 );
2765 createMenu( 417, modifyId, -1 );
2767 createMenu( 214, viewId, -1 );
2769 // ----- create toolbars --------------
2770 int meshTb = createTool( tr( "TB_MESH" ) ),
2771 ctrlTb = createTool( tr( "TB_CTRL" ) ),
2772 addRemTb = createTool( tr( "TB_ADD_REMOVE" ) ),
2773 modifyTb = createTool( tr( "TB_MODIFY" ) ),
2774 dispModeTb = createTool( tr( "TB_DISP_MODE" ) );
2776 createTool( 702, meshTb );
2777 createTool( 703, meshTb );
2778 createTool( 704, meshTb );
2779 createTool( 710, meshTb );
2780 createTool( separator(), meshTb );
2781 createTool( 701, meshTb );
2782 createTool( separator(), meshTb );
2783 createTool( 801, meshTb );
2784 createTool( 802, meshTb );
2785 createTool( 803, meshTb );
2786 createTool( separator(), meshTb );
2787 createTool( 900, meshTb );
2788 createTool( 902, meshTb );
2789 createTool( 903, meshTb );
2790 createTool( separator(), meshTb );
2792 createTool( 6001, ctrlTb );
2793 createTool( 6003, ctrlTb );
2794 createTool( 6004, ctrlTb );
2795 createTool( separator(), ctrlTb );
2796 createTool( 6002, ctrlTb );
2797 createTool( 6018, ctrlTb );
2798 createTool( 6019, ctrlTb );
2799 createTool( 6011, ctrlTb );
2800 createTool( 6012, ctrlTb );
2801 createTool( 6013, ctrlTb );
2802 createTool( 6014, ctrlTb );
2803 createTool( 6015, ctrlTb );
2804 createTool( 6016, ctrlTb );
2805 createTool( separator(), ctrlTb );
2806 createTool( 6017, ctrlTb );
2807 createTool( 6009, ctrlTb );
2808 createTool( separator(), ctrlTb );
2810 createTool( 400, addRemTb );
2811 createTool( 401, addRemTb );
2812 createTool( 4021, addRemTb );
2813 createTool( 4022, addRemTb );
2814 createTool( 4023, addRemTb );
2815 createTool( 4031, addRemTb );
2816 createTool( 4032, addRemTb );
2817 createTool( 4033, addRemTb );
2818 createTool( separator(), addRemTb );
2819 createTool( 4034, addRemTb );
2820 createTool( 4035, addRemTb );
2821 createTool( 4036, addRemTb );
2822 createTool( 4037, addRemTb );
2823 createTool( 4038, addRemTb );
2824 createTool( 4039, addRemTb );
2825 createTool( 4040, addRemTb );
2826 createTool( separator(), addRemTb );
2827 createTool( 4041, addRemTb );
2828 createTool( 4042, addRemTb );
2829 createTool( 4043, addRemTb );
2830 createTool( separator(), addRemTb );
2831 createTool( 4051, addRemTb );
2832 createTool( 4052, addRemTb );
2833 createTool( separator(), addRemTb );
2834 createTool( 4061, addRemTb );
2835 createTool( 4062, addRemTb );
2836 createTool( 4063, addRemTb );
2837 createTool( 4064, addRemTb );
2838 createTool( 4065, addRemTb );
2839 createTool( 4066, addRemTb );
2840 createTool( separator(), addRemTb );
2842 createTool( 406, modifyTb );
2843 createTool( 4067,modifyTb );
2844 createTool( 407, modifyTb );
2845 createTool( 408, modifyTb );
2846 createTool( 409, modifyTb );
2847 createTool( 410, modifyTb );
2848 createTool( 411, modifyTb );
2849 createTool( 412, modifyTb );
2850 createTool( 413, modifyTb );
2851 createTool( 416, modifyTb );
2852 createTool( 414, modifyTb );
2853 createTool( 415, modifyTb );
2854 createTool( 417, modifyTb );
2856 createTool( 214, dispModeTb );
2858 QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality();
2859 QString dc = "selcount"; // VSR : instead of QtxPopupSelection::defSelCountParam()
2862 QString OB = "'ObjectBrowser'",
2863 View = "'" + SVTK_Viewer::Type() + "'",
2865 mesh = pat.arg( SMESHGUI_Selection::typeName( MESH ) ),
2866 group = pat.arg( SMESHGUI_Selection::typeName( GROUP ) ),
2867 hypo = pat.arg( SMESHGUI_Selection::typeName( HYPOTHESIS ) ),
2868 algo = pat.arg( SMESHGUI_Selection::typeName( ALGORITHM ) ),
2869 elems = QString( "'%1' '%2' '%3' '%4' '%5' '%6'" ).
2870 arg( SMESHGUI_Selection::typeName( SUBMESH_VERTEX ) ).
2871 arg( SMESHGUI_Selection::typeName( SUBMESH_EDGE ) ).
2872 arg( SMESHGUI_Selection::typeName( SUBMESH_FACE ) ).
2873 arg( SMESHGUI_Selection::typeName( SUBMESH_SOLID ) ).
2874 arg( SMESHGUI_Selection::typeName( SUBMESH_COMPOUND ) ).
2875 arg( SMESHGUI_Selection::typeName( SUBMESH ) ),
2877 mesh_group = mesh + " " + subMesh + " " + group,
2878 hyp_alg = hypo + " " + algo;
2880 // popup for object browser
2882 createPopupItem( 150, OB, mesh, "&& selcount=1 && isImported" ); // FILE INFORMATION
2883 createPopupItem( 704, OB, mesh, "&& isComputable"); // EDIT_MESHSUBMESH
2884 createPopupItem( 704, OB, subMesh, "&& isComputable" ); // EDIT_MESHSUBMESH
2885 createPopupItem( 803, OB, group ); // EDIT_GROUP
2886 popupMgr()->insert( separator(), -1, 0 );
2887 createPopupItem( 701, OB, mesh, "&& isComputable" ); // COMPUTE
2888 createPopupItem( 214, OB, mesh_group ); // UPDATE
2889 createPopupItem( 900, OB, mesh_group ); // ADV_INFO
2890 createPopupItem( 902, OB, mesh ); // STD_INFO
2891 createPopupItem( 903, OB, mesh_group ); // WHAT_IS
2892 popupMgr()->insert( separator(), -1, 0 );
2893 createPopupItem( 801, OB, mesh ); // CREATE_GROUP
2894 createPopupItem( 802, OB, subMesh ); // CONSTRUCT_GROUP
2895 popupMgr()->insert( separator(), -1, 0 );
2896 createPopupItem( 1100, OB, hypo); // EDIT HYPOTHESIS
2897 createPopupItem( 1102, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS
2898 createPopupItem( 1101, OB, mesh_group + " " + hyp_alg ); // RENAME
2899 popupMgr()->insert( separator(), -1, 0 );
2900 createPopupItem( 4043, OB, mesh ); // CLEAR_MESH
2901 popupMgr()->insert( separator(), -1, 0 );
2903 QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
2905 createPopupItem( 125, OB, mesh, only_one_non_empty ); // EXPORT_MED
2906 createPopupItem( 126, OB, mesh, only_one_non_empty ); // EXPORT_UNV
2907 createPopupItem( 141, OB, mesh, only_one_non_empty ); // EXPORT_STL
2908 //createPopupItem( 33, OB, subMesh + " " + group ); // DELETE
2909 createPopupItem( 33, OB, mesh_group + " " + hyp_alg ); // DELETE
2910 popupMgr()->insert( separator(), -1, 0 );
2913 createPopupItem( 803, View, group ); // EDIT_GROUP
2914 createPopupItem( 804, View, elems ); // ADD
2915 createPopupItem( 805, View, elems ); // REMOVE
2916 popupMgr()->insert( separator(), -1, 0 );
2917 createPopupItem( 214, View, mesh_group ); // UPDATE
2918 createPopupItem( 900, View, mesh_group ); // ADV_INFO
2919 createPopupItem( 902, View, mesh ); // STD_INFO
2920 createPopupItem( 903, View, mesh_group ); // WHAT_IS
2921 popupMgr()->insert( separator(), -1, 0 );
2923 createPopupItem( 1136, OB + " " + View, mesh, "&& (not isAutoColor)" ); // AUTO_COLOR
2924 createPopupItem( 1137, OB + " " + View, mesh, "&& isAutoColor" ); // DISABLE_AUTO_COLOR
2925 popupMgr()->insert( separator(), -1, 0 );
2929 isInvisible("not( isVisible )"),
2930 isEmpty("numberOfNodes = 0"),
2931 isNotEmpty("numberOfNodes <> 0"),
2933 // has nodes, edges, etc in VISIBLE! actor
2934 hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
2935 hasElems("(count( elemTypes ) > 0)"),
2936 hasDifferentElems("(count( elemTypes ) > 1)"),
2937 hasEdges("({'Edge'} in elemTypes)"),
2938 hasFaces("({'Face'} in elemTypes)"),
2939 hasVolumes("({'Volume'} in elemTypes)");
2941 QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" );
2942 QString aType = QString( "%1type in {%2}" ).arg( lc );
2943 aType = aType.arg( mesh_group );
2944 QString aMeshInVTK = aClient + "&&" + aType;
2946 aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
2947 QString anActiveVTK = QString("activeView = '%1'").arg(SVTK_Viewer::Type());
2948 QString aSelCount = QString( "%1 > 0" ).arg( dc );
2950 //-------------------------------------------------
2952 //-------------------------------------------------
2953 anId = popupMgr()->insert( tr( "MEN_NUM" ), -1, -1 );
2955 popupMgr()->insert( action( 9010 ), anId, -1 );
2956 popupMgr()->setRule( action( 9010 ), aMeshInVTK + "&& isVisible &&" + hasNodes, QtxPopupMgr::VisibleRule );
2957 popupMgr()->setRule( action( 9010 ), "{'Point'} in labeledTypes", QtxPopupMgr::ToggleRule );
2959 popupMgr()->insert( action( 9011 ), anId, -1 );
2960 popupMgr()->setRule( action( 9011 ), aMeshInVTK + "&& isVisible &&" + hasElems, QtxPopupMgr::VisibleRule );
2961 popupMgr()->setRule( action( 9011 ), "{'Cell'} in labeledTypes", QtxPopupMgr::ToggleRule );
2963 popupMgr()->insert( separator(), -1, -1 );
2965 //-------------------------------------------------
2967 //-------------------------------------------------
2968 anId = popupMgr()->insert( tr( "MEN_DISPMODE" ), -1, -1 );
2970 popupMgr()->insert( action( 211 ), anId, -1 ); // WIRE
2971 popupMgr()->setRule( action( 211 ), aMeshInVTK + "&&" + hasElems, QtxPopupMgr::VisibleRule );
2972 popupMgr()->setRule( action( 211 ), "displayMode = 'eEdge'", QtxPopupMgr::ToggleRule );
2974 popupMgr()->insert( action( 212 ), anId, -1 ); // SHADE
2975 popupMgr()->setRule( action( 212 ),aMeshInVTK+ "&& (" + hasFaces + "||" + hasVolumes + ")", QtxPopupMgr::VisibleRule);
2976 popupMgr()->setRule( action( 212 ), "displayMode = 'eSurface'", QtxPopupMgr::ToggleRule );
2978 popupMgr()->insert( action( 215 ), anId, -1 ); // POINTS
2979 popupMgr()->setRule( action( 215 ), aMeshInVTK + "&&" + hasNodes, QtxPopupMgr::VisibleRule );
2980 popupMgr()->setRule( action( 215 ), "displayMode = 'ePoint'", QtxPopupMgr::ToggleRule );
2982 popupMgr()->insert( separator(), anId, -1 );
2984 popupMgr()->insert( action( 213 ), anId, -1 ); // SHRINK
2985 popupMgr()->setRule( action( 213 ), aMeshInVTK + "&& shrinkMode <> 'IsNotShrinkable' && displayMode <> 'ePoint'", QtxPopupMgr::VisibleRule);
2986 popupMgr()->setRule( action( 213 ), "shrinkMode = 'IsShrunk'", QtxPopupMgr::ToggleRule );
2988 //-------------------------------------------------
2990 //-------------------------------------------------
2991 QString aDiffElemsInVTK = aMeshInVTK + "&&" + hasDifferentElems;
2993 anId = popupMgr()->insert( tr( "MEN_DISP_ENT" ), -1, -1 );
2995 popupMgr()->insert( action( 217 ), anId, -1 ); // EDGES
2996 popupMgr()->setRule( action( 217 ), aDiffElemsInVTK + "&& isVisible &&" + hasEdges, QtxPopupMgr::VisibleRule );
2997 popupMgr()->setRule( action( 217 ), "{'Edge'} in entityMode", QtxPopupMgr::ToggleRule );
2999 popupMgr()->insert( action( 218 ), anId, -1 ); // FACES
3000 popupMgr()->setRule( action( 218 ), aDiffElemsInVTK + "&& isVisible &&" + hasFaces, QtxPopupMgr::VisibleRule );
3001 popupMgr()->setRule( action( 218 ), "{'Face'} in entityMode", QtxPopupMgr::ToggleRule );
3003 popupMgr()->insert( action( 219 ), anId, -1 ); // VOLUMES
3004 popupMgr()->setRule( action( 219 ), aDiffElemsInVTK + "&& isVisible &&" + hasVolumes, QtxPopupMgr::VisibleRule );
3005 popupMgr()->setRule( action( 219 ), "{'Volume'} in entityMode", QtxPopupMgr::ToggleRule );
3007 popupMgr()->insert( separator(), anId, -1 );
3009 popupMgr()->insert( action( 220 ), anId, -1 ); // ALL
3010 popupMgr()->setRule( action( 220 ), aDiffElemsInVTK + "&& isVisible && not( elemTypes in entityMode )", QtxPopupMgr::VisibleRule );
3012 //-------------------------------------------------
3014 //-------------------------------------------------
3015 popupMgr()->insert( action( 1132 ), -1, -1 );
3016 popupMgr()->setRule( action( 1132 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule );
3018 //-------------------------------------------------
3020 //-------------------------------------------------
3021 popupMgr()->insert( action( 1133 ), -1, -1 );
3022 popupMgr()->setRule( action( 1133 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule );
3024 //-------------------------------------------------
3026 //-------------------------------------------------
3027 popupMgr()->insert( action( 1134 ), -1, -1 );
3028 popupMgr()->setRule( action( 1134 ), aMeshInVTK + "&& isVisible", QtxPopupMgr::VisibleRule );
3030 popupMgr()->insert( separator(), -1, -1 );
3032 //-------------------------------------------------
3034 //-------------------------------------------------
3036 aMeshInVtkHasEdges = aMeshInVTK + "&&" + hasEdges,
3037 aMeshInVtkHasFaces = aMeshInVTK + "&&" + hasFaces,
3038 aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes;
3040 anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 );
3042 popupMgr()->insert( action( 200 ), anId, -1 ); // RESET
3043 popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
3045 popupMgr()->insert( separator(), anId, -1 );
3047 popupMgr()->insert( action( 6003 ), anId, -1 ); // FREE_BORDER
3048 popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
3049 popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeBorders'", QtxPopupMgr::ToggleRule );
3051 popupMgr()->insert( action( 6001 ), anId, -1 ); // LENGTH
3052 popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
3053 popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", QtxPopupMgr::ToggleRule );
3055 popupMgr()->insert( action( 6004 ), anId, -1 ); // CONNECTION
3056 popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
3057 popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", QtxPopupMgr::ToggleRule );
3059 popupMgr()->insert( separator(), anId, -1 );
3061 popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE
3062 popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
3063 popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeEdges'", QtxPopupMgr::ToggleRule );
3065 popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D
3066 popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
3067 popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", QtxPopupMgr::ToggleRule );
3069 popupMgr()->insert( action( 6019 ), anId, -1 ); // CONNECTION_2D
3070 popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
3071 popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", QtxPopupMgr::ToggleRule );
3073 popupMgr()->insert( action( 6011 ), anId, -1 ); // AREA
3074 popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
3075 popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", QtxPopupMgr::ToggleRule );
3077 popupMgr()->insert( action( 6012 ), anId, -1 ); // TAPER
3078 popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
3079 popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", QtxPopupMgr::ToggleRule );
3081 popupMgr()->insert( action( 6013 ), anId, -1 ); // ASPECT
3082 popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
3083 popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", QtxPopupMgr::ToggleRule );
3085 popupMgr()->insert( action( 6014 ), anId, -1 ); // MIN_ANG
3086 popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
3087 popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", QtxPopupMgr::ToggleRule );
3089 popupMgr()->insert( action( 6015 ), anId, -1 ); // WARP
3090 popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
3091 popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", QtxPopupMgr::ToggleRule );
3093 popupMgr()->insert( action( 6016 ), anId, -1 ); // SKEW
3094 popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
3095 popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", QtxPopupMgr::ToggleRule );
3097 popupMgr()->insert( separator(), anId, -1 );
3099 popupMgr()->insert( action( 6017 ), anId, -1 ); // ASPECT_3D
3100 popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
3101 popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", QtxPopupMgr::ToggleRule );
3103 popupMgr()->insert ( action( 6009 ), anId, -1 ); // VOLUME_3D
3104 popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
3105 popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", QtxPopupMgr::ToggleRule );
3107 popupMgr()->insert( separator(), anId, -1 );
3109 popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP
3110 popupMgr()->setRule( action( 201 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
3112 popupMgr()->insert( separator(), -1, -1 );
3114 //-------------------------------------------------
3116 //-------------------------------------------------
3117 QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " +
3118 aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
3119 popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
3120 popupMgr()->setRule( action( 301 ), aRule.arg( "and (not isVisible)" ), QtxPopupMgr::VisibleRule );
3122 popupMgr()->insert( action( 300 ), -1, -1 ); // ERASE
3123 popupMgr()->setRule( action( 300 ), aRule.arg( "and isVisible" ), QtxPopupMgr::VisibleRule );
3125 popupMgr()->insert( action( 302 ), -1, -1 ); // DISPLAY_ONLY
3126 popupMgr()->setRule( action( 302 ), aRule.arg( "" ), QtxPopupMgr::VisibleRule );
3128 popupMgr()->insert( separator(), -1, -1 );
3130 connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ),
3131 this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
3134 //================================================================================
3136 * \brief Return true if SMESH or GEOM objects are selected.
3137 * Is called form LightApp_Module::activateModule() which clear selection if
3138 * not isSelectionCompatible()
3140 //================================================================================
3142 bool SMESHGUI::isSelectionCompatible()
3144 bool isCompatible = true;
3145 SALOME_ListIO selected;
3146 if ( LightApp_SelectionMgr *Sel = selectionMgr() )
3147 Sel->selectedObjects( selected );
3149 SALOME_ListIteratorOfListIO It( selected );
3150 for ( ; isCompatible && It.More(); It.Next())
3152 ( strcmp("GEOM", It.Value()->getComponentDataType()) == 0 ) ||
3153 ( strcmp("SMESH", It.Value()->getComponentDataType()) == 0 );
3155 return isCompatible;
3158 bool SMESHGUI::activateModule( SUIT_Study* study )
3160 bool res = SalomeApp_Module::activateModule( study );
3162 setMenuShown( true );
3163 setToolShown( true );
3165 // Reset actions accelerator keys
3166 action(111)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); // Import DAT
3167 action(112)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)); // Import UNV
3168 action(113)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); // Import MED
3170 action( 33)->setEnabled(true); // Delete: Key_Delete
3171 action(1101)->setEnabled(true); // Rename: Key_F2
3176 bool SMESHGUI::deactivateModule( SUIT_Study* study )
3178 setMenuShown( false );
3179 setToolShown( false );
3181 EmitSignalCloseAllDialogs();
3183 // Unset actions accelerator keys
3184 action(111)->setShortcut(QKeySequence()); // Import DAT
3185 action(112)->setShortcut(QKeySequence()); // Import UNV
3186 action(113)->setShortcut(QKeySequence()); // Import MED
3188 action( 33)->setEnabled(false); // Delete: Key_Delete
3189 action(1101)->setEnabled(false); // Rename: Key_F2
3191 return SalomeApp_Module::deactivateModule( study );
3194 void SMESHGUI::studyClosed( SUIT_Study* s )
3196 SMESH::RemoveVisuData( s->id() );
3197 SalomeApp_Module::studyClosed( s );
3200 void SMESHGUI::OnGUIEvent()
3202 const QObject* obj = sender();
3203 if ( !obj || !obj->inherits( "QAction" ) )
3205 int id = actionId((QAction*)obj);
3210 SMESH::SMESH_Gen_var SMESHGUI::GetSMESHGen()
3212 _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
3213 if ( CORBA::is_nil( myComponentSMESH ) )
3215 SMESHGUI aGUI; //SRN BugID: IPAL9186: Create an instance of SMESHGUI to initialize myComponentSMESH
3217 aGUI.myComponentSMESH->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
3218 return aGUI.myComponentSMESH;
3221 myComponentSMESH->SetCurrentStudy(_CAST(Study,aStudy)->GetStudy());
3222 return myComponentSMESH;
3225 QString SMESHGUI::engineIOR() const
3227 CORBA::ORB_var anORB = getApp()->orb();
3228 CORBA::String_var anIOR = anORB->object_to_string(GetSMESHGen());
3229 return QString( anIOR.in() );
3232 void SMESHGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
3234 SalomeApp_Module::contextMenuPopup( client, menu, title );
3236 selectionMgr()->selectedObjects( lst );
3237 if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
3238 Handle(SALOME_InteractiveObject) io = lst.First();
3239 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
3240 _PTR(Study) study = appStudy->studyDS();
3241 _PTR(SObject) obj = study->FindObjectID( io->getEntry() );
3243 QString aName = QString( obj->GetName().c_str() );
3244 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
3245 aName.remove( (aName.length() - 1), 1 );
3251 LightApp_Selection* SMESHGUI::createSelection() const
3253 return new SMESHGUI_Selection();
3256 void SMESHGUI::windows( QMap<int, int>& aMap ) const
3258 aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3259 aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3262 void SMESHGUI::viewManagers( QStringList& list ) const
3264 list.append( SVTK_Viewer::Type() );
3267 void SMESHGUI::onViewManagerActivated( SUIT_ViewManager* mgr )
3269 if ( dynamic_cast<SVTK_ViewManager*>( mgr ) )
3270 SMESH::UpdateSelectionProp( this );
3273 void SMESHGUI::createPreferences()
3275 int genTab = addPreference( tr( "PREF_TAB_GENERAL" ) );
3277 int updateGroup = addPreference( tr( "PREF_GROUP_UPDATE" ), genTab );
3278 addPreference( tr( "PREF_AUTO_UPDATE" ), updateGroup, LightApp_Preferences::Bool, "SMESH", "auto_update" );
3280 int qaGroup = addPreference( tr( "PREF_GROUP_QUALITY" ), genTab );
3281 setPreferenceProperty( qaGroup, "columns", 2 );
3282 addPreference( tr( "PREF_DISPLAY_ENTITY" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "display_entity" );
3283 addPreference( tr( "PREF_PRECISION_USE" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "use_precision" );
3285 int precGroup = addPreference( tr( "PREF_GROUP_PRECISION" ), genTab );
3286 setPreferenceProperty( precGroup, "columns", 2 );
3288 int prec = addPreference( tr( "PREF_PRECISION_VALUE" ), precGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_precision" );
3290 setPreferenceProperty( prec, "min", 0 );
3291 setPreferenceProperty( prec, "max", 16 );
3293 int dispgroup = addPreference( tr( "PREF_DISPLAY_MODE" ), genTab );
3294 setPreferenceProperty( dispgroup, "columns", 2 );
3295 int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), dispgroup, LightApp_Preferences::Selector, "SMESH", "display_mode" );
3297 modes.append( "Wireframe" );
3298 modes.append( "Shading" );
3299 modes.append( "Nodes" );
3300 modes.append( "Shrink" );
3301 QList<QVariant> indices;
3302 indices.append( 0 );
3303 indices.append( 1 );
3304 indices.append( 2 );
3305 indices.append( 3 );
3306 setPreferenceProperty( dispmode, "strings", modes );
3307 setPreferenceProperty( dispmode, "indexes", indices );
3309 int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
3310 setPreferenceProperty( exportgroup, "columns", 2 );
3311 addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" );
3312 addPreference( tr( "PREF_RENUMBER" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "renumbering" );
3314 int computeGroup = addPreference( tr( "PREF_GROUP_COMPUTE" ), genTab );
3315 setPreferenceProperty( computeGroup, "columns", 2 );
3316 int notifyMode = addPreference( tr( "PREF_NOTIFY_MODE" ), computeGroup, LightApp_Preferences::Selector, "SMESH", "show_result_notification" );
3318 modes.append( "Never" );
3319 modes.append( "Errors only" );
3320 modes.append( "Always" );
3322 indices.append( 0 );
3323 indices.append( 1 );
3324 indices.append( 2 );
3325 setPreferenceProperty( notifyMode, "strings", modes );
3326 setPreferenceProperty( notifyMode, "indexes", indices );
3328 int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
3329 int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
3330 setPreferenceProperty( nodeGroup, "columns", 2 );
3332 addPreference( tr( "PREF_COLOR" ), nodeGroup, LightApp_Preferences::Color, "SMESH", "node_color" );
3333 int nodeSz = addPreference( tr( "PREF_SIZE" ), nodeGroup, LightApp_Preferences::IntSpin, "SMESH", "node_size" );
3335 setPreferenceProperty( nodeSz, "min", 1 );
3336 setPreferenceProperty( nodeSz, "max", 5 );
3338 int elemGroup = addPreference( tr( "PREF_GROUP_ELEMENTS" ), meshTab );
3339 setPreferenceProperty( elemGroup, "columns", 2 );
3341 addPreference( tr( "PREF_FILL" ), elemGroup, LightApp_Preferences::Color, "SMESH", "fill_color" );
3342 addPreference( tr( "PREF_OUTLINE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "outline_color" );
3343 addPreference( tr( "PREF_BACKFACE" ), elemGroup, LightApp_Preferences::Color, "SMESH", "backface_color" );
3344 int sp = addPreference( "", elemGroup, LightApp_Preferences::Space );
3346 setPreferenceProperty( sp, "hstretch", 0 );
3347 setPreferenceProperty( sp, "vstretch", 0 );
3349 int elemW = addPreference( tr( "PREF_WIDTH" ), elemGroup, LightApp_Preferences::IntSpin, "SMESH", "element_width" );
3350 int shrink = addPreference( tr( "PREF_SHRINK_COEFF" ), elemGroup, LightApp_Preferences::IntSpin, "SMESH", "shrink_coeff" );
3352 setPreferenceProperty( elemW, "min", 1 );
3353 setPreferenceProperty( elemW, "max", 5 );
3355 setPreferenceProperty( shrink, "min", 0 );
3356 setPreferenceProperty( shrink, "max", 100 );
3358 int selTab = addPreference( tr( "PREF_TAB_SELECTION" ) );
3360 int selGroup = addPreference( tr( "PREF_GROUP_SELECTION" ), selTab );
3361 setPreferenceProperty( selGroup, "columns", 2 );
3363 addPreference( tr( "PREF_OBJECT_COLOR" ), selGroup, LightApp_Preferences::Color, "SMESH", "selection_object_color" );
3364 addPreference( tr( "PREF_ELEMENT_COLOR" ), selGroup, LightApp_Preferences::Color, "SMESH", "selection_element_color" );
3365 int selW = addPreference( tr( "PREF_WIDTH" ), selGroup, LightApp_Preferences::IntSpin, "SMESH", "selection_width" );
3367 setPreferenceProperty( selW, "min", 1 );
3368 setPreferenceProperty( selW, "max", 5 );
3370 int preGroup = addPreference( tr( "PREF_GROUP_PRESELECTION" ), selTab );
3371 setPreferenceProperty( preGroup, "columns", 2 );
3373 addPreference( tr( "PREF_HIGHLIGHT_COLOR" ), preGroup, LightApp_Preferences::Color, "SMESH", "highlight_color" );
3374 int preW = addPreference( tr( "PREF_WIDTH" ), preGroup, LightApp_Preferences::IntSpin, "SMESH", "highlight_width" );
3376 setPreferenceProperty( preW, "min", 1 );
3377 setPreferenceProperty( preW, "max", 5 );
3379 int precSelGroup = addPreference( tr( "PREF_GROUP_PRECISION" ), selTab );
3380 setPreferenceProperty( precSelGroup, "columns", 2 );
3382 addPreference( tr( "PREF_NODES" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_node" );
3383 addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_element" );
3384 addPreference( tr( "PREF_OBJECTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_object" );
3386 int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
3387 int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
3388 setPreferenceProperty( fontGr, "columns", 2 );
3390 int tfont = addPreference( tr( "SMESH_TITLE" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_title_font" );
3391 addPreference( tr( "PREF_TITLE_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_title_color" );
3392 int lfont = addPreference( tr( "SMESH_LABELS" ), fontGr, LightApp_Preferences::Font, "SMESH", "scalar_bar_label_font" );
3393 addPreference( tr( "PREF_LABELS_COLOR" ), fontGr, LightApp_Preferences::Color, "SMESH", "scalar_bar_label_color" );
3396 fam.append( tr( "SMESH_FONT_ARIAL" ) );
3397 fam.append( tr( "SMESH_FONT_COURIER" ) );
3398 fam.append( tr( "SMESH_FONT_TIMES" ) );
3399 int wflag = ( QtxFontEdit::Family | QtxFontEdit::Scripting );
3401 setPreferenceProperty( tfont, "families", fam );
3402 setPreferenceProperty( tfont, "system", false );
3403 setPreferenceProperty( tfont, "widget_flags", wflag );
3404 setPreferenceProperty( lfont, "families", fam );
3405 setPreferenceProperty( lfont, "system", false );
3406 setPreferenceProperty( lfont, "widget_flags", wflag );
3408 int colorsLabelsGr = addPreference( tr( "SMESH_LABELS_COLORS_SCALARBAR" ), sbarTab );
3409 setPreferenceProperty( colorsLabelsGr, "columns", 2 );
3411 int numcol = addPreference( tr( "SMESH_NUMBEROFCOLORS" ), colorsLabelsGr, LightApp_Preferences::IntSpin, "SMESH", "scalar_bar_num_colors" );
3412 setPreferenceProperty( numcol, "min", 2 );
3413 setPreferenceProperty( numcol, "max", 256 );
3415 int numlab = addPreference( tr( "SMESH_NUMBEROFLABELS" ), colorsLabelsGr, LightApp_Preferences::IntSpin, "SMESH", "scalar_bar_num_labels" );
3416 setPreferenceProperty( numlab, "min", 2 );
3417 setPreferenceProperty( numlab, "max", 65 );
3419 int orientGr = addPreference( tr( "SMESH_ORIENTATION" ), sbarTab );
3420 setPreferenceProperty( orientGr, "columns", 2 );
3421 int orient = addPreference( tr( "SMESH_ORIENTATION" ), orientGr, LightApp_Preferences::Selector, "SMESH", "scalar_bar_orientation" );
3422 QStringList orients;
3423 orients.append( tr( "SMESH_VERTICAL" ) );
3424 orients.append( tr( "SMESH_HORIZONTAL" ) );
3425 indices.clear(); indices.append( 0 ); indices.append( 1 );
3426 setPreferenceProperty( orient, "strings", orients );
3427 setPreferenceProperty( orient, "indexes", indices );
3429 int posVSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_VERTICAL" ), sbarTab );
3430 setPreferenceProperty( posVSizeGr, "columns", 2 );
3431 int xv = addPreference( tr( "SMESH_X_SCALARBAR" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_x" );
3432 int yv = addPreference( tr( "SMESH_Y_SCALARBAR" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_y" );
3433 int wv = addPreference( tr( "SMESH_WIDTH" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_width" );
3434 int hv = addPreference( tr( "SMESH_HEIGHT" ), posVSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_vertical_height" );
3435 setPreferenceProperty( xv, "step", 0.1 );
3436 setPreferenceProperty( xv, "min", 0.0 );
3437 setPreferenceProperty( xv, "max", 1.0 );
3438 setPreferenceProperty( yv, "step", 0.1 );
3439 setPreferenceProperty( yv, "min", 0.0 );
3440 setPreferenceProperty( yv, "max", 1.0 );
3441 setPreferenceProperty( wv, "step", 0.1 );
3442 setPreferenceProperty( wv, "min", 0.0 );
3443 setPreferenceProperty( wv, "max", 1.0 );
3444 setPreferenceProperty( hv, "min", 0.0 );
3445 setPreferenceProperty( hv, "max", 1.0 );
3446 setPreferenceProperty( hv, "step", 0.1 );
3448 int posHSizeGr = addPreference( tr( "SMESH_POSITION_SIZE_SCALARBAR" ) + " " + tr( "SMESH_HORIZONTAL" ), sbarTab );
3449 setPreferenceProperty( posHSizeGr, "columns", 2 );
3450 int xh = addPreference( tr( "SMESH_X_SCALARBAR" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_x" );
3451 int yh = addPreference( tr( "SMESH_Y_SCALARBAR" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_y" );
3452 int wh = addPreference( tr( "SMESH_WIDTH" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_width" );
3453 int hh = addPreference( tr( "SMESH_HEIGHT" ), posHSizeGr, LightApp_Preferences::DblSpin, "SMESH", "scalar_bar_horizontal_height" );
3454 setPreferenceProperty( xv, "min", 0.0 );
3455 setPreferenceProperty( xv, "max", 1.0 );
3456 setPreferenceProperty( xv, "step", 0.1 );
3457 setPreferenceProperty( xh, "min", 0.0 );
3458 setPreferenceProperty( xh, "max", 1.0 );
3459 setPreferenceProperty( xh, "step", 0.1 );
3460 setPreferenceProperty( yh, "min", 0.0 );
3461 setPreferenceProperty( yh, "max", 1.0 );
3462 setPreferenceProperty( yh, "step", 0.1 );
3463 setPreferenceProperty( wh, "min", 0.0 );
3464 setPreferenceProperty( wh, "max", 1.0 );
3465 setPreferenceProperty( wh, "step", 0.1 );
3466 setPreferenceProperty( hh, "min", 0.0 );
3467 setPreferenceProperty( hh, "max", 1.0 );
3468 setPreferenceProperty( hh, "step", 0.1 );
3471 void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
3473 if( sect=="SMESH" ){
3474 float sbX1,sbY1,sbW,sbH;
3475 float aTol = 1.00000009999999;
3476 std::string aWarning;
3477 SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
3478 if( name=="selection_object_color" || name=="selection_element_color" ||
3479 name=="selection_width" || name=="highlight_color" || name=="highlight_width" ||
3480 name=="selection_precision_node" || name=="selection_precision_element" ||
3481 name=="selection_precision_object")
3482 SMESH::UpdateSelectionProp( this );
3483 else if (name == QString("scalar_bar_vertical_x") || name == QString("scalar_bar_vertical_width")){
3484 sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1);
3485 sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW);
3486 if(sbX1+sbW > aTol){
3487 aWarning = "Origin and Size Vertical: X+Width > 1\n";
3490 aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
3491 aResourceMgr->setValue("SMESH", "scalar_bar_vertical_width", sbW);
3494 else if(name == QString("scalar_bar_vertical_y") || name == QString("scalar_bar_vertical_height")){
3495 sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_y", sbY1);
3496 sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_height",sbH);
3497 if(sbY1+sbH > aTol){
3498 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
3499 aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1);
3500 aResourceMgr->setValue("SMESH", "scalar_bar_vertical_height",sbH);
3503 else if(name == QString("scalar_bar_horizontal_x") || name == QString("scalar_bar_horizontal_width")){
3504 sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_x", sbX1);
3505 sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW);
3506 if(sbX1+sbW > aTol){
3507 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
3510 aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1);
3511 aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW);
3514 else if(name == QString("scalar_bar_horizontal_y") || name == QString("scalar_bar_horizontal_height")){
3515 sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_y", sbY1);
3516 sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_height",sbH);
3517 if(sbY1+sbH > aTol){
3518 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
3521 aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1);
3522 aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
3526 if(aWarning.size() != 0){
3527 aWarning += "The default values are applied instead.";
3528 SUIT_MessageBox::warning(SMESHGUI::desktop(),
3529 QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"),
3530 QObject::tr(aWarning.c_str()));
3535 //================================================================================
3537 * \brief Update something in accordance with update flags
3538 * \param theFlags - update flags
3540 * Update viewer or/and object browser etc. in accordance with update flags ( see
3541 * LightApp_UpdateFlags enumeration ).
3543 //================================================================================
3544 void SMESHGUI::update( const int flags )
3546 if ( flags & UF_Viewer | flags & UF_Forced )
3547 SMESH::UpdateView();
3549 SalomeApp_Module::update( flags );
3552 //================================================================================
3554 * \brief Set default selection mode
3556 * SLOT called when operation commited. Sets default selection mode
3558 //================================================================================
3559 void SMESHGUI::onOperationCommited( SUIT_Operation* )
3561 SVTK_ViewWindow* vtkWnd =
3562 dynamic_cast<SVTK_ViewWindow*>( application()->desktop()->activeWindow() );
3564 vtkWnd->SetSelectionMode( ActorSelection );
3567 //================================================================================
3569 * \brief Set default selection mode
3571 * SLOT called when operation aborted. Sets default selection mode
3573 //================================================================================
3574 void SMESHGUI::onOperationAborted( SUIT_Operation* )
3576 SVTK_ViewWindow* vtkWnd =
3577 dynamic_cast<SVTK_ViewWindow*>( application()->desktop()->activeWindow() );
3579 vtkWnd->SetSelectionMode( ActorSelection );
3582 //================================================================================
3584 * \brief Creates operation with given identifier
3585 * \param id - identifier of operation to be started
3586 * \return Pointer on created operation or NULL if operation is not created
3588 * Virtual method redefined from the base class creates operation with given id.
3589 * It is called called automatically from startOperation method of base class.
3591 //================================================================================
3592 LightApp_Operation* SMESHGUI::createOperation( const int id ) const
3594 LightApp_Operation* op = 0;
3595 // to do : create operation here
3598 case 701: // Compute mesh
3599 op = new SMESHGUI_ComputeOp();
3601 case 702: // Create mesh
3602 op = new SMESHGUI_MeshOp( true, true );
3604 case 703: // Create sub-mesh
3605 op = new SMESHGUI_MeshOp( true, false );
3607 case 704: // Edit mesh/sub-mesh
3608 op = new SMESHGUI_MeshOp( false );
3610 case 417: //convert to quadratic
3611 op = new SMESHGUI_ConvToQuadOp();
3613 case 4067: // make mesh pass through point
3614 op = new SMESHGUI_MakeNodeAtPointOp();
3621 op = SalomeApp_Module::createOperation( id );
3625 //================================================================================
3627 * \brief Stops current operations and starts a given one
3628 * \param id - The id of the operation to start
3630 //================================================================================
3632 void SMESHGUI::switchToOperation(int id)
3634 if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() )
3635 activeStudy()->abortAllOperations();
3636 startOperation( id );
3639 LightApp_Displayer* SMESHGUI::displayer()
3642 myDisplayer = new SMESHGUI_Displayer( getApp() );
3646 SALOMEDS::Color SMESHGUI::getUniqueColor( const QList<SALOMEDS::Color>& theReservedColors )
3649 int aTolerance = 64;
3650 int anIterations = 0;
3656 if( anIterations % aPeriod == 0 )
3659 if( aTolerance < 1 )
3662 //cout << "Iteration N" << anIterations << " (tolerance=" << aTolerance << ")"<< endl;
3664 aHue = (int)( 360.0 * rand() / RAND_MAX );
3665 //cout << "Hue = " << aHue << endl;
3667 //cout << "Auto colors : ";
3669 QList<SALOMEDS::Color>::const_iterator it = theReservedColors.constBegin();
3670 QList<SALOMEDS::Color>::const_iterator itEnd = theReservedColors.constEnd();
3671 for( ; it != itEnd; ++it )
3673 SALOMEDS::Color anAutoColor = *it;
3674 QColor aQColor( (int)( anAutoColor.R * 255.0 ), (int)( anAutoColor.G * 255.0 ), (int)( anAutoColor.B * 255.0 ) );
3677 aQColor.getHsv( &h, &s, &v );
3679 if( abs( h - aHue ) < aTolerance )
3682 //cout << "break (diff = " << abs( h - aHue ) << ")";
3692 //cout << "Hue of the returned color = " << aHue << endl;
3694 aColor.setHsv( aHue, 255, 255 );
3696 SALOMEDS::Color aSColor;
3697 aSColor.R = (double)aColor.red() / 255.0;
3698 aSColor.G = (double)aColor.green() / 255.0;
3699 aSColor.B = (double)aColor.blue() / 255.0;