-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013 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
#include <Visual3d_View.hxx>
#include <V3d_Viewer.hxx>
+
+#if OCC_VERSION_LARGE > 0x06070000
+#include <V3d_View.hxx>
+#else
#include <V3d_PerspectiveView.hxx>
#include <V3d_OrthographicView.hxx>
+#endif
#include "utilities.h"
-#if defined WNT
+#if defined WIN32
#include <WNT_Window.hxx>
#else
#include <Xw_Window.hxx>
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 ),
myIsAdvancedZoomingEnabled( false )
{
// VSR: 01/07/2010 commented to avoid SIGSEGV at SALOME exit
//selectVisualId();
+#if OCC_VERSION_LARGE > 0x06070000
+ myActiveView = new V3d_View( viewer, type );
+#else
if ( type == V3d_ORTHOGRAPHIC ) {
myOrthoView = new V3d_OrthographicView( viewer );
myActiveView = myOrthoView;
myPerspView = new V3d_PerspectiveView( viewer );
myActiveView = myPerspView;
}
- if ( myDegenerated )
- activeView()->SetDegenerateModeOn();
+#endif
+
setBackground( Qtx::BackgroundData( Qt::black ) ); // set default background
}
view->TriedronDisplay( Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.05, V3d_ZBUFFER );
}
}
+
+ emit( vpMapped() );
+
return true;
}
view->SetBackgroundColor( oldView->BackgroundColor() );
}
- if ( myDegenerated )
- view->SetDegenerateModeOn();
- else
- view->SetDegenerateModeOff();
-
view->View()->Activate();
activeView() = view;
return oldView;
#endif
}
-/*!
- Set animation mode
- \param theDegenerated - degenerated mode
-*/
-void OCCViewer_ViewPort3d::setAnimationMode(bool theDegenerated)
-{
- if ( !activeView().IsNull() ) {
- myAnimate = theDegenerated;
- activeView()->SetAnimationMode(true, theDegenerated);
- }
-}
-
/*!
Updates the active viewport. [ virtual public ]
*/
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);
void OCCViewer_ViewPort3d::endRotation()
{
if ( !activeView().IsNull() ) {
- if (myAnimate) activeView()->SetAnimationModeOff();
- if ( !myDegenerated )
- activeView()->SetDegenerateModeOff();
activeView()->ZFitAll(1.);
activeView()->SetZSize(0.);
activeView()->Update();
*/
void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e )
{
-#ifndef WNT
+#ifndef WIN32
/* X11 : map before show doesn't work */
if ( !mapped( activeView() ) )
mapView( activeView() );
*/
void OCCViewer_ViewPort3d::resizeEvent( QResizeEvent* e )
{
-#ifdef WNT
+#ifdef WIN32
/* Win32 : map before first show to avoid flicker */
if ( !mapped( activeView() ) )
mapView( activeView() );
myScale = activeView()->Scale();
Standard_Real margin = 0.01;
+
+#if OCC_VERSION_LARGE > 0x06070000
+ activeView()->FitAll( margin, upd );
+ if(withZ)
+ activeView()->ZFitAll();
+#else
activeView()->FitAll( margin, withZ, upd );
+#endif
activeView()->SetZSize(0.);
emit vpTransformed( this );
}
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 ) );
+ attachWindow( view, OCCViewer_VService::CreateWindow( view, winId() ) );
myWindow = view->Window();
return !myWindow.IsNull();
Handle(V3d_View) aView3d = getView();
Handle(V3d_View) aRefView3d = vp3d->getView();
aView3d->SetImmediateUpdate( Standard_False );
+#if OCC_VERSION_LARGE > 0x06070000
+ aView3d->Camera()->Copy( aRefView3d->Camera() );
+#else
aView3d->SetViewMapping( aRefView3d->ViewMapping() );
aView3d->SetViewOrientation( aRefView3d->ViewOrientation() );
+#endif
aView3d->ZFitAll();
aView3d->SetImmediateUpdate( Standard_True );
aView3d->Update();