Displaying an axis system

Hi,

I want to display an axis sytem that reflects the orientation of a view(V3d_View). My view is connected to an AIS_InteractiveContext object. I have defined a special class for the axis system, objects of this class have their own InteractiveModel(3 vectors shapes inside) and V3d_View objects.
I'm trying to display this axis system at the bottom right of the main view.
Actually that doesn't work. I'm using Qt to display the GUI, the main view itself is ok, but when i'm trying to put an axis sytem object, it does not work.

Does anyone already achieve something like that? Are there some classes in OCC that can be used to display natively an axis system?

Thanks a lot.

P.S. : I can send my source code to anyone interested in or that wants to help further.

Patrik Mueller's picture

Hi,

take a look at "TriedronDisplay" in the V3d_View.cdl. It should produce the wished result.

HTH,

Patrik

Hugues Delorme's picture

Thank you, that is exactly what I needed. I have just a little problem : when I set the display mode, the triedron is also affected too, which I don't want. How to avoid this? I'm doing the following :

//Initialize the model, the view and its triedron
Handle_V3d_View _view;
Handle_AIS_InteractiveContext _model;
//...
_view->TriedronDisplay (Aspect_TOTP_RIGHT_LOWER, Quantity_NOC_RED, 0.07);

//Set shaded display mode
AIS_ListOfInteractive objects;
_model->DisplayedObjects (objects);
AIS_ListIteratorOfListOfInteractive iobject (objects);
while (iobject.More ())
{
_model->SetDisplayMode (iobject.Value (), 1);
iobject.Next ();
}
//Now the triedron is set to shaded display mode too...

Patrik Mueller's picture

try that:

_view->TriedronDisplay (Aspect_TOTP_RIGHT_LOWER, Quantity_NOC_RED, 0.07, V3d_WIREFRAME);

Greets,

Patrik

Hugues Delorme's picture

I tried :

//Initializing the triedron
_view->TriedronDisplay (Aspect_TOTP_RIGHT_LOWER, Quantity_NOC_RED, 0.07, V3d_WIREFRAME);
//...
//Set shaded display mode
//Same code as above ...
//Force triedron display mode to wire frame:
_view->TriedronDisplay (Aspect_TOTP_RIGHT_LOWER, Quantity_NOC_RED, 0.07, V3d_WIREFRAME);

But it does not work, the triedron is still in shaded display mode although it is forced to be in wire frame display mode.
I think the problem is that maybe the triedron is loaded in some way in the AIS_InteractiveContext object. As I iterate on all displayed objects to set the display mode, shapes from the triedron are visited too.

Patrik Mueller's picture

Hm...

I initialize the triedron at view initialization and don't change it... no problems so far... Where do you initialize the triedron?

Hugues Delorme's picture

I initialize it just after the view is set up, i.e. after those step stuffs :

Integer window_handle = (Integer) winId ();
ShortInteger lo = (ShortInteger) window_handle;//Quantity_NameOfColor for WNT, XW_WindowQuality for X11
ShortInteger hi = (ShortInteger) (window_handle >> 16);//HWND for WNT, Xw_Xid for X11
HandleOCCWindow handle =
new OCCWindow (HandleOCCGraphicDevice::DownCast(_model.viewer ()->Device ()), hi, lo);

_view->SetWindow (handle);
if (not handle->IsMapped ())
handle->Map ();
_view->SetBackgroundColor (Quantity_NOC_BLACK);
_view->MustBeResized ();

//and then
_view->TriedronDisplay (Aspect_TOTP_RIGHT_LOWER, Quantity_NOC_RED, 0.07, V3d_WIREFRAME);

When the app is launched, there is no problem, as it is in wire frame mode by default. But as soon as shaded display mode is set, the triedron become shaded too (i want to avoid this, it is less visible).
My code to set the shaded mode is :

AIS_ListOfInteractive objects;
_ais_context->DisplayedObjects (objects);
AIS_ListIteratorOfListOfInteractive iobject (objects);
while (iobject.More ())
{
_ais_context->SetDisplayMode (iobject.Value (), AIS_Shaded);
iobject.Next ();
}

This code is executed in the neutral point (no local context).

Stephane Routelous's picture

Hi,

I'm trying to do the same thing as you do.
It seems that in 6.1, it is still broken.
Did you find a way to bypass the problem ?

I also have the problem that if I zoom very close to an object, the triedron may disappear behind the shading of the object. That's not good at all...

And by the way, I was investigating using V3d_ZBUFFER as llast parameter of the TriedronDisplay method, but it seem that the triedron is "floating" around. It seems that the triedron is displayed at (0,0,0) until the origin point goes outside the view, and when the triedron is outside the view, it "jumps" to the corner to remain visible. Is it the intended behaviour ? If it is, it is not consistant with the WIREFRAME behaviour. Both should work the same way, or at least be parameterizable. Is it possible to block it in the corner as the WIREFRAME one ?

Thanks,

Stephane

Hugues's picture

Hello,

No the problems still remain in v6.1.

I also have the zoom problem you decribed. That's nice you have cleanly explained most of the problems with V3d_View::TriedronDisplay() (btw should be corrected to TrihedronDisplay).
Maybe the OCC team can take time to fix them for the next release.

Stephane Routelous's picture

Hello,

Thank you for the answer.
I cross my fingers hoping that the problem will be solved.

Stephane