ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

OpenCASCADE Customize Highlighting

2020-02-29 15:02:05  阅读:334  来源: 互联网

标签:SelectMgr 高亮 Customize object SelectableObject entity OpenCASCADE Highlighting I


OpenCASCADE Customize Highlighting

eryar@163.com

 

The traditional way of highlighting selected entity owners adopted by Open CASCADE Technology assumes that each entity owner highlights itself on its own. This approach has two drawbacks:

l  each entity owner has to maintain its own Prs3d_Presentation object, that results in a considerable memory overhead;

l  drawing selected owners one by one is not efficient from the visualization point of view.

OpenCASCADE内置的高亮算法是每个模型都有自己的高亮实体,高亮的一般是模型的TopoDS_Edge,对于B样条曲面还会显示出一条UIso和VIso线。这种高亮显示策略不一定符合所有人的需求,而且会占用额外大量的内存。

 

Therefore, to overcome these limitations, OCCT has an alternative way to implement the highlighting of a selected presentation. Using this approach, the interactive object itself will be responsible for the highlighting, not the entity owner.

因此,为了克服上面的缺点,OCCT提供一个自定义高亮的方式,由交互对象自己来实现高亮显示,满足更多个性化的需求。

 

On the basis of SelectMgr_EntityOwner::IsAutoHilight() return value, AIS_InteractiveContext object either uses the traditional way of highlighting (in case if IsAutoHilight() returns TRUE) or groups such owners according to their selectable objects and finally calls SelectMgr_SelectableObject::HilightSelected() or SelectMgr_SelectableObject::ClearSelected(), passing a group of owners as an argument.

Hence, an application can derive its own interactive object and redefine virtual methods HilightSelected(), ClearSelected() and HilightOwnerWithColor() from SelectMgr_SelectableObject. SelectMgr_SelectableObject::GetHilightPresentation and SelectMgr_SelectableObject::GetSelectPresentation methods can be used to optimize filling of selection and highlight presentations according to the user's needs. The AIS_InteractiveContext::HighlightSelected() method can be used for efficient redrawing of the selection presentation for a given interactive object from an application code.

当SelectMgr_SelectableObject的所有子类的IsAutoHilight()返回true时,则是由OCCT自动实现高亮选择效果。当IsAutoHilight()返回false时,则交互对象的高亮显示交给用户自己来实现。具体实现步骤为从类SelectMgr_SelectableObject派生出一个子类,重写三个虚函数:

l  HilightSelected():交互对象选中时的高亮显示效果;

l  ClearSelected():清除对象选中时的高亮效果;

l  HilightOwnerWithColor():鼠标移动到交互对象上时的高亮效果;

 

如上图所示为OCCT自动高亮显示效果,模型的每个Edge都高亮显示;

 

上图所示为自己实现模型的高亮效果,只高亮显示模型的外边框。这样高亮显示的数据少,占用内存就少,效率更高。

标签:SelectMgr,高亮,Customize,object,SelectableObject,entity,OpenCASCADE,Highlighting,I
来源: https://www.cnblogs.com/opencascade/p/Highlighting.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有