Select parts within custom shape

When defining a custom shape (descended from AIS_InteractiveObject), how can you get a select based on the internal contents, rather than the Object itself?

To be specific, I'm defining a shape with Vertexes and Lines (a wireframe), the ComputeSelection looks like this:

void ComputeSelection (const Handle(SelectMgr_Selection)& theSel, const Standard_Integer theMode)
{
        for (i=0; i<m_vPoints.size(); i++)
        {
            Handle(Select3D_SensitivePoint) aPntSel = new Select3D_SensitivePoint(m_owner, m_vPoints[i]->Pnt());
            theSel->Add (aPntSel);
        }
        for (i=0; i<m_vLines.size(); i++)
        {
            Handle(Select3D_SensitiveSegment) aLineSel = new Select3D_SensitiveSegment(m_owner, m_vLines[i]->StartPoint(), m_vLines[i]->EndPoint());
            theSel->Add (aLineSel);
        }
}

when the user clicks something, I get a valid Select. BUT - when calling...

myContext->FirstSelectedObject();

...it returns my object, not the internal vertex/edge component parts.

I'm wondering if there is an easy way for me to get a reference to whats actually been clicked (as opposed to me having to re-find it from mouse position)?

Mat

gkv311 n's picture

You need to create a different Onwer objects for each selectable item instead one m_owner for everything and then use AIS_InteractiveContext::SelectedOwner() instead of AIS_InteractiveContext::SelectedInteractive() to get your owners.