+ QString myEntry;
+ bool myRecursive;
+ TGetChildrenEvent( const QString& entry, const bool recursive )
+ : myEntry( entry ),
+ myRecursive( recursive ) {}
+ virtual void Execute()
+ {
+ SALOME_PYQT_ModuleLight* module = dynamic_cast<SALOME_PYQT_ModuleLight*>( getActiveModule() );
+ if ( module ) {
+ myResult = module->getChildren( myEntry, myRecursive );
+ }
+ else {
+ if ( verbose() ) printf( "SalomePyQt.getChildren() function is not supported for the current module.\n" );
+ }
+ }
+};
+QStringList SalomePyQt::getChildren( const QString& entry, const bool recursive )
+{
+ return ProcessEvent( new TGetChildrenEvent( entry, recursive ) );
+}
+
+#ifndef DISABLE_PLOT2DVIEWER
+// Next set of methods relates to the Plot2d viewer functionality
+
+/*!
+ \fn void SalomePyQt::displayCurve( const int id, Plot2d_Curve* theCurve )
+ \brief Display theCurve in view
+ \param id window identifier
+ \param theCurve curve to display
+*/
+
+class TDisplayCurve: public SALOME_Event
+{
+public:
+ int myWndId;
+ Plot2d_Curve* myCurve;
+ TDisplayCurve( const int id, Plot2d_Curve* theCurve ) : myWndId( id ), myCurve( theCurve ) {}
+ virtual void Execute() {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>( getWnd( myWndId ) );
+ if ( wnd )
+ wnd->getViewFrame()->displayCurve( myCurve );
+ }
+};
+void SalomePyQt::displayCurve( const int id, Plot2d_Curve* theCurve )
+{
+ ProcessVoidEvent( new TDisplayCurve( id, theCurve ) );
+}
+
+/*!
+ \fn void SalomePyQt::eraseCurve( const int id, Plot2d_Curve* theCurve )
+ \brief Erase theCurve in view
+ \param id window identifier
+ \param theCurve curve to erase
+*/
+
+class TEraseCurve: public SALOME_Event
+{
+public:
+ int myWndId;
+ Plot2d_Curve* myCurve;
+ TEraseCurve( const int id, Plot2d_Curve* theCurve ) : myWndId( id ), myCurve( theCurve ) {}
+ virtual void Execute() {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>( getWnd( myWndId ) );
+ wnd->getViewFrame()->eraseCurve( myCurve );
+ }
+};
+void SalomePyQt::eraseCurve( const int id, Plot2d_Curve* theCurve )
+{
+ ProcessVoidEvent( new TEraseCurve( id, theCurve ) );
+}
+
+/*!
+ \fn void SalomePyQt::deleteCurve( Plot2d_Curve* theCurve )
+ \brief Delete theCurve from all views
+ \param theCurve curve to delete
+*/
+
+class TDeleteCurve: public SALOME_Event
+{
+public:
+ Plot2d_Curve* myCurve;
+ TDeleteCurve( Plot2d_Curve* theCurve ) : myCurve( theCurve ) {}
+ virtual void Execute() {
+ LightApp_Application* app = getApplication();
+ if ( app ) {
+ STD_TabDesktop* tabDesk = dynamic_cast<STD_TabDesktop*>( app->desktop() );
+ if ( tabDesk ) {
+ QList<SUIT_ViewWindow*> wndlist = tabDesk->windows();
+ SUIT_ViewWindow* wnd;
+ foreach ( wnd, wndlist ) {
+ Plot2d_ViewWindow* aP2d = dynamic_cast<Plot2d_ViewWindow*>( wnd );
+ if ( aP2d )
+ aP2d->getViewFrame()->eraseObject( myCurve );
+ }
+ }
+ }
+ }
+};
+void SalomePyQt::eraseCurve( Plot2d_Curve* theCurve )
+{
+ ProcessVoidEvent( new TDeleteCurve( theCurve ) );
+}
+
+/*!
+ \brief updateCurves (repaint) curves in view window.
+*/
+void SalomePyQt::updateCurves( const int id )
+{
+ class TEvent: public SALOME_Event
+ {
+ public:
+ int myWndId;
+ TEvent( const int id ) : myWndId( id ) {}
+ virtual void Execute()
+ {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>( getWnd( myWndId ) );
+ if ( wnd )
+ wnd->getViewFrame()->DisplayAll();
+ }
+ };
+ ProcessVoidEvent( new TEvent( id ) );
+}
+
+/*!
+ \fn QString SalomePyQt::getPlot2dTitle( const int id, ObjectType type = MainTitle )
+ \brief Get title of corresponding type
+ \param id window identifier
+ \param type is type of title
+ \return title of corresponding type
+*/
+
+class TGetPlot2dTitle: public SALOME_Event
+{
+public:
+ typedef QString TResult;
+ TResult myResult;
+ int myWndId;
+ ObjectType myType;
+ TGetPlot2dTitle(const int id, ObjectType type) :
+ myWndId( id ),
+ myType( type ) {}
+ virtual void Execute() {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>( getWnd( myWndId ) );
+ if ( wnd )
+ myResult = wnd->getViewFrame()->getTitle( (Plot2d_ViewFrame::ObjectType)myType );
+ }
+};
+QString SalomePyQt::getPlot2dTitle( const int id, ObjectType type )
+{
+ return ProcessEvent( new TGetPlot2dTitle( id, type ) );
+}
+
+
+/*!
+ \fn void SalomePyQt::setPlot2dTitle( const int id, const QString& title, ObjectType type = MainTitle, bool show = true )
+ \brief Set title of corresponding type
+ \param id window identifier
+ \param title
+ \param type is type of title
+ \param show
+*/
+
+class TSetPlot2dTitle: public SALOME_Event
+{
+public:
+ int myWndId;
+ Plot2d_Curve* myCurve;
+ QString myTitle;
+ ObjectType myType;
+ bool myShow;
+ TSetPlot2dTitle( const int id, const QString& title, ObjectType type, bool show ) :
+ myWndId( id ),
+ myTitle( title ),
+ myType( type ),
+ myShow( show ) {}
+ virtual void Execute() {
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>( getWnd( myWndId ) );
+ wnd->getViewFrame()->setTitle( myShow, myTitle, (Plot2d_ViewFrame::ObjectType)myType, false );
+ }
+};
+void SalomePyQt::setPlot2dTitle( const int id, const QString& title, ObjectType type, bool show )
+{
+ ProcessVoidEvent( new TSetPlot2dTitle( id, title, type, show ) );
+}
+
+/*!
+ \fn QList<int> SalomePyQt::getPlot2dFitRangeByCurves( const int id )
+ \brief Get list of Plot2d view ranges
+ \param id window identifier
+ \return list of view ranges (XMin, XMax, YMin, YMax)
+*/
+
+class TFitRangeByCurves: public SALOME_Event
+{
+public:
+ typedef QList<double> TResult;
+ TResult myResult;
+ int myWndId;
+ TFitRangeByCurves( const int id )
+ : myWndId( id ) {}
+ virtual void Execute()
+ {
+ myResult.clear();
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>( getWnd( myWndId ) );
+ if ( wnd ) {
+ double XMin, XMax, YMin, YMax, Y2Min, Y2Max;
+ wnd->getViewFrame()->getFitRangeByCurves( XMin, XMax, YMin, YMax, Y2Min, Y2Max );
+ myResult.append( XMin );
+ myResult.append( XMax );
+ myResult.append( YMin );
+ myResult.append( YMax );
+ }
+ }
+};
+QList<double> SalomePyQt::getPlot2dFitRangeByCurves( const int id )
+{
+ return ProcessEvent( new TFitRangeByCurves( id ) );
+}
+
+/*!
+ \fn QList<int> SalomePyQt::getPlot2dFitRangeCurrent( const int id )
+ \brief Get list of current Plot2d view ranges
+ \param id window identifier
+ \return list of view ranges (XMin, XMax, YMin, YMax)
+*/
+
+class TFitRangeCurrent: public SALOME_Event
+{
+public:
+ typedef QList<double> TResult;
+ TResult myResult;
+ int myWndId;
+ TFitRangeCurrent( const int id )
+ : myWndId( id ) {}
+ virtual void Execute()
+ {
+ myResult.clear();
+ Plot2d_ViewWindow* wnd = dynamic_cast<Plot2d_ViewWindow*>( getWnd( myWndId ) );
+ if ( wnd ) {
+ double XMin, XMax, YMin, YMax, Y2Min, Y2Max;
+ wnd->getViewFrame()->getFitRanges( XMin, XMax, YMin, YMax, Y2Min, Y2Max );
+ myResult.append( XMin );
+ myResult.append( XMax );
+ myResult.append( YMin );
+ myResult.append( YMax );
+ }
+ }
+};
+QList<double> SalomePyQt::getPlot2dFitRangeCurrent( const int id )
+{
+ return ProcessEvent( new TFitRangeCurrent( id ) );
+}
+
+/*!
+ \fn void SalomePyQt::setPlot2dFitRange( const int id, const double XMin, const double XMax, const double YMin, const double YMax )
+ \brief Set range of Plot2d view
+ \param id window identifier
+ \param XMin
+ \param XMax
+ \param YMin
+ \param YMax
+*/
+
+class TPlot2dFitRange: public SALOME_Event
+{
+public:
+ int myWndId;
+ double myXMin;
+ double myXMax;
+ double myYMin;
+ double myYMax;
+ TPlot2dFitRange( const int id, const double XMin, const double XMax, const double YMin, const double YMax ) :
+ myWndId( id ),
+ myXMin( XMin ),
+ myXMax( XMax ),
+ myYMin( YMin ),
+ myYMax( YMax ) {}