RangeAxis Class Reference

#include <RangeAxis.h>

Inheritance diagram for RangeAxis:
ColorAxis

List of all members.

Public Member Functions

 RangeAxis (double x1, double y1, double x2, double y2, int ndiv=505, Option_t *option="")
 RangeAxis (RangeDouble *range, double x1, double y1, double x2, double y2, int ndiv=505, Option_t *option="")
virtual ~RangeAxis ()
RangeDoubleGetRange (void)
void UseRange (RangeDouble *range)
RangeDoubleGetSelectionRange ()
virtual void ExecuteEvent (int event, int px, int py)

Private Member Functions

void ApplyRange (void)
 RangeAxis (const RangeAxis &rhs)
RangeAxisoperator= (const RangeAxis &rhs)

Private Attributes

SigC::Ptr< RangeDoublefRange
SigC::Ptr< RangeDoublefSelRange
SigC::Connection fCon

Detailed Description

Definition at line 25 of file RangeAxis.h.


Constructor & Destructor Documentation

RangeAxis::RangeAxis ( double  x1,
double  y1,
double  x2,
double  y2,
int  ndiv = 505,
Option_t *  option = "" 
)

Definition at line 10 of file RangeAxis.cxx.

00012     : TGaxis(x1,y1,x2,y2,0,1,ndiv)
00013       ,fRange(0)
00014       ,fSelRange(0)
00015 {
00016     this->SetOption(opt);
00017     this->UseRange(manage(new RangeDouble));
00018     fSelRange = manage(new RangeDouble);
00019 }

RangeAxis::RangeAxis ( RangeDouble range,
double  x1,
double  y1,
double  x2,
double  y2,
int  ndiv = 505,
Option_t *  option = "" 
)

Definition at line 21 of file RangeAxis.cxx.

References fSelRange, and UseRange().

00024     : TGaxis(x1,y1,x2,y2,range->Min(),range->Max(),ndiv,opt)
00025       ,fRange(0)
00026       ,fSelRange(0)
00027 {
00028     this->SetOption(opt);
00029     this->UseRange(range);
00030     fSelRange = manage(new RangeDouble);
00031 }

RangeAxis::~RangeAxis (  )  [virtual]

Definition at line 33 of file RangeAxis.cxx.

00034 {
00035 }

RangeAxis::RangeAxis ( const RangeAxis rhs  )  [private]

Member Function Documentation

void RangeAxis::ApplyRange ( void   )  [private]

Definition at line 45 of file RangeAxis.cxx.

References fRange.

Referenced by UseRange().

00046 {
00047     this->SetWmin(fRange->Min());
00048     this->SetWmax(fRange->Max());
00049 }

void RangeAxis::ExecuteEvent ( int  event,
int  px,
int  py 
) [virtual]

Definition at line 51 of file RangeAxis.cxx.

References fSelRange, and Munits::m2.

00052 {
00053     gPad->SetCursor(kHand);
00054 
00055     static int px1old, py1old, px2old, py2old;
00056 
00057     bool vertical = fX2 - fX1 < fY2 - fY1;
00058 
00059     switch (event) {
00060     case kButton1Down:
00061         if (vertical) {         // vertical
00062             int width = gPad->XtoAbsPixel(fTickSize);
00063             int cx = gPad->XtoAbsPixel(fX1);
00064             px1old = cx-width;
00065             px2old = cx+width;
00066             py1old = py;
00067             py2old = py;
00068         } 
00069         else {                  // horizontal
00070             int width = gPad->YtoAbsPixel(fTickSize) - gPad->YtoAbsPixel(0.0);
00071             int cy = gPad->YtoAbsPixel(fY1);
00072             py1old = cy+width;
00073             py2old = cy-width;
00074             px1old = px;
00075             px2old = px;            
00076         }
00077         gVirtualX->DrawBox(px1old, py1old, px2old, py2old, TVirtualX::kHollow);
00078         gVirtualX->SetLineColor(-1);
00079 
00080         // Fall through
00081 
00082     case kButton1Motion:
00083         gVirtualX->DrawBox(px1old, py1old, px2old, py2old, TVirtualX::kHollow);//erase
00084 
00085         if (vertical) {         // vertical
00086             int width = gPad->XtoAbsPixel(fTickSize);
00087             int cx = gPad->XtoAbsPixel(fX1);
00088             px2old = cx+width;
00089             py2old = py;
00090         } 
00091         else {                  // horizontal
00092             int width = gPad->YtoAbsPixel(fTickSize) - gPad->YtoAbsPixel(0.0);
00093             int cy = gPad->YtoAbsPixel(fY1);
00094             py2old = cy-width;
00095             px2old = px;
00096             
00097         }
00098 
00099         gVirtualX->DrawBox(px1old, py1old, px2old, py2old, TVirtualX::kHollow);
00100         break;
00101 
00102     case kButton1Up:
00103         gPad->SetCursor(kPointer);
00104        
00105         if (vertical) {         // vertical
00106             double ratio = (fWmax - fWmin) / (fY2 - fY1);
00107             double m1 = (gPad->AbsPixeltoY(py1old)-fY1) * ratio + fWmin;
00108             double m2 = (gPad->AbsPixeltoY(py2old)-fY1) * ratio + fWmin;
00109             if (m1 < m2) fSelRange->Set(m1,m2);
00110             else         fSelRange->Set(m2,m1);
00111         } 
00112         else {                  // horizontal
00113             double ratio = (fWmax - fWmin) / (fX2 - fX1);
00114             double m1 = (gPad->AbsPixeltoX(px1old)-fX1) * ratio + fWmin;
00115             double m2 = (gPad->AbsPixeltoX(px2old)-fX1) * ratio + fWmin;
00116             if (m1 < m2) fSelRange->Set(m1,m2);
00117             else         fSelRange->Set(m2,m1);
00118         }
00119 
00120         gVirtualX->SetLineColor(-1);
00121         break;
00122     }
00123 }

RangeDouble& RangeAxis::GetRange ( void   )  [inline]

Definition at line 37 of file RangeAxis.h.

References fRange.

Referenced by EVD::ColorSemanticHandler(), and EVD::UpdateChargeHists().

00037 { return *fRange; }

RangeDouble& RangeAxis::GetSelectionRange (  )  [inline]

Definition at line 40 of file RangeAxis.h.

References fSelRange.

Referenced by EVD::Init(), MultiPage::Init(), and main().

00040 { return *fSelRange; }

RangeAxis& RangeAxis::operator= ( const RangeAxis rhs  )  [private]

Reimplemented in ColorAxis.

void RangeAxis::UseRange ( RangeDouble range  ) 

Definition at line 37 of file RangeAxis.cxx.

References ApplyRange(), fCon, and fRange.

Referenced by EVD::Init(), MultiPage::Init(), and RangeAxis().

00038 {
00039     if (fRange) fCon.disconnect();
00040     fRange = range;
00041     fCon = fRange->modified.connect(SigC::slot(*this,&RangeAxis::ApplyRange));
00042     this->ApplyRange();
00043 }


Member Data Documentation

SigC::Connection RangeAxis::fCon [private]

Definition at line 54 of file RangeAxis.h.

Referenced by UseRange().

SigC::Ptr<RangeDouble> RangeAxis::fRange [private]

Definition at line 52 of file RangeAxis.h.

Referenced by ApplyRange(), GetRange(), and UseRange().

SigC::Ptr<RangeDouble> RangeAxis::fSelRange [private]

Definition at line 53 of file RangeAxis.h.

Referenced by ExecuteEvent(), GetSelectionRange(), and RangeAxis().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1