DiscussionsIssue archiveOther usage issues

Archived discussion

Transient Graphics interference with highlights

Other usage issuesTue, 04/03/2001 - 15:163 replies

Browse this forum
QuestionAuthor

Hello.

I'm trying to draw some transient graphics (in this case it's just a crosshair) in my view without affecting the default highlights.

I'm using "Visual3d_TransientManager" to do this but I'm still a little confused.

I don't really understand the difference between "BeginDraw" and "BeginAddDraw".

I guess there's a kind of redrawing with "BeginDraw"?

I managed to keep default highlights using "BeginAddDraw" and making the View Update myself.

Here's the piece of code I use (the crosshair is still a simple marker):

MyView->Redraw();

MyGroup->Clear();

MyView->ConvertToGrid(px , py , x, y, z); ////grid echo is turned of

MyAISContext->MoveTo(event->win_x , event->win_y, MyView);

Visual3d_TransientManager::BeginAddDraw(MyView->View;

Graphic3d_Vertex aVertex;

aVertex.SetCoord(x, y, z);

MyGroup->Marker(aVertex);

Visual3d_TransientManager::DrawStructure (MyStructure); ///// MyStructure contains MyGroup

Visual3d_TransientManager::EndAddDraw();

This works almost fine but the highlight flickers just a little due to the redraws.

Even stranger is that the default grid echo marker also interferes with the highlighting.

This code doesn't show highlights (or just shows them for a split of a second):

MyView->ConvertToGrid(px , py , x, y, z); //// grid echo is turned on

MyAISContext->MoveTo(px , py, MyView);

In this case redrawing the View doesn't seem to help.

Does anyone know a better way to do this?

I'm using Cascade release 3.1. Did this methods improved in latter versions? Thanks.

Discussion

3 archived replies

Posts are displayed in their archived order.

01Commenter-1

It is not clear to me, why you use Visual3D_TransientManager. Is there a special reason for doing this? Normally a crosshair is 2D. But you use Visual3D and then convert back to ViewCoordinates. Why do you want to keep default highlights? You have to give more information. Their a several possibilities. Furthermore, highlighting can be steered via the AISContext.

Best regards,

Commenter-1 Gandyra

------------------------------------------------------------------

University of Kaiserslautern

Research Group for Computer Application in Engineering Design

------------------------------------------------------------------

02Author

Hello Michael.

Thanks for answering my post.

I'm using Visual3D_TransientManager because MyView is a "V3d_View" and the crosshair should follow x and y axis.

I also want to keep default highlights mainly because I'm still not very comfortable using AIS. I still don't know how to highlight just a detected edge.

If I call "MyAISContext->DetectedInteractive()" I get an "AIS_InteractiveObject" (wich is the only object I know how to highlight) but the entire object is highlighted not just the edge even if I call "MyAISContext->ActivateStandardMode(TopAbs_EDGE)".

If I call "MyAISContext->DetectedShape()" I get the edge (I guess if I called "MyAISContext->ActivateStandardMode(TopAbs_SHAPE)" I would get the hole shape?) but there's no method in AISContext to highlight that.

Regarding transient graphics, using "Visual3D_TransientManager" is just the only way I know.

Has you can see I'm just grasping this issues.

Nevertheless I think that if the viewer has the methods to work with AIS and manage the highlighting of entities why not use them.

Here is the code I use:

MyView->Redraw(); MyView->ConvertToGrid(px , py , x, y, z); MyAISContext->MoveTo(px , py, MyView);

MyGroup->Clear(); Visual3d_TransientManager::BeginAddDraw(MyView->View());

Graphic3d_Vertex V1, V2, V3, V4;

V1.SetCoord(x - 1000, y, z);

V2.SetCoord(x + 1000, y, z);

V3.SetCoord(x, y - 1000, z);

V4.SetCoord(x, y + 1000, z);

MyGroup->Polyline(V1, V2);

MyGroup->Polyline(V3, V4);

Visual3d_TransientManager::DrawStructure(MyStructure);

Visual3d_TransientManager::EndAddDraw();

Would you please elucidate this newbee!?

Thanks a lot.

03Commenter-1

O.K. Newbee ! :-)

1. Rule: RTFM ! - I know, the manual is not perfect and some parts are undocumented, but the major part is quite useful in its current state. Especially AIS things are quite good documented, I think. If you don't find information in the manuals, very often there are comments in cdl- and cxx-files.

2. Rule: Learn from the samples ! Everything, what you need (without crosshair) is documented in the "SampleAISSelect" sample. Just copy and paste (if you work on linux, there are probably some similar examples, I guess). For the samples there are also some useful manuals (pdf's).

3. Rule: Learn from the source code ! Try to find inheritance correlations between the classes. This is good to practice OpenCasCade.

For your (highlighting) problem you need a local context (see sample).

Concerning the TransientManager I can send you some (undocumented) code snippets, where you can learn from, to find out how to solve this.

Best regards,

Commenter-1 Gandyra

------------------------------------------------------------------

University of Kaiserslautern

Research Group for Computer Application in Engineering Design

------------------------------------------------------------------