1 // Copyright (C) 2007-2013 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
23 #include "HYDROGUI_Module.h"
26 #include "HYDROGUI_DataModel.h"
27 #include "HYDROGUI_Displayer.h"
28 #include "HYDROGUI_GVSelector.h"
29 #include "HYDROGUI_InputPanel.h"
30 #include "HYDROGUI_ObjSelector.h"
31 #include "HYDROGUI_OCCDisplayer.h"
32 #include "HYDROGUI_OCCSelector.h"
33 #include "HYDROGUI_Operations.h"
34 #include "HYDROGUI_PrsImage.h"
35 #include "HYDROGUI_Tool.h"
36 #include "HYDROGUI_UpdateFlags.h"
37 #include "HYDROGUI_Shape.h"
38 #include "HYDROGUI_VTKPrs.h"
39 #include "HYDROGUI_VTKPrsDisplayer.h"
40 #include "HYDROGUI_AbstractDisplayer.h"
41 #include "HYDROGUI_PolylineOp.h"
42 #include "HYDROGUI_SetColorOp.h"
43 #include "HYDROGUI_ImportGeomObjectOp.h"
45 #include <HYDROData_Image.h>
46 #include <HYDROData_Profile.h>
47 #include <HYDROData_Lambert93.h>
48 #include <HYDROData_Tool.h>
50 #include <HYDROData_OperationsFactory.h>
52 #include <GraphicsView_ViewFrame.h>
53 #include <GraphicsView_ViewManager.h>
54 #include <GraphicsView_ViewPort.h>
55 #include <GraphicsView_Viewer.h>
57 #include <ImageComposer_CutOperator.h>
58 #include <ImageComposer_CropOperator.h>
59 #include <ImageComposer_FuseOperator.h>
61 #include <LightApp_Application.h>
62 #include <LightApp_DataOwner.h>
63 #include <LightApp_GVSelector.h>
64 #include <LightApp_SelectionMgr.h>
65 #include <LightApp_UpdateFlags.h>
67 #include <SalomeApp_Study.h>
69 #include <OCCViewer_ViewFrame.h>
70 #include <OCCViewer_ViewManager.h>
71 #include <OCCViewer_ViewModel.h>
73 #include <SALOME_Event.h>
75 #include <SUIT_DataBrowser.h>
76 #include <SUIT_Desktop.h>
77 #include <SUIT_Study.h>
78 #include <SUIT_ViewManager.h>
79 #include <SUIT_ResourceMgr.h>
81 #include <SVTK_ViewManager.h>
82 #include <SVTK_ViewModel.h>
83 #include <SVTK_Selector.h>
85 #include <OCCViewer_ViewPort3d.h>
87 #include <GEOMUtils.hxx>
88 #include <GeometryGUI.h>
90 #include <SALOMEDS_wrap.hxx>
93 #include <QApplication>
94 #include <QGraphicsSceneMouseEvent>
96 #include <QMouseEvent>
99 static int ViewManagerId = 0;
101 extern "C" HYDRO_EXPORT CAM_Module* createModule()
103 return new HYDROGUI_Module();
106 extern "C" HYDRO_EXPORT char* getModuleVersion()
108 return (char*)HYDRO_VERSION;
111 HYDROGUI_Module::HYDROGUI_Module()
112 : LightApp_Module( "HYDRO" ),
115 myIsUpdateEnabled( true )
119 HYDROGUI_Module::~HYDROGUI_Module()
123 int HYDROGUI_Module::getStudyId() const
125 LightApp_Application* anApp = getApp();
126 return anApp ? anApp->activeStudy()->id() : 0;
129 void HYDROGUI_Module::initialize( CAM_Application* theApp )
131 LightApp_Module::initialize( theApp );
134 createUndoRedoActions();
139 setMenuShown( false );
140 setToolShown( false );
142 myDisplayer = new HYDROGUI_Displayer( this );
143 myOCCDisplayer = new HYDROGUI_OCCDisplayer( this );
144 myVTKDisplayer = new HYDROGUI_VTKPrsDisplayer( this );
147 bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
149 bool aRes = LightApp_Module::activateModule( theStudy );
151 LightApp_Application* anApp = getApp();
152 SUIT_Desktop* aDesktop = anApp->desktop();
154 getApp()->setEditEnabled( false ); // hide SalomeApp copy/paste actions
156 setMenuShown( true );
157 setToolShown( true );
159 #ifndef DISABLE_PYCONSOLE
160 aDesktop->tabifyDockWidget( HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_PyConsole ) ),
161 HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_LogWindow ) ) );
164 // Remove defunct view managers from the map.
165 // It's essential to do this before "update( UF_All )" call!
166 QList<int> anObsoleteIds;
167 ViewManagerList anAllViewManagers = anApp->viewManagers();
168 ViewManagerList aHydroViewManagers; // view managers created inside the HYDRO module
169 ViewManagerMapIterator anIter( myViewManagerMap );
170 while( anIter.hasNext() ) {
171 int anId = anIter.next().key();
172 const ViewManagerInfo& anInfo = anIter.value();
174 aHydroViewManagers << anInfo.first;
176 if ( !anAllViewManagers.contains( anInfo.first ) ) {
177 anObsoleteIds << anId;
180 foreach ( const int anId, anObsoleteIds ) {
181 myViewManagerMap.remove( anId );
182 myObjectStateMap.remove( anId );
183 myShapesMap.remove( anId );
184 myVTKPrsMap.remove( anId );
186 // Replace the default selector for all view managers.
187 // Add view managers created outside of HYDRO module to the map.
188 foreach ( SUIT_ViewManager* aViewManager, anAllViewManagers ) {
189 createSelector( aViewManager ); // replace the default selector
190 if ( !aHydroViewManagers.contains( aViewManager ) ) {
191 ViewManagerInfo anInfo( aViewManager, VMR_General );
192 myViewManagerMap.insert( ViewManagerId++, anInfo );
198 updateCommandsStatus();
200 HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, false );
202 ViewManagerList anOCCViewManagers;
203 anApp->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
204 foreach ( const SUIT_ViewManager* aViewManager, anOCCViewManagers ) {
205 connect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
206 this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
207 foreach( SUIT_ViewWindow* aViewWindow, aViewManager->getViews() ) {
208 OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aViewWindow );
209 if ( aViewFrame && aViewFrame->getViewPort() ) {
210 aViewFrame->getViewPort()->installEventFilter( this );
216 SalomeApp_Study* aStudy =
217 dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
219 SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy->studyDS() );
220 GEOM::GEOM_Gen_var aGeomEngine = GeometryGUI::GetGeomGen();
221 if ( !aGeomEngine->_is_nil() && !aGeomEngine->_is_nil() ) {
222 SALOMEDS::StudyBuilder_var aStudyBuilder = aDSStudy->NewBuilder();
223 SALOMEDS::SComponent_wrap GEOM_var = aDSStudy->FindComponent( "GEOM" );
224 if( !GEOM_var->_is_nil() ) {
225 aStudyBuilder->LoadWith( GEOM_var, aGeomEngine );
233 bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy )
236 ViewManagerMapIterator anIter( myViewManagerMap );
237 while( anIter.hasNext() )
238 if( SUIT_ViewManager* aViewManager = anIter.next().value().first )
239 getApp()->removeViewManager( aViewManager );
240 myViewManagerMap.clear();
243 ViewManagerList anOCCViewManagers;
244 getApp()->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
245 foreach ( const SUIT_ViewManager* aViewManager, anOCCViewManagers ) {
246 disconnect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
247 this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
251 myObjectStateMap.clear();
256 // clear the data model's list of copying objects
257 HYDROGUI_DataModel::changeCopyingObjects( HYDROData_SequenceOfObjects() );
259 setMenuShown( false );
260 setToolShown( false );
262 getApp()->setEditEnabled( true ); // show SalomeApp copy/paste actions
264 HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, true );
266 return LightApp_Module::deactivateModule( theStudy );
269 void HYDROGUI_Module::windows( QMap<int, int>& theMap ) const
272 theMap.insert( LightApp_Application::WT_LogWindow, Qt::BottomDockWidgetArea );
273 #ifndef DISABLE_PYCONSOLE
274 theMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
276 theMap.insert( LightApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
279 void HYDROGUI_Module::viewManagers( QStringList& theTypesList ) const
281 theTypesList << GraphicsView_Viewer::Type() << OCCViewer_Viewer::Type();
284 void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
288 HYDROGUI_DataModel* aModel = getDataModel();
290 bool anIsObjectBrowser = theClient == getApp()->objectBrowser()->popupClientType();
291 bool anIsGraphicsView = theClient == GraphicsView_Viewer::Type();
292 bool anIsOCCView = theClient == OCCViewer_Viewer::Type();
293 bool anIsVTKView = theClient == SVTK_Viewer::Type();
294 if( !anIsObjectBrowser && !anIsGraphicsView && !anIsOCCView && !anIsVTKView )
297 size_t anActiveViewId = HYDROGUI_Tool::GetActiveViewId( this );
299 bool anIsSelectedDataObjects = false;
300 bool anIsVisibleInSelection = false;
301 bool anIsHiddenInSelection = false;
303 bool anIsImage = false;
304 bool anIsImportedImage = false;
305 bool anIsImageHasRefs = false;
306 bool anIsFusedImage = false;
307 bool anIsCutImage = false;
308 bool anIsSplittedImage = false;
309 bool anIsMustObjectBeUpdated = false;
310 bool anIsPolyline = false;
311 bool anIsPolyline3D = false;
312 bool anIsProfile = false;
313 bool anIsValidProfile = false;
314 bool anAllAreProfiles = false;
315 bool anIsBathymetry = false;
316 bool anIsCalculation = false;
317 bool anIsImmersibleZone = false;
318 bool anIsVisualState = false;
319 bool anIsRegion = false;
320 bool anIsZone = false;
321 bool anIsObstacle = false;
322 bool anIsStream = false;
323 bool anIsChannel = false;
324 bool anIsDigue = false;
325 bool anIsDummyObject3D = false;
326 bool anIsGroup = false;
327 bool anIsObjectCanBeColored = false;
329 // Check the selected GEOM objects (take into account the Object Browser only)
330 if ( anIsObjectBrowser ) {
331 QList<GEOM::shape_type> anObstacleTypes =
332 HYDROGUI_ImportGeomObjectOp::getObstacleTypes();
333 QList<GEOM::shape_type> aPolylineTypes =
334 HYDROGUI_ImportGeomObjectOp::getPolylineTypes();
336 bool isCanBeImportedAsObstacle =
337 !HYDROGUI_Tool::GetSelectedGeomObjects( this, anObstacleTypes ).isEmpty();
338 bool isCanBeImportedAsPolyline =
339 !HYDROGUI_Tool::GetSelectedGeomObjects( this, aPolylineTypes ).isEmpty();
341 // Add import as obstacle action
342 if ( isCanBeImportedAsObstacle ) {
343 theMenu->addAction( action( ImportGeomObjectAsObstacleId ) );
345 // Add import as polyline action
346 if ( isCanBeImportedAsPolyline ) {
347 theMenu->addAction( action( ImportGeomObjectAsPolylineId ) );
350 if ( isCanBeImportedAsObstacle || isCanBeImportedAsPolyline ) {
351 theMenu->addSeparator();
355 // check the selected data model objects
356 HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this );
357 int aNbOfSelectedProfiles = 0;
358 for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
360 Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
361 if( !anObject.IsNull() )
363 anIsSelectedDataObjects = true;
365 bool aVisibility = isObjectVisible( anActiveViewId, anObject );
366 anIsVisibleInSelection |= aVisibility;
367 anIsHiddenInSelection |= !aVisibility;
369 if ( anObject->CanBeUpdated() && anObject->IsMustBeUpdated() )
371 anIsMustObjectBeUpdated = true;
374 ObjectKind anObjectKind = anObject->GetKind();
375 if( anObjectKind == KIND_IMAGE )
378 Handle(HYDROData_Image) anImage = Handle(HYDROData_Image)::DownCast( anObject );
379 if( !anImage.IsNull() )
381 anIsImportedImage = anImage->HasLocalPoints();
382 anIsImageHasRefs = anImage->HasReferences();
383 if( HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory() )
385 if( ImageComposer_Operator* anOperator = aFactory->Operator( anImage ) )
387 QString anOperatorName = anOperator->name();
388 if( anOperatorName == ImageComposer_FuseOperator::Type() )
389 anIsFusedImage = true;
390 else if( anOperatorName == ImageComposer_CutOperator::Type() )
392 else if( anOperatorName == ImageComposer_CropOperator::Type() )
393 anIsSplittedImage = true;
398 else if( anObjectKind == KIND_POLYLINEXY )
400 else if( anObjectKind == KIND_POLYLINE )
401 anIsPolyline3D = true;
402 else if( anObjectKind == KIND_PROFILE )
405 aNbOfSelectedProfiles++;
407 Handle(HYDROData_Profile) aProfile =
408 Handle(HYDROData_Profile)::DownCast( anObject );
409 if( !aProfile.IsNull() && aProfile->IsValid() ) {
410 anIsValidProfile = true;
413 else if( anObjectKind == KIND_CALCULATION )
414 anIsCalculation = true;
415 else if( anObjectKind == KIND_IMMERSIBLE_ZONE )
416 anIsImmersibleZone = true;
417 else if( anObjectKind == KIND_VISUAL_STATE )
418 anIsVisualState = true;
419 else if( anObjectKind == KIND_REGION )
421 else if( anObjectKind == KIND_ZONE )
423 else if( anObjectKind == KIND_BATHYMETRY )
424 anIsBathymetry = true;
425 else if( anObjectKind == KIND_OBSTACLE )
427 else if( anObjectKind == KIND_STREAM )
429 else if( anObjectKind == KIND_CHANNEL )
431 else if( anObjectKind == KIND_DIGUE )
433 else if( anObjectKind == KIND_DUMMY_3D )
434 anIsDummyObject3D = true;
435 else if( anObjectKind == KIND_SHAPES_GROUP || anObjectKind == KIND_SPLITTED_GROUP )
439 if ( !anIsObjectCanBeColored )
440 anIsObjectCanBeColored = HYDROGUI_SetColorOp::CanObjectBeColored( anObject );
443 // Check if all selected objects are profiles
444 anAllAreProfiles = ( aNbOfSelectedProfiles > 0 ) &&
445 ( aNbOfSelectedProfiles == aSeq.Length() );
447 // check the selected partitions
448 if( !anIsSelectedDataObjects && anIsObjectBrowser )
450 ObjectKind aSelectedPartition = HYDROGUI_Tool::GetSelectedPartition( this );
451 if( aSelectedPartition != KIND_UNKNOWN )
453 switch( aSelectedPartition )
456 theMenu->addAction( action( ImportImageId ) );
458 case KIND_BATHYMETRY:
459 theMenu->addAction( action( ImportBathymetryId ) );
461 case KIND_ARTIFICIAL_OBJECT:
462 theMenu->addAction( action( CreateChannelId ) );
463 theMenu->addAction( action( CreateDigueId ) );
465 case KIND_NATURAL_OBJECT:
466 theMenu->addAction( action( CreateImmersibleZoneId ) );
467 theMenu->addAction( action( CreateStreamId ) );
470 theMenu->addAction( action( ImportObstacleFromFileId ) );
471 theMenu->addAction( action( CreateBoxId ) );
472 theMenu->addAction( action( CreateCylinderId ) );
474 case KIND_CALCULATION:
475 theMenu->addAction( action( CreateCalculationId ) );
477 case KIND_POLYLINEXY:
478 theMenu->addAction( action( CreatePolylineId ) );
481 theMenu->addAction( action( CreatePolyline3DId ) );
484 theMenu->addAction( action( CreateProfileId ) );
485 theMenu->addAction( action( ImportProfilesId ) );
486 theMenu->addAction( action( AllGeoreferencementId ) );
488 case KIND_VISUAL_STATE:
489 theMenu->addAction( action( SaveVisualStateId ) );
492 theMenu->addSeparator();
496 if( anIsSelectedDataObjects )
498 if ( anIsMustObjectBeUpdated )
500 theMenu->addAction( action( UpdateObjectId ) );
501 theMenu->addSeparator();
505 theMenu->addAction( action( ForcedUpdateObjectId ) );
506 theMenu->addSeparator();
510 if( aSeq.Length() == 1 )
514 if( anIsImportedImage )
515 theMenu->addAction( action( EditImportedImageId ) );
516 else if( anIsImageHasRefs )
519 theMenu->addAction( action( EditFusedImageId ) );
520 else if( anIsCutImage )
521 theMenu->addAction( action( EditCutImageId ) );
522 else if( anIsSplittedImage )
523 theMenu->addAction( action( EditSplittedImageId ) );
526 //RKV: BUG#98: theMenu->addAction( action( ObserveImageId ) );
527 theMenu->addAction( action( ExportImageId ) );
528 theMenu->addSeparator();
530 if( anIsImageHasRefs )
532 theMenu->addAction( action( RemoveImageRefsId ) );
533 theMenu->addSeparator();
536 theMenu->addAction( action( FuseImagesId ) );
537 theMenu->addAction( action( CutImagesId ) );
538 theMenu->addAction( action( SplitImageId ) );
539 theMenu->addSeparator();
541 else if( anIsBathymetry )
543 theMenu->addAction( action( EditImportedBathymetryId ) );
544 theMenu->addAction( action( BathymetryBoundsId ) );
545 theMenu->addSeparator();
547 else if( anIsPolyline )
549 theMenu->addAction( action( EditPolylineId ) );
550 theMenu->addSeparator();
552 else if( anIsPolyline3D )
554 theMenu->addAction( action( EditPolyline3DId ) );
555 theMenu->addSeparator();
557 else if( anIsProfile )
559 theMenu->addAction( action( EditProfileId ) );
560 theMenu->addAction( action( SelectedGeoreferencementId ) );
561 theMenu->addSeparator();
563 else if( anIsCalculation )
565 theMenu->addAction( action( EditCalculationId ) );
566 theMenu->addAction( action( ExportCalculationId ) );
567 theMenu->addSeparator();
569 else if( anIsImmersibleZone )
571 theMenu->addAction( action( EditImmersibleZoneId ) );
572 theMenu->addSeparator();
574 else if( anIsStream )
576 theMenu->addAction( action( EditStreamId ) );
577 theMenu->addSeparator();
579 else if( anIsChannel )
581 theMenu->addAction( action( EditChannelId ) );
582 theMenu->addSeparator();
586 theMenu->addAction( action( EditDigueId ) );
587 theMenu->addSeparator();
589 else if( anIsVisualState && anIsObjectBrowser )
591 theMenu->addAction( action( SaveVisualStateId ) );
592 theMenu->addAction( action( LoadVisualStateId ) );
593 theMenu->addSeparator();
596 // Add set color action for geometrical objects
597 if ( anIsObjectCanBeColored )
599 theMenu->addAction( action( SetColorId ) );
600 theMenu->addSeparator();
602 } else if ( anAllAreProfiles ) {
603 theMenu->addAction( action( SelectedGeoreferencementId ) );
604 theMenu->addSeparator();
607 if( !anIsDummyObject3D )
608 theMenu->addAction( action( DeleteId ) );
609 theMenu->addSeparator();
611 if( anIsImage || anIsPolyline || anIsPolyline3D ||
612 anIsImmersibleZone || anIsZone || anIsRegion ||
613 anIsBathymetry || anIsObstacle || anIsStream ||
614 anIsChannel || anIsDigue || anIsDummyObject3D ||
615 anIsValidProfile || anIsGroup )
617 if( anIsHiddenInSelection )
618 theMenu->addAction( action( ShowId ) );
619 theMenu->addAction( action( ShowOnlyId ) );
620 if( anIsVisibleInSelection )
621 theMenu->addAction( action( HideId ) );
622 theMenu->addSeparator();
628 SUIT_Operation* anOp = application()->activeStudy()->activeOperation();
629 HYDROGUI_PolylineOp* aPolylineOp = dynamic_cast<HYDROGUI_PolylineOp*>( anOp );
630 if ( aPolylineOp && aPolylineOp->deleteEnabled() )
631 theMenu->addAction( action( DeleteId ) );
634 if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView || anIsVTKView )
636 theMenu->addAction( action( ShowAllId ) );
637 theMenu->addAction( action( HideAllId ) );
638 theMenu->addSeparator();
642 void HYDROGUI_Module::update( const int flags )
644 if( !isUpdateEnabled() )
647 QApplication::setOverrideCursor( Qt::WaitCursor );
649 // To prevent calling this method recursively
650 // from one of the methods called below
651 setUpdateEnabled( false );
653 // store selected objects
654 QStringList aSelectedEntries = storeSelection();
656 bool aDoFitAll = flags & UF_FitAll;
657 if( ( flags & UF_Viewer ) )
658 updateViewer( getDisplayer(), flags & UF_GV_Init, flags & UF_GV_Forced, aDoFitAll );
660 if( ( flags & UF_OCCViewer ) )
661 updateViewer( getOCCDisplayer(), flags & UF_OCC_Init, flags & UF_OCC_Forced, aDoFitAll );
663 if( ( flags & UF_VTKViewer ) )
664 updateViewer( getVTKDisplayer(), flags & UF_VTK_Init, flags & UF_VTK_Forced, aDoFitAll );
666 if( ( flags & UF_Model ) && getDataModel() && getApp() )
668 getDataModel()->update( getStudyId() );
670 // Temporary workaround to prevent breaking
671 // the selection in the object browser.
672 // Note: processEvents() should be called after updateGV(),
673 // otherwise the application crashes from time to time.
674 //RKV: qApp->processEvents();
675 SUIT_ResourceMgr* aResMgr = getApp()->resourceMgr();
676 bool isResizeOnExpandItem = aResMgr->booleanValue( "ObjectBrowser", "resize_on_expand_item", false );
677 SUIT_DataBrowser* anObjectBrowser = getApp()->objectBrowser();
678 if ( isResizeOnExpandItem && anObjectBrowser ) {
679 anObjectBrowser->setResizeOnExpandItem( false ); // MZN: ISSUE #280
681 getApp()->updateObjectBrowser( true );
682 if ( isResizeOnExpandItem && anObjectBrowser ) {
683 anObjectBrowser->setResizeOnExpandItem( true ); // MZN: ISSUE #280
687 // Object browser is currently updated by using UF_Model flag
688 if( ( flags & UF_ObjBrowser ) && ((flags & UF_Model) == 0) && getApp() )
689 getApp()->updateObjectBrowser( true );
691 if( ( flags & UF_Controls ) && getApp() )
692 getApp()->updateActions();
694 // restore selected objects
695 restoreSelection( aSelectedEntries );
697 setUpdateEnabled( true );
699 QApplication::restoreOverrideCursor();
702 void HYDROGUI_Module::updateCommandsStatus()
704 LightApp_Module::updateCommandsStatus();
706 updateUndoRedoControls();
708 action( CopyId )->setEnabled( getDataModel()->canCopy() );
709 action( PasteId )->setEnabled( getDataModel()->canPaste() );
712 void HYDROGUI_Module::selectionChanged()
714 LightApp_Module::selectionChanged();
715 updateCommandsStatus();
718 HYDROGUI_DataModel* HYDROGUI_Module::getDataModel() const
720 return (HYDROGUI_DataModel*)dataModel();
723 HYDROGUI_Displayer* HYDROGUI_Module::getDisplayer() const
728 HYDROGUI_OCCDisplayer* HYDROGUI_Module::getOCCDisplayer() const
730 return myOCCDisplayer;
733 HYDROGUI_VTKPrsDisplayer* HYDROGUI_Module::getVTKDisplayer() const
735 return myVTKDisplayer;
738 SUIT_ViewManager* HYDROGUI_Module::getViewManager( const int theId ) const
740 if( myViewManagerMap.contains( theId ) )
742 return myViewManagerMap[ theId ].first;
747 GraphicsView_Viewer* HYDROGUI_Module::getViewer( const int theId ) const
749 if( myViewManagerMap.contains( theId ) )
751 ViewManagerInfo anInfo = myViewManagerMap[ theId ];
752 GraphicsView_ViewManager* aViewManager =
753 dynamic_cast<GraphicsView_ViewManager*>( anInfo.first );
755 return aViewManager->getViewer();
760 OCCViewer_Viewer* HYDROGUI_Module::getOCCViewer( const int theId ) const
762 if( myViewManagerMap.contains( theId ) )
764 ViewManagerInfo anInfo = myViewManagerMap[ theId ];
765 OCCViewer_ViewManager* aViewManager =
766 ::qobject_cast<OCCViewer_ViewManager*>( anInfo.first );
768 return aViewManager->getOCCViewer();
773 SVTK_Viewer* HYDROGUI_Module::getVTKViewer( const int theId ) const
775 if( myViewManagerMap.contains( theId ) )
777 ViewManagerInfo anInfo = myViewManagerMap[ theId ];
778 SVTK_ViewManager* aViewManager =
779 ::qobject_cast<SVTK_ViewManager*>( anInfo.first );
781 return dynamic_cast<SVTK_Viewer*>( aViewManager->getViewModel() );
786 int HYDROGUI_Module::getViewManagerId( SUIT_ViewManager* theViewManager )
788 ViewManagerMapIterator anIter( myViewManagerMap );
789 while( anIter.hasNext() )
791 int anId = anIter.next().key();
792 const ViewManagerInfo& anInfo = anIter.value();
793 if( anInfo.first == theViewManager )
799 HYDROGUI_Module::ViewManagerRole HYDROGUI_Module::getViewManagerRole( SUIT_ViewManager* theViewManager )
801 int anId = getViewManagerId( theViewManager );
804 const ViewManagerInfo& anInfo = myViewManagerMap[ anId ];
805 return anInfo.second;
810 void HYDROGUI_Module::setViewManagerRole( SUIT_ViewManager* theViewManager,
811 const ViewManagerRole theRole )
813 int anId = getViewManagerId( theViewManager );
816 ViewManagerInfo& anInfo = myViewManagerMap[ anId ];
817 anInfo.second = theRole;
821 bool HYDROGUI_Module::isObjectVisible( const int theViewId,
822 const Handle(HYDROData_Entity)& theObject ) const
824 if( theObject.IsNull() )
827 ViewId2Name2ObjectStateMap::const_iterator anIter1 = myObjectStateMap.find( theViewId );
828 if( anIter1 != myObjectStateMap.end() )
830 const Name2ObjectStateMap& aName2ObjectStateMap = anIter1.value();
831 Name2ObjectStateMap::const_iterator anIter2 = aName2ObjectStateMap.find( theObject->GetName());
832 if( anIter2 != aName2ObjectStateMap.end() )
834 const ObjectState& anObjectState = anIter2.value();
835 return anObjectState.Visibility;
841 void HYDROGUI_Module::setObjectVisible( const int theViewId,
842 const Handle(HYDROData_Entity)& theObject,
843 const bool theState )
845 if( !theObject.IsNull() )
847 Name2ObjectStateMap& aName2ObjectStateMap = myObjectStateMap[ theViewId ];
848 ObjectState& anObjectState = aName2ObjectStateMap[ theObject->GetName() ];
849 anObjectState.Visibility = theState;
853 void HYDROGUI_Module::setIsToUpdate( const Handle(HYDROData_Entity)& theObject,
854 const bool theState )
856 if( !theObject.IsNull() )
858 // Process OCC shapes
859 ViewId2ListOfShapes::const_iterator aShapesMapIter( myShapesMap.begin() );
860 while( aShapesMapIter != myShapesMap.end() )
862 const ListOfShapes& aShapesList = aShapesMapIter.value();
863 foreach ( HYDROGUI_Shape* aShape, aShapesList )
865 if ( aShape && IsEqual( aShape->getObject(), theObject ) )
867 aShape->setIsToUpdate( theState );
872 // Process VTK shapes
873 ViewId2ListOfVTKPrs::const_iterator aVTKPrsMapIter( myVTKPrsMap.begin() );
874 while( aVTKPrsMapIter != myVTKPrsMap.end() )
876 const ListOfVTKPrs& aShapesList = aVTKPrsMapIter.value();
877 foreach ( HYDROGUI_VTKPrs* aShape, aShapesList )
879 if ( aShape && IsEqual( aShape->getObject(), theObject ) )
881 aShape->setIsToUpdate( theState );
889 /////////////////// OCC SHAPES PROCESSING
890 HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int theViewId,
891 const Handle(HYDROData_Entity)& theObject ) const
893 HYDROGUI_Shape* aResShape = NULL;
894 if( theObject.IsNull() )
897 if ( myShapesMap.contains( theViewId ) )
899 const ListOfShapes& aViewShapes = myShapesMap.value( theViewId );
900 foreach ( HYDROGUI_Shape* aShape, aViewShapes )
902 if ( !aShape || !IsEqual( aShape->getObject(), theObject ) )
913 void HYDROGUI_Module::setObjectShape( const int theViewId,
914 const Handle(HYDROData_Entity)& theObject,
915 HYDROGUI_Shape* theShape )
917 if( theObject.IsNull() )
920 ListOfShapes& aViewShapes = myShapesMap[ theViewId ];
921 aViewShapes.append( theShape );
924 void HYDROGUI_Module::removeObjectShape( const int theViewId,
925 const Handle(HYDROData_Entity)& theObject )
927 if ( !myShapesMap.contains( theViewId ) )
930 ListOfShapes& aViewShapes = myShapesMap[ theViewId ];
931 Handle(HYDROData_Entity) anObject;
932 for ( int i = 0; i < aViewShapes.length(); )
934 HYDROGUI_Shape* aShape = aViewShapes.at( i );
935 anObject = aShape->getObject();
936 if ( aShape && (!anObject.IsNull()) && IsEqual( anObject, theObject ) )
939 aViewShapes.removeAt( i );
947 void HYDROGUI_Module::removeViewShapes( const int theViewId )
949 if ( !myShapesMap.contains( theViewId ) )
952 const ListOfShapes& aViewShapes = myShapesMap.value( theViewId );
953 for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
955 HYDROGUI_Shape* aShape = aViewShapes.at( i );
960 myShapesMap.remove( theViewId );
962 /////////////////// END OF OCC SHAPES PROCESSING
964 /////////////////// VTKPrs PROCESSING
965 HYDROGUI_VTKPrs* HYDROGUI_Module::getObjectVTKPrs( const int theViewId,
966 const Handle(HYDROData_Entity)& theObject ) const
968 HYDROGUI_VTKPrs* aResShape = NULL;
969 if( theObject.IsNull() )
972 if ( myVTKPrsMap.contains( theViewId ) )
974 const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
975 foreach ( HYDROGUI_VTKPrs* aShape, aViewShapes )
977 if ( !aShape || !IsEqual( aShape->getObject(), theObject ) )
988 void HYDROGUI_Module::setObjectVTKPrs( const int theViewId,
989 const Handle(HYDROData_Entity)& theObject,
990 HYDROGUI_VTKPrs* theShape )
992 if( theObject.IsNull() )
995 if( theShape && theShape->needScalarBar() )
997 // Compute the new global Z range from the added presentation and the old global Z range.
998 double* aGlobalRange = getVTKDisplayer()->GetZRange( theViewId );
999 double* aRange = theShape->getInternalZRange();
1000 bool anIsUpdate = false;
1001 if ( aRange[0] < aGlobalRange[0] )
1003 aGlobalRange[0] = aRange[0];
1006 if ( aRange[1] > aGlobalRange[1] )
1008 aGlobalRange[1] = aRange[1];
1014 updateVTKZRange( theViewId, aGlobalRange );
1018 ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
1019 aViewShapes.append( theShape );
1022 void HYDROGUI_Module::removeObjectVTKPrs( const int theViewId,
1023 const Handle(HYDROData_Entity)& theObject )
1025 if ( !myVTKPrsMap.contains( theViewId ) )
1028 ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
1029 Handle(HYDROData_Entity) anObject;
1030 for ( int i = 0; i < aViewShapes.length(); )
1032 HYDROGUI_VTKPrs* aShape = aViewShapes.at( i );
1033 anObject = aShape->getObject();
1034 if ( aShape && (!anObject.IsNull()) && IsEqual( anObject, theObject ) )
1037 aViewShapes.removeAt( i );
1044 // Invalidate global Z range
1045 double anInvalidRange[2] = { HYDROGUI_VTKPrs::InvalidZValue(), HYDROGUI_VTKPrs::InvalidZValue() };
1046 getVTKDisplayer()->SetZRange( theViewId, anInvalidRange );
1049 void HYDROGUI_Module::removeViewVTKPrs( const int theViewId )
1051 if ( !myVTKPrsMap.contains( theViewId ) )
1054 const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
1055 for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
1057 HYDROGUI_VTKPrs* aShape = aViewShapes.at( i );
1062 myVTKPrsMap.remove( theViewId );
1065 void HYDROGUI_Module::updateVTKZRange( const int theViewId, double theRange[] )
1067 if ( myVTKPrsMap.contains( theViewId ) )
1069 // For the given viewer id update all VTK presentations ...
1070 const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
1071 HYDROGUI_VTKPrs* aShape;
1072 for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
1074 aShape = aViewShapes.at( i );
1075 if ( aShape && aShape->needScalarBar() )
1077 aShape->setZRange( theRange );
1081 // ... and update the global color legend scalar bar.
1082 getVTKDisplayer()->SetZRange( theViewId, theRange );
1084 /////////////////// END OF VTKPrs PROCESSING
1086 CAM_DataModel* HYDROGUI_Module::createDataModel()
1088 return new HYDROGUI_DataModel( this );
1091 void HYDROGUI_Module::customEvent( QEvent* e )
1093 int aType = e->type();
1094 if ( aType == NewViewEvent )
1096 SALOME_CustomEvent* ce = ( SALOME_CustomEvent* )e;
1097 if( GraphicsView_ViewFrame* aViewFrame = ( GraphicsView_ViewFrame* )ce->data() )
1099 if( GraphicsView_Viewer* aViewer = dynamic_cast<GraphicsView_Viewer*>( aViewFrame->getViewer() ) )
1101 SUIT_ViewManager* aViewManager = aViewer->getViewManager();
1102 ViewManagerRole aRole = getViewManagerRole( aViewManager );
1104 if( GraphicsView_ViewPort* aViewPort = aViewer->getActiveViewPort() )
1106 if( aRole != VMR_TransformImage && aRole != VMR_ReferenceImage )
1107 aViewPort->scale( 1, -1 ); // invert the Y axis direction from down to up
1109 aViewPort->setInteractionFlag( GraphicsView_ViewPort::TraceBoundingRect );
1110 aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateContextMenu );
1111 aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateSelection );
1113 //ouv: temporarily commented
1114 //aViewPort->setViewLabelPosition( GraphicsView_ViewPort::VLP_BottomLeft, true );
1117 if( aRole != VMR_TransformImage && aRole != VMR_ReferenceImage )
1118 update( UF_Viewer );
1120 aViewer->activateTransform( GraphicsView_Viewer::FitAll );
1126 bool HYDROGUI_Module::eventFilter( QObject* theObj, QEvent* theEvent )
1128 QEvent::Type aType = theEvent->type();
1129 if( theObj->inherits( "GraphicsView_ViewFrame" ) )
1131 if( aType == QEvent::Show )
1133 SALOME_CustomEvent* e = new SALOME_CustomEvent( NewViewEvent );
1134 e->setData( theObj );
1135 QApplication::postEvent( this, e );
1136 theObj->removeEventFilter( this );
1139 else if ( theObj->inherits( "OCCViewer_ViewPort" ) )
1141 if( aType == QEvent::Leave )
1143 SUIT_Desktop* aDesktop = getApp()->desktop();
1144 if ( aDesktop && aDesktop->statusBar() ) {
1145 aDesktop->statusBar()->clearMessage();
1150 return LightApp_Module::eventFilter( theObj, theEvent );
1153 void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager )
1155 LightApp_Module::onViewManagerAdded( theViewManager );
1157 if( theViewManager->getType() == GraphicsView_Viewer::Type() )
1159 connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
1160 this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
1162 else if( theViewManager->getType() == OCCViewer_Viewer::Type() )
1164 connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
1165 this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
1166 connect( theViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
1167 this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
1170 createSelector( theViewManager ); // replace the default selector
1172 ViewManagerInfo anInfo( theViewManager, VMR_General );
1173 myViewManagerMap.insert( ViewManagerId++, anInfo );
1176 void HYDROGUI_Module::onViewManagerRemoved( SUIT_ViewManager* theViewManager )
1178 LightApp_Module::onViewManagerRemoved( theViewManager );
1180 createSelector( theViewManager ); // replace the default selector
1182 int anId = getViewManagerId( theViewManager );
1185 OCCViewer_ViewManager* anOCCViewManager =
1186 ::qobject_cast<OCCViewer_ViewManager*>( myViewManagerMap[ anId ].first );
1187 if ( anOCCViewManager )
1189 OCCViewer_Viewer* anOCCViewer = anOCCViewManager->getOCCViewer();
1191 removeViewShapes( (size_t)anOCCViewer );
1194 if ( getVTKDisplayer()->IsApplicable( theViewManager ) )
1196 SVTK_Viewer* aVTKViewer = getVTKViewer( anId );
1199 getVTKDisplayer()->EraseScalarBar( anId, true );
1200 removeViewShapes( (size_t)aVTKViewer );
1204 myViewManagerMap.remove( anId );
1208 void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow )
1210 if( theViewWindow && theViewWindow->inherits( "GraphicsView_ViewFrame" ) )
1212 if( GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( theViewWindow ) )
1214 aViewFrame->installEventFilter( this );
1216 GraphicsView_ViewPort* aViewPort = aViewFrame->getViewPort();
1218 connect( aViewPort, SIGNAL( vpMouseEvent( QGraphicsSceneMouseEvent* ) ),
1219 this, SLOT( onViewPortMouseEvent( QGraphicsSceneMouseEvent* ) ) );
1222 else if( theViewWindow && theViewWindow->inherits( "OCCViewer_ViewFrame" ) )
1224 if( OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( theViewWindow ) )
1226 aViewFrame->onTopView();
1228 HYDROGUI_Tool::setOCCActionShown( aViewFrame, OCCViewer_ViewWindow::MaximizedId, false );
1230 OCCViewer_ViewPort3d* aViewPort = aViewFrame->getViewPort();
1232 aViewPort->installEventFilter( this );
1238 void HYDROGUI_Module::onViewPortMouseEvent( QGraphicsSceneMouseEvent* theEvent )
1240 /* ouv: currently unused
1241 if( GraphicsView_ViewPort* aViewPort = qobject_cast<GraphicsView_ViewPort*>( sender() ) )
1243 SUIT_ViewManager* aViewManager = 0;
1245 QObject* aParent = aViewPort;
1246 while( aParent = aParent->parent() )
1248 if( GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( aParent ) )
1250 if( GraphicsView_Viewer* aViewer = aViewFrame->getViewer() )
1252 aViewManager = aViewer->getViewManager();
1261 double aMouseX = theEvent->scenePos().x();
1262 double aMouseY = theEvent->scenePos().y();
1264 ViewManagerRole aRole = getViewManagerRole( aViewManager );
1265 if( aRole == VMR_General )
1267 int aXDeg = 0, aYDeg = 0;
1268 int aXMin = 0, aYMin = 0;
1269 double aXSec = 0, aYSec = 0;
1270 HYDROData_Lambert93::secToDMS( aMouseX, aXDeg, aXMin, aXSec );
1271 HYDROData_Lambert93::secToDMS( aMouseY, aYDeg, aYMin, aYSec );
1273 QString aDegSymbol( QChar( 0x00B0 ) );
1274 QString aXStr = QString( "%1%2 %3' %4\"" ).arg( aXDeg ).arg( aDegSymbol ).arg( aXMin ).arg( aXSec );
1275 QString aYStr = QString( "%1%2 %3' %4\"" ).arg( aYDeg ).arg( aDegSymbol ).arg( aYMin ).arg( aYSec );
1277 aViewPort->setViewLabelText( QString( "X: %1\nY: %2" ).arg( aXStr ).arg( aYStr ) );
1279 else if( aRole == VMR_TransformImage )
1280 aViewPort->setViewLabelText( QString( "X: %1\nY: %2" ).arg( (int)aMouseX ).arg( (int)aMouseY ) );
1285 void HYDROGUI_Module::updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer,
1286 const bool theIsInit,
1287 const bool theIsForced,
1288 const bool theDoFitAll )
1290 QList<int> aViewManagerIdList;
1292 // currently, all views are updated
1293 ViewManagerMapIterator anIter( myViewManagerMap );
1294 while( anIter.hasNext() )
1296 SUIT_ViewManager* aViewManager = anIter.next().value().first;
1298 if ( theDisplayer->IsApplicable( aViewManager ) )
1300 int anId = anIter.key();
1301 aViewManagerIdList.append( anId );
1305 QListIterator<int> anIdIter( aViewManagerIdList );
1306 while( anIdIter.hasNext() )
1308 theDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll );
1312 void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager )
1314 if( !theViewManager )
1317 LightApp_SelectionMgr* aSelectionMgr = getApp()->selectionMgr();
1318 if( !aSelectionMgr )
1321 QString aViewType = theViewManager->getType();
1322 if( aViewType != GraphicsView_Viewer::Type() &&
1323 aViewType != OCCViewer_Viewer::Type())
1326 QList<SUIT_Selector*> aSelectorList;
1327 aSelectionMgr->selectors( aViewType, aSelectorList );
1329 // disable all alien selectors
1330 QList<SUIT_Selector*>::iterator anIter, anIterEnd = aSelectorList.end();
1331 for( anIter = aSelectorList.begin(); anIter != anIterEnd; anIter++ )
1333 SUIT_Selector* aSelector = *anIter;
1334 if( aSelector && ( !dynamic_cast<HYDROGUI_GVSelector*>( aSelector ) &&
1335 !dynamic_cast<SVTK_Selector*>( aSelector ) &&
1336 !dynamic_cast<HYDROGUI_OCCSelector*>( aSelector ) ) )
1337 aSelector->setEnabled( false );
1340 if ( aViewType == GraphicsView_Viewer::Type() )
1342 GraphicsView_ViewManager* aViewManager =
1343 ::qobject_cast<GraphicsView_ViewManager*>( theViewManager );
1345 new HYDROGUI_GVSelector( this, aViewManager->getViewer(), aSelectionMgr );
1347 else if ( aViewType == OCCViewer_Viewer::Type() )
1349 OCCViewer_ViewManager* aViewManager =
1350 ::qobject_cast<OCCViewer_ViewManager*>( theViewManager );
1352 new HYDROGUI_OCCSelector( this, aViewManager->getOCCViewer(), aSelectionMgr );
1356 bool HYDROGUI_Module::setUpdateEnabled( const bool theState )
1358 bool aPrevState = myIsUpdateEnabled;
1359 myIsUpdateEnabled = theState;
1363 bool HYDROGUI_Module::isUpdateEnabled() const
1365 return myIsUpdateEnabled;
1368 QStringList HYDROGUI_Module::storeSelection() const
1370 QStringList anEntryList;
1371 if( LightApp_SelectionMgr* aSelectionMgr = getApp()->selectionMgr() )
1373 SUIT_DataOwnerPtrList aList( true );
1374 aSelectionMgr->selected( aList );
1376 SUIT_DataOwnerPtrList::iterator anIter;
1377 for( anIter = aList.begin(); anIter != aList.end(); anIter++ )
1379 const LightApp_DataOwner* anOwner =
1380 dynamic_cast<const LightApp_DataOwner*>( (*anIter).operator->() );
1382 anEntryList.append( anOwner->entry() );
1388 void HYDROGUI_Module::restoreSelection( const QStringList& theEntryList )
1390 if( LightApp_SelectionMgr* aSelectionMgr = getApp()->selectionMgr() )
1392 SUIT_DataOwnerPtrList aList( true );
1393 for( int anIndex = 0, aSize = theEntryList.size(); anIndex < aSize; anIndex++ )
1394 aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( theEntryList[ anIndex ] ) ) );
1395 aSelectionMgr->setSelected( aList );
1399 void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
1401 OCCViewer_ViewWindow* anOCCViewWindow =
1402 dynamic_cast<OCCViewer_ViewWindow*>(theViewWindow);
1403 if ( !anOCCViewWindow ) {
1407 // Get the selected point coordinates
1408 OCCViewer_ViewPort3d* aViewPort = anOCCViewWindow->getViewPort();
1413 gp_Pnt aPnt = GEOMUtils::ConvertClickToPoint( theEvent->x(), theEvent->y(),
1414 aViewPort->getView() );
1416 // Show the coordinates in the status bar
1417 SUIT_Desktop* aDesktop = getApp()->desktop();
1418 if ( aDesktop && aDesktop->statusBar() ) {
1419 QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X() );
1420 QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y() );
1421 aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aX ).arg( anY ) );