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( onSplitZones() ) );
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( objectSelected( const QString & ) ),
218 SLOT( onObjectSelected( const QString & ) ) );
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::onObjectSelected ( const QString & theObjName )
266 // Select the appropriate geometry object shape in the viewer
267 selectionMgr()->clearSelected();
269 // Unhighlight all objects except selected
270 HYDROGUI_Shape* aShape;
271 HYDROGUI_Shape* aSelectedShape = 0;
272 Handle(HYDROData_Entity) anEntity;
273 HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryObjects();
274 HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
277 for ( ; anIter.More(); anIter.Next() )
279 anEntity = anIter.Value();
280 if ( !anEntity.IsNull() )
282 aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anEntity );
285 aName = anEntity->GetName();
286 isSelected = ( aName == theObjName );
289 aSelectedShape = aShape;
291 if ( aShape->isHighlighted() != isSelected )
295 aShape->highlight( isSelected );
302 if ( aSelectedShape )
304 aSelectedShape->highlight( true );
305 aSelectedShape->update();
309 void HYDROGUI_CalculationOp::onClickedInZonesBrowser( SUIT_DataObject* theItem )
311 HYDROGUI_Region* aRegionItem = dynamic_cast<HYDROGUI_Region*>(theItem);
312 HYDROGUI_Zone* aZoneItem;
313 selectionMgr()->clearSelected();
316 // Select a region in preview
317 SUIT_DataOwnerPtrList aList( true );
318 DataObjectList aZones = aRegionItem->children();
319 for ( int i = 0; i < aZones.length(); i++ )
321 aZoneItem = dynamic_cast<HYDROGUI_Zone*>(aZones.at(i));
324 aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( aZoneItem->entry() ) ) );
327 selectionMgr()->setSelected( aList );
331 // select a single zone
332 aZoneItem = dynamic_cast<HYDROGUI_Zone*>(theItem);
335 SUIT_DataOwnerPtrList aList( true );
336 aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( aZoneItem->entry() ) ) );
337 selectionMgr()->setSelected( aList );
342 void HYDROGUI_CalculationOp::onMoveZones( SUIT_DataObject* theRegionItem, const QList<SUIT_DataObject*>& theZonesList )
344 HYDROGUI_Region* aRegion = dynamic_cast<HYDROGUI_Region*>(theRegionItem);
347 QList<HYDROGUI_Zone*> aZonesList;
348 HYDROGUI_Zone* aZone;
349 // Get a list of dropped zones
350 for ( int i = 0; i < theZonesList.length(); i++ )
352 aZone = dynamic_cast<HYDROGUI_Zone*>( theZonesList.at( i ) );
355 aZonesList.append( aZone );
358 if ( aZonesList.length() > 0 )
360 aRegion->addZones( aZonesList );
361 HYDROGUI_CalculationDlg* aPanel =
362 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
365 aPanel->refreshZonesBrowser();
372 void HYDROGUI_CalculationOp::onCreateRegion( const QList<SUIT_DataObject*>& theZonesList )
374 QList<HYDROGUI_Zone*> aZonesList;
375 HYDROGUI_Zone* aZone;
376 // Get a list of dropped zones
377 for ( int i = 0; i < theZonesList.length(); i++ )
379 aZone = dynamic_cast<HYDROGUI_Zone*>( theZonesList.at( i ) );
382 aZonesList.append( aZone );
385 if ( aZonesList.length() > 0 )
387 module()->getDataModel()->createNewRegion( myEditedObject, aZonesList );
388 HYDROGUI_CalculationDlg* aPanel =
389 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
392 aPanel->refreshZonesBrowser();
398 void HYDROGUI_CalculationOp::onSetMergeType( int theMergeType, QString& theBathymetryName )
400 HYDROGUI_CalculationDlg* aPanel =
401 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
404 HYDROGUI_Zone* aZone = aPanel->getCurrentZone();
407 aZone->setMergeType( theMergeType, theBathymetryName );
408 HYDROGUI_Shape* aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aZone->modelObject() );
414 aPanel->refreshZonesBrowser();
418 void HYDROGUI_CalculationOp::onAddObjects()
420 HYDROGUI_CalculationDlg* aPanel =
421 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
425 // Add geometry objects selected in the module browser to the calculation case
426 QStringList aSelectedList = aPanel->getSelectedAvailableGeomObjects();
427 if ( aSelectedList.isEmpty() || !confirmRegionsChange() )
430 QStringList anAddedList;
431 for (int i = 0; i < aSelectedList.length(); i++)
433 Handle(HYDROData_Object) anObject = Handle(HYDROData_Object)::DownCast(
434 HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at( i ) ) );
435 if ( anObject.IsNull() )
438 if ( myEditedObject->AddGeometryObject( anObject ) )
439 anAddedList.append( anObject->GetName() );
442 if ( !anAddedList.isEmpty() )
444 aPanel->includeGeomObjects( anAddedList );
449 void HYDROGUI_CalculationOp::onRemoveObjects()
451 // Remove selected objects from the calculation case
452 HYDROGUI_CalculationDlg* aPanel =
453 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
457 QStringList aSelectedList = aPanel->getSelectedGeomObjects();
458 if ( aSelectedList.isEmpty() || !confirmRegionsChange() )
461 for (int i = 0; i < aSelectedList.length(); i++)
463 Handle(HYDROData_Object) anObject = Handle(HYDROData_Object)::DownCast(
464 HYDROGUI_Tool::FindObjectByName( module(), aSelectedList.at(i) ) );
465 if ( anObject.IsNull() )
468 module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, anObject );
469 myEditedObject->RemoveGeometryObject( anObject );
472 aPanel->excludeGeomObjects( aSelectedList );
475 bool HYDROGUI_CalculationOp::confirmRegionsChange() const
477 // Check if the case is already modified or not
478 bool isConfirmed = myEditedObject->IsMustBeUpdated();
481 // If not modified check if the case has already defined regions with zones
482 HYDROData_SequenceOfObjects aSeq = myEditedObject->GetRegions();
483 if ( aSeq.Length() > 0 )
485 // If there are already defined zones then ask a user to confirm zones recalculation
486 isConfirmed = ( SUIT_MessageBox::question( module()->getApp()->desktop(),
487 tr( "REGIONS_CHANGED" ),
488 tr( "CONFIRM_SPLITTING_ZONES_RECALCULATION" ),
489 QMessageBox::Yes | QMessageBox::No,
490 QMessageBox::No ) == QMessageBox::Yes );
494 isConfirmed = true; // No regions - no zones - nothing to recalculate
500 bool HYDROGUI_CalculationOp::processApply( int& theUpdateFlags,
501 QString& theErrorMsg )
503 HYDROGUI_CalculationDlg* aPanel =
504 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
508 theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
513 void HYDROGUI_CalculationOp::onApply()
515 QApplication::setOverrideCursor( Qt::WaitCursor );
517 int anUpdateFlags = 0;
520 bool aResult = false;
524 aResult = processApply( anUpdateFlags, anErrorMsg );
526 catch ( Standard_Failure )
528 Handle(Standard_Failure) aFailure = Standard_Failure::Caught();
529 anErrorMsg = aFailure->GetMessageString();
537 QApplication::restoreOverrideCursor();
541 module()->update( anUpdateFlags );
547 QString aMsg = tr( "INPUT_VALID_DATA" );
548 if( !anErrorMsg.isEmpty() )
549 aMsg.prepend( anErrorMsg + "\n" );
550 SUIT_MessageBox::critical( module()->getApp()->desktop(),
551 tr( "INSUFFICIENT_INPUT_DATA" ),
556 void HYDROGUI_CalculationOp::onSplitZones()
558 HYDROGUI_CalculationDlg* aPanel =
559 ::qobject_cast<HYDROGUI_CalculationDlg*>( inputPanel() );
563 QApplication::setOverrideCursor( Qt::WaitCursor );
565 QString aNewCaseName = aPanel->getObjectName();
566 QString anOldCaseName = myEditedObject->GetName();
568 bool anIsToUpdateOb = myIsEdit && anOldCaseName != aNewCaseName;
570 // At first we must to update the case name because of
571 // automatic names generation for regions and zones
572 myEditedObject->SetName( aNewCaseName );
574 if ( myEditedObject->IsMustBeUpdated() )
577 myEditedObject->Update();
579 //aPanel->setEditedObject( myEditedObject );
580 aPanel->refreshZonesBrowser();
586 setZonesVisible( true );
589 if ( anIsToUpdateOb )
590 module()->getApp()->updateObjectBrowser( false );
592 QApplication::restoreOverrideCursor();
595 void HYDROGUI_CalculationOp::onHideZones()
597 setZonesVisible( false );
600 void HYDROGUI_CalculationOp::setZonesVisible( bool theIsVisible )
602 myShowZones = theIsVisible;
603 HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions();
604 HYDROData_SequenceOfObjects::Iterator aRegionsIter( aRegions );
605 HYDROData_SequenceOfObjects aZones;
606 Handle(HYDROData_Region) aRegion;
607 if ( myPreviewViewManager )
609 if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() )
611 Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
612 if ( !aCtx.IsNull() )
614 for ( ; aRegionsIter.More(); aRegionsIter.Next() )
616 aRegion = Handle(HYDROData_Region)::DownCast( aRegionsIter.Value() );
617 if ( !aRegion.IsNull() )
619 aZones = aRegion->GetZones();
620 HYDROData_SequenceOfObjects::Iterator aZonesIter( aZones );
621 for ( ; aZonesIter.More(); aZonesIter.Next() )
625 showObject( aZonesIter.Value(), aCtx );
629 module()->removeObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, aZonesIter.Value() );
641 void HYDROGUI_CalculationOp::createPreview()
643 LightApp_Application* anApp = module()->getApp();
644 HYDROData_SequenceOfObjects aSeq = myEditedObject->GetGeometryObjects();
645 Handle(HYDROData_Entity) anEntity;
649 // Gather zones for displaying
650 HYDROData_SequenceOfObjects aRegions = myEditedObject->GetRegions();
651 HYDROData_SequenceOfObjects::Iterator aRegionsIter( aRegions );
652 HYDROData_SequenceOfObjects aZones;
653 Handle(HYDROData_Region) aRegion;
654 for ( ; aRegionsIter.More(); aRegionsIter.Next() )
656 anEntity = aRegionsIter.Value();
657 if ( !anEntity.IsNull() )
659 aRegion = Handle(HYDROData_Region)::DownCast( anEntity );
660 if ( !aRegion.IsNull() )
662 aZones = aRegion->GetZones();
663 aSeq.Append( aZones );
669 // Get a boundary polyline if any
670 aSeq.Append( myEditedObject->GetBoundaryPolyline() );
672 module()->removeViewShapes( HYDROGUI_Module::VMR_PreviewCaseZones );
674 if ( !myActiveViewManager )
676 if ( aSeq.IsEmpty() )
679 myActiveViewManager = anApp->activeViewManager();
682 if ( !myPreviewViewManager )
684 myPreviewViewManager = ::qobject_cast<OCCViewer_ViewManager*>(
685 anApp->createViewManager( OCCViewer_Viewer::Type() ) );
686 if ( myPreviewViewManager )
688 connect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
689 this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
691 module()->setViewManagerRole( myPreviewViewManager, HYDROGUI_Module::VMR_PreviewCaseZones );
692 myPreviewViewManager->setTitle( tr( "PREVIEW_CASE_ZONES" ) );
696 if ( !myPreviewViewManager )
699 if ( OCCViewer_Viewer* aViewer = myPreviewViewManager->getOCCViewer() )
701 Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
702 if ( !aCtx.IsNull() )
704 HYDROData_SequenceOfObjects::Iterator anIter( aSeq );
705 for ( ; anIter.More(); anIter.Next() )
707 showObject( anIter.Value(), aCtx );
710 //Process the draw events for viewer
711 QApplication::processEvents();
712 if ( OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView() )
720 void HYDROGUI_CalculationOp::showObject( Handle(HYDROData_Entity) theEntity, Handle(AIS_InteractiveContext) theCtx )
722 if ( !theEntity.IsNull() )
724 HYDROGUI_Shape* aShape = module()->getObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, theEntity );
727 aShape = new HYDROGUI_Shape( theCtx, theEntity );
728 module()->setObjectShape( HYDROGUI_Module::VMR_PreviewCaseZones, theEntity, aShape );
730 aShape->update( false );
734 void HYDROGUI_CalculationOp::onLastViewClosed( SUIT_ViewManager* theViewManager )
739 void HYDROGUI_CalculationOp::closePreview()
741 SUIT_DataBrowser* aOb = ((LightApp_Application*)module()->application())->objectBrowser();
742 QList<QShortcut*> aShortcuts = aOb->findChildren<QShortcut*>();
743 QShortcut* aShortcut;
744 foreach( aShortcut, aShortcuts )
746 if ( aShortcut->key() ==
747 QKeySequence( ((LightApp_Application*)module()->application())->objectBrowser()->shortcutKey(
748 SUIT_DataBrowser::RenameShortcut ) ) )
750 aShortcut->setEnabled( true );
755 if( myPreviewViewManager )
757 disconnect( myPreviewViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
758 this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
760 module()->getApp()->removeViewManager( myPreviewViewManager ); // myPreviewViewManager is deleted here
761 myPreviewViewManager = NULL;
764 if( myActiveViewManager )
766 HYDROGUI_Tool::SetActiveViewManager( module(), myActiveViewManager );
767 myActiveViewManager = NULL;