Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

evdb::View2D Class Reference

#include <View2D.h>

List of all members.

Public Member Functions

 View2D ()
 ~View2D ()
void Draw ()
void Clear ()
TMarker & AddMarker (double x, double y, int c, int st, double sz)
TPolyMarker & AddPolyMarker (int n, int c, int st, double sz)
TLine & AddLine (double x1, double y1, double x2, double y2)
TPolyLine & AddPolyLine (int n, int c, int w, int s)
TArc & AddArc (double x, double t, double r, double a=0., double b=360.)
TBox & AddBox (double x1, double y1, double x2, double y2)
TText & AddText (double x, double y, const char *text)
TLatex & AddLatex (double x, double y, const char *text)

Private Attributes

std::list< TMarker * > fMarkerL
 List of markers.
std::list< TPolyMarker * > fPolyMarkerL
 List of poly markers.
std::list< TLine * > fLineL
 List of poly lines.
std::list< TPolyLine * > fPolyLineL
 List of poly lines.
std::list< TArc * > fArcL
 List of arcs.
std::list< TBox * > fBoxL
 List of boxes.
std::list< TText * > fTextL
 List of texts.
std::list< TLatex * > fLatexL
 List of LaTeX texts.
std::list< TMarker * >::iterator fNextMarker
 Next in list to use.
std::list< TPolyMarker
* >::iterator 
fNextPolyMarker
 for "add"
std::list< TLine * >::iterator fNextLine
 Try to avoid lots of.
std::list< TPolyLine
* >::iterator 
fNextPolyLine
 "news" and "deletes"
std::list< TArc * >::iterator fNextArc
 to keep things fast
std::list< TBox * >::iterator fNextBox
 to keep things fast
std::list< TText * >::iterator fNextText
std::list< TLatex * >::iterator fNextLatex


Constructor & Destructor Documentation

View2D::View2D  ) 
 

Definition at line 15 of file View2D.cxx.

References AddArc(), AddBox(), AddLatex(), AddLine(), AddMarker(), AddPolyLine(), AddPolyMarker(), AddText(), Clear(), fArcL, fBoxL, fLatexL, fLineL, fMarkerL, fNextArc, fNextBox, fNextLatex, fNextLine, fNextMarker, fNextPolyLine, fNextPolyMarker, fNextText, fPolyLineL, fPolyMarkerL, and fTextL.

00016 { 
00017   fNextMarker     = fMarkerL.end();
00018   fNextPolyMarker = fPolyMarkerL.end();
00019   fNextLine       = fLineL.end();
00020   fNextPolyLine   = fPolyLineL.end();
00021   fNextArc        = fArcL.end();
00022   fNextBox        = fBoxL.end();
00023   fNextText       = fTextL.end();
00024   fNextLatex      = fLatexL.end();
00025 
00026   this->AddMarker(0.0,0.0,2,1,0.1);
00027   this->AddPolyMarker(1,2,20,0.1);
00028   this->AddLine(0.0,0.0,1.0,1.0);
00029   this->AddPolyLine(1,2,1,1);
00030   this->AddArc(0.0,0.0,1.0);
00031   this->AddBox(0.0,1.0,0.0,1.0);
00032   this->AddText(0.0,0.0,"");
00033   this->AddLatex(0.0,0.0,"");
00034   this->Clear();
00035 }

View2D::~View2D  ) 
 

Definition at line 39 of file View2D.cxx.

References fArcL, fBoxL, fLatexL, fLineL, fMarkerL, fPolyLineL, fPolyMarkerL, and fTextL.

00040 {
00041   for_each(fMarkerL.begin(),    fMarkerL.end(),    delete_marker());
00042   for_each(fPolyMarkerL.begin(),fPolyMarkerL.end(),delete_polymarker());
00043   for_each(fLineL.begin(),      fLineL.end(),      delete_line());
00044   for_each(fPolyLineL.begin(),  fPolyLineL.end(),  delete_polyline());
00045   for_each(fArcL.begin(),       fArcL.end(),       delete_arc());
00046   for_each(fBoxL.begin(),       fBoxL.end(),       delete_box());
00047   for_each(fTextL.begin(),      fTextL.end(),      delete_text());
00048   for_each(fLatexL.begin(),     fLatexL.end(),     delete_latex());
00049 }


Member Function Documentation

TArc & View2D::AddArc double  x,
double  t,
double  r,
double  a = 0.,
double  b = 360.
 

Definition at line 194 of file View2D.cxx.

References fArcL, and fNextArc.

Referenced by View2D().

00195 {
00196   TArc* a = 0;
00197   if (fNextArc == fArcL.end()) {
00198     // Grow the list...
00199     a = new TArc(x,y,r,p1,p2);
00200     a->SetBit(kCanDelete,kFALSE);
00201     fArcL.push_back(a);
00202     fNextArc = fArcL.end();
00203   }
00204   else {
00205     // Reuse the arc at the current position
00206     a = *fNextArc;
00207     a->SetX1(x);
00208     a->SetY1(y);
00209     a->SetR1(r);
00210     a->SetR2(r);
00211     a->SetPhimin(p1);
00212     a->SetPhimax(p2);
00213     ++fNextArc;
00214   }
00215   // Return the marker just added so users can twiddle it (ie. add points)
00216   return *a;
00217 }

TBox & View2D::AddBox double  x1,
double  y1,
double  x2,
double  y2
 

Definition at line 221 of file View2D.cxx.

References fBoxL, and fNextBox.

Referenced by evd::TQPad::Draw(), and View2D().

00222 {
00223   TBox* b = 0;
00224   if (fNextBox == fBoxL.end()) {
00225     // Grow the list...
00226     b = new TBox(x1,y1,x2,y2);
00227     b->SetBit(kCanDelete,kFALSE);
00228     fBoxL.push_back(b);
00229     fNextBox = fBoxL.end();
00230   }
00231   else {
00232     // Reuse the arc at the current position
00233     b = *fNextBox;
00234     b->SetX1(x1);
00235     b->SetY1(y1);
00236     b->SetX2(x2);
00237     b->SetY2(y2);
00238     ++fNextBox;
00239   }
00240   // Return the box just added so users can twiddle it
00241   return *b;
00242 }

TLatex & View2D::AddLatex double  x,
double  y,
const char *  text
 

Definition at line 269 of file View2D.cxx.

References fLatexL, and fNextLatex.

Referenced by evd::SimulationDrawer::MCTruthShortText(), and View2D().

00270 {
00271   TLatex* itxt = 0;
00272   if (fNextLatex == fLatexL.end()) {
00273     // Grow the list...
00274     itxt = new TLatex(x,y,text);
00275     itxt->SetBit(kCanDelete,kFALSE);
00276     fLatexL.push_back(itxt);
00277     fNextLatex = fLatexL.end();
00278   }
00279   else {
00280     // Reuse the text at the current position
00281     itxt = *fNextLatex;
00282     itxt->SetText(x,y,text);
00283     ++fNextLatex;
00284   }
00285 
00286   // Return the text just added so users can twiddle it
00287   return *itxt;
00288 }

TLine & View2D::AddLine double  x1,
double  y1,
double  x2,
double  y2
 

Definition at line 141 of file View2D.cxx.

References fLineL, and fNextLine.

Referenced by evd::SimulationDrawer::MCTruthVectors2D(), and View2D().

00142 {
00143   TLine* ln = 0;
00144   if (fNextLine == fLineL.end()) {
00145     // Grow the list...
00146     ln = new TLine(x1,y1,x2,y2);
00147     ln->SetBit(kCanDelete,kFALSE);
00148     fLineL.push_back(ln);
00149     fNextLine = fLineL.end();
00150   }
00151   else {
00152     // Reuse the polyline at the current position
00153     ln = *fNextLine;
00154     ln->SetX1(x1);
00155     ln->SetY1(y1);
00156     ln->SetX2(x2);
00157     ln->SetY2(y2);
00158     ++fNextLine;
00159   }
00160   // Return the marker just added so users can twiddle it (ie. add points)
00161   return *ln;
00162 }

TMarker & View2D::AddMarker double  x,
double  y,
int  c,
int  st,
double  sz
 

Definition at line 84 of file View2D.cxx.

References fMarkerL, and fNextMarker.

Referenced by evd::RecoBaseDrawer::CellHit2D(), evd::SimulationDrawer::FLSHit2D(), evd::RawDataDrawer::RawDigit2D(), and View2D().

00085 {
00086   TMarker* m = 0;
00087   if (fNextMarker == fMarkerL.end()) {
00088     // Grow the list...
00089     m = new TMarker(x,y,st);
00090     m->SetBit(kCanDelete,kFALSE);
00091     m->SetMarkerColor(c);
00092     m->SetMarkerSize(sz);
00093     if (fNextMarker == fMarkerL.begin()) fMarkerL.push_front(m);
00094     else                                 fMarkerL.push_back(m);
00095     fNextMarker = fMarkerL.end();
00096   }
00097   else {
00098     // Reuse the marker at the current position
00099     m = *fNextMarker;
00100     m->SetX(x);
00101     m->SetY(y);
00102     m->SetMarkerSize(sz);
00103     m->SetMarkerColor(c);
00104     m->SetMarkerStyle(st);
00105     ++fNextMarker;
00106   }
00107   // Return the marker just added so users can twiddle it
00108   return *m;
00109 }

TPolyLine & View2D::AddPolyLine int  n,
int  c,
int  w,
int  s
 

Definition at line 166 of file View2D.cxx.

References fNextPolyLine, and fPolyLineL.

Referenced by evd::RecoBaseDrawer::Cluster2D(), and View2D().

00167 {
00168   TPolyLine* pl = 0;
00169   if (fNextPolyLine == fPolyLineL.end()) {
00170     // Grow the list...
00171     pl = new TPolyLine(n);
00172     pl->SetBit(kCanDelete,kFALSE);
00173     pl->SetLineColor(c);
00174     pl->SetLineWidth(w);
00175     pl->SetLineStyle(s);
00176     fPolyLineL.push_back(pl);
00177     fNextPolyLine = fPolyLineL.end();
00178   }
00179   else {
00180     // Reuse the polyline at the current position
00181     pl = *fNextPolyLine;
00182     pl->SetPolyLine(n); // reset elements in PolyLine
00183     pl->SetLineColor(c);
00184     pl->SetLineWidth(w);
00185     pl->SetLineStyle(s);
00186     ++fNextPolyLine;
00187   }
00188   // Return the marker just added so users can twiddle it (ie. add points)
00189   return *pl;
00190 }

TPolyMarker & View2D::AddPolyMarker int  n,
int  c,
int  st,
double  sz
 

Definition at line 113 of file View2D.cxx.

References fNextPolyMarker, and fPolyMarkerL.

Referenced by View2D().

00114 {
00115   TPolyMarker* pm = 0;
00116   if (fNextPolyMarker == fPolyMarkerL.end()) {
00117     // Grow the list...
00118     pm = new TPolyMarker(n);
00119     pm->SetBit(kCanDelete,kFALSE);
00120     pm->SetMarkerColor(c);
00121     pm->SetMarkerStyle(st);
00122     pm->SetMarkerSize(sz);
00123     fPolyMarkerL.push_back(pm);
00124     fNextPolyMarker = fPolyMarkerL.end();
00125   }
00126   else {
00127     // Reuse the polymarker at the current position
00128     pm = *fNextPolyMarker;
00129     pm->SetPolyMarker(n); // reset elements in PolyMarket
00130     pm->SetMarkerColor(c);
00131     pm->SetMarkerSize(sz);
00132     pm->SetMarkerStyle(st);
00133     ++fNextPolyMarker;
00134   }
00135   // Return the marker just added so users can twiddle it (ie. add points)
00136   return *pm;
00137 }

TText & View2D::AddText double  x,
double  y,
const char *  text
 

Definition at line 246 of file View2D.cxx.

References fNextText, and fTextL.

Referenced by View2D().

00247 {
00248   TText* itxt = 0;
00249   if (fNextText == fTextL.end()) {
00250     // Grow the list...
00251     itxt = new TText(x,y,text);
00252     itxt->SetBit(kCanDelete,kFALSE);
00253     fTextL.push_back(itxt);
00254     fNextText = fTextL.end();
00255   }
00256   else {
00257     // Reuse the text at the current position
00258     itxt = *fNextText;
00259     itxt->SetText(x,y,text);
00260     ++fNextText;
00261   }
00262 
00263   // Return the text just added so users can twiddle it
00264   return *itxt;
00265 }

void View2D::Clear  ) 
 

Definition at line 67 of file View2D.cxx.

References fArcL, fBoxL, fLatexL, fLineL, fMarkerL, fNextArc, fNextBox, fNextLatex, fNextLine, fNextMarker, fNextPolyLine, fNextPolyMarker, fNextText, fPolyLineL, fPolyMarkerL, and fTextL.

Referenced by evd::TZProjPad::Draw(), evd::MCBriefPad::Draw(), and View2D().

00068 {
00069   // To clear, just reset the next positions to use for inserts to the
00070   // begining of the lists. Keep all the memory around as it it very likely
00071   // we will reuse it
00072   fNextMarker     = fMarkerL.begin();
00073   fNextPolyMarker = fPolyMarkerL.begin();
00074   fNextLine       = fLineL.begin();
00075   fNextPolyLine   = fPolyLineL.begin();
00076   fNextArc        = fArcL.begin();
00077   fNextBox        = fBoxL.begin();
00078   fNextText       = fTextL.begin();
00079   fNextLatex      = fLatexL.begin();
00080 }

void View2D::Draw  ) 
 

Definition at line 53 of file View2D.cxx.

References fArcL, fBoxL, fLatexL, fLineL, fMarkerL, fPolyLineL, fPolyMarkerL, and fTextL.

Referenced by evd::TZProjPad::Draw(), evd::TQPad::Draw(), and evd::MCBriefPad::Draw().

00054 {
00055   for_each(fArcL.begin(),       fNextArc,       draw_tobject());
00056   for_each(fBoxL.begin(),       fNextBox,       draw_tobject());
00057   for_each(fPolyLineL.begin(),  fNextPolyLine,  draw_tobject());
00058   for_each(fLineL.begin(),      fNextLine,      draw_tobject());
00059   for_each(fMarkerL.begin(),    fNextMarker,    draw_tobject());
00060   for_each(fPolyMarkerL.begin(),fNextPolyMarker,draw_tobject());
00061   for_each(fTextL.begin(),      fNextText,      draw_tobject());
00062   for_each(fLatexL.begin(),     fNextLatex,     draw_tobject());
00063 }


Member Data Documentation

std::list<TArc*> evdb::View2D::fArcL [private]
 

List of arcs.

Definition at line 45 of file View2D.h.

Referenced by AddArc(), Clear(), Draw(), View2D(), and ~View2D().

std::list<TBox*> evdb::View2D::fBoxL [private]
 

List of boxes.

Definition at line 46 of file View2D.h.

Referenced by AddBox(), Clear(), Draw(), View2D(), and ~View2D().

std::list<TLatex*> evdb::View2D::fLatexL [private]
 

List of LaTeX texts.

Definition at line 48 of file View2D.h.

Referenced by AddLatex(), Clear(), Draw(), View2D(), and ~View2D().

std::list<TLine*> evdb::View2D::fLineL [private]
 

List of poly lines.

Definition at line 43 of file View2D.h.

Referenced by AddLine(), Clear(), Draw(), View2D(), and ~View2D().

std::list<TMarker*> evdb::View2D::fMarkerL [private]
 

List of markers.

Definition at line 41 of file View2D.h.

Referenced by AddMarker(), Clear(), Draw(), View2D(), and ~View2D().

std::list<TArc*>::iterator evdb::View2D::fNextArc [private]
 

to keep things fast

Definition at line 54 of file View2D.h.

Referenced by AddArc(), Clear(), and View2D().

std::list<TBox*>::iterator evdb::View2D::fNextBox [private]
 

to keep things fast

Definition at line 55 of file View2D.h.

Referenced by AddBox(), Clear(), and View2D().

std::list<TLatex*>::iterator evdb::View2D::fNextLatex [private]
 

Definition at line 57 of file View2D.h.

Referenced by AddLatex(), Clear(), and View2D().

std::list<TLine*>::iterator evdb::View2D::fNextLine [private]
 

Try to avoid lots of.

Definition at line 52 of file View2D.h.

Referenced by AddLine(), Clear(), and View2D().

std::list<TMarker*>::iterator evdb::View2D::fNextMarker [private]
 

Next in list to use.

Definition at line 50 of file View2D.h.

Referenced by AddMarker(), Clear(), and View2D().

std::list<TPolyLine*>::iterator evdb::View2D::fNextPolyLine [private]
 

"news" and "deletes"

Definition at line 53 of file View2D.h.

Referenced by AddPolyLine(), Clear(), and View2D().

std::list<TPolyMarker*>::iterator evdb::View2D::fNextPolyMarker [private]
 

for "add"

Definition at line 51 of file View2D.h.

Referenced by AddPolyMarker(), Clear(), and View2D().

std::list<TText*>::iterator evdb::View2D::fNextText [private]
 

Definition at line 56 of file View2D.h.

Referenced by AddText(), Clear(), and View2D().

std::list<TPolyLine*> evdb::View2D::fPolyLineL [private]
 

List of poly lines.

Definition at line 44 of file View2D.h.

Referenced by AddPolyLine(), Clear(), Draw(), View2D(), and ~View2D().

std::list<TPolyMarker*> evdb::View2D::fPolyMarkerL [private]
 

List of poly markers.

Definition at line 42 of file View2D.h.

Referenced by AddPolyMarker(), Clear(), Draw(), View2D(), and ~View2D().

std::list<TText*> evdb::View2D::fTextL [private]
 

List of texts.

Definition at line 47 of file View2D.h.

Referenced by AddText(), Clear(), Draw(), View2D(), and ~View2D().


The documentation for this class was generated from the following files:
Generated on Sat Nov 21 04:45:37 2009 for NOvA Offline by  doxygen 1.3.9.1