Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | 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)

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< 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


Constructor & Destructor Documentation

View2D::View2D  ) 
 

Definition at line 15 of file View2D.cxx.

References AddArc(), AddBox(), AddLine(), AddMarker(), AddPolyLine(), AddPolyMarker(), AddText(), Clear(), fArcL, fBoxL, fLineL, fMarkerL, fNextArc, fNextBox, 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 
00025   this->AddMarker(0.0,0.0,2,1,0.1);
00026   this->AddPolyMarker(1,2,20,0.1);
00027   this->AddLine(0.0,0.0,1.0,1.0);
00028   this->AddPolyLine(1,2,1,1);
00029   this->AddArc(0.0,0.0,1.0);
00030   this->AddBox(0.0,1.0,0.0,1.0);
00031   this->AddText(0.0,0.0,"");
00032   this->Clear();
00033 }

View2D::~View2D  ) 
 

Definition at line 37 of file View2D.cxx.

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

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


Member Function Documentation

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

Definition at line 189 of file View2D.cxx.

References fArcL, and fNextArc.

Referenced by View2D().

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

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

Definition at line 216 of file View2D.cxx.

References fBoxL, and fNextBox.

Referenced by evd::PlaneView::DrawMCHits(), evd::PlaneView::DrawPlaneClusters(), evd::PlaneView::DrawRawDigit(), evd::PlaneView::DrawTracks(), and View2D().

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

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

Definition at line 136 of file View2D.cxx.

References fLineL, and fNextLine.

Referenced by evd::PlaneView::DrawMC(), evd::PlaneView::DrawTracks(), and View2D().

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

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

Definition at line 79 of file View2D.cxx.

References fMarkerL, and fNextMarker.

Referenced by View2D().

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

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

Definition at line 161 of file View2D.cxx.

References fNextPolyLine, and fPolyLineL.

Referenced by evd::PlaneView::DrawFilament(), and View2D().

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

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

Definition at line 108 of file View2D.cxx.

References fNextPolyMarker, and fPolyMarkerL.

Referenced by View2D().

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

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

Definition at line 241 of file View2D.cxx.

References fNextText, and fTextL.

Referenced by View2D().

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

void View2D::Clear  ) 
 

Definition at line 63 of file View2D.cxx.

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

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

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

void View2D::Draw  ) 
 

Definition at line 50 of file View2D.cxx.

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

Referenced by evd::PlaneView::Draw().

00051 {
00052   for_each(fArcL.begin(),       fNextArc,       draw_tobject());
00053   for_each(fBoxL.begin(),       fNextBox,       draw_tobject());
00054   for_each(fPolyLineL.begin(),  fNextPolyLine,  draw_tobject());
00055   for_each(fLineL.begin(),      fNextLine,      draw_tobject());
00056   for_each(fMarkerL.begin(),    fNextMarker,    draw_tobject());
00057   for_each(fPolyMarkerL.begin(),fNextPolyMarker,draw_tobject());
00058   for_each(fTextL.begin(),      fNextText,      draw_tobject());
00059 }


Member Data Documentation

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

List of arcs.

Definition at line 43 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 44 of file View2D.h.

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

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

List of poly lines.

Definition at line 41 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 39 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 51 of file View2D.h.

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

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

to keep things fast

Definition at line 52 of file View2D.h.

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

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

Try to avoid lots of.

Definition at line 49 of file View2D.h.

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

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

Next in list to use.

Definition at line 47 of file View2D.h.

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

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

"news" and "deletes"

Definition at line 50 of file View2D.h.

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

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

for "add"

Definition at line 48 of file View2D.h.

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

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

Definition at line 53 of file View2D.h.

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

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

List of poly lines.

Definition at line 42 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 40 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 45 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 Fri Jul 25 02:05:53 2008 for NOvA Offline by doxygen 1.3.5