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_CalculationOp.h"
25 #include "HYDROGUI_DataModel.h"
26 #include "HYDROGUI_CalculationDlg.h"
27 #include "HYDROGUI_Module.h"
28 #include "HYDROGUI_Tool.h"
29 #include "HYDROGUI_UpdateFlags.h"
30 #include "HYDROGUI_Zone.h"
31 #include "HYDROGUI_Region.h"
33 #include <HYDROData_PolylineXY.h>
34 #include <HYDROData_Iterator.h>
35 #include <HYDROData_Object.h>
36 #include <HYDROData_Tool.h>
38 #include <OCCViewer_ViewManager.h>
39 #include <OCCViewer_ViewModel.h>
40 #include <OCCViewer_ViewWindow.h>
42 #include <LightApp_Application.h>
43 #include <LightApp_UpdateFlags.h>
44 #include <LightApp_SelectionMgr.h>
45 #include <LightApp_DataOwner.h>
47 #include <SUIT_MessageBox.h>
48 #include <SUIT_Desktop.h>
49 #include <SUIT_DataBrowser.h>
51 #include <QApplication>
52 #include <QKeySequence>
55 HYDROGUI_CalculationOp::HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool theIsEdit )
56 : HYDROGUI_Operation( theModule ),
57 myIsEdit( theIsEdit ),
58 myActiveViewManager( NULL ),
59 myPreviewViewManager( NULL )
61 setName( myIsEdit ? tr( "EDIT_CALCULATION" ) : tr( "CREATE_CALCULATION" ) );
64 HYDROGUI_CalculationOp::~HYDROGUI_CalculationOp()
69 void HYDROGUI_CalculationOp::startOperation()
71 HYDROGUI_Operation::startOperation();
76 HYDROGUI_CalculationDlg* aPanel =
77 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
81 SUIT_DataBrowser* aOb = ((LightApp_Application*)module()->application())->objectBrowser();
82 QList<QShortcut*> aShortcuts = aOb->findChildren<QShortcut*>();
84 foreach( aShortcut, aShortcuts )
86 if ( aShortcut->key() ==
87 QKeySequence(((LightApp_Application*)module()->application())->objectBrowser()->shortcutKey(
88 SUIT_DataBrowser::RenameShortcut ) ) )
90 aShortcut->setEnabled( false );
97 QStringList anEntryList;
98 HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetGeometryObjects( module() );
99 getNamesAndEntries( aSeq, aList, anEntryList );
100 aPanel->setAllGeomObjects( aList, anEntryList );
105 HYDROData_Iterator anIter( doc(), KIND_POLYLINEXY );
106 Handle(HYDROData_PolylineXY) aPolylineObj;
107 QString aPolylineName;
108 for ( ; anIter.More(); anIter.Next() )
110 aPolylineObj = Handle(HYDROData_PolylineXY)::DownCast( anIter.Current() );
112 if ( !aPolylineObj.IsNull() && aPolylineObj->IsClosed() )
114 // Check the polyline shape
115 TopoDS_Shape aPolylineShape = aPolylineObj->GetShape();
116 if ( !aPolylineShape.IsNull() && aPolylineShape.ShapeType() == TopAbs_WIRE ) {
117 aPolylineName = aPolylineObj->GetName();
118 if ( !aPolylineName.isEmpty() )
120 aList.append( aPolylineName );
121 anEntryList.append( HYDROGUI_DataObject::dataObjectEntry( aPolylineObj ) );
126 aPanel->setPolylineNames( aList, anEntryList );
128 QString anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_CALCULATION_CASE_NAME" ) );
130 myEditedObject.Nullify();
133 myEditedObject = Handle(HYDROData_CalculationCase)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
134 if ( !myEditedObject.IsNull() )
136 anObjectName = myEditedObject->GetName();
137 aPolylineObj = myEditedObject->GetBoundaryPolyline();
138 if ( aPolylineObj.IsNull() )
140 aPanel->setBoundary( QString() );
144 aPolylineName = aPolylineObj->GetName();
145 aPanel->setBoundary( aPolylineName );
147 aSeq = myEditedObject->GetGeometryObjects();
148 getNamesAndEntries( aSeq, aList, anEntryList );
149 aPanel->includeGeomObjects( aList );
155 Handle(HYDROData_CalculationCase)::DownCast( doc()->CreateObject( KIND_CALCULATION ) );
156 myEditedObject->SetName(anObjectName);
159 aPanel->setObjectName( anObjectName );
160 aPanel->setEditedObject( myEditedObject );
165 void HYDROGUI_CalculationOp::getNamesAndEntries( const HYDROData_SequenceOfObjects& theSeq,
166 QStringList& theNames, QStringList& theEntries ) const
171 HYDROData_SequenceOfObjects::Iterator anIter( theSeq );
172 for ( ; anIter.More(); anIter.Next() )
174 Handle(HYDROData_Entity) anEntity = anIter.Value();
175 if ( !HYDROData_Tool::IsGeometryObject( anEntity ) )
178 theNames.append( anEntity->GetName() );
179 theEntries.append( HYDROGUI_DataObject::dataObjectEntry( anEntity ) );
183 void HYDROGUI_CalculationOp::abortOperation()
188 HYDROGUI_Operation::abortOperation();
189 module()->getApp()->updateObjectBrowser();
192 void HYDROGUI_CalculationOp::commitOperation()
195 // Commit transaction
196 commitDocOperation();
197 HYDROGUI_Operation::commitOperation();
200 HYDROGUI_InputPanel* HYDROGUI_CalculationOp::createInputPanel() const
202 HYDROGUI_CalculationDlg* aPanel = new HYDROGUI_CalculationDlg( module(), getName() );
204 // Connect signals and slots
205 connect( aPanel, SIGNAL( addObjects() ), SLOT( onAddObjects() ) );
206 connect( aPanel, SIGNAL( removeObjects() ), SLOT( onRemoveObjects() ) );
207 connect( aPanel, SIGNAL( Next( const int ) ), SLOT( onNext( const int ) ) );
208 connect( aPanel, SIGNAL( Back( const int ) ), SLOT( onHideZones() ) );
209 //connect( aPanel, SIGNAL( clicked( SUIT_DataObject* ) ), SLOT( onSelected( SUIT_DataObject* ) ) );
210 connect( aPanel, SIGNAL( setMergeType( int, QString& ) ), SLOT( onSetMergeType( int, QString& ) ) );
211 connect( aPanel, SIGNAL( moveZones( SUIT_DataObject*, const QList<SUIT_DataObject*>& ) ),
212 SLOT( onMoveZones( SUIT_DataObject*, const QList<SUIT_DataObject*>& ) ) );
213 connect( aPanel, SIGNAL( createRegion( const QList<SUIT_DataObject*>& ) ),
214 SLOT( onCreateRegion( const QList<SUIT_DataObject*>& ) ) );
215 connect( aPanel, SIGNAL( clickedInZonesBrowser( SUIT_DataObject* ) ),
216 SLOT( onClickedInZonesBrowser( SUIT_DataObject* ) ) );
217 connect( aPanel, SIGNAL( objectsSelected() ),
218 SLOT( onObjectsSelected() ) );
219 connect( aPanel, SIGNAL( boundarySelected( const QString & ) ),
220 SLOT( onBoundarySelected( const QString & ) ) );
225 void HYDROGUI_CalculationOp::onBoundarySelected ( const QString & theObjName )
227 bool anIsToUpdateViewer = false;
229 // Remove the old boundary from the operation viewer
230 Handle(HYDROData_PolylineXY) aPrevPolyline =
231 myEditedObject->GetBoundaryPolyline();
232 if ( !aPrevPolyline.IsNull() )
234 module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aPrevPolyline );
235 anIsToUpdateViewer = true;
238 // Set the selected boundary polyline to the calculation case
239 Handle(HYDROData_PolylineXY) aNewPolyline = Handle(HYDROData_PolylineXY)::DownCast(
240 HYDROGUI_Tool::FindObjectByName( module(), theObjName, KIND_POLYLINEXY ) );
241 myEditedObject->SetBoundaryPolyline( aNewPolyline );
243 if ( myPreviewViewManager )
245 OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer();
248 if ( !aNewPolyline.IsNull() )
250 Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
251 if ( !aCtx.IsNull() )
253 showObject( aNewPolyline, aCtx );
254 anIsToUpdateViewer = true;
258 if ( anIsToUpdateViewer )
264 void HYDROGUI_CalculationOp::onObjectsSelected()
266 HYDROGUI_CalculationDlg* aPanel =
267 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
269 QStringList aSelectedObjs = aPanel->getSelectedGeomObjects();
270 QMap<QString, bool> aSelectedObjsMap;
271 foreach( QString aName, aSelectedObjs )
272 aSelectedObjsMap[aName] = true;
275 // Select the appropriate geometry object shape in the viewer
276 selectionMgr()->clearSelected();
278 // Unhighlight all objects except selected
279 HYDROGUI_Shape* aShape = 0, *aLastShape = 0;
280 Handle(HYDROData_Entity) anEntity;
281 HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryObjects();
282 HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
285 for ( ; anIter.More(); anIter.Next() )
287 anEntity = anIter.Value();
288 if ( !anEntity.IsNull() )
290 aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anEntity );
293 aName = anEntity->GetName();
294 isSelected = aSelectedObjsMap.contains( aName );
295 aShape->highlight( isSelected, false );
296 aShape->update( false );
302 aLastShape->update( true );
305 void HYDROGUI_CalculationOp::onClickedInZonesBrowser( SUIT_DataObject* theItem )
307 HYDROGUI_Region* aRegionItem = dynamic_cast<HYDROGUI_Region*>(theItem);
308 HYDROGUI_Zone* aZoneItem;
309 selectionMgr()->clearSelected();
312 // Select a region in preview
313 SUIT_DataOwnerPtrList aList( true );
314 DataObjectList aZones = aRegionItem->children();
315 for ( int i = 0; i < aZones.length(); i++ )
317 aZoneItem = dynamic_cast<HYDROGUI_Zone*>(aZones.at(i));
320 aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( aZoneItem->entry() ) ) );
323 selectionMgr()->setSelected( aList );
327 // select a single zone
328 aZoneItem = dynamic_cast<HYDROGUI_Zone*>(theItem);
331 SUIT_DataOwnerPtrList aList( true );
332 aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( aZoneItem->entry() ) ) );
333 selectionMgr()->setSelected( aList );
338 void HYDROGUI_CalculationOp::onMoveZones( SUIT_DataObject* theRegionItem, const QList<SUIT_DataObject*>& theZonesList )
340 HYDROGUI_Region* aRegion = dynamic_cast<HYDROGUI_Region*>(theRegionItem);
343 QList<HYDROGUI_Zone*> aZonesList;
344 HYDROGUI_Zone* aZone;
345 // Get a list of dropped zones
346 for ( int i = 0; i < theZonesList.length(); i++ )
348 aZone = dynamic_cast<HYDROGUI_Zone*>( theZonesList.at( i ) );
351 aZonesList.append( aZone );
354 if ( aZonesList.length() > 0 )
356 aRegion->addZones( aZonesList );
357 HYDROGUI_CalculationDlg* aPanel =
358 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
361 aPanel->refreshZonesBrowser();
368 void HYDROGUI_CalculationOp::onCreateRegion( const QList<SUIT_DataObject*>& theZonesList )
370 QList<HYDROGUI_Zone*> aZonesList;
371 HYDROGUI_Zone* aZone;
372 // Get a list of dropped zones
373 for ( int i = 0; i < theZonesList.length(); i++ )
375 aZone = dynamic_cast<HYDROGUI_Zone*>( theZonesList.at( i ) );
378 aZonesList.append( aZone );
381 if ( aZonesList.length() > 0 )
383 module()->getDataModel()->createNewRegion( myEditedObject, aZonesList );
384 HYDROGUI_CalculationDlg* aPanel =
385 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
388 aPanel->refreshZonesBrowser();
394 void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theBathymetryName )
396 HYDROGUI_CalculationDlg* aPanel =
397 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
400 HYDROGUI_Zone* aZone = aPanel->getCurrentZone();
403 aZone->setMergeType( theMergeType, theBathymetryName );
404 HYDROGUI_Shape* aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aZone->modelObject() );
410 aPanel->refreshZonesBrowser();
414 void HYDROGUI_CalculationOp::onAddObjects()
416 HYDROGUI_CalculationDlg* aPanel =
417 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
421 // Add geometry objects selected in the module browser to the calculation case
422 QStringList aSelectedList = aPanel->getSelectedAvailableGeomObjects();
423 if ( aSelectedList.isEmpty() || !confirmRegionsChange() )
426 QStringList anAddedList;
427 for (int i = 0; i < aSelectedList.length(); i++)
429 Handle(HYDROData_Object) anObject = Handle(HYDROData_Object)::DownCast(
430 HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at( i ) ) );
431 if ( anObject.IsNull() )
434 if ( myEditedObject->AddGeometryObject( anObject ) )
435 anAddedList.append( anObject->GetName() );
438 if ( !anAddedList.isEmpty() )
440 aPanel->includeGeomObjects( anAddedList );
445 void HYDROGUI_CalculationOp::onRemoveObjects()
447 // Remove selected objects from the calculation case
448 HYDROGUI_CalculationDlg* aPanel =
449 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
453 QStringList aSelectedList = aPanel->getSelectedGeomObjects();
454 if ( aSelectedList.isEmpty() || !confirmRegionsChange() )
457 for (int i = 0; i < aSelectedList.length(); i++)
459 Handle(HYDROData_Object) anObject = Handle(HYDROData_Object)::DownCast(
460 HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at(i) ) );
461 if ( anObject.IsNull() )
464 module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anObject );
465 myEditedObject->RemoveGeometryObject( anObject );
468 aPanel->excludeGeomObjects( aSelectedList );
471 bool HYDROGUI_CalculationOp::confirmRegionsChange() const
473 // Check if the case is already modified or not
474 bool isConfirmed = myEditedObject->IsMustBeUpdated();
477 // If not modified check if the case has already defined regions with zones
478 HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions();
479 if ( aSeq.Length() > 0 )
481 // If there are already defined zones then ask a user to confirm zones recalculation
482 isConfirmed = ( SUIT_MessageBox::question( module()->getApp()->desktop(),
483 tr( "REGIONS_CHANGED" ),
484 tr( "CONFIRM_SPLITTING_ZONES_RECALCULATION" ),
485 QMessageBox::Yes | QMessageBox::No,
486 QMessageBox::No ) == QMessageBox::Yes );
490 isConfirmed = true; // No regions - no zones - nothing to recalculate
496 bool HYDROGUI_CalculationOp::processApply( int& theUpdateFlags,
497 QString& theErrorMsg )
499 HYDROGUI_CalculationDlg* aPanel =
500 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
504 theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
509 void HYDROGUI_CalculationOp::onApply()
511 QApplication::setOverrideCursor( Qt::WaitCursor );
513 int anUpdateFlags = 0;
516 bool aResult = false;
520 aResult = processApply( anUpdateFlags, anErrorMsg );
522 catch ( Standard_Failure )
524 Handle(Standard_Failure) aFailure = Standard_Failure::Caught();
525 anErrorMsg = aFailure->GetMessageString();
533 QApplication::restoreOverrideCursor();
537 module()->update( anUpdateFlags );
543 QString aMsg = tr( "INPUT_VALID_DATA" );
544 if( !anErrorMsg.isEmpty() )
545 aMsg.prepend( anErrorMsg + "\n" );
546 SUIT_MessageBox::critical( module()->getApp()->desktop(),
547 tr( "INSUFFICIENT_INPUT_DATA" ),
552 void HYDROGUI_CalculationOp::onNext( const int theIndex )
556 setAvailableGroups();
558 else if( theIndex==2 )
560 HYDROGUI_CalculationDlg* aPanel =
561 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
565 QApplication::setOverrideCursor( Qt::WaitCursor );
567 QString aNewCaseName = aPanel->getObjectName();
568 QString anOldCaseName = myEditedObject->GetName();
570 bool anIsToUpdateOb = myIsEdit && anOldCaseName != aNewCaseName;
572 // At first we must to update the case name because of
573 // automatic names generation for regions and zones
574 myEditedObject->SetName( aNewCaseName );
576 if ( myEditedObject->IsMustBeUpdated() )
579 myEditedObject->Update();
581 //aPanel->setEditedObject( myEditedObject );
582 aPanel->refreshZonesBrowser();
588 setZonesVisible( true );
591 if ( anIsToUpdateOb )
592 module()->getApp()->updateObjectBrowser( false );
594 QApplication::restoreOverrideCursor();
598 void HYDROGUI_CalculationOp::onHideZones()
600 setZonesVisible( false );
603 void HYDROGUI_CalculationOp::setZonesVisible( bool theIsVisible )
605 myShowZones = theIsVisible;
606 HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions();
607 HYDROData_SequenceOfObjects::Iterator aRegionsIter( aRegions );
608 HYDROData_SequenceOfObjects aZones;
609 Handle(HYDROData_Region) aRegion;
610 if ( myPreviewViewManager )
612 if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() )
614 Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
615 if ( !aCtx.IsNull() )
617 for ( ; aRegionsIter.More(); aRegionsIter.Next() )
619 aRegion = Handle(HYDROData_Region)::DownCast( aRegionsIter.Value() );
620 if ( !aRegion.IsNull() )
622 aZones = aRegion->GetZones();
623 HYDROData_SequenceOfObjects::Iterator aZonesIter( aZones );
624 for ( ; aZonesIter.More(); aZonesIter.Next() )
628 showObject( aZonesIter.Value(), aCtx );
632 module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aZonesIter.Value() );
644 void HYDROGUI_CalculationOp::createPreview()
646 LightApp_Application* anApp = module()->getApp();
647 HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryObjects();
648 Handle(HYDROData_Entity) anEntity;
652 // Gather zones for displaying
653 HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions();
654 HYDROData_SequenceOfObjects::Iterator aRegionsIter( aRegions );
655 HYDROData_SequenceOfObjects aZones;
656 Handle(HYDROData_Region) aRegion;
657 for ( ; aRegionsIter.More(); aRegionsIter.Next() )
659 anEntity = aRegionsIter.Value();
660 if ( !anEntity.IsNull() )
662 aRegion = Handle(HYDROData_Region)::DownCast( anEntity );
663 if ( !aRegion.IsNull() )
665 aZones = aRegion->GetZones();
666 aSeq.Append( aZones );
672 // Get a boundary polyline if any
673 aSeq.Append( myEditedObject->GetBoundaryPolyline() );
675 module()->removeViewShapes( HYDROGUI_Module::VMR_PreviewCaseZones );
677 if ( !myActiveViewManager )
679 if ( aSeq.IsEmpty() )
682 myActiveViewManager = anApp->activeViewManager();
685 if ( !myPreviewViewManager )
687 myPreviewViewManager = ::qobject_cast<OCCViewer_ViewManager*>(
688 anApp->createViewManager( OCCViewer_Viewer::Type() ) );
689 if ( myPreviewViewManager )
691 connect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
692 this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
694 module()->setViewManagerRole( myPreviewViewManager, HYDROGUI_Module::VMR_PreviewCaseZones );
695 myPreviewViewManager->setTitle( tr( "PREVIEW_CASE_ZONES" ) );
699 if ( !myPreviewViewManager )
702 if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() )
704 Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
705 if ( !aCtx.IsNull() )
707 HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
708 for ( ; anIter.More(); anIter.Next() )
710 showObject( anIter.Value(), aCtx );
713 //Process the draw events for viewer
714 QApplication::processEvents();
715 if ( OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView() )
723 void HYDROGUI_CalculationOp::showObject( Handle(HYDROData_Entity) theEntity, Handle(AIS_InteractiveContext) theCtx )
725 if ( !theEntity.IsNull() )
727 HYDROGUI_Shape* aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, theEntity );
730 aShape = new HYDROGUI_Shape( theCtx, theEntity );
731 module()->setObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, theEntity, aShape );
733 aShape->update( false );
737 void HYDROGUI_CalculationOp::onLastViewClosed( SUIT_ViewManager* theViewManager )
742 void HYDROGUI_CalculationOp::closePreview()
744 SUIT_DataBrowser* aOb = ((LightApp_Application*)module()->application())->objectBrowser();
745 QList<QShortcut*> aShortcuts = aOb->findChildren<QShortcut*>();
746 QShortcut* aShortcut;
747 foreach( aShortcut, aShortcuts )
749 if ( aShortcut->key() ==
750 QKeySequence( ((LightApp_Application*)module()->application())->objectBrowser()->shortcutKey(
751 SUIT_DataBrowser::RenameShortcut ) ) )
753 aShortcut->setEnabled( true );
758 if( myPreviewViewManager )
760 disconnect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
761 this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
763 module()->getApp()->removeViewManager( myPreviewViewManager ); // myPreviewViewManager is deleted here
764 myPreviewViewManager = NULL;
767 if( myActiveViewManager )
769 HYDROGUI_Tool::SetActiveViewManager( module(), myActiveViewManager );
770 myActiveViewManager = NULL;
774 void HYDROGUI_CalculationOp::setAvailableGroups()
776 HYDROGUI_CalculationDlg* aPanel =
777 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
779 HYDROData_SequenceOfObjects anObjs = myEditedObject->GetGeometryObjects();
780 for( int anIndex = 1, aLength = anObjs.Length(); anIndex <= aLength; anIndex++ )
782 Handle_HYDROData_Object anObj = Handle_HYDROData_Object::DownCast( anObjs.Value( anIndex ) );
783 //TODO: anObj->GetGroups();