TObject* myObject;
TAction myAction;
};
+ typedef TMemFunEvent<QAD_StudyFrame> TFrameActionEvent;
template<class TObject, typename TArg, typename TStoreArg = TArg, typename TResult = void>
};
+ template<class TObject, typename TArg, typename TArg1,
+ typename TStoreArg = TArg, typename TStoreArg1 = TArg1,
+ typename TResult = void>
+ class TMemFun2ArgEvent: public SALOME_Event{
+ public:
+ typedef TResult (TObject::* TAction)(TArg,TArg1);
+ TMemFun2ArgEvent(TObject* theObject, TAction theAction, TArg theArg, TArg1 theArg1):
+ myObject(theObject),
+ myAction(theAction),
+ myArg(theArg),
+ myArg1(theArg1)
+ {}
+ virtual bool Execute(){
+ (myObject->*myAction)(myArg,myArg1);
+ return true;
+ }
+ private:
+ TObject* myObject;
+ TAction myAction;
+ TStoreArg myArg;
+ TStoreArg1 myArg1;
+ };
+
+ template<class TObject>
+ class TSetBackgroundEvent: public SALOME_Event{
+ TObject* myView;
+ const SALOMEDS::Color& myColor;
+ public:
+ TSetBackgroundEvent(TObject* theView, const SALOMEDS::Color& theColor):
+ myView(theView), myColor(theColor)
+ {}
+ virtual bool Execute(){
+ int aColor[3];
+ aColor[0] = int(255.0*myColor.R);
+ aColor[1] = int(255.0*myColor.G);
+ aColor[2] = int(255.0*myColor.B);
+ QColor aNewColor(aColor[0],aColor[1],aColor[2]);
+ myView->setBackgroundColor(aNewColor);
+ return true;
+ }
+ };
+
+
+ void RepaintView(QAD_StudyFrame* theStudyFrame);
+ class TRepaintViewEvent: public SALOME_Event{
+ QAD_StudyFrame* myStudyFrame;
+ public:
+ TRepaintViewEvent(QAD_StudyFrame* theStudyFrame):
+ myStudyFrame(theStudyFrame)
+ {}
+ virtual bool Execute(){
+ RepaintView(myStudyFrame);
+ return true;
+ }
+ };
+
+
VTKViewer_ViewFrame* GetViewFrame(QAD_StudyFrame* theStudyFrame){
return dynamic_cast<VTKViewer_ViewFrame*>(theStudyFrame->getRightFrame()->getViewFrame());
}
}
- class TRepaintViewEvent: public SALOME_Event{
- QAD_StudyFrame* myStudyFrame;
- public:
- TRepaintViewEvent(QAD_StudyFrame* theStudyFrame):
- myStudyFrame(theStudyFrame)
- {}
- virtual bool Execute(){
- RepaintView(myStudyFrame);
- return true;
- }
- };
-
-
VISU_Actor* UpdateViewer(QAD_StudyFrame* theStudyFrame, int theDisplaing, Prs3d_i* thePrs){
VTKViewer_ViewFrame* vf = GetViewFrame(theStudyFrame);
if (!vf) return NULL;
const char* View_i::GetComment() const { return "";}
void View_i::ToStream(std::ostringstream& theStr) {}
- const char* View_i::GetEntry(){
+ string View_i::GetEntry(){
SALOMEDS::SObject_var aSObject = myStudy->getStudyDocument()->FindObjectIOR(GetID());
CORBA::String_var anEntry = aSObject->GetID();
- string aString(anEntry);
- if(MYDEBUG) MESSAGE("Result_i::GetEntry - "<<aString);
- return aString.c_str();
+ return string(anEntry.in());
}
+
+
//===========================================================================
XYPlot_i::XYPlot_i(SALOMEDS::Study_ptr theStudy) : View_i(theStudy) {
if(MYDEBUG) MESSAGE("XYPlot_i::XYPlot_i");
return CORBA::string_dup(myStudyFrame->title().latin1());
}
+
void XYPlot_i::SetSubTitle(const char* theTitle){
- class TEvent: public SALOME_Event{
- Plot2d_ViewFrame* myView;
- const char* myName;
- public:
- TEvent(Plot2d_ViewFrame* theView,
- const char* theName):
- myView(theView),
- myName(theName)
- {}
- virtual bool Execute(){
- myView->setTitle(myName);
- return true;
- }
- };
- ProcessVoidEvent(new TEvent(myView,theTitle));
+ ProcessVoidEvent(new TMemFun1ArgEvent<Plot2d_ViewFrame,const QString&,QString>
+ (myView,&Plot2d_ViewFrame::setTitle,QString(theTitle)));
}
char* XYPlot_i::GetSubTitle() {
return CORBA::string_dup(myView->getTitle());
}
+
void XYPlot_i::SetCurveType(VISU::XYPlot::CurveType theType){
- if(MYDEBUG) MESSAGE("XYPlot_i::SetCurveType");
- Mutex mt(myMutex,qApp,MYDELAY);
- myView->setCurveType(theType);
+ ProcessVoidEvent(new TMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
+ (myView,&Plot2d_ViewFrame::setCurveType,theType,true));
}
VISU::XYPlot::CurveType XYPlot_i::GetCurveType(){
- if(MYDEBUG) MESSAGE("XYPlot_i::GetCurveType");
- Mutex mt(myMutex,qApp);
return (VISU::XYPlot::CurveType)myView->getCurveType();
}
+
void XYPlot_i::SetMarkerSize(CORBA::Long theSize){
- if(MYDEBUG) MESSAGE("XYPlot_i::SetMarkerSize");
- Mutex mt(myMutex,qApp,MYDELAY);
- myView->setMarkerSize(theSize);
+ ProcessVoidEvent(new TMemFun2ArgEvent<Plot2d_ViewFrame,int,bool>
+ (myView,&Plot2d_ViewFrame::setMarkerSize,theSize,true));
}
CORBA::Long XYPlot_i::GetMarkerSize(){
- if(MYDEBUG) MESSAGE("XYPlot_i::GetMarkerSize");
- Mutex mt(myMutex,qApp);
return myView->getMarkerSize();
}
+
+ class TEnbleGridEvent: public SALOME_Event{
+ public:
+ typedef void (Plot2d_ViewFrame::* TFun)(bool, const int, bool, const int, bool = true);
+ TEnbleGridEvent(Plot2d_ViewFrame* theView, TFun theFun,
+ CORBA::Boolean theMajor, CORBA::Long theNumMajor,
+ CORBA::Boolean theMinor, CORBA::Long theNumMinor):
+ myView(theView), myFun(theFun),
+ myMajor(theMajor), myNumMajor(theNumMajor),
+ myMinor(theMinor), myNumMinor(theNumMinor)
+ {}
+ virtual bool Execute(){
+ (myView->*myFun)(myMajor,myNumMajor,myMinor,myNumMinor);
+ return true;
+ }
+ protected:
+ Plot2d_ViewFrame* myView;
+ TFun myFun;
+ CORBA::Boolean myMajor, myNumMajor;
+ CORBA::Boolean myMinor, myNumMinor;
+ };
+
+
void XYPlot_i::EnableXGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor){
- if(MYDEBUG) MESSAGE("XYPlot_i::EnableXGrid");
- Mutex mt(myMutex,qApp,MYDELAY);
- myView->setXGrid(theMajor,theNumMajor,theMinor,theNumMinor);
+ CORBA::Boolean theMinor, CORBA::Long theNumMinor)
+ {
+ ProcessVoidEvent(new TEnbleGridEvent(myView,&Plot2d_ViewFrame::setXGrid,
+ theMajor,theNumMajor,theMinor,theNumMinor));
}
void XYPlot_i::EnableYGrid(CORBA::Boolean theMajor, CORBA::Long theNumMajor,
- CORBA::Boolean theMinor, CORBA::Long theNumMinor){
- if(MYDEBUG) MESSAGE("XYPlot_i::EnableYGrid");
- Mutex mt(myMutex,qApp,MYDELAY);
- myView->setYGrid(theMajor,theNumMajor,theMinor,theNumMinor);
+ CORBA::Boolean theMinor, CORBA::Long theNumMinor)
+ {
+ ProcessVoidEvent(new TEnbleGridEvent(myView,&Plot2d_ViewFrame::setYGrid,
+ theMajor,theNumMajor,theMinor,theNumMinor));
}
+
+ class TSetScaleModeEvent: public SALOME_Event{
+ public:
+ typedef void (Plot2d_ViewFrame::* TFun)(const int, bool = true);
+ TSetScaleModeEvent(Plot2d_ViewFrame* theView, TFun theFun, int theScaling):
+ myView(theView), myFun(theFun), myScaling(theScaling)
+ {}
+ virtual bool Execute(){
+ (myView->*myFun)(myScaling);
+ return true;
+ }
+ protected:
+ Plot2d_ViewFrame* myView;
+ TFun myFun;
+ int myScaling;
+ };
+
+
void XYPlot_i::SetHorScaling(VISU::Scaling theScaling){
- if(MYDEBUG) MESSAGE("XYPlot_i::SetHorScaling");
- Mutex mt(myMutex,qApp,MYDELAY);
- if(theScaling == VISU::LOGARITHMIC)
- myView->setHorScaleMode(1);
- else
- myView->setHorScaleMode(0);
+ ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setHorScaleMode,
+ theScaling == VISU::LOGARITHMIC));
}
VISU::Scaling XYPlot_i::GetHorScaling(){
- if(MYDEBUG) MESSAGE("XYPlot_i::GetHorScaling");
- Mutex mt(myMutex,qApp,MYDELAY);
return (VISU::Scaling)myView->getHorScaleMode();
}
void XYPlot_i::SetVerScaling(VISU::Scaling theScaling){
- if(MYDEBUG) MESSAGE("XYPlot_i::SetVerScaling");
- Mutex mt(myMutex,qApp,MYDELAY);
- if(theScaling == VISU::LOGARITHMIC)
- myView->setVerScaleMode(1);
- else
- myView->setVerScaleMode(0);
+ ProcessVoidEvent(new TSetScaleModeEvent(myView,&Plot2d_ViewFrame::setVerScaleMode,
+ theScaling == VISU::LOGARITHMIC));
}
VISU::Scaling XYPlot_i::GetVerScaling(){
- if(MYDEBUG) MESSAGE("XYPlot_i::SetVerScaling");
- Mutex mt(myMutex,qApp);
return (VISU::Scaling)myView->getVerScaleMode();
}
+
+ class TSetTitleEvent: public SALOME_Event{
+ public:
+ typedef void (Plot2d_ViewFrame::* TFun)(bool, const QString&, bool = true);
+ TSetTitleEvent(Plot2d_ViewFrame* theView, TFun theFun, const char* theTitle):
+ myView(theView), myFun(theFun), myTitle(theTitle)
+ {}
+ virtual bool Execute(){
+ (myView->*myFun)(true,myTitle);
+ return true;
+ }
+ protected:
+ Plot2d_ViewFrame* myView;
+ TFun myFun;
+ const char* myTitle;
+ };
+
+
void XYPlot_i::SetXTitle(const char* theTitle){
- if(MYDEBUG) MESSAGE("XYPlot_i::SetXTitle");
- Mutex mt(myMutex,qApp,MYDELAY);
- myView->setXTitle(true,theTitle);
+ ProcessVoidEvent(new TSetTitleEvent(myView,&Plot2d_ViewFrame::setXTitle,theTitle));
}
char* XYPlot_i::GetXTitle() {
- if(MYDEBUG) MESSAGE("XYPlot_i::GetXTitle");
- Mutex mt(myMutex,qApp);
return CORBA::string_dup(myView->getXTitle());
}
void XYPlot_i::SetYTitle(const char* theTitle){
- if(MYDEBUG) MESSAGE("XYPlot_i::SetYTitle");
- Mutex mt(myMutex,qApp,MYDELAY);
- myView->setYTitle(true,theTitle);
+ ProcessVoidEvent(new TSetTitleEvent(myView,&Plot2d_ViewFrame::setYTitle,theTitle));
}
char* XYPlot_i::GetYTitle() {
- if(MYDEBUG) MESSAGE("XYPlot_i::GetYTitle");
- Mutex mt(myMutex,qApp);
return CORBA::string_dup(myView->getYTitle());
}
void XYPlot_i::ShowLegend(CORBA::Boolean theShowing){
- if(MYDEBUG) MESSAGE("XYPlot_i::ShowLegend");
- Mutex mt(myMutex,qApp,MYDELAY);
- myView->showLegend(theShowing);
+ ProcessVoidEvent(new TMemFun2ArgEvent<Plot2d_ViewFrame,bool,bool>
+ (myView,&Plot2d_ViewFrame::showLegend,theShowing,true));
}
void XYPlot_i::SetBackground(const SALOMEDS::Color& theColor){
- if(MYDEBUG) MESSAGE("XYPlot_i::SetBackground");
- Mutex mt(myMutex,qApp,MYDELAY);
- int aColor[3];
- aColor[0] = (int)(255.0*theColor.R);
- aColor[1] = (int)(255.0*theColor.G);
- aColor[2] = (int)(255.0*theColor.B);
- QColor aNewColor(aColor[0],aColor[1],aColor[2]);
- myView->setBackgroundColor(aNewColor);
+ ProcessVoidEvent(new TSetBackgroundEvent<Plot2d_ViewFrame>(myView,theColor));
}
SALOMEDS::Color XYPlot_i::GetBackground() {
- if(MYDEBUG) MESSAGE("XYPlot_i::GetBackground");
- Mutex mt(myMutex,qApp);
SALOMEDS::Color aColor;
aColor.R = myView->backgroundColor().red()/255.0;
aColor.G = myView->backgroundColor().green()/255.0;
return aColor;
}
void XYPlot_i::Minimize() {
- if(MYDEBUG) MESSAGE("XYPlot_i::Minimize");
- Mutex mt(myMutex,qApp,MYDELAY);
- myStudyFrame->showMinimized();
+ ProcessVoidEvent(new TFrameActionEvent(myStudyFrame,&QAD_StudyFrame::showMinimized));
}
void XYPlot_i::Restore() {
- if(MYDEBUG) MESSAGE("XYPlot_i::Restore");
- Mutex mt(myMutex,qApp,MYDELAY);
- myStudyFrame->showNormal();
+ ProcessVoidEvent(new TFrameActionEvent(myStudyFrame, &QAD_StudyFrame::showNormal));
}
void XYPlot_i::Maximize() {
- if(MYDEBUG) MESSAGE("XYPlot_i::Maximize");
- Mutex mt(myMutex,qApp,MYDELAY);
- myStudyFrame->showMaximized();
+ ProcessVoidEvent(new TFrameActionEvent(myStudyFrame, &QAD_StudyFrame::showMaximized));
}
void XYPlot_i::Display(PrsObject_ptr thePrsObj) {
if(MYDEBUG) MESSAGE("XYPlot_i::Display");
SALOMEGUI_TableDlg::ttAuto,
Qt::Vertical);
myView->show();
- myName = myView->caption().latin1();
return this;
}
}
return NULL;
}
void TableView_i::SetTitle(const char* theTitle){
- if(MYDEBUG) MESSAGE("TableView_i::SetTitle");
- Mutex mt(myMutex,qApp,MYDELAY);
- myName = theTitle;
- myView->setCaption(myName.c_str());
+ myView->setCaption(theTitle);
}
char* TableView_i::GetTitle() {
- if(MYDEBUG) MESSAGE("TableView_i::GetTitle");
- Mutex mt(myMutex,qApp);
- myName = (myView->caption()).latin1();
- return CORBA::string_dup(myName.c_str());
+ return CORBA::string_dup(myView->caption().latin1());
}
void TableView_i::Close(){
- if(MYDEBUG) MESSAGE("TableView_i::Close");
- Mutex mt(myMutex,qApp,MYDELAY);
myView->close();
}
TableView_i::~TableView_i() {
if(MYDEBUG) MESSAGE("TableView_i::~TableView_i");
- Mutex mt(myMutex,qApp,MYDELAY);
- Close();
delete myView;
}
//===========================================================================
return true;
}
};
- if(MYDEBUG) MESSAGE("View3D_i::Update");
- myName = myStudyFrame->title().latin1();
ProcessVoidEvent(new TEvent(myStudyFrame));
}
}
}
};
- if(MYDEBUG) MESSAGE("View3D_i::SavePicture");
if (!myStudyFrame->getRightFrame()->getViewFrame()->getViewWidget())
return false;
TEvent* ve = new TEvent(myStudyFrame,theFileName);
return true;
}
CORBA::Boolean View3D_i::SaveViewParams(const char* theName){
- if(MYDEBUG) MESSAGE("View3D_i::SaveViewPoint");
return SaveViewParams(myStudyFrame,theName);
}
typedef CORBA::Boolean TResult;
TResult myResult;
};
- if(MYDEBUG) MESSAGE("View3D_i::RestoreViewParams - "<<theName);
TEvent* ve = new TEvent(myStudyFrame,theName);
ve->process();
TEvent::TResult aResult = ve->myResult;
GetViewFrame(theStudyFrame)->setBackgroundColor(aNewColor);
}
void View3D_i::SetBackground(const SALOMEDS::Color& theColor) {
- class TEvent: public SALOME_Event{
- QAD_StudyFrame* myStudyFrame;
- const SALOMEDS::Color& myColor;
- public:
- TEvent(QAD_StudyFrame* theStudyFrame,
- const SALOMEDS::Color& theColor):
- myStudyFrame(theStudyFrame),
- myColor(theColor)
- {}
- virtual bool Execute(){
- SetBackground(myStudyFrame,myColor);
- return true;
- }
- };
- if(MYDEBUG) MESSAGE("View3D_i::SetBackground");
- ProcessVoidEvent(new TEvent(myStudyFrame,theColor));
+ ProcessVoidEvent(new TSetBackgroundEvent<VTKViewer_ViewFrame>(GetViewFrame(myStudyFrame),theColor));
}
return aColor;
}
SALOMEDS::Color View3D_i::GetBackground() {
- if(MYDEBUG) MESSAGE("View3D_i::GetBackground");
return GetBackground(myStudyFrame);
}
- typedef TMemFunEvent<QAD_StudyFrame> TFrameActionEvent;
void View3D_i::Minimize() {
ProcessVoidEvent(new TFrameActionEvent(myStudyFrame,&QAD_StudyFrame::showMinimized));
}