X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FOCCViewer%2FOCCViewer_ViewWindow.cxx;h=cfeb79fb49f605a791e11bdaf7784d9edb151968;hb=9f57d6054a4065e334d5e0e1b0c887bb754bb5b5;hp=08f89e26992ef4e03c1f1e4cee1f0de4e597f85e;hpb=fefd312d1e3275214b2cfb49168f3e1a3d918d09;p=modules%2Fgui.git diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx old mode 100755 new mode 100644 index 08f89e269..cfeb79fb4 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -24,6 +24,7 @@ // Author : #include "OCCViewer_ViewWindow.h" +#include "OCCViewer_ViewFrame.h" #include "OCCViewer_ViewModel.h" #include "OCCViewer_ViewPort3d.h" #include "OCCViewer_ViewManager.h" @@ -34,8 +35,10 @@ #include "OCCViewer_AxialScaleDlg.h" #include "OCCViewer_CubeAxesDlg.h" #include "OCCViewer_ClippingDlg.h" - -#include +#include "OCCViewer_RayTracingDlg.h" +#include "OCCViewer_EnvTextureDlg.h" +#include "OCCViewer_LightSourceDlg.h" +#include "OCCViewer_Utilities.h" #include #include @@ -49,9 +52,7 @@ #include #include -#ifndef DISABLE_GLVIEWER - #include -#endif +#include #include #include @@ -72,12 +73,24 @@ #include #include +#include +#include +#include +#include + #include #include #include #include +#if OCC_VERSION_LARGE > 0x06090000 +#include +#include +#endif + +#if OCC_VERSION_MAJOR < 7 + #include +#endif -#include #include #include @@ -86,9 +99,6 @@ #include #include -#include -#include - #include #include @@ -101,11 +111,24 @@ static QEvent* l_mbPressEvent = 0; -#ifdef WIN32 -# include -#endif +//#ifdef WIN32 +//# include +//#endif +#ifdef __APPLE__ +#include +#else #include +#endif + +// To avoid conflict between KeyPress from the X.h (define KeyPress 2) +// and QEvent::KeyPress (qevent.h) +#ifdef KeyPress +#undef KeyPress +#endif + +// Enable ray tracing features +#define ENABLE_RAY_TRACING const char* imageZoomCursor[] = { "32 32 3 1", @@ -234,6 +257,7 @@ OCCViewer_ViewWindow::OCCViewer_ViewWindow( SUIT_Desktop* theDesktop, myModel = theModel; myRestoreFlag = 0; myEnableDrawMode = false; + myDrawRectEnabled = true; myDrawRect=false; updateEnabledDrawMode(); myScalingDlg = 0; @@ -252,9 +276,9 @@ OCCViewer_ViewWindow::OCCViewer_ViewWindow( SUIT_Desktop* theDesktop, mySelectionEnabled = true; myCursorIsHand = false; + myPanningByBtn = false; clearViewAspects(); - } /*! @@ -276,8 +300,8 @@ void OCCViewer_ViewWindow::initLayout() setCentralWidget(myViewPort); myOperation = NOTHING; - myCurrPointType = GRAVITY; - myPrevPointType = GRAVITY; + myCurrPointType = BBCENTER; + myPrevPointType = BBCENTER; mySelectedPoint = gp_Pnt(0.,0.,0.); myRotationPointSelection = false; @@ -377,7 +401,9 @@ bool OCCViewer_ViewWindow::eventFilter( QObject* watched, QEvent* e ) ic->HilightPreviousDetected( myViewPort->getView() ); } } - } else { + } + else { + emit vpTransformationStarted ( ZOOMVIEW ); myViewPort->startZoomAtPoint( aEvent->x(), aEvent->y() ); double delta = (double)( aEvent->delta() ) / ( 15 * 8 ); int x = aEvent->x(); @@ -385,7 +411,10 @@ bool OCCViewer_ViewWindow::eventFilter( QObject* watched, QEvent* e ) int x1 = (int)( aEvent->x() + width()*delta/100 ); int y1 = (int)( aEvent->y() + height()*delta/100 ); myViewPort->zoom( x, y, x1, y1 ); +#if OCC_VERSION_LARGE <= 0x07000000 myViewPort->getView()->ZFitAll(); +#endif + emit vpTransformationFinished ( ZOOMVIEW ); } } return true; @@ -409,13 +438,25 @@ bool OCCViewer_ViewWindow::eventFilter( QObject* watched, QEvent* e ) return SUIT_ViewWindow::eventFilter(watched, e); } +/*! + \brief Enable / disable draw rect (rubber band) mode +*/ +bool OCCViewer_ViewWindow::enableDrawMode( bool on ) +{ + bool prev = myDrawRectEnabled; + myDrawRectEnabled = on; + updateEnabledDrawMode(); + return prev; +} + /*! \brief Update state of enable draw mode state. */ void OCCViewer_ViewWindow::updateEnabledDrawMode() { + myEnableDrawMode = myDrawRectEnabled; if ( myModel ) - myEnableDrawMode = myModel->isSelectionEnabled() && myModel->isMultiSelectionEnabled(); + myEnableDrawMode = myEnableDrawMode && myModel->isSelectionEnabled() && myModel->isMultiSelectionEnabled(); } /*! @@ -502,7 +543,7 @@ void OCCViewer_ViewWindow::vpMousePressEvent( QMouseEvent* theEvent ) if ( theEvent->button() == Qt::LeftButton ) { Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); - ic->Select(); + ic->Select( Standard_True ); for ( ic->InitSelected(); ic->MoreSelected(); ic->NextSelected() ) { TopoDS_Shape aShape = ic->SelectedShape(); @@ -541,7 +582,7 @@ void OCCViewer_ViewWindow::vpMousePressEvent( QMouseEvent* theEvent ) } if ( ic->NbSelected() == 0 ) myCurrPointType = myPrevPointType; if ( mySetRotationPointDlg ) mySetRotationPointDlg->toggleChange(); - ic->CloseAllContexts(); + ic->CloseAllContexts( Standard_True ); myOperation = NOTHING; myViewPort->setCursor( myCursor ); myCursorIsHand = false; @@ -554,7 +595,7 @@ void OCCViewer_ViewWindow::vpMousePressEvent( QMouseEvent* theEvent ) } /* notify that we start a transformation */ if ( transformRequested() ) - emit vpTransformationStarted ( myOperation ); + emit vpTransformationStarted ( myOperation ); } if ( transformRequested() ) setTransformInProcess( true ); @@ -585,6 +626,12 @@ void OCCViewer_ViewWindow::activateZoom() } +void OCCViewer_ViewWindow::onPanning() +{ + myPanningByBtn = true; + activatePanning(); +} + /*! \brief Start panning operation. @@ -663,9 +710,8 @@ bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, dou for( ; aStructureIt.More(); aStructureIt.Next() ) { const Handle(Graphic3d_Structure)& aStructure = aStructureIt.Key(); - if ( aStructure->IsEmpty() ) { + if ( aStructure->IsEmpty() || !aStructure->IsVisible() || aStructure->CStructure()->IsForHighlight ) continue; - } #if OCC_VERSION_LARGE > 0x06070100 Bnd_Box aBox = aStructure->MinMaxValues(); @@ -737,7 +783,7 @@ void OCCViewer_ViewWindow::activateSetRotationGravity() if ( myRotationPointSelection ) { Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); - ic->CloseAllContexts(); + ic->CloseAllContexts( Standard_True ); myOperation = NOTHING; myViewPort->setCursor( myCursor ); myCursorIsHand = false; @@ -745,10 +791,10 @@ void OCCViewer_ViewWindow::activateSetRotationGravity() } myPrevPointType = myCurrPointType; - myCurrPointType = GRAVITY; + myCurrPointType = BBCENTER; Standard_Real Xcenter, Ycenter, Zcenter; - if ( computeGravityCenter( Xcenter, Ycenter, Zcenter ) ) + if ( OCCViewer_Utilities::computeVisibleBBCenter( myViewPort->getView(), Xcenter, Ycenter, Zcenter ) ) mySetRotationPointDlg->setCoords( Xcenter, Ycenter, Zcenter ); } @@ -758,10 +804,10 @@ void OCCViewer_ViewWindow::activateSetRotationGravity() */ void OCCViewer_ViewWindow::updateGravityCoords() { - if ( mySetRotationPointDlg && mySetRotationPointDlg->isVisible() && myCurrPointType == GRAVITY ) + if ( mySetRotationPointDlg && mySetRotationPointDlg->isVisible() && myCurrPointType == BBCENTER ) { Standard_Real Xcenter, Ycenter, Zcenter; - if ( computeGravityCenter( Xcenter, Ycenter, Zcenter ) ) + if ( OCCViewer_Utilities::computeVisibleBBCenter( myViewPort->getView(), Xcenter, Ycenter, Zcenter ) ) mySetRotationPointDlg->setCoords( Xcenter, Ycenter, Zcenter ); } } @@ -777,7 +823,7 @@ void OCCViewer_ViewWindow::activateSetRotationSelected( double theX, double theY if ( myRotationPointSelection ) { Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); - ic->CloseAllContexts(); + ic->CloseAllContexts( Standard_True ); myOperation = NOTHING; myViewPort->setCursor( myCursor ); myCursorIsHand = false; @@ -1027,9 +1073,17 @@ void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) case PANVIEW: case ZOOMVIEW: +#if OCC_VERSION_LARGE <= 0x07000000 myViewPort->getView()->ZFitAll(); - resetState(); - break; +#endif + { + OCCViewer_ViewManager* aMgr = dynamic_cast( getViewManager() ); + bool isChained = aMgr->isChainedOperations(); + bool isReset = !( myOperation==PANVIEW && myPanningByBtn && isChained ) || theEvent->button() == Qt::RightButton; + if( isReset ) + resetState(); + break; + } case PANGLOBAL: if ( theEvent->button() == Qt::LeftButton ) { @@ -1151,6 +1205,8 @@ void OCCViewer_ViewWindow::createActions() return; SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + if( !aResMgr ) + return; QtxAction* aAction; @@ -1193,7 +1249,7 @@ void OCCViewer_ViewWindow::createActions() aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_PAN" ) ), tr( "MNU_PAN_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_PAN_VIEW")); - connect(aAction, SIGNAL(triggered()), this, SLOT(activatePanning())); + connect(aAction, SIGNAL(triggered()), this, SLOT(onPanning())); toolMgr()->registerAction( aAction, PanId ); // Global Panning @@ -1284,7 +1340,6 @@ void OCCViewer_ViewWindow::createActions() tr( "MNU_ORTHOGRAPHIC_MODE" ), 0, this); aAction->setStatusTip(tr("DSC_ORTHOGRAPHIC_MODE")); aAction->setCheckable(true); - //connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onProjectionType())); toolMgr()->registerAction( aAction, OrthographicId ); // - perspective projection @@ -1292,15 +1347,22 @@ void OCCViewer_ViewWindow::createActions() tr( "MNU_PERSPECTIVE_MODE" ), 0, this); aAction->setStatusTip(tr("DSC_PERSPECTIVE_MODE")); aAction->setCheckable(true); - //connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onProjectionType())); toolMgr()->registerAction( aAction, PerspectiveId ); - +#if OCC_VERSION_LARGE > 0x06090000 + // - stereo projection + aAction = new QtxAction(tr("MNU_STEREO_MODE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_STEREO" ) ), + tr( "MNU_STEREO_MODE" ), 0, this); + aAction->setStatusTip(tr("DSC_STEREO_MODE")); + aAction->setCheckable(true); + toolMgr()->registerAction( aAction, StereoId ); + connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onStereoType(bool))); +#endif // - add exclusive action group QActionGroup* aProjectionGroup = new QActionGroup( this ); aProjectionGroup->addAction( toolMgr()->action( OrthographicId ) ); aProjectionGroup->addAction( toolMgr()->action( PerspectiveId ) ); - connect(aProjectionGroup, SIGNAL(triggered(QAction*)), this, SLOT(onProjectionType())); - + connect(aProjectionGroup, SIGNAL(triggered(QAction*)), this, SLOT(onProjectionType(QAction*))); + // Reset aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_RESET" ) ), tr( "MNU_RESET_VIEW" ), 0, this, false, "Viewers:Reset view"); @@ -1417,6 +1479,28 @@ void OCCViewer_ViewWindow::createActions() // Synchronize View toolMgr()->registerAction( synchronizeAction(), SynchronizeId ); +#ifdef ENABLE_RAY_TRACING + // Ray tracing + aAction = new QtxAction( tr("MNU_RAY_TRACING"), aResMgr->loadPixmap( "OCCViewer", tr("ICON_OCCVIEWER_RAY_TRACING") ), + tr("MNU_RAY_TRACING"), 0, this ); + aAction->setStatusTip( tr("DSC_RAY_TRACING") ); + connect( aAction, SIGNAL( triggered() ), this, SLOT( onRayTracing() ) ); + toolMgr()->registerAction( aAction, RayTracingId ); + + // Environment texture + aAction = new QtxAction( tr("MNU_ENV_TEXTURE"), aResMgr->loadPixmap( "OCCViewer", tr("ICON_OCCVIEWER_ENV_TEXTURE") ), + tr("MNU_ENV_TEXTURE"), 0, this ); + aAction->setStatusTip( tr("DSC_ENV_TEXTURE") ); + connect( aAction, SIGNAL( triggered() ), this, SLOT( onEnvTexture() ) ); + toolMgr()->registerAction( aAction, EnvTextureId ); + + // Light source + aAction = new QtxAction( tr("MNU_LIGHT_SOURCE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_LIGHT_SOURCE" ) ), + tr( "MNU_LIGHT_SOURCE" ), 0, this ); + aAction->setStatusTip( tr("DSC_LIGHT_SOURCE") ); + connect( aAction, SIGNAL( triggered() ), this, SLOT( onLightSource() ) ); + toolMgr()->registerAction( aAction, LightSourceId ); +#endif } /*! @@ -1483,6 +1567,9 @@ void OCCViewer_ViewWindow::createToolBar() toolMgr()->append( OrthographicId, tid ); toolMgr()->append( PerspectiveId, tid ); +#if OCC_VERSION_LARGE > 0x06090000 + toolMgr()->append( StereoId, tid ); +#endif toolMgr()->append( ResetId, tid ); } @@ -1503,6 +1590,11 @@ void OCCViewer_ViewWindow::createToolBar() toolMgr()->append( MaximizedId, tid ); toolMgr()->append( SynchronizeId, tid ); +#ifdef ENABLE_RAY_TRACING + toolMgr()->append( RayTracingId, tid ); + toolMgr()->append( EnvTextureId, tid ); + toolMgr()->append( LightSourceId, tid ); +#endif } /*! @@ -1623,17 +1715,167 @@ void OCCViewer_ViewWindow::onResetView() } /*! - \brief Perform "reset view" transformation. + \brief Set the given projection mode. - Sets default orientation of the viewport camera. + Set the given projection mode: Orthographic or Perspective. +*/ +void OCCViewer_ViewWindow::onProjectionType( QAction* theAction ) +{ + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); + if (theAction == toolMgr()->action( OrthographicId )) { + myModel->setProjectionType(Orthographic); + aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Orthographic ); + aCamera->SetFOVy(45.0); + } + else if (theAction == toolMgr()->action( PerspectiveId )) { + myModel->setProjectionType(Perspective); + aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Perspective ); + aCamera->SetFOVy(30.0); + } +#if OCC_VERSION_LARGE > 0x06090000 + if (toolMgr()->action( StereoId )->isChecked()) { + aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Stereo ); + aCamera->SetFOVy(30.0); + } +#endif + aView3d->Redraw(); + onViewFitAll(); + } +} + +/*! + \brief Sets Stereo projection mode. + + Sets Stereo projection mode. +*/ +void OCCViewer_ViewWindow::onStereoType( bool activate ) +{ +#if OCC_VERSION_LARGE > 0x06090000 + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); + if (activate) { + toolMgr()->action( PerspectiveId )->setChecked(true); + aCamera->SetProjectionType(Graphic3d_Camera::Projection_Perspective); + toolMgr()->action( PerspectiveId )->actionGroup()->setEnabled(false); + + aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Stereo ); + SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); + setStereoType( aResMgr->integerValue( "OCCViewer", "stereo_type", 0 ) ); + setAnaglyphFilter( aResMgr->integerValue( "OCCViewer", "anaglyph_filter", 0 ) ); + setReverseStereo( aResMgr->booleanValue( "OCCViewer", "reverse_stereo", false ) ); + setVSync( aResMgr->booleanValue( "OCCViewer", "enable_vsync", true ) ); + setQuadBufferSupport( aResMgr->booleanValue( "OCCViewer", "enable_quad_buffer_support", false ) ); + } + else { + toolMgr()->action( PerspectiveId )->actionGroup()->setEnabled(true); + if (myModel->projectionType() == Orthographic) { + toolMgr()->action( OrthographicId )->setChecked(true); + aCamera->SetProjectionType(Graphic3d_Camera::Projection_Orthographic); + } + else if (myModel->projectionType() == Perspective) { + toolMgr()->action( PerspectiveId )->setChecked(true); + aCamera->SetProjectionType(Graphic3d_Camera::Projection_Perspective); + } + } + aView3d->Redraw(); + onViewFitAll(); + } + + if ( isQuadBufferSupport() && !isOpenGlStereoSupport() && stereoType() == QuadBuffer && + toolMgr()->action( StereoId )->isChecked() ) + SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ), tr( "WRN_SUPPORT_QUAD_BUFFER" ) ); +#endif +} + +/*! + \brief Restore the view. + + Restore the projection mode based on tool-buttons states. */ void OCCViewer_ViewWindow::onProjectionType() { emit vpTransformationStarted( PROJECTION ); - setProjectionType( toolMgr()->action( OrthographicId )->isChecked() ? Orthographic : Perspective ); + if (toolMgr()->action( OrthographicId )->isChecked()) + setProjectionType( Orthographic ); + if (toolMgr()->action( PerspectiveId )->isChecked()) + setProjectionType( Perspective ); +#if OCC_VERSION_LARGE > 0x06090000 + if (toolMgr()->action( StereoId )->isChecked()) + setProjectionType( Stereo ); +#endif emit vpTransformationFinished( PROJECTION ); } +void OCCViewer_ViewWindow::setProjectionType( int mode ) +{ + QtxAction* anOrthographicAction = dynamic_cast( toolMgr()->action( OrthographicId ) ); + QtxAction* aPerspectiveAction = dynamic_cast( toolMgr()->action( PerspectiveId ) ); +#if OCC_VERSION_LARGE > 0x06090000 + QtxAction* aStereoAction = dynamic_cast( toolMgr()->action( StereoId ) ); +#endif + switch ( mode ) { + case Orthographic: + onProjectionType( anOrthographicAction ); + break; + case Perspective: + onProjectionType( aPerspectiveAction ); + break; + case Stereo: + onStereoType( true ); + break; + } + // update action state if method is called outside + if ( mode == Orthographic && !anOrthographicAction->isChecked() ) { + anOrthographicAction->setChecked( true ); + #if OCC_VERSION_LARGE > 0x06090000 + aStereoAction->setChecked( false ); + #endif + } + if ( mode == Perspective && !aPerspectiveAction->isChecked() ) { + aPerspectiveAction->setChecked( true ); + #if OCC_VERSION_LARGE > 0x06090000 + aStereoAction->setChecked( false ); + #endif + } +#if OCC_VERSION_LARGE > 0x06090000 + if ( mode == Stereo ) { + aStereoAction->setChecked( true ); + if ( anOrthographicAction->isEnabled() ) { + anOrthographicAction->setEnabled( false ); + anOrthographicAction->setChecked( false ); + aStereoAction->setChecked( false ); + } + else { + anOrthographicAction->setEnabled( true ); + aStereoAction->setChecked( false ); + anOrthographicAction->setChecked(myModel->projectionType() == Orthographic); + } + if ( aPerspectiveAction->isEnabled() ) { + aPerspectiveAction->setEnabled( false ); + aPerspectiveAction->setChecked( true ); + if ( isQuadBufferSupport() && !isOpenGlStereoSupport() && stereoType() == QuadBuffer && + toolMgr()->action( StereoId )->isChecked() ) + SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ), tr( "WRN_SUPPORT_QUAD_BUFFER" ) ); + } + else { + aPerspectiveAction->setEnabled( true ); + aStereoAction->setChecked( false ); + aPerspectiveAction->setChecked(myModel->projectionType() == Perspective); + onProjectionType(); + } + } + else { + if ( !anOrthographicAction->isEnabled() ) + anOrthographicAction->setEnabled( true ); + if ( !aPerspectiveAction->isEnabled() ) + aPerspectiveAction->setEnabled( true ); + } +#endif +} + /*! \brief Perform "fit all" transformation. */ @@ -1673,10 +1915,10 @@ void OCCViewer_ViewWindow::onSetRotationPoint( bool on ) if (!mySetRotationPointDlg->isVisible()) { //if (mySetRotationPointDlg->IsFirstShown()) - if (myCurrPointType == GRAVITY) + if (myCurrPointType == BBCENTER) { Standard_Real Xcenter, Ycenter, Zcenter; - if (computeGravityCenter(Xcenter, Ycenter, Zcenter)) + if (OCCViewer_Utilities::computeVisibleBBCenter(myViewPort->getView(), Xcenter, Ycenter, Zcenter)) mySetRotationPointDlg->setCoords(Xcenter, Ycenter, Zcenter); } mySetRotationPointDlg->show(); @@ -1697,6 +1939,10 @@ void OCCViewer_ViewWindow::onCloneView() SUIT_ViewWindow* vw = myManager->createViewWindow(); //vw->show(); emit viewCloned( vw ); + OCCViewer_ViewWindow* occVw = dynamic_cast (vw); + if(occVw && occVw->getView(OCCViewer_ViewFrame::MAIN_VIEW)) { + occVw->getView(OCCViewer_ViewFrame::MAIN_VIEW)->synchronize(this); + } } /*! @@ -1705,7 +1951,7 @@ void OCCViewer_ViewWindow::onCloneView() void OCCViewer_ViewWindow::onAxialScale() { if ( !myScalingDlg ) - myScalingDlg = new OCCViewer_AxialScaleDlg( this ); + myScalingDlg = new OCCViewer_AxialScaleDlg( this , myModel ); if ( !myScalingDlg->isVisible() ) { @@ -1929,7 +2175,7 @@ void OCCViewer_ViewWindow::onSwitchInteractionStyle( bool on ) // update action state if method is called outside QtxAction* a = dynamic_cast( toolMgr()->action( SwitchInteractionStyleId ) ); - if ( a->isChecked() != on ) + if ( a && a->isChecked() != on ) a->setChecked( on ); } @@ -1942,7 +2188,7 @@ void OCCViewer_ViewWindow::onSwitchZoomingStyle( bool on ) // update action state if method is called outside QtxAction* a = dynamic_cast( toolMgr()->action( SwitchZoomingStyleId ) ); - if ( a->isChecked() != on ) + if ( a && a->isChecked() != on ) a->setChecked( on ); } @@ -2050,17 +2296,24 @@ bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img, const QString& fileName, const QString& format ) { + bool res = false; + QApplication::setOverrideCursor( Qt::WaitCursor ); if ( format != "PS" && format != "EPS") - return SUIT_ViewWindow::dumpViewToFormat( img, fileName, format ); + res = myViewPort->getView()->Dump( fileName.toStdString().c_str() ); +#if OCC_VERSION_MAJOR < 7 Handle(Visual3d_View) a3dView = myViewPort->getView()->View(); +#else + Handle(Graphic3d_CView) a3dView = myViewPort->getView()->View(); +#endif if (format == "PS") - a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_PostScript); + res = a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_PostScript); else if (format == "EPS") - a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_EnhPostScript); + res = a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_EnhPostScript); - return true; + QApplication::restoreOverrideCursor(); + return res; } @@ -2097,10 +2350,15 @@ void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x, const doub gp_Pln pln (gp_Pnt(x, y, z), gp_Dir(dx, dy, dz)); double a, b, c, d; pln.Coefficients(a, b, c, d); - +#if OCC_VERSION_LARGE > 0x07000000 + Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = view->ClipPlanes(); + Graphic3d_SequenceOfHClipPlane::Iterator anIter (*aPlanes); + if(aPlanes->Size() > 0 ) { +#else Graphic3d_SequenceOfHClipPlane aPlanes = view->GetClipPlanes(); + Graphic3d_SequenceOfHClipPlane::Iterator anIter (aPlanes); if(aPlanes.Size() > 0 ) { - Graphic3d_SequenceOfHClipPlane::Iterator anIter (aPlanes); +#endif Handle(Graphic3d_ClipPlane) aClipPlane = anIter.Value(); aClipPlane->SetEquation(pln); aClipPlane->SetOn(Standard_True); @@ -2109,8 +2367,13 @@ void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x, const doub } } else { +#if OCC_VERSION_LARGE > 0x07000000 + Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = view->ClipPlanes(); + Graphic3d_SequenceOfHClipPlane::Iterator anIter (*aPlanes); +#else Graphic3d_SequenceOfHClipPlane aPlanes = view->GetClipPlanes(); Graphic3d_SequenceOfHClipPlane::Iterator anIter (aPlanes); +#endif for( ;anIter.More();anIter.Next() ){ Handle(Graphic3d_ClipPlane) aClipPlane = anIter.Value(); aClipPlane->SetOn(Standard_False); @@ -2137,8 +2400,13 @@ bool OCCViewer_ViewWindow::isCuttingPlane() { Handle(V3d_View) view = myViewPort->getView(); bool res = false; - Graphic3d_SequenceOfHClipPlane aPlanes = view->GetClipPlanes(); - Graphic3d_SequenceOfHClipPlane::Iterator anIter (aPlanes); +#if OCC_VERSION_LARGE > 0x07000000 + Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = view->ClipPlanes(); + Graphic3d_SequenceOfHClipPlane::Iterator anIter (*aPlanes); +#else + Graphic3d_SequenceOfHClipPlane aPlanes = view->GetClipPlanes(); + Graphic3d_SequenceOfHClipPlane::Iterator anIter (aPlanes); +#endif for( ;anIter.More();anIter.Next() ) { Handle(Graphic3d_ClipPlane) aClipPlane = anIter.Value(); if(aClipPlane->IsOn()) { @@ -2358,6 +2626,58 @@ QString OCCViewer_ViewWindow::getVisualParameters() data << QString( "gtTickmarkLengthX=%1" ).arg( params.gtTickmarkLengthX ); data << QString( "gtTickmarkLengthY=%1" ).arg( params.gtTickmarkLengthY ); data << QString( "gtTickmarkLengthZ=%1" ).arg( params.gtTickmarkLengthZ ); + + // ray tracing parameters + Graphic3d_RenderingParams rendParams = this->getViewPort()->getView()->RenderingParams(); + if ( rendParams.Method == Graphic3d_RM_RAYTRACING ) { + QString RayTracing = "rayTracing="; + RayTracing += QString( "rtDepth~%1;" ).arg( rendParams.RaytracingDepth ); + RayTracing += QString( "rtReflection~%1;" ).arg( rendParams.IsReflectionEnabled ); + RayTracing += QString( "rtAntialiasing~%1;" ).arg( rendParams.IsAntialiasingEnabled ); + RayTracing += QString( "rtShadow~%1;" ).arg( rendParams.IsShadowEnabled ); + RayTracing += QString( "rtTransShadow~%1;" ).arg( rendParams.IsTransparentShadowEnabled ); + data << RayTracing; + } + + // environment texture parameters + Handle(Graphic3d_TextureEnv) aTexture = this->getViewPort()->getView()->TextureEnv(); + if ( !aTexture.IsNull() ) { + QString EnvTexture = "envTexture="; + if ( aTexture->Name() == Graphic3d_NOT_ENV_UNKNOWN ) { + TCollection_AsciiString aFileName; + aTexture->Path().SystemName( aFileName ); + EnvTexture += QString( "etFile~%1;" ).arg( aFileName.ToCString() ); + } + else + EnvTexture += QString( "etNumber~%1;" ).arg( aTexture->Name() ); + data << EnvTexture; + } + + // light source parameters + myModel->getViewer3d()->InitDefinedLights(); + while ( myModel->getViewer3d()->MoreDefinedLights() ) + { + Handle(V3d_Light) aLight = myModel->getViewer3d()->DefinedLight(); + if ( aLight->Type() != V3d_AMBIENT ) { + QString LightSource = QString( "lightSource=" ); + LightSource += QString( "lightType~%1;" ).arg( aLight->Type() ); + double aX, aY, aZ; + if ( aLight->Type() == V3d_DIRECTIONAL ) + Handle(V3d_DirectionalLight)::DownCast( aLight )->Direction( aX, aY, aZ ); + else if ( aLight->Type() == V3d_POSITIONAL ) + Handle(V3d_PositionalLight)::DownCast( aLight )->Position( aX, aY, aZ ); + LightSource += QString( "lightX~%1;" ).arg( aX ); + LightSource += QString( "lightY~%1;" ).arg( aY ); + LightSource += QString( "lightZ~%1;" ).arg( aZ ); + LightSource += QString( "lightColorR~%1;" ).arg( aLight->Color().Red() ); + LightSource += QString( "lightColorG~%1;" ).arg( aLight->Color().Green() ); + LightSource += QString( "lightColorB~%1;" ).arg( aLight->Color().Blue() ); + LightSource += QString( "lightHeadlight~%1;" ).arg( aLight->Headlight() ); + data << LightSource; + } + myModel->getViewer3d()->NextDefinedLights(); + } + QString bg = Qtx::backgroundToString( background() ).replace( "=", "$" ); data << QString( "background=%1" ).arg( bg ); @@ -2476,6 +2796,86 @@ void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) else if ( paramName == "gtTickmarkLengthX" ) params.gtTickmarkLengthX = paramValue.toInt(); else if ( paramName == "gtTickmarkLengthY" ) params.gtTickmarkLengthY = paramValue.toInt(); else if ( paramName == "gtTickmarkLengthZ" ) params.gtTickmarkLengthZ = paramValue.toInt(); + else if ( paramName == "rayTracing" ) + { + Graphic3d_RenderingParams& rendParams = this->getViewPort()->getView()->ChangeRenderingParams(); + rendParams.Method = Graphic3d_RM_RAYTRACING; + QStringList rtData = paramValue.split( ';' ); + foreach( QString rtParam, rtData ) + { + QString rt_paramName = rtParam.section( '~', 0, 0 ).trimmed(); + QString rt_paramValue = rtParam.section( '~', 1, 1 ).trimmed(); + if ( rt_paramName == "rtDepth" ) rendParams.RaytracingDepth = rt_paramValue.toInt(); + else if ( rt_paramName == "rtReflection" ) rendParams.IsReflectionEnabled = rt_paramValue.toInt(); + else if ( rt_paramName == "rtAntialiasing" ) rendParams.IsAntialiasingEnabled = rt_paramValue.toInt(); + else if ( rt_paramName == "rtShadow" ) rendParams.IsShadowEnabled = rt_paramValue.toInt(); + else if ( rt_paramName == "rtTransShadow" ) rendParams.IsTransparentShadowEnabled = rt_paramValue.toInt(); + } + } + else if ( paramName == "envTexture" ) + { + Handle(Graphic3d_TextureEnv) aTexture; + QStringList etData = paramValue.split( ';' ); + foreach( QString etParam, etData ) + { + QString et_paramName = etParam.section( '~', 0, 0 ).trimmed(); + QString et_paramValue = etParam.section( '~', 1, 1 ).trimmed(); + if ( et_paramName == "etNumber" ) + aTexture = new Graphic3d_TextureEnv( Graphic3d_NameOfTextureEnv( et_paramValue.toInt() ) ); + else if ( et_paramName == "etFile" ) + aTexture = new Graphic3d_TextureEnv( TCollection_AsciiString( et_paramValue.toStdString().c_str() ) ); + Handle(V3d_View) aView = this->getViewPort()->getView(); + aView->SetTextureEnv( aTexture ); +#if OCC_VERSION_LARGE <= 0x07000000 + aView->SetSurfaceDetail( V3d_TEX_ENVIRONMENT ); +#endif + } + } + else if ( paramName == "lightSource" ) + { + myModel->getViewer3d()->InitDefinedLights(); + while ( myModel->getViewer3d()->MoreDefinedLights() ) + { + Handle(V3d_Light) aLight = myModel->getViewer3d()->DefinedLight(); + if( aLight->Type() != V3d_AMBIENT ) { + myModel->getViewer3d()->DelLight( aLight ); + myModel->getViewer3d()->InitDefinedLights(); + } else { + myModel->getViewer3d()->NextDefinedLights(); + } + } + double aX, aY, aZ; + double cR, cG, cB; + V3d_TypeOfLight aType; + bool isHeadlight; + QStringList lsData = paramValue.split( ';' ); + foreach( QString lsParam, lsData ) + { + QString ls_paramName = lsParam.section( '~', 0, 0 ).trimmed(); + QString ls_paramValue = lsParam.section( '~', 1, 1 ).trimmed(); + if ( ls_paramName == "lightType" ) aType = V3d_TypeOfLight( ls_paramValue.toInt() ); + else if ( ls_paramName == "lightX" ) aX = ls_paramValue.toDouble(); + else if ( ls_paramName == "lightY" ) aY = ls_paramValue.toDouble(); + else if ( ls_paramName == "lightZ" ) aZ = ls_paramValue.toDouble(); + else if ( ls_paramName == "lightColorR" ) cR = ls_paramValue.toDouble(); + else if ( ls_paramName == "lightColorG" ) cG = ls_paramValue.toDouble(); + else if ( ls_paramName == "lightColorB" ) cB = ls_paramValue.toDouble(); + else if ( ls_paramName == "lightHeadlight" ) isHeadlight = ls_paramValue.toInt(); + } + Quantity_Color aColor = Quantity_Color( cR, cG, cB, Quantity_TOC_RGB ); + if( aType == V3d_DIRECTIONAL ) { + Handle(V3d_DirectionalLight) aLight = new V3d_DirectionalLight( myModel->getViewer3d() ); + aLight->SetDirection( aX, aY, aZ ); + aLight->SetColor( aColor ); + aLight->SetHeadlight( isHeadlight ); + myModel->getViewer3d()->SetLightOn( aLight ); + } + else if( aType == V3d_POSITIONAL ) { + Handle(V3d_PositionalLight) aLight = new V3d_PositionalLight( myModel->getViewer3d(), aX, aY, aZ, aColor.Name() ); + aLight->SetHeadlight( isHeadlight ); + myModel->getViewer3d()->SetLightOn( aLight ); + } + } else if ( paramName == "background" ) { QString bg = paramValue.replace( "$", "=" ); bgData = Qtx::stringToBackground( bg ); @@ -2790,29 +3190,240 @@ void OCCViewer_ViewWindow::set2dMode(Mode2dType theType) my2dMode = theType; } -void OCCViewer_ViewWindow::setProjectionType( int mode ) +int OCCViewer_ViewWindow::projectionType() const { + int mode = Orthographic; Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); - aCamera->SetProjectionType( mode == Perspective ? Graphic3d_Camera::Projection_Perspective : Graphic3d_Camera::Projection_Orthographic ); - onViewFitAll(); + if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Perspective) + mode = Perspective; + if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Orthographic) + mode = Orthographic; + #if OCC_VERSION_LARGE > 0x06090000 + if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Stereo) + mode = Stereo; + #endif } - // update action state if method is called outside - QtxAction* a = dynamic_cast( toolMgr()->action( mode == Orthographic ? OrthographicId : PerspectiveId ) ); - if ( ! a->isChecked() ) - a->setChecked( true ); + return mode; } -int OCCViewer_ViewWindow::projectionType() const +void OCCViewer_ViewWindow::setStereoType( int type ) +{ + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); + aParams->StereoMode = (Graphic3d_StereoMode)type; + #endif + } +} + +int OCCViewer_ViewWindow::stereoType() const +{ + int type = QuadBuffer; + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); + type = (OCCViewer_ViewWindow::StereoType)aParams->StereoMode; + #endif + } + return type; +} + +void OCCViewer_ViewWindow::setAnaglyphFilter( int type ) +{ + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); + if (type == RedCyan) + aParams->AnaglyphFilter = Graphic3d_RenderingParams::Anaglyph_RedCyan_Optimized; + if (type == YellowBlue) + aParams->AnaglyphFilter = Graphic3d_RenderingParams::Anaglyph_YellowBlue_Optimized; + if (type == GreenMagenta) + aParams->AnaglyphFilter = Graphic3d_RenderingParams::Anaglyph_GreenMagenta_Simple; + #endif + } +} + +int OCCViewer_ViewWindow::anaglyphFilter() const +{ + int type = RedCyan; + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); + if (aParams->AnaglyphFilter == Graphic3d_RenderingParams::Anaglyph_RedCyan_Optimized) + type = RedCyan; + if (aParams->AnaglyphFilter == Graphic3d_RenderingParams::Anaglyph_YellowBlue_Optimized) + type = YellowBlue; + if (aParams->AnaglyphFilter == Graphic3d_RenderingParams::Anaglyph_GreenMagenta_Simple) + type = GreenMagenta; + #endif + } + return type; +} + +void OCCViewer_ViewWindow::setStereographicFocus( int type, double value ) { - int mode = Orthographic; Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); - mode = aCamera->ProjectionType() == Graphic3d_Camera::Projection_Perspective ? Perspective : Orthographic; + aCamera->SetZFocus( (Graphic3d_Camera::FocusType) type, value ); + #endif } - return mode; +} + +int OCCViewer_ViewWindow::stereographicFocusType() const +{ + int type = Relative; + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); + type = (OCCViewer_ViewWindow::FocusIODType)aCamera->ZFocusType(); + #endif + } + return type; +} + +double OCCViewer_ViewWindow::stereographicFocusValue() const +{ + double value = 1.0; + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); + value = aCamera->ZFocus(); + #endif + } + return value; +} + +void OCCViewer_ViewWindow::setInterocularDistance( int type, double value ) +{ + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); + aCamera->SetIOD( (Graphic3d_Camera::IODType) type, value ); + #endif + } +} + +int OCCViewer_ViewWindow::interocularDistanceType() const +{ + int type = Relative; + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); + type = (OCCViewer_ViewWindow::FocusIODType)aCamera->GetIODType(); + #endif + } + return type; +} + +double OCCViewer_ViewWindow::interocularDistanceValue() const +{ + double value = 0.05; + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); + value = aCamera->IOD(); + #endif + } + return value; +} + +void OCCViewer_ViewWindow::setReverseStereo( bool reverse ) +{ + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); + aParams->ToReverseStereo = reverse; + #endif + } +} + +bool OCCViewer_ViewWindow::isReverseStereo() const +{ + int reverse = false; + Handle(V3d_View) aView3d = myViewPort->getView(); + if ( !aView3d.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); + reverse = aParams->ToReverseStereo; + #endif + } + return reverse; +} + +void OCCViewer_ViewWindow::setVSync( bool enable ) +{ + Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext(); + if ( !anIntCont.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver()); + OpenGl_Caps* aCaps = &aDriver->ChangeOptions(); + aCaps->swapInterval = enable; + #endif + } +} + +bool OCCViewer_ViewWindow::isVSync() const +{ + int enable = true; + Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext(); + if ( !anIntCont.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver()); + OpenGl_Caps* aCaps = &aDriver->ChangeOptions(); + enable = aCaps->swapInterval; + #endif + } + return enable; +} + +void OCCViewer_ViewWindow::setQuadBufferSupport( bool enable ) +{ + Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext(); + if ( !anIntCont.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver()); + OpenGl_Caps* aCaps = &aDriver->ChangeOptions(); + aCaps->contextStereo = enable; + #endif + } +} + +bool OCCViewer_ViewWindow::isQuadBufferSupport() const +{ + int enable = true; + Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext(); + if ( !anIntCont.IsNull() ) { + #if OCC_VERSION_LARGE > 0x06090000 + Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver()); + OpenGl_Caps* aCaps = &aDriver->ChangeOptions(); + enable = aCaps->contextStereo; + #endif + } + return enable; +} + + +bool OCCViewer_ViewWindow::isOpenGlStereoSupport() const +{ + GLboolean support[1]; + glGetBooleanv (GL_STEREO, support); + if ( support[0] ) + return true; + return false; } // obsolete @@ -3077,8 +3688,9 @@ void OCCViewer_ViewWindow::synchronize( SUIT_ViewWindow* theView ) #endif getViewPort()->setAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] ); - +#if OCC_VERSION_LARGE <= 0x07000000 aDestView->ZFitAll(); +#endif aDestView->SetImmediateUpdate( Standard_True ); aDestView->Redraw(); @@ -3166,3 +3778,30 @@ void OCCViewer_ViewWindow::onClipping (bool theIsOn) } } } + +void OCCViewer_ViewWindow::onRayTracing() +{ + if( !OCCViewer_Utilities::isDialogOpened( this, OCCViewer_RayTracingDlg::getName() ) ) { + QDialog* aDlg = new OCCViewer_RayTracingDlg( this ); + if ( aDlg != NULL ) + aDlg->show(); + } +} + +void OCCViewer_ViewWindow::onEnvTexture() +{ + if( !OCCViewer_Utilities::isDialogOpened( this, OCCViewer_EnvTextureDlg::getName() ) ) { + QDialog* aDlg = new OCCViewer_EnvTextureDlg( this ); + if ( aDlg != NULL ) + aDlg->show(); + } +} + +void OCCViewer_ViewWindow::onLightSource() +{ + if( !OCCViewer_Utilities::isDialogOpened( this, OCCViewer_LightSourceDlg::getName() ) ) { + QDialog* aDlg = new OCCViewer_LightSourceDlg( this, myModel ); + if ( aDlg != NULL ) + aDlg->show(); + } +}