[vtkusers] integrate a vtkOrientationMarkerWidget into aQVtkWidget

John Platt jcplatt at dsl.pipex.com
Mon Nov 28 18:49:03 EST 2011


Hi,

This is the essence of what I do in a QVTKWidget derived class ...

    m_vtkRenderer = vtkRenderer::New();
    vtkRenderWindow* renWin = GetRenderWindow();
    renWin->AddRenderer( m_vtkRenderer );

    m_vtkAxesWidget = vtkOrientationMarkerWidget::New();
    m_vtkAxesWidget->SetDefaultRenderer( m_vtkRenderer );
    vtkRenderWindowInteractor* rwi = 
m_vtkRenderer->GetRenderWindow()->GetInteractor();
    m_vtkAxesWidget->SetInteractor( rwi );

    vtkAxesActor* axes = vtkAxesActor::New();
    m_vtkAxesWidget->SetOrientationMarker ( axes );
    axes->Delete();

m_vtkRenderer & m_vtkAxesWidget are class members.

HTH

John.

----- Original Message ----- 
From: "HamidG" <listboss at gmail.com>
To: <vtkusers at vtk.org>
Sent: Monday, November 28, 2011 10:49 PM
Subject: Re: [vtkusers] integrate a vtkOrientationMarkerWidget into 
aQVtkWidget


>
> Jean-Loïc wrote
>>
>> // "Cast" QVTKWidget to  vtkRenderWindowInteractor
>> vtkRenderWindow* renWin1 = QVTKWidget->GetRenderWindow();
>> renWin1->AddRenderer( QVTKWidget->GetRenderer() );
>>
> I am confused, QVTKWidget doesn't have GetRenderer()
>
>
> Jean-Loïc wrote
>>
>> vtkRenderWindowInteractor* iren1 = QVTKWidget->GetInteractor();
>> // Call vtkRenderWindowInteractor in orientation marker widgt
>> vtkOrientationMarkerWidget* widget = vtkOrientationMarkerWidget::New();
>> widget->SetOutlineColor( 0.9300, 0.5700, 0.1300 );
>> widget->SetOrientationMarker( this->m_Axes );
>> widget->SetInteractor( renWin1->GetInteractor() );
>>
> Did you also mean
> widget->SetInteractor( iren1 );
> Instead of widget->SetInteractor( renWin1->GetInteractor() ) ?
>
> I am nitpicking because I've wasted 10 hours to get this thing work, a
> simple integration of vtkOrientationMarkerWidget into QVTKWidget without
> getting crashes or blank render windows :(
>
> Any help is appreciated.
>
> thanks in advance,
>
> --
> View this message in context: 
> http://vtk.1045678.n5.nabble.com/integrate-a-vtkOrientationMarkerWidget-into-a-QVtkWidget-tp2843764p5030404.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: 
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 





More information about the vtkusers mailing list