[vtkusers] Question on Viewports/vtkChartXY/SetGeometry in example TestMultipleChartRenderers.cxx

Frese Daniel Dr. frese at heidenhain.de
Mon Nov 29 10:49:51 EST 2010


Hi !

I am quite new to this stuff so please be patient in case I write just nonsense here...
I try to display two items (for now e.g. two vtkChartXY) using the 2D API. I tried to go along the example .../Testing/Cxx/TestMultipleChartRenderers.cxx, but unfortunately already this example does not work for me quite as expected.
If I understand correctly, in this example the rendering window is split into several viewports and each viewport gets a renderer and so on. If I execute, the window is split as advertised, but the plots are badly clipped; basically the charts are not scaled to the corresponding viewport size. It just looks horrible.

Digging a bit deeper I found, that the vtkChartXY seem to get their geometry information from their scenes, so I set explicitly the geometry of the corresponding scenes. I  modified TestMultipleChartRenderers.cxx a bit to have a look at that:

int TestMultipleChartRenderers(int , char * [])

 ....

chartScene->SetRenderer(ren);
        lastscene = chartScene;
        sizeX = (viewports[4*i+2] - viewports[4*i]) * 800;
        sizeY = (viewports[4*i+3] - viewports[4*i+1]) * 640;
        chartScene->SetGeometry(sizeX, sizeY);

...

iren->Initialize();
cout << "Print() Output of last scene before rendering" << endl;
lastscene->Print(cout);
renwin->Render();
cout << "Print() Output of last scene after rendering" << endl;
lastscene->Print(cout);
iren->Start();

...

Output is:

Print() Output of last scene before rendering
vtkContextScene (030798A0)
  Debug: Off
  Modified Time: 2084
  Reference Count: 1
  Registered Events:
    Registered Observers:
      vtkObserver (0307A388)
        Event: 2
        EventName: DeleteEvent
        Command: 030783C0
        Priority: 0
        Tag: 2
      vtkObserver (0307A368)
        Event: 2
        EventName: DeleteEvent
        Command: 03076858
        Priority: 0
        Tag: 1
  Widthxheight: 400     320

Print() Output of last scene after rendering
vtkContextScene (030798A0)
  Debug: Off
  Modified Time: 3056
  Reference Count: 1
  Registered Events:
    Registered Observers:
      vtkObserver (0307A388)
        Event: 2
        EventName: DeleteEvent
        Command: 030783C0
        Priority: 0
        Tag: 2
      vtkObserver (0307A368)
        Event: 2
        EventName: DeleteEvent
        Command: 03076858
        Priority: 0
        Tag: 1
  Widthxheight: 800     640

So in the first case the 400 X 320 pixel geometry is what I expected, since for that last scene the viewport  is set to { 0.5,0.5,1.0,1.0 } and the window dimensions are 800 X 640, but after the explicit call to Render(), this seems to be reset.

So any ideas on that ? Am I doing something wrong here ?

Thank you,
Daniel





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101129/3dacb754/attachment.htm>
-------------- next part --------------
</PRE><p>
------------------------------------------------------------------------------------------------------ <br>
Registergericht: Traunstein / Registry Court: HRB 275 - Sitz / Head Office: Traunreut <br>
Aufsichtsratsvorsitzender / Chairman of Supervisory Board: Rainer Burkhard <br>
Gesch?ftsf?hrung / Management Board: Thomas Sesselmann (Vorsitzender / Chairman),<br>
Michael Grimm, Matthias Fauser, Sebastian Tondorf<br><br>
<a href="http://www.heidenhain.de/disclaimer" target="_blank">E-Mail Haftungsausschluss / E-Mail Disclaimer</a><br><pre>


More information about the vtkusers mailing list