From 22270d5d7b703fee59bd48ce61a73eaa05f124d9 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 23 Jun 2005 11:05:36 +0000 Subject: [PATCH] Suppress compilation warnings --- src/VISU_I/VISU_Gen_i.cc | 36 +++++++++++++++++++++++++++---- src/VISU_I/VISU_ViewManager_i.cc | 37 +++++++++++++++++++++----------- src/VISU_I/VISU_View_i.cc | 10 +++++++-- 3 files changed, 64 insertions(+), 19 deletions(-) diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 9965c30b..11ffff01 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -404,12 +404,40 @@ namespace VISU{ return Base_i::GetID(); } - void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy){ - if(!CORBA::is_nil(theStudy)){ + void VISU_Gen_i::SetCurrentStudy(SALOMEDS::Study_ptr theStudy) + { + if (!CORBA::is_nil(theStudy)) + { CORBA::String_var aName = theStudy->Name(); - MESSAGE("VISU_Gen_i::SetCurrentStudy - StudyId = "<StudyId()<<"; Name = '"< anApplications = aSession->applications(); + QPtrListIterator anIter (anApplications); + SUIT_Application* aFirstApp = anIter.current(); + while (SUIT_Application* anApp = anIter.current()) { + ++anIter; + if (SUIT_Study* aSStudy = anApp->activeStudy()) { + if (SalomeApp_Study* aStudy = dynamic_cast(aSStudy)) { + MESSAGE("There is an application with active study : " << aStudy->studyName()); + if (aStudyName == aStudy->studyName()) { + isActive = true; + break; + } + } + } + } + if (!isActive) { + // Has to be loaded in an empty or in a new application + SalomeApp_Application* anApp = dynamic_cast(aFirstApp); + anApp->onLoadDoc(aName.in()); + } + } else { MESSAGE("VISU_Gen_i::SetCurrentStudy : CORBA::is_nil(theStudy)"); } } diff --git a/src/VISU_I/VISU_ViewManager_i.cc b/src/VISU_I/VISU_ViewManager_i.cc index f09e93de..e501ec10 100644 --- a/src/VISU_I/VISU_ViewManager_i.cc +++ b/src/VISU_I/VISU_ViewManager_i.cc @@ -77,22 +77,34 @@ namespace VISU { void Execute() { + MESSAGE("Find application for study : " << myStudyName); + QString aStudyName (myStudyName); SUIT_Session* aSession = SUIT_Session::session(); QPtrList anApplications = aSession->applications(); - QPtrListIterator anIter(anApplications); - while(SUIT_Application* anApp = anIter.current()){ + QPtrListIterator anIter (anApplications); + //bool isAnyStudy = false; //jfa tmp + ////SUIT_Application* aFirstResult = NULL; //jfa tmp + //SUIT_Application* aFirstResult = anIter.current(); //jfa tmp + while (SUIT_Application* anApp = anIter.current()) { ++anIter; - if(SUIT_Study* aSStudy = anApp->activeStudy()){ - if(SalomeApp_Study* aStudy = dynamic_cast(aSStudy)){ - if(_PTR(Study) aCStudy = aStudy->studyDS()){ - if(myStudyName == aCStudy->Name()){ - myResult = dynamic_cast(anApp); - break; - } + if (SUIT_Study* aSStudy = anApp->activeStudy()) { + if (SalomeApp_Study* aStudy = dynamic_cast(aSStudy)) { + //isAnyStudy = true; //jfa tmp + ////aFirstResult = anApp; //jfa tmp + MESSAGE("There is an application with active study : " << aStudy->studyName()); + if (aStudyName == aStudy->studyName()) { + myResult = dynamic_cast(anApp); + break; } } } } + if (!myResult) { //jfa tmp + MESSAGE("Error: application is not found for study : " << myStudyName); + ////if (isAnyStudy) { //jfa tmp + // myResult = dynamic_cast(aFirstResult); //jfa tmp + ////} //jfa tmp + } //jfa tmp } }; @@ -148,13 +160,11 @@ namespace VISU { template struct TCreateViewFrameEvent: public SALOME_Event { - //const SUIT_Application* myApplication; SalomeApp_Application* myApplication; typedef typename TViewFrame::TInterface TInterface; typedef typename TInterface::_ptr_type TResult; TResult myResult; - //TCreateViewFrameEvent (const SUIT_Application* theApplication): TCreateViewFrameEvent (SalomeApp_Application* theApplication): myApplication(theApplication), myResult(TInterface::_nil()) @@ -164,11 +174,12 @@ namespace VISU { void Execute() { - //if (CheckStudy(myStudyDocument)){ + //if (CheckStudy(myStudyDocument)) { + if (myApplication) { TViewFrame* pView = new TViewFrame (myApplication); if (pView->Create(1)) myResult = pView->_this(); - //} + } } }; diff --git a/src/VISU_I/VISU_View_i.cc b/src/VISU_I/VISU_View_i.cc index a9b943c3..73b1d60b 100644 --- a/src/VISU_I/VISU_View_i.cc +++ b/src/VISU_I/VISU_View_i.cc @@ -608,9 +608,12 @@ namespace VISU{ //=========================================================================== XYPlot_i::XYPlot_i (SalomeApp_Application* theApplication) - : View_i(theApplication, theApplication->getViewManager(Plot2d_Viewer::Type(), true)) + : View_i(theApplication, NULL) { if (MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i"); + if (theApplication) { + myViewManager = theApplication->getViewManager(Plot2d_Viewer::Type(), true); + } } Storable* XYPlot_i::Create (int theNew) @@ -981,9 +984,12 @@ namespace VISU{ } View3D_i::View3D_i (SalomeApp_Application* theApplication) - : View_i(theApplication, theApplication->getViewManager(SVTK_Viewer::Type(), true)) + : View_i(theApplication, NULL) { if (MYDEBUG) MESSAGE("View3D_i::View3D_i"); + if (theApplication) { + myViewManager = theApplication->getViewManager(SVTK_Viewer::Type(), true); + } } Storable* View3D_i::Create (int theNew) -- 2.39.2