EgtGraphics 2.1e4 :
- corretta funzione ZoomObject.
This commit is contained in:
+14
-6
@@ -315,23 +315,31 @@ Scene::ZoomObject( int nId)
|
||||
int nMyId = m_pGeomDB->GetFirstSelectedObj() ;
|
||||
while ( nMyId != GDB_ID_NULL) {
|
||||
BBox3d b3Curr ;
|
||||
if ( m_pGeomDB->GetGlobalBBox( nMyId, b3Curr))
|
||||
if ( m_pGeomDB->GetGlobalBBox( nMyId, b3Curr, BBF_ONLY_VISIBLE))
|
||||
b3Obj.Add( b3Curr) ;
|
||||
nMyId = m_pGeomDB->GetNextSelectedObj() ;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_pGeomDB->GetGlobalBBox( nId, b3Obj) ;
|
||||
m_pGeomDB->GetGlobalBBox( nId, b3Obj, BBF_ONLY_VISIBLE) ;
|
||||
|
||||
// recupero centro e diametro vista
|
||||
// recupero centro
|
||||
Point3d ptCent ;
|
||||
double dDiam ;
|
||||
if ( ! b3Obj.GetCenter( ptCent) || ! b3Obj.GetDiameter( dDiam))
|
||||
if ( ! b3Obj.GetCenter( ptCent))
|
||||
return false ;
|
||||
|
||||
// determino le dimensioni di vista nel riferimento di vista
|
||||
Frame3d frView ;
|
||||
if ( ! CalcCameraFrame( frView))
|
||||
return false ;
|
||||
b3Obj.ToLoc( frView) ;
|
||||
const double COEFF = 1.05 ;
|
||||
double dHalfWidth = COEFF * ( b3Obj.GetMax().x - b3Obj.GetMin().x) / 2 ;
|
||||
double dHalfHeight = COEFF * ( b3Obj.GetMax().y - b3Obj.GetMin().y) / 2 ;
|
||||
|
||||
// imposto il centro e le dimensioni di vista
|
||||
m_ptCenter = ptCent ;
|
||||
return AdjustDimView( dDiam / 2, dDiam / 2) ;
|
||||
return AdjustDimView( dHalfWidth, dHalfHeight) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user