opencascade AIS源码学习 原创
Application Interactive Services provide the means to create links between an application GUI viewer and the packages which are used to manage selection and presentation. The tools AIS defined in order to do this include different sorts of entities: both the selectable viewable objects themselves and the context and attribute managers to define their selection and display. To orient the user as he works in a modeling environment, views and selections must be comprehensible. There must be several different sorts of selectable and viewable object defined. These must also be interactive, that is, connecting graphic representation and the underlying reference geometry. These entities are called Interactive Objects, and are divided into four types:
•the Datum
•the Relation
•the Object
•None. The Datum groups together the construction elements such as lines, circles, points, trihedra, plane trihedra, planes and axes. The Relation is made up of constraints on one or more interactive shapes and the corresponding reference geometry. For example, you might want to constrain two edges in a parallel relation. This contraint is considered as an object in its own right, and is shown as a sensitive primitive. This takes the graphic form of a perpendicular arrow marked with the || symbol and lying between the two edges. The Object type includes topological shapes, and connections between shapes. None, in order not to eliminate the object, tells the application to look further until it finds an object definition in its generation which is accepted. Inside these categories, you have the possibility of an additional characterization by means of a signature. The signature provides an index to the further characterization. By default, the Interactive Object has a None type and a signature of 0 (equivalent to None.) If you want to give a particular type and signature to your interactive object, you must redefine the two virtual methods: Type and Signature. In the C++ inheritance structure of the package, each class representing a specific Interactive Object inherits AIS_InteractiveObject. Among these inheriting classes, AIS_Relation functions as the abstract mother class for tinheriting classes defining display of specific relational constraints and types of dimension. Some of these include:
•display of constraints based on relations of symmetry, tangency, parallelism and concentricity
•display of dimensions for angles, offsets, diameters, radii and chamfers. No viewer can show everything at once with any coherence or clarity. Views must be managed carefully both sequentially and at any given instant. Another function of the view is that of a context to carry out design in. The design changes are applied to the objects in the view and then extended to the underlying reference geometry by a solver. To make sense of this complicated visual data, several display and selection tools are required. To facilitate management, each object and each construction element has a selection priority. There are also means to modify the default priority. To define an environment of dynamic detection, you can use standard filter classes or create your own. A filter questions the owner of the sensitive primitive to determine if it has the desired qualities. If it answers positively, it is kept. If not, it is rejected. The standard filters supplied in AIS include:
•AIS_AttributeFilter
•AIS_SignatureFilter
•AIS_TypeFilter. A set of functions allows you to choose the interactive objects which you want to act on, the selection modes which you want to activate. An interactive object can have a certain number of graphic attributes which are specific to it, such as visualization mode, color, and material. By the same token, the interactive context has a set of graphic attributes, the Drawer which is valid by default for the objects it controls. When an interactive object is visualized, the required graphic attributes are first taken from the object’s own Drawer if one exists, or from the context drawer for the others.
翻译:
应用交互服务提供了在应用程序GUI查看器与用于管理选择和呈现的包之间创建链接的手段。为了完成这一目标,AIS定义的工具包括不同类型的实体:即可选择的可视对象本身以及用于定义它们的选择和显示的上下文和属性管理器。为了在建模环境中指导用户工作,视图和选择必须是可理解的。必须定义几种不同类型的可选择和可视对象。这些对象也必须是交互式的,即连接图形表示和底层参考几何。这些实体被称为交互式对象,并分为四种类型:
•基准(Datum)
•关系(Relation)
•对象(Object)
•无(None)。基准将构造元素(如线、圆、点、三向测角器、平面三向测角器、平面和轴)组合在一起。关系由一个或多个交互式形状上的约束以及相应的参考几何构成。例如,您可能希望将两个边约束为平行关系。这种约束被视为一个独立的对象,并以敏感原语的形式显示。它表现为一个垂直箭头,用“||”符号标记,位于两个边之间。对象类型包括拓扑形状和形状之间的连接。无(None)是为了不消除对象,它告诉应用程序继续查找,直到在其生成中找到一个可接受的对象定义。在这些类别内部,您可以通过签名进行额外的特征描述。签名提供了对进一步特征的索引。默认情况下,交互式对象的类型为无(None),签名为0(等同于无)。如果您想为您的交互式对象指定特定的类型和签名,您必须重新定义两个虚拟方法:Type(类型)和Signature(签名)。在C++继承中,这些方法可以被覆盖以实现自定义的行为。
个人理解:
这个交互式对象,在occ中是用于交互的,也就是用户可以进行操作的对象,显示出来的对象,但是这个对象不能用来进行几何计算,就需要将交互式对象数据结构转为拓扑结构(Topods)进行几何计算,而其中的Type和signature可以在开发过程中进行拓展和标记,比如开发者对交互式对象进行区分并且进行一些标记要记录,可以使用这两个虚拟方法,另外,再开发过程中,如果要进行拓展,创建自己的交互对象, 需要重写这两个类进而实现,以上是个人理解。
实际例子代码:
暂无。
联系:
yzxxty39@163.com
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)