56using namespace std::string_literals;
100 } supported_classes[] = {{
"TH1",
true},
105 {
"TMultiGraph",
false},
106 {
"TGraphPolargram",
true},
116 {
"TMathText",
false},
118 {
"TPolyMarker",
false},
119 {
"TPolyMarker3D",
false},
120 {
"TPolyLine3D",
false},
122 {
"TGraph2DErrors",
false},
124 {
"TRatioPlot",
false},
128 {
"TGeoManager",
false},
129 {
"TPolyLine3D",
false},
130 {
"TPolyMarker3D",
false},
134 for (
int i = 0; supported_classes[i].name !=
nullptr; ++i)
135 if (strcmp(supported_classes[i].
name, obj->
ClassName()) == 0)
139 for (
int i = 0; supported_classes[i].name !=
nullptr; ++i)
140 if (supported_classes[i].with_derived)
175 if (
name[0] ==
'+') {
200 TView *view =
nullptr;
232 painter->SetPainting(
nullptr);
269 auto *tgt = listofcols->Reserve(pal.
GetSize());
272 listofcols->FixSize();
299 TIter iter(primitives);
303 bool need_frame =
false;
304 std::string need_title;
306 while ((obj = iter()) !=
nullptr) {
308 frame =
static_cast<TFrame *
>(obj);
316 if (strcmp(obj->
GetName(),
"title") == 0)
326 if (!need_title.empty()) {
328 auto line0 = title->
GetLine(0);
331 title =
new TPaveText(0, 0, 0, 0,
"blNDC");
340 title->
AddText(need_title.c_str());
342 primitives->
Add(title);
346 auto flush_master = [&]() {
355 bool first_obj =
true;
357 while ((obj = iter()) !=
nullptr) {
372 while ((fobj = fiter()) !=
nullptr) {
411 std::stringstream exec;
412 exec <<
"new TPaletteAxis(0,0,0,0, (TH1*)" << std::hex << std::showbase << (size_t)hist <<
");";
413 palette = (
TObject *)
gROOT->ProcessLine(exec.str().c_str());
418 if (title && first_obj) hopt.
Append(
";;use_pad_title");
422 if (palette) hopt.
Append(
";;use_pad_palette");
444 while ((fobj = fiter()) !=
nullptr) {
454 if (title && first_obj) gropt.
Append(
";;use_pad_title");
455 if (stats) gropt.
Append(
";;use_pad_stats");
460 while ((fobj = fiter()) !=
nullptr)
477 provide_colors = !!resfunc && (version <= 0);
479 provide_colors = !!resfunc;
492 TList *dlst =
nullptr;
493 while ((dlst = (
TList *)diter()) !=
nullptr) {
495 while ((obj = fiter()) !=
nullptr)
498 dlst->
Clear(
"nodelete");
508 TIter siter(&save_lst);
510 while ((dlst = (
TList *)diter()) !=
nullptr) {
511 while ((obj = siter()) !=
nullptr) {
518 save_lst.
Clear(
"nodelete");
532 if ((conn.fConnId == connid) || (connid == 0)) {
533 conn.fSend.emplace(msg);
551 if (connid && (conn.fConnId != connid))
555 if (!
fWindow->CanSend(conn.fConnId,
true))
560 if ((conn.fSendVersion <
fCanvVersion) && (conn.fSendVersion == conn.fDrawVersion)) {
567 if (!conn.fSendVersion)
571 buf.append(TBufferJSON::ToJSON(snap, fJsonComp).Data());
576 }
else if (!conn.fSend.empty()) {
578 std::swap(buf, conn.fSend.front());
584 fWindow->Send(conn.fConnId, buf);
606 fWindow->SetDefaultPage(
"file:rootui5sys/canv/canvas6.html");
610 [
this](
unsigned connid) {
615 [
this](
unsigned connid,
const std::string &arg) {
620 [
this](
unsigned connid) {
623 if (
c.fConnId == connid) {
634 if ((w > 10) && (w < 50000) && (
h > 10) && (
h < 30000))
635 fWindow->SetGeometry(w + 6,
h + 22);
669 if (!pad || !obj)
return;
729 auto arr = TBufferJSON::FromJSON<std::vector<TWebPadOptions>>(msg);
734 for (
unsigned n = 0;
n < arr->size(); ++
n) {
735 auto &
r = arr->at(
n);
743 if (
r.active && (pad !=
gPad))
gPad = pad;
763 Double_t ux1_, ux2_, uy1_, uy2_, px1_, px2_, py1_, py2_;
765 pad->
GetRange(px1_, py1_, px2_, py2_);
768 bool same_range = (
r.ux1 == ux1_) && (
r.ux2 == ux2_) && (
r.uy1 == uy1_) && (
r.uy2 == uy2_) &&
769 (
r.px1 == px1_) && (
r.px2 == px2_) && (
r.py1 == py1_) && (
r.py2 == py2_);
777 Info(
"DecodeAllRanges",
"Change ranges for pad %s", pad->
GetName());
781 pad->
SetPad(
r.mleft,
r.mbottom, 1-
r.mright, 1-
r.mtop);
786 double hmin = 0, hmax = 0;
796 }
else if (
r.zy1 ==
r.zy2) {
806 if (
r.zz1 ==
r.zz2) {
818 for (
auto &item :
r.primitives)
844 if (
c.fConnId == connid)
break;
852 FlagGuard(
Bool_t &_flag) : flag(_flag) { flag =
true; }
853 ~FlagGuard() { flag =
false; }
858 const char *cdata = arg.c_str();
860 if (arg ==
"KEEPALIVE") {
863 }
else if (arg ==
"QUIT") {
868 }
else if (arg.compare(0, 7,
"READY6:") == 0) {
875 const char *separ = strchr(cdata,
':');
877 fWebConn[indx].fDrawVersion = std::stoll(cdata);
879 fWebConn[indx].fDrawVersion = std::stoll(std::string(cdata, separ - cdata));
884 }
else if (arg ==
"RELOAD") {
889 }
else if (arg.compare(0, 5,
"SAVE:") == 0) {
892 const char *img = cdata + 5;
894 const char *separ = strchr(img,
':');
896 TString filename(img, separ - img);
899 std::ofstream ofs(filename.
Data());
910 Info(
"ProcessData",
"File %s has been created", filename.
Data());
913 }
else if (arg.compare(0, 8,
"PRODUCE:") == 0) {
918 }
else if (arg.compare(0, 9,
"OPTIONS6:") == 0) {
923 }
else if (arg.compare(0, 11,
"STATUSBITS:") == 0) {
935 }
else if (arg.compare(0, 8,
"GETMENU:") == 0) {
943 std::string buf =
"MENU:";
948 }
else if (arg.compare(0, 8,
"PRIMIT6:") == 0) {
952 auto opt = TBufferJSON::FromJSON<TWebObjectOptions>(arg.c_str() + 8);
963 }
else if (arg.compare(0, 11,
"PADCLICKED:") == 0) {
965 auto click = TBufferJSON::FromJSON<TWebPadClick>(arg.c_str() + 11);
970 if (pad && (pad !=
gPad)) {
971 Info(
"ProcessData",
"Activate pad %s", pad->
GetName());
978 if (!click->objid.empty()) {
985 if ((click->x >= 0) && (click->y >= 0)) {
993 }
else if (arg.compare(0, 8,
"OBJEXEC:") == 0) {
995 auto buf = arg.substr(8);
996 auto pos = buf.find(
":");
999 auto sid = buf.substr(0, pos);
1000 buf.erase(0, pos + 1);
1003 if (obj && !buf.empty()) {
1005 while (!buf.empty()) {
1006 std::string sub = buf;
1007 pos = buf.find(
";;");
1008 if (pos == std::string::npos) {
1012 sub = buf.substr(0,pos);
1013 buf = buf.substr(pos+2);
1015 if (sub.empty())
continue;
1017 std::stringstream exec;
1018 exec <<
"((" << obj->
ClassName() <<
" *) " << std::hex << std::showbase << (size_t)obj <<
")->" << sub <<
";";
1019 Info(
"ProcessData",
"Obj %s Execute %s", obj->
GetName(), exec.str().c_str());
1020 gROOT->ProcessLine(exec.str().c_str());
1027 }
else if (arg.compare(0, 12,
"EXECANDSEND:") == 0) {
1031 std::string buf = arg.substr(12);
1035 auto pos = buf.find(
":");
1039 reply = buf.substr(0, pos);
1040 buf.erase(0, pos + 1);
1041 pos = buf.find(
":");
1043 auto sid = buf.substr(0, pos);
1044 buf.erase(0, pos + 1);
1049 if (obj && !buf.empty() && !reply.empty()) {
1050 std::stringstream exec;
1051 exec <<
"((" << obj->
ClassName() <<
" *) " << std::hex << std::showbase << (size_t)obj
1052 <<
")->" << buf <<
";";
1054 Info(
"ProcessData",
"Obj %s Exec %s", obj->
GetName(), exec.str().c_str());
1056 Long_t res =
gROOT->ProcessLine(exec.str().c_str());
1059 std::string send = reply;
1063 if (reply[0] ==
'D')
1092 while ((obj = iter()) !=
nullptr) {
1097 if (inc_version && modified)
1153 Info(
"WaitWhenCanvasPainted",
"version %ld", (
long)ver);
1155 while (cnt++ < cnt_limit) {
1157 if (!
fWindow->HasConnection(0,
false)) {
1159 Info(
"WaitWhenCanvasPainted",
"no connections - abort");
1165 Info(
"WaitWhenCanvasPainted",
"ver %ld got painted", (
long)ver);
1175 Info(
"WaitWhenCanvasPainted",
"timeout");
1191 Bool_t isbatch =
c->IsBatch();
1195 auto imp = std::make_unique<TWebCanvas>(
c,
c->GetName(), 0, 0, 1000, 500);
1199 imp->CreatePadSnapshot(holder,
c, 0, [&res, json_compression](
TPadWebSnapshot *snap) {
1204 c->SetBatch(isbatch);
1219 Bool_t isbatch =
c->IsBatch();
1223 auto imp = std::make_unique<TWebCanvas>(
c,
c->GetName(), 0, 0, 1000, 500);
1227 imp->CreatePadSnapshot(holder,
c, 0, [&res, filename, option](
TPadWebSnapshot *snap) {
1232 c->SetBatch(isbatch);
1259 TPad *objpad =
nullptr;
1262 if (item.
fcust.compare(
"exec") == 0) {
1263 auto pos = item.
opt.find(
"(");
1264 if (obj && (pos != std::string::npos) && obj->IsA()->GetMethodAllAny(item.
opt.substr(0,pos).c_str())) {
1265 std::stringstream exec;
1266 exec <<
"((" << obj->
ClassName() <<
" *) " << std::hex << std::showbase
1267 << (size_t)obj <<
")->" << item.
opt <<
";";
1268 Info(
"ProcessObjectOptions",
"Obj %s Execute %s", obj->
GetName(), exec.str().c_str());
1269 gROOT->ProcessLine(exec.str().c_str());
1271 Error(
"ProcessObjectOptions",
"Fail to execute %s for object %p %s", item.
opt.c_str(), obj, obj ? obj->
ClassName() :
"---");
1277 bool modified =
false;
1280 auto pos = item.
opt.find(
";;use_");
1281 if (pos != std::string::npos) item.
opt.resize(pos);
1284 Info(
"ProcessObjectOptions",
"Set draw option %s for object %s %s", item.
opt.c_str(),
1292 if (item.
fcust.compare(
"frame") == 0) {
1295 if (item.
fopt.size() >= 4) {
1303 }
else if (item.
fcust.compare(
"pave") == 0) {
1306 if ((item.
fopt.size() >= 4) && objpad) {
1325 return modified ? objpad :
nullptr;
1341 auto separ = sid.find(
"#");
1342 long unsigned id = 0;
1343 bool search_hist =
false;
1345 if (sid ==
"histogram") {
1347 }
else if (separ == std::string::npos) {
1348 id = std::stoul(sid);
1350 kind = sid.substr(separ + 1);
1351 id = std::stoul(sid.substr(0, separ));
1370 auto offset = TGraph::Class()->GetDataMemberOffset(
"fHistogram");
1372 return *((
TH1 **)((
char*)
gr + offset));
1374 printf(
"ERROR: Cannot access fHistogram data member in TGraph\n");
1386 if (
gr && (kind.find(
"hist")==0)) {
1390 if (!kind.empty() && (kind[0]==
'#')) kind.erase(0,1);
1394 if (
h1 && (kind ==
"x"))
1396 if (
h1 && (kind ==
"y"))
1398 if (
h1 && (kind ==
"z"))
1401 if ((
h1 ||
gr) && !kind.empty() && (kind.compare(0,5,
"func_") == 0)) {
1402 auto funcname = kind.substr(5);
1404 return col ? col->
FindObject(funcname.c_str()) :
nullptr;
1407 if (!kind.empty() && (kind.compare(0,7,
"member_") == 0)) {
1408 auto member = kind.substr(7);
1409 auto offset = obj->IsA() ? obj->IsA()->GetDataMemberOffset(member.c_str()) : 0;
1424 while ((fobj = fiter()) !=
nullptr)
1432 if (objpad && !*objpad)
include TDocParser_001 C image html pict1_TDocParser_001 png width
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.
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)
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).
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 SetClickSelectedPad(TPad *pad)
TVirtualPadPainter * GetCanvasPainter()
Access and (probably) creation of pad painter.
void SetClickSelected(TObject *obj)
UInt_t GetWw() const override
UInt_t GetWh() const override
TClass instances represent classes, structs and namespaces in the ROOT type system.
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Collection abstract base class.
virtual TObject * FindObject(const char *name) const
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.
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.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
TList * GetListOfFunctions() const
virtual Int_t BufferEmpty(Int_t action=0)
Fill histogram with all entries in the buffer.
Option_t * GetOption() const
virtual void Add(TObject *obj)
virtual void AddFirst(TObject *obj)
Add object at the beginning of the list.
virtual TObjLink * FirstLink() const
virtual void Clear(Option_t *option="")
Remove all objects from the list.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetName() const
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 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 SetActive(bool on=true)
TWebSnapshot & NewPrimitive(TObject *obj=nullptr, const std::string &opt="")
Create new entry in list of primitives.
The most important graphics class in the ROOT system.
Int_t GetTicky() const override
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.
void SetGrid(Int_t valuex=1, Int_t valuey=1) override
Bool_t GetGridx() const override
void SetLogz(Int_t value=1) override
Set Lin/Log scale for Z.
TList * GetListOfPrimitives() const override
void SetPad(const char *name, const char *title, Double_t xlow, Double_t ylow, Double_t xup, Double_t yup, Color_t color=35, Short_t bordersize=5, Short_t bordermode=-1) override
Set all pad parameters.
void Range(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Set world coordinate system for the pad.
Bool_t IsModified() const override
Int_t GetTickx() const override
void Modified(Bool_t flag=1) override
void SetLogy(Int_t value=1) override
Set Lin/Log scale for Y.
TView * GetView() const override
Bool_t GetGridy() const override
Int_t GetLogz() const override
void RangeAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax) override
Set axis coordinate system for the pad.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Int_t GetLogy() const override
void Print(const char *filename="") const override
This method is equivalent to SaveAs("filename"). See TPad::SaveAs for details.
TFrame * GetFrame() override
Get frame.
void GetRangeAxis(Double_t &xmin, Double_t &ymin, Double_t &xmax, Double_t &ymax) override
Return pad axis coordinates range.
void SetTicks(Int_t valuex=1, Int_t valuey=1) override
void GetRange(Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2) override
Return pad world coordinates range.
void SetLogx(Int_t value=1) override
Set Lin/Log scale for X.
Int_t GetLogx() const override
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.
void SetOptStat(Int_t stat=1)
Set the stat option.
virtual void SetParent(TObject *obj)
virtual void SetFitFormat(const char *format="5.4g")
Change (i.e. set) the format for printing fit parameters in statistics box.
void SetOptFit(Int_t fit=1)
Set the fit option.
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
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
TString & Append(const char *cs)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Color_t GetStatTextColor() 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).
virtual void SetAutoRange(Bool_t autorange=kTRUE)=0
static TView * CreateView(Int_t system=1, const Double_t *rmin=0, const Double_t *rmax=0)
Create a concrete default 3-d view via the plug-in manager.
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0
TVirtualPadPainter * CreatePadPainter() override
Creates web-based pad painter.
void ForceUpdate() override
Increment canvas version and force sending data to client - do not wit for reply.
void AddCustomClass(const std::string &clname, bool with_derived=false)
Assign custom class.
Bool_t CheckPadModified(TPad *pad, Bool_t inc_version=kTRUE)
Returns true if any pad in the canvas were modified Reset modified flags, increment canvas version (i...
void ShowCmd(const std::string &arg, Bool_t show)
Function used to send command to browser to toggle menu, toolbar, editors, ...
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)
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
static bool ProduceImage(TCanvas *c, const char *filename, Int_t width=0, Int_t height=0)
Create image using batch (headless) capability of Chrome browser Supported png, jpeg,...
void SetLongerPolling(Bool_t on)
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
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...
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 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.
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.
virtual Bool_t DecodePadOptions(const std::string &)
Decode all pad options, which includes ranges plus objects options.
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
Bool_t fHasSpecials
! has special objects which may require pad ranges
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.
TPad * ProcessObjectOptions(TWebObjectOptions &item, TPad *pad)
Process data for single primitive Returns object pad if object was modified.
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
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
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 ...
Int_t GetPaletteDelivery() const
TObject * FindPrimitive(const std::string &id, TPad *pad=nullptr, TObjLink **padlnk=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.