Transform persistence of AIS_ColorScale derivation

In 7.5 I had a derived class from AIS_ColorScale which had a constructor like this:

AIS_TrajectoryColorScale::AIS_TrajectoryColorScale(NODE_UUID iChannelUUID, bool bSmooth, int NumSegments)
{
......
SetLabelType(Aspect_TOCSD_AUTO);
SetZLayer(Graphic3d_ZLayerId_TopOSD);
SetPosition(0, 0); // lower left corner
SetTransformPersistence(Graphic3d_TMF_2d, gp_Pnt(-1, -1, 0));//Displayed in the third phenomenon
}

When going to 7.8, the instruction SetTransformPersistence is no longer valid (it places the colorscale in the right bottom of the screen).
I tried this:

AIS_TrajectoryColorScale::AIS_TrajectoryColorScale(NODE_UUID iChannelUUID, bool bSmooth, int NumSegments)
{
...
SetZLayer(Graphic3d_ZLayerId_TopOSD);
SetPosition(0, 0); // lower left corner
Handle(Graphic3d_TransformPers) transformPers = new Graphic3d_TransformPers(
Graphic3d_TMF_2d, gp_Pnt(-1, -1, 0));
SetTransformPersistence(transformPers);//Displayed in the third phenomenon
}

But this throws an exception: Graphic3d_TransformPers::SetPersistence(), wrong persistence mode .

So what can i do?

gkv311 n's picture

For setting Graphic3d_TMF_2d mode you need using the second constructor taking Aspect_TypeOfTriedronPosition on input.

Handle(Graphic3d_TransformPers) transformPers =
  new Graphic3d_TransformPers(Graphic3d_TMF_2d, Aspect_TOTP_LEFT_LOWER);

P.S.: please use code tags to post code fragments formatted.

Luc Wens's picture

That worked! Thanks.
I did look for the code tags, but did not find them right away, maybe not a bad idea to place this right at the top of the explanation page.