Interactive overlay annotations: framed REveText boxes floating in front of the 3D scene, which can be dragged and resized in the browser.
Font size is a fraction of viewport height. A client with a differently shaped window sees the boxes at the same relative position but covering a different fraction of its width.
SetPickable() governs moving, SetResizable() governs resizing, so a header can be repositioned while keeping its size. The logo, an REveLogo, moves and resizes the same way.
Moving and resizing are client-local. Nothing is sent to the server, so two browsers on the same session arrange their annotations independently.
static const char *kOvlFont = "LiberationSerif-Regular";
{
t->SetFont(kOvlFont);
t->SetFontWeight(0.05f);
t->SetMode(1);
t->SetTextColor(text_color);
t->SetDrawFrame(true);
t->SetFillColor(fill_color);
t->SetFillAlpha(170);
t->SetLineColor(frame_color);
t->SetLineAlpha(255);
t->SetLineWidth(0.06);
t->SetExtraBorder(0.25);
t->SetPickable(true);
t->SetResizable(resizable);
holder->AddElement(t);
return t;
}
{
b->SetShape(
new TGeoTube(kR_min, kR_max, kZ_d));
b->SetMainTransparency(60);
eveMng->GetGlobalScene()->AddElement(
b);
for (int i = 0; i < 4; ++i) {
jet->SetCylinder(2 * kR_max, 2 * kZ_d);
jet->AddEllipticCone(
r.Uniform(-2.5, 2.5),
r.Uniform(0,
TMath::TwoPi()),
r.Uniform(0.05, 0.2),
jet->SetFillColor(
kPink - 8);
jets->AddElement(jet);
}
eveMng->GetEventScene()->AddElement(jets);
}
void overlay_drag()
{
auto eveMng = REveManager::Create();
eveMng->AllowMultipleRemoteConnections(false, false);
REveText::AssertSdfFont(kOvlFont, rf + kOvlFont + ".ttf");
makeSceneContent(eveMng);
REveScene *os = eveMng->SpawnNewScene(
"Overlay scene",
"Draggable annotations");
((
REveViewer *)(eveMng->GetViewers()->FirstChild()))->AddScene(os);
os->SetIsOverlay(true);
auto logo =
new REveLogo(
"Root6Icon.png",
"Logo");
logo->SetPosition(0.88, 0.86);
logo->SetSize(110);
logo->SetOpacity(0.75);
os->AddElement(logo);
makeAnnotation(holder, "Title", "Run 123456 / Event 42", 0.03, 0.95, 0.035, kInk, kQuiet, kIce, false);
makeAnnotation(holder, "DragMe", "drag me anywhere", 0.03, 0.85, 0.030, kInk, kLive, kIce);
makeAnnotation(holder, "ResizeMe", "hover me, then grab the corner", 0.03, 0.76, 0.030, kInk, kLive, kIce);
makeAnnotation(holder, "Legend", "legend\n cyan barrel\n pink jet cones", 0.03, 0.67, 0.030, kInk, kLive, kIce);
makeAnnotation(holder, "InFront", "always in front of the geometry", 0.34, 0.28, 0.026, kInk, kQuiet, kIce, false);
os->AddElement(holder);
eveMng->Show();
}
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
short Color_t
Color number (short)
double Double_t
Double 8 bytes.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char text
R__EXTERN TRandom * gRandom
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Base class for REveUtil visualization elements, providing hierarchy management, rendering control and...
Wrapper for TGeoShape with absolute positioning and color attributes allowing display of extracted TG...
Draws a jet cone with leading particle is specified in (eta,phi) and cone radius is given.
A screen-space image for an overlay scene, such as an experiment logo or a watermark.
Central application manager for web-based REve.
Eve representation of TGLScene.
Eve representation of a GL view.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
static const TString & GetIconPath()
Get the icon path in the installation. Static utility function.
static const TString & GetDataDir()
Get the data directory in the installation. Static utility function.
This is the base class for the ROOT Random number generators.
Namespace for ROOT features in testing.
constexpr Double_t TwoPi()