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 <CurveCreator_Utils.h>
54 #include <GraphicsView_ViewFrame.h>
55 #include <GraphicsView_ViewManager.h>
56 #include <GraphicsView_ViewPort.h>
57 #include <GraphicsView_Viewer.h>
59 #include <ImageComposer_CutOperator.h>
60 #include <ImageComposer_CropOperator.h>
61 #include <ImageComposer_FuseOperator.h>
63 #include <LightApp_Application.h>
64 #include <LightApp_DataOwner.h>
65 #include <LightApp_GVSelector.h>
66 #include <LightApp_SelectionMgr.h>
67 #include <LightApp_UpdateFlags.h>
69 #include <SalomeApp_Study.h>
71 #include <OCCViewer_ViewFrame.h>
72 #include <OCCViewer_ViewManager.h>
73 #include <OCCViewer_ViewModel.h>
75 #include <SALOME_Event.h>
77 #include <SUIT_DataBrowser.h>
78 #include <SUIT_Desktop.h>
79 #include <SUIT_Study.h>
80 #include <SUIT_ViewManager.h>
81 #include <SUIT_ResourceMgr.h>
83 #include <SVTK_ViewManager.h>
84 #include <SVTK_ViewModel.h>
85 #include <SVTK_Selector.h>
87 #include <OCCViewer_ViewPort3d.h>
89 #include <GEOMUtils.hxx>
90 #include <GeometryGUI.h>
92 #include <SALOMEDS_wrap.hxx>
95 #include <QApplication>
96 #include <QGraphicsSceneMouseEvent>
98 #include <QMouseEvent>
101 static int ViewManagerId = 0;
103 extern "C" HYDRO_EXPORT CAM_Module* createModule()
105 return new HYDROGUI_Module();
108 extern "C" HYDRO_EXPORT char* getModuleVersion()
110 return (char*)HYDRO_VERSION;
113 HYDROGUI_Module::HYDROGUI_Module()
114 : LightApp_Module( "HYDRO" ),
117 myIsUpdateEnabled( true )
121 HYDROGUI_Module::~HYDROGUI_Module()
125 int HYDROGUI_Module::getStudyId() const
127 LightApp_Application* anApp = getApp();
128 return anApp ? anApp->activeStudy()->id() : 0;
131 void HYDROGUI_Module::initialize( CAM_Application* theApp )
133 LightApp_Module::initialize( theApp );
136 createUndoRedoActions();
141 setMenuShown( false );
142 setToolShown( false );
144 myDisplayer = new HYDROGUI_Displayer( this );
145 myOCCDisplayer = new HYDROGUI_OCCDisplayer( this );
146 myVTKDisplayer = new HYDROGUI_VTKPrsDisplayer( this );
149 bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
151 bool aRes = LightApp_Module::activateModule( theStudy );
153 LightApp_Application* anApp = getApp();
154 SUIT_Desktop* aDesktop = anApp->desktop();
156 getApp()->setEditEnabled( false ); // hide SalomeApp copy/paste actions
158 setMenuShown( true );
159 setToolShown( true );
161 #ifndef DISABLE_PYCONSOLE
162 aDesktop->tabifyDockWidget( HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_PyConsole ) ),
163 HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_LogWindow ) ) );
166 // Remove defunct view managers from the map.
167 // It's essential to do this before "update( UF_All )" call!
168 QList<int> anObsoleteIds;
169 ViewManagerList anAllViewManagers = anApp->viewManagers();
170 ViewManagerList aHydroViewManagers; // view managers created inside the HYDRO module
171 ViewManagerMapIterator anIter( myViewManagerMap );
172 while( anIter.hasNext() ) {
173 int anId = anIter.next().key();
174 const ViewManagerInfo& anInfo = anIter.value();
176 aHydroViewManagers << anInfo.first;
178 if ( !anAllViewManagers.contains( anInfo.first ) ) {
179 anObsoleteIds << anId;
182 foreach ( const int anId, anObsoleteIds ) {
183 myViewManagerMap.remove( anId );
184 myObjectStateMap.remove( anId );
185 myShapesMap.remove( anId );
186 myVTKPrsMap.remove( anId );
188 // Replace the default selector for all view managers.
189 // Add view managers created outside of HYDRO module to the map.
190 foreach ( SUIT_ViewManager* aViewManager, anAllViewManagers ) {
191 createSelector( aViewManager ); // replace the default selector
192 if ( !aHydroViewManagers.contains( aViewManager ) ) {
193 ViewManagerInfo anInfo( aViewManager, VMR_General );
194 myViewManagerMap.insert( ViewManagerId++, anInfo );
200 updateCommandsStatus();
202 HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, false );
204 ViewManagerList anOCCViewManagers;
205 anApp->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
206 foreach ( const SUIT_ViewManager* aViewManager, anOCCViewManagers ) {
207 connect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
208 this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
209 foreach( SUIT_ViewWindow* aViewWindow, aViewManager->getViews() ) {
210 OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aViewWindow );
211 if ( aViewFrame && aViewFrame->getViewPort() ) {
212 aViewFrame->getViewPort()->installEventFilter( this );
218 SalomeApp_Study* aStudy =
219 dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
221 SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy->studyDS() );
222 GEOM::GEOM_Gen_var aGeomEngine = GeometryGUI::GetGeomGen();
223 if ( !aGeomEngine->_is_nil() && !aGeomEngine->_is_nil() ) {
224 SALOMEDS::StudyBuilder_var aStudyBuilder = aDSStudy->NewBuilder();
225 SALOMEDS::SComponent_wrap GEOM_var = aDSStudy->FindComponent( "GEOM" );
226 if( !GEOM_var->_is_nil() ) {
227 aStudyBuilder->LoadWith( GEOM_var, aGeomEngine );
235 bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy )
238 ViewManagerMapIterator anIter( myViewManagerMap );
239 while( anIter.hasNext() )
240 if( SUIT_ViewManager* aViewManager = anIter.next().value().first )
241 getApp()->removeViewManager( aViewManager );
242 myViewManagerMap.clear();
245 ViewManagerList anOCCViewManagers;
246 getApp()->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
247 foreach ( const SUIT_ViewManager* aViewManager, anOCCViewManagers ) {
248 disconnect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
249 this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
253 myObjectStateMap.clear();
258 // clear the data model's list of copying objects
259 HYDROGUI_DataModel::changeCopyingObjects( HYDROData_SequenceOfObjects() );
261 setMenuShown( false );
262 setToolShown( false );
264 getApp()->setEditEnabled( true ); // show SalomeApp copy/paste actions
266 HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, true );
268 return LightApp_Module::deactivateModule( theStudy );
271 void HYDROGUI_Module::windows( QMap<int, int>& theMap ) const
274 theMap.insert( LightApp_Application::WT_LogWindow, Qt::BottomDockWidgetArea );
275 #ifndef DISABLE_PYCONSOLE
276 theMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
278 theMap.insert( LightApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
281 void HYDROGUI_Module::viewManagers( QStringList& theTypesList ) const
283 theTypesList << GraphicsView_Viewer::Type() << OCCViewer_Viewer::Type();
286 void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
290 HYDROGUI_DataModel* aModel = getDataModel();
292 bool anIsObjectBrowser = theClient == getApp()->objectBrowser()->popupClientType();
293 bool anIsGraphicsView = theClient == GraphicsView_Viewer::Type();
294 bool anIsOCCView = theClient == OCCViewer_Viewer::Type();
295 bool anIsVTKView = theClient == SVTK_Viewer::Type();
296 if( !anIsObjectBrowser && !anIsGraphicsView && !anIsOCCView && !anIsVTKView )
299 size_t anActiveViewId = HYDROGUI_Tool::GetActiveViewId( this );
301 bool anIsSelectedDataObjects = false;
302 bool anIsVisibleInSelection = false;
303 bool anIsHiddenInSelection = false;
305 bool anIsImage = false;
306 bool anIsImportedImage = false;
307 bool anIsImageHasRefs = false;
308 bool anIsFusedImage = false;
309 bool anIsCutImage = false;
310 bool anIsSplittedImage = false;
311 bool anIsMustObjectBeUpdated = false;
312 bool anIsPolyline = false;
313 bool anIsPolyline3D = false;
314 bool anIsProfile = false;
315 bool anIsValidProfile = false;
316 bool anAllAreProfiles = false;
317 bool anIsBathymetry = false;
318 bool anIsCalculation = false;
319 bool anIsImmersibleZone = false;
320 bool anIsVisualState = false;
321 bool anIsRegion = false;
322 bool anIsZone = false;
323 bool anIsObstacle = false;
324 bool anIsStream = false;
325 bool anIsChannel = false;
326 bool anIsDigue = false;
327 bool anIsDummyObject3D = false;
328 bool anIsGroup = false;
329 bool anIsObjectCanBeColored = false;
331 // Check the selected GEOM objects (take into account the Object Browser only)
332 if ( anIsObjectBrowser ) {
333 QList<GEOM::shape_type> anObstacleTypes =
334 HYDROGUI_ImportGeomObjectOp::getObstacleTypes();
335 QList<GEOM::shape_type> aPolylineTypes =
336 HYDROGUI_ImportGeomObjectOp::getPolylineTypes();
338 bool isCanBeImportedAsObstacle =
339 !HYDROGUI_Tool::GetSelectedGeomObjects( this, anObstacleTypes ).isEmpty();
340 bool isCanBeImportedAsPolyline =
341 !HYDROGUI_Tool::GetSelectedGeomObjects( this, aPolylineTypes ).isEmpty();
343 // Add import as obstacle action
344 if ( isCanBeImportedAsObstacle ) {
345 theMenu->addAction( action( ImportGeomObjectAsObstacleId ) );
347 // Add import as polyline action
348 if ( isCanBeImportedAsPolyline ) {
349 theMenu->addAction( action( ImportGeomObjectAsPolylineId ) );
352 if ( isCanBeImportedAsObstacle || isCanBeImportedAsPolyline ) {
353 theMenu->addSeparator();
357 // check the selected data model objects
358 HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this );
359 int aNbOfSelectedProfiles = 0;
360 for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
362 Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
363 if( !anObject.IsNull() )
365 anIsSelectedDataObjects = true;
367 bool aVisibility = isObjectVisible( anActiveViewId, anObject );
368 anIsVisibleInSelection |= aVisibility;
369 anIsHiddenInSelection |= !aVisibility;
371 if ( anObject->CanBeUpdated() && anObject->IsMustBeUpdated() )
373 anIsMustObjectBeUpdated = true;
376 ObjectKind anObjectKind = anObject->GetKind();
377 if( anObjectKind == KIND_IMAGE )
380 Handle(HYDROData_Image) anImage = Handle(HYDROData_Image)::DownCast( anObject );
381 if( !anImage.IsNull() )
383 anIsImportedImage = anImage->HasLocalPoints();
384 anIsImageHasRefs = anImage->HasReferences();
385 if( HYDROData_OperationsFactory* aFactory = HYDROData_OperationsFactory::Factory() )
387 if( ImageComposer_Operator* anOperator = aFactory->Operator( anImage ) )
389 QString anOperatorName = anOperator->name();
390 if( anOperatorName == ImageComposer_FuseOperator::Type() )
391 anIsFusedImage = true;
392 else if( anOperatorName == ImageComposer_CutOperator::Type() )
394 else if( anOperatorName == ImageComposer_CropOperator::Type() )
395 anIsSplittedImage = true;
400 else if( anObjectKind == KIND_POLYLINEXY )
402 else if( anObjectKind == KIND_POLYLINE )
403 anIsPolyline3D = true;
404 else if( anObjectKind == KIND_PROFILE )
407 aNbOfSelectedProfiles++;
409 Handle(HYDROData_Profile) aProfile =
410 Handle(HYDROData_Profile)::DownCast( anObject );
411 if( !aProfile.IsNull() && aProfile->IsValid() ) {
412 anIsValidProfile = true;
415 else if( anObjectKind == KIND_CALCULATION )
416 anIsCalculation = true;
417 else if( anObjectKind == KIND_IMMERSIBLE_ZONE )
418 anIsImmersibleZone = true;
419 else if( anObjectKind == KIND_VISUAL_STATE )
420 anIsVisualState = true;
421 else if( anObjectKind == KIND_REGION )
423 else if( anObjectKind == KIND_ZONE )
425 else if( anObjectKind == KIND_BATHYMETRY )
426 anIsBathymetry = true;
427 else if( anObjectKind == KIND_OBSTACLE )
429 else if( anObjectKind == KIND_STREAM )
431 else if( anObjectKind == KIND_CHANNEL )
433 else if( anObjectKind == KIND_DIGUE )
435 else if( anObjectKind == KIND_DUMMY_3D )
436 anIsDummyObject3D = true;
437 else if( anObjectKind == KIND_SHAPES_GROUP || anObjectKind == KIND_SPLITTED_GROUP )
441 if ( !anIsObjectCanBeColored )
442 anIsObjectCanBeColored = HYDROGUI_SetColorOp::CanObjectBeColored( anObject );
445 // Check if all selected objects are profiles
446 anAllAreProfiles = ( aNbOfSelectedProfiles > 0 ) &&
447 ( aNbOfSelectedProfiles == aSeq.Length() );
449 // check the selected partitions
450 if( !anIsSelectedDataObjects && anIsObjectBrowser )
452 ObjectKind aSelectedPartition = HYDROGUI_Tool::GetSelectedPartition( this );
453 if( aSelectedPartition != KIND_UNKNOWN )
455 switch( aSelectedPartition )
458 theMenu->addAction( action( ImportImageId ) );
460 case KIND_BATHYMETRY:
461 theMenu->addAction( action( ImportBathymetryId ) );
463 case KIND_ARTIFICIAL_OBJECT:
464 theMenu->addAction( action( CreateChannelId ) );
465 theMenu->addAction( action( CreateDigueId ) );
467 case KIND_NATURAL_OBJECT:
468 theMenu->addAction( action( CreateImmersibleZoneId ) );
469 theMenu->addAction( action( CreateStreamId ) );
472 theMenu->addAction( action( ImportObstacleFromFileId ) );
473 theMenu->addAction( action( CreateBoxId ) );
474 theMenu->addAction( action( CreateCylinderId ) );
476 case KIND_CALCULATION:
477 theMenu->addAction( action( CreateCalculationId ) );
479 case KIND_POLYLINEXY:
480 theMenu->addAction( action( CreatePolylineId ) );
483 theMenu->addAction( action( CreatePolyline3DId ) );
486 theMenu->addAction( action( CreateProfileId ) );
487 theMenu->addAction( action( ImportProfilesId ) );
488 theMenu->addAction( action( AllGeoreferencementId ) );
490 case KIND_VISUAL_STATE:
491 theMenu->addAction( action( SaveVisualStateId ) );
494 theMenu->addSeparator();
498 if( anIsSelectedDataObjects )
500 if ( anIsMustObjectBeUpdated )
502 theMenu->addAction( action( UpdateObjectId ) );
503 theMenu->addSeparator();
507 theMenu->addAction( action( ForcedUpdateObjectId ) );
508 theMenu->addSeparator();
512 if( aSeq.Length() == 1 )
516 if( anIsImportedImage )
517 theMenu->addAction( action( EditImportedImageId ) );
518 else if( anIsImageHasRefs )
521 theMenu->addAction( action( EditFusedImageId ) );
522 else if( anIsCutImage )
523 theMenu->addAction( action( EditCutImageId ) );
524 else if( anIsSplittedImage )
525 theMenu->addAction( action( EditSplittedImageId ) );
528 //RKV: BUG#98: theMenu->addAction( action( ObserveImageId ) );
529 theMenu->addAction( action( ExportImageId ) );
530 theMenu->addSeparator();
532 if( anIsImageHasRefs )
534 theMenu->addAction( action( RemoveImageRefsId ) );
535 theMenu->addSeparator();
538 theMenu->addAction( action( FuseImagesId ) );
539 theMenu->addAction( action( CutImagesId ) );
540 theMenu->addAction( action( SplitImageId ) );
541 theMenu->addSeparator();
543 else if( anIsBathymetry )
545 theMenu->addAction( action( EditImportedBathymetryId ) );
546 theMenu->addAction( action( BathymetryBoundsId ) );
547 theMenu->addSeparator();
549 else if( anIsPolyline )
551 theMenu->addAction( action( EditPolylineId ) );
552 theMenu->addSeparator();
554 else if( anIsPolyline3D )
556 theMenu->addAction( action( EditPolyline3DId ) );
557 theMenu->addSeparator();
559 else if( anIsProfile )
561 theMenu->addAction( action( EditProfileId ) );
562 theMenu->addAction( action( SelectedGeoreferencementId ) );
563 theMenu->addSeparator();
565 else if( anIsCalculation )
567 theMenu->addAction( action( EditCalculationId ) );
568 theMenu->addAction( action( ExportCalculationId ) );
569 theMenu->addSeparator();
571 else if( anIsImmersibleZone )
573 theMenu->addAction( action( EditImmersibleZoneId ) );
574 theMenu->addSeparator();
576 else if( anIsStream )
578 theMenu->addAction( action( EditStreamId ) );
579 theMenu->addSeparator();
581 else if( anIsChannel )
583 theMenu->addAction( action( EditChannelId ) );
584 theMenu->addSeparator();
588 theMenu->addAction( action( EditDigueId ) );
589 theMenu->addSeparator();
591 else if( anIsVisualState && anIsObjectBrowser )
593 theMenu->addAction( action( SaveVisualStateId ) );
594 theMenu->addAction( action( LoadVisualStateId ) );
595 theMenu->addSeparator();
598 // Add set color action for geometrical objects
599 if ( anIsObjectCanBeColored )
601 theMenu->addAction( action( SetColorId ) );
602 theMenu->addSeparator();
604 } else if ( anAllAreProfiles ) {
605 theMenu->addAction( action( SelectedGeoreferencementId ) );
606 theMenu->addSeparator();
609 if( !anIsDummyObject3D )
610 theMenu->addAction( action( DeleteId ) );
611 theMenu->addSeparator();
613 if( anIsImage || anIsPolyline || anIsPolyline3D ||
614 anIsImmersibleZone || anIsZone || anIsRegion ||
615 anIsBathymetry || anIsObstacle || anIsStream ||
616 anIsChannel || anIsDigue || anIsDummyObject3D ||
617 anIsValidProfile || anIsGroup )
619 if( anIsHiddenInSelection )
620 theMenu->addAction( action( ShowId ) );
621 theMenu->addAction( action( ShowOnlyId ) );
622 if( anIsVisibleInSelection )
623 theMenu->addAction( action( HideId ) );
624 theMenu->addSeparator();
630 SUIT_Operation* anOp = application()->activeStudy()->activeOperation();
631 HYDROGUI_PolylineOp* aPolylineOp = dynamic_cast<HYDROGUI_PolylineOp*>( anOp );
632 if ( aPolylineOp && aPolylineOp->deleteEnabled() )
633 theMenu->addAction( action( DeleteId ) );
636 if( anIsObjectBrowser || anIsGraphicsView || anIsOCCView || anIsVTKView )
638 theMenu->addAction( action( ShowAllId ) );
639 theMenu->addAction( action( HideAllId ) );
640 theMenu->addSeparator();
644 void HYDROGUI_Module::update( const int flags )
646 if( !isUpdateEnabled() )
649 QApplication::setOverrideCursor( Qt::WaitCursor );
651 // To prevent calling this method recursively
652 // from one of the methods called below
653 setUpdateEnabled( false );
655 // store selected objects
656 QStringList aSelectedEntries = storeSelection();
658 bool aDoFitAll = flags & UF_FitAll;
659 if( ( flags & UF_Viewer ) )
660 updateViewer( getDisplayer(), flags & UF_GV_Init, flags & UF_GV_Forced, aDoFitAll );
662 if( ( flags & UF_OCCViewer ) )
663 updateViewer( getOCCDisplayer(), flags & UF_OCC_Init, flags & UF_OCC_Forced, aDoFitAll );
665 if( ( flags & UF_VTKViewer ) )
666 updateViewer( getVTKDisplayer(), flags & UF_VTK_Init, flags & UF_VTK_Forced, aDoFitAll );
668 if( ( flags & UF_Model ) && getDataModel() && getApp() )
670 getDataModel()->update( getStudyId() );
672 // Temporary workaround to prevent breaking
673 // the selection in the object browser.
674 // Note: processEvents() should be called after updateGV(),
675 // otherwise the application crashes from time to time.
676 //RKV: qApp->processEvents();
677 SUIT_ResourceMgr* aResMgr = getApp()->resourceMgr();
678 bool isResizeOnExpandItem = aResMgr->booleanValue( "ObjectBrowser", "resize_on_expand_item", false );
679 SUIT_DataBrowser* anObjectBrowser = getApp()->objectBrowser();
680 if ( isResizeOnExpandItem && anObjectBrowser ) {
681 anObjectBrowser->setResizeOnExpandItem( false ); // MZN: ISSUE #280
683 getApp()->updateObjectBrowser( true );
684 if ( isResizeOnExpandItem && anObjectBrowser ) {
685 anObjectBrowser->setResizeOnExpandItem( true ); // MZN: ISSUE #280
689 // Object browser is currently updated by using UF_Model flag
690 if( ( flags & UF_ObjBrowser ) && ((flags & UF_Model) == 0) && getApp() )
691 getApp()->updateObjectBrowser( true );
693 if( ( flags & UF_Controls ) && getApp() )
694 getApp()->updateActions();
696 // restore selected objects
697 restoreSelection( aSelectedEntries );
699 setUpdateEnabled( true );
701 QApplication::restoreOverrideCursor();
704 void HYDROGUI_Module::updateCommandsStatus()
706 LightApp_Module::updateCommandsStatus();
708 updateUndoRedoControls();
710 action( CopyId )->setEnabled( getDataModel()->canCopy() );
711 action( PasteId )->setEnabled( getDataModel()->canPaste() );
714 void HYDROGUI_Module::selectionChanged()
716 LightApp_Module::selectionChanged();
717 updateCommandsStatus();
720 HYDROGUI_DataModel* HYDROGUI_Module::getDataModel() const
722 return (HYDROGUI_DataModel*)dataModel();
725 HYDROGUI_Displayer* HYDROGUI_Module::getDisplayer() const
730 HYDROGUI_OCCDisplayer* HYDROGUI_Module::getOCCDisplayer() const
732 return myOCCDisplayer;
735 HYDROGUI_VTKPrsDisplayer* HYDROGUI_Module::getVTKDisplayer() const
737 return myVTKDisplayer;
740 SUIT_ViewManager* HYDROGUI_Module::getViewManager( const int theId ) const
742 if( myViewManagerMap.contains( theId ) )
744 return myViewManagerMap[ theId ].first;
749 GraphicsView_Viewer* HYDROGUI_Module::getViewer( const int theId ) const
751 if( myViewManagerMap.contains( theId ) )
753 ViewManagerInfo anInfo = myViewManagerMap[ theId ];
754 GraphicsView_ViewManager* aViewManager =
755 dynamic_cast<GraphicsView_ViewManager*>( anInfo.first );
757 return aViewManager->getViewer();
762 OCCViewer_Viewer* HYDROGUI_Module::getOCCViewer( const int theId ) const
764 if( myViewManagerMap.contains( theId ) )
766 ViewManagerInfo anInfo = myViewManagerMap[ theId ];
767 OCCViewer_ViewManager* aViewManager =
768 ::qobject_cast<OCCViewer_ViewManager*>( anInfo.first );
770 return aViewManager->getOCCViewer();
775 SVTK_Viewer* HYDROGUI_Module::getVTKViewer( const int theId ) const
777 if( myViewManagerMap.contains( theId ) )
779 ViewManagerInfo anInfo = myViewManagerMap[ theId ];
780 SVTK_ViewManager* aViewManager =
781 ::qobject_cast<SVTK_ViewManager*>( anInfo.first );
783 return dynamic_cast<SVTK_Viewer*>( aViewManager->getViewModel() );
788 int HYDROGUI_Module::getViewManagerId( SUIT_ViewManager* theViewManager )
790 ViewManagerMapIterator anIter( myViewManagerMap );
791 while( anIter.hasNext() )
793 int anId = anIter.next().key();
794 const ViewManagerInfo& anInfo = anIter.value();
795 if( anInfo.first == theViewManager )
801 HYDROGUI_Module::ViewManagerRole HYDROGUI_Module::getViewManagerRole( SUIT_ViewManager* theViewManager )
803 int anId = getViewManagerId( theViewManager );
806 const ViewManagerInfo& anInfo = myViewManagerMap[ anId ];
807 return anInfo.second;
812 void HYDROGUI_Module::setViewManagerRole( SUIT_ViewManager* theViewManager,
813 const ViewManagerRole theRole )
815 int anId = getViewManagerId( theViewManager );
818 ViewManagerInfo& anInfo = myViewManagerMap[ anId ];
819 anInfo.second = theRole;
823 bool HYDROGUI_Module::isObjectVisible( const int theViewId,
824 const Handle(HYDROData_Entity)& theObject ) const
826 if( theObject.IsNull() )
829 ViewId2Name2ObjectStateMap::const_iterator anIter1 = myObjectStateMap.find( theViewId );
830 if( anIter1 != myObjectStateMap.end() )
832 const Name2ObjectStateMap& aName2ObjectStateMap = anIter1.value();
833 Name2ObjectStateMap::const_iterator anIter2 = aName2ObjectStateMap.find( theObject->GetName());
834 if( anIter2 != aName2ObjectStateMap.end() )
836 const ObjectState& anObjectState = anIter2.value();
837 return anObjectState.Visibility;
843 void HYDROGUI_Module::setObjectVisible( const int theViewId,
844 const Handle(HYDROData_Entity)& theObject,
845 const bool theState )
847 if( !theObject.IsNull() )
849 Name2ObjectStateMap& aName2ObjectStateMap = myObjectStateMap[ theViewId ];
850 ObjectState& anObjectState = aName2ObjectStateMap[ theObject->GetName() ];
851 anObjectState.Visibility = theState;
855 void HYDROGUI_Module::setIsToUpdate( const Handle(HYDROData_Entity)& theObject,
856 const bool theState )
858 if( !theObject.IsNull() )
860 // Process OCC shapes
861 ViewId2ListOfShapes::const_iterator aShapesMapIter( myShapesMap.begin() );
862 while( aShapesMapIter != myShapesMap.end() )
864 const ListOfShapes& aShapesList = aShapesMapIter.value();
865 foreach ( HYDROGUI_Shape* aShape, aShapesList )
867 if ( aShape && IsEqual( aShape->getObject(), theObject ) )
869 aShape->setIsToUpdate( theState );
874 // Process VTK shapes
875 ViewId2ListOfVTKPrs::const_iterator aVTKPrsMapIter( myVTKPrsMap.begin() );
876 while( aVTKPrsMapIter != myVTKPrsMap.end() )
878 const ListOfVTKPrs& aShapesList = aVTKPrsMapIter.value();
879 foreach ( HYDROGUI_VTKPrs* aShape, aShapesList )
881 if ( aShape && IsEqual( aShape->getObject(), theObject ) )
883 aShape->setIsToUpdate( theState );
891 /////////////////// OCC SHAPES PROCESSING
892 HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int theViewId,
893 const Handle(HYDROData_Entity)& theObject ) const
895 HYDROGUI_Shape* aResShape = NULL;
896 if( theObject.IsNull() )
899 if ( myShapesMap.contains( theViewId ) )
901 const ListOfShapes& aViewShapes = myShapesMap.value( theViewId );
902 foreach ( HYDROGUI_Shape* aShape, aViewShapes )
904 if ( !aShape || !IsEqual( aShape->getObject(), theObject ) )
915 void HYDROGUI_Module::setObjectShape( const int theViewId,
916 const Handle(HYDROData_Entity)& theObject,
917 HYDROGUI_Shape* theShape )
919 if( theObject.IsNull() )
922 ListOfShapes& aViewShapes = myShapesMap[ theViewId ];
923 aViewShapes.append( theShape );
926 void HYDROGUI_Module::removeObjectShape( const int theViewId,
927 const Handle(HYDROData_Entity)& theObject )
929 if ( !myShapesMap.contains( theViewId ) )
932 ListOfShapes& aViewShapes = myShapesMap[ theViewId ];
933 Handle(HYDROData_Entity) anObject;
934 for ( int i = 0; i < aViewShapes.length(); )
936 HYDROGUI_Shape* aShape = aViewShapes.at( i );
937 anObject = aShape->getObject();
938 if ( aShape && (!anObject.IsNull()) && IsEqual( anObject, theObject ) )
941 aViewShapes.removeAt( i );
949 void HYDROGUI_Module::removeViewShapes( const int theViewId )
951 if ( !myShapesMap.contains( theViewId ) )
954 const ListOfShapes& aViewShapes = myShapesMap.value( theViewId );
955 for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
957 HYDROGUI_Shape* aShape = aViewShapes.at( i );
962 myShapesMap.remove( theViewId );
964 /////////////////// END OF OCC SHAPES PROCESSING
966 /////////////////// VTKPrs PROCESSING
967 HYDROGUI_VTKPrs* HYDROGUI_Module::getObjectVTKPrs( const int theViewId,
968 const Handle(HYDROData_Entity)& theObject ) const
970 HYDROGUI_VTKPrs* aResShape = NULL;
971 if( theObject.IsNull() )
974 if ( myVTKPrsMap.contains( theViewId ) )
976 const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
977 foreach ( HYDROGUI_VTKPrs* aShape, aViewShapes )
979 if ( !aShape || !IsEqual( aShape->getObject(), theObject ) )
990 void HYDROGUI_Module::setObjectVTKPrs( const int theViewId,
991 const Handle(HYDROData_Entity)& theObject,
992 HYDROGUI_VTKPrs* theShape )
994 if( theObject.IsNull() )
997 if( theShape && theShape->needScalarBar() )
999 // Compute the new global Z range from the added presentation and the old global Z range.
1000 double* aGlobalRange = getVTKDisplayer()->GetZRange( theViewId );
1001 double* aRange = theShape->getInternalZRange();
1002 bool anIsUpdate = false;
1003 if ( aRange[0] < aGlobalRange[0] )
1005 aGlobalRange[0] = aRange[0];
1008 if ( aRange[1] > aGlobalRange[1] )
1010 aGlobalRange[1] = aRange[1];
1016 updateVTKZRange( theViewId, aGlobalRange );
1020 ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
1021 aViewShapes.append( theShape );
1024 void HYDROGUI_Module::removeObjectVTKPrs( const int theViewId,
1025 const Handle(HYDROData_Entity)& theObject )
1027 if ( !myVTKPrsMap.contains( theViewId ) )
1030 ListOfVTKPrs& aViewShapes = myVTKPrsMap[ theViewId ];
1031 Handle(HYDROData_Entity) anObject;
1032 for ( int i = 0; i < aViewShapes.length(); )
1034 HYDROGUI_VTKPrs* aShape = aViewShapes.at( i );
1035 anObject = aShape->getObject();
1036 if ( aShape && (!anObject.IsNull()) && IsEqual( anObject, theObject ) )
1039 aViewShapes.removeAt( i );
1046 // Invalidate global Z range
1047 double anInvalidRange[2] = { HYDROGUI_VTKPrs::InvalidZValue(), HYDROGUI_VTKPrs::InvalidZValue() };
1048 getVTKDisplayer()->SetZRange( theViewId, anInvalidRange );
1051 void HYDROGUI_Module::removeViewVTKPrs( const int theViewId )
1053 if ( !myVTKPrsMap.contains( theViewId ) )
1056 const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
1057 for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
1059 HYDROGUI_VTKPrs* aShape = aViewShapes.at( i );
1064 myVTKPrsMap.remove( theViewId );
1067 void HYDROGUI_Module::updateVTKZRange( const int theViewId, double theRange[] )
1069 if ( myVTKPrsMap.contains( theViewId ) )
1071 // For the given viewer id update all VTK presentations ...
1072 const ListOfVTKPrs& aViewShapes = myVTKPrsMap.value( theViewId );
1073 HYDROGUI_VTKPrs* aShape;
1074 for ( int i = 0, n = aViewShapes.length(); i < n; ++i )
1076 aShape = aViewShapes.at( i );
1077 if ( aShape && aShape->needScalarBar() )
1079 aShape->setZRange( theRange );
1083 // ... and update the global color legend scalar bar.
1084 getVTKDisplayer()->SetZRange( theViewId, theRange );
1086 /////////////////// END OF VTKPrs PROCESSING
1088 CAM_DataModel* HYDROGUI_Module::createDataModel()
1090 return new HYDROGUI_DataModel( this );
1093 void HYDROGUI_Module::customEvent( QEvent* e )
1095 int aType = e->type();
1096 if ( aType == NewViewEvent )
1098 SALOME_CustomEvent* ce = ( SALOME_CustomEvent* )e;
1099 if( GraphicsView_ViewFrame* aViewFrame = ( GraphicsView_ViewFrame* )ce->data() )
1101 if( GraphicsView_Viewer* aViewer = dynamic_cast<GraphicsView_Viewer*>( aViewFrame->getViewer() ) )
1103 SUIT_ViewManager* aViewManager = aViewer->getViewManager();
1104 ViewManagerRole aRole = getViewManagerRole( aViewManager );
1106 if( GraphicsView_ViewPort* aViewPort = aViewer->getActiveViewPort() )
1108 if( aRole != VMR_TransformImage && aRole != VMR_ReferenceImage )
1109 aViewPort->scale( 1, -1 ); // invert the Y axis direction from down to up
1111 aViewPort->setInteractionFlag( GraphicsView_ViewPort::TraceBoundingRect );
1112 aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateContextMenu );
1113 aViewPort->setInteractionFlag( GraphicsView_ViewPort::ImmediateSelection );
1115 //ouv: temporarily commented
1116 //aViewPort->setViewLabelPosition( GraphicsView_ViewPort::VLP_BottomLeft, true );
1119 if( aRole != VMR_TransformImage && aRole != VMR_ReferenceImage )
1120 update( UF_Viewer );
1122 aViewer->activateTransform( GraphicsView_Viewer::FitAll );
1128 bool HYDROGUI_Module::eventFilter( QObject* theObj, QEvent* theEvent )
1130 QEvent::Type aType = theEvent->type();
1131 if( theObj->inherits( "GraphicsView_ViewFrame" ) )
1133 if( aType == QEvent::Show )
1135 SALOME_CustomEvent* e = new SALOME_CustomEvent( NewViewEvent );
1136 e->setData( theObj );
1137 QApplication::postEvent( this, e );
1138 theObj->removeEventFilter( this );
1141 else if ( theObj->inherits( "OCCViewer_ViewPort" ) )
1143 if( aType == QEvent::Leave )
1145 SUIT_Desktop* aDesktop = getApp()->desktop();
1146 if ( aDesktop && aDesktop->statusBar() ) {
1147 aDesktop->statusBar()->clearMessage();
1152 return LightApp_Module::eventFilter( theObj, theEvent );
1155 void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager )
1157 LightApp_Module::onViewManagerAdded( theViewManager );
1159 if( theViewManager->getType() == GraphicsView_Viewer::Type() )
1161 connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
1162 this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
1164 else if( theViewManager->getType() == OCCViewer_Viewer::Type() )
1166 connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
1167 this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
1168 connect( theViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
1169 this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
1172 createSelector( theViewManager ); // replace the default selector
1174 ViewManagerInfo anInfo( theViewManager, VMR_General );
1175 myViewManagerMap.insert( ViewManagerId++, anInfo );
1178 void HYDROGUI_Module::onViewManagerRemoved( SUIT_ViewManager* theViewManager )
1180 LightApp_Module::onViewManagerRemoved( theViewManager );
1182 createSelector( theViewManager ); // replace the default selector
1184 int anId = getViewManagerId( theViewManager );
1187 OCCViewer_ViewManager* anOCCViewManager =
1188 ::qobject_cast<OCCViewer_ViewManager*>( myViewManagerMap[ anId ].first );
1189 if ( anOCCViewManager )
1191 OCCViewer_Viewer* anOCCViewer = anOCCViewManager->getOCCViewer();
1193 removeViewShapes( (size_t)anOCCViewer );
1196 if ( getVTKDisplayer()->IsApplicable( theViewManager ) )
1198 SVTK_Viewer* aVTKViewer = getVTKViewer( anId );
1201 getVTKDisplayer()->EraseScalarBar( anId, true );
1202 removeViewShapes( (size_t)aVTKViewer );
1206 myViewManagerMap.remove( anId );
1210 void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow )
1212 if( theViewWindow && theViewWindow->inherits( "GraphicsView_ViewFrame" ) )
1214 if( GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( theViewWindow ) )
1216 aViewFrame->installEventFilter( this );
1218 GraphicsView_ViewPort* aViewPort = aViewFrame->getViewPort();
1220 connect( aViewPort, SIGNAL( vpMouseEvent( QGraphicsSceneMouseEvent* ) ),
1221 this, SLOT( onViewPortMouseEvent( QGraphicsSceneMouseEvent* ) ) );
1224 else if( theViewWindow && theViewWindow->inherits( "OCCViewer_ViewFrame" ) )
1226 if( OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( theViewWindow ) )
1228 aViewFrame->onTopView();
1230 HYDROGUI_Tool::setOCCActionShown( aViewFrame, OCCViewer_ViewWindow::MaximizedId, false );
1232 OCCViewer_ViewPort3d* aViewPort = aViewFrame->getViewPort();
1234 aViewPort->installEventFilter( this );
1240 void HYDROGUI_Module::onViewPortMouseEvent( QGraphicsSceneMouseEvent* theEvent )
1242 /* ouv: currently unused
1243 if( GraphicsView_ViewPort* aViewPort = qobject_cast<GraphicsView_ViewPort*>( sender() ) )
1245 SUIT_ViewManager* aViewManager = 0;
1247 QObject* aParent = aViewPort;
1248 while( aParent = aParent->parent() )
1250 if( GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( aParent ) )
1252 if( GraphicsView_Viewer* aViewer = aViewFrame->getViewer() )
1254 aViewManager = aViewer->getViewManager();
1263 double aMouseX = theEvent->scenePos().x();
1264 double aMouseY = theEvent->scenePos().y();
1266 ViewManagerRole aRole = getViewManagerRole( aViewManager );
1267 if( aRole == VMR_General )
1269 int aXDeg = 0, aYDeg = 0;
1270 int aXMin = 0, aYMin = 0;
1271 double aXSec = 0, aYSec = 0;
1272 HYDROData_Lambert93::secToDMS( aMouseX, aXDeg, aXMin, aXSec );
1273 HYDROData_Lambert93::secToDMS( aMouseY, aYDeg, aYMin, aYSec );
1275 QString aDegSymbol( QChar( 0x00B0 ) );
1276 QString aXStr = QString( "%1%2 %3' %4\"" ).arg( aXDeg ).arg( aDegSymbol ).arg( aXMin ).arg( aXSec );
1277 QString aYStr = QString( "%1%2 %3' %4\"" ).arg( aYDeg ).arg( aDegSymbol ).arg( aYMin ).arg( aYSec );
1279 aViewPort->setViewLabelText( QString( "X: %1\nY: %2" ).arg( aXStr ).arg( aYStr ) );
1281 else if( aRole == VMR_TransformImage )
1282 aViewPort->setViewLabelText( QString( "X: %1\nY: %2" ).arg( (int)aMouseX ).arg( (int)aMouseY ) );
1287 void HYDROGUI_Module::updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer,
1288 const bool theIsInit,
1289 const bool theIsForced,
1290 const bool theDoFitAll )
1292 QList<int> aViewManagerIdList;
1294 // currently, all views are updated
1295 ViewManagerMapIterator anIter( myViewManagerMap );
1296 while( anIter.hasNext() )
1298 SUIT_ViewManager* aViewManager = anIter.next().value().first;
1300 if ( theDisplayer->IsApplicable( aViewManager ) )
1302 int anId = anIter.key();
1303 aViewManagerIdList.append( anId );
1307 QListIterator<int> anIdIter( aViewManagerIdList );
1308 while( anIdIter.hasNext() )
1310 theDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll );
1314 void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager )
1316 if( !theViewManager )
1319 LightApp_SelectionMgr* aSelectionMgr = getApp()->selectionMgr();
1320 if( !aSelectionMgr )
1323 QString aViewType = theViewManager->getType();
1324 if( aViewType != GraphicsView_Viewer::Type() &&
1325 aViewType != OCCViewer_Viewer::Type())
1328 QList<SUIT_Selector*> aSelectorList;
1329 aSelectionMgr->selectors( aViewType, aSelectorList );
1331 // disable all alien selectors
1332 QList<SUIT_Selector*>::iterator anIter, anIterEnd = aSelectorList.end();
1333 for( anIter = aSelectorList.begin(); anIter != anIterEnd; anIter++ )
1335 SUIT_Selector* aSelector = *anIter;
1336 if( aSelector && ( !dynamic_cast<HYDROGUI_GVSelector*>( aSelector ) &&
1337 !dynamic_cast<SVTK_Selector*>( aSelector ) &&
1338 !dynamic_cast<HYDROGUI_OCCSelector*>( aSelector ) ) )
1339 aSelector->setEnabled( false );
1342 if ( aViewType == GraphicsView_Viewer::Type() )
1344 GraphicsView_ViewManager* aViewManager =
1345 ::qobject_cast<GraphicsView_ViewManager*>( theViewManager );
1347 new HYDROGUI_GVSelector( this, aViewManager->getViewer(), aSelectionMgr );
1349 else if ( aViewType == OCCViewer_Viewer::Type() )
1351 OCCViewer_ViewManager* aViewManager =
1352 ::qobject_cast<OCCViewer_ViewManager*>( theViewManager );
1354 new HYDROGUI_OCCSelector( this, aViewManager->getOCCViewer(), aSelectionMgr );
1358 bool HYDROGUI_Module::setUpdateEnabled( const bool theState )
1360 bool aPrevState = myIsUpdateEnabled;
1361 myIsUpdateEnabled = theState;
1365 bool HYDROGUI_Module::isUpdateEnabled() const
1367 return myIsUpdateEnabled;
1370 QStringList HYDROGUI_Module::storeSelection() const
1372 QStringList anEntryList;
1373 if( LightApp_SelectionMgr* aSelectionMgr = getApp()->selectionMgr() )
1375 SUIT_DataOwnerPtrList aList( true );
1376 aSelectionMgr->selected( aList );
1378 SUIT_DataOwnerPtrList::iterator anIter;
1379 for( anIter = aList.begin(); anIter != aList.end(); anIter++ )
1381 const LightApp_DataOwner* anOwner =
1382 dynamic_cast<const LightApp_DataOwner*>( (*anIter).operator->() );
1384 anEntryList.append( anOwner->entry() );
1390 void HYDROGUI_Module::restoreSelection( const QStringList& theEntryList )
1392 if( LightApp_SelectionMgr* aSelectionMgr = getApp()->selectionMgr() )
1394 SUIT_DataOwnerPtrList aList( true );
1395 for( int anIndex = 0, aSize = theEntryList.size(); anIndex < aSize; anIndex++ )
1396 aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( theEntryList[ anIndex ] ) ) );
1397 aSelectionMgr->setSelected( aList );
1401 void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* theEvent )
1403 OCCViewer_ViewWindow* anOCCViewWindow =
1404 dynamic_cast<OCCViewer_ViewWindow*>(theViewWindow);
1405 if ( !anOCCViewWindow ) {
1409 // Get the selected point coordinates
1410 OCCViewer_ViewPort3d* aViewPort = anOCCViewWindow->getViewPort();
1415 gp_Pnt aPnt = CurveCreator_Utils::ConvertClickToPoint( theEvent->x(), theEvent->y(),
1416 aViewPort->getView() );
1417 // Show the coordinates in the status bar
1418 SUIT_Desktop* aDesktop = getApp()->desktop();
1419 if ( aDesktop && aDesktop->statusBar() ) {
1420 QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X() );
1421 QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y() );
1422 aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aX ).arg( anY ) );