From f25cf2c805de8d3cc2d125282ca6f39e6b5c2b96 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 17 Nov 2009 12:37:01 +0000 Subject: [PATCH] Integrate patch for TRIPOLI --- src/OCCViewer/OCCViewer_VService.cxx | 33 ++- src/OCCViewer/OCCViewer_VService.h | 9 + src/OCCViewer/OCCViewer_ViewPort3d.cxx | 378 +++++++++++++------------ src/OCCViewer/OCCViewer_ViewPort3d.h | 3 + src/OCCViewer/OCCViewer_ViewWindow.cxx | 12 +- 5 files changed, 233 insertions(+), 202 deletions(-) diff --git a/src/OCCViewer/OCCViewer_VService.cxx b/src/OCCViewer/OCCViewer_VService.cxx index e7ba5ea8f..a2217a28b 100755 --- a/src/OCCViewer/OCCViewer_VService.cxx +++ b/src/OCCViewer/OCCViewer_VService.cxx @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #else @@ -82,23 +81,33 @@ return XServiceImageDevice; #endif // WNT /*! - Maps CasCade view to the window [ static ] + Create native view window for CasCade view [ static ] */ -void OCCViewer_VService::SetWindow( const Handle(V3d_View)& view, - const Standard_Integer hiwin, - const Standard_Integer lowin, - const Xw_WindowQuality quality ) +Handle(Aspect_Window) OCCViewer_VService::CreateWindow( const Handle(V3d_View)& view, + const Standard_Integer hiwin, + const Standard_Integer lowin, + const Xw_WindowQuality quality ) { + Handle(Aspect_Window) viewWindow; #ifdef WNT - Handle(WNT_Window) w = - new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin ); - // Prevent flicker + viewWindow = new WNT_Window( Handle(Graphic3d_WNTGraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin ); + // Prevent flickering w->SetFlags( WDF_NOERASEBKGRND ); #else - Handle(Xw_Window) w = - new Xw_Window( Handle(Graphic3d_GraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin, quality ); + viewWindow = new Xw_Window( Handle(Graphic3d_GraphicDevice)::DownCast(view->Viewer()->Device()), hiwin, lowin, quality ); #endif - view->SetWindow( w ); + return viewWindow; +} + +/*! + Maps CasCade view to the window [ static ] +*/ +void OCCViewer_VService::SetWindow( const Handle(V3d_View)& view, + const Standard_Integer hiwin, + const Standard_Integer lowin, + const Xw_WindowQuality quality ) +{ + view->SetWindow( OCCViewer_VService::CreateWindow( view, hiwin, lowin, quality ) ); } /*! diff --git a/src/OCCViewer/OCCViewer_VService.h b/src/OCCViewer/OCCViewer_VService.h index 43298b1f3..2e7b392f6 100755 --- a/src/OCCViewer/OCCViewer_VService.h +++ b/src/OCCViewer/OCCViewer_VService.h @@ -58,6 +58,9 @@ #ifndef _Handle_Aspect_WindowDriver_HeaderFile #include #endif +#ifndef _Handle_Aspect_Window_HeaderFile +#include +#endif class V3d_View; class V2d_View; @@ -90,6 +93,12 @@ public: } // STATIC METHODS + static Handle(Aspect_Window) + CreateWindow( const Handle(V3d_View)& view, + const Standard_Integer hiwin, + const Standard_Integer lowin, + const Xw_WindowQuality quality ); + static void SetWindow( const Handle( V3d_View )& view, const Standard_Integer hiwin, const Standard_Integer lowin, diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index 7fc204ddd..523018d33 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -51,14 +51,14 @@ static int sy = 0; static Standard_Boolean zRotation = Standard_False; /*! - Constructor + Constructor */ OCCViewer_ViewPort3d::OCCViewer_ViewPort3d( QWidget* parent, const Handle( V3d_Viewer)& viewer, V3d_TypeOfView type ) -: OCCViewer_ViewPort( parent ), -myScale( 1.0 ), -myDegenerated( true ), -myAnimate( false ), -myBusy( true ) + : OCCViewer_ViewPort( parent ), + myScale( 1.0 ), + myDegenerated( true ), + myAnimate( false ), + myBusy( true ) { selectVisualId(); @@ -75,7 +75,7 @@ myBusy( true ) } /*! - Destructor + Destructor */ OCCViewer_ViewPort3d::~OCCViewer_ViewPort3d() { @@ -85,41 +85,40 @@ OCCViewer_ViewPort3d::~OCCViewer_ViewPort3d() } /*! - Activates the desired 'type' of view in the viewer - ( view of 'type' is created if it doesn't exist ). [ public ] + Activates the desired 'type' of view in the viewer + ( view of 'type' is created if it doesn't exist ). [ public ] */ /*void OCCViewer_ViewPort3d::setActive( V3d_TypeOfView type ) { - if ( activeView().IsNull() ) - return; - - if ( activeView()->Type() != type ) - { - if ( type == V3d_ORTHOGRAPHIC ) - setView( myOrthoView ); - if ( type == V3d_PERSPECTIVE ) - setView( myPerspView ); - } + if ( activeView().IsNull() ) + return; + + if ( activeView()->Type() != type ) + { + if ( type == V3d_ORTHOGRAPHIC ) + setView( myOrthoView ); + if ( type == V3d_PERSPECTIVE ) + setView( myPerspView ); + } }*/ /*! - Maps CasCade 'view' to this viewport. [ private ] + Maps CasCade 'view' to this viewport. [ private ] */ bool OCCViewer_ViewPort3d::mapView( const Handle(V3d_View)& view ) { if ( !setWindow( view ) ) return false; - if ( !mapped( view ) ) - { - view->SetWindow( myWindow ); - if ( view != activeView() ) - view->View()->Deactivate(); - } + if ( !mapped( view ) ) { + view->SetWindow( myWindow ); + if ( view != activeView() ) + view->View()->Deactivate(); + } /* create static trihedron (16551: EDF PAL 501) */ OCCViewer_ViewWindow* aVW = dynamic_cast( parentWidget() ); - if ( aVW ){ + if ( aVW ) { OCCViewer_Viewer* aViewModel = dynamic_cast( aVW->getViewManager()->getViewModel() ); if ( aViewModel && aViewModel->isStaticTrihedronDisplayed() ){ view->ZBufferTriedronSetup(); @@ -130,7 +129,7 @@ bool OCCViewer_ViewPort3d::mapView( const Handle(V3d_View)& view ) } /*! - Sets new CASCADE view on viewport. Returns the previous active view. [ public ] + Sets new CASCADE view on viewport. Returns the previous active view. [ public ] */ Handle( V3d_View ) OCCViewer_ViewPort3d::setView( const Handle( V3d_View )& view ) { @@ -138,13 +137,14 @@ Handle( V3d_View ) OCCViewer_ViewPort3d::setView( const Handle( V3d_View )& view if ( view == activeView() || !mapView( view ) ) return activeView(); - /* activate the new view*/ + /* activate the new view*/ Handle( V3d_View ) oldView = activeView(); - if ( !oldView.IsNull() ) - { - oldView->View()->Deactivate(); - view->SetBackgroundColor( oldView->BackgroundColor() ); - } + if ( !oldView.IsNull() ) { + if (oldView->View()->IsDefined()) + oldView->View()->Deactivate(); + view->SetBackgroundColor( oldView->BackgroundColor() ); + } + if ( myDegenerated ) view->SetDegenerateModeOn(); else @@ -152,32 +152,32 @@ Handle( V3d_View ) OCCViewer_ViewPort3d::setView( const Handle( V3d_View )& view view->View()->Activate(); activeView() = view; - return oldView; + return oldView; } /*! - Returns CasCade 3D view. [ public ] + Returns CasCade 3D view. [ public ] */ Handle(V3d_View) OCCViewer_ViewPort3d::getView() const { - return activeView(); + return activeView(); } /*! - Returns CasCade 3D viewer [ public ] + Returns CasCade 3D viewer [ public ] */ Handle(V3d_Viewer) OCCViewer_ViewPort3d::getViewer() const { - Handle(V3d_Viewer) viewer; - if ( !activeView().IsNull() ) + Handle(V3d_Viewer) viewer; + if ( !activeView().IsNull() ) viewer = activeView()->Viewer(); - return viewer; + return viewer; } /*! - Syncronizes visual state of this viewport with 'ref' - ( scale, projection, eye etc ) Returns 'true' if copied OK, - 'false' otherwise. [ virtual public ] + Syncronizes visual state of this viewport with 'ref' + ( scale, projection, eye etc ) Returns 'true' if copied OK, + 'false' otherwise. [ virtual public ] */ bool OCCViewer_ViewPort3d::syncronize( const OCCViewer_ViewPort3d* ref ) { @@ -186,11 +186,11 @@ bool OCCViewer_ViewPort3d::syncronize( const OCCViewer_ViewPort3d* ref ) Handle(V3d_View) tgtView = getView(); /* Syncronize view types */ -/* if ( tgtView->Type() != refView->Type() ) - { - setActive( refView->Type() ); - tgtView = getView(); - }*/ + /* if ( tgtView->Type() != refView->Type() ) + { + setActive( refView->Type() ); + tgtView = getView(); + }*/ /* The following params are copied: - view type( ortho/persp ) @@ -208,7 +208,7 @@ bool OCCViewer_ViewPort3d::syncronize( const OCCViewer_ViewPort3d* ref ) /* perspective */ if ( refView->Type() == V3d_PERSPECTIVE ) - tgtView->SetFocale( refView->Focale() ); + tgtView->SetFocale( refView->Focale() ); /* copy params */ Standard_Real x, y, z; @@ -227,7 +227,7 @@ bool OCCViewer_ViewPort3d::syncronize( const OCCViewer_ViewPort3d* ref ) } /*! - Returns Z-size of this view. [ public ] + Returns Z-size of this view. [ public ] */ double OCCViewer_ViewPort3d::getZSize() const { @@ -237,46 +237,44 @@ double OCCViewer_ViewPort3d::getZSize() const } /*! - Sets Z-size of this view ( for both orthographic and perspective ). [ public ] + Sets Z-size of this view ( for both orthographic and perspective ). [ public ] */ void OCCViewer_ViewPort3d::setZSize( double zsize ) { myActiveView->SetZSize( zsize ); -/* if ( !myOrthoView.IsNull() ) + /* if ( !myOrthoView.IsNull() ) myOrthoView->SetZSize( zsize ); - if ( !myPerspView.IsNull() ) + if ( !myPerspView.IsNull() ) myPerspView->SetZSize( zsize );*/ } /*! - Returns the background color [ virtual public ] + Returns the background color [ virtual public ] */ QColor OCCViewer_ViewPort3d::backgroundColor() const { - if ( !activeView().IsNull() ) - { - Standard_Real aRed, aGreen, aBlue; - activeView()->BackgroundColor( Quantity_TOC_RGB, aRed, aGreen, aBlue ); - int red = (int) (aRed * 255); - int green = (int) (aGreen * 255); - int blue = (int) (aBlue * 255); - return QColor( red, green, blue ); - } - return OCCViewer_ViewPort::backgroundColor(); + if ( !activeView().IsNull() ) { + Standard_Real aRed, aGreen, aBlue; + activeView()->BackgroundColor( Quantity_TOC_RGB, aRed, aGreen, aBlue ); + int red = (int) (aRed * 255); + int green = (int) (aGreen * 255); + int blue = (int) (aBlue * 255); + return QColor( red, green, blue ); + } + return OCCViewer_ViewPort::backgroundColor(); } /*! - Sets the background color [ virtual public ] + Sets the background color [ virtual public ] */ void OCCViewer_ViewPort3d::setBackgroundColor( const QColor& color ) { - if ( !activeView().IsNull() ) - { - activeView()->SetBackgroundColor( Quantity_TOC_RGB, color.red()/255., - color.green()/255., color.blue()/255.); - activeView()->Update(); - emit vpChangeBGColor( color ); - } + if ( !activeView().IsNull() ) { + activeView()->SetBackgroundColor( Quantity_TOC_RGB, color.red()/255., + color.green()/255., color.blue()/255.); + activeView()->Update(); + emit vpChangeBGColor( color ); + } } /*! @@ -285,15 +283,14 @@ void OCCViewer_ViewPort3d::setBackgroundColor( const QColor& color ) */ void OCCViewer_ViewPort3d::setAnimationMode(bool theDegenerated) { - if ( !activeView().IsNull() ) - { + if ( !activeView().IsNull() ) { myAnimate = theDegenerated; activeView()->SetAnimationMode(true, theDegenerated); } } /*! - Updates the active viewport. [ virtual public ] + Updates the active viewport. [ virtual public ] */ void OCCViewer_ViewPort3d::onUpdate() { @@ -302,16 +299,16 @@ void OCCViewer_ViewPort3d::onUpdate() } /*! - Called at 'window fit' transformation. [ virtual protected ] + Called at 'window fit' transformation. [ virtual protected ] */ void OCCViewer_ViewPort3d::fitRect( const QRect& rect ) { - if ( !activeView().IsNull() ) - activeView()->WindowFit( rect.left(), rect.top(), rect.right(), rect.bottom() ); + if ( !activeView().IsNull() ) + activeView()->WindowFit( rect.left(), rect.top(), rect.right(), rect.bottom() ); } /*! - Called at 'zoom' transformation. [ virtual protected ] + Called at 'zoom' transformation. [ virtual protected ] */ void OCCViewer_ViewPort3d::zoom( int x0, int y0, int x, int y ) { @@ -324,74 +321,73 @@ void OCCViewer_ViewPort3d::zoom( int x0, int y0, int x, int y ) } /*! - Centers the viewport. [ virtual protected ] + Centers the viewport. [ virtual protected ] */ void OCCViewer_ViewPort3d::setCenter( int x, int y ) { - if ( !activeView().IsNull() ) - activeView()->Place( x, y, myScale ); + if ( !activeView().IsNull() ) + activeView()->Place( x, y, myScale ); } /*! - Called at 'pan' transformation. [ virtual protected ] + Called at 'pan' transformation. [ virtual protected ] */ void OCCViewer_ViewPort3d::pan( int dx, int dy ) { - if ( !activeView().IsNull() ) - activeView()->Pan( dx, dy, 1.0 ); + if ( !activeView().IsNull() ) + activeView()->Pan( dx, dy, 1.0 ); } /*! - Inits 'rotation' transformation. [ protected ] + Inits 'rotation' transformation. [ protected ] */ void OCCViewer_ViewPort3d::startRotation( int x, int y, int theRotationPointType, const gp_Pnt& theSelectedPoint ) { - if ( !activeView().IsNull() ) - { - myDegenerated = activeView()->DegenerateModeIsOn(); - activeView()->SetDegenerateModeOn(); - if (myAnimate) activeView()->SetAnimationModeOn(); - - //double gx, gy, gz; - //double gx = activeView()->gx; - //activeView()->Gravity(gx,gy,gz); - - switch ( theRotationPointType ) { - case OCCViewer_ViewWindow::GRAVITY: - activeView()->StartRotation( x, y, 0.45 ); - break; - case OCCViewer_ViewWindow::SELECTED: - sx = x; sy = y; - - double X,Y; - activeView()->Size(X,Y); - rx = Standard_Real(activeView()->Convert(X)); - ry = Standard_Real(activeView()->Convert(Y)); - - activeView()->Rotate( 0., 0., 0., - theSelectedPoint.X(),theSelectedPoint.Y(), theSelectedPoint.Z(), - Standard_True ); - - Quantity_Ratio zRotationThreshold; - zRotation = Standard_False; - zRotationThreshold = 0.45; - if( zRotationThreshold > 0. ) { - Standard_Real dx = Abs(sx - rx/2.); - Standard_Real dy = Abs(sy - ry/2.); - Standard_Real dd = zRotationThreshold * (rx + ry)/2.; - if( dx > dd || dy > dd ) zRotation = Standard_True; - } - break; - default: - break; + if ( !activeView().IsNull() ) { + myDegenerated = activeView()->DegenerateModeIsOn(); + activeView()->SetDegenerateModeOn(); + if (myAnimate) activeView()->SetAnimationModeOn(); + + //double gx, gy, gz; + //double gx = activeView()->gx; + //activeView()->Gravity(gx,gy,gz); + + switch ( theRotationPointType ) { + case OCCViewer_ViewWindow::GRAVITY: + activeView()->StartRotation( x, y, 0.45 ); + break; + case OCCViewer_ViewWindow::SELECTED: + sx = x; sy = y; + + double X,Y; + activeView()->Size(X,Y); + rx = Standard_Real(activeView()->Convert(X)); + ry = Standard_Real(activeView()->Convert(Y)); + + activeView()->Rotate( 0., 0., 0., + theSelectedPoint.X(),theSelectedPoint.Y(), theSelectedPoint.Z(), + Standard_True ); + + Quantity_Ratio zRotationThreshold; + zRotation = Standard_False; + zRotationThreshold = 0.45; + if( zRotationThreshold > 0. ) { + Standard_Real dx = Abs(sx - rx/2.); + Standard_Real dy = Abs(sy - ry/2.); + Standard_Real dd = zRotationThreshold * (rx + ry)/2.; + if( dx > dd || dy > dd ) zRotation = Standard_True; } + break; + default: + break; } + } } /*! - Rotates the viewport. [ protected ] + Rotates the viewport. [ protected ] */ void OCCViewer_ViewPort3d::rotate( int x, int y, int theRotationPointType, @@ -427,66 +423,63 @@ void OCCViewer_ViewPort3d::rotate( int x, int y, } /*! - Resets the viewport after 'rotation'. [ protected ] + Resets the viewport after 'rotation'. [ protected ] */ void OCCViewer_ViewPort3d::endRotation() { - if ( !activeView().IsNull() ) - { - if (myAnimate) activeView()->SetAnimationModeOff(); - if ( !myDegenerated ) - activeView()->SetDegenerateModeOff(); - activeView()->ZFitAll(1.); - activeView()->SetZSize(0.); - activeView()->Update(); - } + if ( !activeView().IsNull() ) { + if (myAnimate) activeView()->SetAnimationModeOff(); + if ( !myDegenerated ) + activeView()->SetDegenerateModeOff(); + activeView()->ZFitAll(1.); + activeView()->SetZSize(0.); + activeView()->Update(); + } } /*! - Repaints the viewport. [ virtual protected ] + Repaints the viewport. [ virtual protected ] */ void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e ) { #ifndef WNT - /* X11 : map before show doesn't work */ - if ( !mapped( activeView() ) ) - mapView( activeView() ); + /* X11 : map before show doesn't work */ + if ( !mapped( activeView() ) ) + mapView( activeView() ); #endif - if ( !myWindow.IsNull() ) - { - QApplication::syncX(); - QRect rc = e->rect(); - if ( !myPaintersRedrawing ) - activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() ); - } - OCCViewer_ViewPort::paintEvent( e ); - myBusy = false; + if ( !myWindow.IsNull() ) { + QApplication::syncX(); + QRect rc = e->rect(); + if ( !myPaintersRedrawing ) + activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() ); + } + OCCViewer_ViewPort::paintEvent( e ); + myBusy = false; } /*! - Resizes the viewport. [ virtual protected ] + Resizes the viewport. [ virtual protected ] */ void OCCViewer_ViewPort3d::resizeEvent( QResizeEvent* e ) { #ifdef WNT - /* Win32 : map before first show to avoid flicker */ - if ( !mapped( activeView() ) ) - mapView( activeView() ); + /* Win32 : map before first show to avoid flicker */ + if ( !mapped( activeView() ) ) + mapView( activeView() ); #endif - QApplication::syncX(); - if ( !activeView().IsNull() ) - activeView()->MustBeResized(); + QApplication::syncX(); + if ( !activeView().IsNull() ) + activeView()->MustBeResized(); } /*! - Fits all objects in view. [ virtual protected ] + Fits all objects in view. [ virtual protected ] */ void OCCViewer_ViewPort3d::fitAll( bool keepScale, bool withZ, bool upd ) { if ( activeView().IsNull() ) return; - if ( keepScale ) myScale = activeView()->Scale(); @@ -496,59 +489,68 @@ void OCCViewer_ViewPort3d::fitAll( bool keepScale, bool withZ, bool upd ) } /*! - Resets the view. [ virtual protected ] + Resets the view. [ virtual protected ] */ void OCCViewer_ViewPort3d::reset() { -// double zsize = getZSize(); - if ( !activeView().IsNull() ) - activeView()->Reset(); -// setZSize( zsize ); + // double zsize = getZSize(); + if ( !activeView().IsNull() ) + activeView()->Reset(); + // setZSize( zsize ); } /*! - Passed the handle of native window of the component to CASCADE view. [ private ] + Passed the handle of native window of the component to CASCADE view. [ private ] */ bool OCCViewer_ViewPort3d::setWindow( const Handle(V3d_View)& view ) { - if ( !myWindow.IsNull() ) - return true; - - if ( view.IsNull() ) - return false; - - int hwnd = (int)winId(); - if ( !hwnd ) - return false; - - /* set this widget as the drawing window */ - short lo = (short)hwnd; - short hi = (short)( hwnd >> 16 ); - OCCViewer_VService::SetWindow( view, (int)hi, (int)lo, Xw_WQ_SAMEQUALITY ); - myWindow = view->Window(); - return !myWindow.IsNull(); + if ( !myWindow.IsNull() ) + return true; + + if ( view.IsNull() ) + return false; + + int hwnd = (int)winId(); + if ( !hwnd ) + return false; + + /* set this widget as the drawing window */ + short lo = (short)hwnd; + short hi = (short)( hwnd >> 16 ); + + attachWindow( view, OCCViewer_VService::CreateWindow( view, (int)hi, (int)lo, Xw_WQ_SAMEQUALITY ) ); + + myWindow = view->Window(); + return !myWindow.IsNull(); +} + +void OCCViewer_ViewPort3d::attachWindow( const Handle(V3d_View)& view, + const Handle(Aspect_Window)& window) +{ + if (!view.IsNull()) + view->SetWindow( window ); } /*! - Returns the current active view. [ private ] + Returns the current active view. [ private ] */ Handle(V3d_View) OCCViewer_ViewPort3d::activeView() const { - return myActiveView; + return myActiveView; } /*! - Returns the current inactive view [ private ] + Returns the current inactive view [ private ] */ /*Handle(V3d_View) OCCViewer_ViewPort3d::inactiveView() const -{ - return ( activeView() == myOrthoView ? myPerspView : myOrthoView ); -}*/ + { + return ( activeView() == myOrthoView ? myPerspView : myOrthoView ); + }*/ /*! - Returns 'true' if the given view is mapped to window. [ private ] + Returns 'true' if the given view is mapped to window. [ private ] */ bool OCCViewer_ViewPort3d::mapped( const Handle(V3d_View)& view ) const { - return ( !view.IsNull() && view->View()->IsDefined() ); + return ( !view.IsNull() && view->View()->IsDefined() ); } diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.h b/src/OCCViewer/OCCViewer_ViewPort3d.h index efa011d4b..41d2c6744 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.h +++ b/src/OCCViewer/OCCViewer_ViewPort3d.h @@ -81,6 +81,9 @@ protected: virtual void paintEvent( QPaintEvent* ); virtual void resizeEvent( QResizeEvent* ); + // initialization + virtual void attachWindow( const Handle(V3d_View)&, const Handle(Aspect_Window)& ); + private: Handle(V3d_View) activeView() const; Handle(V3d_View) inactiveView() const; diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 21b36661e..82c6c3011 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -1164,6 +1164,7 @@ void OCCViewer_ViewWindow::onFrontView() Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Xpos); onViewFitAll(); + emit vpTransformationFinished ( FRONTVIEW ); } /*! @@ -1175,6 +1176,7 @@ void OCCViewer_ViewWindow::onBackView() Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Xneg); onViewFitAll(); + emit vpTransformationFinished ( BACKVIEW ); } /*! @@ -1186,6 +1188,7 @@ void OCCViewer_ViewWindow::onTopView() Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Zpos); onViewFitAll(); + emit vpTransformationFinished ( TOPVIEW ); } /*! @@ -1197,6 +1200,7 @@ void OCCViewer_ViewWindow::onBottomView() Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Zneg); onViewFitAll(); + emit vpTransformationFinished ( BOTTOMVIEW ); } /*! @@ -1208,6 +1212,7 @@ void OCCViewer_ViewWindow::onLeftView() Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Yneg); onViewFitAll(); + emit vpTransformationFinished ( LEFTVIEW ); } /*! @@ -1219,6 +1224,7 @@ void OCCViewer_ViewWindow::onRightView() Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) aView3d->SetProj (V3d_Ypos); onViewFitAll(); + emit vpTransformationFinished ( RIGHTVIEW ); } /*! @@ -1234,6 +1240,7 @@ void OCCViewer_ViewWindow::onResetView() myViewPort->fitAll( false, true, false ); myViewPort->getView()->SetImmediateUpdate( upd ); myViewPort->getView()->Update(); + emit vpTransformationFinished( RESETVIEW ); } /*! @@ -1243,6 +1250,7 @@ void OCCViewer_ViewWindow::onFitAll() { emit vpTransformationStarted( FITALLVIEW ); myViewPort->fitAll(); + emit vpTransformationFinished( FITALLVIEW ); } /*! @@ -1433,9 +1441,9 @@ bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img, Handle(Visual3d_View) a3dView = myViewPort->getView()->View(); if (format == "PS") - a3dView->Export(qPrintable(fileName), Graphic3d_EF_PostScript); + a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_PostScript); else if (format == "EPS") - a3dView->Export(qPrintable(fileName), Graphic3d_EF_EnhPostScript); + a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_EnhPostScript); return true; } -- 2.39.2