47 fPosX(posx), fPosY(posy),
48 fMouseX(0), fMouseY(0),
50 fDrawW(0), fDrawH(0), fTextSizeDrag(0),
52 fMainFrame(0), fTextEdit(0),
59 fBackColor(fgBackColor),
60 fTextColor(fgTextColor),
77 fPosX(posx), fPosY(posy),
78 fMouseX(0), fMouseY(0),
80 fDrawW(0), fDrawH(0), fTextSizeDrag(0),
82 fMainFrame(0), fTextEdit(0),
89 fBackColor(fgBackColor),
90 fTextColor(fgTextColor),
123 switch (event->
fType)
166 else if (
fPosY > 1.0f)
171 using namespace TMath;
218 glGetFloatv(GL_DEPTH_RANGE, old_depth_range);
219 glDepthRange(0, 0.001);
222 glPushAttrib(GL_ENABLE_BIT | GL_LINE_BIT | GL_POLYGON_BIT);
224 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
225 glDisable(GL_CULL_FACE);
227 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
243 c1->GetGreen()*
f1 +
c2->GetGreen()*f2,
244 c1->GetBlue() *
f1 +
c2->GetBlue() *f2);
254 glTranslatef(-1.0f, -1.0f, 0.0f);
255 glScalef(2.0f, 2.0f, 1.0f);
257 glEnable(GL_POLYGON_OFFSET_FILL);
258 glPolygonOffset(0.1f, 1.0f);
268 TIter line_iter(lines);
271 Float_t widthTxt, heightTxt, sx, sy, descent, line_height;
279 Float_t llx, lly, llz, urx, ury, urz;
280 widthTxt = heightTxt = 0;
281 while ((osl = (
TObjString*) line_iter()) != 0)
285 heightTxt += line_height;
287 widthTxt += 2.0f * descent;
288 heightTxt += 2.0f * descent;
291 sy =
fTextSize / (line_height + descent);
296 glScalef(sx, sy, 1.0f);
314 glVertex3f(
x1, y1, z3);
315 glVertex3f(
x2, y1, z3);
316 glVertex3f(
x2, y2, z3);
317 glVertex3f(
x1, y2, z3);
322 glVertex3f(
x1, y1, z2);
323 glVertex3f(
x2, y1, z2);
324 glVertex3f(
x2, y2, z2);
325 glVertex3f(
x1, y2, z2);
334 while ((osl = (
TObjString*) line_iter()) != 0)
340 tx = 0.5f * widthTxt - descent ;
343 tx = widthTxt - 2.0f * descent;
345 glTranslatef(0.0f, -line_height, 0.0f);
358 fFont.
BBox(
"X", bbox[0], bbox[1], bbox[2], bbox[3], bbox[4], bbox[5]);
361 x2 = bbox[3] + 2.0f * descent;
371 y2 = line_height + descent;
378 glVertex3f(
x1, y1, z3);
379 glVertex3f(
x2, y1, z3);
380 glVertex3f(
x2, y2, z3);
381 glVertex3f(
x1, y2, z3);
386 glVertex3f(
x1, y1, z0);
387 glVertex3f(
x2, y1, z0);
388 glVertex3f(
x2, y2, z0);
389 glVertex3f(
x1, y2, z0);
401 glVertex3f(
x1, y1, z3);
402 glVertex3f(
x2, y1, z3);
403 glVertex3f(
x2, y2, z3);
404 glVertex3f(
x1, y2, z3);
409 glVertex3f(
x1, y1, z0);
410 glVertex3f(
x2, y1, z0);
411 glVertex3f(
x2, y2, z0);
412 glVertex3f(
x1, y2, z0);
419 x1 = widthTxt - line_height;
422 y2 = -heightTxt + line_height;
425 glVertex3f(
x1, y1, z1);
426 glVertex3f(
x2, y1, z1);
427 glVertex3f(
x2, y2, z1);
428 glVertex3f(
x1, y2, z1);
433 Float_t aOff = 0.25*line_height;
434 glVertex3f(
x1+aOff, y1+aOff, z0);
435 glVertex3f(
x2-aOff, y1+aOff, z0);
436 glVertex3f(
x2-aOff, y1+aOff, z0);
437 glVertex3f(
x2-aOff, y2-aOff, z0);
454 if (fx != 0.5f || fy != 0.5f)
460 glVertex3f(op[0], op[1], z3);
468 glDepthRange(old_depth_range[0], old_depth_range[1]);
507 btt1->
Connect(
"Clicked()",
"TGLAnnotation",
this,
"UpdateText()");
508 btt2->
Connect(
"Clicked()",
"TGLAnnotation",
this,
"CloseEditor()");
static const double x2[5]
static const double x1[5]
The color creation and management class.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void Layout()
Layout the elements of the composite frame.
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
virtual void UnmapWindow()
static Color_t fgBackColor
static Color_t fgTextColor
void MakeEditor()
Show the annotation editor.
void UpdateText()
Modify the annotation text from the text-edit widget.
void CloseEditor()
Close the annotation editor.
TGLFont::ETextAlignH_e fTextAlign
virtual ~TGLAnnotation()
Destructor.
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered overlay area.
virtual void Render(TGLRnrCtx &rnrCtx)
Render the annotation.
Char_t GetLineTransparency() const
Returns transparency of annotation outline.
TGLAnnotation(const TGLAnnotation &)
virtual void MouseLeave()
Mouse has left overlay area.
EDrag fDrag
last mouse position
Float_t fTextSizeDrag
width and height when drawing
virtual Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event)
Handle overlay event.
TGLVector3 fPointer
text-size at start of drag
TGLVertex3 WorldToViewport(const TGLVertex3 &worldVertex, TGLMatrix *modviewMat=0) const
Convert a 3D world vertex to '3D' viewport (screen) one.
Color_t GetColorIndex() const
Returns color-index representing the color.
static Int_t GetFontSize(Int_t ds)
Get availabe font size.
A wrapper class for FTFont.
Float_t GetDescent() const
Get font's descent. The returned value is positive.
Float_t GetLineHeight() const
Get font's line-height.
void BBox(const char *txt, Float_t &llx, Float_t &lly, Float_t &llz, Float_t &urx, Float_t &ury, Float_t &urz) const
Get bounding box.
void Render(const char *txt, Double_t x, Double_t y, Double_t angle, Double_t mgn) const
virtual void PostRender() const
Reset GL state after FTFont rendering.
virtual void PreRender(Bool_t autoLight=kTRUE, Bool_t lightOn=kFALSE) const
Set-up GL state before FTFont rendering.
Selection record for overlay objects.
Viewport (pixel base) 2D rectangle class.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
void RegisterFontNoScale(Int_t size, Int_t file, Int_t mode, TGLFont &out)
Get font in the GL rendering context.
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
Short_t ViewerLOD() const
void ProjectionMatrixPushIdentity()
void ProjectionMatrixPop()
UInt_t GetItem(Int_t i) const
static void ColorTransparency(Color_t color_index, Char_t transparency=0)
Set color from color_index and ROOT-style transparency (default 0).
static void Color(const TGLColor &color)
Set color from TGLColor.
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
Base class for GL viewers.
virtual void AddOverlayElement(TGLOverlayElement *el)
Add overlay element.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
virtual void RemoveOverlayElement(TGLOverlayElement *el)
Remove overlay element.
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail 'LOD' Request is directed via cross thread gVirt...
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
virtual Long_t ReturnLongestLineWidth()
Return width of longest line in widget.
virtual void SetText(TGText *text)
Adopt a new text buffer. The text will be deleted by this object.
Bool_t LoadBuffer(const char *txtbuf)
Load a 0 terminated buffer. Lines will be split at ' '.
TString AsString()
Returns content as ROOT string.
Collectable string class.
const TString & GetString() const
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Short_t Max(Short_t a, Short_t b)
Short_t Min(Short_t a, Short_t b)