}
- VISU::View_ptr ViewManager_i::GetCurrentView(){
- class TEvent: public SALOME_Event{
- SALOMEDS::Study_ptr myStudyDocument;
- public:
- TEvent( SALOMEDS::Study_ptr theStudy):
- myStudyDocument(theStudy)
- {}
- virtual void Execute(){
- if(QAD_Study* aStudy = QAD_Application::getDesktop()->findStudy( myStudyDocument )){
- if ( QAD_StudyFrame* aStudyFrame = aStudy->getActiveStudyFrame() ) {
- if(MYDEBUG)
- MESSAGE("GetCurrentView::Execute - TypeView = "<<aStudyFrame->getTypeView());
- if ( aStudyFrame->getTypeView() == VIEW_VTK ) {
- VISU::View3D_i* pView = new View3D_i(myStudyDocument);
- if(pView->Create(0))
- myResult = pView->_this();
- } else if ( aStudyFrame->getTypeView() == VIEW_PLOT2D ) {
- VISU::XYPlot_i* pView = new XYPlot_i(myStudyDocument);
- if(pView->Create(0))
- myResult = pView->_this();
- }
+ class TGetCurrentViewEvent: public SALOME_Event{
+ SALOMEDS::Study_ptr myStudyDocument;
+ public:
+ TGetCurrentViewEvent( SALOMEDS::Study_ptr theStudy):
+ myStudyDocument(theStudy),
+ myResult(VISU::View::_nil())
+ {}
+ virtual void Execute(){
+ if(QAD_Study* aStudy = QAD_Application::getDesktop()->findStudy( myStudyDocument )){
+ if ( QAD_StudyFrame* aStudyFrame = aStudy->getActiveStudyFrame() ) {
+ if(MYDEBUG)
+ MESSAGE("GetCurrentView::Execute - TypeView = "<<aStudyFrame->getTypeView());
+ if ( aStudyFrame->getTypeView() == VIEW_VTK ) {
+ VISU::View3D_i* pView = new View3D_i(myStudyDocument);
+ if(pView->Create(0))
+ myResult = pView->_this();
+ } else if ( aStudyFrame->getTypeView() == VIEW_PLOT2D ) {
+ VISU::XYPlot_i* pView = new XYPlot_i(myStudyDocument);
+ if(pView->Create(0))
+ myResult = pView->_this();
}
}
}
- typedef VISU::View_var TResult;
- TResult myResult;
- };
- TEvent* ve = new TEvent( myStudyDocument );
- ve->process();
- TEvent::TResult aResult = ve->myResult;
- ve->release();
- return aResult._retn();
+ }
+ typedef VISU::View_ptr TResult;
+ TResult myResult;
+ };
+
+ VISU::View_ptr ViewManager_i::GetCurrentView(){
+ return ProcessEvent(new TGetCurrentViewEvent( myStudyDocument ));
}
}
- VISU::TableView_ptr ViewManager_i::CreateTableView(VISU::Table_ptr theTable){
- class TEvent: public TCreateViewEvent{
- Table_ptr myTable;
- public:
- TEvent(SALOMEDS::Study_ptr theStudy,
- Table_ptr theTable):
- TCreateViewEvent(theStudy),
- myTable(theTable)
- {}
- virtual void Execute(){
- if ( CheckStudy( myStudyDocument ) ) {
- VISU::TableView_i* pView = new TableView_i(myStudyDocument);
- if(pView->Create(myTable) != NULL)
- myResult = pView->_this();
- }
+ class TCreateTableViewEvent: public TCreateViewEvent{
+ Table_ptr myTable;
+ public:
+ TCreateTableViewEvent(SALOMEDS::Study_ptr theStudy,
+ Table_ptr theTable):
+ TCreateViewEvent(theStudy),
+ myTable(theTable),
+ myResult(VISU::TableView::_nil())
+ {}
+ virtual void Execute(){
+ if ( CheckStudy( myStudyDocument ) ) {
+ VISU::TableView_i* pView = new TableView_i(myStudyDocument);
+ if(pView->Create(myTable) != NULL)
+ myResult = pView->_this();
}
- typedef VISU::TableView_var TResult;
- TResult myResult;
- };
+ }
+ typedef VISU::TableView_ptr TResult;
+ TResult myResult;
+ };
+
+ VISU::TableView_ptr ViewManager_i::CreateTableView(VISU::Table_ptr theTable){
if(MYDEBUG) MESSAGE("ViewManager_i::CreateTableView");
- TEvent* ve = new TEvent(myStudyDocument,theTable);
- ve->process();
- TEvent::TResult aResult = ve->myResult;
- ve->release();
- return aResult._retn();
+ return ProcessEvent(new TCreateTableViewEvent(myStudyDocument,theTable));
}
CORBA::Boolean XYPlot_i::SavePicture(const char* theFileName) {
- TSavePictureEvent* ve = new TSavePictureEvent(myView->getViewWidget(),theFileName);
- ve->process();
- TSavePictureEvent::TResult aResult = ve->myResult;
- ve->release();
- return aResult;
+ return ProcessEvent(new TSavePictureEvent(myView->getViewWidget(),theFileName));
}
CORBA::Boolean View3D_i::SavePicture(const char* theFileName) {
- TSavePictureEvent* ve = new TSavePictureEvent(myStudyFrame->getRightFrame()->getViewFrame()->getViewWidget(),theFileName);
- ve->process();
- TSavePictureEvent::TResult aResult = ve->myResult;
- ve->release();
- return aResult;
+ return ProcessEvent(new TSavePictureEvent(myStudyFrame->getRightFrame()->getViewFrame()->getViewWidget(),theFileName));
}
}
+ class TRestoreViewParamsEvent: public SALOME_Event{
+ QAD_StudyFrame* myStudyFrame;
+ const char* myName;
+ public:
+ TRestoreViewParamsEvent(QAD_StudyFrame* theStudyFrame,
+ const char* theName):
+ myStudyFrame(theStudyFrame),
+ myName(theName)
+ {}
+ virtual void Execute(){
+ myResult = View3D_i::RestoreViewParams(myStudyFrame,myName);
+ }
+ typedef CORBA::Boolean TResult;
+ TResult myResult;
+ };
+
CORBA::Boolean View3D_i::RestoreViewParams(const char* theName){
- class TEvent: public SALOME_Event{
- QAD_StudyFrame* myStudyFrame;
- const char* myName;
- public:
- TEvent(QAD_StudyFrame* theStudyFrame,
- const char* theName):
- myStudyFrame(theStudyFrame),
- myName(theName)
- {}
- virtual void Execute(){
- myResult = RestoreViewParams(myStudyFrame,myName);
- }
- typedef CORBA::Boolean TResult;
- TResult myResult;
- };
- TEvent* ve = new TEvent(myStudyFrame,theName);
- ve->process();
- TEvent::TResult aResult = ve->myResult;
- ve->release();
- return aResult;
+ return ProcessEvent(new TRestoreViewParamsEvent(myStudyFrame,theName));
}
};
void VISU_Gen_i::CreateTestView() {
- TestViewEvent* ve = new TestViewEvent();
- ve->process();
- ve->release();
+ ProcessVoidEvent(new TestViewEvent());
}
};
void VISU_Gen_i::ShowTestObject() {
- TestObjectEvent* ve = new TestObjectEvent();
- ve->process();
- ve->release();
- return;
+ ProcessVoidEvent(new TestObjectEvent());
}
/*! SAN & VSR : Test QT_EVENT
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<