RE: problem with TView zoom

From: G.Mavromanolakis <gmavroma_at_mail.cern.ch>
Date: Tue, 21 Feb 2006 10:37:09 +0100 (CET)


Hi all,
I use both projections. The code looks something like this

   void ShowView(int opt=0)
   {

      theLayout->Draw();

//gPad->Modified();
//gPad->Update();
int iret; switch(opt) { case 0: gPad->GetView()->SetPerspective(); //gPad->GetView()->SetView(-65,127,-73,iret); gPad->GetView()->SetView(-335,127,-73,iret); gPad->GetView()->ZoomView(0,1.9); break; case 1: gPad->GetView()->SetParallel(); gPad->GetView()->SetView(90,180,0,iret); gPad->GetView()->ZoomView(0,1.5); //gPad->GetView()->Top(); break; } gPad->SetFillColor(17);//light grey gPad->Modified(); gPad->Update();

   }

"Zooms" worked as expected with ROOTv4.02.00 or older. With newer versions they do not. As Jan and Olivier suggested a fix is to update the gPad immediately after any TNode::Draw() i.e. after theLayout->Draw();
The gPad->Modified();gPad->Update(); at the last lines do update correctly any rotation, projection, style attribute of the view but not zooms after version 4.02

Regards,
George

On Mon, 20 Feb 2006, Fine, Valeri wrote:

> Can you elaborate what kind of the projection you used Orthographic  or perspective.
>  
> In my mind the default was changed sometimes ago and it must affect the way Zoom method "look and feel"
>  
> Can you toggle the projection  to make sure that may have cured the problem you reported.
> See: 
>  
> http://root.cern.ch/root/htmldoc//src/TView.cxx.html#TView:SetPerspective 
>  
> http://root.cern.ch/root/htmldoc//src/TView.cxx.html#TView:SetParallel
>  
>  
> 
> ________________________________
> 
> From: owner-roottalk_at_pcroot.cern.ch on behalf of G.Mavromanolakis
> Sent: Thu 2/16/2006 5:33 AM
> To: roottalk_at_pcroot.cern.ch
> Cc: gmavroma_at_mail.cern.ch
> Subject: [ROOT] problem with TView zoom
> 
> 
> 
> Hello ROOTers,
> 
> I am developing a 3d event display for a monitor application.
> I used ROOTv4.02.00 under ScientificLinux3 and I tried to switched
> recently to a newer version. I experience some strange behavior from
> the zoom methods in TView class. They work as expected
> when invoked within the CINT or by clicking a TView object on a
> pad. But when they are put in a macro or source code they produce
> no effect.
> For example something like
> 
> void test()
> {
>    TCanvas *c1 = new TCanvas("c1","The ... canvas",200,10,700,700);
>    c1->cd();
> 
>    BuildLayout()->Draw();
>    //ShowAxis(-15,-15,-20,4);
>    ShowView(1.);
> 
>    
>    TCanvas* c2 = new TCanvas("c2","The ... canvas",200,10,700,700);
>    c2->cd();
> 
>    BuildLayout()->Draw();
>    //ShowAxis(-15,-15,-20,4);
>    ShowView(0.5);
> 
> }
> 
> with
> 
> void ShowView(float zoomfactor)
> {
>    gPad->GetView()->ZoomView(0,zoomfactor);
>    gPad->SetFillColor(17);//light grey
>    gPad->Modified();
>    gPad->Update();
> }
> 
> should produce 2 canvases with one normal and one small view.
> This is the case for v4.02.00 or older. When trying with a newer version
> (4.04.02g, 5.08.00) there is no zoom, the example above
> gives 2 identical canvases!
> 
> Also the TView::Zoom, ZoomIn, ZoomOut methods behave similarly
> strange, ie they give no effect. 
> 
> Any hints??? Am I doing something wrong???
> 
> Thanks and regards,
> George
> 
> PS. I attach a small example macro
> (run it from root with
> .L test.C
> test()
> ) 
> 
> 
Received on Tue Feb 21 2006 - 10:37:15 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET