Control plot appearance in vtk / Qt

I display a vtk surface plot inside a QVTKWidget. The QVTKWidget supports interaction, i.e., I can e.g. zoom or rotate. I would like to control the initial appearance of the plot before any user interaction: Zoom factor, view angle, surface color mapping. Which object(s) do I have to manipulate for that? I was looking at the interfaces of vtkChartXYZ, vtkContextScene, vtkCamera, vtkRenderer, but have't found a good way to set the above parameters. What would be the best way to do this?

QVTKWidget vtkWidget;
vtkSmartPointer<vtkContextView> view  = vtkSmartPointer<vtkContextView>::New();
vtkSmartPointer<vtkChartXYZ>    chart = vtkSmartPointer<vtkChartXYZ>::New();

vtkSmartPointer<vtkTable> surface = vtkSmartPointer<vtkTable>::New();
// ... fill surface with some data ...

chart->SetGeometry(vtkRectf(0.0, 0.0, 300, 300));

vtkSmartPointer<vtkPlotSurface> plot = vtkSmartPointer<vtkPlotSurface>::New();
// ... set up plot ...



Regarding the zoom, I had the same issue and I solved by deriving the vtkInteractorStyleImage class, that I used for the interaction with the image in the QVTKWidget.

Basically, that class allows the zoom with the mouse wheel and, in fact, it has (among the others) the methods OnMouseWheelForward() and OnMouseWheelBackward(); but they are private. Deriving that class, I redefined those methods (OnMouseWheelForward() and OnMouseWheelBackward()) as public. Let's indicate the instance of the derived class with "myInteractorStyle".

This way, as soon as the image is rendered in the QVTKWidget (and myInteractorStyle has been assigned to the interactor) , I did something like this (assuming that you wanna increase the zoom):

for (int i = 0; i < zoomLevel; ++i){
   //Or OnMouseWheelBackward(), if you want to reduce the zoom

So, your zoom level is satisified from the beginning of the interaction. I think that, in the same way, you could solve also your other issues.

Need Your Help

JPA select List<Object> from entity order by list elements attribute

java hibernate jpa jpql

Im having a self reffering datamodel. Im trying to get a list of children ordered by an attribute using JPA (Hibernate). But Im having problems with the JPQL. Do you have a suggestion on how I can ...

How many copies of program/class gets loaded into memory when multiple users accessing it at the same time

linux memory jvm loading sharing

We are trying to setup Eclipse in a shared environment, i.e., it will be installed on a server and each user connects to it using VNC. There are different reasons for sharing Eclipse, one being pro...