From: nds Date: Mon, 2 Dec 2013 05:29:26 +0000 (+0000) Subject: Profile object creation. OCC viewer using instead of OCC widget. X-Git-Tag: BR_hydro_v_0_4~118 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b3903f48488439547ebef768281eb171ef032bf2;p=modules%2Fhydro.git Profile object creation. OCC viewer using instead of OCC widget. --- diff --git a/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx b/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx index e6e24a48..8c691004 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx @@ -26,9 +26,11 @@ #include #include -#include #include #include +#include +#include +#include #include #include @@ -52,57 +54,40 @@ HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QStr myEditorWidget = new CurveCreator_Widget( this, NULL ); addWidget( myEditorWidget, 3 ); - myViewWidget = new OCCViewer_ViewWidget( this, false ); - OCCViewer_ViewPort3d* aViewPort = myViewWidget->getViewPort(); - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - if ( aResMgr ) - aViewPort->setBackground( aResMgr->backgroundValue( "OCCViewer", "background", - Qtx::BackgroundData( Qt::black ) ) ); - OCCViewer_Utilities::setViewWidget2DMode( myViewWidget, OCCViewer_ViewWidget::XZPlane ); - addWidget( myViewWidget, 4 ); - - //myAddElementBox = new QGroupBox( tr( "ADD_ELEMENT" ), this ); - //addWidget( myAddElementBox, 2 ); + OCCViewer_ViewManager* aViewMgr = new OCCViewer_ViewManager( theModule->getApp()->activeStudy(), 0 ); + myViewer = new OCCViewer_Viewer( true ); - //QBoxLayout* anAddElementLayout = new QVBoxLayout( myAddElementBox ); - //anAddElementLayout->setMargin( 0 ); - //anAddElementLayout->setSpacing( 5 ); + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + myViewer->setBackground( OCCViewer_ViewFrame::TOP_LEFT, + aResMgr->backgroundValue( "OCCViewer", "xz_background", myViewer->background(OCCViewer_ViewFrame::TOP_LEFT) ) ); + myViewer->setBackground( OCCViewer_ViewFrame::TOP_RIGHT, + aResMgr->backgroundValue( "OCCViewer", "yz_background", myViewer->background(OCCViewer_ViewFrame::TOP_RIGHT) ) ); + myViewer->setBackground( OCCViewer_ViewFrame::BOTTOM_LEFT, + aResMgr->backgroundValue( "OCCViewer", "xy_background", myViewer->background(OCCViewer_ViewFrame::BOTTOM_LEFT) ) ); + myViewer->setBackground( OCCViewer_ViewFrame::BOTTOM_RIGHT, + aResMgr->backgroundValue( "OCCViewer", "background", myViewer->background(OCCViewer_ViewFrame::MAIN_VIEW) ) ); + + myViewer->setTrihedronSize( aResMgr->doubleValue( "3DViewer", "trihedron_size", myViewer->trihedronSize() ), + aResMgr->booleanValue( "3DViewer", "relative_size", myViewer->trihedronRelative() )); + myViewer->setInteractionStyle( aResMgr->integerValue( "3DViewer", "navigation_mode", myViewer->interactionStyle() ) ); + myViewer->setZoomingStyle( aResMgr->integerValue( "3DViewer", "zooming_mode", myViewer->zoomingStyle() ) ); + myViewer->enablePreselection( aResMgr->booleanValue( "OCCViewer", "enable_preselection", myViewer->isPreselectionEnabled() ) ); + myViewer->enableSelection( aResMgr->booleanValue( "OCCViewer", "enable_selection", myViewer->isSelectionEnabled() ) ); + + aViewMgr->setViewModel( myViewer );// custom view model, which extends SALOME_View interface + SUIT_ViewWindow* aViewWin = aViewMgr->createViewWindow(); + addWidget( aViewWin, 4 ); + myEditorWidget->setOCCViewer( myViewer ); connect( myEditorWidget, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*) ), this, SLOT( processStartedSubOperation(QWidget*) ) ); connect( myEditorWidget, SIGNAL( subOperationFinished(QWidget*) ), this, SLOT( processFinishedSubOperation(QWidget*) ) ); - - //myAddElementBox->hide(); - - myEditorWidget->setOCCViewWidget( myViewWidget ); } HYDROGUI_ProfileDlg::~HYDROGUI_ProfileDlg() { } -void HYDROGUI_ProfileDlg::processStartedSubOperation( QWidget* theWidget ) -{ - //myEditorWidget->setEnabled( false ); - - //QBoxLayout* anAddElementLayout = dynamic_cast( myAddElementBox->layout() ); - //anAddElementLayout->addWidget( theWidget ); - - //theWidget->show(); - //myAddElementBox->show(); -} - -void HYDROGUI_ProfileDlg::processFinishedSubOperation( QWidget* theWidget ) -{ - /*myEditorWidget->setEnabled( true ); - - QBoxLayout* anAddElementLayout = dynamic_cast( myAddElementBox->layout() ); - anAddElementLayout->removeWidget( theWidget ); - - theWidget->hide(); - myAddElementBox->hide();*/ -} - void HYDROGUI_ProfileDlg::reset() { myEditorWidget->reset(); @@ -110,7 +95,7 @@ void HYDROGUI_ProfileDlg::reset() Handle(AIS_InteractiveContext) HYDROGUI_ProfileDlg::getAISContext() { - return myViewWidget->getAISContext(); + return myViewer->getAISContext(); } void HYDROGUI_ProfileDlg::setProfileName( const QString& theName ) diff --git a/src/HYDROGUI/HYDROGUI_ProfileDlg.h b/src/HYDROGUI/HYDROGUI_ProfileDlg.h index 388fc48d..e2f1c5f3 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileDlg.h +++ b/src/HYDROGUI/HYDROGUI_ProfileDlg.h @@ -27,10 +27,8 @@ #include -class QGroupBox; class QLineEdit; class CurveCreator_Widget; -class OCCViewer_ViewWidget; class CurveCreator_ICurve; class OCCViewer_Viewer; @@ -57,9 +55,6 @@ public: void deleteSelected(); bool deleteEnabled(); -protected slots: - void processStartedSubOperation( QWidget* ); - void processFinishedSubOperation( QWidget* ); signals: void createPreview( QString ); void selectionChanged(); @@ -69,8 +64,7 @@ signals: private: QLineEdit* myName; CurveCreator_Widget* myEditorWidget; - //QGroupBox* myAddElementBox; - OCCViewer_ViewWidget* myViewWidget; + OCCViewer_Viewer* myViewer; }; #endif