当前位置: 首页 > news >正文

opencascade 快速显示AIS_ConnectedInteractive源码学习

AIS_ConcentricRelation

typedef PrsDim_ConcentricRelation AIS_ConcentricRelation

AIS_ConnectedInteractive

在这里插入图片描述

简介

创建一个任意位置的另一个交互对象实例作为参考。这允许您使用连接的交互对象,而无需重新计算其表示、选择或图形结构。这些属性是从您的参考对象推导而来的。连接的交互对象与其源对象之间的关系通常是几何变换关系。AIS_ConnectedInteractive 类支持任何交互对象的选择模式 0,并且如果其参考对象基于 AIS_Shape,则支持所有标准模式。子类可以重新定义 ComputeSelection()。此外,如果其参考对象基于 AIS_Shape,则连接的交互对象还将处理 HLR(隐藏线去除)。

方法介绍

AIS_ConnectedInteractive()

AIS_ConnectedInteractive::AIS_ConnectedInteractive(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView)

断开先前的视图连接并将高亮模式设置为0。这会高亮显示线框表示aTypeOfPresentation3d。Top_AllView禁用隐藏线去除。

AcceptDisplayMode()
virtual Standard_Boolean AIS_ConnectedInteractive::AcceptDisplayMode(const Standard_Integer theMode) const inline override virtual

如果参考表示接受指定的显示模式,则返回true。

重实现自PrsMgr_PresentableObject。

AcceptShapeDecomposition()
virtual Standard_Boolean AIS_ConnectedInteractive::AcceptShapeDecomposition() const inline override virtual

通知图形上下文交互对象可以分解为子形状以进行动态选择。

重实现自SelectMgr_SelectableObject。

Compute()
virtual void AIS_ConnectedInteractive::Compute(const Handle<PrsMgr_PresentationManager>& thePrsMgr, const Handle<Prs3d_Presentation>& theprs, const Standard_Integer theMode) override protected virtual

计算视图aPresentation及其更新。后者由aPresentationManager管理。显示模式aMode默认为0。当实例连接到另一个InteractiveObject时,该方法是重新定义的虚方法;此时,该方法不会计算任何内容,只是使用最后一个对象的表示,并进行存储的变换(如果有)。

实现自PrsMgr_PresentableObject。

computeHLR()
virtual void AIS_ConnectedInteractive::computeHLR(const Handle<Graphic3d_Camera>& theProjector, const Handle<TopLoc_Datum3D>& theTrsf, const Handle<Prs3d_Presentation>& thePrs) override protected virtual

根据视点计算表示。

重实现自PrsMgr_PresentableObject。

ComputeSelection()
virtual void AIS_ConnectedInteractive::ComputeSelection(const Handle<SelectMgr_Selection>& theSelection, const Standard_Integer theMode) override protected virtual

通过从myReference选择中复制生成敏感实体,为这些实体创建并设置一个实体拥有者,并将它们添加到theSelection中。

实现自SelectMgr_SelectableObject。

computeSubShapeSelection()
void AIS_ConnectedInteractive::computeSubShapeSelection(const Handle<SelectMgr_Selection>& theSelection, const Standard_Integer theMode) protected

通过从myReference子形状选择中复制生成敏感实体,为这些实体创建并设置一个实体拥有者,并将它们添加到theSelection中。

Connect() [1/3]
void AIS_ConnectedInteractive::Connect(const Handle<AIS_InteractiveObject>& theAnotherObj) inline

建立连接交互对象、anotherIobj及其参考之间的连接。

Connect() [2/3]
void AIS_ConnectedInteractive::Connect(const Handle<AIS_InteractiveObject>& theAnotherObj, const gp_Trsf& theLocation) inline

建立连接交互对象、anotherIobj及其参考之间的连接。将实例定位在aLocation中。

Connect() [3/3]
void AIS_ConnectedInteractive::Connect(const Handle<AIS_InteractiveObject>& theAnotherObj, const Handle<TopLoc_Datum3D>& theLocation) inline

建立连接交互对象、anotherIobj及其参考之间的连接。将实例定位在aLocation中。

connect()
void AIS_ConnectedInteractive::connect(const Handle<AIS_InteractiveObject>& theAnotherObj, const Handle<TopLoc_Datum3D>& theLocation) protected
ConnectedTo()
const Handle<AIS_InteractiveObject>& AIS_ConnectedInteractive::ConnectedTo() const inline

返回与参考交互对象的连接。

Disconnect()
void AIS_ConnectedInteractive::Disconnect()

清除与源参考的连接。表示将不再显示。警告:必须在删除表示之前完成。

HasConnection()
Standard_Boolean AIS_ConnectedInteractive::HasConnection() const inline

如果表示与其源参考之间建立了连接,则返回true。

Signature()
virtual Standard_Integer AIS_ConnectedInteractive::Signature() const inline override virtual

返回0。

重实现自AIS_InteractiveObject。

Type()
virtual AIS_KindOfInteractive AIS_ConnectedInteractive::Type() const inline override virtual

返回KOI_Object。

重实现自AIS_InteractiveObject。

updateShape()
void AIS_ConnectedInteractive::updateShape(const Standard_Boolean WithLocation = Standard_True)

用法示例

#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_GraphicDriverHandle(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_InteractiveContextHandle(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 中进行显示。

http://www.lryc.cn/news/359874.html

相关文章:

  • CentOS系统上安装单机版Redis教程
  • 纯Java实现Google地图的KMZ和KML文件的解析
  • k8s自定义资源你会创建吗
  • CATIA二次开发VBA入门(4)——进程外开发环境搭建,vb.net在Visual Studio中开发,创建圆柱曲面的宏录制到二次开发案例
  • c++字符串相关接口
  • Maven打包错误:无效的源发行版:17
  • 【环境栏Composer】Composer常见问题(持续更新)
  • 塑造更智慧的AI:策略与路径探索
  • 软设之快速排序
  • 从零学算法2965
  • 【Mac版】Java生成二维码
  • ROS2自定义服务接口
  • linux /www/server/cron内log文件占用空间过大,/www/server/cron是什么内容,/www/server/cron是否可以删除
  • C++青少年简明教程:break语句、continue语句
  • MySQL实战行转列(或称为PIVOT)实战sales的表记录了不同产品在不同月份的销售情况,进行输出
  • 牛客NC164 最长上升子序列(二)【困难 贪心+二分 Java/Go/PHP/C++】
  • 电子烟开发【恒压、恒有效算法】
  • 基于Open3D的点云处理22-非阻塞可视化/动态可视化
  • C++面试题其一
  • CentOS7某天的samba服务搭建操作记录(还没成功)
  • Qt Demo:基于TCP协议的视频传输Demo
  • 内存管理【C++】
  • D3D 顶点格式学习
  • gmssl vs2010编译
  • 容器化部署gitlab、jenkins,jenkins应用示例
  • 基于STM32的轻量级Web服务器设计
  • 用r语言处理 Excel数据当中的缺失值方法
  • AWS 高防和阿里云高防深度对比
  • ctfshow web 月饼杯II
  • 「前端+鸿蒙」核心技术HTML5+CSS3(二)