Salome HOME
Fix for bug IPAL18578 (Qt4 porting: Menu - New Entity - Sketch: self activation of...
[modules/geom.git] / src / GEOMGUI / GeometryGUI.cxx
1 // GEOM GEOMGUI : GUI for Geometry component
2 //
3 // Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File   : GeometryGUI.cxx
23 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
24 //
25
26 #include "GeometryGUI.h"
27 #include "GEOMGUI_OCCSelector.h"
28 #include "GEOMGUI_Selection.h"
29 #include "GEOM_Displayer.h"
30
31 #include <SUIT_Desktop.h>
32 #include <SUIT_MessageBox.h>
33 #include <SUIT_ResourceMgr.h>
34 #include <SUIT_Session.h>
35 #include <SUIT_ViewManager.h>
36
37 #include <OCCViewer_ViewWindow.h>
38 #include <OCCViewer_ViewPort3d.h>
39 #include <OCCViewer_ViewModel.h>
40 #include <OCCViewer_ViewManager.h>
41
42 #include <SVTK_ViewWindow.h>
43 #include <SVTK_RenderWindowInteractor.h>
44 #include <SVTK_InteractorStyle.h>
45 #include <SVTK_ViewModel.h>
46
47 #include <SalomeApp_Application.h>
48 #include <LightApp_SelectionMgr.h>
49 #include <LightApp_VTKSelector.h>
50 #include <SalomeApp_Study.h>
51 #include <LightApp_Preferences.h>
52 #include <SALOME_LifeCycleCORBA.hxx>
53 #include <SALOME_ListIO.hxx>
54
55 // External includes
56 #include <QAction>
57 #include <QFileInfo>
58 #include <QString>
59 #include <QPainter>
60
61 #include <Prs3d_Drawer.hxx>
62 #include <Prs3d_IsoAspect.hxx>
63 #include <Aspect_TypeOfMarker.hxx>
64 #include <OSD_SharedLibrary.hxx>
65
66 #include <utilities.h>
67
68 #include <vtkCamera.h>
69 #include <vtkRenderer.h>
70
71 using namespace Qt;
72
73 extern "C" {
74   Standard_EXPORT CAM_Module* createModule() {
75     return new GeometryGUI();
76   }
77 }
78
79
80
81 GEOM::GEOM_Gen_var GeometryGUI::myComponentGeom = GEOM::GEOM_Gen::_nil();
82
83 GEOM::GEOM_Gen_var GeometryGUI::GetGeomGen()
84 {
85   // Bug 12290: exception in Mesh GUI on GEOMBase::GetShape() if Geometry GUI hasn't been loaded
86   if (CORBA::is_nil(myComponentGeom))
87     InitGeomGen();
88   return GeometryGUI::myComponentGeom;
89 }
90
91 bool GeometryGUI::InitGeomGen()
92 {
93   GeometryGUI aGG;
94   if( CORBA::is_nil( myComponentGeom ) ) return false;
95   return true;
96 }
97
98 //=======================================================================
99 // function : ClientSObjectToObject
100 // purpose  :
101 //=======================================================================
102 CORBA::Object_var GeometryGUI::ClientSObjectToObject (_PTR(SObject) theSObject)
103 {
104   _PTR(GenericAttribute) anAttr;
105   CORBA::Object_var anObj;
106   try {
107     std::string aValue = theSObject->GetIOR();
108     if (strcmp(aValue.c_str(), "") != 0) {
109       CORBA::ORB_ptr anORB = SalomeApp_Application::orb();
110       anObj = anORB->string_to_object(aValue.c_str());
111     }
112   } catch(...) {
113     INFOS("ClientSObjectToObject - Unknown exception was occured!!!");
114   }
115   return anObj._retn();
116 }
117
118 //=======================================================================
119 // function : ClientStudyToStudy
120 // purpose  :
121 //=======================================================================
122 SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy)
123 {
124   SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
125   CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager");
126   SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject);
127   int aStudyID = theStudy->StudyId();
128   SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(aStudyID);
129   return aDSStudy._retn();
130 }
131
132 //=======================================================================
133 // function : GeometryGUI::GeometryGUI()
134 // purpose  : Constructor
135 //=======================================================================
136 GeometryGUI::GeometryGUI() :
137   SalomeApp_Module( "GEOM" )
138 {
139   if ( CORBA::is_nil( myComponentGeom ) )
140   {
141     SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA( getApp()->namingService() );
142     Engines::Component_var comp = ls->FindOrLoad_Component( "FactoryServer", "GEOM" );
143     myComponentGeom  = GEOM::GEOM_Gen::_narrow( comp );
144   }
145
146   myState           = -1;
147   myActiveDialogBox = 0;
148   myFatherior       = "";
149
150   gp_Pnt origin = gp_Pnt(0., 0., 0.);
151   gp_Dir direction = gp_Dir(0., 0., 1.);
152   myWorkingPlane = gp_Ax3(origin, direction);
153
154   myDisplayer = 0;
155   myLocalSelectionMode = GEOM_ALLOBJECTS;
156 }
157
158 //=======================================================================
159 // function : GeometryGUI::~GeometryGUI()
160 // purpose  : Destructor
161 //=======================================================================
162 GeometryGUI::~GeometryGUI()
163 {
164   while (!myOCCSelectors.isEmpty())
165     delete myOCCSelectors.takeFirst();
166
167   while (!myVTKSelectors.isEmpty())
168     delete myVTKSelectors.takeFirst();
169 }
170
171 //=======================================================================
172 // function : GeometryGUI::getLibrary()
173 // purpose  : get or load GUI library by name [ internal ]
174 //=======================================================================
175 typedef GEOMGUI* (*LibraryGUI)( GeometryGUI* );
176 GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName )
177 {
178   if ( !myGUIMap.contains( libraryName ) ) {
179     // try to load library if it is not loaded yet
180     QString libs;
181 #ifndef WNT
182     libs = getenv( "LD_LIBRARY_PATH" );
183     if( !libs.isEmpty() ) {
184       QStringList dirList = libs.split( ":", QString::SkipEmptyParts ); // skip empty entries
185 #else
186     libs = getenv( "PATH" );
187     if( !libs.isEmpty() ) {
188       QStringList dirList = libs.split( ";", QString::SkipEmptyParts ); // skip empty entries
189 #endif
190       for( int i = dirList.count()-1; i >= 0; i-- ) {
191         QString dir = dirList[ i ];
192         QFileInfo fi( Qtx::addSlash( dirList[ i ] ) + libraryName );
193         if( fi.exists() ) {
194           OSD_SharedLibrary aSharedLibrary( fi.fileName().toLatin1().data() );
195           bool res = aSharedLibrary.DlOpen( OSD_RTLD_LAZY );
196           if( !res ) {
197             MESSAGE( "Can't open library : " << aSharedLibrary.DlError() );
198             continue; // continue search further
199           }
200           OSD_Function osdF = aSharedLibrary.DlSymb( "GetLibGUI" );
201           if ( osdF != NULL ) {
202             LibraryGUI func = (GEOMGUI* (*) (GeometryGUI*))osdF;
203             GEOMGUI* libGUI = (*func)(this);
204             if ( libGUI ) {
205               myGUIMap[ libraryName ] = libGUI;
206               break; // found and loaded!
207             }
208           }
209         }
210       }
211     }
212   }
213   if ( myGUIMap.contains( libraryName ) )
214     // library is successfully loaded
215     return myGUIMap[ libraryName ];
216   return 0;
217 }
218
219 //=======================================================================
220 // function : GeometryGUI::ActiveWorkingPlane()
221 // purpose  : Activate Working Plane View
222 //=======================================================================
223 void GeometryGUI::ActiveWorkingPlane()
224 {
225   gp_Dir DZ = myWorkingPlane.Direction();
226   gp_Dir DY = myWorkingPlane.YDirection();
227
228   SUIT_ViewWindow* window = application()->desktop()->activeWindow();
229   bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
230   bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
231
232   if( ViewOCC ) {
233     OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( window );
234     if ( vw ) {
235       Handle(V3d_View) view3d =  vw->getViewPort()->getView();
236
237       view3d->SetProj(DZ.X(), DZ.Y(), DZ.Z());
238       view3d->SetUp(DY.X(), DY.Y(), DY.Z());
239
240       vw->onViewFitAll();
241     }
242   }
243   else if( ViewVTK ) {
244     SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( window );
245     if ( vw ) {
246       vtkCamera* camera = vw->getRenderer()->GetActiveCamera();
247
248       camera->SetPosition(DZ.X(), DZ.Y(), DZ.Z());
249       camera->SetViewUp(DY.X(), DY.Y(), DY.Z());
250       camera->SetFocalPoint(0,0,0);
251
252       vw->onFitAll();
253     }
254   }
255 }
256
257 //=======================================================================
258 // function : GeometryGUI::SetActiveDialogBox()
259 // purpose  : Set active dialog box
260 //=======================================================================
261 void GeometryGUI::SetActiveDialogBox( QDialog* aDlg )
262 {
263   myActiveDialogBox = (QDialog*)aDlg;
264 }
265
266 //=======================================================================
267 // function : GeometryGUI::EmitSignalDeactivateDialog()
268 // purpose  : Emit a signal to deactivate the active dialog Box
269 //=======================================================================
270 void GeometryGUI::EmitSignalDeactivateDialog()
271 {
272   emit SignalDeactivateActiveDialog();
273 }
274
275 //=======================================================================
276 // function : GeometryGUI::EmitSignalCloseAllDialogs()
277 // purpose  : Emit a signal to close all non modal dialogs box
278 //=======================================================================
279 void GeometryGUI::EmitSignalCloseAllDialogs()
280 {
281   emit SignalCloseAllDialogs();
282 }
283
284 //=======================================================================
285 // function : GeometryGUI::EmitSignalDefaultStepValueChanged()
286 // purpose  : Emit a signal to inform that default real spin box step has
287 //            been changed
288 //=======================================================================
289 void GeometryGUI::EmitSignalDefaultStepValueChanged(double newVal)
290 {
291   emit SignalDefaultStepValueChanged(newVal);
292 }
293
294 //=======================================================================
295 // function : GeometryGUI::OnGUIEvent()
296 // purpose  : common slot for all menu/toolbar actions
297 //=======================================================================
298 void GeometryGUI::OnGUIEvent()
299 {
300   const QObject* obj = sender();
301   if ( !obj || !obj->inherits( "QAction" ) )
302     return;
303   int id = actionId((QAction*)obj);
304   if ( id != -1 )
305     OnGUIEvent( id );
306 }
307
308 //=======================================================================
309 // function : GeometryGUI::OnGUIEvent()
310 // purpose  : manage all events on GUI [static]
311 //=======================================================================
312 void GeometryGUI::OnGUIEvent( int id )
313 {
314   SUIT_Application* anApp = application();
315   if (!anApp) return;
316   SUIT_Desktop* desk = anApp->desktop();
317
318   // check type of the active viewframe
319   SUIT_ViewWindow* window = desk->activeWindow();
320   bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
321   bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
322   // if current viewframe is not of OCC and not of VTK type - return immediately
323   // fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example)
324   bool NotViewerDependentCommand = ( id == 901 || id == 216 || id == 213 );
325   if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommand )
326       return;
327
328   // fix for IPAL9103, point 2
329   if ( CORBA::is_nil( GetGeomGen() ) ) {
330     SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_GET_ENGINE" ), tr( "GEOM_BUT_OK" ) );
331     return;
332   }
333
334   GEOMGUI* library = 0;
335   // try to get-or-load corresponding GUI library
336   if( id == 111  ||  // MENU FILE - IMPORT BREP
337       id == 112  ||  // MENU FILE - IMPORT IGES
338       id == 113  ||  // MENU FILE - IMPORT STEP
339       id == 121  ||  // MENU FILE - EXPORT BREP
340       id == 122  ||  // MENU FILE - EXPORT IGES
341       id == 123  ||  // MENU FILE - EXPORT STEP
342       id == 2171 ||  // POPUP VIEWER - SELECT ONLY - VERTEX
343       id == 2172 ||  // POPUP VIEWER - SELECT ONLY - EDGE
344       id == 2173 ||  // POPUP VIEWER - SELECT ONLY - WIRE
345       id == 2174 ||  // POPUP VIEWER - SELECT ONLY - FACE
346       id == 2175 ||  // POPUP VIEWER - SELECT ONLY - SHELL
347       id == 2176 ||  // POPUP VIEWER - SELECT ONLY - SOLID
348       id == 2177 ||  // POPUP VIEWER - SELECT ONLY - COMPOUND
349       id == 2178 ||  // POPUP VIEWER - SELECT ONLY - SELECT ALL
350       id == 31   ||  // MENU EDIT - COPY
351       id == 33   ||  // MENU EDIT - DELETE
352       id == 411  ||  // MENU SETTINGS - ADD IN STUDY
353       id == 412  ||  // MENU SETTINGS - SHADING COLOR
354       id == 5103 ||  // MENU TOOLS - CHECK GEOMETRY
355       id == 8032 ||  // POPUP VIEWER - COLOR
356       id == 8033 ||  // POPUP VIEWER - TRANSPARENCY
357       id == 8034 ||  // POPUP VIEWER - ISOS
358       id == 8035 ||  // POPUP VIEWER - AUTO COLOR
359       id == 8036 ||  // POPUP VIEWER - DISABLE AUTO COLOR
360       id == 804  ||  // POPUP VIEWER - ADD IN STUDY
361       id == 901  ||  // OBJECT BROWSER - RENAME
362       id == 9024 ) { // OBJECT BROWSER - OPEN
363     //cout << "id " << id << " received" << endl;
364 #ifndef WNT
365         library = getLibrary( "libGEOMToolsGUI.so" );
366 #else
367         library = getLibrary( "GEOMToolsGUI.dll" );
368 #endif
369   }
370   else if( id == 211  ||  // MENU VIEW - WIREFRAME/SHADING
371            id == 212  ||  // MENU VIEW - DISPLAY ALL
372            id == 213  ||  // MENU VIEW - DISPLAY ONLY
373            id == 214  ||  // MENU VIEW - ERASE ALL
374            id == 215  ||  // MENU VIEW - ERASE
375            id == 216  ||  // MENU VIEW - DISPLAY
376            id == 80311 ||  // POPUP VIEWER - WIREFRAME
377            id == 80312 ) { // POPUP VIEWER - SHADING
378 #ifndef WNT
379         library = getLibrary( "libDisplayGUI.so" );
380 #else
381         library = getLibrary( "DisplayGUI.dll" );
382 #endif
383   }
384   else if( id == 4011 ||  // MENU BASIC - POINT
385            id == 4012 ||  // MENU BASIC - LINE
386            id == 4013 ||  // MENU BASIC - CIRCLE
387            id == 4014 ||  // MENU BASIC - ELLIPSE
388            id == 4015 ||  // MENU BASIC - ARC
389            id == 4016 ||  // MENU BASIC - VECTOR
390            id == 4017 ||  // MENU BASIC - PLANE
391            id == 4018 ||  // MENU BASIC - WPLANE
392            id == 4019 ||  // MENU BASIC - CURVE
393            id == 4020 ) { // MENU BASIC - REPAIR
394 #ifndef WNT
395         library = getLibrary( "libBasicGUI.so" );
396 #else
397         library = getLibrary( "BasicGUI.dll" );
398 #endif
399   }
400   else if( id == 4021 ||  // MENU PRIMITIVE - BOX
401            id == 4022 ||  // MENU PRIMITIVE - CYLINDER
402            id == 4023 ||  // MENU PRIMITIVE - SPHERE
403            id == 4024 ||  // MENU PRIMITIVE - TORUS
404            id == 4025 ) { // MENU PRIMITIVE - CONE
405 #ifndef WNT
406         library = getLibrary( "libPrimitiveGUI.so" );
407 #else
408         library = getLibrary( "PrimitiveGUI.dll" );
409 #endif
410   }
411   else if( id == 4031 ||  // MENU GENERATION - PRISM
412            id == 4032 ||  // MENU GENERATION - REVOLUTION
413            id == 4033 ||  // MENU GENERATION - FILLING
414            id == 4034 ) { // MENU GENERATION - PIPE
415 #ifndef WNT
416         library = getLibrary( "libGenerationGUI.so" );
417 #else
418         library = getLibrary( "GenerationGUI.dll" );
419 #endif
420   }
421   else if( id == 404 ||   // MENU ENTITY - SKETCHER
422            id == 407 ) {  // MENU ENTITY - EXPLODE
423 #ifndef WNT
424         library = getLibrary( "libEntityGUI.so" );
425 #else
426         library = getLibrary( "EntityGUI.dll" );
427 #endif
428   }
429   else if( id == 4081 ||  // MENU BUILD - EDGE
430            id == 4082 ||  // MENU BUILD - WIRE
431            id == 4083 ||  // MENU BUILD - FACE
432            id == 4084 ||  // MENU BUILD - SHELL
433            id == 4085 ||  // MENU BUILD - SOLID
434            id == 4086 ) { // MENU BUILD - COMPUND
435 #ifndef WNT
436         library = getLibrary( "libBuildGUI.so" );
437 #else
438         library = getLibrary( "BuildGUI.dll" );
439 #endif
440   }
441   else if( id == 5011 ||  // MENU BOOLEAN - FUSE
442            id == 5012 ||  // MENU BOOLEAN - COMMON
443            id == 5013 ||  // MENU BOOLEAN - CUT
444            id == 5014 ) { // MENU BOOLEAN - SECTION
445 #ifndef WNT
446         library = getLibrary( "libBooleanGUI.so" );
447 #else
448         library = getLibrary( "BooleanGUI.dll" );
449 #endif
450   }
451   else if( id == 5021 ||  // MENU TRANSFORMATION - TRANSLATION
452            id == 5022 ||  // MENU TRANSFORMATION - ROTATION
453            id == 5023 ||  // MENU TRANSFORMATION - LOCATION
454            id == 5024 ||  // MENU TRANSFORMATION - MIRROR
455            id == 5025 ||  // MENU TRANSFORMATION - SCALE
456            id == 5026 ||  // MENU TRANSFORMATION - OFFSET
457            id == 5027 ||  // MENU TRANSFORMATION - MULTI-TRANSLATION
458            id == 5028 ) { // MENU TRANSFORMATION - MULTI-ROTATION
459 #ifndef WNT
460         library = getLibrary( "libTransformationGUI.so" );
461 #else
462         library = getLibrary( "TransformationGUI.dll" );
463 #endif
464   }
465   else if( id == 503 ||   // MENU OPERATION - PARTITION
466            id == 504 ||   // MENU OPERATION - ARCHIMEDE
467            id == 505 ||   // MENU OPERATION - FILLET
468            id == 506 ||   // MENU OPERATION - CHAMFER
469            id == 507 ) {  // MENU OPERATION - CLIPPING RANGE
470 #ifndef WNT
471         library = getLibrary( "libOperationGUI.so" );
472 #else
473         library = getLibrary( "OperationGUI.dll" );
474 #endif
475   }
476   else if( id == 601 ||   // MENU REPAIR - SEWING
477            id == 603 ||   // MENU REPAIR - SUPPRESS FACES
478            id == 604 ||   // MENU REPAIR - SUPPRESS HOLE
479            id == 605 ||   // MENU REPAIR - SHAPE PROCESSING
480            id == 606 ||   // MENU REPAIR - CLOSE CONTOUR
481            id == 607 ||   // MENU REPAIR - REMOVE INTERNAL WIRES
482            id == 608 ||   // MENU REPAIR - ADD POINT ON EDGE
483            id == 609 ||   // MENU MEASURE - FREE BOUNDARIES
484            id == 610 ||   // MENU MEASURE - FREE FACES
485            id == 611 ||   // MENU REPAIR - CHANGE ORIENTATION
486            id == 602 ||   // MENU REPAIR - GLUE FACES
487            id == 612 ) {  // MENU REPAIR - REMOVE EXTRA EDGES
488 #ifndef WNT
489         library = getLibrary( "libRepairGUI.so" );
490 #else
491         library = getLibrary( "RepairGUI.dll" );
492 #endif
493   }
494   else if( id == 701   ||  // MENU MEASURE - PROPERTIES
495            id == 702   ||  // MENU MEASURE - CDG
496            id == 703   ||  // MENU MEASURE - INERTIA
497            id == 704   ||  // MENU MEASURE - NORMALE
498            id == 7041  ||  // MENU MEASURE - BOUNDING BOX
499            id == 7042  ||  // MENU MEASURE - MIN DISTANCE
500            id == 7043  ||  // MENU MEASURE - ANGLE
501            id == 705   ||  // MENU MEASURE - TOLERANCE
502            id == 706   ||  // MENU MEASURE - WHATIS
503            id == 707   ||  // MENU MEASURE - CHECK
504            id == 7072  ||  // MENU MEASURE - CHECK COMPOUND OF BLOCKS
505            id == 708 ) {  // MENU MEASURE - POINT COORDINATES
506 #ifndef WNT
507         library = getLibrary( "libMeasureGUI.so" );
508 #else
509         library = getLibrary( "MeasureGUI.dll" );
510 #endif
511   }
512   else if( id == 800  ||  // MENU GROUP - CREATE
513            id == 8001 ||  // POPUP MENU - CREATE GROUP
514            id == 801 ) {  // MENU GROUP - EDIT
515 #ifndef WNT
516         library = getLibrary( "libGroupGUI.so" );
517 #else
518         library = getLibrary( "GroupGUI.dll" );
519 #endif
520   }
521   else if( id == 9999  ||  // MENU BLOCKS - HEXAHEDRAL SOLID
522            id == 9998  ||  // MENU BLOCKS - MULTI-TRANSFORMATION
523            id == 9997  ||  // MENU BLOCKS - QUADRANGLE FACE
524            id == 99991 ||  // MENU BLOCKS - PROPAGATE
525            id == 9995 ) { // MENU BLOCKS - EXPLODE ON BLOCKS
526 #ifndef WNT
527         library = getLibrary( "libBlocksGUI.so" );
528 #else
529         library = getLibrary( "BlocksGUI.dll" );
530 #endif
531   }
532
533   // call method of corresponding GUI library
534   if ( library )
535     library->OnGUIEvent( id, desk );
536   else
537     SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) );
538 }
539
540
541 //=================================================================================
542 // function : GeometryGUI::OnKeyPress()
543 // purpose  : Called when any key is pressed by user [static]
544 //=================================================================================
545 void GeometryGUI::OnKeyPress( SUIT_ViewWindow* win, QKeyEvent* pe )
546 {
547   GUIMap::Iterator it;
548   bool bOk = true;
549   for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) {
550     SUIT_Application* anApp = application();
551     if (!anApp) return;
552     bOk = bOk && it.value()->OnKeyPress( pe, anApp->desktop(), win );
553   }
554 //  return bOk;
555 }
556
557
558 //=================================================================================
559 // function : GeometryGUI::OnMouseMove()
560 // purpose  : Manages mouse move events [static]
561 //=================================================================================
562 void GeometryGUI::OnMouseMove( SUIT_ViewWindow* win, QMouseEvent* pe )
563 {
564   GUIMap::Iterator it;
565   bool bOk = true;
566   for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) {
567     SUIT_Application* anApp = application();
568     if (!anApp) return;
569     bOk = bOk && it.value()->OnMouseMove( pe, anApp->desktop(), win );
570   }
571 //  return bOk;
572 }
573
574
575 //=================================================================================
576 // function : GeometryGUI::0nMousePress()
577 // purpose  : Manage mouse press events [static]
578 //=================================================================================
579 void GeometryGUI::OnMousePress( SUIT_ViewWindow* win, QMouseEvent* pe )
580 {
581   GUIMap::Iterator it;
582   // OnMousePress() should return false if this event should be processed further
583   // (see OCCViewer_Viewer3d::onMousePress() for explanation)
584   bool processed = false;
585   for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) {
586     SUIT_Application* anApp = application();
587     if (!anApp) return;
588     processed = processed || it.value()->OnMousePress( pe, anApp->desktop(), win );
589   }
590 //  return processed;
591 }
592
593 /*
594 static void UpdateVtkSelection()
595 {
596   QPtrList<SUIT_ViewWindow> winList = application()->desktop()->windows();
597   SUIT_ViewWindow* win = 0;
598   for ( win = winList.first(); win; win = winList.next() ) {
599     if ( win->getViewManager()->getTypeView() == VIEW_VTK ) {
600       SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( window );
601       if ( vw ) {
602         SVTK_RenderWindowInteractor* anInteractor = vw->getRWInteractor();
603         anInteractor->SetSelectionProp();
604         anInteractor->SetSelectionTolerance();
605         SVTK_InteractorStyleSALOME* aStyle = anInteractor->GetInteractorStyleSALOME();
606         if (aStyle) {
607           aStyle->setPreselectionProp();
608         }
609       }
610     }
611   }
612 }
613
614 //=================================================================================
615 // function : GeometryGUI::SetSettings()
616 // purpose  : Called when GEOM module is activated [static]
617 //=================================================================================
618 bool GeometryGUI::SetSettings()
619 {
620   QMenuBar*     Mb = parent->getMainMenuBar();
621   SUIT_Study*   ActiveStudy = application()->activeStudy();
622
623 // Wireframe or Shading
624   int DisplayMode = 0;
625   SUIT_ViewWindow* window = application()->desktop()->activeWindow();
626   bool ViewOCC = ( window && window->getViewManager()->getType() == VIEW_OCC );
627   bool ViewVTK = ( window && window->getViewManager()->getType() == VIEW_VTK );
628   if ( ViewOCC ) {
629     OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( window->getViewManager() );
630     if ( vm ) {
631       Handle(AIS_InteractiveContext) ic = vm->getOCCViewer()->getAISContext();
632       DisplayMode = ic->DisplayMode();
633     }
634   }
635   else if ( ViewVTK ) {
636     SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( window );
637     if ( vw ) {
638       SVTK_RenderWindowInteractor* myRenderInter = vw->getRWInteractor();
639       DisplayMode = myRenderInter->GetDisplayMode();
640     }
641   }
642
643   if( DisplayMode == 1 )
644     getApp()->
645     Mb->changeItem( 211, tr( "GEOM_MEN_WIREFRAME" ) );
646   else
647     Mb->changeItem( 211, tr( "GEOM_MEN_SHADING" ) );
648
649
650   // Add in Study  - !!!ALWAYS TRUE!!! /////// VSR : TO BE REMOVED
651   QString AddInStudy = QAD_CONFIG->getSetting("Geometry:SettingsAddInStudy");
652   int Settings_AddInStudy;
653   //  if(!AddInStudy.isEmpty())
654   //    Settings_AddInStudy = AddInStudy.toInt();
655   //  else
656
657   Settings_AddInStudy = 1;
658   Mb->setItemChecked(411, Settings_AddInStudy);
659
660   // step value
661   QString S = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
662   if(S.isEmpty())
663     QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", "100");
664
665   // isos
666   int count = ActiveStudy->getStudyFramesCount();
667   for(int i = 0; i < count; i++) {
668     if(ActiveStudy->getStudyFrame(i)->getTypeView() == VIEW_OCC) {
669       OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)ActiveStudy->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer();
670       Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
671
672       QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
673       QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
674       if(!IsoU.isEmpty())
675         ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt());
676       if(!IsoV.isEmpty())
677         ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt());
678     }
679   }
680
681   setActionsEnabled();
682
683   // PAL5356: update VTK selection
684   ::UpdateVtkSelection();
685   bool bOk = true;
686   GUIMap::Iterator it;
687   for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
688     bOk = bOk && it.data()->SetSettings( parent );
689
690   // MZN: Enable/disable "Clipping range" menu item(from GEOM_CLIPPING variable)
691   if (getenv( "GEOM_CLIPPING" ) == NULL)
692     {
693       QMenuItem* mi = Mb->findItem(50);
694       if (mi && mi->popup())
695       mi->popup()->removeItem(507);
696     }
697
698   return bOk;
699 }
700 */
701
702 //=======================================================================
703 // function : createGeomAction
704 // purpose  :
705 //=======================================================================
706 void GeometryGUI::createGeomAction( const int id, const QString& po_id, const QString& icon_id, const int key, const bool toggle  )
707 {
708   QIcon icon;
709   QWidget* parent = application()->desktop();
710   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
711   QPixmap pix;
712   if ( icon_id.length() )
713     pix = resMgr->loadPixmap( "GEOM", tr( icon_id.toLatin1().constData() ) );
714   else
715     pix = resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+po_id).toLatin1().constData() ), false );
716   if ( !pix.isNull() )
717     icon = QIcon( pix );
718
719   QString tooltip    = tr( (QString( "TOP_" )+po_id).toLatin1().constData() ),
720           menu       = tr( (QString( "MEN_" )+po_id).toLatin1().constData() ),
721           status_bar = tr( (QString( "STB_" )+po_id).toLatin1().constData() );
722
723   createAction( id, tooltip, icon, menu, status_bar, key, parent, toggle, this, SLOT( OnGUIEvent() )  );
724 }
725
726
727
728 //=======================================================================
729 // function : GeometryGUI::initialize()
730 // purpose  : Called when GEOM module is created
731 //=======================================================================
732 void GeometryGUI::initialize( CAM_Application* app )
733 {
734   SalomeApp_Module::initialize( app );
735
736   // ----- create actions --------------
737
738   createGeomAction( 111, "IMPORT", "", (CTRL + Key_I) );
739   createGeomAction( 121, "EXPORT", "", (CTRL + Key_E) );
740
741   createGeomAction( 33, "DELETE", "", Qt::Key_Delete );
742
743   createGeomAction( 4011, "POINT" );
744   createGeomAction( 4012, "LINE" );
745   createGeomAction( 4013, "CIRCLE" );
746   createGeomAction( 4014, "ELLIPSE" );
747   createGeomAction( 4015, "ARC" );
748   createGeomAction( 4019, "CURVE" );
749   createGeomAction( 4016, "VECTOR" );
750   createGeomAction( 4017, "PLANE" );
751   createGeomAction( 4018, "WORK_PLANE" );
752   createGeomAction( 4020, "LOCAL_CS" );
753
754   createGeomAction( 4021, "BOX" );
755   createGeomAction( 4022, "CYLINDER" );
756   createGeomAction( 4023, "SPHERE" );
757   createGeomAction( 4024, "TORUS" );
758   createGeomAction( 4025, "CONE" );
759
760   createGeomAction( 4031, "EXTRUSION" );
761   createGeomAction( 4032, "REVOLUTION" );
762   createGeomAction( 4033, "FILLING" );
763   createGeomAction( 4034, "PIPE" );
764
765   createGeomAction( 800, "GROUP_CREATE" );
766   createGeomAction( 801, "GROUP_EDIT" );
767
768   createGeomAction( 9997, "Q_FACE" );
769   createGeomAction( 9999, "HEX_SOLID" );
770
771   createGeomAction( 404, "SKETCH" );
772   createGeomAction( 407, "EXPLODE" );
773
774   createGeomAction( 4081, "EDGE" );
775   createGeomAction( 4082, "WIRE" );
776   createGeomAction( 4083, "FACE" );
777   createGeomAction( 4084, "SHELL" );
778   createGeomAction( 4085, "SOLID" );
779   createGeomAction( 4086, "COMPOUND" );
780
781   createGeomAction( 5011, "FUSE" );
782   createGeomAction( 5012, "COMMON" );
783   createGeomAction( 5013, "CUT" );
784   createGeomAction( 5014, "SECTION" );
785
786   createGeomAction( 5021, "TRANSLATION" );
787   createGeomAction( 5022, "ROTATION" );
788   createGeomAction( 5023, "MODIFY_LOCATION" );
789   createGeomAction( 5024, "MIRROR" );
790   createGeomAction( 5025, "SCALE" );
791   createGeomAction( 5026, "OFFSET" );
792   createGeomAction( 5027, "MUL_TRANSLATION" );
793   createGeomAction( 5028, "MUL_ROTATION" );
794
795   createGeomAction( 503, "PARTITION" );
796   createGeomAction( 504, "ARCHIMEDE" );
797   createGeomAction( 505, "FILLET" );
798   createGeomAction( 506, "CHAMFER" );
799   //createGeomAction( 507, "CLIPPING" );
800
801   createGeomAction( 9998, "MUL_TRANSFORM" );
802   createGeomAction( 9995, "EXPLODE_BLOCKS" );
803   createGeomAction( 99991, "PROPAGATE" );
804
805   createGeomAction( 601, "SEWING" );
806   createGeomAction( 602, "GLUE_FACES" );
807   createGeomAction( 603, "SUPPRESS_FACES" );
808   createGeomAction( 604, "SUPPERSS_HOLES" );
809   createGeomAction( 605, "SHAPE_PROCESS" );
810   createGeomAction( 606, "CLOSE_CONTOUR" );
811   createGeomAction( 607, "SUPPRESS_INT_WIRES" );
812   createGeomAction( 608, "POINT_ON_EDGE" );
813   createGeomAction( 609, "CHECK_FREE_BNDS" );
814   createGeomAction( 610, "CHECK_FREE_FACES" );
815   createGeomAction( 611, "CHANGE_ORIENTATION" );
816   createGeomAction( 612, "REMOVE_EXTRA_EDGES" );
817
818   createGeomAction( 708, "POINT_COORDS" );
819   createGeomAction( 701, "BASIC_PROPS" );
820   createGeomAction( 702, "MASS_CENTER" );
821   createGeomAction( 703, "INERTIA" );
822   createGeomAction( 704, "NORMALE" );
823   createGeomAction( 7041, "BND_BOX" );
824   createGeomAction( 7042, "MIN_DIST" );
825   createGeomAction( 7043, "MEASURE_ANGLE" );
826
827   createGeomAction( 705, "TOLERANCE" );
828   createGeomAction( 706, "WHAT_IS" );
829   createGeomAction( 707, "CHECK" );
830   createGeomAction( 7072, "CHECK_COMPOUND" );
831
832 #ifdef _DEBUG_ // PAL16821
833   createGeomAction( 5103, "CHECK_GEOMETRY" );
834 #endif
835   createGeomAction( 412, "SHADING_COLOR" );
836
837   createGeomAction( 211, "SHADING" );
838   createGeomAction( 212, "DISPLAY_ALL" );
839   createGeomAction( 214, "ERASE_ALL" );
840   createGeomAction( 216, "DISPLAY" );
841   createGeomAction( 2171, "VERTEX_SEL_ONLY" ,"", 0, true );
842   createGeomAction( 2172, "EDGE_SEL_ONLY", "", 0, true );
843   createGeomAction( 2173, "WIRE_SEL_ONLY", "",  0, true );
844   createGeomAction( 2174, "FACE_SEL_ONLY", "", 0, true );
845   createGeomAction( 2175, "SHELL_SEL_ONLY", "",  0, true );
846   createGeomAction( 2176, "SOLID_SEL_ONLY", "", 0, true );
847   createGeomAction( 2177, "COMPOUND_SEL_ONLY", "",  0, true );
848   createGeomAction( 2178, "ALL_SEL_ONLY", "",  0, true );
849   createGeomAction( 213, "DISPLAY_ONLY" );
850   createGeomAction( 215, "ERASE" );
851
852   createGeomAction( 901, "POP_RENAME", "", Qt::Key_F2 );
853   createGeomAction( 80311, "POP_WIREFRAME", "", 0, true );
854   createGeomAction( 80312, "POP_SHADING", "", 0, true );
855   createGeomAction( 8032, "POP_COLOR" );
856   createGeomAction( 8033, "POP_TRANSPARENCY" );
857   createGeomAction( 8034, "POP_ISOS" );
858   createGeomAction( 8035, "POP_AUTO_COLOR" );
859   createGeomAction( 8036, "POP_DISABLE_AUTO_COLOR" );
860   createGeomAction( 8001, "POP_CREATE_GROUP" );
861
862   // make wireframe-shading items to be exclusive (only one at a time is selected)
863   //QActionGroup* dispModeGr = new QActionGroup( this, "", true );
864   //dispModeGr->add( action( 80311 ) );
865   //dispModeGr->add( action( 80312 ) );
866   // ---- create menu --------------------------
867
868   int fileId = createMenu( tr( "MEN_FILE" ), -1, -1 );
869   createMenu( separator(), fileId, 10 );
870   createMenu( 111, fileId, 10 );
871   createMenu( 121, fileId, 10 );
872   createMenu( separator(), fileId, -1 );
873
874   int editId = createMenu( tr( "MEN_EDIT" ), -1, -1 );
875   createMenu( 33, editId, -1 );
876
877   int newEntId = createMenu( tr( "MEN_NEW_ENTITY" ), -1, -1, 10 );
878
879   int basicId = createMenu( tr( "MEN_BASIC" ), newEntId, -1 );
880   createMenu( 4011, basicId, -1 );
881   createMenu( 4012, basicId, -1 );
882   createMenu( 4013, basicId, -1 );
883   createMenu( 4014, basicId, -1 );
884   createMenu( 4015, basicId, -1 );
885   createMenu( 4019, basicId, -1 );
886   createMenu( separator(), basicId, -1 );
887   createMenu( 4016, basicId, -1 );
888   createMenu( 4017, basicId, -1 );
889   createMenu( 4018, basicId, -1 );
890   createMenu( 4020, basicId, -1 );
891
892   int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 );
893   createMenu( 4021, primId, -1 );
894   createMenu( 4022, primId, -1 );
895   createMenu( 4023, primId, -1 );
896   createMenu( 4024, primId, -1 );
897   createMenu( 4025, primId, -1 );
898
899   int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 );
900   createMenu( 4031, genId, -1 );
901   createMenu( 4032, genId, -1 );
902   createMenu( 4033, genId, -1 );
903   createMenu( 4034, genId, -1 );
904   createMenu( separator(), newEntId, -1 );
905
906   int groupId = createMenu( tr( "MEN_GROUP" ), newEntId, -1 );
907   createMenu( 800, groupId, -1 );
908   createMenu( 801, groupId, -1 );
909   createMenu( separator(), newEntId, -1 );
910
911   int blocksId = createMenu( tr( "MEN_BLOCKS" ), newEntId, -1 );
912   createMenu( 9997, blocksId, -1 );
913   createMenu( 9999, blocksId, -1 );
914
915   createMenu( separator(), newEntId, -1 );
916   createMenu( 404, newEntId, -1 );
917   createMenu( separator(), newEntId, -1 );
918   createMenu( 407, newEntId, -1 );
919
920   int buildId = createMenu( tr( "MEN_BUILD" ), newEntId, -1 );
921   createMenu( 4081, buildId, -1 );
922   createMenu( 4082, buildId, -1 );
923   createMenu( 4083, buildId, -1 );
924   createMenu( 4084, buildId, -1 );
925   createMenu( 4085, buildId, -1 );
926   createMenu( 4086, buildId, -1 );
927
928   int operId = createMenu( tr( "MEN_OPERATIONS" ), -1, -1, 10 );
929
930   int boolId = createMenu( tr( "MEN_BOOLEAN" ), operId, -1 );
931   createMenu( 5011, boolId, -1 );
932   createMenu( 5012, boolId, -1 );
933   createMenu( 5013, boolId, -1 );
934   createMenu( 5014, boolId, -1 );
935
936   int transId = createMenu( tr( "MEN_TRANSFORMATION" ), operId, -1 );
937   createMenu( 5021, transId, -1 );
938   createMenu( 5022, transId, -1 );
939   createMenu( 5023, transId, -1 );
940   createMenu( 5024, transId, -1 );
941   createMenu( 5025, transId, -1 );
942   createMenu( 5026, transId, -1 );
943   createMenu( separator(), transId, -1 );
944   createMenu( 5027, transId, -1 );
945   createMenu( 5028, transId, -1 );
946
947   createMenu( 503, operId, -1 );
948   createMenu( 504, operId, -1 );
949   createMenu( separator(), operId, -1 );
950   createMenu( 505, transId, -1 );
951   createMenu( 506, transId, -1 );
952   //createMenu( 507, transId, -1 );
953
954   int blockId = createMenu( tr( "MEN_BLOCKS" ), operId, -1 );
955   createMenu( 9998, blockId, -1 );
956   createMenu( 9995, blockId, -1 );
957   createMenu( 99991, blockId, -1 );
958
959   int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 );
960   createMenu( 605, repairId, -1 );
961   createMenu( 603, repairId, -1 );
962   createMenu( 606, repairId, -1 );
963   createMenu( 607, repairId, -1 );
964   createMenu( 604, repairId, -1 );
965   createMenu( 601, repairId, -1 );
966   createMenu( 602, repairId, -1 );
967   createMenu( 608, repairId, -1 );
968   //createMenu( 609, repairId, -1 );
969   //createMenu( 610, repairId, -1 );
970   createMenu( 611, repairId, -1 );
971   createMenu( 612, repairId, -1 );
972
973   int measurId = createMenu( tr( "MEN_MEASURES" ), -1, -1, 10 );
974   createMenu( 708, measurId, -1 );
975   createMenu( 701, measurId, -1 );
976   createMenu( separator(), measurId, -1 );
977   createMenu( 702, measurId, -1 );
978   createMenu( 703, measurId, -1 );
979   createMenu( 704, measurId, -1 );
980   // NPAL16572: move "Check free boundaries" and "Check free faces" from "Repair" to "Measure"
981   createMenu( separator(), measurId, -1 );
982   createMenu( 609, measurId, -1 );
983   createMenu( 610, measurId, -1 );
984   // NPAL16572 END
985   createMenu( separator(), measurId, -1 );
986
987   int dimId = createMenu( tr( "MEN_DIMENSIONS" ), measurId, -1 );
988   createMenu( 7041, dimId, -1 );
989   createMenu( 7042, dimId, -1 );
990   createMenu( 7043, dimId, -1 );
991   createMenu( separator(), measurId, -1 );
992
993   createMenu( 705, measurId, -1 );
994   createMenu( separator(), measurId, -1 );
995   createMenu( 706, measurId, -1 );
996   createMenu( 707, measurId, -1 );
997   createMenu( 7072, measurId, -1 );
998
999 #ifdef _DEBUG_ // PAL16821
1000   int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
1001   createMenu( separator(), toolsId, -1 );
1002   createMenu( 5103, toolsId, -1 );
1003 #endif
1004   //int prefId = createMenu( tr( "MEN_PREFERENCES" ), -1, -1, 50 );
1005   //createMenu( separator(), prefId, -1 );
1006   //int geomId = createMenu( tr( "MEN_PREFERENCES_GEOM" ), prefId, -1 );
1007   //createMenu( 412, geomId, -1 );
1008   //createMenu( separator(), prefId, -1 );
1009
1010   int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 );
1011   createMenu( separator(), viewId, -1 );
1012
1013   int dispmodeId = createMenu( tr( "MEN_DISPLAY_MODE" ), viewId, -1 );
1014   createMenu( 211, dispmodeId, -1 );
1015
1016   createMenu( separator(), viewId, -1 );
1017   createMenu( 212, viewId, -1 );
1018   createMenu( 214, viewId, -1 );
1019   createMenu( separator(), viewId, -1 );
1020
1021 /*
1022   PAL9111:
1023   because of these items are accessible through object browser and viewers
1024   we have removed they from main menu
1025
1026   createMenu( 216, viewId, -1 );
1027   createMenu( 213, viewId, -1 );
1028   createMenu( 215, viewId, -1 );
1029 */
1030
1031   // ---- create toolbars --------------------------
1032
1033   int basicTbId = createTool( tr( "TOOL_BASIC" ) );
1034   createTool( 4011, basicTbId );
1035   createTool( 4012, basicTbId );
1036   createTool( 4013, basicTbId );
1037   createTool( 4014, basicTbId );
1038   createTool( 4015, basicTbId );
1039   createTool( 4019, basicTbId );
1040   createTool( 4016, basicTbId );
1041   createTool( 4017, basicTbId );
1042   createTool( 4018, basicTbId );
1043   createTool( 4020, basicTbId );
1044
1045   int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) );
1046   createTool( 4021, primTbId );
1047   createTool( 4022, primTbId );
1048   createTool( 4023, primTbId );
1049   createTool( 4024, primTbId );
1050   createTool( 4025, primTbId );
1051
1052   int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) );
1053   createTool( 5011, boolTbId );
1054   createTool( 5012, boolTbId );
1055   createTool( 5013, boolTbId );
1056   createTool( 5014, boolTbId );
1057
1058   int genTbId = createTool( tr( "TOOL_GENERATION" ) );
1059   createTool( 4031, genTbId );
1060   createTool( 4032, genTbId );
1061   createTool( 4033, genTbId );
1062   createTool( 4034, genTbId );
1063
1064   int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ) );
1065   createTool( 5021, transTbId );
1066   createTool( 5022, transTbId );
1067   createTool( 5023, transTbId );
1068   createTool( 5024, transTbId );
1069   createTool( 5025, transTbId );
1070   createTool( 5026, transTbId );
1071   createTool( separator(), transTbId );
1072   createTool( 5027, transTbId );
1073   createTool( 5028, transTbId );
1074
1075   // ---- create popup menus --------------------------
1076
1077   QString clientOCCorVTK = "(client='OCCViewer' or client='VTKViewer')";
1078   QString clientOCCorVTK_AndSomeVisible = clientOCCorVTK + " and selcount>0 and isVisible";
1079
1080   QString clientOCCorVTKorOB = "(client='ObjectBrowser' or client='OCCViewer' or client='VTKViewer')";
1081   QString clientOCCorVTKorOB_AndSomeVisible = clientOCCorVTKorOB + " and selcount>0 and isVisible";
1082
1083   QString autoColorPrefix =
1084     "(client='ObjectBrowser' or client='OCCViewer') and type='Shape' and selcount=1 and isOCC=true";
1085
1086   QtxPopupMgr* mgr = popupMgr();
1087   mgr->insert( action(  901 ), -1, -1 );  // rename
1088   mgr->setRule( action( 901 ), QString("$type in {'Shape' 'Group'} and selcount=1"), QtxPopupMgr::VisibleRule );
1089   mgr->insert( action(   33 ), -1, -1 );  // delete
1090   mgr->setRule( action(  33 ), QString("$type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule );
1091   mgr->insert( action(  8001 ), -1, -1 ); // create group
1092   mgr->setRule( action( 8001 ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
1093   mgr->insert( action(  801 ), -1, -1 );  // edit group
1094   mgr->setRule( action( 801 ),  QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
1095   mgr->insert( separator(), -1, -1 );     // -----------
1096   dispmodeId = mgr->insert(  tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu
1097   mgr->insert( action(  80311 ), dispmodeId, -1 ); // wireframe
1098   mgr->setRule( action( 80311 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
1099   mgr->setRule( action( 80311 ), clientOCCorVTK + " and displaymode='Wireframe'", QtxPopupMgr::ToggleRule );
1100   mgr->insert( action(  80312 ), dispmodeId, -1 ); // shading
1101   mgr->setRule( action( 80312 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
1102   mgr->setRule( action( 80312 ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule );
1103   mgr->insert( separator(), -1, -1 );     // -----------
1104   mgr->insert( action(  8032 ), -1, -1 ); // color
1105   mgr->setRule( action( 8032 ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
1106   mgr->insert( action(  8033 ), -1, -1 ); // transparency
1107   mgr->setRule( action( 8033 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
1108   mgr->insert( action(  8034 ), -1, -1 ); // isos
1109   mgr->setRule( action( 8034 ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
1110   mgr->insert( separator(), -1, -1 );     // -----------
1111   mgr->insert( action(  8035 ), -1, -1 ); // auto color
1112   mgr->setRule( action( 8035 ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule );
1113   mgr->insert( action(  8036 ), -1, -1 ); // disable auto color
1114   mgr->setRule( action( 8036 ), autoColorPrefix + " and isAutoColor=true", QtxPopupMgr::VisibleRule );
1115   mgr->insert( separator(), -1, -1 );     // -----------
1116
1117
1118   QString canDisplay = "($component={'GEOM'}) and (selcount>0) and ({true} in $canBeDisplayed) ",
1119           onlyComponent = "((type='Component') and selcount=1)",
1120           rule = canDisplay + "and ((($type in {%1}) and( %2 )) or " + onlyComponent + ")",
1121           types = "'Shape' 'Group'";
1122
1123   mgr->insert( action(  216 ), -1, -1 ); // display
1124   mgr->setRule( action( 216 ), rule.arg( types ).arg( "not isVisible" ), QtxPopupMgr::VisibleRule );
1125
1126   mgr->insert( action(  215 ), -1, -1 ); // erase
1127   mgr->setRule( action( 215 ), rule.arg( types ).arg( "isVisible" ), QtxPopupMgr::VisibleRule );
1128
1129   mgr->insert( action(  214 ), -1, -1 ); // erase All
1130   mgr->setRule( action( 214 ), clientOCCorVTK, QtxPopupMgr::VisibleRule );
1131
1132   QString selectOnly = "(client='OCCViewer' or client='VTKViewer') and (selcount=0)";
1133
1134   int selectolnyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1);                //select only menu
1135   mgr->insert( action(2171), selectolnyId, -1);                                  //Vertex
1136   mgr->setRule(action(2171), selectOnly, QtxPopupMgr::VisibleRule);
1137   mgr->setRule(action(2171), selectOnly + " and selectionmode='VERTEX'", QtxPopupMgr::ToggleRule);
1138   mgr->insert( action(2172), selectolnyId, -1);                                  //Edge
1139   mgr->setRule(action(2172), selectOnly, QtxPopupMgr::VisibleRule);
1140   mgr->setRule(action(2172), selectOnly + " and selectionmode='EDGE'", QtxPopupMgr::ToggleRule);
1141   mgr->insert( action(2173), selectolnyId, -1);                                  //Wire
1142   mgr->setRule(action(2173), selectOnly, QtxPopupMgr::VisibleRule);
1143   mgr->setRule(action(2173), selectOnly + " and selectionmode='WIRE'", QtxPopupMgr::ToggleRule);
1144   mgr->insert( action(2174), selectolnyId, -1);                                  //Face
1145   mgr->setRule(action(2174), selectOnly, QtxPopupMgr::VisibleRule);
1146   mgr->setRule(action(2174), selectOnly + " and selectionmode='FACE'", QtxPopupMgr::ToggleRule);
1147   mgr->insert( action(2175), selectolnyId, -1);                                  //Shell
1148   mgr->setRule(action(2175), selectOnly, QtxPopupMgr::VisibleRule);
1149   mgr->setRule(action(2175), selectOnly + " and selectionmode='SHELL'", QtxPopupMgr::ToggleRule);
1150   mgr->insert( action(2176), selectolnyId, -1);                                  //Solid
1151   mgr->setRule(action(2176), selectOnly, QtxPopupMgr::VisibleRule);
1152   mgr->setRule(action(2176), selectOnly + " and selectionmode='SOLID'", QtxPopupMgr::ToggleRule);
1153   mgr->insert( action(2177), selectolnyId, -1);                                  //Compound
1154   mgr->setRule(action(2177), selectOnly, QtxPopupMgr::VisibleRule);
1155   mgr->setRule(action(2177), selectOnly + " and selectionmode='COMPOUND'", QtxPopupMgr::ToggleRule);
1156   mgr->insert( separator(), selectolnyId, -1);
1157   mgr->insert( action(2178), selectolnyId, -1);                                  //Clear selection filter
1158   mgr->setRule(action(2178), selectOnly, QtxPopupMgr::VisibleRule);
1159   mgr->setRule(action(2178), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
1160   mgr->insert( action(  213 ), -1, -1 ); // display only
1161   mgr->setRule( action( 213 ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule );
1162   mgr->insert( separator(), -1, -1 );
1163
1164   mgr->hide( mgr->actionId( action( myEraseAll ) ) );
1165 }
1166
1167 //=======================================================================
1168 // function : GeometryGUI::activateModule()
1169 // purpose  : Called when GEOM module is activated
1170 //=======================================================================
1171 bool GeometryGUI::activateModule( SUIT_Study* study )
1172 {
1173   if ( CORBA::is_nil( myComponentGeom ) )
1174     return false;
1175
1176   bool res = SalomeApp_Module::activateModule( study );
1177
1178   if ( !res )
1179     return false;
1180
1181   setMenuShown( true );
1182   setToolShown( true );
1183
1184   connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
1185           this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
1186
1187   // Reset actions accelerator keys
1188   //action(111)->setAccel(QKeySequence(CTRL + Key_I)); // Import
1189   //action(121)->setAccel(QKeySequence(CTRL + Key_E)); // Export
1190   action(111)->setEnabled(true); // Import
1191   action(121)->setEnabled(true); // Export
1192
1193   GUIMap::Iterator it;
1194   for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
1195     it.value()->activate( application()->desktop() );
1196
1197   LightApp_SelectionMgr* sm = getApp()->selectionMgr();
1198   SUIT_ViewManager* vm;
1199   ViewManagerList OCCViewManagers, VTKViewManagers;
1200
1201   application()->viewManagers( OCCViewer_Viewer::Type(), OCCViewManagers );
1202   QListIterator<SUIT_ViewManager*> itOCC( OCCViewManagers );
1203   while ( itOCC.hasNext() && (vm = itOCC.next()) )
1204     myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) );
1205
1206   application()->viewManagers( SVTK_Viewer::Type(), VTKViewManagers );
1207   QListIterator<SUIT_ViewManager*> itVTK( VTKViewManagers );
1208   while ( itVTK.hasNext() && (vm = itVTK.next()) )
1209     myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast<SVTK_Viewer*>( vm->getViewModel() ), sm ) );
1210
1211   // disable OCC selectors
1212   //getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() );
1213   QListIterator<GEOMGUI_OCCSelector*> itOCCSel( myOCCSelectors );
1214   while ( itOCCSel.hasNext() )
1215     if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() )
1216       sr->setEnabled(true);
1217
1218   // disable VTK selectors
1219   //getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() );
1220   QListIterator<LightApp_VTKSelector*> itVTKSel( myVTKSelectors );
1221   while ( itVTKSel.hasNext() )
1222     if ( LightApp_VTKSelector* sr = itVTKSel.next() )
1223       sr->setEnabled(true);
1224
1225   return true;
1226 }
1227
1228
1229 //=======================================================================
1230 // function : GeometryGUI::deactivateModule()
1231 // purpose  : Called when GEOM module is deactivated
1232 //=======================================================================
1233 bool GeometryGUI::deactivateModule( SUIT_Study* study )
1234 {
1235   setMenuShown( false );
1236   setToolShown( false );
1237
1238   disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
1239              this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
1240
1241   EmitSignalCloseAllDialogs();
1242
1243   GUIMap::Iterator it;
1244   for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
1245     it.value()->deactivate();
1246
1247   // Unset actions accelerator keys
1248   //action(111)->setAccel(QKeySequence()); // Import
1249   //action(121)->setAccel(QKeySequence()); // Export
1250   action(111)->setEnabled(false); // Import
1251   action(121)->setEnabled(false); // Export
1252
1253   myOCCSelectors.clear();
1254   getApp()->selectionMgr()->setEnabled( true, OCCViewer_Viewer::Type() );
1255
1256   myVTKSelectors.clear();
1257   getApp()->selectionMgr()->setEnabled( true, SVTK_Viewer::Type() );
1258
1259   return SalomeApp_Module::deactivateModule( study );
1260 }
1261
1262 //=======================================================================
1263 // function : GeometryGUI::BuildPresentation()
1264 // purpose  :
1265 //=======================================================================
1266 void GeometryGUI::BuildPresentation( const Handle(SALOME_InteractiveObject)& io, SUIT_ViewWindow* win )
1267 {
1268   //GEOM_Displayer().Display( io, false, win );
1269 }
1270
1271 //=======================================================================
1272 // function : onWindowActivated()
1273 // purpose  : update menu items' status - disable non-OCC-viewer-compatible actions
1274 //=======================================================================
1275 void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win )
1276 {
1277   if ( !win )
1278     return;
1279
1280   const bool ViewOCC = ( win->getViewManager()->getType() == OCCViewer_Viewer::Type() );
1281   const bool ViewVTK = ( win->getViewManager()->getType() == SVTK_Viewer::Type() );
1282
1283   // disable non-OCC viewframe menu commands
1284 //  action( 404 )->setEnabled( ViewOCC ); // SKETCHER
1285   action( 603 )->setEnabled( ViewOCC ); // SuppressFace
1286   action( 604 )->setEnabled( ViewOCC ); // SuppressHole
1287   action( 606 )->setEnabled( ViewOCC ); // CloseContour
1288   action( 607 )->setEnabled( ViewOCC ); // RemoveInternalWires
1289   action( 608 )->setEnabled( ViewOCC ); // AddPointOnEdge
1290 //  action( 609 )->setEnabled( ViewOCC ); // Free boundaries
1291 //  action( 413 )->setEnabled( ViewOCC || ViewVTK ); // Isos Settings
1292
1293   action( 800 )->setEnabled( ViewOCC ); // Create Group
1294   action( 801 )->setEnabled( ViewOCC ); // Edit Group
1295
1296   action( 9998 )->setEnabled( ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION
1297 }
1298
1299 void GeometryGUI::windows( QMap<int, int>& mappa ) const
1300 {
1301   mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
1302   mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
1303 }
1304
1305 void GeometryGUI::viewManagers( QStringList& lst ) const
1306 {
1307   lst.append( OCCViewer_Viewer::Type() );
1308 }
1309
1310 void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm )
1311 {
1312   if ( vm->getType() == OCCViewer_Viewer::Type() )
1313   {
1314     qDebug( "connect" );
1315     connect( vm, SIGNAL( keyPress  ( SUIT_ViewWindow*, QKeyEvent* ) ),
1316              this, SLOT( OnKeyPress( SUIT_ViewWindow*, QKeyEvent* ) ) );
1317     connect( vm, SIGNAL( mousePress( SUIT_ViewWindow*, QMouseEvent* ) ),
1318              this, SLOT( OnMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) );
1319     connect( vm, SIGNAL( mouseMove ( SUIT_ViewWindow*, QMouseEvent* ) ),
1320              this, SLOT( OnMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
1321
1322
1323     LightApp_SelectionMgr* sm = getApp()->selectionMgr();
1324     myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) );
1325
1326     // disable OCC selectors
1327     getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() );
1328     QListIterator<GEOMGUI_OCCSelector*> itOCCSel( myOCCSelectors );
1329     while ( itOCCSel.hasNext() )
1330       if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() )
1331         sr->setEnabled(true);
1332   }
1333   else if ( vm->getType() == SVTK_Viewer::Type() )
1334   {
1335     LightApp_SelectionMgr* sm = getApp()->selectionMgr();
1336     myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast<SVTK_Viewer*>( vm->getViewModel() ), sm ) );
1337
1338     // disable VTK selectors
1339     getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() );
1340     QListIterator<LightApp_VTKSelector*> itVTKSel( myVTKSelectors );
1341     while ( itVTKSel.hasNext() )
1342       if ( LightApp_VTKSelector* sr = itVTKSel.next() )
1343         sr->setEnabled(true);
1344   }
1345 }
1346
1347 void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm )
1348 {
1349   SUIT_ViewModel* viewer = vm->getViewModel();
1350   if ( vm->getType() == OCCViewer_Viewer::Type() )
1351   {
1352     QListIterator<GEOMGUI_OCCSelector*> itOCCSel( myOCCSelectors );
1353     while ( itOCCSel.hasNext() )
1354       if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() )
1355         if ( sr->viewer() == viewer )
1356         {
1357           delete myOCCSelectors.takeAt( myOCCSelectors.indexOf( sr ) );
1358           break;
1359         }
1360   }
1361   if ( vm->getType() == SVTK_Viewer::Type() )
1362   {
1363     QListIterator<LightApp_VTKSelector*> itVTKSel( myVTKSelectors );
1364     while ( itVTKSel.hasNext() )
1365       if ( LightApp_VTKSelector* sr = itVTKSel.next() )
1366         if ( sr->viewer() == viewer )
1367         {
1368           delete myVTKSelectors.takeAt( myVTKSelectors.indexOf( sr ) );
1369           break;
1370         }
1371   }
1372 }
1373
1374 QString GeometryGUI::engineIOR() const
1375 {
1376   if ( !CORBA::is_nil( GetGeomGen() ) )
1377     return QString( getApp()->orb()->object_to_string( GetGeomGen() ) );
1378   return "";
1379 }
1380
1381 LightApp_Selection* GeometryGUI::createSelection( const QString& client, LightApp_SelectionMgr* mgr ) const
1382 {
1383   return new GEOMGUI_Selection( client, mgr );
1384 }
1385
1386 void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
1387 {
1388   SalomeApp_Module::contextMenuPopup( client, menu, title );
1389   SALOME_ListIO lst;
1390   getApp()->selectionMgr()->selectedObjects( lst );
1391   if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
1392     Handle(SALOME_InteractiveObject) io = lst.First();
1393     SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
1394     _PTR(Study) study = appStudy->studyDS();
1395     _PTR(SObject) obj = study->FindObjectID( io->getEntry() );
1396     if ( obj )
1397       title = QString( obj->GetName().c_str() );
1398   }
1399 }
1400
1401 void GeometryGUI::createPreferences()
1402 {
1403   int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
1404
1405   int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
1406   setPreferenceProperty( genGroup, "columns", 1 );
1407
1408   int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup,
1409                                 LightApp_Preferences::Selector, 
1410                                 "Geometry", "display_mode" );
1411
1412   addPreference( tr( "PREF_SHADING_COLOR" ), genGroup,
1413                  LightApp_Preferences::Color, "Geometry", "shading_color" );
1414
1415   addPreference( tr( "PREF_WIREFRAME_COLOR" ), genGroup,
1416                  LightApp_Preferences::Color, "Geometry", "wireframe_color" );
1417
1418   addPreference( tr( "PREF_FREE_BOUND_COLOR" ), genGroup,
1419                  LightApp_Preferences::Color, "Geometry", "free_bound_color" );
1420
1421   addPreference( tr( "PREF_LINE_COLOR"), genGroup,
1422                  LightApp_Preferences::Color, "Geometry", "line_color" );
1423
1424   addPreference( tr( "PREF_POINT_COLOR"), genGroup,
1425                  LightApp_Preferences::Color, "Geometry", "point_color" );
1426
1427   addPreference( tr( "PREF_ISOS_COLOR" ), genGroup,
1428                  LightApp_Preferences::Color, "Geometry", "isos_color" );
1429
1430   int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup,
1431                             LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" );
1432
1433   int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId );
1434
1435   int typeOfMarker = addPreference( tr( "PREF_TYPE_OF_MARKER" ), VertexGroup,
1436                                     LightApp_Preferences::Selector, "Geometry", "type_of_marker" );
1437
1438   int markerScale = addPreference( tr( "PREF_MARKER_SCALE" ), VertexGroup,
1439                                    LightApp_Preferences::DblSpin, "Geometry", "marker_scale" );
1440
1441   // Set property for default display mode
1442   QStringList aModesList;
1443   aModesList.append( tr("MEN_WIREFRAME") );
1444   aModesList.append( tr("MEN_SHADING") );
1445
1446   QList<QVariant> anIndexesList;
1447   anIndexesList.append(0);
1448   anIndexesList.append(1);
1449
1450   setPreferenceProperty( dispmode, "strings", aModesList );
1451   setPreferenceProperty( dispmode, "indexes", anIndexesList );
1452
1453   // Set property for step value for spinboxes
1454   setPreferenceProperty( step, "min", 0.001 );
1455   setPreferenceProperty( step, "max", 10000 );
1456   setPreferenceProperty( step, "precision", 3 );
1457
1458   // Set property for type of vertex marker
1459   QStringList aTypeOfMarkerList;
1460   QList<QVariant> anTypeOfMarkerIndexesList;
1461
1462   aTypeOfMarkerList.append( tr("TOM_PLUS") );
1463   anTypeOfMarkerIndexesList.append(Aspect_TOM_PLUS);
1464
1465   aTypeOfMarkerList.append( tr("TOM_POINT") );
1466   anTypeOfMarkerIndexesList.append(Aspect_TOM_POINT);
1467
1468   aTypeOfMarkerList.append( tr("TOM_STAR") );
1469   anTypeOfMarkerIndexesList.append(Aspect_TOM_STAR);
1470
1471   aTypeOfMarkerList.append( tr("TOM_O") );
1472   anTypeOfMarkerIndexesList.append(Aspect_TOM_O);
1473
1474   aTypeOfMarkerList.append( tr("TOM_X") );
1475   anTypeOfMarkerIndexesList.append(Aspect_TOM_X);
1476
1477   aTypeOfMarkerList.append( tr("TOM_O_POINT") );
1478   anTypeOfMarkerIndexesList.append(Aspect_TOM_O_POINT);
1479
1480   aTypeOfMarkerList.append( tr("TOM_O_PLUS") );
1481   anTypeOfMarkerIndexesList.append(Aspect_TOM_O_PLUS);
1482
1483   aTypeOfMarkerList.append( tr("TOM_O_STAR") );
1484   anTypeOfMarkerIndexesList.append(Aspect_TOM_O_STAR);
1485
1486   aTypeOfMarkerList.append( tr("TOM_O_X") );
1487   anTypeOfMarkerIndexesList.append(Aspect_TOM_O_X);
1488
1489
1490   setPreferenceProperty( typeOfMarker, "strings", aTypeOfMarkerList );
1491   setPreferenceProperty( typeOfMarker, "indexes", anTypeOfMarkerIndexesList );
1492
1493   // Set property for Vertex Marker scale
1494   setPreferenceProperty( markerScale, "min", 1. );
1495   setPreferenceProperty( markerScale, "max", 7. );
1496   setPreferenceProperty( markerScale, "precision", 0.01 );
1497   setPreferenceProperty( markerScale, "step", 0.5 );
1498
1499 }
1500
1501 void GeometryGUI::preferencesChanged( const QString& section, const QString& param )
1502 {
1503   if (section == "Geometry") {
1504     SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
1505     if (param == QString("SettingsGeomStep")) {
1506       double spin_step = aResourceMgr->doubleValue(section, param, 100.);
1507       EmitSignalDefaultStepValueChanged(spin_step);
1508     }
1509   }
1510 }
1511
1512 LightApp_Displayer* GeometryGUI::displayer()
1513 {
1514   if( !myDisplayer )
1515     myDisplayer = new GEOM_Displayer( dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
1516   return myDisplayer;
1517 }
1518
1519 void GeometryGUI::setLocalSelectionMode(const int mode)
1520 {
1521   myLocalSelectionMode = mode;
1522 }
1523 int GeometryGUI::getLocalSelectionMode() const
1524 {
1525   return myLocalSelectionMode;
1526 }