how to get AIS_Shape from SelectMgr_SelectableObject mySelectable?

I made a selection owner inherited from SelectMgr_EntityOwner.

In its HandleMouseClick() I would like to get the selected AIS_Shape.

However, the selection owner returns only mySelectable which is a SelectMgr_SelectableObject, so how do I get the AIS_Shape?

Kirill Gavrilov's picture

AIS_Shape is a subclass of SelectMgr_SelectableObject. You need to perform DownCast'ing or dynamic_cast<> to get AIS_Shape.

john wick's picture

the downcast returns a null pointer. What would be the reason for it?

Attachments: 
Kirill Gavrilov's picture

the downcast returns a null pointer.

Then you are working with the owner of another interactive object. That's the only idea I have.

john wick's picture

Yes, I guess that maybe the problem, how do you put SelectMgr_EntityOwner on AIS_InteractiveObject without having to use a copy of the TopoDS_Shape that you create in Compute()?

This is what I have right now, _InnerObject is a TopoDS_Shape that is copied from within Compute() before StdPrs_ShadedShape::Add(thePrs, m_walls1, myDrawer).

Kirill Gavrilov's picture

The selectable of Owner will be of type MyAIS_InteractiveObject in your case.

john wick's picture

Yes, what you said makes sense. the code I wrote is rubbish, now I just inherent from AIS_Shape to save all the pain.