AIS_TextLabel strange behaviour

Hello team.

I have a very strange problem and I really don't know how to fix it.

I didn't use standard dimensions and created my custom ones because I have some needs that dimensions don't provide.

To define an angle dimension, I created some lines using a custom AIS object that have, for parent, an AIX_TextLabel.
This label has an angle and a vertical alignement that I calculate to ensure it's always inside the arc.

According to the camera direction, this vertical alignement may change, but when I change it, the label is not always updated as needed.

In the attached picture, I show the scenario:

1 - The label is well placed with VAlign = Top.
2 - The camera direction change, the VAlign is updated with VAlign = Bottom => the valign is not considered... If I move the camera a little, it has no effect.
3 - I place the mouse cursor on the label to highlight it => the highlighted label is well placed.
4 - At this moment, I move the camera a little => the label replace itself at the expected position.

After valign is changed, I use myLabel->SetToUpdate().
I also tried myLabel->InteractiveContext()->CurrentViewer()->Invalidate() => no more success.

What am I missing ? I really don't understand.

Thank you very much for your help.

Attachments: 
gkv311 n's picture

SetToUpdate() just marks presentation for updating, but doesn't actually recomputes anything. You'll need to call AIS_IntrractiveContext::Display() (or similar) somewhere later on in the logic to have effect. But within described logic it is unclear where it is called, if called at all.

Guillaume CHAFFAROD's picture

What is strange is that if when I call myLabel.SetAngle(newAngle), the label effectively updates with the new angle directly in the 3D view.
Anyway, I now use AIS_IntrractiveContext::Redisplay and it's much better.

Thank you for your answer.