openCASCade——Standard_Transient

  • 指定放缩平移旋转的显示实现
    继承Standard_Transient并实现相关方法,参考类V3d_Trihedron
    在构造函数中增加:
myTransformPers = new Graphic3d_TransformPers(Graphic3d_TMF_2d, Aspect_TOTP_CENTER);
SetPosition(Aspect_TOTP_CENTER);

其中,Graphic3d_TransformPers的第一个参数如下:

enum Graphic3d_TransModeFlags
{
  Graphic3d_TMF_None           = 0x0000,                  //!< no persistence attributes (normal 3D object)
  Graphic3d_TMF_ZoomPers       = 0x0002,                  //!< object does not resize
  Graphic3d_TMF_RotatePers     = 0x0008,                  //!< object does not rotate;
  Graphic3d_TMF_TriedronPers   = 0x0020,                  //!< object behaves like trihedron - it is fixed at the corner of view and does not resizing (but rotating)
  Graphic3d_TMF_2d             = 0x0040,                  //!< object is defined in 2D screen coordinates (pixels) and does not resize, pan and rotate
  Graphic3d_TMF_ZoomRotatePers = Graphic3d_TMF_ZoomPers
                               | Graphic3d_TMF_RotatePers //!< object doesn't resize and rotate
};

Graphic3d_TransformPers的第二个参数如下:

enum Aspect_TypeOfTriedronPosition
{
  Aspect_TOTP_CENTER      = 0x0000,             //!< at the center of the view
  Aspect_TOTP_TOP         = 0x0001,             //!< at the middle of the top    side
  Aspect_TOTP_BOTTOM      = 0x0002,             //!< at the middle of the bottom side
  Aspect_TOTP_LEFT        = 0x0004,             //!< at the middle of the left   side
  Aspect_TOTP_RIGHT       = 0x0008,             //!< at the middle of the right  side
  Aspect_TOTP_LEFT_LOWER  = Aspect_TOTP_BOTTOM
                          | Aspect_TOTP_LEFT,   //!< at the left lower corner
  Aspect_TOTP_LEFT_UPPER  = Aspect_TOTP_TOP
                          | Aspect_TOTP_LEFT,   //!< at the left upper corner
  Aspect_TOTP_RIGHT_LOWER = Aspect_TOTP_BOTTOM
                          | Aspect_TOTP_RIGHT,  //!< at the right lower corner
  Aspect_TOTP_RIGHT_UPPER = Aspect_TOTP_TOP
                          | Aspect_TOTP_RIGHT,  //!< at the right upper corner

};

调用方法:

    my_note_value_->SetLabelsColor(Quantity_NOC_TURQUOISE);
    my_note_value_->SetScale(aTrihedronScale);
    my_note_value_->SetPosition(Aspect_TOTP_CENTER);
    my_note_value_->SetWireframe(V3d_ZBUFFER == V3d_WIREFRAME);

    my_note_value_->Display(*view_);

猜你喜欢

转载自blog.csdn.net/u012541187/article/details/81082248