ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
annotation.C File Reference

Demonstrates usage of TGLAnnotation class. More...

Go to the source code of this file.

Detailed Description

Demonstrates usage of TGLAnnotation class.

eve_annotation.png
#include <TEveManager.h>
#include <TGLViewer.h>
#include <TGLAnnotation.h>
#include <TEveBox.h>
#include <TDatime.h>
#include <TTimer.h>
#include <TDatime.h>
class MyTimer : public TTimer
{
private:
TGLAnnotation* m_label;
public:
MyTimer(TGLAnnotation* x) : TTimer(1000), m_label(x)
{
}
virtual Bool_t Notify()
{
// stop timer
// so some action here
m_label->SetText(d.AsString());
// start timer
SetTime(1000);
Reset();
TurnOn();
return true;
}
};
void annotation(Float_t a=10, Float_t d=5, Float_t x=0, Float_t y=0, Float_t z=0)
{
// add a box in scene
TEveBox* b = new TEveBox("Box", "Test Title");
b->SetVertex(0, x - a, y - a, z - a);
b->SetVertex(1, x - a, y + a, z - a);
b->SetVertex(2, x + a, y + a, z - a);
b->SetVertex(3, x + a, y - a, z - a);
b->SetVertex(4, x - a, y - a, z + a);
b->SetVertex(5, x - a, y + a, z + a);
b->SetVertex(6, x + a, y + a, z + a);
b->SetVertex(7, x + a, y - a, z + a);
// add overlay text
TDatime time;
TGLAnnotation* ann = new TGLAnnotation(v, time.AsString(), 0.1, 0.9);
ann->SetTextSize(0.1);// % of window diagonal
// set timer to update text every second
MyTimer* timer = new MyTimer(ann);
timer->SetTime(1000);
timer->Reset();
timer->TurnOn();
}
Author
Alja Mrak-Tadel

Definition in file annotation.C.