Virtual object - highlight & selection

Hello community.

I use AIS framework to display some 3D data and I create measure objects, such as distance and angles, and display them creating a root object and child objects (lines / arcs / labels).

To do so, the root object I used is actually an AIS_Trihedron with its axes / arrows and labels hidden:

Handle(Prs3d_DatumAspect) trihedronAspect = new Prs3d_DatumAspect();
trihedronAspect->SetDrawLabels(Standard_False);
trihedronAspect->SetDrawArrows(Standard_False);
trihedronAspect->LineAspect(Prs3d_DatumParts::Prs3d_DP_XAxis)->SetTypeOfLine(Aspect_TypeOfLine::Aspect_TOL_EMPTY);
trihedronAspect->LineAspect(Prs3d_DatumParts::Prs3d_DP_YAxis)->SetTypeOfLine(Aspect_TypeOfLine::Aspect_TOL_EMPTY);
trihedronAspect->LineAspect(Prs3d_DatumParts::Prs3d_DP_ZAxis)->SetTypeOfLine(Aspect_TypeOfLine::Aspect_TOL_EMPTY);

Then, I add child objects to the trihedron (lines / labels ...).
First attachment shows an example of a measure line displayed in my 3D viewer.

First, I was surprised that I couldn't find any virtual object that may only hold children and draw nothing special but it doesn't matter using a trihedron to hold all needed objects.

My main problem is that I need to highlight and select this full object, not only selecting one line or the label but the entire object, pointing the cursor on any line or label and I can't achieve this.

To display the trihedron, I use this code:

trihedron->SetContext(myInteractiveContext);
myInteractiveContext->Display(trihedron, 0, AIS_TrihedronSelectionMode_EntireObject, Standard_False);
myInteractiveContext->SetZLayer(trihedron, this->zLayerMeasureObjectsId);
trihedron->SetDynamicHilightAttributes(myInteractiveContext->HighlightStyle(Prs3d_TypeOfHighlight_Dynamic));
trihedron->SetHilightAttributes(myInteractiveContext->HighlightStyle(Prs3d_TypeOfHighlight_Selected));

To display a line / label / arc, I use this code (example for a line):

line->SetContext(myInteractiveContext);
myInteractiveContext->Display(line, 0, -1, Standard_False);
myInteractiveContext->SetZLayer(line, this->zLayerMeasureObjectsId);
line->SetDynamicHilightAttributes(myInteractiveContext->HighlightStyle(Prs3d_TypeOfHighlight_Dynamic));
line->SetHilightAttributes(myInteractiveContext->HighlightStyle(Prs3d_TypeOfHighlight_Selected));

I can select the complete object, but it appears that it's not when the mouse cursor is under any of these lines as you can see in second attachment. I suppose it happens when the cursor is in fact under any axis of the trihedron while these axes are not displayed.

I really don't know how to achieve my goal. If someone can give my a good hint it would really help me.

Thank you very much.

Guillaume CHAFFAROD's picture

I just figure that the selection with highlight is also very hard to perform because my lines / labels / arcs are not selectable (-1 for selection mode in myInteractiveContext->Display method).

If I set the value 0, i can do dynamic highlight, but only on specific parts whereas my goal is to always highlight (dynamic for mouse over and standard for selection on click) the entire object (all lines / labels) :/

Luc Wens's picture