\r
#include <gp_Dir.hxx>\r
#include <gp_Pln.hxx>\r
+#include <gp_GTrsf.hxx>\r
#include <TColgp_Array1OfPnt2d.hxx>\r
\r
#if OCC_VERSION_LARGE > 0x06060000 \r
*/\r
bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, double& theZ )\r
{\r
- Handle(Visual3d_View) aView = myViewPort->getView()->View();\r
-\r
- Standard_Real Xmin,Ymin,Zmin,Xmax,Ymax,Zmax,U,V,W ;\r
- Standard_Real Umin,Vmin,Umax,Vmax ;\r
- Standard_Integer Nstruct,Npoint ;\r
- Graphic3d_MapOfStructure MySetOfStructures;\r
+ Handle(V3d_View) aView3d = myViewPort->getView();\r
\r
- aView->DisplayedStructures (MySetOfStructures);\r
- Nstruct = MySetOfStructures.Extent() ;\r
+ // Project boundaries points and add to avergae gravity\r
+ // the ones which lie within the screen limits\r
+ Standard_Real aScreenLimits[4] = { 0.0, 0.0, 0.0, 0.0 };\r
\r
- Graphic3d_MapIteratorOfMapOfStructure MyIterator(MySetOfStructures) ;\r
#if OCC_VERSION_LARGE > 0x06070000\r
- aView->Camera()->WindowLimit(Umin,Vmin,Umax,Vmax);\r
+ // NDC space screen limits\r
+ aScreenLimits[0] = -1.0;\r
+ aScreenLimits[1] = 1.0;\r
+ aScreenLimits[2] = -1.0;\r
+ aScreenLimits[3] = 1.0;\r
#else\r
- aView->ViewMapping().WindowLimit(Umin,Vmin,Umax,Vmax);\r
+ aView3d->View()->ViewMapping().WindowLimit( aScreenLimits[0],\r
+ aScreenLimits[1],\r
+ aScreenLimits[2],\r
+ aScreenLimits[3] );\r
#endif\r
- Npoint = 0 ; theX = theY = theZ = 0. ;\r
- for( ; MyIterator.More(); MyIterator.Next()) {\r
- if (!(MyIterator.Key())->IsEmpty()) {\r
- (MyIterator.Key())->MinMaxValues(Xmin,Ymin,Zmin,\r
- Xmax,Ymax,Zmax) ;\r
-\r
- Standard_Real LIM = ShortRealLast() -1.;\r
- if (! (fabs(Xmin) > LIM || fabs(Ymin) > LIM || fabs(Zmin) > LIM\r
- || fabs(Xmax) > LIM || fabs(Ymax) > LIM || fabs(Zmax) > LIM )) {\r
-\r
- aView->Projects(Xmin,Ymin,Zmin,U,V,W) ;\r
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {\r
- Npoint++ ; theX += Xmin ; theY += Ymin ; theZ += Zmin ;\r
- }\r
- aView->Projects(Xmax,Ymin,Zmin,U,V,W) ;\r
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {\r
- Npoint++ ; theX += Xmax ; theY += Ymin ; theZ += Zmin ;\r
- }\r
- aView->Projects(Xmin,Ymax,Zmin,U,V,W) ;\r
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {\r
- Npoint++ ; theX += Xmin ; theY += Ymax ; theZ += Zmin ;\r
- }\r
- aView->Projects(Xmax,Ymax,Zmin,U,V,W) ;\r
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {\r
- Npoint++ ; theX += Xmax ; theY += Ymax ; theZ += Zmin ;\r
- }\r
- aView->Projects(Xmin,Ymin,Zmax,U,V,W) ;\r
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {\r
- Npoint++ ; theX += Xmin ; theY += Ymin ; theZ += Zmax ;\r
- }\r
- aView->Projects(Xmax,Ymin,Zmax,U,V,W) ;\r
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {\r
- Npoint++ ; theX += Xmax ; theY += Ymin ; theZ += Zmax ;\r
- }\r
- aView->Projects(Xmin,Ymax,Zmax,U,V,W) ;\r
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {\r
- Npoint++ ; theX += Xmin ; theY += Ymax ; theZ += Zmax ;\r
- }\r
- aView->Projects(Xmax,Ymax,Zmax,U,V,W) ;\r
- if( U >= Umin && U <= Umax && V >= Vmin && V <= Vmax ) {\r
- Npoint++ ; theX += Xmax ; theY += Ymax ; theZ += Zmax ;\r
- }\r
+\r
+ Standard_Integer aPointsNb = 0;\r
+\r
+ Standard_Real aXmin = 0.0;\r
+ Standard_Real aYmin = 0.0;\r
+ Standard_Real aZmin = 0.0;\r
+ Standard_Real aXmax = 0.0;\r
+ Standard_Real aYmax = 0.0;\r
+ Standard_Real aZmax = 0.0;\r
+\r
+ Graphic3d_MapOfStructure aSetOfStructures;\r
+ aView3d->View()->DisplayedStructures( aSetOfStructures );\r
+ Graphic3d_MapIteratorOfMapOfStructure aStructureIt( aSetOfStructures );\r
+\r
+ for( ; aStructureIt.More(); aStructureIt.Next() ) {\r
+ const Handle(Graphic3d_Structure)& aStructure = aStructureIt.Key();\r
+ if ( aStructure->IsEmpty() ) {\r
+ continue;\r
+ }\r
+\r
+ aStructure->MinMaxValues( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );\r
+\r
+ // Infinite structures are skipped\r
+ Standard_Real aLIM = ShortRealLast() - 1.0;\r
+ if ( Abs( aXmin ) > aLIM || Abs( aYmin ) > aLIM || Abs( aZmin ) > aLIM\r
+ || Abs( aXmax ) > aLIM || Abs( aYmax ) > aLIM || Abs( aZmax ) > aLIM ) {\r
+ continue;\r
+ }\r
+\r
+ gp_Pnt aPoints[8] = {
+ gp_Pnt( aXmin, aYmin, aZmin ), gp_Pnt( aXmin, aYmin, aZmax ),
+ gp_Pnt( aXmin, aYmax, aZmin ), gp_Pnt( aXmin, aYmax, aZmax ),
+ gp_Pnt( aXmax, aYmin, aZmin ), gp_Pnt( aXmax, aYmin, aZmax ),
+ gp_Pnt( aXmax, aYmax, aZmin ), gp_Pnt( aXmax, aYmax, aZmax )
+ };
+\r
+ for ( Standard_Integer aPointIt = 0; aPointIt < 8; ++aPointIt ) {\r
+ const gp_Pnt& aBBPoint = aPoints[aPointIt];
+
+#if OCC_VERSION_LARGE > 0x06070000
+ gp_Pnt aProjected = aView3d->Camera()->Project( aBBPoint );
+ const Standard_Real& U = aProjected.X();
+ const Standard_Real& V = aProjected.Y();
+#else
+ Standard_Real U = 0.0;
+ Standard_Real V = 0.0;
+ Standard_Real W = 0.0;
+ aView3d->View()->Projects( aBBPoint.X(), aBBPoint.Y(), aBBPoint.Z(), U, V, W );
+#endif
+
+ if (U >= aScreenLimits[0]
+ && U <= aScreenLimits[1]
+ && V >= aScreenLimits[2]
+ && V <= aScreenLimits[3])
+ {
+ aPointsNb++;
+ theX += aBBPoint.X();
+ theY += aBBPoint.Y();
+ theZ += aBBPoint.Z();
}\r
}\r
}\r
- if( Npoint > 0 ) {\r
- theX /= Npoint ; theY /= Npoint ; theZ /= Npoint ;\r
+\r
+ if ( aPointsNb > 0 )\r
+ {\r
+ theX /= aPointsNb;\r
+ theY /= aPointsNb;\r
+ theZ /= aPointsNb;\r
}\r
return true;\r
}\r
\r
Standard_Boolean prev = aView3d->SetImmediateUpdate( Standard_False );\r
aView3d->SetScale( anItem.scale );\r
- aView3d->SetCenter( anItem.centerX, anItem.centerY );\r
aView3d->SetTwist( anItem.twist );\r
aView3d->SetAt( anItem.atX, anItem.atY, anItem.atZ );\r
aView3d->SetImmediateUpdate( prev );\r
aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ );\r
aView3d->SetAxialScale( anItem.scaleX, anItem.scaleY, anItem.scaleZ );\r
\r
+#if OCC_VERSION_LARGE > 0x06070000\r
+ if ( anItem.centerX != 0.0 || anItem.centerY != 0.0 )\r
+ {\r
+ double anUpX = 0.0, anUpY = 0.0, anUpZ = 0.0;\r
+\r
+ // "eye" and "at" require conversion to represent center panning\r
+ // up direction is only available after setting angle of twist and\r
+ // other view parameters\r
+ aView3d->Up( anUpX, anUpY, anUpZ );\r
+\r
+ gp_Dir aProj( -anItem.projX, -anItem.projY, -anItem.projZ );\r
+ gp_Dir anUp( anUpX, anUpY, anUpZ );\r
+ gp_Pnt anAt( anItem.atX, anItem.atY, anItem.atZ );\r
+ gp_Pnt anEye( anItem.eyeX, anItem.eyeY, anItem.eyeZ );\r
+ gp_Dir aSide = aProj ^ anUp;\r
+\r
+ anAt.Translate( gp_Vec( aSide ) * anItem.centerX );\r
+ anAt.Translate( gp_Vec( anUp ) * anItem.centerY );\r
+\r
+ aView3d->SetAt( anAt.X(), anAt.Y(), anAt.Z() );\r
+ aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ );\r
+ }\r
+#else\r
+ aView3d->SetCenter( anItem.centerX, anItem.centerY );\r
+#endif\r
+\r
if ( !baseParamsOnly ) {\r
\r
myModel->setTrihedronShown( anItem.isVisible );\r
*/\r
viewAspect OCCViewer_ViewWindow::getViewParams() const\r
{\r
- double centerX, centerY, projX, projY, projZ, twist;\r
+ double projX, projY, projZ, twist;\r
double atX, atY, atZ, eyeX, eyeY, eyeZ;\r
double aScaleX, aScaleY, aScaleZ;\r
\r
Handle(V3d_View) aView3d = myViewPort->getView();\r
\r
- aView3d->Center( centerX, centerY );\r
aView3d->Proj( projX, projY, projZ );\r
aView3d->At( atX, atY, atZ );\r
aView3d->Eye( eyeX, eyeY, eyeZ );\r
\r
viewAspect params;\r
params.scale = aView3d->Scale();\r
- params.centerX = centerX;\r
- params.centerY = centerY;\r
params.projX = projX;\r
params.projY = projY;\r
params.projZ = projZ;\r
params.isVisible= isShown;\r
params.size = size;\r
\r
+#if OCC_VERSION_LARGE <= 0x06070000 // the property is deprecated in OCCT 6.7.1\r
+ aView3d->Center( params.centerX, params.centerY );\r
+#endif\r
+\r
#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version\r
// graduated trihedron\r
bool anIsVisible = false;\r
QStringList data;\r
\r
data << QString( "scale=%1" ) .arg( params.scale, 0, 'e', 12 );\r
+#if OCC_VERSION_LARGE <= 0x06070000 // the property is deprecated in OCCT 6.7.1\r
data << QString( "centerX=%1" ) .arg( params.centerX, 0, 'e', 12 );\r
data << QString( "centerY=%1" ) .arg( params.centerY, 0, 'e', 12 );\r
+#endif\r
data << QString( "projX=%1" ) .arg( params.projX, 0, 'e', 12 );\r
data << QString( "projY=%1" ) .arg( params.projY, 0, 'e', 12 );\r
data << QString( "projZ=%1" ) .arg( params.projZ, 0, 'e', 12 );\r
aProps.setDimension( SUIT_CameraProperties::Dim2D );\r
aProps.setViewSide( (SUIT_CameraProperties::ViewSide)(int)get2dMode() );\r
}\r
- \r
+\r
// read common properites of the view\r
- Standard_Real anUpDir[3];\r
- Standard_Real aPrjDir[3];\r
- Standard_Real aMapScale[2];\r
- Standard_Real aTranslation[3];\r
+ Standard_Real anUp[3];\r
+ Standard_Real anAt[3];\r
+ Standard_Real anEye[3];\r
+ Standard_Real aProj[3];\r
Standard_Real anAxialScale[3];\r
- \r
- aSourceView->Up(anUpDir[0], anUpDir[1], anUpDir[2]);\r
- aSourceView->Proj(aPrjDir[0], aPrjDir[1], aPrjDir[2]);\r
- aSourceView->At(aTranslation[0], aTranslation[1], aTranslation[2]);\r
- aSourceView->Size(aMapScale[0], aMapScale[1]);\r
\r
- getViewPort()->getAxialScale(anAxialScale[0], anAxialScale[1], anAxialScale[2]);\r
+ aSourceView->Up( anUp[0], anUp[1], anUp[2] );\r
+ aSourceView->At( anAt[0], anAt[1], anAt[2] );\r
+ aSourceView->Proj( aProj[0], aProj[1], aProj[2] );\r
+ getViewPort()->getAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] );\r
+\r
+ aProps.setAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] );\r
+ aProps.setViewUp( anUp[0], anUp[1], anUp[2] );\r
+\r
+#if OCC_VERSION_LARGE > 0x06070000\r
+ aSourceView->Eye( anEye[0], anEye[1], anEye[2] );\r
+\r
+ // store camera properties "as is": it is up to synchronized\r
+ // view classes to provide necessary property conversion.\r
+ aProps.setPosition( anEye[0], anEye[1], anEye[2] );\r
+ aProps.setFocalPoint( anAt[0], anAt[1], anAt[2] );\r
\r
- // we use similar depth to the one used in perspective projection \r
- // to proivde a convinience synchronization with other camera views that\r
- // can switch between orthogonal & perspective projection. otherwise,\r
- // the camera will get to close when switching from orthogonal to perspective.\r
+ if ( aSourceView->Camera()->IsOrthographic() )\r
+ {\r
+ aProps.setProjection( SUIT_CameraProperties::PrjOrthogonal );\r
+ aProps.setViewAngle( 0.0 );\r
+ }\r
+ else\r
+ {\r
+ aProps.setProjection( SUIT_CameraProperties::PrjPerspective );\r
+ aProps.setViewAngle( aSourceView->Camera()->FOVy() );\r
+ }\r
+ aProps.setMappingScale( aSourceView->Camera()->Scale() );\r
+#else\r
Standard_Real aCameraDepth = aSourceView->Depth() + aSourceView->ZSize() * 0.5;\r
\r
- // store common props\r
- aProps.setViewUp(anUpDir[0], anUpDir[1], anUpDir[2]);\r
- aProps.setMappingScale(aMapScale[1] / 2.0);\r
- aProps.setAxialScale(anAxialScale[0], anAxialScale[1], anAxialScale[2]);\r
- \r
// generate view orientation matrix for transforming OCC projection reference point\r
// into a camera (eye) position.\r
- gp_Dir aLeftDir = gp_Dir(anUpDir[0], anUpDir[1], anUpDir[2]).Crossed(\r
- gp_Dir(aPrjDir[0], aPrjDir[1], aPrjDir[2]));\r
+ gp_Dir aLeftDir = gp_Dir( anUp[0], anUp[1], anUp[2] ) ^ gp_Dir( aProj[0], aProj[1], aProj[2] );\r
\r
- gp_Trsf aTrsf;\r
- aTrsf.SetValues( aLeftDir.X(), anUpDir[0], aPrjDir[0], aTranslation[0],\r
- aLeftDir.Y(), anUpDir[1], aPrjDir[1], aTranslation[1],\r
- aLeftDir.Z(), anUpDir[2], aPrjDir[2], aTranslation[2],\r
- Precision::Confusion(),\r
- Precision::Confusion() );\r
+ gp_GTrsf aTrsf;\r
+ aTrsf.SetValue( 1, 1, aLeftDir.X() );\r
+ aTrsf.SetValue( 2, 1, aLeftDir.Y() );\r
+ aTrsf.SetValue( 3, 1, aLeftDir.Z() );\r
+\r
+ aTrsf.SetValue( 1, 2, anUp[0] );\r
+ aTrsf.SetValue( 2, 2, anUp[1] );\r
+ aTrsf.SetValue( 3, 2, anUp[2] );\r
+\r
+ aTrsf.SetValue( 1, 3, aProj[0] );\r
+ aTrsf.SetValue( 2, 3, aProj[1] );\r
+ aTrsf.SetValue( 3, 3, aProj[2] );\r
+\r
+ aTrsf.SetValue( 1, 4, anAt[0] );\r
+ aTrsf.SetValue( 2, 4, anAt[1] );\r
+ aTrsf.SetValue( 3, 4, anAt[2] );\r
\r
-// get projection reference point in view coordinates\r
-#if OCC_VERSION_LARGE > 0x06070000\r
- gp_Pnt aProjRef = aSourceView->Camera()->ProjectionShift();\r
- aProjRef.SetX( -aProjRef.X() );\r
- aProjRef.SetY( -aProjRef.Y() );\r
-#else\r
Graphic3d_Vertex aProjRef = aSourceView->ViewMapping().ProjectionReferencePoint();\r
-#endif\r
\r
// transform to world-space coordinate system\r
- gp_Pnt aPosition = gp_Pnt(aProjRef.X(), aProjRef.Y(), aCameraDepth).Transformed(aTrsf);\r
- \r
+ gp_XYZ aPosition( aProjRef.X(), aProjRef.Y(), aCameraDepth );\r
+ aTrsf.Transforms( aPosition );\r
+\r
// compute focal point\r
double aFocalPoint[3];\r
\r
- aFocalPoint[0] = aPosition.X() - aPrjDir[0] * aCameraDepth;\r
- aFocalPoint[1] = aPosition.Y() - aPrjDir[1] * aCameraDepth;\r
- aFocalPoint[2] = aPosition.Z() - aPrjDir[2] * aCameraDepth;\r
+ aFocalPoint[0] = aPosition.X() - aProj[0] * aCameraDepth;\r
+ aFocalPoint[1] = aPosition.Y() - aProj[1] * aCameraDepth;\r
+ aFocalPoint[2] = aPosition.Z() - aProj[2] * aCameraDepth;\r
+\r
+ aProps.setFocalPoint( aFocalPoint[0], aFocalPoint[1], aFocalPoint[2] );\r
+ aProps.setPosition( aPosition.X(), aPosition.Y(), aPosition.Z() );\r
\r
- aProps.setFocalPoint(aFocalPoint[0], aFocalPoint[1], aFocalPoint[2]);\r
- aProps.setPosition(aPosition.X(), aPosition.Y(), aPosition.Z());\r
+ Standard_Real aViewScale[2];\r
+ aSourceView->Size( aViewScale[0], aViewScale[1] );\r
+ aProps.setMappingScale( aViewScale[1] );\r
+#endif\r
\r
return aProps;\r
}\r
double anUpDir[3];\r
double aPosition[3];\r
double aFocalPoint[3];\r
- double aMapScaling;\r
double anAxialScale[3];\r
\r
// get common properties\r
- aProps.getFocalPoint(aFocalPoint[0], aFocalPoint[1], aFocalPoint[2]);\r
- aProps.getPosition(aPosition[0], aPosition[1], aPosition[2]);\r
- aProps.getViewUp(anUpDir[0], anUpDir[1], anUpDir[2]);\r
- aProps.getAxialScale(anAxialScale[0], anAxialScale[1], anAxialScale[2]);\r
- aMapScaling = aProps.getMappingScale() * 2.0;\r
-\r
- gp_Dir aProjDir(aPosition[0] - aFocalPoint[0],\r
- aPosition[1] - aFocalPoint[1],\r
- aPosition[2] - aFocalPoint[2]);\r
- \r
+ aProps.getFocalPoint( aFocalPoint[0], aFocalPoint[1], aFocalPoint[2] );\r
+ aProps.getPosition( aPosition[0], aPosition[1], aPosition[2] );\r
+ aProps.getViewUp( anUpDir[0], anUpDir[1], anUpDir[2] );\r
+ aProps.getAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] );\r
+\r
+#if OCC_VERSION_LARGE > 0x06070000\r
+ aDestView->SetAt( aFocalPoint[0], aFocalPoint[1], aFocalPoint[2] );\r
+ aDestView->SetEye( aPosition[0], aPosition[1], aPosition[2] );\r
+ aDestView->SetUp( anUpDir[0], anUpDir[1], anUpDir[2] );\r
+ aDestView->Camera()->SetScale( aProps.getMappingScale() );\r
+#else\r
+ gp_Dir aProjDir( aPosition[0] - aFocalPoint[0],\r
+ aPosition[1] - aFocalPoint[1],\r
+ aPosition[2] - aFocalPoint[2] );\r
+\r
// get custom view translation\r
Standard_Real aTranslation[3];\r
- aDestView->At(aTranslation[0], aTranslation[1], aTranslation[2]);\r
-\r
- gp_Dir aLeftDir = gp_Dir(anUpDir[0], anUpDir[1], anUpDir[2]).Crossed(\r
- gp_Dir(aProjDir.X(), aProjDir.Y(), aProjDir.Z()));\r
-\r
- // convert camera position into a view reference point\r
- gp_Trsf aTrsf;\r
- aTrsf.SetValues( aLeftDir.X(), anUpDir[0], aProjDir.X(), aTranslation[0],\r
- aLeftDir.Y(), anUpDir[1], aProjDir.Y(), aTranslation[1],\r
- aLeftDir.Z(), anUpDir[2], aProjDir.Z(), aTranslation[2], \r
- Precision::Confusion(),\r
- Precision::Confusion() );\r
+ aDestView->At( aTranslation[0], aTranslation[1], aTranslation[2] );\r
+\r
+ gp_Dir aLeftDir = gp_Dir( anUpDir[0], anUpDir[1], anUpDir[2] )\r
+ ^ gp_Dir( aProjDir.X(), aProjDir.Y(), aProjDir.Z() );\r
+\r
+ gp_GTrsf aTrsf;\r
+ aTrsf.SetValue( 1, 1, aLeftDir.X() );\r
+ aTrsf.SetValue( 2, 1, aLeftDir.Y() );\r
+ aTrsf.SetValue( 3, 1, aLeftDir.Z() );\r
+\r
+ aTrsf.SetValue( 1, 2, anUpDir[0] );\r
+ aTrsf.SetValue( 2, 2, anUpDir[1] );\r
+ aTrsf.SetValue( 3, 2, anUpDir[2] );\r
+\r
+ aTrsf.SetValue( 1, 3, aProjDir.X() );\r
+ aTrsf.SetValue( 2, 3, aProjDir.Y() );\r
+ aTrsf.SetValue( 3, 3, aProjDir.Z() );\r
+\r
+ aTrsf.SetValue( 1, 4, aTranslation[0] );\r
+ aTrsf.SetValue( 2, 4, aTranslation[1] );\r
+ aTrsf.SetValue( 3, 4, aTranslation[2] );\r
aTrsf.Invert();\r
\r
// transform to view-space coordinate system\r
- gp_Pnt aProjRef(aPosition[0], aPosition[1], aPosition[2]);\r
- aProjRef.Transform(aTrsf);\r
+ gp_XYZ aProjRef( aPosition[0], aPosition[1], aPosition[2] );\r
+ aTrsf.Transforms( aProjRef );\r
\r
-#if OCC_VERSION_LARGE > 0x06070000\r
- aDestView->Camera()->SetDirection( -aProjDir );\r
- aDestView->Camera()->SetUp( gp_Dir( anUpDir[0], anUpDir[1], anUpDir[2] ) );\r
- aDestView->Camera()->SetProjectionShift( gp_Pnt( -aProjRef.X(), -aProjRef.Y(), 0.0 ) );\r
-#else\r
// set view camera properties using low-level approach. this is done\r
// in order to avoid interference with static variables in v3d view used\r
// when rotation is in process in another view.\r
Visual3d_ViewMapping aMapping = aDestView->View()->ViewMapping();\r
Visual3d_ViewOrientation anOrientation = aDestView->View()->ViewOrientation();\r
\r
- Graphic3d_Vector aMappingProj(aProjDir.X(), aProjDir.Y(), aProjDir.Z());\r
- Graphic3d_Vector aMappingUp(anUpDir[0], anUpDir[1], anUpDir[2]);\r
+ Graphic3d_Vector aMappingProj( aProjDir.X(), aProjDir.Y(), aProjDir.Z() );\r
+ Graphic3d_Vector aMappingUp( anUpDir[0], anUpDir[1], anUpDir[2] );\r
\r
aMappingProj.Normalize();\r
aMappingUp.Normalize();\r
\r
- anOrientation.SetViewReferencePlane(aMappingProj);\r
- anOrientation.SetViewReferenceUp(aMappingUp);\r
+ anOrientation.SetViewReferencePlane( aMappingProj );\r
+ anOrientation.SetViewReferenceUp( aMappingUp );\r
\r
- aDestView->SetViewMapping(aMapping);\r
- aDestView->SetViewOrientation(anOrientation);\r
+ aDestView->SetViewMapping( aMapping );\r
+ aDestView->SetViewOrientation( anOrientation );\r
\r
// set panning\r
- aDestView->SetCenter(aProjRef.X(), aProjRef.Y());\r
-#endif\r
+ aDestView->SetCenter( aProjRef.X(), aProjRef.Y() );\r
\r
// set mapping scale\r
+ double aMapScaling = aProps.getMappingScale();\r
Standard_Real aWidth, aHeight;\r
- aDestView->Size(aWidth, aHeight);\r
- \r
- if ( aWidth > aHeight )\r
- aDestView->SetSize (aMapScaling * (aWidth / aHeight));\r
- else\r
- aDestView->SetSize (aMapScaling);\r
+ aDestView->Size( aWidth, aHeight );\r
+ aDestView->SetSize ( aWidth > aHeight ? aMapScaling * (aWidth / aHeight) : aMapScaling );\r
+#endif\r
\r
- getViewPort()->setAxialScale(anAxialScale[0], anAxialScale[1], anAxialScale[2]);\r
+ getViewPort()->setAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] );\r
\r
aDestView->ZFitAll();\r
aDestView->SetImmediateUpdate( Standard_True );\r