Re: problem with loaded function

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Sep 30 1997 - 15:50:36 MEST


Hi Pasha,

   you would do something like this:

void DriftChamber::Draw(Option_t *opt)
{
   AppendPad(opt);
}

void DriftChamber::Paint(Option_t *opt)
{
   TLine l;

   l.PaintLine(x1,y1,x2,y2);
   l.PaintLine(x1,y11,x2,y2);
   // etc.

}

So you see in the Paint() function you only need one TLine or other
primitive object which you can use to paint as many copies as you want.

Cheers, Fons.


Pasha Murat wrote:
> 
> Fons Rademakers writes:
>  > Hi Pasha,
>  >
>  >    the answer is scope. In the function example the TPaveLabel pel
>  > is deleted as soon as the function returns (stack variable goes out
>  > of scope and dtor deletes it from canvas). Use new to create TPaveLabel.
>  >
> 
>         Hi Fons,
> 
> suppose that I have a complex object, say , drift chamber, drawing of which
> requires ~10**5 graphics primitives to be put on the screen (hits, wires...)
> - CDF central drift chamber for example has 3*10**4 wires:
> 
> class DRIFT_CHAMBER : public TObject {
> ...
>         void Draw (Option_t* opt);
> ...
> };
> 
> DRIFT_CHAMBER DriftChamber;
> 
> How it is possible to draw a DriftChamber thing on the screen w/o allocating
> dynamically an object per graphics primitive, but having
> DRIFT_CHAMBER::Draw method drawing all of them?
> 
> Some time ago we ran into a problem with having object per primitive with OpenGL,
> where there is a limit on the number of objects to be put into selection stack...
> 
>                                                 Thanks a lot, Pasha.

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET