-bool VTKViewer_ViewFrame::ComputeTrihedronSize( double& theNewSize, double& theSize )
-{
- // calculating diagonal of visible props of the renderer
- float bnd[ 6 ];
- m_Triedron->VisibilityOff();
- if ( ::ComputeVisiblePropBounds( m_Renderer, bnd ) == 0 )
- {
- bnd[ 1 ] = bnd[ 3 ] = bnd[ 5 ] = 100;
- bnd[ 0 ] = bnd[ 2 ] = bnd[ 100 ] = 0;
- }
- m_Triedron->VisibilityOn();
- float aLength = 0;
- static bool CalcByDiag = false;
- if ( CalcByDiag )
- {
- aLength = sqrt( ( bnd[1]-bnd[0])*(bnd[1]-bnd[0] )+
- ( bnd[3]-bnd[2])*(bnd[3]-bnd[2] )+
- ( bnd[5]-bnd[4])*(bnd[5]-bnd[4] ) );
- }
- else
- {
- aLength = bnd[ 1 ]-bnd[ 0 ];
- aLength = max( ( bnd[ 3 ] - bnd[ 2 ] ),aLength );
- aLength = max( ( bnd[ 5 ] - bnd[ 4 ] ),aLength );
- }
-
- static float aSizeInPercents = 105;
- QString aSetting = QAD_CONFIG->getSetting( "Viewer:TrihedronSize" );
- if ( !aSetting.isEmpty() )
- aSizeInPercents = aSetting.toFloat();
-
- static float EPS_SIZE = 5.0E-3;
- theSize = m_Triedron->GetSize();
- theNewSize = aLength * aSizeInPercents / 100.0;
-
- // if the new trihedron size have sufficient difference, then apply the value
- return fabs( theNewSize - theSize) > theSize * EPS_SIZE ||
- fabs( theNewSize-theSize ) > theNewSize * EPS_SIZE;
-}
-