X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_PolylineOp.cxx;h=47b25a1233b9769803854985c2caa4e4ab4dbcff;hb=a88716339afd0e93e4a62bd0379c8c6eacd01ad9;hp=dc0d2d6b12f85d497a8e9b55ff765a7cb358faf8;hpb=a1431f03eac1d1aed4203d0568d987c41ce939b3;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx index dc0d2d6b..47b25a12 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx @@ -52,8 +52,7 @@ HYDROGUI_PolylineOp::HYDROGUI_PolylineOp( HYDROGUI_Module* theModule, bool theIsEdit ) : HYDROGUI_Operation( theModule ), myIsEdit( theIsEdit ), - myCurve( NULL ), - myViewManager( NULL ) + myCurve( NULL ) { setName( theIsEdit ? tr( "EDIT_POLYLINE" ) : tr( "CREATE_POLYLINE" ) ); } @@ -81,6 +80,32 @@ bool HYDROGUI_PolylineOp::deleteEnabled() return aPanel->deleteEnabled(); } +/** + * Set Z layer for the operation preview. + \param theLayer a layer position + */ +void HYDROGUI_PolylineOp::updatePreviewZLayer( int theLayer ) +{ + HYDROGUI_Operation::updatePreviewZLayer( theLayer ); + + int aZLayer = getPreviewZLayer(); + if ( aZLayer >= 0 ) + { + if( getPreviewManager() ) + { + if ( OCCViewer_Viewer* aViewer = getPreviewManager()->getOCCViewer() ) + { + Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); + if( !aCtx.IsNull() ) + { + Handle(AIS_InteractiveObject) anObject = myCurve->getAISObject( true ); + aCtx->SetZLayer( anObject, aZLayer ); + } + } + } + } +} + void HYDROGUI_PolylineOp::startOperation() { if( myIsEdit ) @@ -109,9 +134,10 @@ void HYDROGUI_PolylineOp::startOperation() aPanel->reset(); LightApp_Application* anApp = module()->getApp(); - myViewManager = + OCCViewer_ViewManager* aViewManager = dynamic_cast( anApp->getViewManager( OCCViewer_Viewer::Type(), true ) ); - aPanel->setOCCViewer( myViewManager ? myViewManager->getOCCViewer() : 0 ); + aPanel->setOCCViewer( aViewManager ? aViewManager->getOCCViewer() : 0 ); + setPreviewManager( aViewManager ); QString aPolylineName; if( !myEditedObject.IsNull() ) @@ -320,14 +346,14 @@ void HYDROGUI_PolylineOp::onEditorSelectionChanged() void HYDROGUI_PolylineOp::displayPreview() { - if( myViewManager ) + if( getPreviewManager() ) { - if( OCCViewer_Viewer* aViewer = myViewManager->getOCCViewer() ) + if( OCCViewer_Viewer* aViewer = getPreviewManager()->getOCCViewer() ) { Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); if( !aCtx.IsNull() ) { - CurveCreator_Displayer* aDisplayer = new CurveCreator_Displayer( aCtx ); + CurveCreator_Displayer* aDisplayer = new CurveCreator_Displayer( aCtx, getPreviewZLayer() ); myCurve->setDisplayer( aDisplayer ); aDisplayer->display( myCurve->getAISObject( true ), true ); } @@ -338,9 +364,9 @@ void HYDROGUI_PolylineOp::displayPreview() void HYDROGUI_PolylineOp::erasePreview() { CurveCreator_Displayer* aDisplayer = myCurve ? myCurve->getDisplayer() : 0; - if( myViewManager && aDisplayer ) + if( getPreviewManager() && aDisplayer ) { - if( OCCViewer_Viewer* aViewer = myViewManager->getOCCViewer() ) + if( OCCViewer_Viewer* aViewer = getPreviewManager()->getOCCViewer() ) { Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); if( !aCtx.IsNull() ) @@ -350,7 +376,7 @@ void HYDROGUI_PolylineOp::erasePreview() } } - myViewManager = NULL; + setPreviewManager( NULL ); if ( myCurve ) { delete myCurve;