OpenCASCADE Customize Highlighting

摘要:
Therefore,toovercometheselimitations,OCCThasanalternativewaytoimplementthehighlightingofaselectedpresentation.Usingthisapproach,theinteractiveobjectitselfwillberesponsibleforthehighlighting,nottheentityowner.因此,为了克服上面的缺点,OCCT提供一个自定义高亮的方式,由交互对象自己来实现高亮显示,满足更多个性化的需求。OnthebasisofSelectMgr_EntityOwner::IsAutoHilight()returnvalue,AIS_InteractiveContextobjecteitherusesthetraditionalwayofhighlightingorgroupssuchownersaccordingtotheirselectableobjectsandfinallycallsSelectMgr_SelectableObject::HilightSelected()orSelectMgr_SelectableObject::ClearSelected(),passingagroupofownersasanargument.Hence,anapplicationcanderiveitsowninteractiveobjectandredefinevirtualmethodsHilightSelected(),ClearSelected()andHilightOwnerWithColor()fromSelectMgr_SelectableObject.SelectMgr_SelectableObject::GetHilightPresentationandSelectMgr_SelectableObject::GetSelectPresentationmethodscanbeusedtooptimizefillingofselectionandhighlightpresentationsaccordingtotheuser'sneeds.TheAIS_InteractiveContext::HighlightSelected()methodcanbeusedforefficientredrawingoftheselectionpresentationforagiveninteractiveobjectfromanapplicationcode.当SelectMgr_SelectableObject的所有子类的IsAutoHilight()返回true时,则是由OCCT自动实现高亮选择效果。当IsAutoHilight()返回false时,则交互对象的高亮显示交给用户自己来实现。
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线。这种高亮显示策略不一定符合所有人的需求,而且会占用额外大量的内存。

OpenCASCADE Customize Highlighting第1张

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():鼠标移动到交互对象上时的高亮效果;

OpenCASCADE Customize Highlighting第2张

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

OpenCASCADE Customize Highlighting第3张

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

免责声明:文章转载自《OpenCASCADE Customize Highlighting》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇C#.Net C/S快速开发框架V2.2版本介绍在线HTML编辑器使用入门(Kindeditor)下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

vs2010(vs2012)好用的扩展插件介绍

  一直以来只使用番茄vs助手(https://www.wholetomato.com/downloads/default.asp)辅助写代码,也都忘了是谁介绍的,不过确实好用。 相比原始的vs,它提供了很多改进功能。例如,重命名变量,高亮宏与自定义类型,查找引用,智能代码提示等。   因为一直以来用着没有觉得不爽的地方,所以对于vs的其它插件都没做研究。...

基于vue实现搜索高亮关键字

有一个需求是在已有列表中搜索关键词,然后在列表中展示含有相关关键字的数据项并且对关键字进行高亮显示,所以该需求需要解决的就两个问题: 1.搜索关键词过滤列表数据 2.每个列表高亮关键字 ps: 此问题基于数组对象,其他数据类型也可参考此思路。 关键词搜索:过滤数据很简单,无非就是监听search,对源数据过滤即可,贴一下代码: 1 const search...

vim中文件类型识别、语法高亮及缩进实现流程

一、文件类型在使用vim编辑一个文件的时候,如果能够识别出文件的类型,加上对应的高亮规则,可以使文件的查看更加醒目,这个功能几乎是使用vim浏览文件的一个核心诉求。另外,在进行文件编辑的时候,特别是使用vim写代码的时候(典型的场景是通过vim写C/C++代码),如果能够智能缩进,还可以减少敲代码。例如,在每行的开头自动添加缩进与前一行对齐;或者是当在输入...

【ECharts】03 样式

ECharts4 开始,除了默认主题外,内置了两套主题,分别为 light 和 dark。 设置方式: var chart = echarts.init(dom, 'light'); var chart = echarts.init(dom, 'dark'); 除了上面的设置方式之外,EChart还提供在线调试获取的方式: https://echart...

3.6 Lucene基本检索+关键词高亮+分页

3.2节我们已经运行了一个Lucene实现检索的小程序,这一节我们将以这个小程序为例,讲一下Lucene检索的基本步骤,同时介绍关键词高亮显示和分页返回结果这两个有用的技巧。 一、Lucene检索的基本步骤 1 import java.nio.file.Paths; 2 import java.io.*; 3 4 import org.apac...

汇集移动端兼容性问题

1、一些情况下对非可点击元素如(label,span)监听click事件,ios下不会触发 css增加cursor:pointer 2、三星手机遮罩层下的input、select、a等元素可以被点击和focus(点击穿透) 发现于三星手机,这个在特定需求下才会有,因此如果没有类似问题的可以不看。首先需求是浮层操作,在三星上被遮罩的元素依然可以获取focu...