• OpenCASCADE Customize Highlighting


    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都高亮显示;

     

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

  • 相关阅读:
    前辈的经验
    ES6 的新特性
    jQuery 事件对象的属性和方法
    ECMAScript 6 入门
    浏览器的加载与页面性能优化
    ajax 基于 jquery 简单的 ajax 请求
    浏览器加载、解析、渲染的过程
    浏览器的加载和解析的过程,以及如何加快 HTML 的加载速度
    【经典问题】当你输入一个网址的时候,实际会发生什么?
    总结 IE 下的一些 BUG
  • 原文地址:https://www.cnblogs.com/opencascade/p/Highlighting.html
Copyright © 2020-2023  润新知