赞
踩
typedef PrsDim_ConcentricRelation AIS_ConcentricRelation
创建一个任意位置的另一个交互对象实例作为参考。这允许您使用连接的交互对象,而无需重新计算其表示、选择或图形结构。这些属性是从您的参考对象推导而来的。连接的交互对象与其源对象之间的关系通常是几何变换关系。AIS_ConnectedInteractive 类支持任何交互对象的选择模式 0,并且如果其参考对象基于 AIS_Shape,则支持所有标准模式。子类可以重新定义 ComputeSelection()。此外,如果其参考对象基于 AIS_Shape,则连接的交互对象还将处理 HLR(隐藏线去除)。
断开先前的视图连接并将高亮模式设置为0。这会高亮显示线框表示aTypeOfPresentation3d。Top_AllView禁用隐藏线去除。
如果参考表示接受指定的显示模式,则返回true。
重实现自PrsMgr_PresentableObject。
通知图形上下文交互对象可以分解为子形状以进行动态选择。
重实现自SelectMgr_SelectableObject。
计算视图aPresentation及其更新。后者由aPresentationManager管理。显示模式aMode默认为0。当实例连接到另一个InteractiveObject时,该方法是重新定义的虚方法;此时,该方法不会计算任何内容,只是使用最后一个对象的表示,并进行存储的变换(如果有)。
实现自PrsMgr_PresentableObject。
根据视点计算表示。
重实现自PrsMgr_PresentableObject。
通过从myReference选择中复制生成敏感实体,为这些实体创建并设置一个实体拥有者,并将它们添加到theSelection中。
实现自SelectMgr_SelectableObject。
通过从myReference子形状选择中复制生成敏感实体,为这些实体创建并设置一个实体拥有者,并将它们添加到theSelection中。
建立连接交互对象、anotherIobj及其参考之间的连接。
建立连接交互对象、anotherIobj及其参考之间的连接。将实例定位在aLocation中。
建立连接交互对象、anotherIobj及其参考之间的连接。将实例定位在aLocation中。
返回与参考交互对象的连接。
清除与源参考的连接。表示将不再显示。警告:必须在删除表示之前完成。
如果表示与其源参考之间建立了连接,则返回true。
返回0。
重实现自AIS_InteractiveObject。
返回KOI_Object。
重实现自AIS_InteractiveObject。
#include <AIS_ConnectedInteractive.hxx> #include <AIS_InteractiveContext.hxx> #include <AIS_Shape.hxx> #include <TopoDS_Shape.hxx> #include <BRepPrimAPI_MakeBox.hxx> #include <V3d_View.hxx> #include <Graphic3d_GraphicDriver.hxx> #include <OpenGl_GraphicDriver.hxx> #include <Aspect_DisplayConnection.hxx> int main() { // 创建 OpenGl_GraphicDriver Handle(Graphic3d_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver(); // 创建视窗 Handle(Aspect_DisplayConnection) aDispConnection = new Aspect_DisplayConnection(); Handle(V3d_View) aView = new V3d_View(aGraphicDriver, "My View", aDispConnection); // 创建一个AIS_InteractiveContext Handle(AIS_InteractiveContext) context = new AIS_InteractiveContext(aGraphicDriver); // 创建一个盒子 TopoDS_Shape boxShape = BRepPrimAPI_MakeBox(10, 20, 30).Shape(); Handle(AIS_Shape) box = new AIS_Shape(boxShape); // 将盒子添加到AIS_InteractiveContext中 context->Display(box); // 创建一个AIS_ConnectedInteractive对象 Handle(AIS_ConnectedInteractive) connectedInteractive = new AIS_ConnectedInteractive(); // 连接AIS_ConnectedInteractive对象与盒子 connectedInteractive->Connect(box); // 将AIS_ConnectedInteractive对象添加到AIS_InteractiveContext中 context->Display(connectedInteractive); // 显示视图 aView->SetWindow(100, 100, 800, 600); aView->SetBackgroundColor(Quantity_NOC_BLACK); aView->MustBeResized(); aView->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_GOLD, 0.08, V3d_ZBUFFER); // 主事件循环 aView->Redraw(); aView->Redraw(); return 0; }
在这个示例中,我们首先创建了一个 OpenGl_GraphicDriver 并设置了视窗。然后创建了一个 AIS_InteractiveContext,并在其中创建了一个盒子对象 box,并将其添加到 AIS_InteractiveContext 中进行显示。接着,创建了一个 AIS_ConnectedInteractive 对象 connectedInteractive,并通过 Connect() 方法将其连接到盒子对象 box 上,最后将 connectedInteractive 对象添加到 AIS_InteractiveContext 中进行显示。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。