Get Label(or pointer) from a subshape


We can get the associated Label or Handle by AIS_InteractiveObject's GetOwner(), so we can know the semantics of a shape we selected in viewer.

But, when you enter a deep level, e.g. subshape of a AIS_Shape, how you can get semantics info?

Of course, we can associate subshape with label easily. But it is only easy when we get shape from label, and vice verse? We can only get label(or other `hook' data') by using AIS_InteractiveObject's Owner mechanism. But AIS_InteractiveObject support ShapeDecomposition! How can I get info from these decomposed part? For example, a face in a box, the box is displayed as AIS_Shape, I can select a face, I can identify it as part of box, I can even build a child label to represent it. but how can I directly get that label?

Search and compare its master label is not a good idea, even maintain a hash map. Suppose we have collect a lot of shapes into a TopoDS_Compound, how can I identify a single TopoDS_Shape that consists of this Compound? Still use search or hash?

Since OCC can easily pick elements from viewer, I think there must be a very simple and natural and effective manner to hook a pointer into graphics data, or selectable data, i.e. our selectable subshape.

Any suggestion will be highly appreciated.

Best regards,

fhchina's picture


Any detail information about Presentation & Selection package implementation will be useful.