[IGSTK-Developers] View class refactoring

Andinet Enquobahrie andinet.enqu at kitware.com
Thu Aug 16 14:25:51 EDT 2007


Torleif,


> 2. If I start more than one igstk::ViewNew2D, the objects added to  
> these disappear. No mentionis made in the log from the views.
> Try something like this:
>
> widget1 = new igstk::QTWidget();
> view1 = igstk::ViewNew2D::New();
> widget1->RequestSetView(view1);
>
> widget2 = new igstk::QTWidget();
> view2 = new igstk::ViewNew2D::New();
> widget2->RequestSetView(view2);
>
> igstk::EllipsoidObject::Pointer ellipsoid =  
> igstk::EllipsoidObject::New();
> ellipsoid->SetRadius(1,2,3);
>
> igstk::EllipsoidObjectRepresentation::Pointer ellipsoidRepresentation1 =
>     igstk::EllipsoidObjectRepresentation::New();
> ellipsoidRepresentation1->RequestSetEllipsoidObject(ellipsoid);
> ellipsoidRepresentation1->SetColor(0.0,1.0,0.0);
>
> igstk::EllipsoidObjectRepresentation::Pointer ellipsoidRepresentation2 =
>     igstk::EllipsoidObjectRepresentation::New();
> ellipsoidRepresentation2->RequestSetEllipsoidObject(ellipsoid);
> ellipsoidRepresentation2->SetColor(0.0,0.0,1.0);
>
> widget1->RequestEnableInteractions();
> view1->RequestSetOrientation(igstk::ViewNew2D::Axial);
> view1->RequestInitializeRenderWindowInteractor();
> view1->RequestStart();
> view1->RequestAddObject(ellipsoidRepresentation1);
>
> widget2->RequestEnableInteractions();
> view2->RequestSetOrientation(igstk::ViewNew2D::Coronal);
> view2->RequestInitializeRenderWindowInteractor();
> view2->RequestStart();
> view2->RequestAddObject(ellipsoidRepresentation2);


You can add more than one widget to your application.  That shouldn't 
cause spatialobject
rendering to disappear. The main constraint is only a single view object 
can be attached to a
widget. This is similar to the way you are doing it above. Having said 
that,  the rendered objects
could disappear if you set to the object a transform with a very short 
expiration time.

To give you a concrete example and also to try to reproduce the problem 
you reported,
I created a test

igstQTWidgetTest2.cxx

in the sandbox.

This test instantiates two QT widgets and two view objects which contain 
ellipsoid spatialobject
similar to the above code.

If you update-configure-build your sandbox and run this test, you will 
see the two ellipsoid objects displayed
next to each other. The objects don't disappear since I set a long 
expiration time for the transform.

-Andinet


>
> Torleif
>


-- 
==========================================================
Andinet A. Enquobahrie, PhD
R&D Engineer
Kitware Inc.

28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x124
www.kitware.com





More information about the IGSTK-Developers mailing list