Salome HOME
Profile object creation.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ProfileDlg.cxx
index 25c2deaa39fb51ed745782cdba6730d181aae4c7..e6e24a486302691f93e9e895cabd9dc51d060ebe 100644 (file)
 #include <CurveCreator_Widget.h>
 #include <CurveCreator_ICurve.hxx>
 
-#include <OCCViewer_ViewModel.h>
+#include <OCCViewer_ViewWidget.h>
+#include <OCCViewer_ViewPort3d.h>
+#include <OCCViewer_Utilities.h>
+
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
 
 #include <QGroupBox>
 #include <QHBoxLayout>
@@ -47,53 +52,65 @@ HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QStr
   myEditorWidget = new CurveCreator_Widget( this, NULL );
   addWidget( myEditorWidget, 3 );
 
-  myAddElementBox = new QGroupBox( tr( "ADD_ELEMENT" ), this );
-  addWidget( myAddElementBox, 2 );
+  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 );
 
-  QBoxLayout* anAddElementLayout = new QVBoxLayout( myAddElementBox );
-  anAddElementLayout->setMargin( 0 );
-  anAddElementLayout->setSpacing( 5 );
+  //QBoxLayout* anAddElementLayout = new QVBoxLayout( myAddElementBox );
+  //anAddElementLayout->setMargin( 0 );
+  //anAddElementLayout->setSpacing( 5 );
 
   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();
-}
+  //myAddElementBox->hide();
 
-HYDROGUI_ProfileDlg::~HYDROGUI_ProfileDlg()
-{
+  myEditorWidget->setOCCViewWidget( myViewWidget );
 }
 
-void HYDROGUI_ProfileDlg::setOCCViewer( OCCViewer_Viewer* theViewer )
+HYDROGUI_ProfileDlg::~HYDROGUI_ProfileDlg()
 {
-  myEditorWidget->setOCCViewer( theViewer );
 }
 
 void HYDROGUI_ProfileDlg::processStartedSubOperation( QWidget* theWidget )
 {
-  myEditorWidget->setEnabled( false );
+  //myEditorWidget->setEnabled( false );
 
-  QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
-  anAddElementLayout->addWidget( theWidget );
+  //QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
+  //anAddElementLayout->addWidget( theWidget );
 
-  theWidget->show();
-  myAddElementBox->show();
+  //theWidget->show();
+  //myAddElementBox->show();
 }
 
 void HYDROGUI_ProfileDlg::processFinishedSubOperation( QWidget* theWidget )
 {
-  myEditorWidget->setEnabled( true );
+  /*myEditorWidget->setEnabled( true );
 
   QBoxLayout* anAddElementLayout = dynamic_cast<QBoxLayout*>( myAddElementBox->layout() );
   anAddElementLayout->removeWidget( theWidget );
 
   theWidget->hide();
-  myAddElementBox->hide();
+  myAddElementBox->hide();*/
 }
 
 void HYDROGUI_ProfileDlg::reset()
 {
+  myEditorWidget->reset();
+}
+
+Handle(AIS_InteractiveContext) HYDROGUI_ProfileDlg::getAISContext()
+{
+  return myViewWidget->getAISContext();
 }
 
 void HYDROGUI_ProfileDlg::setProfileName( const QString& theName )
@@ -106,9 +123,9 @@ QString HYDROGUI_ProfileDlg::getProfileName() const
   return myName->text();
 }
 
-void HYDROGUI_ProfileDlg::setCurve( CurveCreator_ICurve* theCurve )
+void HYDROGUI_ProfileDlg::setProfile( CurveCreator_ICurve* theProfile )
 {
-  myEditorWidget->setCurve( theCurve );
+  myEditorWidget->setCurve( theProfile );
 }
 
 QList<int> HYDROGUI_ProfileDlg::getSelectedSections()