BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BesPaveText Class Reference

#include <BesPaveText.h>

Inheritance diagram for BesPaveText:

Public Member Functions

 BesPaveText ()
 BesPaveText (Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="br")
 BesPaveText (const BesPaveText &pavetext)
virtual void SetText (std::vector< TString > infoCon)
virtual void SetPos (Int_t px, Int_t py)
 BesPaveText ()
 BesPaveText (Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="br")
 BesPaveText (const BesPaveText &pavetext)
virtual void SetText (std::vector< TString > infoCon)
virtual void SetPos (Int_t px, Int_t py)
 BesPaveText ()
 BesPaveText (Double_t x1, Double_t y1, Double_t x2, Double_t y2, Option_t *option="br")
 BesPaveText (const BesPaveText &pavetext)
virtual void SetText (std::vector< TString > infoCon)
virtual void SetPos (Int_t px, Int_t py)

Protected Attributes

Double_t fTextSize
Double_t fdxNDC
Double_t fdyNDC

Detailed Description

Constructor & Destructor Documentation

◆ BesPaveText() [1/9]

BesPaveText::BesPaveText ( )

Referenced by BesPaveText(), BesPaveText(), and SetPos().

◆ BesPaveText() [2/9]

BesPaveText::BesPaveText ( Double_t x1,
Double_t y1,
Double_t x2,
Double_t y2,
Option_t * option = "br" )

Definition at line 18 of file BesPaveText.cxx.

20 : TPaveText( x1, y1, x2, y2, option ) {
21 SetFillColor( 9001 );
22 SetBorderSize( 1 );
23 SetCornerRadius( 0.2 );
24
25 fTextSize = 0.025;
26}
gStyle SetFillColor(0)
text SetBorderSize(0)

◆ BesPaveText() [3/9]

BesPaveText::BesPaveText ( const BesPaveText & pavetext)

Definition at line 29 of file BesPaveText.cxx.

29: TPaveText() {}

◆ BesPaveText() [4/9]

BesPaveText::BesPaveText ( )

◆ BesPaveText() [5/9]

BesPaveText::BesPaveText ( Double_t x1,
Double_t y1,
Double_t x2,
Double_t y2,
Option_t * option = "br" )

◆ BesPaveText() [6/9]

BesPaveText::BesPaveText ( const BesPaveText & pavetext)

◆ BesPaveText() [7/9]

BesPaveText::BesPaveText ( )

◆ BesPaveText() [8/9]

BesPaveText::BesPaveText ( Double_t x1,
Double_t y1,
Double_t x2,
Double_t y2,
Option_t * option = "br" )

◆ BesPaveText() [9/9]

BesPaveText::BesPaveText ( const BesPaveText & pavetext)

Member Function Documentation

◆ SetPos() [1/3]

void BesPaveText::SetPos ( Int_t px,
Int_t py )
virtual

Definition at line 88 of file BesPaveText.cxx.

88 {
89 if ( !gPad )
90 {
91 cout << "BesPaveText::SetPos, gPad does not exist" << endl;
92 return;
93 }
94
95 Double_t x = gPad->AbsPixeltoX( px + 10 );
96 Double_t y = gPad->AbsPixeltoY( py - 10 );
97 Double_t x1, y1, x2, y2, xNDC, yNDC;
98 gPad->GetRange( x1, y1, x2, y2 );
99 xNDC = ( x - x1 ) / ( x2 - x1 );
100 yNDC = ( y - y1 ) / ( y2 - y1 );
101 // cout << xNDC << " " << yNDC << endl;
102
103 x1 = xNDC;
104 y1 = yNDC;
105 x2 = xNDC + fdxNDC;
106 y2 = yNDC + fdyNDC;
107
108 Double_t delta = 0.02;
109 if ( x2 > 1.0 && y2 > 1.0 )
110 {
111 x1 -= ( fdxNDC + delta );
112 x2 -= ( fdxNDC + delta );
113 y1 -= ( fdyNDC + delta );
114 y2 -= ( fdyNDC + delta );
115 }
116 else if ( x2 > 1.0 )
117 {
118 x1 -= fdxNDC;
119 x2 -= fdxNDC;
120 }
121 if ( y2 > 1.0 )
122 {
123 y1 -= fdyNDC;
124 y2 -= fdyNDC;
125 }
126
127 SetX1NDC( x1 );
128 SetY1NDC( y1 );
129 SetX2NDC( x2 );
130 SetY2NDC( y2 );
131 ConvertNDCtoPad();
132}
Double_t x[10]

◆ SetPos() [2/3]

virtual void BesPaveText::SetPos ( Int_t px,
Int_t py )
virtual

◆ SetPos() [3/3]

virtual void BesPaveText::SetPos ( Int_t px,
Int_t py )
virtual

◆ SetText() [1/3]

void BesPaveText::SetText ( std::vector< TString > infoCon)
virtual

Definition at line 32 of file BesPaveText.cxx.

32 {
33 Int_t n = infoCon.size();
34 Double_t margin = GetMargin();
35 Double_t dy = ( 1.0 - margin * 2 ) / n;
36
37 // Long Peixun's update: If the number of lines is 2, add an empty line to avoid text out of
38 // box.
39 if ( n == 2 ) dy = ( 1.0 - margin * 2 ) / 3;
40
41 Double_t coordx = 0.0;
42 Double_t coordy = 0.0;
43 for ( Int_t i = 0; i < n; i++ )
44 {
45 coordy = 1.0 - ( i + 1 ) * dy;
46 if ( n == 1 ) coordy = 1.0;
47
48 TText* tdata = AddText( coordx, coordy, infoCon[i].Data() );
49 tdata->SetTextSize( fTextSize / 1.2 );
50 tdata->SetTextFont( 42 );
51 if ( i == 0 && n > 4 )
52 {
53 tdata->SetTextSize( fTextSize );
54 tdata->SetTextFont( 62 );
55 }
56 tdata->SetTextColor( 1 );
57 tdata->SetTextAlign( 12 );
58
59 if ( infoCon[i] == TString( "Fired" ) )
60 {
61 tdata->SetTextColor( kRed );
62 // tdata->SetTextSize(fTextSize);
63 tdata->SetTextFont( 72 );
64 }
65 }
66 // Long Peixun's update: If the number of lines is 2, add an empty line to avoid text out of
67 // box.
68 if ( infoCon.size() == 2 )
69 {
70 coordy = 1.0 - 3 * dy;
71 TText* tdata = AddText( 0.0, coordy, "" );
72 ++n;
73 }
74
75 fdxNDC = fTextSize * fLongest / 2.2;
76 fdyNDC = fTextSize * n * 1.2; // fLines->GetSize() * 1.2;
77
78 ConvertNDCtoPad();
79 // This is necessary, or when fTip was drawn the first time, it will in center, as its fX1
80 // fX2 fY1 fY2 have not been changed.
81 SetX1NDC( 0.0 );
82 SetY1NDC( 0.0 );
83 SetX2NDC( fdxNDC );
84 SetY2NDC( fdyNDC );
85}
const Int_t n
text AddText("Boss 6.5.1")

◆ SetText() [2/3]

virtual void BesPaveText::SetText ( std::vector< TString > infoCon)
virtual

◆ SetText() [3/3]

virtual void BesPaveText::SetText ( std::vector< TString > infoCon)
virtual

Member Data Documentation

◆ fdxNDC

Double_t BesPaveText::fdxNDC
protected

Definition at line 15 of file EventDisplay/BesVisLib/include/BesVisLib/BesPaveText.h.

Referenced by SetPos(), and SetText().

◆ fdyNDC

Double_t BesPaveText::fdyNDC
protected

Definition at line 15 of file EventDisplay/BesVisLib/include/BesVisLib/BesPaveText.h.

Referenced by SetPos(), and SetText().

◆ fTextSize

Double_t BesPaveText::fTextSize
protected

Definition at line 14 of file EventDisplay/BesVisLib/include/BesVisLib/BesPaveText.h.

Referenced by BesPaveText(), and SetText().


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