Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TWebCanvas.h
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 7/12/2016
2
3/*************************************************************************
4 * Copyright (C) 1995-2023, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_TWebCanvas
12#define ROOT_TWebCanvas
13
14#include "TCanvasImp.h"
15
16#include "TString.h"
17#include "TList.h"
18#include "TWebPadOptions.h"
19
20#include <ROOT/RWebWindow.hxx>
21
22#include <vector>
23#include <string>
24#include <queue>
25#include <functional>
26#include <map>
27
28class TPad;
29class TPadWebSnapshot;
30class TWebPS;
31class TObjLink;
32class TExec;
33class TWebCanvasTimer;
34
35class TWebCanvas : public TCanvasImp {
36
37friend class TWebCanvasTimer;
38
39public:
40 /// Function type for signals, invoked when canvas drawing or update is completed
41 using UpdatedSignal_t = std::function<void()>;
42
43 /// Function type for pad-related signals - like activate pad signal
44 using PadSignal_t = std::function<void(TPad *)>;
45
46 /// Function type for pad-click signals
47 using PadClickedSignal_t = std::function<void(TPad *, int, int)>;
48
49 /// Function type for signals, invoked when object is selected
50 using ObjectSelectSignal_t = std::function<void(TPad *, TObject *)>;
51
52protected:
53
54 /// Function called when pad painting produced
55 using PadPaintingReady_t = std::function<void(TPadWebSnapshot *)>;
56
57 struct WebConn {
58 unsigned fConnId{0}; ///<! connection id
59 Long64_t fCheckedVersion{0}; ///<! canvas version checked before sending
60 Long64_t fSendVersion{0}; ///<! canvas version send to the client
61 Long64_t fDrawVersion{0}; ///<! canvas version drawn (confirmed) by client
62 UInt_t fLastSendHash{0}; ///<! hash of last send draw message, avoid looping
63 std::map<std::string, std::string> fCtrl; ///<! different ctrl parameters which can be send at once
64 std::queue<std::string> fSend; ///<! send queue, processed after sending draw data
65
66 WebConn(unsigned id) : fConnId(id) {}
67 bool is_batch() const { return fConnId == 0; }
68 bool match(unsigned id) const { return !is_batch() && ((fConnId == id) || (id == 0)); }
69 void reset()
70 {
72 fLastSendHash = 0;
73 }
74 };
75
76 struct PadStatus {
77 Long64_t fVersion{0}; ///<! last pad version
78 bool _detected{false}; ///<! if pad was detected during last scan
79 bool _modified{false}; ///<! if pad was modified during last scan
80 bool _has_specials{false}; ///<! are there any special objects with painting
81 };
82
83 std::vector<WebConn> fWebConn; ///<! connections
84 TWebCanvasTimer *fTimer{nullptr}; ///<! timer to submit control messages
85
86 std::map<TPad*, PadStatus> fPadsStatus; ///<! map of pads in canvas and their status flags
87
88 std::shared_ptr<ROOT::RWebWindow> fWindow; ///!< configured display
89
90 Bool_t fReadOnly{kFALSE}; ///<! in read-only mode canvas cannot be changed from client side
91 Long64_t fCanvVersion{1}; ///<! actual canvas version, changed with every new Modified() call
92 UInt_t fClientBits{0}; ///<! latest status bits from client like editor visible or not
93 TList fPrimitivesLists; ///<! list of lists of primitives, temporary collected during painting
94 Int_t fStyleDelivery{0}; ///<! gStyle delivery to clients: 0:never, 1:once, 2:always
95 Int_t fPaletteDelivery{1}; ///<! colors palette delivery 0:never, 1:once, 2:always, 3:per subpad
96 Int_t fPrimitivesMerge{100}; ///<! number of PS primitives, which will be merged together
97 Int_t fJsonComp{0}; ///<! compression factor for messages send to the client
98 std::string fCustomScripts; ///<! custom JavaScript code or URL on JavaScript files to load before start drawing
99 std::vector<std::string> fCustomClasses; ///<! list of custom classes, which can be delivered as is to client
100 Bool_t fCanCreateObjects{kTRUE}; ///<! indicates if canvas allowed to create extra objects for interactive painting
101 Bool_t fLongerPolling{kFALSE}; ///<! when true, make longer polling in blocking operations
102 Bool_t fProcessingData{kFALSE}; ///<! flag used to prevent blocking methods when process data is invoked
103 Bool_t fAsyncMode{kFALSE}; ///<! when true, methods like TCanvas::Update will never block
104 Long64_t fStyleVersion{0}; ///<! current gStyle object version, checked every time when new snapshot created
105 UInt_t fStyleHash{0}; ///<! last hash of gStyle
106 Long64_t fColorsVersion{0}; ///<! current colors/palette version, checked every time when new snapshot created
107 UInt_t fColorsHash{0}; ///<! last hash of colors/palette
108 Bool_t fTF1UseSave{kFALSE}; ///<! use save buffer for TF1/TF2, need when evaluation failed on client side
109 std::vector<int> fWindowGeometry; ///<! last received window geometry
110 Bool_t fFixedSize{kFALSE}; ///<! is canvas size fixed
111
112 UpdatedSignal_t fUpdatedSignal; ///<! signal emitted when canvas updated or state is changed
113 PadSignal_t fActivePadChangedSignal; ///<! signal emitted when active pad changed in the canvas
114 PadClickedSignal_t fPadClickedSignal; ///<! signal emitted when simple mouse click performed on the pad
115 PadClickedSignal_t fPadDblClickedSignal; ///<! signal emitted when simple mouse click performed on the pad
116 ObjectSelectSignal_t fObjSelectSignal; ///<! signal emitted when new object selected in the pad
117
118 void Lock() override {}
119 void Unlock() override {}
120 Bool_t IsLocked() override { return kFALSE; }
121
122 Bool_t IsWeb() const override { return kTRUE; }
123 Bool_t PerformUpdate(Bool_t async) override;
125
127 void AddColorsPalette(TPadWebSnapshot &master);
128
129 void CreateObjectSnapshot(TPadWebSnapshot &master, TPad *pad, TObject *obj, const char *opt, TWebPS *masterps = nullptr);
130 void CreatePadSnapshot(TPadWebSnapshot &paddata, TPad *pad, Long64_t version, PadPaintingReady_t func);
131
132 void CheckPadModified(TPad *pad);
133
134 Bool_t CheckCanvasModified(bool force_modified = false);
135
136 void AddCtrlMsg(unsigned connid, const std::string &key, const std::string &value);
137
138 void AddSendQueue(unsigned connid, const std::string &msg);
139
140 Bool_t CheckDataToSend(unsigned connid = 0);
141
143
144 virtual Bool_t IsJSSupportedClass(TObject *obj, Bool_t many_primitives = kFALSE);
145
146 Bool_t IsFirstConn(unsigned connid) const { return (connid != 0) && (fWebConn.size() > 1) && (fWebConn[1].fConnId == connid); }
147
148 Bool_t IsFirstDrawn() const { return (fWebConn.size() > 1) && (fWebConn[1].fDrawVersion > 0); }
149
150 void ShowCmd(const std::string &arg, Bool_t show);
151
152 void AssignStatusBits(UInt_t bits);
153
154 virtual Bool_t ProcessData(unsigned connid, const std::string &arg);
155
156 virtual Bool_t DecodePadOptions(const std::string &, bool process_execs = false);
157
158 virtual Bool_t CanCreateObject(const std::string &) { return !IsReadOnly() && fCanCreateObjects; }
159
160 TPad *ProcessObjectOptions(TWebObjectOptions &item, TPad *pad, int idcnt = 1);
161
162 TObject *FindPrimitive(const std::string &id, int idcnt = 1, TPad *pad = nullptr, TObjLink **objlnk = nullptr, TPad **objpad = nullptr);
163
164 void ProcessExecs(TPad *pad, TExec *extra = nullptr);
165
166 void ProcessLinesForObject(TObject *obj, const std::string &lines);
167
168public:
169 TWebCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height, Bool_t readonly = kTRUE);
170 ~TWebCanvas() override;
171
172 void ShowWebWindow(const ROOT::RWebDisplayArgs &user_args = "");
173
174 const std::shared_ptr<ROOT::RWebWindow> &GetWebWindow() const { return fWindow; }
175
176 virtual Bool_t IsReadOnly() const { return fReadOnly; }
177
178 Int_t InitWindow() override;
179 void Close() override;
180 void Show() override;
181
183
184 void ShowMenuBar(Bool_t show = kTRUE) override { ShowCmd("Menu", show); }
185 void ShowStatusBar(Bool_t show = kTRUE) override { ShowCmd("StatusBar", show); }
186 void ShowEditor(Bool_t show = kTRUE) override { ShowCmd("Editor", show); }
187 void ShowToolBar(Bool_t show = kTRUE) override { ShowCmd("ToolBar", show); }
188 void ShowToolTips(Bool_t show = kTRUE) override { ShowCmd("ToolTips", show); }
189
190 // web-canvas specific methods
191
192 void ActivateInEditor(TPad *pad, TObject *obj);
193
194 void ForceUpdate() override;
195
196 void SetWindowPosition(Int_t x, Int_t y) override;
197 void SetWindowSize(UInt_t w, UInt_t h) override;
198 void SetWindowTitle(const char *newTitle) override;
199 void SetCanvasSize(UInt_t w, UInt_t h) override;
200 void Iconify() override;
201 void RaiseWindow() override;
202
203 /*
204 virtual void SetStatusText(const char *text = 0, Int_t partidx = 0);
205 virtual void ReallyDelete();
206 */
207
208 Bool_t HasEditor() const override;
209 Bool_t HasMenuBar() const override;
210 Bool_t HasStatusBar() const override;
211 Bool_t HasToolBar() const override { return kFALSE; }
212 Bool_t HasToolTips() const override;
213
219
222
225
228
231
234
235 void SetCustomScripts(const std::string &src);
236
237 void AddCustomClass(const std::string &clname, bool with_derived = false);
238 bool IsCustomClass(const TClass *cl) const;
239
241 Bool_t IsAsyncMode() const { return fAsyncMode; }
242
243 Bool_t IsFixedSize() const { return fFixedSize; }
244
245 static TString CreatePadJSON(TPad *pad, Int_t json_compression = 0, Bool_t batchmode = kFALSE);
246 static TString CreateCanvasJSON(TCanvas *c, Int_t json_compression = 0, Bool_t batchmode = kFALSE);
247 static Int_t StoreCanvasJSON(TCanvas *c, const char *filename, const char *option = "");
248
249 static bool ProduceImage(TPad *pad, const char *filename, Int_t width = 0, Int_t height = 0);
250
251 static bool ProduceImages(std::vector<TPad *> pads, const char *filename, Int_t width = 0, Int_t height = 0);
252
253 static TCanvasImp *NewCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height);
254
255 ClassDefOverride(TWebCanvas, 0) // Web-based implementation for TCanvasImp
256};
257
258#endif
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:101
unsigned int UInt_t
Definition RtypesCore.h:46
long long Long64_t
Definition RtypesCore.h:80
const Bool_t kTRUE
Definition RtypesCore.h:100
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
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 id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t width
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
char name[80]
Definition TGX11.cxx:110
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area).
Definition TCanvasImp.h:30
The Canvas class.
Definition TCanvas.h:23
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
TExec is a utility class that can be used to execute a C++ command when some event happens in a pad.
Definition TExec.h:26
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
The most important graphics class in the ROOT system.
Definition TPad.h:28
Basic string class.
Definition TString.h:139
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
Basic TCanvasImp ABI implementation for Web-based Graphics Provides painting of main ROOT classes in ...
Definition TWebCanvas.h:35
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.
Int_t GetPrimitivesMerge() const
Definition TWebCanvas.h:230
void AddCustomClass(const std::string &clname, bool with_derived=false)
Assign custom class.
static TString CreatePadJSON(TPad *pad, Int_t json_compression=0, Bool_t batchmode=kFALSE)
Create JSON painting output for given pad Produce JSON can be used for offline drawing with JSROOT.
Bool_t fTF1UseSave
! use save buffer for TF1/TF2, need when evaluation failed on client side
Definition TWebCanvas.h:108
void SetCanvasSize(UInt_t w, UInt_t h) override
Set canvas size of web canvas.
UInt_t fColorsHash
! last hash of colors/palette
Definition TWebCanvas.h:107
const std::shared_ptr< ROOT::RWebWindow > & GetWebWindow() const
Definition TWebCanvas.h:174
void ShowCmd(const std::string &arg, Bool_t show)
Function used to send command to browser to toggle menu, toolbar, editors, ...
Bool_t fCanCreateObjects
! indicates if canvas allowed to create extra objects for interactive painting
Definition TWebCanvas.h:100
Long64_t fColorsVersion
! current colors/palette version, checked every time when new snapshot created
Definition TWebCanvas.h:106
std::string fCustomScripts
! custom JavaScript code or URL on JavaScript files to load before start drawing
Definition TWebCanvas.h:98
virtual Bool_t IsReadOnly() const
Definition TWebCanvas.h:176
std::shared_ptr< ROOT::RWebWindow > fWindow
Definition TWebCanvas.h:88
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 AddCtrlMsg(unsigned connid, const std::string &key, const std::string &value)
Add control message for specified connection Same control message can be overwritten many time before...
void SetCustomScripts(const std::string &src)
Configures custom script for canvas.
ObjectSelectSignal_t fObjSelectSignal
! signal emitted when new object selected in the pad
Definition TWebCanvas.h:116
PadClickedSignal_t fPadClickedSignal
! signal emitted when simple mouse click performed on the pad
Definition TWebCanvas.h:114
void SetActivePadChangedHandler(PadSignal_t func)
Definition TWebCanvas.h:215
void SetLongerPolling(Bool_t on)
Definition TWebCanvas.h:232
UInt_t fStyleHash
! last hash of gStyle
Definition TWebCanvas.h:105
virtual Bool_t CanCreateObject(const std::string &)
Definition TWebCanvas.h:158
void ShowWebWindow(const ROOT::RWebDisplayArgs &user_args="")
Show canvas in specified place.
void SetStyleDelivery(Int_t val)
Definition TWebCanvas.h:223
Int_t fPrimitivesMerge
! number of PS primitives, which will be merged together
Definition TWebCanvas.h:96
void ShowToolTips(Bool_t show=kTRUE) override
Definition TWebCanvas.h:188
void SetAsyncMode(Bool_t on=kTRUE)
Definition TWebCanvas.h:240
std::function< void()> UpdatedSignal_t
Function type for signals, invoked when canvas drawing or update is completed.
Definition TWebCanvas.h:41
void Show() override
Show canvas in browser window.
Bool_t HasToolBar() const override
Definition TWebCanvas.h:211
Bool_t WaitWhenCanvasPainted(Long64_t ver)
Wait when specified version of canvas was painted and confirmed by browser.
Bool_t IsWeb() const override
Definition TWebCanvas.h:122
void ShowMenuBar(Bool_t show=kTRUE) override
Definition TWebCanvas.h:184
std::vector< std::string > fCustomClasses
! list of custom classes, which can be delivered as is to client
Definition TWebCanvas.h:99
Bool_t IsAsyncMode() const
Definition TWebCanvas.h:241
UInt_t CalculateColorsHash()
Calculate hash function for all colors and palette.
Bool_t HasStatusBar() const override
Returns kTRUE if web canvas has status bar.
Bool_t IsFixedSize() const
Definition TWebCanvas.h:243
void Close() override
Close web canvas - not implemented.
static bool ProduceImages(std::vector< TPad * > pads, const char *filename, Int_t width=0, Int_t height=0)
Create images for several pads using batch (headless) capability of Chrome or Firefox browsers Suppor...
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...
void RaiseWindow() override
Raise browser window.
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 SetPadDblClickedHandler(PadClickedSignal_t func)
Definition TWebCanvas.h:217
void ActivateInEditor(TPad *pad, TObject *obj)
Activate object in editor in web browser.
std::vector< WebConn > fWebConn
! connections
Definition TWebCanvas.h:83
PadSignal_t fActivePadChangedSignal
! signal emitted when active pad changed in the canvas
Definition TWebCanvas.h:113
Bool_t GetLongerPolling() const
Definition TWebCanvas.h:233
UInt_t fClientBits
! latest status bits from client like editor visible or not
Definition TWebCanvas.h:92
std::function< void(TPadWebSnapshot *)> PadPaintingReady_t
Function called when pad painting produced.
Definition TWebCanvas.h:55
Int_t fPaletteDelivery
! colors palette delivery 0:never, 1:once, 2:always, 3:per subpad
Definition TWebCanvas.h:95
void ShowToolBar(Bool_t show=kTRUE) override
Definition TWebCanvas.h:187
Bool_t fProcessingData
! flag used to prevent blocking methods when process data is invoked
Definition TWebCanvas.h:102
Bool_t HasToolTips() const override
Returns kTRUE if tooltips are activated in web canvas.
TWebCanvasTimer * fTimer
! timer to submit control messages
Definition TWebCanvas.h:84
Long64_t fCanvVersion
! actual canvas version, changed with every new Modified() call
Definition TWebCanvas.h:91
bool IsCustomClass(const TClass *cl) const
Checks if class belongs to custom.
std::vector< int > fWindowGeometry
! last received window geometry
Definition TWebCanvas.h:109
void SetPadClickedHandler(PadClickedSignal_t func)
Definition TWebCanvas.h:216
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.
Long64_t fStyleVersion
! current gStyle object version, checked every time when new snapshot created
Definition TWebCanvas.h:104
void SetUpdatedHandler(UpdatedSignal_t func)
Definition TWebCanvas.h:214
std::function< void(TPad *, int, int)> PadClickedSignal_t
Function type for pad-click signals.
Definition TWebCanvas.h:47
void AddSendQueue(unsigned connid, const std::string &msg)
Add message to send queue for specified connection If connid == 0, message will be add to all connect...
Bool_t fLongerPolling
! when true, make longer polling in blocking operations
Definition TWebCanvas.h:101
void ShowStatusBar(Bool_t show=kTRUE) override
Definition TWebCanvas.h:185
void Unlock() override
Definition TWebCanvas.h:119
void SetWindowPosition(Int_t x, Int_t y) override
Set window position of web canvas.
UpdatedSignal_t fUpdatedSignal
! signal emitted when canvas updated or state is changed
Definition TWebCanvas.h:112
Bool_t IsLocked() override
Definition TWebCanvas.h:120
Int_t fJsonComp
! compression factor for messages send to the client
Definition TWebCanvas.h:97
Bool_t IsFirstConn(unsigned connid) const
Definition TWebCanvas.h:146
~TWebCanvas() override
Destructor.
Bool_t fReadOnly
!< configured display
Definition TWebCanvas.h:90
std::map< TPad *, PadStatus > fPadsStatus
! map of pads in canvas and their status flags
Definition TWebCanvas.h:86
Bool_t fAsyncMode
! when true, methods like TCanvas::Update will never block
Definition TWebCanvas.h:103
void ShowEditor(Bool_t show=kTRUE) override
Definition TWebCanvas.h:186
Bool_t CheckDataToSend(unsigned connid=0)
Check if any data should be send to client If connid != 0, only selected connection will be checked.
Bool_t PerformUpdate(Bool_t async) override
if canvas or any subpad was modified, scan all primitives in the TCanvas and subpads and convert them...
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.
void ProcessLinesForObject(TObject *obj, const std::string &lines)
Execute one or several methods for selected object String can be separated by ";;" to let execute sev...
std::function< void(TPad *)> PadSignal_t
Function type for pad-related signals - like activate pad signal.
Definition TWebCanvas.h:44
void SetCanCreateObjects(Bool_t on=kTRUE)
Definition TWebCanvas.h:220
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() ...
void SetPrimitivesMerge(Int_t cnt)
Definition TWebCanvas.h:229
void Iconify() override
Iconify browser window.
void SetWindowTitle(const char *newTitle) override
Set window title of web canvas.
UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Returns window geometry including borders and menus.
void SetPaletteDelivery(Int_t val)
Definition TWebCanvas.h:226
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.
static TString CreateCanvasJSON(TCanvas *c, Int_t json_compression=0, Bool_t batchmode=kFALSE)
Create JSON painting output for given canvas Produce JSON can be used for offline drawing with JSROOT...
void SetObjSelectHandler(ObjectSelectSignal_t func)
Definition TWebCanvas.h:218
std::function< void(TPad *, TObject *)> ObjectSelectSignal_t
Function type for signals, invoked when object is selected.
Definition TWebCanvas.h:50
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
Definition TWebCanvas.h:94
PadClickedSignal_t fPadDblClickedSignal
! signal emitted when simple mouse click performed on the pad
Definition TWebCanvas.h:115
void ProcessExecs(TPad *pad, TExec *extra=nullptr)
Process TExec objects in the pad.
void Lock() override
Definition TWebCanvas.h:118
TList fPrimitivesLists
! list of lists of primitives, temporary collected during painting
Definition TWebCanvas.h:93
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 ...
Bool_t CheckCanvasModified(bool force_modified=false)
Check if any pad on the canvas was modified If yes, increment version of correspondent pad Returns tr...
Bool_t GetCanCreateObjects() const
Definition TWebCanvas.h:221
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
Definition TWebCanvas.h:227
Bool_t IsFirstDrawn() const
Definition TWebCanvas.h:148
void SetWindowSize(UInt_t w, UInt_t h) override
Set window size of web canvas.
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...
Bool_t fFixedSize
! is canvas size fixed
Definition TWebCanvas.h:110
Int_t GetStyleDelivery() const
Definition TWebCanvas.h:224
Class used to transport drawing options from the client.
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
bool _has_specials
! are there any special objects with painting
Definition TWebCanvas.h:80
Long64_t fVersion
! last pad version
Definition TWebCanvas.h:77
bool _modified
! if pad was modified during last scan
Definition TWebCanvas.h:79
bool _detected
! if pad was detected during last scan
Definition TWebCanvas.h:78
std::map< std::string, std::string > fCtrl
! different ctrl parameters which can be send at once
Definition TWebCanvas.h:63
std::queue< std::string > fSend
! send queue, processed after sending draw data
Definition TWebCanvas.h:64
UInt_t fLastSendHash
! hash of last send draw message, avoid looping
Definition TWebCanvas.h:62
WebConn(unsigned id)
Definition TWebCanvas.h:66
bool is_batch() const
Definition TWebCanvas.h:67
unsigned fConnId
! connection id
Definition TWebCanvas.h:58
bool match(unsigned id) const
Definition TWebCanvas.h:68
Long64_t fSendVersion
! canvas version send to the client
Definition TWebCanvas.h:60
Long64_t fCheckedVersion
! canvas version checked before sending
Definition TWebCanvas.h:59
Long64_t fDrawVersion
! canvas version drawn (confirmed) by client
Definition TWebCanvas.h:61