From: smh Date: Fri, 16 Apr 2004 07:12:02 +0000 (+0000) Subject: Another CORBA calls was wrapped X-Git-Tag: mergeto_Event_Server_20Apr04~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1d8e08f853ba6025475ad0428d9d8419d1bc6ba2;p=modules%2Fvisu.git Another CORBA calls was wrapped --- diff --git a/src/VISU_I/VISU_ViewManager_i.cc b/src/VISU_I/VISU_ViewManager_i.cc index e4e7ed2e..6a3de0d8 100644 --- a/src/VISU_I/VISU_ViewManager_i.cc +++ b/src/VISU_I/VISU_ViewManager_i.cc @@ -732,121 +732,76 @@ namespace VISU{ } - void XYPlot_i::Display(PrsObject_ptr thePrsObj) { - if(MYDEBUG) MESSAGE("XYPlot_i::Display"); - Mutex mt(myMutex,qApp,MYDELAY); - CORBA::Object_ptr anObj = thePrsObj; - // is it Curve ? - if(Curve_i* aCurve = dynamic_cast(VISU::GetServant(anObj).in())) { - UpdatePlot2d(myView,eDisplay,aCurve); - } - // is it Container ? - if(Container_i* aContainer = dynamic_cast(VISU::GetServant(anObj).in())) { - int nbCurves = aContainer->GetNbCurves(); - for ( int i = 1; i <= nbCurves; i++ ) { - VISU::Curve_i* aCurve = aContainer->GetCurve( i ); - if ( aCurve && aCurve->IsValid() ) { - UpdatePlot2d(myView,eDisplay,aCurve); - } + class TXYPlotViewEvent: public SALOME_Event{ + QAD_Study* myStudy; + Plot2d_ViewFrame* myView; + PrsObject_ptr myPrsObj; + int myDisplaing; + public: + TXYPlotViewEvent(QAD_Study* theStudy, + Plot2d_ViewFrame* theView, + PrsObject_ptr thePrsObj, + int theDisplaing): + myStudy(theStudy), + myView(theView), + myPrsObj(thePrsObj), + myDisplaing(theDisplaing) + {} + virtual bool Execute(){ + // is it Curve ? + if(Curve_i* aCurve = dynamic_cast(VISU::GetServant(myPrsObj).in())) { + UpdatePlot2d(myView,myDisplaing,aCurve); } - myView->Repaint(); - } - // is it Table ? - if(Table_i* aTable = dynamic_cast(VISU::GetServant(anObj).in())) { - SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() ); - if ( !TableSO->_is_nil() ) { - SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO ); - for ( ; Iter->More(); Iter->Next() ) { - CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() ); - if( !CORBA::is_nil( childObject ) ) { - CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject ); - if( !CORBA::is_nil( aCurve ) ) - UpdatePlot2d(myView,eDisplay,dynamic_cast( VISU::GetServant(aCurve).in())); + // is it Container ? + if(Container_i* aContainer = dynamic_cast(VISU::GetServant(myPrsObj).in())) { + int nbCurves = aContainer->GetNbCurves(); + for ( int i = 1; i <= nbCurves; i++ ) { + VISU::Curve_i* aCurve = aContainer->GetCurve( i ); + if ( aCurve && aCurve->IsValid() ) { + UpdatePlot2d(myView,myDisplaing,aCurve); } } myView->Repaint(); } - } - } - - - void XYPlot_i::Erase(PrsObject_ptr thePrsObj) { - if(MYDEBUG) MESSAGE("XYPlot_i::Erase"); - Mutex mt(myMutex,qApp,MYDELAY); - CORBA::Object_ptr anObj = thePrsObj; - // is it Curve ? - if(Curve_i* aCurve = dynamic_cast(VISU::GetServant(anObj).in())) { - UpdatePlot2d(myView,eErase,aCurve); - } - // is it Container ? - if(Container_i* aContainer = dynamic_cast(VISU::GetServant(anObj).in())) { - int nbCurves = aContainer->GetNbCurves(); - for ( int i = 1; i <= nbCurves; i++ ) { - VISU::Curve_i* aCurve = aContainer->GetCurve( i ); - if ( aCurve && aCurve->IsValid() ) { - UpdatePlot2d(myView,eErase,aCurve); - } - } - myView->Repaint(); - } - // is it Table ? - if(Table_i* aTable = dynamic_cast(VISU::GetServant(anObj).in())) { - SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() ); - if ( !TableSO->_is_nil() ) { - SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO ); + // is it Table ? + if(Table_i* aTable = dynamic_cast(VISU::GetServant(myPrsObj).in())) { + SALOMEDS::Study_var aStudy = myStudy->getStudyDocument(); + SALOMEDS::SObject_var TableSO = aStudy->FindObjectID( aTable->GetEntry() ); + if ( !TableSO->_is_nil() ) { + SALOMEDS::ChildIterator_var Iter = aStudy->NewChildIterator( TableSO ); for ( ; Iter->More(); Iter->Next() ) { - CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() ); - if( !CORBA::is_nil( childObject ) ) { - CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject ); - if( !CORBA::is_nil( aCurve ) ) - UpdatePlot2d(myView,eErase,dynamic_cast( VISU::GetServant(aCurve).in())); + CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() ); + if( !CORBA::is_nil( childObject ) ) { + CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject ); + if( !CORBA::is_nil( aCurve ) ) + UpdatePlot2d(myView,myDisplaing,dynamic_cast( VISU::GetServant(aCurve).in())); + } } + myView->Repaint(); } - myView->Repaint(); } + return true; } + }; + + + void XYPlot_i::Display(PrsObject_ptr thePrsObj) { + ProcessVoidEvent(new TXYPlotViewEvent(myStudy,myView,thePrsObj,eDisplay)); } - void XYPlot_i::EraseAll() { - ProcessVoidEvent(new TMemFunEvent(myView,&Plot2d_ViewFrame::EraseAll)); + + void XYPlot_i::Erase(PrsObject_ptr thePrsObj) { + ProcessVoidEvent(new TXYPlotViewEvent(myStudy,myView,thePrsObj,eErase)); } void XYPlot_i::DisplayOnly(PrsObject_ptr thePrsObj) { - if(MYDEBUG) MESSAGE("XYPlot_i::DisplayOnly"); - Mutex mt(myMutex,qApp,MYDELAY); - CORBA::Object_ptr anObj = thePrsObj; - // is it Curve ? - if(Curve_i* aCurve = dynamic_cast(VISU::GetServant(anObj).in())) { - UpdatePlot2d(myView,eDisplayOnly,aCurve); - } - // is it Container ? - if(Container_i* aContainer = dynamic_cast(VISU::GetServant(anObj).in())) { - int nbCurves = aContainer->GetNbCurves(); - for ( int i = 1; i <= nbCurves; i++ ) { - VISU::Curve_i* aCurve = aContainer->GetCurve( i ); - if ( aCurve && aCurve->IsValid() ) { - UpdatePlot2d(myView,eDisplayOnly,aCurve); - } - } - myView->Repaint(); - } - // is it Table ? - if(Table_i* aTable = dynamic_cast(VISU::GetServant(anObj).in())) { - SALOMEDS::SObject_var TableSO = myStudy->getStudyDocument()->FindObjectID( aTable->GetEntry() ); - if ( !TableSO->_is_nil() ) { - SALOMEDS::ChildIterator_var Iter = myStudy->getStudyDocument()->NewChildIterator( TableSO ); - for ( ; Iter->More(); Iter->Next() ) { - CORBA::Object_var childObject = VISU::SObjectToObject( Iter->Value() ); - if( !CORBA::is_nil( childObject ) ) { - CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject ); - if( !CORBA::is_nil( aCurve ) ) - UpdatePlot2d(myView,eDisplayOnly,dynamic_cast( VISU::GetServant(aCurve).in())); - } - } - myView->Repaint(); - } - } + ProcessVoidEvent(new TXYPlotViewEvent(myStudy,myView,thePrsObj,eDisplayOnly)); + } + + + void XYPlot_i::EraseAll() { + ProcessVoidEvent(new TMemFunEvent(myView,&Plot2d_ViewFrame::EraseAll)); } @@ -886,19 +841,28 @@ namespace VISU{ } return NULL; } + + + TableView_i::~TableView_i() { + if(MYDEBUG) MESSAGE("TableView_i::~TableView_i"); + delete myView; + } + + void TableView_i::SetTitle(const char* theTitle){ - myView->setCaption(theTitle); + ProcessVoidEvent(new TMemFun1ArgEvent + (myView,&SALOMEGUI_TableDlg::setCaption,QString(theTitle))); } + + char* TableView_i::GetTitle() { return CORBA::string_dup(myView->caption().latin1()); } + + void TableView_i::Close(){ myView->close(); } - TableView_i::~TableView_i() { - if(MYDEBUG) MESSAGE("TableView_i::~TableView_i"); - delete myView; - } //===========================================================================