Hi all, <br><br>I need to implement 3DConnexion Space Navigator support
in my VTK application. To know a little bit more, this device are used
to control 3D navigation in a scheme, like rotation, zooming, move and
others. <br>I read an old post in the list, but no answers are returned. I was read the VTK interactor and relative classes (interactorStyle, vtkXRenderWindowInteractor ) to try to understand how to implement this, but without success. <br>
Since I'm using X11, this device will send to me a ClientMessage XEvent
type, with the data about move position or button click. I'm current
handling this in Qt, without problems ( the code are at the end to
illustrate better what's I need to do). Now, I need to do in VTK, but I'm a little bit confused
about wich class(es) I need to re implement or inherits to give this
support. vtkRenderWindowInteractor? vtkInteractorStyle? Or something
completely new?<br>I know this classes are changing from VTK 5.0 to 5.2, and I'm using VTK 5.0.4.<br>
<br>Can someone helps and put me in the correct way?<br><br>Thks in advance!<br><br><br>Wagner Sales<br><br><br>The Qt code to handle the event:<br>bool QtSpaceNavigatorWidget:<div id="mb_0">:x11Event(XEvent *event)<br>{<br>
MagellanFloatEvent MagellanEvent;<br>
double MagellanSensitivity = 1.0;<br> Display *display = QX11Info::display();<br> {<br> if(!display)<br> {<br> qDebug() << "Cannot open display!" << endl;<br> }<br>
}<br> if ( !MagellanInit( display, winId() ) )<br> {<br> qDebug() << "No Space Navigator driver exists";<br> return false;<br> };<br><br> switch (event->type)<br>
{<br>
case ClientMessage:<br> switch( MagellanTranslateEvent( display, event, &MagellanEvent, 1.0, 1.0 ) )<br> {<br> case MagellanInputMotionEvent :<br> MagellanRemoveMotionEvents( display );<br>
// now we will be set the values from Space Navigator on the text labels<br> xvalue->setText(QString::number(MagellanEvent.MagellanData[ MagellanX ]));<br> yvalue->setText(QString::number(MagellanEvent.MagellanData[ MagellanY ]));<br>
zvalue->setText(QString::number(MagellanEvent.MagellanData[ MagellanZ ]));<br> avalue->setText(QString::number(MagellanEvent.MagellanData[ MagellanA ]));<br> bvalue->setText(QString::number(MagellanEvent.MagellanData[ MagellanB ]));<br>
cvalue->setText(QString::number(MagellanEvent.MagellanData[ MagellanC ]));<br> return false;<br> <br> break;<br> <br> case MagellanInputButtonPressEvent :<br> qDebug() << "MagellanInputButtonPressEvent called" << endl;<br>
<br> switch ( MagellanEvent.MagellanButton )<br> {<br> case 5: MagellanApplicationSensitivity( display, MagellanSensitivity / 2.0 ); break;<br> case 6: MagellanApplicationSensitivity( display, MagellanSensitivity * 2.0 ); break;<br>
case 7: MagellanApplicationSensitivity( display, 1.0 ); break;<br> };<br><br> switch( MagellanEvent.MagellanButton )<br> {<br>
case 5: MagellanSensitivity = MagellanSensitivity <=
1.0/32.0 ? 1.0/32.0 : MagellanSensitivity/2.0; break;<br>
case 6: MagellanSensitivity = MagellanSensitivity >= 32.0 ? 32.0 : MagellanSensitivity*2.0; break;<br> case 7: MagellanSensitivity = 1.0; break;<br> }; <br>
switch( MagellanEvent.MagellanButton )<br> {<br> case 5:<br> case 6:<br> case 7:<br> printf("Application Sensitivity = %lf \n", MagellanSensitivity );<br>
break;<br> };<br> return false;<br> break;<br><br> case MagellanInputButtonReleaseEvent :<br> qDebug() << "MagellanInputButtonPressEvent called" << endl;<br>
return false;<br> break;<br> }<br> default:<br> return false;<br> break;<br> }<br> return false;<br><br>}</div>