vtk 3.1: still puzzling over vtkInteractorStyle - headers missing?

Damion Shelton dmsst59+ at pitt.edu
Wed Feb 23 14:15:17 EST 2000


I had a problem similar to this - I'm using vtkInteractorStyle in a VC++
6.0 app by linking against the most recently distributed dll (in other
words I'm not recompiling the whole thing). Rather than include specific
classes, I included the vtk.h header under the assumption that this would
take care of including the interactor headers also.... but, it didn't.
Checking vtkGraphics.h revealed that vtkInteractorStyle.h and
vtkInteractorStyleTrackball.h weren't present. After I added them, I had no
problems compiling my program. I didn't think anything of it at the time,
but now I'm wondering if this is a bug and not merely my ignorance. Perhaps
this has been fixed in the nightlies....? I'm using the beta 3.1 build
rather than the nightlies.

As for the previous topic of how to use the vtkInteractorStyle class,
here's how I use it. This is a much less advanced way of tackling the
problem than the other reply posted today - I make the naive assumption
that the style of the interactor is of type vtkInteractorStyleTrackball and
cast the returned to value to conform to this assumption. In the context of
my code it will never be anything else so I can get away with this.... but
it's probably not the greatest programming technique.

For determining current mode.... (note some of this syntax is MFC specific)

void CRtkView::OnUpdateViewRotationJoystick(CCmdUI* pCmdUI) 
{
	vtkInteractorStyleTrackball* style;
	style = (vtkInteractorStyleTrackball*)
this->Interactor->GetInteractorStyle();
	pCmdUI->SetCheck(style->GetTrackballMode()==0);	
}

For setting current mode....

void CRtkView::OnViewRotationJoystick() 
{
	// Change to joystick style rotation
	vtkInteractorStyleTrackball* style;
	style = (vtkInteractorStyleTrackball*)
this->Interactor->GetInteractorStyle();
	style->SetTrackballModeToJoystick();
}

Hope this helps. 

	-Damion-

Damion Shelton
University of Pittsburgh
Musculoskeletal Research Center

> Still having trouble updating to vtk 3.1: vtkInteractorStyle
> 
> vtkInteractorStyle myInteractorStyle = vtkInteractorStyle::New();
> 
> gives the following error message
> 
> advImage.cpp:2415: no method `vtkInteractorStyle::New'
> advImage.cpp:2416: invalid use of undefined type `class
> vtkInteractorStyle'
> /export/home0/stuff/vtk/vtk/common/../graphics/vtkRenderWindowInteractor.
> h:64:  forward declaration of `class vtkInteractorStyle
--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list