Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
evdb::Canvas Class Referenceabstract

#include "/cvmfs/nova.opensciencegrid.org/externals/nuevdb/v1_00_02/source/nuevdb/EventDisplayBase/Canvas.h"

Inheritance diagram for evdb::Canvas:
evdb::Printable evd::Display3DView evd::HardwareView evd::PlotView evd::XZYZProjectionsView evdb::testCanvas1

Public Member Functions

 Canvas (TGMainFrame *mf)
 
virtual ~Canvas ()
 
virtual void Draw (const char *opt=0)=0
 
virtual const char * PrintTag () const
 
virtual const char * Description () const
 
virtual void Print (const char *f)
 
void Connect ()
 Make signal/slot connections. More...
 

Static Public Member Functions

static void AddToListOfPrintables (const char *name, evdb::Printable *p)
 
static void RemoveFromListOfPrintables (evdb::Printable *p)
 
static std::map< std::string, evdb::Printable * > & GetPrintables ()
 

Protected Attributes

TGCompositeFrame * fFrame
 Graphics frame. More...
 
TGLayoutHints * fLayout
 Layout hints for frame. More...
 
TRootEmbeddedCanvas * fEmbCanvas
 Embedded canvas. More...
 
TCanvas * fCanvas
 The ROOT drawing canvas. More...
 
unsigned short fXsize
 Size of the canvas;. More...
 
unsigned short fYsize
 Size of the canvas;. More...
 
float fAspectRatio
 fYsize/fXsize More...
 

Detailed Description

Definition at line 22 of file Canvas.h.

Constructor & Destructor Documentation

evdb::Canvas::Canvas ( TGMainFrame *  mf)

Perform the basic setup for a drawing canvas

Definition at line 33 of file Canvas.cxx.

References fAspectRatio, fCanvas, fEmbCanvas, fFrame, fLayout, check_time_usage::float, fXsize, fYsize, PrintTag(), and string.

34  {
35  TGDimension sz; // Size of the main frame
36 
37  sz = mf->GetSize();
38  fXsize = sz.fWidth - 10; // Leave small margin on left and right
39  fYsize = sz.fHeight - 58; // Leave small margin on top and bottom
40  fAspectRatio = (float)fYsize/(float)fXsize;
41 
42  // This frame is apparently for holding the buttons on the top; it's
43  // not used for anything else.
44  fFrame = new TGCompositeFrame(mf, 60, 60, kHorizontalFrame);
45 
46  // Define a layout for placing the canvas within the frame.
47  fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX |
48  kLHintsExpandY, 5, 5, 5, 5);
49 
50  // Careful about clashes with root's naming of canvases. Make a name
51  // like "tpcEVDCanvas" using the print tag
52  std::string name(this->PrintTag());
53  name += "evdb::Canvas";
54 
55  // Create the embedded canvas within the main ROOT graphics frame.
56  fEmbCanvas = new TRootEmbeddedCanvas(name.c_str(), mf, fXsize, fYsize,
57  kSunkenFrame, 0);
58  mf->AddFrame(fEmbCanvas, fLayout);
59  mf->AddFrame(fFrame);
60 
61  // Extract the graphical Canvas from the embedded canvas. The user
62  // will do most of their drawing in this.
63  fCanvas = fEmbCanvas->GetCanvas();
64  }
const XML_Char * name
Definition: expat.h:151
TGCompositeFrame * fFrame
Graphics frame.
Definition: Canvas.h:39
TCanvas * fCanvas
The ROOT drawing canvas.
Definition: Canvas.h:42
TGLayoutHints * fLayout
Layout hints for frame.
Definition: Canvas.h:40
float fAspectRatio
fYsize/fXsize
Definition: Canvas.h:46
unsigned short fXsize
Size of the canvas;.
Definition: Canvas.h:44
unsigned short fYsize
Size of the canvas;.
Definition: Canvas.h:45
virtual const char * PrintTag() const
Definition: Canvas.h:32
TRootEmbeddedCanvas * fEmbCanvas
Embedded canvas.
Definition: Canvas.h:41
enum BeamMode string
evdb::Canvas::~Canvas ( )
virtual

Definition at line 78 of file Canvas.cxx.

References fEmbCanvas, fFrame, and fLayout.

79  {
80  // IoModule::Instance()->Disconnect(0,this,0);
81  delete fEmbCanvas;
82  delete fLayout;
83  delete fFrame;
84  }
TGCompositeFrame * fFrame
Graphics frame.
Definition: Canvas.h:39
TGLayoutHints * fLayout
Layout hints for frame.
Definition: Canvas.h:40
TRootEmbeddedCanvas * fEmbCanvas
Embedded canvas.
Definition: Canvas.h:41

Member Function Documentation

void evdb::Printable::AddToListOfPrintables ( const char *  name,
evdb::Printable p 
)
staticinherited

Definition at line 29 of file Printable.cxx.

References om::cerr, and string.

Referenced by Connect(), evdb::ObjListCanvas::Connect(), evdb::Printable::Description(), and evdb::testCanvas1::testCanvas1().

31  {
33 
34  if (gsPrintables[s] == 0) {
35  gsPrintables[s] = p;
36  }
37  else {
38  if (gsPrintables[s] != p) {
39  std::cerr << "Printable: Name " << name << " reused.\n";
40  std::abort();
41  }
42  }
43  }
const XML_Char * name
Definition: expat.h:151
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14
const char * p
Definition: xmltok.h:285
OStream cerr
Definition: OStream.cxx:7
const XML_Char * s
Definition: expat.h:262
enum BeamMode string
void evdb::Canvas::Connect ( )

Make signal/slot connections.

Definition at line 68 of file Canvas.cxx.

References evdb::Printable::AddToListOfPrintables(), and Description().

Referenced by Description(), and evdb::DisplayWindow::DisplayWindow().

69  {
70  // Make connections for drawing and printing
71  // IoModule::Instance()->Connect("NewEvent()",
72  // "evdb::Canvas",this,"Draw()");
74  }
virtual const char * Description() const
Definition: Canvas.h:33
static void AddToListOfPrintables(const char *name, evdb::Printable *p)
Definition: Printable.cxx:29
virtual const char* evdb::Canvas::Description ( ) const
inlinevirtual

Reimplemented from evdb::Printable.

Reimplemented in evdb::testCanvas1, evd::PlotView, evd::XZYZProjectionsView, evd::HardwareView, and evd::Display3DView.

Definition at line 33 of file Canvas.h.

References Connect(), MakeMiniprodValidationCuts::f, and Print().

Referenced by Connect().

33 {return "sub-class needs description"; }
virtual void evdb::Canvas::Draw ( const char *  opt = 0)
pure virtual
std::map< std::string, evdb::Printable * > & evdb::Printable::GetPrintables ( )
staticinherited

Definition at line 61 of file Printable.cxx.

References evdb::gsPrintables.

Referenced by evdb::Printable::Description(), evd::SliceNavigator::postProcessEvent(), evdb::EventDisplay::postProcessEvent(), and evdb::PrintDialog::PrintDialog().

62  {
63  return gsPrintables;
64  }
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14
void evdb::Canvas::Print ( const char *  f)
virtual

Implements evdb::Printable.

Definition at line 88 of file Canvas.cxx.

References fCanvas.

Referenced by Description().

88 { fCanvas->Print(f); }
TCanvas * fCanvas
The ROOT drawing canvas.
Definition: Canvas.h:42
virtual const char* evdb::Canvas::PrintTag ( ) const
inlinevirtual

Implements evdb::Printable.

Reimplemented in evdb::testCanvas1, evd::PlotView, evd::XZYZProjectionsView, evd::HardwareView, and evd::Display3DView.

Definition at line 32 of file Canvas.h.

Referenced by Canvas().

32 {return "sub-class needs print tag"; }
void evdb::Printable::RemoveFromListOfPrintables ( evdb::Printable p)
staticinherited

Definition at line 47 of file Printable.cxx.

Referenced by evdb::Printable::Description(), evdb::Printable::~Printable(), and evdb::testCanvas1::~testCanvas1().

48  {
49  std::map<std::string,Printable*>::iterator itr(gsPrintables.begin());
50  std::map<std::string,Printable*>::iterator itrEnd(gsPrintables.end());
51  for (; itr!=itrEnd; ++itr) {
52  if ( itr->second == p) {
53  gsPrintables.erase(itr);
54  return;
55  }
56  }
57  }
static std::map< std::string, evdb::Printable * > gsPrintables
Definition: Printable.cxx:14

Member Data Documentation

float evdb::Canvas::fAspectRatio
protected

fYsize/fXsize

Definition at line 46 of file Canvas.h.

Referenced by Canvas().

TCanvas* evdb::Canvas::fCanvas
protected
TRootEmbeddedCanvas* evdb::Canvas::fEmbCanvas
protected

Embedded canvas.

Definition at line 41 of file Canvas.h.

Referenced by Canvas(), evd::XZYZProjectionsView::XZYZProjectionsView(), and ~Canvas().

TGCompositeFrame* evdb::Canvas::fFrame
protected

Graphics frame.

Definition at line 39 of file Canvas.h.

Referenced by Canvas(), and ~Canvas().

TGLayoutHints* evdb::Canvas::fLayout
protected

Layout hints for frame.

Definition at line 40 of file Canvas.h.

Referenced by Canvas(), evd::XZYZProjectionsView::XZYZProjectionsView(), and ~Canvas().

unsigned short evdb::Canvas::fXsize
protected

Size of the canvas;.

Definition at line 44 of file Canvas.h.

Referenced by Canvas().

unsigned short evdb::Canvas::fYsize
protected

Size of the canvas;.

Definition at line 45 of file Canvas.h.

Referenced by Canvas().


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