[vtkusers] How to show and control one vtkSphereWidget in different windows?

jiang jiang at TI.Uni-Trier.DE
Thu Nov 6 05:09:34 EST 2003


Hi, all,
I want to show one vtkSphereWidget in two windows. And if I move the sphere
in one window, it will also be moved in the other window. My code is below,
but it doesn't work.

class 1:
AddMarker(vtkSphereWidget* Marker)
{
	Marker->SetInteractor( iren);
	Marker->SetProp3D(volume);
	Marker->SetPlaceFactor(0.15);
	Marker->PlaceWidget();
}

class 2:
AddMarker(vtkSphereWidget* Marker)
{
	Marker->SetInteractor( m_Interactor);
	Marker->SetPlaceFactor(0.15);
	Marker->PlaceWidget(m_Actor->GetBounds());
}


class main:
{
	vtkSphereWidget* Marker=vtkSphereWidget::New();
	c1->AddMarker(Marker);
	c2->AddMarker(Marker);

	Marker->TranslationOn();
	Marker->ScaleOff();
	Marker->HandleVisibilityOff();
	Marker->SetRepresentationToSurface();
	Marker->GetSphereProperty()->SetColor(1,1,0);
	Marker->SetEnabled(1);
}

When I run it, the sphere isn't shown on screen. If I only call
c1->AddMarker(Marker); I can see the sphere is shown in c1 window.

How can I solve this problem?

Thank you very much!

Chunyan




More information about the vtkusers mailing list