Re: TView on the 'background'

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Feb 26 2000 - 11:26:30 MET


Hi Rutger,
The way you create TView is OK. I have to know a bit more about
what your Track class is (how you draw it?) to come with a diagnostic.
Look at $ROOTSYS/tutorials/tornado.C for a simple example.
Did you derive your class from TAtt3D ?
At least one 3-d object must be in the pad to get the view cursor.

Rene Brun


On Fri, 25 Feb 2000, Rutger van der Eijk wrote:

> Hi,
> 
> I want to be able to rotate a track which I draw on a canvas by using a
> TView.
> 
> I have some geometry description with the ROOT geometry classes. If I draw
> the geometry on a canvas I am able to rotate it. The rotation is provided
> by TView. I always get the rotation symbol if the TView is 'selected'
> (i.e. shortest distanceToPrimitive; turning on 'Event Status' in canvas
> tells me).
> 
> I want to be able to do the same thing (rotate from a TView) with a track
> that I paint. So as done in TNode::Draw() (which is called by
> TGeometry::Draw()) I create a TView:
> 
>    if (!gPad) {
>       if (!gROOT->GetMakeDefCanvas()) return;
>       (gROOT->GetMakeDefCanvas())();
>    }
>    gPad->Clear();
> 
>    TView *view = gPad->GetView();
>    if (!view) {
>       view = new TView(1);
>       view->SetRange(-100, -250, 300, 100, 250, 1000);
>      // where the range is the range where the track can be present
>    }
> 
> and after that draw by track
> 
> The track is correctly painted, but I am not able to rotate the track
> because TView is never 'selected'. Instead of TView the created canvas
> (c1) is selected.
> 
> Why doesn't this work? Or better why is TView selected after a geometry
> draw, and in my simple case not? 
> 
> (I know I can use a TMarker3DBox to get a box which helps me rotate, but I
> want to rotate without having to refer to the TMarker3DBox edges. Which
> works with TView on the 'background', i.e. always 'selected' if no other
> object is.)
> 
> I have the feeling I am missing something trivial. But I seem not to be
> able to figure out what. Can anyone show me the light?
> 
> Thanks,
> 
> Rutger
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:20 MET