Wednesday, December 22, 2010

Unification Of Display Code for Interactives/TopoDS

OpenCascade works visually with AIS_InteractiveObject instances that are added in a scene (AIS_InteractiveContext). Anyway, most objects do represent themselves in topological form (TopoDS_Shape) and based on them we build the AIS_Shape (an implementation of interactives). Anyway, other parts of code do not have access to TopoDS_Shape objects. The most used tool that is interactive, is Dimension.
So for that we used another code path that handles interactives and this shows, mostly in bugs: you cannot switch color for interactives, you cannot select them as our code depends on detecting the underlying TopoDS from one side and the code is explicitly around that logic, not around interactives. This make (and is still true) to be impossible not just selecting (that is theoretically possible with this change), but also changing color (this is possible if Dimension is setup visible in tree, and I've did that, but you can change for example for any length constraints that display a dimension).
The latest advantage of this change is the way was done it: it manages a list of AIS_Interactive all the time, so navigating through them is much more compact code with no two code paths, so adding possibility to select dimension like shapes (and any future AIS_Interactive code) to be possible and easier to be done (in fact a prototype code is there, and with help of bxtrx, this code may be really here fairly soon ;) ).

No comments: