14#include "TGLIncludes.h"
107 fParent->RemoveOverlayElement(
this);
121 switch (event->
fType)
164 else if (
fPosY > 1.0f)
169 using namespace TMath;
216 glGetFloatv(GL_DEPTH_RANGE, old_depth_range);
217 glDepthRange(0, 0.001);
220 glPushAttrib(GL_ENABLE_BIT | GL_LINE_BIT | GL_POLYGON_BIT);
222 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
223 glDisable(GL_CULL_FACE);
225 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
241 c1->GetGreen()*
f1 +
c2->GetGreen()*f2,
242 c1->GetBlue() *
f1 +
c2->GetBlue() *f2);
252 glTranslatef(-1.0f, -1.0f, 0.0f);
253 glScalef(2.0f, 2.0f, 1.0f);
255 glEnable(GL_POLYGON_OFFSET_FILL);
256 glPolygonOffset(0.1f, 1.0f);
266 TIter line_iter(lines);
269 Float_t widthTxt, heightTxt, sx, sy, descent, line_height;
274 descent =
fFont.GetDescent();
275 line_height =
fFont.GetLineHeight();
277 Float_t llx, lly, llz, urx, ury, urz;
278 widthTxt = heightTxt = 0;
279 while ((osl = (
TObjString*) line_iter()) !=
nullptr)
283 heightTxt += line_height;
285 widthTxt += 2.0f * descent;
286 heightTxt += 2.0f * descent;
289 sy =
fTextSize / (line_height + descent);
294 glScalef(sx, sy, 1.0f);
312 glVertex3f(x1, y1, z3);
313 glVertex3f(x2, y1, z3);
314 glVertex3f(x2, y2, z3);
315 glVertex3f(x1, y2, z3);
319 glBegin(GL_LINE_LOOP);
320 glVertex3f(x1, y1, z2);
321 glVertex3f(x2, y1, z2);
322 glVertex3f(x2, y2, z2);
323 glVertex3f(x1, y2, z2);
332 while ((osl = (
TObjString*) line_iter()) !=
nullptr)
338 tx = 0.5f * widthTxt - descent ;
341 tx = widthTxt - 2.0f * descent;
343 glTranslatef(0.0f, -line_height, 0.0f);
356 fFont.BBox(
"X", bbox[0], bbox[1], bbox[2], bbox[3], bbox[4], bbox[5]);
359 x2 = bbox[3] + 2.0f * descent;
369 y2 = line_height + descent;
376 glVertex3f(x1, y1, z3);
377 glVertex3f(x2, y1, z3);
378 glVertex3f(x2, y2, z3);
379 glVertex3f(x1, y2, z3);
383 glBegin(GL_LINE_LOOP);
384 glVertex3f(x1, y1, z0);
385 glVertex3f(x2, y1, z0);
386 glVertex3f(x2, y2, z0);
387 glVertex3f(x1, y2, z0);
399 glVertex3f(x1, y1, z3);
400 glVertex3f(x2, y1, z3);
401 glVertex3f(x2, y2, z3);
402 glVertex3f(x1, y2, z3);
406 glBegin(GL_LINE_LOOP);
407 glVertex3f(x1, y1, z0);
408 glVertex3f(x2, y1, z0);
409 glVertex3f(x2, y2, z0);
410 glVertex3f(x1, y2, z0);
417 x1 = widthTxt - line_height;
420 y2 = -heightTxt + line_height;
423 glVertex3f(x1, y1, z1);
424 glVertex3f(x2, y1, z1);
425 glVertex3f(x2, y2, z1);
426 glVertex3f(x1, y2, z1);
431 Float_t aOff = 0.25*line_height;
432 glVertex3f(x1+aOff, y1+aOff, z0);
433 glVertex3f(x2-aOff, y1+aOff, z0);
434 glVertex3f(x2-aOff, y1+aOff, z0);
435 glVertex3f(x2-aOff, y2-aOff, z0);
452 if (fx != 0.5f || fy != 0.5f)
458 glVertex3f(op[0], op[1], z3);
466 glDepthRange(old_depth_range[0], old_depth_range[1]);
490 fMainFrame->SetWindowName(
"Annotation Editor");
505 btt1->
Connect(
"Clicked()",
"TGLAnnotation",
this,
"UpdateText()");
506 btt2->
Connect(
"Clicked()",
"TGLAnnotation",
this,
"CloseEditor()");
int Int_t
Signed integer 4 bytes (int).
char Char_t
Character 1 byte (char).
bool Bool_t
Boolean (0=false, 1=true) (bool).
short Color_t
Color number (short).
float Float_t
Float 4 bytes (float).
static Int_t GetColor(const char *hexcolor)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
A composite frame that layout their children in horizontal way.
static Color_t fgBackColor
TGLAnnotation(const TGLAnnotation &)=delete
Bool_t MouseEnter(TGLOvlSelectRecord &selRec) override
Mouse has entered overlay area.
Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event) override
Handle overlay event.
static Color_t fgTextColor
void MakeEditor()
Show the annotation editor.
void UpdateText()
Modify the annotation text from the text-edit widget.
Float_t fDrawH
! width and height when drawing
void CloseEditor()
Close the annotation editor.
TGLFont::ETextAlignH_e fTextAlign
Char_t GetLineTransparency() const
Returns transparency of annotation outline.
~TGLAnnotation() override
Destructor.
void MouseLeave() override
Mouse has left overlay area.
Int_t fMouseY
! last mouse position
void Render(TGLRnrCtx &rnrCtx) override
Render the annotation.
Float_t fTextSizeDrag
! text-size at start of drag
TGLVertex3 WorldToViewport(const TGLVertex3 &worldVertex, TGLMatrix *modviewMat=nullptr) 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.
TGLOverlayElement(const TGLOverlayElement &)=delete
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.
This class describes layout hints used by the layout classes.
Defines top level windows that interact with the system Window Manager.
Yield an action as soon as it is clicked.
A TGTextEdit is a specialization of TGTextView.
A TGText is a multi line text buffer.
Bool_t LoadBuffer(const char *txtbuf)
Load a 0 terminated buffer. Lines will be split at ' '.
A composite frame that layout their children in vertical way.
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
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)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
EGEventType fType
of event (see EGEventType)
Int_t fY
pointer x, y coordinates in event window