]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Profile object creation. OCC viewer using instead of OCC widget.
authornds <nds@opencascade.com>
Mon, 2 Dec 2013 05:29:26 +0000 (05:29 +0000)
committernds <nds@opencascade.com>
Mon, 2 Dec 2013 05:29:26 +0000 (05:29 +0000)
src/HYDROGUI/HYDROGUI_ProfileDlg.cxx
src/HYDROGUI/HYDROGUI_ProfileDlg.h

index e6e24a486302691f93e9e895cabd9dc51d060ebe..8c691004167402773c43d4c38e485fc3c3be79c7 100644 (file)
 #include <CurveCreator_Widget.h>
 #include <CurveCreator_ICurve.hxx>
 
-#include <OCCViewer_ViewWidget.h>
 #include <OCCViewer_ViewPort3d.h>
 #include <OCCViewer_Utilities.h>
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewFrame.h>
+#include <LightApp_Application.h>
 
 #include <SUIT_Session.h>
 #include <SUIT_ResourceMgr.h>
@@ -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<QBoxLayout*>( myAddElementBox->layout() );
-  //anAddElementLayout->addWidget( theWidget );
-
-  //theWidget->show();
-  //myAddElementBox->show();
-}
-
-void HYDROGUI_ProfileDlg::processFinishedSubOperation( QWidget* theWidget )
-{
-  /*myEditorWidget->setEnabled( true );
-
-  QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( 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 )
index 388fc48df5ca9b2802a88226824731b4851b1eab..e2f1c5f30a2eee413141537222b126a715b70aa5 100644 (file)
 
 #include <AIS_InteractiveContext.hxx>
 
-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