wustguangh |分类标签:CAA, CATIA 2014-09-22
CAA如何实现几何模型居中显示?
CAA开发如何实现几何模型在视图中居中显示,实现如下图所示右键菜单“居中”的效果。

回答(3)
wustguangh 19级 2014-09-23 10:06:10
针对3d模型的显示,caa对应的类是CAT3DViewer:
void CAT3DViewer::ReframeOn( const CAT3DBoundingSphere& iBs3D)
wustguangh 19级 2014-09-22 22:12:36
其中,获取当前环境激活的视图(CATViewer)的示例代码如下:
CATFrmLayout * pCurrentLayout= CATFrmLayout::GetCurrentLayout();
if ( NULL != pCurrentLayout )
{
CATFrmWindow * pCurrentWindow = pCurrentLayout->GetCurrentWindow();
if ( NULL != pCurrentWindow )
{
pCurrentViewer = pCurrentWindow->GetViewer();
}
}wustguangh 19级 2014-09-22 21:55:58
这个可以通过CATViewer接口实现,可以参考如下几何方法进行实现:
1. public virtual void Reframe( )
Changes the Main Viewpoint to have all the repreentations visible on screen.
2. public void Resize( const float iWidth, const float iHeight)
Resize the viewer.
Parameters:
iWidth
the new width in pixel for the viewer.
iHeight
the new width in pixel for the viewer.
3. public virtual void SetFullScreen( const int iOnOff =1)
Sets the viewer's FullScreen state.
Parameters:
iOnOff
the FullScreen mode

