]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Bug 158: Crash in profile edition
authornds <nds@opencascade.com>
Thu, 5 Dec 2013 09:35:02 +0000 (09:35 +0000)
committernds <nds@opencascade.com>
Thu, 5 Dec 2013 09:35:02 +0000 (09:35 +0000)
src/HYDROGUI/HYDROGUI_ProfileDlg.cxx
src/HYDROGUI/HYDROGUI_ProfileDlg.h
src/HYDROGUI/HYDROGUI_ProfileOp.cxx

index e05d473911d14939d1da86de28c66755cad91319..7af6f434382f57534d4831d73bce0a57b3c698bd 100644 (file)
@@ -63,31 +63,30 @@ HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QStr
   anAddElementLayout->setMargin( 0 );
   anAddElementLayout->setSpacing( 5 );
 
-
-  OCCViewer_ViewManager* aViewMgr = new OCCViewer_ViewManager( theModule->getApp()->activeStudy(), 0 );
-  myViewer = new OCCViewer_Viewer( true );
+  myViewManager = new OCCViewer_ViewManager( theModule->getApp()->activeStudy(), 0 );
+  OCCViewer_Viewer* aViewer = new OCCViewer_Viewer( true );
 
   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();
+  aViewer->setBackground( OCCViewer_ViewFrame::TOP_LEFT,
+                     aResMgr->backgroundValue( "OCCViewer", "xz_background", aViewer->background(OCCViewer_ViewFrame::TOP_LEFT) ) );
+  aViewer->setBackground( OCCViewer_ViewFrame::TOP_RIGHT,
+                     aResMgr->backgroundValue( "OCCViewer", "yz_background", aViewer->background(OCCViewer_ViewFrame::TOP_RIGHT) ) );
+  aViewer->setBackground( OCCViewer_ViewFrame::BOTTOM_LEFT,
+                     aResMgr->backgroundValue( "OCCViewer", "xy_background", aViewer->background(OCCViewer_ViewFrame::BOTTOM_LEFT) ) );
+  aViewer->setBackground( OCCViewer_ViewFrame::BOTTOM_RIGHT,
+                     aResMgr->backgroundValue( "OCCViewer", "background", aViewer->background(OCCViewer_ViewFrame::MAIN_VIEW) ) );
+
+  aViewer->setTrihedronSize( aResMgr->doubleValue( "3DViewer", "trihedron_size", aViewer->trihedronSize() ),
+                        aResMgr->booleanValue( "3DViewer", "relative_size", aViewer->trihedronRelative() ));
+  aViewer->setInteractionStyle( aResMgr->integerValue( "3DViewer", "navigation_mode", aViewer->interactionStyle() ) );
+  aViewer->setZoomingStyle( aResMgr->integerValue( "3DViewer", "zooming_mode", aViewer->zoomingStyle() ) );
+  aViewer->enablePreselection( aResMgr->booleanValue( "OCCViewer", "enable_preselection", aViewer->isPreselectionEnabled() ) );
+  aViewer->enableSelection( aResMgr->booleanValue( "OCCViewer", "enable_selection", aViewer->isSelectionEnabled() ) );
+
+  myViewManager->setViewModel( aViewer );// custom view model, which extends SALOME_View interface
+  SUIT_ViewWindow* aViewWin = myViewManager->createViewWindow();
   addWidget( aViewWin, 4 );
-  myEditorWidget->setOCCViewer( myViewer );
+  myEditorWidget->setOCCViewer( aViewer );
 
   connect( myEditorWidget, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
   connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*) ), this, SLOT( processStartedSubOperation(QWidget*) ) );
@@ -98,6 +97,7 @@ HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QStr
 
 HYDROGUI_ProfileDlg::~HYDROGUI_ProfileDlg()
 {
+  delete myViewManager;
 }
 
 void HYDROGUI_ProfileDlg::reset()
@@ -107,7 +107,8 @@ void HYDROGUI_ProfileDlg::reset()
 
 Handle(AIS_InteractiveContext) HYDROGUI_ProfileDlg::getAISContext()
 {
-  return myViewer->getAISContext();
+  OCCViewer_Viewer* aViewer = (OCCViewer_Viewer*)myViewManager->getViewModel();
+  return aViewer ? aViewer->getAISContext() : 0;
 }
 
 void HYDROGUI_ProfileDlg::setProfileName( const QString& theName )
index 96f37e7deb17ddc3dc1eb459cc32bd8795f8768b..f4c760562f8c7054bc9e51c2041544a4120d6965 100644 (file)
@@ -30,7 +30,7 @@
 class QLineEdit;
 class CurveCreator_Widget;
 class CurveCreator_ICurve;
-class OCCViewer_Viewer;
+class OCCViewer_ViewManager;
 class QGroupBox;
 
 class HYDROGUI_ProfileDlg : public HYDROGUI_InputPanel
@@ -70,7 +70,7 @@ private:
   QLineEdit*            myName;
   CurveCreator_Widget*  myEditorWidget;
   QGroupBox*            myAddElementBox;
-  OCCViewer_Viewer*     myViewer;
+  OCCViewer_ViewManager* myViewManager;
 };
 
 #endif
index 6ed7bd15e3ef70f706ab2d69bc2b83024056b2fb..386e914ae9a46b8cb946734a612314db0e9e9ad1 100644 (file)
@@ -200,9 +200,6 @@ bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags,
   }
   aProfileObj->SetParametricPoints( aProfileParamPoints );
 
-  if( !myIsEdit )
-    module()->setObjectVisible( HYDROGUI_Tool::GetActiveOCCViewId( module() ), aProfileObj, true );
-
   theUpdateFlags = UF_Model;
   return true;
 }