Hello.
I’m trying to control the position of the Axes (vtkOrientationMarkerWidget).
In our interface, there should be an option to change the position with 4 possible values: Bottom left, bottom right, top left, top right).
I know that I can set the position of the vtkOrientationMarkerWidget with the call to setViewport, but that seems to only work the first time.
I’m using VTK 7.1.1 with Visual Studio 2010.
Here a snippet of my code:
// initialization, in constructor of the class that handle the vtkRenderer. All with m_ are properties of the class. // Axes actor m_axesActor = vtkSmartPointer<vtkAxesActor>::New(); m_axesActor->SetPickable(0); // Orientation marker that synchronizes its orientation with the camera position. m_widget = vtkSmartPointer<vtkOrientationMarkerWidget>::New(); m_widget->SetInteractor(m_renderWindowInteractor); // vtkSmartPointer<vtkRenderWindowInteractor>, interactor of the render window. m_widget->SetOrientationMarker( m_axesActor ); m_widget->SetViewport(0, 0, 0.4, 0.4); // bottom left, works OK. m_widget->SetEnabled(1); m_widget->InteractiveOff(); // i don't want to be interactable... // After, in method to change the position: void changePosition(int position) { // This has no effect if (position == AXES_POSITION_BOTTOM_LEFT) m_widget->SetViewport(0, 0, 0.4, 0.4); else if (position == AXES_POSITION_BOTTOM_RIGHT) m_widget->SetViewport(0.6, 0.6, 1.0, 1.0); else if (position == AXES_POSITION_TOP_LEFT) m_widget->SetViewport(0, 0.6, 0.4, 1.0); else if (position == AXES_POSITION_TOP_RIGHT) m_widget->SetViewport(0.6, 0.6, 1.0, 1.0); // more code follows, with calls to redraw and sort... }
Thank you.