-void HYDROGUI_Tool::SetActiveViewManager( HYDROGUI_Module* theModule,
- SUIT_ViewManager* theViewManager )
-{
- if( theViewManager )
- if( SUIT_ViewWindow* aViewWindow = theViewManager->getActiveView() )
- if( STD_TabDesktop* aTabDesktop = dynamic_cast<STD_TabDesktop*>( theModule->getApp()->desktop() ) )
- if( QtxWorkstack* aWorkstack = aTabDesktop->workstack() )
- aWorkstack->setActiveWindow( aViewWindow );
-}
-
-void HYDROGUI_Tool::GetPrsSubObjects( HYDROGUI_Module* theModule,
- HYDROData_SequenceOfObjects& theSeq )
-{
- Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
- if( !aDocument.IsNull() )
- {
- HYDROData_Iterator anIterator( aDocument );
- for( ; anIterator.More(); anIterator.Next() )
- {
- Handle(HYDROData_Entity) anObject = anIterator.Current();
- if( !anObject.IsNull() && (
- ( anObject->GetKind() == KIND_IMAGE ) ||
- ( anObject->GetKind() == KIND_POLYLINE ) ||
- ( anObject->GetKind() == KIND_IMMERSIBLE_ZONE ) ||
- ( anObject->GetKind() == KIND_REGION ) ||
- ( anObject->GetKind() == KIND_ZONE ) ||
- ( anObject->GetKind() == KIND_OBSTACLE ) ) )
- {
- theSeq.Append( anObject );
- }
- }
- }
-}
-
-HYDROGUI_Prs* HYDROGUI_Tool::GetPresentation( const Handle(HYDROData_Entity)& theObj,
- const GraphicsView_ObjectList& theObjects )
-{
- if( !theObj.IsNull() )
- {
- GraphicsView_ObjectListIterator anIter( theObjects );
- while( anIter.hasNext() )
- {
- if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
- {
- Handle(HYDROData_Entity) anObj = aPrs->getObject();
- if( IsEqual( anObj, theObj ) )
- return aPrs;
- }
- }
- }
- return NULL;
-}
-
-GraphicsView_ObjectList HYDROGUI_Tool::GetPrsList( GraphicsView_ViewPort* theViewPort )
-{
- GraphicsView_ObjectList aList;
- if( theViewPort )
- {
- GraphicsView_ObjectListIterator anIter( theViewPort->getObjects() );
- while( anIter.hasNext() )
- if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
- aList.append( aPrs );
- }
- return aList;
-}
-
-HYDROData_SequenceOfObjects HYDROGUI_Tool::GetSelectedObjects( HYDROGUI_Module* theModule )
-{
- HYDROData_SequenceOfObjects aSeq;
-
- HYDROGUI_DataModel* aModel = theModule->getDataModel();
-
- SUIT_SelectionMgr* aSelectionMgr = theModule->getApp()->selectionMgr();
- SUIT_DataOwnerPtrList anOwners;
- aSelectionMgr->selected( anOwners );
-
- QStringList aCollectedNameList; // to avoid duplication
- foreach( SUIT_DataOwner* aSUITOwner, anOwners )
- {
- if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
- {
- Handle(HYDROData_Entity) anObject = aModel->objectByEntry( anOwner->entry() );
- if( !anObject.IsNull() )
- {
- QString aName = anObject->GetName();
- if( !aCollectedNameList.contains( aName ) )
- {
- aSeq.Append( anObject );
- aCollectedNameList.append( aName );
- }
- }
- }
- }
- return aSeq;
-}
-
-Handle(HYDROData_Entity) HYDROGUI_Tool::GetSelectedObject( HYDROGUI_Module* theModule )
-{
- HYDROData_SequenceOfObjects aSeq = GetSelectedObjects( theModule );
- if( !aSeq.IsEmpty() )
- return aSeq.First();
- return NULL;
-}
-
-HYDROData_SequenceOfObjects HYDROGUI_Tool::GetGeometryObjects(
- HYDROGUI_Module* theModule )