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