#include <QPaintEvent>
#include <QResizeEvent>
#include <QApplication>
+#include <QTimer>
-#include <Visual3d_View.hxx>
-#include <V3d_Viewer.hxx>
-
-#if OCC_VERSION_LARGE > 0x06070100
#include <V3d_View.hxx>
-#else
-#include <V3d_PerspectiveView.hxx>
-#include <V3d_OrthographicView.hxx>
-#endif
+#include <Quantity_Ratio.hxx>
#include "utilities.h"
// VSR: 01/07/2010 commented to avoid SIGSEGV at SALOME exit
//selectVisualId();
-#if OCC_VERSION_LARGE > 0x06070100
myActiveView = new V3d_View( viewer, type );
-#else
- if ( type == V3d_ORTHOGRAPHIC ) {
- myOrthoView = new V3d_OrthographicView( viewer );
- myActiveView = myOrthoView;
- myPerspView = 0;
- } else {
- myPerspView = new V3d_PerspectiveView( viewer );
- myActiveView = myPerspView;
- }
-#endif
setDefaultParams();
refView->Up( x, y, z ); tgtView->SetUp( x, y, z );
refView->Eye( x, y, z ); tgtView->SetEye( x, y, z );
refView->Proj( x, y, z ); tgtView->SetProj( x, y, z );
-#if OCC_VERSION_LARGE <= 0x06070100
- refView->Center( x, y ); tgtView->SetCenter( x, y );
-#endif
tgtView->SetScale( refView->Scale() );
tgtView->SetTwist( refView->Twist() );
/* update */
tgtView->Update();
tgtView->SetImmediateUpdate( Standard_True );
- tgtView->ZFitAll();
- return true;
-}
-/*!
- Returns Z-size of this view. [ public ]
-*/
-double OCCViewer_ViewPort3d::getZSize() const
-{
- if ( !activeView().IsNull() )
- return activeView()->ZSize();
- return 0;
+ return true;
}
-/*!
- Sets Z-size of this view ( for both orthographic and perspective ). [ public ]
-*/
-void OCCViewer_ViewPort3d::setZSize( double zsize )
-{
- myActiveView->SetZSize( zsize );
- /* if ( !myOrthoView.IsNull() )
- myOrthoView->SetZSize( zsize );
- if ( !myPerspView.IsNull() )
- myPerspView->SetZSize( zsize );*/
-}
/*!
Get axial scale to the view
// set texture image: file name and fill mode
switch ( textureMode ) {
case Qtx::CenterTexture:
- activeView()->SetBackgroundImage( fi.absoluteFilePath().toLatin1().constData(), Aspect_FM_CENTERED );
+ activeView()->SetBackgroundImage( fi.absoluteFilePath().toUtf8().constData(), Aspect_FM_CENTERED );
break;
case Qtx::TileTexture:
- activeView()->SetBackgroundImage( fi.absoluteFilePath().toLatin1().constData(), Aspect_FM_TILED );
+ activeView()->SetBackgroundImage( fi.absoluteFilePath().toUtf8().constData(), Aspect_FM_TILED );
break;
case Qtx::StretchTexture:
- activeView()->SetBackgroundImage( fi.absoluteFilePath().toLatin1().constData(), Aspect_FM_STRETCH );
+ activeView()->SetBackgroundImage( fi.absoluteFilePath().toUtf8().constData(), Aspect_FM_STRETCH );
break;
default:
break;
//activeView()->Gravity(gx,gy,gz);
switch ( theRotationPointType ) {
- case OCCViewer_ViewWindow::GRAVITY:
+ case OCCViewer_ViewWindow::BBCENTER:
activeView()->StartRotation( x, y, 0.45 );
break;
case OCCViewer_ViewWindow::SELECTED:
{
if ( !activeView().IsNull() ) {
switch ( theRotationPointType ) {
- case OCCViewer_ViewWindow::GRAVITY:
+ case OCCViewer_ViewWindow::BBCENTER:
activeView()->Rotation( x, y );
break;
case OCCViewer_ViewWindow::SELECTED:
void OCCViewer_ViewPort3d::endRotation()
{
if ( !activeView().IsNull() ) {
- activeView()->ZFitAll( 1.0 );
-#if OCC_VERSION_LARGE <= 0x06070100
- activeView()->SetZSize( 0.0 );
-#endif
activeView()->Update();
emit vpTransformed( this );
}
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QApplication::syncX();
#endif
- QRect rc = e->rect();
- if ( !myPaintersRedrawing )
- activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() );
+ if ( !myPaintersRedrawing ) {
+ activeView()->Redraw();
+ }
}
OCCViewer_ViewPort::paintEvent( e );
myBusy = false;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QApplication::syncX();
#endif
- if ( !activeView().IsNull() )
- activeView()->MustBeResized();
+ QTimer::singleShot( 0, this, SLOT( repaintViewAfterMove() ) );
}
/*!
Moved the viewport
*/
-/*
void OCCViewer_ViewPort3d::repaintViewAfterMove( )
{
if ( !activeView().IsNull() ){
activeView()->MustBeResized();
}
}
-*/
+
/*!
Fits all objects in view. [ virtual protected ]
*/
Standard_Real margin = 0.01;
-#if OCC_VERSION_LARGE > 0x06070100
activeView()->FitAll( margin, upd );
- if(withZ)
- activeView()->ZFitAll();
-#else
- activeView()->FitAll( margin, withZ, upd );
-#endif
- activeView()->SetZSize(0.);
+
emit vpTransformed( this );
}
Handle(V3d_View) aView3d = getView();
Handle(V3d_View) aRefView3d = vp3d->getView();
aView3d->SetImmediateUpdate( Standard_False );
-#if OCC_VERSION_LARGE > 0x06070100
aView3d->Camera()->Copy( aRefView3d->Camera() );
-#else
- aView3d->SetViewMapping( aRefView3d->ViewMapping() );
- aView3d->SetViewOrientation( aRefView3d->ViewOrientation() );
-#endif
- aView3d->ZFitAll();
aView3d->SetImmediateUpdate( Standard_True );
aView3d->Update();
blockSignals( blocked );