61using namespace std::string_literals;
102 static const struct {
103 const char *
name{
nullptr};
104 bool with_derived{
false};
105 bool reduse_by_many{
false};
106 } supported_classes[] = {{
"TH1",
true},
112 {
"TGraphPolargram",
true},
117 {
"TBox",
false,
true},
119 {
"TLine",
false,
true},
142 for (
int i = 0; supported_classes[i].name !=
nullptr; ++i)
143 if ((!many_primitives || !supported_classes[i].reduse_by_many) && (strcmp(supported_classes[i].
name, obj->
ClassName()) == 0))
147 for (
int i = 0; supported_classes[i].name !=
nullptr; ++i)
148 if (supported_classes[i].with_derived && (!many_primitives || !supported_classes[i].reduse_by_many))
183 if (
name[0] ==
'+') {
206 TView *view =
nullptr;
238 painter->SetPainting(
nullptr);
297 auto *tgt = listofcols->Reserve(pal.
GetSize());
300 listofcols->FixSize();
316 bool process_primitives = (version == 0) || (pad_status.fVersion > version);
347 TIter iter(primitives);
351 bool need_frame =
false, has_histo =
false;
352 std::string need_title;
354 while (process_primitives && ((obj = iter()) !=
nullptr)) {
360 auto hs =
static_cast<THStack *
>(obj);
373 frame =
static_cast<TFrame *
>(obj);
382 if (!has_histo && (strlen(obj->
GetTitle()) > 0))
386 if (strcmp(obj->
GetName(),
"title") == 0)
399 auto line0 = title->
GetLine(0);
402 title =
new TPaveText(0, 0, 0, 0,
"blNDC");
411 title->
AddText(need_title.c_str());
413 primitives->
Add(title);
417 auto flush_master = [&]() {
426 bool first_obj =
true;
428 if (process_primitives)
429 pad_status._has_specials =
false;
431 while ((obj = iter()) !=
nullptr) {
435 }
else if (!process_primitives) {
448 while ((fobj = fiter()) !=
nullptr) {
489 std::stringstream exec;
490 exec <<
"new TPaletteAxis(0,0,0,0, (TH1*)" << std::hex << std::showbase << (size_t)hist <<
");";
491 palette = (
TObject *)
gROOT->ProcessLine(exec.str().c_str());
496 if (title && first_obj) hopt.
Append(
";;use_pad_title");
500 if (palette) hopt.
Append(
";;use_pad_palette");
523 while ((fobj = fiter()) !=
nullptr) {
533 if (title && first_obj) gropt.
Append(
";;use_pad_title");
534 if (stats) gropt.
Append(
";;use_pad_stats");
539 while ((fobj = fiter()) !=
nullptr)
550 pad_status._has_specials =
true;
556 bool provide_colors =
false;
560 provide_colors = process_primitives;
586 TList *dlst =
nullptr;
587 while ((dlst = (
TList *)diter()) !=
nullptr) {
589 while ((obj = fiter()) !=
nullptr)
592 dlst->
Clear(
"nodelete");
602 TIter siter(&save_lst);
604 while ((dlst = (
TList *)diter()) !=
nullptr) {
605 while ((obj = siter()) !=
nullptr) {
612 save_lst.
Clear(
"nodelete");
626 if ((conn.fConnId == connid) || (connid == 0)) {
627 conn.fSend.emplace(msg);
645 if (connid && (conn.fConnId != connid))
649 if (!
fWindow->CanSend(conn.fConnId,
true))
654 if ((conn.fCheckedVersion <
fCanvVersion) && (conn.fSendVersion == conn.fDrawVersion)) {
661 if (!conn.fSendVersion)
667 auto json = TBufferJSON::ToJSON(snap, fJsonComp);
668 auto hash = json.Hash();
669 if (conn.fLastSendHash && (conn.fLastSendHash == hash) && conn.fSendVersion) {
673 buf.append(json.Data());
674 conn.fLastSendHash = hash;
685 }
else if (!conn.fSend.empty()) {
687 std::swap(buf, conn.fSend.front());
693 fWindow->Send(conn.fConnId, buf);
715 fWindow->SetDefaultPage(
"file:rootui5sys/canv/canvas6.html");
719 [
this](
unsigned connid) {
724 [
this](
unsigned connid,
const std::string &arg) {
729 [
this](
unsigned connid) {
732 if (
c.fConnId == connid) {
743 if ((
w > 10) && (
w < 50000) && (
h > 10) && (
h < 30000))
759 if (
gROOT->IsWebDisplayBatch())
781 if (!pad || !obj)
return;
841 auto arr = TBufferJSON::FromJSON<std::vector<TWebPadOptions>>(msg);
848 TPad *pad_with_execs =
nullptr;
849 TExec *hist_exec =
nullptr;
851 for (
unsigned n = 0;
n < arr->size(); ++
n) {
852 auto &
r = arr->at(
n);
864 if (
r.active && (pad !=
gPad))
gPad = pad;
911 if (mother->GetAbsWNDC() > 0. && mother->GetAbsHNDC() > 0.) {
912 pad->
fXlowNDC = (
r.xlow - mother->GetAbsXlowNDC()) / mother->GetAbsWNDC();
913 pad->
fYlowNDC = (
r.ylow - mother->GetAbsYlowNDC()) / mother->GetAbsHNDC();
914 pad->
fXUpNDC = (
r.xup - mother->GetAbsXlowNDC()) / mother->GetAbsWNDC();
915 pad->
fYUpNDC = (
r.yup - mother->GetAbsYlowNDC()) / mother->GetAbsHNDC();
916 pad->
fWNDC = (
r.xup -
r.xlow) / mother->GetAbsWNDC();
917 pad->
fHNDC = (
r.yup -
r.ylow) / mother->GetAbsHNDC();
932 if ((xrange != 0.) && (pxrange != 0)) {
935 pad->
fXtoPixelk = rounding + -pxrange*
r.px1/xrange;
942 if ((yrange != 0.) && (pyrange != 0.)) {
945 pad->
fYtoPixelk = rounding + -pyrange - pyrange*
r.py1/yrange;
961 if (hist_holder == hist)
962 hist_holder =
nullptr;
976 if ((
hmin ==
hmax) && !no_entries) {
981 }
else if (
r.zy1 ==
r.zy2) {
990 if ((
hmin ==
hmax) && !no_entries) {
996 if (
r.zz1 ==
r.zz2) {
1015 ::Error(
"SetMember",
"Cannot find %s data member in %s",
name, hist_holder->
ClassName());
1019 SetMember(
"fMinimum",
hmin);
1020 SetMember(
"fMaximum",
hmax);
1024 while (
auto fobj = next())
1026 hist_exec = (
TExec *) fobj;
1027 need_update =
kTRUE;
1031 std::map<std::string, int> idmap;
1033 for (
auto &item :
r.primitives) {
1034 auto iter = idmap.find(item.snapid);
1036 if (iter == idmap.end())
1037 idmap[item.snapid] = 1;
1039 idcnt = ++iter->second;
1047 need_update =
kTRUE;
1050 if (process_execs && (
gPad == pad))
1051 pad_with_execs = pad;
1068 if ((!execs || !execs->GetSize()) && !extra)
1080 while (
auto obj = next()) {
1081 auto exec =
dynamic_cast<TExec *
>(obj);
1105 if (
c.fConnId == connid)
break;
1113 FlagGuard(
Bool_t &_flag) : flag(_flag) { flag =
true; }
1114 ~FlagGuard() { flag =
false; }
1119 const char *cdata = arg.c_str();
1121 if (arg ==
"KEEPALIVE") {
1124 }
else if (arg ==
"QUIT") {
1129 }
else if (arg.compare(0, 7,
"READY6:") == 0) {
1136 const char *separ = strchr(cdata,
':');
1138 fWebConn[indx].fDrawVersion = std::stoll(cdata);
1140 fWebConn[indx].fDrawVersion = std::stoll(std::string(cdata, separ - cdata));
1148 }
else if (arg ==
"RELOAD") {
1153 }
else if (arg.compare(0, 5,
"SAVE:") == 0) {
1156 const char *img = cdata + 5;
1158 const char *separ = strchr(img,
':');
1163 std::ofstream ofs(
filename.Data());
1174 Info(
"ProcessData",
"File %s has been created",
filename.Data());
1177 }
else if (arg.compare(0, 8,
"PRODUCE:") == 0) {
1182 }
else if (arg.compare(0, 9,
"OPTIONS6:") == 0) {
1191 }
else if (arg.compare(0, 11,
"STATUSBITS:") == 0) {
1197 }
else if (arg.compare(0, 10,
"HIGHLIGHT:") == 0) {
1199 auto arr = TBufferJSON::FromJSON<std::vector<std::string>>(arg.substr(10));
1200 if (!arr || (arr->size() != 4)) {
1201 Error(
"ProcessData",
"Wrong arguments count %d in highlight message", (
int)(arr ? arr->size() : -1));
1205 int argx = std::stoi(arr->at(2));
1206 int argy = std::stoi(arr->at(3));
1218 }
else if (arg.compare(0, 6,
"EVENT:") == 0) {
1219 auto arr = TBufferJSON::FromJSON<std::vector<std::string>>(arg.substr(6));
1220 if (!arr || (arr->size() != 5)) {
1221 Error(
"ProcessData",
"Wrong arguments count %d in event message", (
int)(arr ? arr->size() : -1));
1224 std::string kind = arr->at(1);
1227 int argx = std::stoi(arr->at(2));
1228 int argy = std::stoi(arr->at(3));
1231 if ((
event >= 0) && pad && (pad ==
gPad)) {
1242 }
else if (arg.compare(0, 8,
"GETMENU:") == 0) {
1250 std::string buf =
"MENU:";
1255 }
else if (arg.compare(0, 8,
"PRIMIT6:") == 0) {
1259 auto opt = TBufferJSON::FromJSON<TWebObjectOptions>(arg.c_str() + 8);
1270 }
else if (arg.compare(0, 11,
"PADCLICKED:") == 0) {
1272 auto click = TBufferJSON::FromJSON<TWebPadClick>(arg.c_str() + 11);
1280 const char *mthd = btn->GetMethod();
1281 if (mthd && *mthd) {
1283 gROOT->ProcessLine(mthd);
1288 if (pad && (pad !=
gPad)) {
1295 if (!click->objid.empty()) {
1303 if ((click->x >= 0) && (click->y >= 0)) {
1316 }
else if (arg.compare(0, 8,
"OBJEXEC:") == 0) {
1318 auto buf = arg.substr(8);
1319 auto pos = buf.find(
":");
1322 auto sid = buf.substr(0, pos);
1323 buf.erase(0, pos + 1);
1326 TPad *objpad =
nullptr;
1329 if (obj && !buf.empty()) {
1331 while (!buf.empty()) {
1332 std::string sub = buf;
1333 pos = buf.find(
";;");
1334 if (pos == std::string::npos) {
1338 sub = buf.substr(0,pos);
1339 buf = buf.substr(pos+2);
1341 if (sub.empty())
continue;
1343 std::stringstream exec;
1344 exec <<
"((" << obj->
ClassName() <<
" *) " << std::hex << std::showbase << (size_t)obj <<
")->" << sub <<
";";
1345 Info(
"ProcessData",
"Obj %s Execute %s", obj->
GetName(), exec.str().c_str());
1346 gROOT->ProcessLine(exec.str().c_str());
1358 }
else if (arg.compare(0, 12,
"EXECANDSEND:") == 0) {
1362 std::string buf = arg.substr(12);
1366 auto pos = buf.find(
":");
1370 reply = buf.substr(0, pos);
1371 buf.erase(0, pos + 1);
1372 pos = buf.find(
":");
1374 auto sid = buf.substr(0, pos);
1375 buf.erase(0, pos + 1);
1380 if (obj && !buf.empty() && !reply.empty()) {
1381 std::stringstream exec;
1382 exec <<
"((" << obj->
ClassName() <<
" *) " << std::hex << std::showbase << (size_t)obj
1383 <<
")->" << buf <<
";";
1385 Info(
"ProcessData",
"Obj %s Exec %s", obj->
GetName(), exec.str().c_str());
1387 auto res =
gROOT->ProcessLine(exec.str().c_str());
1390 std::string send = reply;
1394 if (reply[0] ==
'D')
1399 }
else if (arg.compare(0, 6,
"CLEAR:") == 0) {
1400 std::string snapid = arg.substr(6);
1409 printf(
"Not found pad with id %s\n", snapid.c_str());
1411 }
else if (arg.compare(0, 7,
"DIVIDE:") == 0) {
1412 auto arr = TBufferJSON::FromJSON<std::vector<std::string>>(arg.substr(7));
1413 if (arr && arr->size() == 2) {
1415 int nn = 0, n1 = 0, n2 = 0;
1417 std::string divide = arr->at(1);
1418 auto p = divide.find(
'x');
1419 if (
p == std::string::npos)
1420 p = divide.find(
'X');
1422 if (
p != std::string::npos) {
1423 n1 = std::stoi(divide.substr(0,
p));
1424 n2 = std::stoi(divide.substr(
p+1));
1426 nn = std::stoi(divide);
1429 if (pad && ((nn > 1) || (n1*n2 > 1))) {
1441 }
else if (arg.compare(0, 8,
"DRAWOPT:") == 0) {
1442 auto arr = TBufferJSON::FromJSON<std::vector<std::string>>(arg.substr(8));
1443 if (arr && arr->size() == 2) {
1450 }
else if (arg ==
"INTERRUPT"s) {
1451 gROOT->SetInterrupt();
1473 entry._modified =
true;
1477 while (
auto obj = iter()) {
1491 entry.second._detected =
false;
1492 entry.second._modified = force_modified;
1499 bool is_any_modified =
false;
1501 if (iter->second._modified)
1502 is_any_modified =
true;
1503 if (!iter->second._detected)
1510 if (is_any_modified) {
1513 if (entry.second._modified)
1579 Info(
"WaitWhenCanvasPainted",
"version %ld", (
long)ver);
1581 while (cnt++ < cnt_limit) {
1583 if (!
fWindow->HasConnection(0,
false)) {
1585 Info(
"WaitWhenCanvasPainted",
"no connections - abort");
1591 Info(
"WaitWhenCanvasPainted",
"ver %ld got painted", (
long)ver);
1601 Info(
"WaitWhenCanvasPainted",
"timeout");
1616 auto imp = std::make_unique<TWebCanvas>(pad->
GetCanvas(), pad->
GetName(), 0, 0, 1000, 500);
1620 imp->CreatePadSnapshot(holder, pad, 0, [&res, json_compression](
TPadWebSnapshot *snap) {
1640 auto imp = std::make_unique<TWebCanvas>(
c,
c->GetName(), 0, 0, 1000, 500);
1644 imp->CreatePadSnapshot(holder,
c, 0, [&res, json_compression](
TPadWebSnapshot *snap) {
1664 auto imp = std::make_unique<TWebCanvas>(
c,
c->GetName(), 0, 0, 1000, 500);
1699 TPad *objpad =
nullptr;
1702 if (item.
fcust.compare(
"exec") == 0) {
1703 auto pos = item.
opt.find(
"(");
1704 if (obj && (pos != std::string::npos) && obj->
IsA()->
GetMethodAllAny(item.
opt.substr(0,pos).c_str())) {
1705 std::stringstream exec;
1706 exec <<
"((" << obj->
ClassName() <<
" *) " << std::hex << std::showbase
1707 << (size_t)obj <<
")->" << item.
opt <<
";";
1708 Info(
"ProcessObjectOptions",
"Obj %s Execute %s", obj->
GetName(), exec.str().c_str());
1709 gROOT->ProcessLine(exec.str().c_str());
1711 Error(
"ProcessObjectOptions",
"Fail to execute %s for object %p %s", item.
opt.c_str(), obj, obj ? obj->
ClassName() :
"---");
1717 bool modified =
false;
1720 auto pos = item.
opt.find(
";;use_");
1721 if (pos != std::string::npos) item.
opt.resize(pos);
1724 Info(
"ProcessObjectOptions",
"Set draw option %s for object %s %s", item.
opt.c_str(),
1732 if (item.
fcust.compare(
"frame") == 0) {
1735 if (item.
fopt.size() >= 4) {
1743 }
else if (item.
fcust.compare(
"pave") == 0) {
1746 if ((item.
fopt.size() >= 4) && objpad) {
1763 return modified ? objpad :
nullptr;
1774 if (sid.empty() || (sid ==
"0"s))
1781 auto separ = sid.find(
"#");
1782 long unsigned id = 0;
1783 bool search_hist =
false;
1785 if (sid ==
"histogram") {
1787 }
else if (separ == std::string::npos) {
1788 id = std::stoul(sid);
1790 kind = sid.substr(separ + 1);
1791 id = std::stoul(sid.substr(0, separ));
1797 auto getHistogram = [](
TObject *obj) ->
TH1* {
1798 auto offset = obj->IsA()->GetDataMemberOffset(
"fHistogram");
1800 return *((
TH1 **)((
char*) obj +
offset));
1801 ::Error(
"getHistogram",
"Cannot access fHistogram data member in %s", obj->ClassName());
1806 TObject *obj = lnk->GetObject();
1809 TString opt = lnk->GetOption();
1824 return getHistogram(
gr);
1826 return getHistogram(mg);
1828 return getHistogram(hs);
1836 if ((
TString::Hash(&obj,
sizeof(obj)) ==
id) && (--idcnt <= 0)) {
1840 if (kind.find(
"hist") == 0) {
1842 obj =
h1 = getHistogram(
gr);
1844 obj =
h1 = getHistogram(mg);
1846 obj =
h1 = getHistogram(hs);
1849 if (!kind.empty() && (kind[0]==
'#')) kind.erase(0,1);
1853 if (
h1 && (kind ==
"x"))
1855 if (
h1 && (kind ==
"y"))
1857 if (
h1 && (kind ==
"z"))
1860 if ((
h1 ||
gr) && !kind.empty() && (kind.compare(0,5,
"func_") == 0)) {
1861 auto funcname = kind.substr(5);
1863 return col ? col->
FindObject(funcname.c_str()) :
nullptr;
1866 if (!kind.empty() && (kind.compare(0,7,
"member_") == 0)) {
1867 auto member = kind.substr(7);
1884 while ((fobj = fiter()) !=
nullptr)
1892 if (objpad && !*objpad)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmin
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmax
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
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 GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void funcs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
R__EXTERN TVirtualPS * gVirtualPS
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
EBrowserKind GetBrowserKind() const
returns configured browser kind, see EBrowserKind for supported values
@ kCEF
Chromium Embedded Framework - local display with CEF libs.
@ kQt6
Qt6 QWebEngine libraries - Chromium code packed in qt6.
@ kQt5
Qt5 QWebEngine libraries - Chromium code packed in qt5.
RWebDisplayArgs & SetWidgetKind(const std::string &kind)
set widget kind
static bool ProduceImage(const std::string &fname, const std::string &json, int width=800, int height=600, const char *batch_file=nullptr)
Produce image file using JSON data as source Invokes JSROOT drawing functionality in headless browser...
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
Array of integers (32 bits per element).
const Int_t * GetArray() const
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
static TString Decode(const char *data)
Decode a base64 string date into a generic TString.
virtual void SetY2(Double_t y2)
virtual void SetX1(Double_t x1)
virtual void SetX2(Double_t x2)
virtual void SetY1(Double_t y1)
static Int_t ExportToFile(const char *filename, const TObject *obj, const char *option=nullptr)
Convert object into JSON and store in text file Returns size of the produce file Used in TObject::Sav...
static TString ToJSON(const T *obj, Int_t compact=0, const char *member_name=nullptr)
@ kNoSpaces
no new lines plus remove all spaces around "," and ":" symbols
@ kSameSuppression
zero suppression plus compress many similar values together
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area).
void SetScripts(const std::string &src)
void SetHighlightConnect(bool on=true)
UInt_t fCw
Width of the canvas along X (pixels)
void SetClickSelectedPad(TPad *pad)
Int_t fEventX
! Last X mouse position in canvas
TVirtualPadPainter * GetCanvasPainter()
Access and (probably) creation of pad painter.
Int_t fEventY
! Last Y mouse position in canvas
TObject * fSelected
! Currently selected object
UInt_t fCh
Height of the canvas along Y (pixels)
void SetClickSelected(TObject *obj)
UInt_t GetWw() const override
UInt_t GetWh() const override
virtual void Highlighted(TVirtualPad *pad, TObject *obj, Int_t x, Int_t y)
Emit Highlighted() signal.
Int_t fEvent
! Type of current or last handled event
TClass instances represent classes, structs and namespaces in the ROOT type system.
Longptr_t GetDataMemberOffset(const char *membername) const
return offset for member name.
Int_t Size() const
Return size of object of this class.
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
TMethod * GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
Collection abstract base class.
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
The color creation and management class.
static const TArrayI & GetPalette()
Static function returning the current active palette.
static Bool_t DefinedColors()
Static function returning kTRUE if some new colors have been defined after initialisation or since th...
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
TExec is a utility class that can be used to execute a C++ command when some event happens in a pad.
virtual void Exec(const char *command="")
Execute the command referenced by this object.
A TGraph is an object made of two arrays X and Y with npoints each.
TList * GetListOfFunctions() const
TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases.
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t GetDimension() const
@ kNoTitle
Don't draw the histogram title.
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
virtual Double_t GetEntries() const
Return the current number of entries.
TList * GetListOfFunctions() const
virtual Int_t BufferEmpty(Int_t action=0)
Fill histogram with all entries in the buffer.
The Histogram stack class.
Option_t * GetOption() const
void Clear(Option_t *option="") override
Remove all objects from the list.
void Add(TObject *obj) override
virtual TObjLink * FirstLink() const
void AddFirst(TObject *obj) override
Add object at the beginning of the list.
A TMultiGraph is a collection of TGraph (or derived) objects.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
Wrapper around a TObject so it can be stored in a TList.
virtual void SetOption(Option_t *)
TObject * GetObject() const
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual const char * GetTitle() const
Returns title of object.
virtual TClass * IsA() const
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
TPadWebSnapshot & NewSubPad()
Create new entry for subpad.
TWebSnapshot & NewSpecials()
Create new entry in list of primitives in the front.
void SetWithoutPrimitives(bool on=true)
void SetActive(bool on=true)
TWebSnapshot & NewPrimitive(TObject *obj=nullptr, const std::string &opt="")
Create new entry in list of primitives.
bool IsSetObjectIds() const
The most important graphics class in the ROOT system.
Int_t GetTicky() const override
Double_t fAbsYlowNDC
Absolute Y top left corner of pad in NDC [0,1].
Double_t fXtoAbsPixelk
Conversion coefficient for X World to absolute pixel.
virtual void DivideSquare(Int_t n, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
"n" is the total number of sub-pads.
Double_t fWNDC
Width of pad along X in Normalized Coordinates (NDC)
void SetView(TView *view=nullptr) override
Set the current TView. Delete previous view if view=0.
TVirtualViewer3D * GetViewer3D(Option_t *type="") override
Create/obtain handle to 3D viewer.
Double_t fPixeltoYk
Conversion coefficient for pixel to Y World.
void SetGrid(Int_t valuex=1, Int_t valuey=1) override
Double_t fPixeltoY
yworld = fPixeltoYk + fPixeltoY*ypixel
Double_t fAbsXlowNDC
Absolute X top left corner of pad in NDC [0,1].
TList * GetListOfExecs() const override
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
Double_t fXtoPixel
xpixel = fXtoPixelk + fXtoPixel*xworld
Bool_t GetGridx() const override
Double_t fX2
X of upper X coordinate.
Double_t fPixeltoX
xworld = fPixeltoXk + fPixeltoX*xpixel
Double_t fYtoPixel
ypixel = fYtoPixelk + fYtoPixel*yworld
Double_t fAbsWNDC
Absolute Width of pad along X in NDC.
UInt_t GetWw() const override
Get Ww.
Double_t fX1
X of lower X coordinate.
TList * GetListOfPrimitives() const override
Double_t fUymin
Minimum value on the Y axis.
Int_t fLogz
(=0 if Z linear scale, =1 if log scale)
Double_t fYtoPixelk
Conversion coefficient for Y World to pixel.
Double_t fPixeltoXk
Conversion coefficient for pixel to X World.
Bool_t IsModified() const override
Double_t fY1
Y of lower Y coordinate.
Double_t fYlowNDC
Y bottom left corner of pad in NDC [0,1].
Double_t fAbsPixeltoXk
Conversion coefficient for absolute pixel to X World.
void Clear(Option_t *option="") override
Delete all pad primitives.
Int_t GetTickx() const override
Double_t fUymax
Maximum value on the Y axis.
void Modified(Bool_t flag=1) override
TVirtualPad * GetMother() const override
TView * GetView() const override
Bool_t GetGridy() const override
Double_t fAbsHNDC
Absolute Height of pad along Y in NDC.
void SetFixedAspectRatio(Bool_t fixed=kTRUE) override
Fix pad aspect ratio to current value if fixed is true.
Int_t fLogx
(=0 if X linear scale, =1 if log scale)
UInt_t GetWh() const override
Get Wh.
TCanvas * GetCanvas() const override
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
void Print(const char *filename="") const override
This method is equivalent to SaveAs("filename"). See TPad::SaveAs for details.
TFrame * GetFrame() override
Get frame.
Double_t fYtoAbsPixelk
Conversion coefficient for Y World to absolute pixel.
Double_t fXtoPixelk
Conversion coefficient for X World to pixel.
Int_t fLogy
(=0 if Y linear scale, =1 if log scale)
Double_t fHNDC
Height of pad along Y in Normalized Coordinates (NDC)
Double_t fXlowNDC
X bottom left corner of pad in NDC [0,1].
Double_t fUxmin
Minimum value on the X axis.
void SetTicks(Int_t valuex=1, Int_t valuey=1) override
Double_t fUxmax
Maximum value on the X axis.
Double_t fY2
Y of upper Y coordinate.
Double_t fAbsPixeltoYk
Conversion coefficient for absolute pixel to Y World.
const char * GetName() const override
Returns name of object.
The histogram statistics painter class.
virtual void SetStatFormat(const char *format="6.4g")
Change (i.e. set) the format for printing statistics.
virtual void SetFitFormat(const char *format="5.4g")
Change (i.e. set) the format for printing fit parameters in statistics box.
void SetParent(TObject *obj) override
A Pave (see TPave) with text, lines or/and boxes inside.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
virtual TText * GetLine(Int_t number) const
Get Pointer to line number in this pavetext.
A TBox with a bordersize and a shadow option.
virtual void SetY1NDC(Double_t y1)
virtual void ConvertNDCtoPad()
Convert pave coordinates from NDC to Pad coordinates.
virtual void SetName(const char *name="")
virtual void SetBorderSize(Int_t bordersize=4)
virtual void SetY2NDC(Double_t y2)
virtual void SetX1NDC(Double_t x1)
virtual void SetX2NDC(Double_t x2)
const char * Data() const
void ToUpper()
Change string to upper case.
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
TString & Append(const char *cs)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Color_t GetStatTextColor() const
Int_t GetOptTitle() const
Float_t GetStatFontSize() const
Style_t GetTitleFont(Option_t *axis="X") const
Return title font.
Color_t GetTitleFillColor() const
Style_t GetTitleStyle() const
Color_t GetStatColor() const
Width_t GetTitleBorderSize() const
Width_t GetStatBorderSize() const
Color_t GetTitleTextColor() const
Style_t GetStatStyle() const
const char * GetFitFormat() const
const char * GetStatFormat() const
Style_t GetStatFont() const
Float_t GetTitleFontSize() const
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
static TView * CreateView(Int_t system=1, const Double_t *rmin=nullptr, const Double_t *rmax=nullptr)
Create a concrete default 3-d view via the plug-in manager.
virtual void SetAutoRange(Bool_t autorange=kTRUE)=0
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
small helper class to store/restore gPad context in TPad methods
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Semi-Abstract base class defining a generic interface to the underlying, low level,...
Basic TCanvasImp ABI implementation for Web-based GUI Provides painting of main ROOT6 classes in web ...
TVirtualPadPainter * CreatePadPainter() override
Creates web-based pad painter.
void ForceUpdate() override
Increment canvas version and force sending data to client - do not wait for reply.
void AddCustomClass(const std::string &clname, bool with_derived=false)
Assign custom class.
UInt_t fColorsHash
! last hash of colors/palette
void ShowCmd(const std::string &arg, Bool_t show)
Function used to send command to browser to toggle menu, toolbar, editors, ...
Long64_t fColorsVersion
! current colors/palette version, checked every time when new snapshot created
std::string fCustomScripts
! custom JavaScript code or URL on JavaScript files to load before start drawing
virtual Bool_t IsReadOnly() const
virtual Bool_t IsJSSupportedClass(TObject *obj, Bool_t many_primitives=kFALSE)
Returns kTRUE when object is fully supported on JSROOT side In ROOT7 Paint function will just return ...
void SetCustomScripts(const std::string &src)
Configures custom script for canvas.
ObjectSelectSignal_t fObjSelectSignal
! signal emitted when new object selected in the pad
PadClickedSignal_t fPadClickedSignal
! signal emitted when simple mouse click performed on the pad
void SetLongerPolling(Bool_t on)
UInt_t fStyleHash
! last hash of gStyle
virtual Bool_t CanCreateObject(const std::string &)
Int_t fPrimitivesMerge
! number of PS primitives, which will be merged together
void Show() override
Show canvas in browser window.
Bool_t WaitWhenCanvasPainted(Long64_t ver)
Wait when specified version of canvas was painted and confirmed by browser.
std::vector< std::string > fCustomClasses
! list of custom classes, which can be delivered as is to client
static TString CreatePadJSON(TPad *pad, Int_t json_compression=0)
Bool_t IsAsyncMode() const
static TString CreateCanvasJSON(TCanvas *c, Int_t json_compression=0)
Create JSON painting output for given canvas Produce JSON can be used for offline drawing with JSROOT...
UInt_t CalculateColorsHash()
Calculate hash function for all colors and palette.
Bool_t HasStatusBar() const override
Returns kTRUE if web canvas has status bar.
void Close() override
Close web canvas - not implemented.
Bool_t HasMenuBar() const override
Returns kTRUE if web canvas has menu bar.
Int_t InitWindow() override
Initialize window for the web canvas At this place canvas is not yet register to the list of canvases...
void CheckPadModified(TPad *pad)
Returns true if any pad in the canvas were modified Reset modified flags, increment canvas version (i...
static bool ProduceImage(TPad *pad, const char *filename, Int_t width=0, Int_t height=0)
Create image using batch (headless) capability of Chrome or Firefox browsers Supported png,...
void ActivateInEditor(TPad *pad, TObject *obj)
Activate object in editor in web browser.
std::vector< WebConn > fWebConn
! connections
PadSignal_t fActivePadChangedSignal
! signal emitted when active pad changed in the canvas
Bool_t GetLongerPolling() const
void ShowWebWindow(const ROOT::Experimental::RWebDisplayArgs &user_args="")
Show canvas in specified place.
UInt_t fClientBits
! latest status bits from client like editor visible or not
std::function< void(TPadWebSnapshot *)> PadPaintingReady_t
Function called when pad painting produced.
Int_t fPaletteDelivery
! colors palette delivery 0:never, 1:once, 2:always, 3:per subpad
Bool_t fProcessingData
! flag used to prevent blocking methods when process data is invoked
Bool_t HasToolTips() const override
Returns kTRUE if tooltips are activated in web canvas.
Bool_t AddToSendQueue(unsigned connid, const std::string &msg)
Add message to send queue for specified connection If connid == 0, message will be add to all connect...
Long64_t fCanvVersion
! actual canvas version, changed with every new Modified() call
bool IsCustomClass(const TClass *cl) const
Checks if class belongs to custom.
TPad * ProcessObjectOptions(TWebObjectOptions &item, TPad *pad, int idcnt=1)
Process data for single primitive Returns object pad if object was modified.
void CreateObjectSnapshot(TPadWebSnapshot &master, TPad *pad, TObject *obj, const char *opt, TWebPS *masterps=nullptr)
Creates representation of the object for painting in web browser.
void AddColorsPalette(TPadWebSnapshot &master)
Add special canvas objects like colors list at selected palette.
void CheckCanvasModified(bool force_modified=false)
Check if any pad on the canvas was modified If yes, increment version of correspondent pad.
Long64_t fStyleVersion
! current gStyle object version, checked every time when new snapshot created
Bool_t PerformUpdate() override
if canvas or any subpad was modified, scan all primitives in the TCanvas and subpads and convert them...
void CheckDataToSend(unsigned connid=0)
Check if any data should be send to client If connid != 0, only selected connection will be checked.
UpdatedSignal_t fUpdatedSignal
! signal emitted when canvas updated or state is changed
Int_t fJsonComp
! compression factor for messages send to the client
Bool_t IsFirstConn(unsigned connid) const
Bool_t fReadOnly
!< configured display
std::map< TPad *, PadStatus > fPadsStatus
! map of pads in canvas and their status flags
void AssignStatusBits(UInt_t bits)
Assign clients bits.
virtual Bool_t ProcessData(unsigned connid, const std::string &arg)
Handle data from web browser Returns kFALSE if message was not processed.
TWebCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height, Bool_t readonly=kTRUE)
Constructor.
static Int_t StoreCanvasJSON(TCanvas *c, const char *filename, const char *option="")
Create JSON painting output for given canvas and store into the file See TBufferJSON::ExportToFile() ...
UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Returns window geometry including borders and menus.
std::shared_ptr< ROOT::Experimental::RWebWindow > fWindow
static TCanvasImp * NewCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height)
Static method to create TWebCanvas instance Used by plugin manager.
Bool_t HasEditor() const override
Returns kTRUE if web canvas has graphical editor.
Int_t fStyleDelivery
! gStyle delivery to clients: 0:never, 1:once, 2:always
PadClickedSignal_t fPadDblClickedSignal
! signal emitted when simple mouse click performed on the pad
void ProcessExecs(TPad *pad, TExec *extra=nullptr)
Process TExec objects in the pad.
TList fPrimitivesLists
! list of lists of primitives, temporary collected during painting
void CreatePadSnapshot(TPadWebSnapshot &paddata, TPad *pad, Long64_t version, PadPaintingReady_t func)
Create snapshot for pad and all primitives Callback function is used to create JSON in the middle of ...
virtual Bool_t DecodePadOptions(const std::string &, bool process_execs=false)
Decode all pad options, which includes ranges plus objects options.
Int_t GetPaletteDelivery() const
TObject * FindPrimitive(const std::string &id, int idcnt=1, TPad *pad=nullptr, TObjLink **objlnk=nullptr, TPad **objpad=nullptr)
Search of object with given id in list of primitives One could specify pad where search could be star...
Int_t GetStyleDelivery() const
Class used to transport drawing options from the client.
std::vector< double > fopt
custom float array
std::string fcust
custom string
std::string snapid
id of the object
std::string opt
drawing options
Bool_t IsEmptyPainting() const
TWebPainting * TakePainting()
TWebPainting * GetPainting()
Implement TVirtualPadPainter which abstracts painting operations.
Object used to store paint operations and deliver them to JSROOT.
void AddColor(Int_t indx, TColor *col)
Add custom color to operations.
void SetObjectIDAsPtr(void *ptr)
Use pointer to assign object id - TString::Hash.
void SetSnapshot(Int_t kind, TObject *snapshot, Bool_t owner=kFALSE)
SetUse pointer to assign object id - TString::Hash.
@ kSVG
list of SVG primitives
@ kColors
list of ROOT colors + palette
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
bool _detected
! if pad was detected during last scan