}
- 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<Curve_i*>(VISU::GetServant(anObj).in())) {
- UpdatePlot2d(myView,eDisplay,aCurve);
- }
- // is it Container ?
- if(Container_i* aContainer = dynamic_cast<Container_i*>(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<Curve_i*>(VISU::GetServant(myPrsObj).in())) {
+ UpdatePlot2d(myView,myDisplaing,aCurve);
}
- myView->Repaint();
- }
- // is it Table ?
- if(Table_i* aTable = dynamic_cast<Table_i*>(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::Curve_i*>( VISU::GetServant(aCurve).in()));
+ // is it Container ?
+ if(Container_i* aContainer = dynamic_cast<Container_i*>(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<Curve_i*>(VISU::GetServant(anObj).in())) {
- UpdatePlot2d(myView,eErase,aCurve);
- }
- // is it Container ?
- if(Container_i* aContainer = dynamic_cast<Container_i*>(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<Table_i*>(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<Table_i*>(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::Curve_i*>( 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::Curve_i*>( 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<Plot2d_ViewFrame>(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<Curve_i*>(VISU::GetServant(anObj).in())) {
- UpdatePlot2d(myView,eDisplayOnly,aCurve);
- }
- // is it Container ?
- if(Container_i* aContainer = dynamic_cast<Container_i*>(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<Table_i*>(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::Curve_i*>( VISU::GetServant(aCurve).in()));
- }
- }
- myView->Repaint();
- }
- }
+ ProcessVoidEvent(new TXYPlotViewEvent(myStudy,myView,thePrsObj,eDisplayOnly));
+ }
+
+
+ void XYPlot_i::EraseAll() {
+ ProcessVoidEvent(new TMemFunEvent<Plot2d_ViewFrame>(myView,&Plot2d_ViewFrame::EraseAll));
}
}
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<SALOMEGUI_TableDlg,const QString&,QString>
+ (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;
- }
//===========================================================================