1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // GEOM GEOMGUI : GUI for Geometry component
23 // File : GeometryGUI.cxx
24 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
27 #include "GeometryGUI.h"
28 #include "GeometryGUI_Operations.h"
29 #include "GEOMGUI_OCCSelector.h"
30 #include "GEOMGUI_Selection.h"
31 #include "GEOM_Displayer.h"
32 #include "GEOM_AISShape.hxx"
34 #include "GEOM_Actor.h"
36 #include <SUIT_Desktop.h>
37 #include <SUIT_MessageBox.h>
38 #include <SUIT_ResourceMgr.h>
39 #include <SUIT_Session.h>
40 #include <SUIT_ViewManager.h>
42 #include <OCCViewer_ViewWindow.h>
43 #include <OCCViewer_ViewPort3d.h>
44 #include <OCCViewer_ViewModel.h>
45 #include <OCCViewer_ViewManager.h>
47 #include <SOCC_ViewModel.h>
48 #include <SOCC_ViewWindow.h>
50 #include <SVTK_ViewWindow.h>
51 #include <SVTK_RenderWindowInteractor.h>
52 #include <SVTK_InteractorStyle.h>
53 #include <SVTK_ViewModel.h>
55 #include <SalomeApp_Application.h>
56 #include <SalomeApp_Study.h>
58 #include <LightApp_SelectionMgr.h>
59 #include <LightApp_VTKSelector.h>
60 #include <LightApp_DataObject.h>
61 #include <LightApp_Preferences.h>
63 #include <SALOME_LifeCycleCORBA.hxx>
64 #include <SALOME_ListIO.hxx>
65 #include <SALOME_ListIteratorOfListIO.hxx>
67 #include <SALOMEDSClient_ClientFactory.hxx>
68 #include <SALOMEDSClient_IParameters.hxx>
77 #include <AIS_Drawer.hxx>
78 #include <AIS_ListOfInteractive.hxx>
79 #include <AIS_ListIteratorOfListOfInteractive.hxx>
80 #include <Prs3d_Drawer.hxx>
81 #include <Prs3d_IsoAspect.hxx>
82 #include <Aspect_TypeOfMarker.hxx>
83 #include <OSD_SharedLibrary.hxx>
84 #include <NCollection_DataMap.hxx>
85 #include <Graphic3d_HArray1OfBytes.hxx>
87 #include <utilities.h>
89 #include <vtkCamera.h>
90 #include <vtkRenderer.h>
92 #include "GEOMImpl_Types.hxx"
95 Standard_EXPORT CAM_Module* createModule() {
96 return new GeometryGUI();
100 GeometryGUI::StudyTextureMap GeometryGUI::myTextureMap;
102 GEOM::GEOM_Gen_var GeometryGUI::myComponentGeom = GEOM::GEOM_Gen::_nil();
104 GEOM::GEOM_Gen_var GeometryGUI::GetGeomGen()
106 // Bug 12290: exception in Mesh GUI on GEOMBase::GetShape() if Geometry GUI hasn't been loaded
107 if (CORBA::is_nil(myComponentGeom))
109 return GeometryGUI::myComponentGeom;
112 bool GeometryGUI::InitGeomGen()
115 if( CORBA::is_nil( myComponentGeom ) ) return false;
119 //=======================================================================
120 // function : ClientSObjectToObject
122 //=======================================================================
123 CORBA::Object_var GeometryGUI::ClientSObjectToObject (_PTR(SObject) theSObject)
125 _PTR(GenericAttribute) anAttr;
126 CORBA::Object_var anObj;
128 std::string aValue = theSObject->GetIOR();
129 if (strcmp(aValue.c_str(), "") != 0) {
130 CORBA::ORB_ptr anORB = SalomeApp_Application::orb();
131 anObj = anORB->string_to_object(aValue.c_str());
134 INFOS("ClientSObjectToObject - Unknown exception was occured!!!");
136 return anObj._retn();
139 //=======================================================================
140 // function : ClientStudyToStudy
142 //=======================================================================
143 SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy)
145 SALOME_NamingService *aNamingService = SalomeApp_Application::namingService();
146 CORBA::Object_var aSMObject = aNamingService->Resolve("/myStudyManager");
147 SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject);
148 int aStudyID = theStudy->StudyId();
149 SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID(aStudyID);
150 return aDSStudy._retn();
153 //=======================================================================
154 // function : GeometryGUI::GeometryGUI()
155 // purpose : Constructor
156 //=======================================================================
157 GeometryGUI::GeometryGUI() :
158 SalomeApp_Module( "GEOM" ),
159 LightApp_Module( "GEOM" )
161 if ( CORBA::is_nil( myComponentGeom ) )
163 Engines::Component_var comp = SalomeApp_Application::lcc()->FindOrLoad_Component( "FactoryServer", "GEOM" );
164 myComponentGeom = GEOM::GEOM_Gen::_narrow( comp );
167 myActiveDialogBox = 0;
169 gp_Pnt origin = gp_Pnt(0., 0., 0.);
170 gp_Dir direction = gp_Dir(0., 0., 1.);
171 myWorkingPlane = gp_Ax3(origin, direction);
174 myLocalSelectionMode = GEOM_ALLOBJECTS;
177 //=======================================================================
178 // function : GeometryGUI::~GeometryGUI()
179 // purpose : Destructor
180 //=======================================================================
181 GeometryGUI::~GeometryGUI()
183 while (!myOCCSelectors.isEmpty())
184 delete myOCCSelectors.takeFirst();
186 while (!myVTKSelectors.isEmpty())
187 delete myVTKSelectors.takeFirst();
189 qDeleteAll(myGUIMap);
192 //=======================================================================
193 // function : GeometryGUI::getLibrary()
194 // purpose : get or load GUI library by name [ internal ]
195 //=======================================================================
196 typedef GEOMGUI* (*LibraryGUI)( GeometryGUI* );
197 GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName )
199 if ( !myGUIMap.contains( libraryName ) ) {
200 // try to load library if it is not loaded yet
202 QString dirs = getenv( "LD_LIBRARY_PATH" );
205 QString dirs = getenv( "PATH" );
208 if ( !dirs.isEmpty() ) {
209 QStringList dirList = dirs.split(sep, QString::SkipEmptyParts ); // skip empty entries
210 QListIterator<QString> it( dirList ); it.toBack();
211 while ( it.hasPrevious() ) {
212 QFileInfo fi( Qtx::addSlash( it.previous() ) + libraryName );
214 OSD_SharedLibrary aSharedLibrary( fi.fileName().toLatin1().constData() );
215 bool res = aSharedLibrary.DlOpen( OSD_RTLD_LAZY );
217 MESSAGE( "Can't open library : " << aSharedLibrary.DlError() );
218 continue; // continue search further
220 OSD_Function osdF = aSharedLibrary.DlSymb( "GetLibGUI" );
221 if ( osdF != NULL ) {
222 LibraryGUI func = (GEOMGUI* (*) (GeometryGUI*))osdF;
223 GEOMGUI* libGUI = (*func)( this );
225 myGUIMap[ libraryName ] = libGUI;
226 break; // found and loaded!
233 return myGUIMap.contains( libraryName ) ? myGUIMap[ libraryName ] : 0;
236 //=======================================================================
237 // function : GeometryGUI::ActiveWorkingPlane()
238 // purpose : Activate Working Plane View
239 //=======================================================================
240 void GeometryGUI::ActiveWorkingPlane()
242 gp_Dir DZ = myWorkingPlane.Direction();
243 gp_Dir DY = myWorkingPlane.YDirection();
245 SUIT_ViewWindow* window = application()->desktop()->activeWindow();
246 bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
247 bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
250 OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( window );
252 Handle(V3d_View) view3d = vw->getViewPort()->getView();
254 view3d->SetProj(DZ.X(), DZ.Y(), DZ.Z());
255 view3d->SetUp(DY.X(), DY.Y(), DY.Z());
261 SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( window );
263 vtkCamera* camera = vw->getRenderer()->GetActiveCamera();
265 camera->SetPosition(DZ.X(), DZ.Y(), DZ.Z());
266 camera->SetViewUp(DY.X(), DY.Y(), DY.Z());
267 camera->SetFocalPoint(0,0,0);
274 //=======================================================================
275 // function : GeometryGUI::SetActiveDialogBox()
276 // purpose : Set active dialog box
277 //=======================================================================
278 void GeometryGUI::SetActiveDialogBox( QDialog* aDlg )
280 myActiveDialogBox = (QDialog*)aDlg;
283 //=======================================================================
284 // function : GeometryGUI::EmitSignalDeactivateDialog()
285 // purpose : Emit a signal to deactivate the active dialog Box
286 //=======================================================================
287 void GeometryGUI::EmitSignalDeactivateDialog()
289 emit SignalDeactivateActiveDialog();
292 //=======================================================================
293 // function : GeometryGUI::EmitSignalCloseAllDialogs()
294 // purpose : Emit a signal to close all non modal dialogs box
295 //=======================================================================
296 void GeometryGUI::EmitSignalCloseAllDialogs()
298 emit SignalCloseAllDialogs();
301 //=======================================================================
302 // function : GeometryGUI::EmitSignalDefaultStepValueChanged()
303 // purpose : Emit a signal to inform that default real spin box step has
305 //=======================================================================
306 void GeometryGUI::EmitSignalDefaultStepValueChanged(double newVal)
308 emit SignalDefaultStepValueChanged(newVal);
311 //=======================================================================
312 // function : GeometryGUI::OnGUIEvent()
313 // purpose : common slot for all menu/toolbar actions
314 //=======================================================================
315 void GeometryGUI::OnGUIEvent()
317 const QObject* obj = sender();
318 if ( !obj || !obj->inherits( "QAction" ) )
320 int id = actionId((QAction*)obj);
325 //=======================================================================
326 // function : GeometryGUI::OnGUIEvent()
327 // purpose : manage all events on GUI [static]
328 //=======================================================================
329 void GeometryGUI::OnGUIEvent( int id )
331 SUIT_Application* anApp = application();
333 SUIT_Desktop* desk = anApp->desktop();
335 // check type of the active viewframe
336 SUIT_ViewWindow* window = desk->activeWindow();
337 bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
338 bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
339 // if current viewframe is not of OCC and not of VTK type - return immediately
340 // fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example)
341 QList<int> NotViewerDependentCommands;
342 NotViewerDependentCommands << GEOMOp::OpRename
345 << GEOMOp::OpShowOnly
346 << GEOMOp::OpShowChildren
347 << GEOMOp::OpHideChildren
348 << GEOMOp::OpPointMarker;
349 if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommands.contains( id ) )
352 // fix for IPAL9103, point 2
353 if ( CORBA::is_nil( GetGeomGen() ) ) {
354 SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_GET_ENGINE" ), tr( "GEOM_BUT_OK" ) );
359 // find corresponding GUI library
361 case GEOMOp::OpImport: // MENU FILE - IMPORT
362 case GEOMOp::OpExport: // MENU FILE - EXPORT
363 case GEOMOp::OpSelectVertex: // POPUP MENU - SELECT ONLY - VERTEX
364 case GEOMOp::OpSelectEdge: // POPUP MENU - SELECT ONLY - EDGE
365 case GEOMOp::OpSelectWire: // POPUP MENU - SELECT ONLY - WIRE
366 case GEOMOp::OpSelectFace: // POPUP MENU - SELECT ONLY - FACE
367 case GEOMOp::OpSelectShell: // POPUP MENU - SELECT ONLY - SHELL
368 case GEOMOp::OpSelectSolid: // POPUP MENU - SELECT ONLY - SOLID
369 case GEOMOp::OpSelectCompound: // POPUP MENU - SELECT ONLY - COMPOUND
370 case GEOMOp::OpSelectAll: // POPUP MENU - SELECT ONLY - SELECT ALL
371 case GEOMOp::OpDelete: // MENU EDIT - DELETE
372 case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY
373 case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
374 case GEOMOp::OpColor: // POPUP MENU - COLOR
375 case GEOMOp::OpTransparency: // POPUP MENU - TRANSPARENCY
376 case GEOMOp::OpIsos: // POPUP MENU - ISOS
377 case GEOMOp::OpAutoColor: // POPUP MENU - AUTO COLOR
378 case GEOMOp::OpNoAutoColor: // POPUP MENU - DISABLE AUTO COLOR
379 case GEOMOp::OpShowChildren: // POPUP MENU - SHOW CHILDREN
380 case GEOMOp::OpHideChildren: // POPUP MENU - HIDE CHILDREN
381 case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER
382 case GEOMOp::OpRename: // POPUP MENU - RENAME
383 libName = "GEOMToolsGUI";
385 case GEOMOp::OpDisplayMode: // MENU VIEW - WIREFRAME/SHADING
386 case GEOMOp::OpShowAll: // MENU VIEW - SHOW ALL
387 case GEOMOp::OpShowOnly: // MENU VIEW - DISPLAY ONLY
388 case GEOMOp::OpHideAll: // MENU VIEW - ERASE ALL
389 case GEOMOp::OpHide: // MENU VIEW - ERASE
390 case GEOMOp::OpShow: // MENU VIEW - DISPLAY
391 case GEOMOp::OpSwitchVectors: // MENU VIEW - VECTOR MODE
392 case GEOMOp::OpWireframe: // POPUP MENU - WIREFRAME
393 case GEOMOp::OpShading: // POPUP MENU - SHADING
394 case GEOMOp::OpVectors: // POPUP MENU - VECTORS
395 libName = "DisplayGUI";
397 case GEOMOp::OpPoint: // MENU BASIC - POINT
398 case GEOMOp::OpLine: // MENU BASIC - LINE
399 case GEOMOp::OpCircle: // MENU BASIC - CIRCLE
400 case GEOMOp::OpEllipse: // MENU BASIC - ELLIPSE
401 case GEOMOp::OpArc: // MENU BASIC - ARC
402 case GEOMOp::OpVector: // MENU BASIC - VECTOR
403 case GEOMOp::OpPlane: // MENU BASIC - PLANE
404 case GEOMOp::OpCurve: // MENU BASIC - CURVE
405 case GEOMOp::OpLCS: // MENU BASIC - REPAIR
406 libName = "BasicGUI";
408 case GEOMOp::OpBox: // MENU PRIMITIVE - BOX
409 case GEOMOp::OpCylinder: // MENU PRIMITIVE - CYLINDER
410 case GEOMOp::OpSphere: // MENU PRIMITIVE - SPHERE
411 case GEOMOp::OpTorus: // MENU PRIMITIVE - TORUS
412 case GEOMOp::OpCone: // MENU PRIMITIVE - CONE
413 case GEOMOp::OpRectangle: // MENU PRIMITIVE - FACE
414 case GEOMOp::OpDisk: // MENU PRIMITIVE - DISK
415 libName = "PrimitiveGUI";
417 case GEOMOp::OpPrism: // MENU GENERATION - PRISM
418 case GEOMOp::OpRevolution: // MENU GENERATION - REVOLUTION
419 case GEOMOp::OpFilling: // MENU GENERATION - FILLING
420 case GEOMOp::OpPipe: // MENU GENERATION - PIPE
421 libName = "GenerationGUI";
423 case GEOMOp::Op2dSketcher: // MENU ENTITY - SKETCHER
424 case GEOMOp::Op3dSketcher: // MENU ENTITY - 3D SKETCHER
425 case GEOMOp::OpExplode: // MENU ENTITY - EXPLODE
426 libName = "EntityGUI";
428 case GEOMOp::OpEdge: // MENU BUILD - EDGE
429 case GEOMOp::OpWire: // MENU BUILD - WIRE
430 case GEOMOp::OpFace: // MENU BUILD - FACE
431 case GEOMOp::OpShell: // MENU BUILD - SHELL
432 case GEOMOp::OpSolid: // MENU BUILD - SOLID
433 case GEOMOp::OpCompound: // MENU BUILD - COMPUND
434 libName = "BuildGUI";
436 case GEOMOp::OpFuse: // MENU BOOLEAN - FUSE
437 case GEOMOp::OpCommon: // MENU BOOLEAN - COMMON
438 case GEOMOp::OpCut: // MENU BOOLEAN - CUT
439 case GEOMOp::OpSection: // MENU BOOLEAN - SECTION
440 libName = "BooleanGUI";
442 case GEOMOp::OpTranslate: // MENU TRANSFORMATION - TRANSLATION
443 case GEOMOp::OpRotate: // MENU TRANSFORMATION - ROTATION
444 case GEOMOp::OpChangeLoc: // MENU TRANSFORMATION - LOCATION
445 case GEOMOp::OpMirror: // MENU TRANSFORMATION - MIRROR
446 case GEOMOp::OpScale: // MENU TRANSFORMATION - SCALE
447 case GEOMOp::OpOffset: // MENU TRANSFORMATION - OFFSET
448 case GEOMOp::OpMultiTranslate: // MENU TRANSFORMATION - MULTI-TRANSLATION
449 case GEOMOp::OpMultiRotate: // MENU TRANSFORMATION - MULTI-ROTATION
450 case GEOMOp::OpReimport: // CONTEXT(POPUP) MENU - RELOAD_IMPORTED
451 libName = "TransformationGUI";
453 case GEOMOp::OpPartition: // MENU OPERATION - PARTITION
454 case GEOMOp::OpArchimede: // MENU OPERATION - ARCHIMEDE
455 case GEOMOp::OpFillet3d: // MENU OPERATION - FILLET
456 case GEOMOp::OpChamfer: // MENU OPERATION - CHAMFER
457 case GEOMOp::OpClipping: // MENU OPERATION - CLIPPING RANGE
458 case GEOMOp::OpShapesOnShape: // MENU OPERATION - GET SHAPES ON SHAPE
459 case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D
460 case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D
461 libName = "OperationGUI";
463 case GEOMOp::OpSewing: // MENU REPAIR - SEWING
464 case GEOMOp::OpSuppressFaces: // MENU REPAIR - SUPPRESS FACES
465 case GEOMOp::OpSuppressHoles: // MENU REPAIR - SUPPRESS HOLE
466 case GEOMOp::OpShapeProcess: // MENU REPAIR - SHAPE PROCESSING
467 case GEOMOp::OpCloseContour: // MENU REPAIR - CLOSE CONTOUR
468 case GEOMOp::OpRemoveIntWires: // MENU REPAIR - REMOVE INTERNAL WIRES
469 case GEOMOp::OpAddPointOnEdge: // MENU REPAIR - ADD POINT ON EDGE
470 case GEOMOp::OpFreeBoundaries: // MENU MEASURE - FREE BOUNDARIES
471 case GEOMOp::OpFreeFaces: // MENU MEASURE - FREE FACES
472 case GEOMOp::OpOrientation: // MENU REPAIR - CHANGE ORIENTATION
473 case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES
474 case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
475 libName = "RepairGUI";
477 case GEOMOp::OpProperties: // MENU MEASURE - PROPERTIES
478 case GEOMOp::OpCenterMass: // MENU MEASURE - CDG
479 case GEOMOp::OpInertia: // MENU MEASURE - INERTIA
480 case GEOMOp::OpNormale: // MENU MEASURE - NORMALE
481 case GEOMOp::OpBoundingBox: // MENU MEASURE - BOUNDING BOX
482 case GEOMOp::OpMinDistance: // MENU MEASURE - MIN DISTANCE
483 case GEOMOp::OpAngle: // MENU MEASURE - ANGLE
484 case GEOMOp::OpTolerance: // MENU MEASURE - TOLERANCE
485 case GEOMOp::OpWhatIs: // MENU MEASURE - WHATIS
486 case GEOMOp::OpCheckShape: // MENU MEASURE - CHECK
487 case GEOMOp::OpCheckCompound: // MENU MEASURE - CHECK COMPOUND OF BLOCKS
488 case GEOMOp::OpPointCoordinates: // MENU MEASURE - POINT COORDINATES
489 libName = "MeasureGUI";
491 case GEOMOp::OpGroupCreate: // MENU GROUP - CREATE
492 case GEOMOp::OpGroupCreatePopup: // POPUP MENU - CREATE GROUP
493 case GEOMOp::OpGroupEdit: // MENU GROUP - EDIT
494 libName = "GroupGUI";
496 case GEOMOp::OpHexaSolid: // MENU BLOCKS - HEXAHEDRAL SOLID
497 case GEOMOp::OpMultiTransform: // MENU BLOCKS - MULTI-TRANSFORMATION
498 case GEOMOp::OpQuadFace: // MENU BLOCKS - QUADRANGLE FACE
499 case GEOMOp::OpPropagate: // MENU BLOCKS - PROPAGATE
500 case GEOMOp::OpExplodeBlock: // MENU BLOCKS - EXPLODE ON BLOCKS
501 libName = "BlocksGUI";
503 case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base)
504 case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
505 // case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
506 //@@ insert new functions before this line @@//
507 libName = "AdvancedGUI";
513 GEOMGUI* library = 0;
514 if ( !libName.isEmpty() ) {
516 libName = QString( "lib" ) + libName + ".so";
518 libName = libName + ".dll";
520 library = getLibrary( libName );
523 // call method of corresponding GUI library
525 library->OnGUIEvent( id, desk );
527 SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) );
530 //=================================================================================
531 // function : GeometryGUI::OnKeyPress()
532 // purpose : Called when any key is pressed by user [static]
533 //=================================================================================
534 void GeometryGUI::OnKeyPress( SUIT_ViewWindow* w, QKeyEvent* e )
536 if ( !application() )
538 foreach ( GEOMGUI* lib, myGUIMap )
539 lib->OnKeyPress( e, application()->desktop(), w );
542 //=================================================================================
543 // function : GeometryGUI::OnMouseMove()
544 // purpose : Manages mouse move events [static]
545 //=================================================================================
546 void GeometryGUI::OnMouseMove( SUIT_ViewWindow* w, QMouseEvent* e )
548 if ( !application() )
550 foreach ( GEOMGUI* lib, myGUIMap )
551 lib->OnMouseMove( e, application()->desktop(), w );
554 //=================================================================================
555 // function : GeometryGUI::OnMousePress()
556 // purpose : Manage mouse press events [static]
557 //=================================================================================
558 void GeometryGUI::OnMousePress( SUIT_ViewWindow* w, QMouseEvent* e )
560 if ( !application() )
562 foreach ( GEOMGUI* lib, myGUIMap )
563 lib->OnMousePress( e, application()->desktop(), w );
566 //=======================================================================
567 // function : createGeomAction
569 //=======================================================================
570 void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel, const int accel, const bool toggle )
572 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
573 QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false )
574 : resMgr->loadPixmap( "GEOM", tr( icolabel.toLatin1().constData() ) );
576 tr( QString( "TOP_%1" ).arg( label ).toLatin1().constData() ),
578 tr( QString( "MEN_%1" ).arg( label ).toLatin1().constData() ),
579 tr( QString( "STB_%1" ).arg( label ).toLatin1().constData() ),
581 application()->desktop(),
583 this, SLOT( OnGUIEvent() ) );
588 //=======================================================================
589 // function : GeometryGUI::initialize()
590 // purpose : Called when GEOM module is created
591 //=======================================================================
592 void GeometryGUI::initialize( CAM_Application* app )
594 SalomeApp_Module::initialize( app );
596 // ----- create actions --------------
598 createGeomAction( GEOMOp::OpImport, "IMPORT", "", Qt::ControlModifier + Qt::Key_I );
599 createGeomAction( GEOMOp::OpExport, "EXPORT", "", Qt::ControlModifier + Qt::Key_E );
601 createGeomAction( GEOMOp::OpDelete, "DELETE", "", Qt::Key_Delete );
603 createGeomAction( GEOMOp::OpPoint, "POINT" );
604 createGeomAction( GEOMOp::OpLine, "LINE" );
605 createGeomAction( GEOMOp::OpCircle, "CIRCLE" );
606 createGeomAction( GEOMOp::OpEllipse, "ELLIPSE" );
607 createGeomAction( GEOMOp::OpArc, "ARC" );
608 createGeomAction( GEOMOp::OpCurve, "CURVE" );
609 createGeomAction( GEOMOp::OpVector, "VECTOR" );
610 createGeomAction( GEOMOp::OpPlane, "PLANE" );
611 createGeomAction( GEOMOp::OpLCS, "LOCAL_CS" );
613 createGeomAction( GEOMOp::OpBox, "BOX" );
614 createGeomAction( GEOMOp::OpCylinder, "CYLINDER" );
615 createGeomAction( GEOMOp::OpSphere, "SPHERE" );
616 createGeomAction( GEOMOp::OpTorus, "TORUS" );
617 createGeomAction( GEOMOp::OpCone, "CONE" );
618 createGeomAction( GEOMOp::OpRectangle, "RECTANGLE" );
619 createGeomAction( GEOMOp::OpDisk, "DISK" );
621 createGeomAction( GEOMOp::OpPrism, "EXTRUSION" );
622 createGeomAction( GEOMOp::OpRevolution, "REVOLUTION" );
623 createGeomAction( GEOMOp::OpFilling, "FILLING" );
624 createGeomAction( GEOMOp::OpPipe, "PIPE" );
626 createGeomAction( GEOMOp::OpGroupCreate, "GROUP_CREATE" );
627 createGeomAction( GEOMOp::OpGroupEdit, "GROUP_EDIT" );
629 createGeomAction( GEOMOp::OpReimport, "RELOAD_IMPORTED" );
631 createGeomAction( GEOMOp::OpQuadFace, "Q_FACE" );
632 createGeomAction( GEOMOp::OpHexaSolid, "HEX_SOLID" );
634 createGeomAction( GEOMOp::Op2dSketcher, "SKETCH" );
635 createGeomAction( GEOMOp::Op3dSketcher, "3DSKETCH" );
636 createGeomAction( GEOMOp::OpExplode, "EXPLODE" );
638 createGeomAction( GEOMOp::OpEdge, "EDGE" );
639 createGeomAction( GEOMOp::OpWire, "WIRE" );
640 createGeomAction( GEOMOp::OpFace, "FACE" );
641 createGeomAction( GEOMOp::OpShell, "SHELL" );
642 createGeomAction( GEOMOp::OpSolid, "SOLID" );
643 createGeomAction( GEOMOp::OpCompound, "COMPOUND" );
645 createGeomAction( GEOMOp::OpFuse, "FUSE" );
646 createGeomAction( GEOMOp::OpCommon, "COMMON" );
647 createGeomAction( GEOMOp::OpCut, "CUT" );
648 createGeomAction( GEOMOp::OpSection, "SECTION" );
650 createGeomAction( GEOMOp::OpTranslate, "TRANSLATION" );
651 createGeomAction( GEOMOp::OpRotate, "ROTATION" );
652 createGeomAction( GEOMOp::OpChangeLoc, "MODIFY_LOCATION" );
653 createGeomAction( GEOMOp::OpMirror, "MIRROR" );
654 createGeomAction( GEOMOp::OpScale, "SCALE" );
655 createGeomAction( GEOMOp::OpOffset, "OFFSET" );
656 createGeomAction( GEOMOp::OpMultiTranslate, "MUL_TRANSLATION" );
657 createGeomAction( GEOMOp::OpMultiRotate, "MUL_ROTATION" );
659 createGeomAction( GEOMOp::OpPartition, "PARTITION" );
660 createGeomAction( GEOMOp::OpArchimede, "ARCHIMEDE" );
661 createGeomAction( GEOMOp::OpFillet3d, "FILLET" );
662 createGeomAction( GEOMOp::OpChamfer, "CHAMFER" );
663 //createGeomAction( GEOMOp::OpClipping, "CLIPPING" );
664 createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPES" );
665 createGeomAction( GEOMOp::OpFillet1d, "FILLET_1D" );
666 createGeomAction( GEOMOp::OpFillet2d, "FILLET_2D" );
668 createGeomAction( GEOMOp::OpMultiTransform, "MUL_TRANSFORM" );
669 createGeomAction( GEOMOp::OpExplodeBlock, "EXPLODE_BLOCKS" );
670 createGeomAction( GEOMOp::OpPropagate, "PROPAGATE" );
672 createGeomAction( GEOMOp::OpSewing, "SEWING" );
673 createGeomAction( GEOMOp::OpGlueFaces, "GLUE_FACES" );
674 createGeomAction( GEOMOp::OpSuppressFaces, "SUPPRESS_FACES" );
675 createGeomAction( GEOMOp::OpSuppressHoles, "SUPPERSS_HOLES" );
676 createGeomAction( GEOMOp::OpShapeProcess, "SHAPE_PROCESS" );
677 createGeomAction( GEOMOp::OpCloseContour, "CLOSE_CONTOUR" );
678 createGeomAction( GEOMOp::OpRemoveIntWires, "SUPPRESS_INT_WIRES" );
679 createGeomAction( GEOMOp::OpAddPointOnEdge, "POINT_ON_EDGE" );
680 createGeomAction( GEOMOp::OpFreeBoundaries, "CHECK_FREE_BNDS" );
681 createGeomAction( GEOMOp::OpFreeFaces, "CHECK_FREE_FACES" );
682 createGeomAction( GEOMOp::OpOrientation, "CHANGE_ORIENTATION" );
683 createGeomAction( GEOMOp::OpRemoveExtraEdges, "REMOVE_EXTRA_EDGES" );
685 createGeomAction( GEOMOp::OpPointCoordinates, "POINT_COORDS" );
686 createGeomAction( GEOMOp::OpProperties, "BASIC_PROPS" );
687 createGeomAction( GEOMOp::OpCenterMass, "MASS_CENTER" );
688 createGeomAction( GEOMOp::OpInertia, "INERTIA" );
689 createGeomAction( GEOMOp::OpNormale, "NORMALE" );
690 createGeomAction( GEOMOp::OpBoundingBox, "BND_BOX" );
691 createGeomAction( GEOMOp::OpMinDistance, "MIN_DIST" );
692 createGeomAction( GEOMOp::OpAngle, "MEASURE_ANGLE" );
694 createGeomAction( GEOMOp::OpTolerance, "TOLERANCE" );
695 createGeomAction( GEOMOp::OpWhatIs, "WHAT_IS" );
696 createGeomAction( GEOMOp::OpCheckShape, "CHECK" );
697 createGeomAction( GEOMOp::OpCheckCompound, "CHECK_COMPOUND" );
699 #ifdef _DEBUG_ // PAL16821
700 createGeomAction( GEOMOp::OpCheckGeom, "CHECK_GEOMETRY" );
703 createGeomAction( GEOMOp::OpDisplayMode, "SHADING" );
704 createGeomAction( GEOMOp::OpShowAll, "DISPLAY_ALL" );
705 createGeomAction( GEOMOp::OpHideAll, "ERASE_ALL" );
706 createGeomAction( GEOMOp::OpShow, "DISPLAY" );
707 createGeomAction( GEOMOp::OpSwitchVectors, "VECTOR_MODE");
708 createGeomAction( GEOMOp::OpSelectVertex, "VERTEX_SEL_ONLY" ,"", 0, true );
709 createGeomAction( GEOMOp::OpSelectEdge, "EDGE_SEL_ONLY", "", 0, true );
710 createGeomAction( GEOMOp::OpSelectWire, "WIRE_SEL_ONLY", "", 0, true );
711 createGeomAction( GEOMOp::OpSelectFace, "FACE_SEL_ONLY", "", 0, true );
712 createGeomAction( GEOMOp::OpSelectShell, "SHELL_SEL_ONLY", "", 0, true );
713 createGeomAction( GEOMOp::OpSelectSolid, "SOLID_SEL_ONLY", "", 0, true );
714 createGeomAction( GEOMOp::OpSelectCompound, "COMPOUND_SEL_ONLY", "", 0, true );
715 createGeomAction( GEOMOp::OpSelectAll, "ALL_SEL_ONLY", "", 0, true );
716 createGeomAction( GEOMOp::OpShowOnly, "DISPLAY_ONLY" );
717 createGeomAction( GEOMOp::OpHide, "ERASE" );
719 createGeomAction( GEOMOp::OpRename, "POP_RENAME", "", Qt::Key_F2 );
720 createGeomAction( GEOMOp::OpWireframe, "POP_WIREFRAME", "", 0, true );
721 createGeomAction( GEOMOp::OpShading, "POP_SHADING", "", 0, true );
722 createGeomAction( GEOMOp::OpVectors, "POP_VECTORS", "", 0, true );
723 createGeomAction( GEOMOp::OpDeflection, "POP_DEFLECTION" );
724 createGeomAction( GEOMOp::OpColor, "POP_COLOR" );
725 createGeomAction( GEOMOp::OpTransparency, "POP_TRANSPARENCY" );
726 createGeomAction( GEOMOp::OpIsos, "POP_ISOS" );
727 createGeomAction( GEOMOp::OpAutoColor, "POP_AUTO_COLOR" );
728 createGeomAction( GEOMOp::OpNoAutoColor, "POP_DISABLE_AUTO_COLOR" );
729 createGeomAction( GEOMOp::OpGroupCreatePopup, "POP_CREATE_GROUP" );
730 createGeomAction( GEOMOp::OpShowChildren, "POP_SHOW_CHILDREN" );
731 createGeomAction( GEOMOp::OpHideChildren, "POP_HIDE_CHILDREN" );
732 createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
734 createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
735 // createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
736 //@@ insert new functions before this line @@//
738 // ---- create menus --------------------------
740 int fileId = createMenu( tr( "MEN_FILE" ), -1, -1 );
741 createMenu( separator(), fileId, 10 );
742 createMenu( GEOMOp::OpImport, fileId, 10 );
743 createMenu( GEOMOp::OpExport, fileId, 10 );
744 createMenu( separator(), fileId, -1 );
746 int editId = createMenu( tr( "MEN_EDIT" ), -1, -1 );
747 createMenu( GEOMOp::OpDelete, editId, -1 );
749 int newEntId = createMenu( tr( "MEN_NEW_ENTITY" ), -1, -1, 10 );
751 int basicId = createMenu( tr( "MEN_BASIC" ), newEntId, -1 );
752 createMenu( GEOMOp::OpPoint, basicId, -1 );
753 createMenu( GEOMOp::OpLine, basicId, -1 );
754 createMenu( GEOMOp::OpCircle, basicId, -1 );
755 createMenu( GEOMOp::OpEllipse, basicId, -1 );
756 createMenu( GEOMOp::OpArc, basicId, -1 );
757 createMenu( GEOMOp::OpCurve, basicId, -1 );
758 createMenu( separator(), basicId, -1 );
759 createMenu( GEOMOp::OpVector, basicId, -1 );
760 createMenu( GEOMOp::OpPlane, basicId, -1 );
761 createMenu( GEOMOp::OpLCS, basicId, -1 );
763 int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 );
764 createMenu( GEOMOp::OpBox, primId, -1 );
765 createMenu( GEOMOp::OpCylinder, primId, -1 );
766 createMenu( GEOMOp::OpSphere, primId, -1 );
767 createMenu( GEOMOp::OpTorus, primId, -1 );
768 createMenu( GEOMOp::OpCone, primId, -1 );
769 createMenu( GEOMOp::OpRectangle, primId, -1 );
770 createMenu( GEOMOp::OpDisk, primId, -1 );
772 int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 );
773 createMenu( GEOMOp::OpPrism, genId, -1 );
774 createMenu( GEOMOp::OpRevolution, genId, -1 );
775 createMenu( GEOMOp::OpFilling, genId, -1 );
776 createMenu( GEOMOp::OpPipe, genId, -1 );
778 int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
779 createMenu( GEOMOp::OpPipeTShape, advId, -1 );
780 // createMenu( GEOMOp::OpPipeTShapeGroups, advId, -1 );
781 //@@ insert new functions before this line @@//
783 createMenu( separator(), newEntId, -1 );
785 int groupId = createMenu( tr( "MEN_GROUP" ), newEntId, -1 );
786 createMenu( GEOMOp::OpGroupCreate, groupId, -1 );
787 createMenu( GEOMOp::OpGroupEdit, groupId, -1 );
789 createMenu( separator(), newEntId, -1 );
791 int blocksId = createMenu( tr( "MEN_BLOCKS" ), newEntId, -1 );
792 createMenu( GEOMOp::OpQuadFace, blocksId, -1 );
793 createMenu( GEOMOp::OpHexaSolid, blocksId, -1 );
795 createMenu( separator(), newEntId, -1 );
797 createMenu( GEOMOp::Op2dSketcher, newEntId, -1 );
798 createMenu( GEOMOp::Op3dSketcher, newEntId, -1 );
800 createMenu( separator(), newEntId, -1 );
802 createMenu( GEOMOp::OpExplode, newEntId, -1 );
804 int buildId = createMenu( tr( "MEN_BUILD" ), newEntId, -1 );
805 createMenu( GEOMOp::OpEdge, buildId, -1 );
806 createMenu( GEOMOp::OpWire, buildId, -1 );
807 createMenu( GEOMOp::OpFace, buildId, -1 );
808 createMenu( GEOMOp::OpShell, buildId, -1 );
809 createMenu( GEOMOp::OpSolid, buildId, -1 );
810 createMenu( GEOMOp::OpCompound, buildId, -1 );
812 int operId = createMenu( tr( "MEN_OPERATIONS" ), -1, -1, 10 );
814 int boolId = createMenu( tr( "MEN_BOOLEAN" ), operId, -1 );
815 createMenu( GEOMOp::OpFuse, boolId, -1 );
816 createMenu( GEOMOp::OpCommon, boolId, -1 );
817 createMenu( GEOMOp::OpCut, boolId, -1 );
818 createMenu( GEOMOp::OpSection, boolId, -1 );
820 int transId = createMenu( tr( "MEN_TRANSFORMATION" ), operId, -1 );
821 createMenu( GEOMOp::OpTranslate, transId, -1 );
822 createMenu( GEOMOp::OpRotate, transId, -1 );
823 createMenu( GEOMOp::OpChangeLoc, transId, -1 );
824 createMenu( GEOMOp::OpMirror, transId, -1 );
825 createMenu( GEOMOp::OpScale, transId, -1 );
826 createMenu( GEOMOp::OpOffset, transId, -1 );
827 createMenu( separator(), transId, -1 );
828 createMenu( GEOMOp::OpMultiTranslate, transId, -1 );
829 createMenu( GEOMOp::OpMultiRotate, transId, -1 );
831 int blockId = createMenu( tr( "MEN_BLOCKS" ), operId, -1 );
832 createMenu( GEOMOp::OpMultiTransform, blockId, -1 );
833 createMenu( GEOMOp::OpExplodeBlock, blockId, -1 );
834 createMenu( GEOMOp::OpPropagate, blockId, -1 );
836 createMenu( separator(), operId, -1 );
838 createMenu( GEOMOp::OpPartition, operId, -1 );
839 createMenu( GEOMOp::OpArchimede, operId, -1 );
840 createMenu( GEOMOp::OpShapesOnShape, operId, -1 );
842 createMenu( separator(), operId, -1 );
844 createMenu( GEOMOp::OpFillet1d, operId, -1 );
845 createMenu( GEOMOp::OpFillet2d, operId, -1 );
846 createMenu( GEOMOp::OpFillet3d, operId, -1 );
847 createMenu( GEOMOp::OpChamfer, operId, -1 );
848 //createMenu( GEOMOp::OpClipping, operId, -1 );
850 int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 );
851 createMenu( GEOMOp::OpShapeProcess, repairId, -1 );
852 createMenu( GEOMOp::OpSuppressFaces, repairId, -1 );
853 createMenu( GEOMOp::OpCloseContour, repairId, -1 );
854 createMenu( GEOMOp::OpRemoveIntWires, repairId, -1 );
855 createMenu( GEOMOp::OpSuppressHoles, repairId, -1 );
856 createMenu( GEOMOp::OpSewing, repairId, -1 );
857 createMenu( GEOMOp::OpGlueFaces, repairId, -1 );
858 createMenu( GEOMOp::OpAddPointOnEdge, repairId, -1 );
859 //createMenu( GEOMOp::OpFreeBoundaries, repairId, -1 );
860 //createMenu( GEOMOp::OpFreeFaces, repairId, -1 );
861 createMenu( GEOMOp::OpOrientation, repairId, -1 );
862 createMenu( GEOMOp::OpRemoveExtraEdges, repairId, -1 );
864 int measurId = createMenu( tr( "MEN_MEASURES" ), -1, -1, 10 );
865 createMenu( GEOMOp::OpPointCoordinates, measurId, -1 );
866 createMenu( GEOMOp::OpProperties, measurId, -1 );
867 createMenu( separator(), measurId, -1 );
868 createMenu( GEOMOp::OpCenterMass, measurId, -1 );
869 createMenu( GEOMOp::OpInertia, measurId, -1 );
870 createMenu( GEOMOp::OpNormale, measurId, -1 );
871 createMenu( separator(), measurId, -1 );
872 createMenu( GEOMOp::OpFreeBoundaries, measurId, -1 );
873 createMenu( GEOMOp::OpFreeFaces, measurId, -1 );
874 createMenu( separator(), measurId, -1 );
876 int dimId = createMenu( tr( "MEN_DIMENSIONS" ), measurId, -1 );
877 createMenu( GEOMOp::OpBoundingBox, dimId, -1 );
878 createMenu( GEOMOp::OpMinDistance, dimId, -1 );
879 createMenu( GEOMOp::OpAngle, dimId, -1 );
881 createMenu( separator(), measurId, -1 );
882 createMenu( GEOMOp::OpTolerance, measurId, -1 );
883 createMenu( separator(), measurId, -1 );
884 createMenu( GEOMOp::OpWhatIs, measurId, -1 );
885 createMenu( GEOMOp::OpCheckShape, measurId, -1 );
886 createMenu( GEOMOp::OpCheckCompound, measurId, -1 );
888 #ifdef _DEBUG_ // PAL16821
889 int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
890 createMenu( separator(), toolsId, -1 );
891 createMenu( GEOMOp::OpCheckGeom, toolsId, -1 );
894 int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 );
895 createMenu( separator(), viewId, -1 );
897 int dispmodeId = createMenu( tr( "MEN_DISPLAY_MODE" ), viewId, -1 );
898 createMenu( GEOMOp::OpDisplayMode, dispmodeId, -1 );
899 createMenu( separator(), dispmodeId, -1 );
900 createMenu( GEOMOp::OpSwitchVectors, dispmodeId, -1 );
902 createMenu( separator(), viewId, -1 );
903 createMenu( GEOMOp::OpShowAll, viewId, -1 );
904 createMenu( GEOMOp::OpHideAll, viewId, -1 );
905 createMenu( separator(), viewId, -1 );
909 because of these items are accessible through object browser and viewers
910 we have removed they from main menu
912 createMenu( GEOMOp::OpShow, viewId, -1 );
913 createMenu( GEOMOp::OpShowOnly, viewId, -1 );
914 createMenu( GEOMOp::OpHide, viewId, -1 );
917 // ---- create toolbars --------------------------
919 int basicTbId = createTool( tr( "TOOL_BASIC" ) );
920 createTool( GEOMOp::OpPoint, basicTbId );
921 createTool( GEOMOp::OpLine, basicTbId );
922 createTool( GEOMOp::OpCircle, basicTbId );
923 createTool( GEOMOp::OpEllipse, basicTbId );
924 createTool( GEOMOp::OpArc, basicTbId );
925 createTool( GEOMOp::OpCurve, basicTbId );
926 createTool( GEOMOp::OpVector, basicTbId );
927 createTool( GEOMOp::OpPlane, basicTbId );
928 createTool( GEOMOp::OpLCS, basicTbId );
930 int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) );
931 createTool( GEOMOp::OpBox, primTbId );
932 createTool( GEOMOp::OpCylinder, primTbId );
933 createTool( GEOMOp::OpSphere, primTbId );
934 createTool( GEOMOp::OpTorus, primTbId );
935 createTool( GEOMOp::OpCone, primTbId );
936 createTool( GEOMOp::OpRectangle, primTbId );
937 createTool( GEOMOp::OpDisk, primTbId );
939 int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) );
940 createTool( GEOMOp::OpFuse, boolTbId );
941 createTool( GEOMOp::OpCommon, boolTbId );
942 createTool( GEOMOp::OpCut, boolTbId );
943 createTool( GEOMOp::OpSection, boolTbId );
945 int genTbId = createTool( tr( "TOOL_GENERATION" ) );
946 createTool( GEOMOp::OpPrism, genTbId );
947 createTool( GEOMOp::OpRevolution, genTbId );
948 createTool( GEOMOp::OpFilling, genTbId );
949 createTool( GEOMOp::OpPipe, genTbId );
951 int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ) );
952 createTool( GEOMOp::OpTranslate, transTbId );
953 createTool( GEOMOp::OpRotate, transTbId );
954 createTool( GEOMOp::OpChangeLoc, transTbId );
955 createTool( GEOMOp::OpMirror, transTbId );
956 createTool( GEOMOp::OpScale, transTbId );
957 createTool( GEOMOp::OpOffset, transTbId );
958 createTool( separator(), transTbId );
959 createTool( GEOMOp::OpMultiTranslate, transTbId );
960 createTool( GEOMOp::OpMultiRotate, transTbId );
962 int operTbId = createTool( tr( "TOOL_OPERATIONS" ) );
963 createTool( GEOMOp::Op2dSketcher, operTbId );
964 createTool( GEOMOp::Op3dSketcher, operTbId );
965 createTool( separator(), operTbId );
966 createTool( GEOMOp::OpExplode, operTbId );
967 createTool( separator(), operTbId );
968 createTool( GEOMOp::OpPartition, operTbId );
969 createTool( GEOMOp::OpArchimede, operTbId );
970 createTool( GEOMOp::OpShapesOnShape, operTbId );
971 createTool( separator(), operTbId );
972 createTool( GEOMOp::OpFillet1d, operTbId );
973 createTool( GEOMOp::OpFillet2d, operTbId );
974 createTool( GEOMOp::OpFillet3d, operTbId );
975 createTool( GEOMOp::OpChamfer, operTbId );
977 int buildTbId = createTool( tr( "TOOL_BUILD" ) );
978 createTool( GEOMOp::OpEdge, buildTbId );
979 createTool( GEOMOp::OpWire, buildTbId );
980 createTool( GEOMOp::OpFace, buildTbId );
981 createTool( GEOMOp::OpShell, buildTbId );
982 createTool( GEOMOp::OpSolid, buildTbId );
983 createTool( GEOMOp::OpCompound, buildTbId );
985 int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
986 createTool( GEOMOp::OpPipeTShape, advancedTbId );
987 //@@ insert new functions before this line @@//
989 // ---- create popup menus --------------------------
991 QString clientOCCorVTK = "(client='OCCViewer' or client='VTKViewer')";
992 QString clientOCCorVTK_AndSomeVisible = clientOCCorVTK + " and selcount>0 and isVisible";
994 QString clientOCCorVTKorOB = "(client='ObjectBrowser' or client='OCCViewer' or client='VTKViewer')";
995 QString clientOCCorVTKorOB_AndSomeVisible = clientOCCorVTKorOB + " and selcount>0 and isVisible";
997 QString autoColorPrefix =
998 "(client='ObjectBrowser' or client='OCCViewer') and type='Shape' and selcount=1 and isOCC=true";
1000 QtxPopupMgr* mgr = popupMgr();
1001 mgr->insert( action( GEOMOp::OpRename ), -1, -1 ); // rename
1002 mgr->setRule( action( GEOMOp::OpRename ), QString("$type in {'Shape' 'Group'} and selcount=1"), QtxPopupMgr::VisibleRule );
1003 mgr->insert( action( GEOMOp::OpDelete ), -1, -1 ); // delete
1004 mgr->setRule( action( GEOMOp::OpDelete ), QString("$type in {'Shape' 'Group'} and selcount>0"), QtxPopupMgr::VisibleRule );
1005 mgr->insert( action( GEOMOp::OpGroupCreatePopup ), -1, -1 ); // create group
1006 mgr->setRule( action( GEOMOp::OpGroupCreatePopup ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
1007 mgr->insert( action( GEOMOp::OpShowChildren ), -1, -1 ); // show children
1008 mgr->setRule( action( GEOMOp::OpShowChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasHiddenChildren=true"), QtxPopupMgr::VisibleRule );
1009 mgr->insert( action( GEOMOp::OpHideChildren ), -1, -1 ); // hide children
1010 mgr->setRule( action( GEOMOp::OpHideChildren ), QString("client='ObjectBrowser' and type='Shape' and selcount=1 and hasShownChildren=true"), QtxPopupMgr::VisibleRule );
1011 mgr->insert( action( GEOMOp::OpGroupEdit ), -1, -1 ); // edit group
1012 mgr->setRule( action( GEOMOp::OpGroupEdit ), QString("client='ObjectBrowser' and type='Group' and selcount=1 and isOCC=true"), QtxPopupMgr::VisibleRule );
1013 mgr->insert( separator(), -1, -1 ); // -----------
1014 dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu
1015 mgr->insert( action( GEOMOp::OpWireframe ), dispmodeId, -1 ); // wireframe
1016 mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
1017 mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK + " and displaymode='Wireframe'", QtxPopupMgr::ToggleRule );
1018 mgr->insert( action( GEOMOp::OpShading ), dispmodeId, -1 ); // shading
1019 mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
1020 mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule );
1021 mgr->insert( separator(), dispmodeId, -1 );
1022 mgr->insert( action( GEOMOp::OpVectors ), dispmodeId, -1 ); // vectors
1023 mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
1024 mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK + " and isVectorsMode", QtxPopupMgr::ToggleRule );
1025 mgr->insert( separator(), -1, -1 ); // -----------
1026 mgr->insert( action( GEOMOp::OpColor ), -1, -1 ); // color
1027 mgr->setRule( action( GEOMOp::OpColor ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
1028 mgr->insert( action( GEOMOp::OpTransparency ), -1, -1 ); // transparency
1029 mgr->setRule( action( GEOMOp::OpTransparency ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
1030 mgr->insert( action( GEOMOp::OpIsos ), -1, -1 ); // isos
1031 mgr->setRule( action( GEOMOp::OpIsos ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
1032 mgr->insert( action( GEOMOp::OpDeflection ), -1, -1 ); // deflection
1033 mgr->setRule( action( GEOMOp::OpDeflection ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
1034 mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker
1035 mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg( GEOM_POINT ), QtxPopupMgr::VisibleRule );
1036 mgr->insert( separator(), -1, -1 ); // -----------
1037 mgr->insert( action( GEOMOp::OpAutoColor ), -1, -1 ); // auto color
1038 mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule );
1039 mgr->insert( action( GEOMOp::OpNoAutoColor ), -1, -1 ); // disable auto color
1040 mgr->setRule( action( GEOMOp::OpNoAutoColor ), autoColorPrefix + " and isAutoColor=true", QtxPopupMgr::VisibleRule );
1041 mgr->insert( separator(), -1, -1 ); // -----------
1043 QString canDisplay = "($component={'GEOM'}) and (selcount>0) and ({true} in $canBeDisplayed) ",
1044 onlyComponent = "((type='Component') and selcount=1)",
1045 rule = canDisplay + "and ((($type in {%1}) and( %2 )) or " + onlyComponent + ")",
1046 types = "'Shape' 'Group'";
1048 mgr->insert( action( GEOMOp::OpShow ), -1, -1 ); // display
1049 mgr->setRule( action( GEOMOp::OpShow ), rule.arg( types ).arg( "not isVisible" ), QtxPopupMgr::VisibleRule );
1051 mgr->insert( action( GEOMOp::OpHide ), -1, -1 ); // erase
1052 mgr->setRule( action( GEOMOp::OpHide ), rule.arg( types ).arg( "isVisible" ), QtxPopupMgr::VisibleRule );
1054 mgr->insert( action( GEOMOp::OpHideAll ), -1, -1 ); // erase All
1055 mgr->setRule( action( GEOMOp::OpHideAll ), clientOCCorVTK, QtxPopupMgr::VisibleRule );
1057 QString selectOnly = "(client='OCCViewer' or client='VTKViewer') and (selcount=0)";
1059 int selectonlyId = mgr->insert( tr("MEN_SELECT_ONLY"), -1, -1); //select only menu
1060 mgr->insert( action(GEOMOp::OpSelectVertex), selectonlyId, -1); //Vertex
1061 mgr->setRule(action(GEOMOp::OpSelectVertex), selectOnly, QtxPopupMgr::VisibleRule);
1062 mgr->setRule(action(GEOMOp::OpSelectVertex), selectOnly + " and selectionmode='VERTEX'", QtxPopupMgr::ToggleRule);
1063 mgr->insert( action(GEOMOp::OpSelectEdge), selectonlyId, -1); //Edge
1064 mgr->setRule(action(GEOMOp::OpSelectEdge), selectOnly, QtxPopupMgr::VisibleRule);
1065 mgr->setRule(action(GEOMOp::OpSelectEdge), selectOnly + " and selectionmode='EDGE'", QtxPopupMgr::ToggleRule);
1066 mgr->insert( action(GEOMOp::OpSelectWire), selectonlyId, -1); //Wire
1067 mgr->setRule(action(GEOMOp::OpSelectWire), selectOnly, QtxPopupMgr::VisibleRule);
1068 mgr->setRule(action(GEOMOp::OpSelectWire), selectOnly + " and selectionmode='WIRE'", QtxPopupMgr::ToggleRule);
1069 mgr->insert( action(GEOMOp::OpSelectFace), selectonlyId, -1); //Face
1070 mgr->setRule(action(GEOMOp::OpSelectFace), selectOnly, QtxPopupMgr::VisibleRule);
1071 mgr->setRule(action(GEOMOp::OpSelectFace), selectOnly + " and selectionmode='FACE'", QtxPopupMgr::ToggleRule);
1072 mgr->insert( action(GEOMOp::OpSelectShell), selectonlyId, -1); //Shell
1073 mgr->setRule(action(GEOMOp::OpSelectShell), selectOnly, QtxPopupMgr::VisibleRule);
1074 mgr->setRule(action(GEOMOp::OpSelectShell), selectOnly + " and selectionmode='SHELL'", QtxPopupMgr::ToggleRule);
1075 mgr->insert( action(GEOMOp::OpSelectSolid), selectonlyId, -1); //Solid
1076 mgr->setRule(action(GEOMOp::OpSelectSolid), selectOnly, QtxPopupMgr::VisibleRule);
1077 mgr->setRule(action(GEOMOp::OpSelectSolid), selectOnly + " and selectionmode='SOLID'", QtxPopupMgr::ToggleRule);
1078 mgr->insert( action(GEOMOp::OpSelectCompound), selectonlyId, -1); //Compound
1079 mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly, QtxPopupMgr::VisibleRule);
1080 mgr->setRule(action(GEOMOp::OpSelectCompound), selectOnly + " and selectionmode='COMPOUND'", QtxPopupMgr::ToggleRule);
1081 mgr->insert( separator(), selectonlyId, -1);
1082 mgr->insert( action(GEOMOp::OpSelectAll), selectonlyId, -1); //Clear selection filter
1083 mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly, QtxPopupMgr::VisibleRule);
1084 mgr->setRule(action(GEOMOp::OpSelectAll), selectOnly + " and selectionmode='ALL'", QtxPopupMgr::ToggleRule);
1085 mgr->insert( action(GEOMOp::OpShowOnly ), -1, -1 ); // display only
1086 mgr->setRule(action(GEOMOp::OpShowOnly ), rule.arg( types ).arg( "true" ), QtxPopupMgr::VisibleRule );
1087 mgr->insert( separator(), -1, -1 );
1089 mgr->hide( mgr->actionId( action( myEraseAll ) ) );
1092 //=======================================================================
1093 // function : GeometryGUI::activateModule()
1094 // purpose : Called when GEOM module is activated
1095 //=======================================================================
1096 bool GeometryGUI::activateModule( SUIT_Study* study )
1098 if ( CORBA::is_nil( myComponentGeom ) )
1101 bool res = SalomeApp_Module::activateModule( study );
1106 setMenuShown( true );
1107 setToolShown( true );
1109 // import Python module that manages GEOM plugins (need to be here because SalomePyQt API uses active module)
1110 PyGILState_STATE gstate = PyGILState_Ensure();
1111 PyObject* pluginsmanager=PyImport_ImportModule((char*)"salome_pluginsmanager");
1112 if(pluginsmanager==NULL)
1116 PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"geom","New Entity","Other");
1121 PyGILState_Release(gstate);
1122 // end of GEOM plugins loading
1124 connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
1125 this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
1127 // Reset actions accelerator keys
1128 action(GEOMOp::OpImport)->setEnabled( true ); // Import: CTRL + Key_I
1129 action(GEOMOp::OpExport)->setEnabled( true ); // Export: CTRL + Key_E
1130 action(GEOMOp::OpDelete)->setEnabled( true ); // Delete: Key_Delete
1131 action(GEOMOp::OpRename)->setEnabled( true ); // Rename: Key_F2
1133 GUIMap::Iterator it;
1134 for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
1135 it.value()->activate( application()->desktop() );
1137 LightApp_SelectionMgr* sm = getApp()->selectionMgr();
1139 SUIT_ViewManager* vm;
1140 ViewManagerList OCCViewManagers, VTKViewManagers;
1142 application()->viewManagers( OCCViewer_Viewer::Type(), OCCViewManagers );
1143 QListIterator<SUIT_ViewManager*> itOCC( OCCViewManagers );
1144 while ( itOCC.hasNext() && (vm = itOCC.next()) )
1145 myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) );
1147 application()->viewManagers( SVTK_Viewer::Type(), VTKViewManagers );
1148 QListIterator<SUIT_ViewManager*> itVTK( VTKViewManagers );
1149 while ( itVTK.hasNext() && (vm = itVTK.next()) )
1150 myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast<SVTK_Viewer*>( vm->getViewModel() ), sm ) );
1153 SALOME_ListIO selected;
1154 sm->selectedObjects( selected );
1155 sm->clearSelected();
1157 // disable OCC selectors
1158 getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() );
1159 QListIterator<GEOMGUI_OCCSelector*> itOCCSel( myOCCSelectors );
1160 while ( itOCCSel.hasNext() )
1161 if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() )
1162 sr->setEnabled(true);
1164 // disable VTK selectors
1165 getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() );
1166 QListIterator<LightApp_VTKSelector*> itVTKSel( myVTKSelectors );
1167 while ( itVTKSel.hasNext() )
1168 if ( LightApp_VTKSelector* sr = itVTKSel.next() )
1169 sr->setEnabled(true);
1171 sm->setSelectedObjects( selected, true ); //NPAL 19674
1173 QMenu* viewMenu = menuMgr()->findMenu( STD_Application::MenuViewId );
1175 connect( viewMenu, SIGNAL( aboutToShow() ), this, SLOT( onViewAboutToShow() ) );
1181 //=======================================================================
1182 // function : GeometryGUI::deactivateModule()
1183 // purpose : Called when GEOM module is deactivated
1184 //=======================================================================
1185 bool GeometryGUI::deactivateModule( SUIT_Study* study )
1187 QMenu* viewMenu = menuMgr()->findMenu( STD_Application::MenuViewId );
1189 disconnect( viewMenu, SIGNAL( aboutToShow() ), this, SLOT( onViewAboutToShow() ) );
1191 setMenuShown( false );
1192 setToolShown( false );
1194 disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
1195 this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
1197 EmitSignalCloseAllDialogs();
1199 GUIMap::Iterator it;
1200 for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
1201 it.value()->deactivate();
1203 // Unset actions accelerator keys
1204 action(GEOMOp::OpImport)->setEnabled( false ); // Import: CTRL + Key_I
1205 action(GEOMOp::OpExport)->setEnabled( false ); // Export: CTRL + Key_E
1206 action(GEOMOp::OpDelete)->setEnabled( false ); // Delete: Key_Delete
1207 action(GEOMOp::OpRename)->setEnabled( false ); // Rename: Key_F2
1209 qDeleteAll(myOCCSelectors);
1210 myOCCSelectors.clear();
1211 getApp()->selectionMgr()->setEnabled( true, OCCViewer_Viewer::Type() );
1213 qDeleteAll(myVTKSelectors);
1214 myVTKSelectors.clear();
1215 getApp()->selectionMgr()->setEnabled( true, SVTK_Viewer::Type() );
1217 return SalomeApp_Module::deactivateModule( study );
1220 //=======================================================================
1221 // function : onWindowActivated()
1222 // purpose : update menu items' status - disable non-OCC-viewer-compatible actions
1223 //=======================================================================
1224 void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win )
1229 const bool ViewOCC = ( win->getViewManager()->getType() == OCCViewer_Viewer::Type() );
1230 //const bool ViewVTK = ( win->getViewManager()->getType() == SVTK_Viewer::Type() );
1232 // disable non-OCC viewframe menu commands
1233 // action( GEOMOp::Op2dSketcher )->setEnabled( ViewOCC ); // SKETCHER
1234 action( GEOMOp::OpSuppressFaces )->setEnabled( ViewOCC ); // SuppressFace
1235 action( GEOMOp::OpSuppressHoles )->setEnabled( ViewOCC ); // SuppressHole
1236 action( GEOMOp::OpCloseContour )->setEnabled( ViewOCC ); // CloseContour
1237 action( GEOMOp::OpRemoveIntWires )->setEnabled( ViewOCC ); // RemoveInternalWires
1238 action( GEOMOp::OpAddPointOnEdge )->setEnabled( ViewOCC ); // AddPointOnEdge
1239 // action( GEOMOp::OpFreeBoundaries )->setEnabled( ViewOCC ); // Free boundaries
1241 action( GEOMOp::OpGroupCreate )->setEnabled( ViewOCC ); // Create Group
1242 action( GEOMOp::OpGroupEdit )->setEnabled( ViewOCC ); // Edit Group
1244 action( GEOMOp::OpMultiTransform )->setEnabled( ViewOCC ); // MENU BLOCKS - MULTI-TRANSFORMATION
1247 void GeometryGUI::windows( QMap<int, int>& mappa ) const
1249 mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
1250 mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
1253 void GeometryGUI::viewManagers( QStringList& lst ) const
1255 lst.append( OCCViewer_Viewer::Type() );
1258 void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm )
1260 if ( vm->getType() == OCCViewer_Viewer::Type() )
1262 qDebug( "connect" );
1263 connect( vm, SIGNAL( keyPress ( SUIT_ViewWindow*, QKeyEvent* ) ),
1264 this, SLOT( OnKeyPress( SUIT_ViewWindow*, QKeyEvent* ) ) );
1265 connect( vm, SIGNAL( mousePress( SUIT_ViewWindow*, QMouseEvent* ) ),
1266 this, SLOT( OnMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) );
1267 connect( vm, SIGNAL( mouseMove ( SUIT_ViewWindow*, QMouseEvent* ) ),
1268 this, SLOT( OnMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
1270 LightApp_SelectionMgr* sm = getApp()->selectionMgr();
1271 myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) );
1273 // disable OCC selectors
1274 getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() );
1275 QListIterator<GEOMGUI_OCCSelector*> itOCCSel( myOCCSelectors );
1276 while ( itOCCSel.hasNext() )
1277 if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() )
1278 sr->setEnabled(true);
1280 else if ( vm->getType() == SVTK_Viewer::Type() )
1282 LightApp_SelectionMgr* sm = getApp()->selectionMgr();
1283 myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast<SVTK_Viewer*>( vm->getViewModel() ), sm ) );
1285 // disable VTK selectors
1286 getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() );
1287 QListIterator<LightApp_VTKSelector*> itVTKSel( myVTKSelectors );
1288 while ( itVTKSel.hasNext() )
1289 if ( LightApp_VTKSelector* sr = itVTKSel.next() )
1290 sr->setEnabled(true);
1294 void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm )
1296 SUIT_ViewModel* viewer = vm->getViewModel();
1297 if ( vm->getType() == OCCViewer_Viewer::Type() )
1299 QListIterator<GEOMGUI_OCCSelector*> itOCCSel( myOCCSelectors );
1300 while ( itOCCSel.hasNext() )
1301 if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() )
1302 if ( sr->viewer() == viewer )
1304 delete myOCCSelectors.takeAt( myOCCSelectors.indexOf( sr ) );
1308 if ( vm->getType() == SVTK_Viewer::Type() )
1310 QListIterator<LightApp_VTKSelector*> itVTKSel( myVTKSelectors );
1311 while ( itVTKSel.hasNext() )
1312 if ( LightApp_VTKSelector* sr = itVTKSel.next() )
1313 if ( sr->viewer() == viewer )
1315 delete myVTKSelectors.takeAt( myVTKSelectors.indexOf( sr ) );
1321 QString GeometryGUI::engineIOR() const
1323 if ( !CORBA::is_nil( GetGeomGen() ) )
1324 return QString( getApp()->orb()->object_to_string( GetGeomGen() ) );
1328 Handle(Graphic3d_HArray1OfBytes) GeometryGUI::getTexture( SalomeApp_Study* theStudy, int theId, int& theWidth, int& theHeight )
1330 theWidth = theHeight = 0;
1331 Handle(Graphic3d_HArray1OfBytes) aTexture;
1333 TextureMap aTextureMap = myTextureMap[ theStudy->studyDS()->StudyId() ];
1334 aTexture = aTextureMap[ theId ];
1335 if ( aTexture.IsNull() ) {
1336 GEOM::GEOM_IInsertOperations_var aInsOp = GeometryGUI::GetGeomGen()->GetIInsertOperations( theStudy->studyDS()->StudyId() );
1337 if ( !aInsOp->_is_nil() ) {
1338 CORBA::Long aWidth, aHeight;
1339 SALOMEDS::TMPFile_var aStream = aInsOp->GetTexture( theId, aWidth, aHeight );
1340 if ( aWidth > 0 && aHeight > 0 && aStream->length() > 0 ) {
1342 theHeight = aHeight;
1343 aTexture = new Graphic3d_HArray1OfBytes( 1, aStream->length() );
1344 for ( int i = 0; i < aStream->length(); i++ )
1345 aTexture->SetValue( i+1, (Standard_Byte)aStream[i] );
1346 aTextureMap[ theId ] = aTexture;
1354 LightApp_Selection* GeometryGUI::createSelection() const
1356 return new GEOMGUI_Selection();
1359 void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
1361 SalomeApp_Module::contextMenuPopup(client, menu, title);
1364 getApp()->selectionMgr()->selectedObjects(lst);
1365 if (lst.Extent() < 1)
1368 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
1369 _PTR(Study) study = appStudy->studyDS();
1371 bool isImported = true;
1372 SALOME_ListIteratorOfListIO anIt (lst);
1373 for (; anIt.More() && isImported; anIt.Next()) {
1374 Handle(SALOME_InteractiveObject) io = anIt.Value();
1375 _PTR(SObject) aSObj = study->FindObjectID(io->getEntry());
1377 if (lst.Extent() == 1) {
1378 // Set context menu title
1379 if (client == "OCCViewer" || client == "VTKViewer")
1380 title = QString(aSObj->GetName().c_str());
1383 CORBA::Object_var anObj = GeometryGUI::ClientSObjectToObject(aSObj);
1384 GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(anObj);
1385 if (CORBA::is_nil(aGeomObj) || aGeomObj->GetType() != GEOM_IMPORT)
1393 menu->addAction(action(GEOMOp::OpReimport)); // Reload imported shape
1397 void GeometryGUI::createPreferences()
1399 int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
1401 int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
1402 setPreferenceProperty( genGroup, "columns", 2 );
1404 int dispmode = addPreference( tr( "PREF_DISPLAY_MODE" ), genGroup,
1405 LightApp_Preferences::Selector,
1406 "Geometry", "display_mode" );
1408 addPreference( tr( "PREF_SHADING_COLOR" ), genGroup,
1409 LightApp_Preferences::Color, "Geometry", "shading_color" );
1411 addPreference( tr( "PREF_WIREFRAME_COLOR" ), genGroup,
1412 LightApp_Preferences::Color, "Geometry", "wireframe_color" );
1414 addPreference( tr( "PREF_FREE_BOUND_COLOR" ), genGroup,
1415 LightApp_Preferences::Color, "Geometry", "free_bound_color" );
1417 addPreference( tr( "PREF_LINE_COLOR"), genGroup,
1418 LightApp_Preferences::Color, "Geometry", "line_color" );
1420 addPreference( tr( "PREF_POINT_COLOR"), genGroup,
1421 LightApp_Preferences::Color, "Geometry", "point_color" );
1423 addPreference( tr( "PREF_ISOS_COLOR" ), genGroup,
1424 LightApp_Preferences::Color, "Geometry", "isos_color" );
1426 int step = addPreference( tr( "PREF_STEP_VALUE" ), genGroup,
1427 LightApp_Preferences::IntSpin, "Geometry", "SettingsGeomStep" );
1429 int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
1430 LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
1432 // Quantities with individual precision settings
1433 int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId );
1434 setPreferenceProperty( precGroup, "columns", 2 );
1436 const int nbQuantities = 8;
1437 int prec[nbQuantities], ii = 0;
1438 prec[ii++] = addPreference( tr( "GEOM_PREF_length_precision" ), precGroup,
1439 LightApp_Preferences::IntSpin, "Geometry", "length_precision" );
1440 prec[ii++] = addPreference( tr( "GEOM_PREF_angle_precision" ), precGroup,
1441 LightApp_Preferences::IntSpin, "Geometry", "angle_precision" );
1442 prec[ii++] = addPreference( tr( "GEOM_PREF_len_tol_precision" ), precGroup,
1443 LightApp_Preferences::IntSpin, "Geometry", "len_tol_precision" );
1444 prec[ii++] = addPreference( tr( "GEOM_PREF_ang_tol_precision" ), precGroup,
1445 LightApp_Preferences::IntSpin, "Geometry", "ang_tol_precision" );
1446 prec[ii++] = addPreference( tr( "GEOM_PREF_weight_precision" ), precGroup,
1447 LightApp_Preferences::IntSpin, "Geometry", "weight_precision" );
1448 prec[ii++] = addPreference( tr( "GEOM_PREF_density_precision" ), precGroup,
1449 LightApp_Preferences::IntSpin, "Geometry", "density_precision" );
1450 prec[ii++] = addPreference( tr( "GEOM_PREF_parametric_precision" ), precGroup,
1451 LightApp_Preferences::IntSpin, "Geometry", "parametric_precision" );
1452 prec[ii ] = addPreference( tr( "GEOM_PREF_param_tol_precision" ), precGroup,
1453 LightApp_Preferences::IntSpin, "Geometry", "param_tol_precision" );
1455 // Set property for precision value for spinboxes
1456 for ( ii = 0; ii < nbQuantities; ii++ ){
1457 setPreferenceProperty( prec[ii], "min", -10 );
1458 setPreferenceProperty( prec[ii], "max", 10 );
1459 setPreferenceProperty( prec[ii], "precision", 2 );
1462 int VertexGroup = addPreference( tr( "PREF_GROUP_VERTEX" ), tabId );
1463 setPreferenceProperty( VertexGroup, "columns", 2 );
1465 int typeOfMarker = addPreference( tr( "PREF_TYPE_OF_MARKER" ), VertexGroup,
1466 LightApp_Preferences::Selector, "Geometry", "type_of_marker" );
1468 int markerScale = addPreference( tr( "PREF_MARKER_SCALE" ), VertexGroup,
1469 LightApp_Preferences::Selector, "Geometry", "marker_scale" );
1471 // Set property for default display mode
1472 QStringList aModesList;
1473 aModesList.append( tr("MEN_WIREFRAME") );
1474 aModesList.append( tr("MEN_SHADING") );
1476 QList<QVariant> anIndexesList;
1477 anIndexesList.append(0);
1478 anIndexesList.append(1);
1480 setPreferenceProperty( dispmode, "strings", aModesList );
1481 setPreferenceProperty( dispmode, "indexes", anIndexesList );
1483 // Set property for step value for spinboxes
1484 setPreferenceProperty( step, "min", 1 );
1485 setPreferenceProperty( step, "max", 10000 );
1486 setPreferenceProperty( step, "precision", 3 );
1488 // Set property for deflection value for spinboxes
1489 setPreferenceProperty( defl, "min", DEFLECTION_MIN );
1490 setPreferenceProperty( defl, "max", 1.0 );
1491 setPreferenceProperty( defl, "step", 1.0e-04 );
1492 setPreferenceProperty( defl, "precision", 6 );
1494 // Set property vertex marker type
1495 QList<QVariant> aMarkerTypeIndicesList;
1496 QList<QVariant> aMarkerTypeIconsList;
1498 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1499 for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) {
1500 QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
1501 QPixmap pixmap = resMgr->loadPixmap( "GEOM", tr( qPrintable( icoFile ) ) );
1502 aMarkerTypeIndicesList << (i-1);
1503 aMarkerTypeIconsList << pixmap;
1506 setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
1507 setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
1509 // Set property for vertex marker scale
1510 QList<QVariant> aMarkerScaleIndicesList;
1511 QStringList aMarkerScaleValuesList;
1513 for ( int iii = GEOM::MS_10; iii <= GEOM::MS_70; iii++ ) {
1514 aMarkerScaleIndicesList << iii;
1515 aMarkerScaleValuesList << QString::number( (iii-(int)GEOM::MS_10)*0.5 + 1.0 );
1518 setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
1519 setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
1522 void GeometryGUI::preferencesChanged( const QString& section, const QString& param )
1524 if (section == "Geometry") {
1525 SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
1526 if (param == QString("SettingsGeomStep")) {
1527 double spin_step = aResourceMgr->doubleValue(section, param, 100.);
1528 EmitSignalDefaultStepValueChanged(spin_step);
1533 LightApp_Displayer* GeometryGUI::displayer()
1536 myDisplayer = new GEOM_Displayer( dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() ) );
1540 void GeometryGUI::setLocalSelectionMode(const int mode)
1542 myLocalSelectionMode = mode;
1544 int GeometryGUI::getLocalSelectionMode() const
1546 return myLocalSelectionMode;
1549 const char gSeparator = '_'; // character used to separate parameter names
1550 const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b)
1553 * \brief Store visual parameters
1555 * This method is called just before the study document is saved.
1556 * Store visual parameters in AttributeParameter attribue(s)
1558 void GeometryGUI::storeVisualParameters (int savePoint)
1560 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
1561 if (!appStudy || !appStudy->studyDS())
1563 _PTR(Study) studyDS = appStudy->studyDS();
1565 // componentName is used for encoding of entries when storing them in IParameters
1566 std::string componentName = myComponentGeom->ComponentDataType();
1567 //_PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM");
1568 //if (!aSComponent) return;
1571 _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative",
1572 componentName.c_str(),
1574 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
1576 // viewers counters are used for storing view_numbers in IParameters
1577 int vtkViewers(0), occViewers(0);
1579 QList<SUIT_ViewManager*> lst;
1580 QList<SUIT_ViewManager*>::Iterator it;
1582 // main cycle to store parameters of displayed objects
1584 vtkViewers = occViewers = 0;
1585 getApp()->viewManagers(lst);
1586 for (it = lst.begin(); it != lst.end(); it++)
1588 SUIT_ViewManager* vman = *it;
1589 QString vType = vman->getType();
1591 // saving VTK actors properties
1592 if (vType == SVTK_Viewer::Type())
1594 QVector<SUIT_ViewWindow*> views = vman->getViews();
1595 for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++)
1597 if (SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>(views[i]))
1599 vtkActorCollection* allActors = vtkView->getRenderer()->GetActors();
1600 allActors->InitTraversal();
1601 while (vtkActor* actor = allActors->GetNextActor())
1603 if (actor->GetVisibility()) // store only visible actors
1605 GEOM_Actor* aGeomActor = 0;
1606 if (actor->IsA("GEOM_Actor"))
1607 aGeomActor = GEOM_Actor::SafeDownCast(actor);
1608 if (aGeomActor && aGeomActor->hasIO())
1610 Handle(SALOME_InteractiveObject) io = aGeomActor->getIO();
1613 // entry is "encoded" = it does NOT contain component adress, since it is a
1614 // subject to change on next component loading
1615 std::string entry = ip->encodeEntry(io->getEntry(), componentName);
1617 std::string param, occParam = vType.toLatin1().data();
1618 occParam += gSeparator;
1619 occParam += QString::number(vtkViewers).toLatin1().data();
1620 occParam += gSeparator;
1622 param = occParam + "Visibility";
1623 ip->setParameter(entry, param, "On");
1625 param = occParam + "DisplayMode";
1626 ip->setParameter(entry, param, QString::number
1627 (aGeomActor->getDisplayMode()).toLatin1().data());
1629 vtkFloatingPointType r, g, b;
1630 aGeomActor->GetColor(r, g, b);
1631 QString colorStr = QString::number(r);
1632 colorStr += gDigitsSep; colorStr += QString::number(g);
1633 colorStr += gDigitsSep; colorStr += QString::number(b);
1634 param = occParam + "Color";
1635 ip->setParameter(entry, param, colorStr.toLatin1().data());
1637 param = occParam + "Opacity";
1638 ip->setParameter(entry, param, QString::number(aGeomActor->GetOpacity()).toLatin1().data());
1640 int nbUIso(0), nbVIso(0);
1641 aGeomActor->GetNbIsos(nbUIso,nbVIso);
1642 QString isosStr = QString::number(nbUIso);
1643 isosStr += gDigitsSep;
1644 isosStr += QString::number(nbVIso);
1645 param = occParam + "Isos";
1646 ip->setParameter(entry, param, isosStr.toLatin1().data());
1647 } // if (io->hasEntry())
1648 } // GEOM_Actor && hasIO
1650 } // while.. actors traversal
1654 } // if (SVTK view model)
1655 else if (vType == SOCC_Viewer::Type()) // processing OCC viewers
1657 QVector<SUIT_ViewWindow*> views = vman->getViews();
1658 for (int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++)
1660 SOCC_ViewWindow* occView = dynamic_cast<SOCC_ViewWindow*>(views[i]);
1663 //Handle(AIS_InteractiveContext) ic =
1664 // ((OCCViewer_Viewer*)(occView->getViewManager()->getViewModel()))->getAISContext();
1665 OCCViewer_Viewer* viewModel = (OCCViewer_Viewer*)(vman->getViewModel());
1666 //OCCViewer_Viewer* viewModel = ((OCCViewer_ViewManager*)vman)->getOCCViewer();
1667 Handle(AIS_InteractiveContext) ic = viewModel->getAISContext();
1669 AIS_ListOfInteractive aList;
1670 ic->DisplayedObjects(aList);
1672 AIS_ListIteratorOfListOfInteractive ite (aList);
1673 for (; ite.More(); ite.Next())
1675 if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape)))
1677 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
1680 Handle(SALOME_InteractiveObject) io =
1681 Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO());
1684 // entry is "encoded": it does NOT contain component adress,
1685 // since it is a subject to change on next component loading
1686 std::string entry = ip->encodeEntry(io->getEntry(), componentName);
1688 std::string param, occParam = vType.toLatin1().data();
1689 occParam += gSeparator;
1690 occParam += QString::number(occViewers).toLatin1().data();
1691 occParam += gSeparator;
1694 param = occParam + "Visibility";
1695 ip->setParameter(entry, param, "On");
1698 param = occParam + "DisplayMode";
1699 int dm = aSh->DisplayMode();
1700 ip->setParameter(entry, param, QString::number(dm).toLatin1().data());
1703 // is a property of GEOM_Object, it is stored by GEOM engine
1706 param = occParam + "Transparency";
1707 ip->setParameter(entry, param, QString::number(aSh->Transparency()).toLatin1().data());
1710 Handle(AIS_Drawer) aDrawer = aSh->Attributes();
1711 int nbUIso = aDrawer->UIsoAspect()->Number();
1712 int nbVIso = aDrawer->VIsoAspect()->Number();
1713 QString isosStr = QString::number(nbUIso);
1714 isosStr += gDigitsSep;
1715 isosStr += QString::number(nbVIso);
1716 param = occParam + "Isos";
1717 ip->setParameter(entry, param, isosStr.toLatin1().data());
1718 } // if (io->hasEntry())
1720 } // if (GEOM_AISShape)
1721 } // for (AIS_ListOfInteractive)
1725 } // if (SOCC view model)
1728 // unknown viewer type
1730 } // for (viewManagers)
1734 * \brief Restore visual parameters
1736 * This method is called after the study document is opened.
1737 * Restore visual parameters from AttributeParameter attribue(s)
1739 void GeometryGUI::restoreVisualParameters (int savePoint)
1741 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
1742 if (!appStudy || !appStudy->studyDS())
1744 _PTR(Study) studyDS = appStudy->studyDS();
1746 // componentName is used for encoding of entries when storing them in IParameters
1747 std::string componentName = myComponentGeom->ComponentDataType();
1748 //_PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM");
1749 //if (!aSComponent) return;
1752 _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative",
1753 componentName.c_str(),
1755 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
1757 std::vector<std::string> entries = ip->getEntries();
1759 for (std::vector<std::string>::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt)
1761 // entry is a normal entry - it should be "decoded" (setting base adress of component)
1762 QString entry (ip->decodeEntry(*entIt).c_str());
1764 // Check that the entry corresponds to a real object in the Study
1765 // as the object may be deleted or modified after the visual state is saved.
1766 _PTR(SObject) so = studyDS->FindObjectID(entry.toLatin1().data());
1767 if (!so) continue; //Skip the not existent entry
1769 std::vector<std::string> paramNames = ip->getAllParameterNames( *entIt );
1770 std::vector<std::string> paramValues = ip->getAllParameterValues( *entIt );
1772 std::vector<std::string>::iterator namesIt = paramNames.begin();
1773 std::vector<std::string>::iterator valuesIt = paramValues.begin();
1775 // actors are stored in a map after displaying of them for
1776 // quicker access in the future: map < viewID to actor >
1777 NCollection_DataMap<int, GEOM_Actor* > vtkActors;
1778 NCollection_DataMap<int, Handle(GEOM_AISShape)> occActors;
1780 for (; namesIt != paramNames.end(); ++namesIt, ++valuesIt)
1782 // visual parameters are stored in strings as follows: ViewerType_ViewIndex_ParamName.
1783 // '_' is used as separator and should not be used in viewer type or parameter names.
1784 QStringList lst = QString((*namesIt).c_str()).split(gSeparator, QString::SkipEmptyParts);
1785 if (lst.size() != 3)
1788 QString viewerTypStr = lst[0];
1789 QString viewIndexStr = lst[1];
1790 QString paramNameStr = lst[2];
1793 int viewIndex = viewIndexStr.toUInt(&ok);
1794 if (!ok) // bad conversion of view index to integer
1798 if (viewerTypStr == SVTK_Viewer::Type())
1800 GEOM_Actor* vActor = 0;
1801 if (vtkActors.IsBound(viewIndex))
1802 vActor = vtkActors.Find(viewIndex);
1804 if (paramNameStr == "Visibility")
1806 if (!vActor && displayer())
1808 QList<SUIT_ViewManager*> lst;
1809 getApp()->viewManagers(viewerTypStr, lst);
1811 // SVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
1812 if (viewIndex >= 0 && viewIndex < lst.count()) {
1813 SUIT_ViewManager* vman = lst.at(viewIndex);
1814 SUIT_ViewModel* vmodel = vman->getViewModel();
1815 // SVTK view model can be casted to SALOME_View
1816 displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));
1818 // store displayed actor in a temporary map for quicker
1819 // access later when restoring other parameters
1820 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
1821 vtkRenderer* Renderer = vtkView->getRenderer();
1822 vtkActorCollection* theActors = Renderer->GetActors();
1823 theActors->InitTraversal();
1824 bool isFound = false;
1825 vtkActor *ac = theActors->GetNextActor();
1826 for (; ac != NULL && !isFound; ac = theActors->GetNextActor()) {
1827 if (ac->IsA("GEOM_Actor")) {
1828 GEOM_Actor* aGeomAc = GEOM_Actor::SafeDownCast(ac);
1829 if (aGeomAc->hasIO()) {
1830 Handle(SALOME_InteractiveObject) io =
1831 Handle(SALOME_InteractiveObject)::DownCast(aGeomAc->getIO());
1832 if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) {
1834 vtkActors.Bind(viewIndex, aGeomAc);
1841 } // if (paramNameStr == "Visibility")
1844 // the rest properties "work" with GEOM_Actor
1847 QString val ((*valuesIt).c_str());
1849 if (paramNameStr == "DisplayMode") {
1850 vActor->setDisplayMode(val.toInt());
1852 else if (paramNameStr == "Color") {
1853 QStringList colors = val.split(gDigitsSep, QString::SkipEmptyParts);
1854 if (colors.count() == 3)
1855 vActor->SetColor(colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat());
1857 else if (paramNameStr == "Opacity") {
1858 vActor->SetOpacity(val.toFloat());
1860 else if (paramNameStr == "Isos") {
1861 QStringList isos = val.split(gDigitsSep, QString::SkipEmptyParts);
1862 if (isos.count() == 2) {
1863 int aIsos[2] = {isos[0].toInt(), isos[1].toInt()};
1864 vActor->SetNbIsos(aIsos);
1868 } // other parameters than Visibility
1870 else if (viewerTypStr == SOCC_Viewer::Type())
1872 //Handle(AIS_InteractiveObject) occActor;
1873 Handle(GEOM_AISShape) occActor;
1874 if (occActors.IsBound(viewIndex))
1875 occActor = occActors.Find(viewIndex);
1877 // ViewModel and InteractiveContext
1878 SOCC_Viewer* occVModel = 0;
1879 Handle(AIS_InteractiveContext) ic;
1881 QList<SUIT_ViewManager*> lst;
1882 getApp()->viewManagers(viewerTypStr, lst);
1884 // SOCC ViewManager always has 1 ViewWindow, so view index is index of view manager
1885 if (viewIndex >= 0 && viewIndex < lst.count()) {
1886 SUIT_ViewManager* vman = lst.at(viewIndex);
1887 SUIT_ViewModel* vmodel = vman->getViewModel();
1888 occVModel = dynamic_cast<SOCC_Viewer*>(vmodel);
1890 ic = occVModel->getAISContext();
1896 if (paramNameStr == "Visibility")
1898 if (occActor.IsNull() && displayer())
1900 displayer()->Display(entry, true, occVModel);
1902 // store displayed actor in a temporary map for quicker
1903 // access later when restoring other parameters
1904 AIS_ListOfInteractive aList;
1905 ic->DisplayedObjects(aList);
1906 bool isFound = false;
1907 AIS_ListIteratorOfListOfInteractive ite (aList);
1908 for (; ite.More() && !isFound; ite.Next()) {
1909 if (ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
1910 Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
1912 Handle(SALOME_InteractiveObject) io =
1913 Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO());
1914 if (io->hasEntry() && strcmp(io->getEntry(), entry.toLatin1().data()) == 0) {
1916 occActors.Bind(viewIndex, aSh);
1922 } // if (paramNameStr == "Visibility")
1925 // the rest properties "work" with GEOM_AISShape
1926 if (!occActor.IsNull())
1928 QString val ((*valuesIt).c_str());
1930 if (paramNameStr == "DisplayMode") {
1931 ic->SetDisplayMode(occActor, AIS_DisplayMode(val.toInt()), false);
1932 //ic->Redisplay(occActor, Standard_False, Standard_True);
1934 // Color is restored by the GEOM engine
1935 else if (paramNameStr == "Transparency") {
1936 ic->SetTransparency(occActor, val.toFloat(), false);
1937 ic->Redisplay(occActor, Standard_False, Standard_True);
1939 else if (paramNameStr == "Isos") {
1940 QStringList isos = val.split(gDigitsSep, QString::SkipEmptyParts);
1941 if (isos.count() == 2) {
1942 Handle(AIS_Drawer) aDrawer = occActor->Attributes();
1943 int nbUIso = isos[0].toInt();
1944 int nbVIso = isos[1].toInt();
1945 Handle(Prs3d_IsoAspect) uIsoAspect = aDrawer->UIsoAspect();
1946 Handle(Prs3d_IsoAspect) vIsoAspect = aDrawer->VIsoAspect();
1947 uIsoAspect->SetNumber(nbUIso);
1948 vIsoAspect->SetNumber(nbVIso);
1949 aDrawer->SetUIsoAspect(uIsoAspect);
1950 aDrawer->SetVIsoAspect(vIsoAspect);
1951 ic->SetLocalAttributes(occActor, aDrawer);
1952 ic->Redisplay(occActor);
1956 } // other parameters than Visibility
1960 // unknown viewer type
1962 } // for names/parameters iterator
1963 } // for entries iterator
1965 // update all VTK and OCC views
1966 QList<SUIT_ViewManager*> lst;
1967 getApp()->viewManagers(lst);
1968 for (QList<SUIT_ViewManager*>::Iterator it = lst.begin(); it != lst.end(); it++) {
1969 SUIT_ViewModel* vmodel = (*it)->getViewModel();
1972 if (vmodel->getType() == SVTK_Viewer::Type()) {
1973 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView();
1974 vtkView->getRenderer()->ResetCameraClippingRange();
1977 else if (vmodel->getType() == SOCC_Viewer::Type()) {
1978 //SOCC_ViewWindow* occView = (SOCC_ViewWindow*) (*it)->getActiveView();
1979 SALOME_View* occVMod = dynamic_cast<SALOME_View*>(vmodel);
1986 void GeometryGUI::onViewAboutToShow()
1988 SUIT_ViewWindow* window = application()->desktop()->activeWindow();
1989 QAction* a = action( GEOMOp::OpSwitchVectors );
1991 a->setEnabled(true);
1992 bool vmode = window->getCustomData("VectorsMode").toBool();
1993 a->setText ( vmode == 1 ? tr( "MEN_VECTOR_MODE_OFF" ) : tr("MEN_VECTOR_MODE_ON") );
1995 a->setText ( tr("MEN_VECTOR_MODE_ON") );
1996 a->setEnabled(false);