QPoint c = center();
double x1, y1, z1, x2, y2, z2;
main->getView()->Convert( main->width()/2, main->height()/2, x1, y1, z1 );
+
+ // Patch for OCCT 6.9.1, on 7.0.0 the moving of point to plane XY is not necessary
+ gp_Dir dm = main->getView()->Camera()->Direction();
+ double t1 = -z1/dm.Z();
+ x1 += dm.X()*t1;
+ y1 += dm.Y()*t1;
+ z1 += dm.Z()*t1;
+
overview->getView()->Convert( c.x(), c.y(), x2, y2, z2 );
+ gp_Dir dov = overview->getView()->Camera()->Direction();
+ double t2 = -z2/dov.Z();
+ x2 += dov.X()*t2;
+ y2 += dov.Y()*t2;
+ z2 += dov.Z()*t2;
gp_Trsf aTrsf;
aTrsf.SetTranslation( gp_Pnt( x1, y1, z1 ), gp_Pnt( x2, y2, z2 ) );
- main->getView()->Camera()->Transform( aTrsf );
+
+ // Temporary patch for bug in OCCT 6.9.1
+ Handle(Graphic3d_Camera) cam = main->getView()->Camera();
+ gp_Dir u = cam->Up(), nu = u.Transformed (aTrsf);
+ gp_Pnt e = cam->Eye(), ne = e.Transformed (aTrsf);
+ gp_Pnt cen = cam->Center(), ncen = cen.Transformed (aTrsf);
+
+ if (!nu.IsEqual (u, 0.0))
+ cam->SetUp(nu);
+
+ if (!ne.IsEqual (e, 0.0))
+ cam->SetEye(ne);
+
+ if (!ncen.IsEqual(cen, 0.0))
+ cam->SetCenter (ncen);
+
+ //version for new OCCT:
+ //main->getView()->Camera()->Transform( aTrsf );
main->repaint();
}
}
if( !myViewPort )
{
myViewPort = new OCCViewer_ViewPort3d( this, myMainView->getViewPort()->getViewer(), V3d_ORTHOGRAPHIC );
- //myViewPort->setBackgroundColor( Qt::white );
+ myViewPort->setBackgroundColor( myMainView->getViewPort()->backgroundColor() );
connect( myViewPort, SIGNAL( vpMouseEvent( QMouseEvent* ) ),
this, SLOT( OnMouseEvent( QMouseEvent* ) ) );