> quick question. i have a pad in which i have drawn a figure (in
> this
> case, the 2-D layout of a detector). i would like to draw other
> figures on top of this detector (specifically, trajectories).
> however, i would like to draw them one at a time and, thus, every
> time i hit a button to draw the next event, i want the old event
> erased, but the original picture of the layout to remain where it
> was. is there a quick way to do this? i just don't want to redraw
> the layout every time a user wants to display a new event. i can
> think of some solutions, but they are all memory intensive. any
> suggestions?
It is very way ROOT works.
I'd like to remind ROOT user. the TObject::Draw() usually just
append the pointer to your object to the list of the primitive of the
current TPad. The "painting" is to provide by TObject::Paint()
method. This method is called by TPad::Update for all modified
object on its "list of primitives".
Update() method is either called "by hand" or by several other
occasions. For example the user press "Enter" key finishing his/her
macro, when user Resize window with some other "window" events as
well.
For you this means if you Remove your previous object from the list
of the TPad primitives and call <your_new_object>::Draw() with any
next "Pad" event" you will get the picture reflecting the current
status of the TPad "list of the primitives". Sure every thing will
be recalculated and re-painted with method Paint().
I think the place where you can optimize things is very this
method of your class('es). One can think about a "special user's
customized and derived from TPad class". This way you have full
control over TUserPad::Paint method.
From another hand I'd like to call your attention each "standard"
ROOT TPad works in so-called "double-buffered mode". This means there
is a "hiden" pixmap image of each TPad anyway. During TCanvas::Paint
all TPad pixpams are to be painted onto "the screen"
The solution would be the "transparent" TPad background color.
Been implemented it allows creating several overlaping TPads and gain
what you are asking about (but it costs memory anyway).
May be Rene will supply more "direct" advice as well.
Valery
=================================================================
Dr. Valeri Faine (Fine)
------------------- Phone: +1 516 344 7806
Brookhaven National Laboratory FAX : +1 516 344 4206
Bldg. 510A /STAR mailto:fine@bnl.gov
Upton, New York, 11973-5000 http://nicewww.cern.ch/~fine
USA
Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su