Basic TCanvasImp ABI implementation for Web-based GUI Provides painting of main ROOT6 classes in web browsers Major interactive features implemented in TWebCanvasFull class.
Definition at line 32 of file TWebCanvas.h.
Classes | |
struct | WebConn |
Public Types | |
using | ObjectSelectSignal_t = std::function< void(TPad *, TObject *)> |
Function type for signals, invoked when object is selected. More... | |
using | PadClickedSignal_t = std::function< void(TPad *, int, int)> |
Function type for pad-click signals. More... | |
using | PadSignal_t = std::function< void(TPad *)> |
Function type for pad-related signals - like activate pad signal. More... | |
using | UpdatedSignal_t = std::function< void()> |
Function type for signals, invoked when canvas drawing or update is completed. More... | |
Public Member Functions | |
TWebCanvas (TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height, Bool_t readonly=kTRUE) | |
Constructor. More... | |
virtual | ~TWebCanvas ()=default |
void | ActivateInEditor (TPad *pad, TObject *obj) |
Activate object in editor in web browser. More... | |
void | AddCustomClass (const std::string &clname, bool with_derived=false) |
Assign custom class. More... | |
void | Close () override |
Close web canvas - not implemented. More... | |
void | ForceUpdate () override |
Increment canvas version and force sending data to client - do not wait for reply. More... | |
Bool_t | GetCanCreateObjects () const |
Bool_t | GetLongerPolling () const |
Int_t | GetPaletteDelivery () const |
Int_t | GetPrimitivesMerge () const |
Int_t | GetStyleDelivery () const |
const std::shared_ptr< ROOT::Experimental::RWebWindow > & | GetWebWindow () const |
UInt_t | GetWindowGeometry (Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override |
Returns window geometry including borders and menus. More... | |
Bool_t | HasEditor () const override |
Returns kTRUE if web canvas has graphical editor. More... | |
Bool_t | HasMenuBar () const override |
Returns kTRUE if web canvas has menu bar. More... | |
Bool_t | HasStatusBar () const override |
Returns kTRUE if web canvas has status bar. More... | |
Bool_t | HasToolBar () const override |
Bool_t | HasToolTips () const override |
Returns kTRUE if tooltips are activated in web canvas. More... | |
Int_t | InitWindow () override |
Initialize window for the web canvas At this place canvas is not yet register to the list of canvases - one cannot call RWebWindow::Show() More... | |
TClass * | IsA () const override |
Bool_t | IsAsyncMode () const |
bool | IsCustomClass (const TClass *cl) const |
Checks if class belongs to custom. More... | |
virtual Bool_t | IsReadOnly () const |
void | SetActivePadChangedHandler (PadSignal_t func) |
void | SetAsyncMode (Bool_t on=kTRUE) |
void | SetCanCreateObjects (Bool_t on=kTRUE) |
void | SetCustomScripts (const std::string &src) |
Configures custom script for canvas. More... | |
void | SetLongerPolling (Bool_t on) |
void | SetObjSelectHandler (ObjectSelectSignal_t func) |
void | SetPadClickedHandler (PadClickedSignal_t func) |
void | SetPadDblClickedHandler (PadClickedSignal_t func) |
void | SetPaletteDelivery (Int_t val) |
void | SetPrimitivesMerge (Int_t cnt) |
void | SetStyleDelivery (Int_t val) |
void | SetUpdatedHandler (UpdatedSignal_t func) |
void | Show () override |
Show canvas in browser window. More... | |
void | ShowEditor (Bool_t show=kTRUE) override |
void | ShowMenuBar (Bool_t show=kTRUE) override |
void | ShowStatusBar (Bool_t show=kTRUE) override |
void | ShowToolBar (Bool_t show=kTRUE) override |
void | ShowToolTips (Bool_t show=kTRUE) override |
void | ShowWebWindow (const ROOT::Experimental::RWebDisplayArgs &user_args="") |
Show canvas in specified place. More... | |
void | Streamer (TBuffer &) override |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
![]() | |
TCanvasImp (TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height) | |
TCanvasImp (TCanvas *c, const char *name, UInt_t width, UInt_t height) | |
TCanvasImp (TCanvas *c=0) | |
virtual | ~TCanvasImp () |
TCanvas * | Canvas () const |
virtual void | Close () |
virtual void | ForceUpdate () |
virtual UInt_t | GetWindowGeometry (Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) |
virtual Bool_t | HasEditor () const |
virtual Bool_t | HasMenuBar () const |
virtual Bool_t | HasStatusBar () const |
virtual Bool_t | HasToolBar () const |
virtual Bool_t | HasToolTips () const |
virtual void | Iconify () |
virtual Int_t | InitWindow () |
virtual TClass * | IsA () const |
virtual void | RaiseWindow () |
virtual void | ReallyDelete () |
virtual void | SetCanvasSize (UInt_t w, UInt_t h) |
virtual void | SetStatusText (const char *text=nullptr, Int_t partidx=0) |
virtual void | SetWindowPosition (Int_t x, Int_t y) |
virtual void | SetWindowSize (UInt_t w, UInt_t h) |
virtual void | SetWindowTitle (const char *newTitle) |
virtual void | Show () |
virtual void | ShowEditor (Bool_t show=kTRUE) |
virtual void | ShowMenuBar (Bool_t show=kTRUE) |
virtual void | ShowStatusBar (Bool_t show=kTRUE) |
virtual void | ShowToolBar (Bool_t show=kTRUE) |
virtual void | ShowToolTips (Bool_t show=kTRUE) |
virtual void | Streamer (TBuffer &) |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
Static Public Member Functions | |
static TClass * | Class () |
static const char * | Class_Name () |
static Version_t | Class_Version () |
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. More... | |
static const char * | DeclFileName () |
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, svg, pdf formats. More... | |
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() method for more details. More... | |
![]() | |
static TClass * | Class () |
static const char * | Class_Name () |
static Version_t | Class_Version () |
static const char * | DeclFileName () |
Protected Types | |
using | PadPaintingReady_t = std::function< void(TPadWebSnapshot *)> |
Function called when pad painting produced. More... | |
Protected Member Functions | |
void | AddColorsPalette (TPadWebSnapshot &master) |
Add special canvas objects like colors list at selected palette. More... | |
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 connections Return kFALSE if queue is full or connection is not exists. More... | |
void | AssignStatusBits (UInt_t bits) |
Assign clients bits. More... | |
virtual Bool_t | CanCreateObject (const std::string &) |
void | CheckDataToSend (unsigned connid=0) |
Check if any data should be send to client If connid != 0, only selected connection will be checked. More... | |
Bool_t | CheckPadModified (TPad *pad, Int_t inc_version=1) |
Returns true if any pad in the canvas were modified Reset modified flags, increment canvas version (if inc_version is true) More... | |
void | CreateObjectSnapshot (TPadWebSnapshot &master, TPad *pad, TObject *obj, const char *opt, TWebPS *masterps=nullptr) |
Creates representation of the object for painting in web browser. More... | |
TVirtualPadPainter * | CreatePadPainter () override |
Creates web-based pad painter. More... | |
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 data processing - when all misc objects removed from canvas list of primitives or histogram list of functions After that objects are moved back to their places. More... | |
virtual Bool_t | DecodePadOptions (const std::string &) |
Decode all pad options, which includes ranges plus objects options. More... | |
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 start Also if object is in list of primitives, one could ask for entry link for such object, This can allow to change draw option. More... | |
Bool_t | IsFirstConn (unsigned connid) const |
virtual Bool_t | IsJSSupportedClass (TObject *obj) |
Returns kTRUE when object is fully supported on JSROOT side In ROOT7 Paint function will just return appropriate flag that object can be displayed on JSROOT side. More... | |
Bool_t | IsLocked () override |
Bool_t | IsWeb () const override |
void | Lock () override |
Bool_t | PerformUpdate () override |
if canvas or any subpad was modified, scan all primitives in the TCanvas and subpads and convert them into the structure which will be delivered to JSROOT client More... | |
virtual Bool_t | ProcessData (unsigned connid, const std::string &arg) |
Handle data from web browser Returns kFALSE if message was not processed. More... | |
TPad * | ProcessObjectOptions (TWebObjectOptions &item, TPad *pad) |
Process data for single primitive Returns object pad if object was modified. More... | |
void | ShowCmd (const std::string &arg, Bool_t show) |
Function used to send command to browser to toggle menu, toolbar, editors, ... More... | |
void | Unlock () override |
Bool_t | WaitWhenCanvasPainted (Long64_t ver) |
Wait when specified version of canvas was painted and confirmed by browser. More... | |
![]() | |
TCanvasImp (const TCanvasImp &ci) | |
virtual TVirtualPadPainter * | CreatePadPainter () |
virtual Bool_t | IsLocked () |
virtual Bool_t | IsWeb () const |
virtual void | Lock () |
TCanvasImp & | operator= (const TCanvasImp &ci) |
virtual Bool_t | PerformUpdate () |
virtual void | Unlock () |
Protected Attributes | |
PadSignal_t | fActivePadChangedSignal |
! signal emitted when active pad changed in the canvas More... | |
Bool_t | fAsyncMode {kFALSE} |
! when true, methods like TCanvas::Update will never block More... | |
Bool_t | fCanCreateObjects {kTRUE} |
! indicates if canvas allowed to create extra objects for interactive painting More... | |
Long64_t | fCanvVersion {1} |
! actual canvas version, changed with every new Modified() call More... | |
UInt_t | fClientBits {0} |
! latest status bits from client like editor visible or not More... | |
std::vector< std::string > | fCustomClasses |
! list of custom classes, which can be delivered as is to client More... | |
std::string | fCustomScripts |
! custom JavaScript code or URL on JavaScript files to load before start drawing More... | |
Bool_t | fHasSpecials {false} |
! has special objects which may require pad ranges More... | |
Int_t | fJsonComp {0} |
! compression factor for messages send to the client More... | |
Bool_t | fLongerPolling {kFALSE} |
! when true, make longer polling in blocking operations More... | |
ObjectSelectSignal_t | fObjSelectSignal |
! signal emitted when new object selected in the pad More... | |
PadClickedSignal_t | fPadClickedSignal |
! signal emitted when simple mouse click performed on the pad More... | |
PadClickedSignal_t | fPadDblClickedSignal |
! signal emitted when simple mouse click performed on the pad More... | |
Int_t | fPaletteDelivery {1} |
! colors palette delivery 0:never, 1:once, 2:always, 3:per subpad More... | |
TList | fPrimitivesLists |
! list of lists of primitives, temporary collected during painting More... | |
Int_t | fPrimitivesMerge {100} |
! number of PS primitives, which will be merged together More... | |
Bool_t | fProcessingData {kFALSE} |
! flag used to prevent blocking methods when process data is invoked More... | |
Bool_t | fReadOnly {true} |
!< configured display More... | |
Int_t | fStyleDelivery {0} |
! gStyle delivery to clients: 0:never, 1:once, 2:always More... | |
UpdatedSignal_t | fUpdatedSignal |
! signal emitted when canvas updated or state is changed More... | |
std::vector< WebConn > | fWebConn |
! connections More... | |
std::shared_ptr< ROOT::Experimental::RWebWindow > | fWindow |
![]() | |
TCanvas * | fCanvas |
#include <TWebCanvas.h>
using TWebCanvas::ObjectSelectSignal_t = std::function<void(TPad *, TObject *)> |
Function type for signals, invoked when object is selected.
Definition at line 45 of file TWebCanvas.h.
using TWebCanvas::PadClickedSignal_t = std::function<void(TPad *, int, int)> |
Function type for pad-click signals.
Definition at line 42 of file TWebCanvas.h.
|
protected |
Function called when pad painting produced.
Definition at line 50 of file TWebCanvas.h.
using TWebCanvas::PadSignal_t = std::function<void(TPad *)> |
Function type for pad-related signals - like activate pad signal.
Definition at line 39 of file TWebCanvas.h.
using TWebCanvas::UpdatedSignal_t = std::function<void()> |
Function type for signals, invoked when canvas drawing or update is completed.
Definition at line 36 of file TWebCanvas.h.
TWebCanvas::TWebCanvas | ( | TCanvas * | c, |
const char * | name, | ||
Int_t | x, | ||
Int_t | y, | ||
UInt_t | width, | ||
UInt_t | height, | ||
Bool_t | readonly = kTRUE |
||
) |
Constructor.
Definition at line 61 of file TWebCanvas.cxx.
|
virtualdefault |
Activate object in editor in web browser.
Definition at line 669 of file TWebCanvas.cxx.
|
protected |
Add special canvas objects like colors list at selected palette.
Definition at line 246 of file TWebCanvas.cxx.
void TWebCanvas::AddCustomClass | ( | const std::string & | clname, |
bool | with_derived = false |
||
) |
Assign custom class.
Definition at line 161 of file TWebCanvas.cxx.
|
protected |
Add message to send queue for specified connection If connid == 0, message will be add to all connections Return kFALSE if queue is full or connection is not exists.
Definition at line 528 of file TWebCanvas.cxx.
|
protected |
Assign clients bits.
Definition at line 714 of file TWebCanvas.cxx.
|
inlineprotectedvirtual |
Definition at line 118 of file TWebCanvas.h.
|
protected |
Check if any data should be send to client If connid != 0, only selected connection will be checked.
Definition at line 545 of file TWebCanvas.cxx.
Returns true if any pad in the canvas were modified Reset modified flags, increment canvas version (if inc_version is true)
Definition at line 1097 of file TWebCanvas.cxx.
|
static |
|
inlinestatic |
Definition at line 205 of file TWebCanvas.h.
|
overridevirtual |
Close web canvas - not implemented.
Reimplemented from TCanvasImp.
Definition at line 593 of file TWebCanvas.cxx.
Create JSON painting output for given canvas Produce JSON can be used for offline drawing with JSROOT.
Definition at line 1200 of file TWebCanvas.cxx.
|
protected |
Creates representation of the object for painting in web browser.
Definition at line 188 of file TWebCanvas.cxx.
|
overrideprotectedvirtual |
Creates web-based pad painter.
Reimplemented from TCanvasImp.
Definition at line 83 of file TWebCanvas.cxx.
|
protected |
Create snapshot for pad and all primitives Callback function is used to create JSON in the middle of data processing - when all misc objects removed from canvas list of primitives or histogram list of functions After that objects are moved back to their places.
Definition at line 283 of file TWebCanvas.cxx.
|
inlinestatic |
Definition at line 205 of file TWebCanvas.h.
|
protectedvirtual |
Decode all pad options, which includes ranges plus objects options.
Definition at line 726 of file TWebCanvas.cxx.
|
protected |
Search of object with given id in list of primitives One could specify pad where search could be start Also if object is in list of primitives, one could ask for entry link for such object, This can allow to change draw option.
Definition at line 1350 of file TWebCanvas.cxx.
|
overridevirtual |
Increment canvas version and force sending data to client - do not wait for reply.
Reimplemented from TCanvasImp.
Definition at line 1151 of file TWebCanvas.cxx.
|
inline |
Definition at line 178 of file TWebCanvas.h.
|
inline |
Definition at line 190 of file TWebCanvas.h.
|
inline |
Definition at line 184 of file TWebCanvas.h.
|
inline |
Definition at line 187 of file TWebCanvas.h.
|
inline |
Definition at line 181 of file TWebCanvas.h.
|
inline |
Definition at line 130 of file TWebCanvas.h.
|
overridevirtual |
Returns window geometry including borders and menus.
Reimplemented from TCanvasImp.
Definition at line 1122 of file TWebCanvas.cxx.
|
overridevirtual |
Returns kTRUE if web canvas has graphical editor.
Reimplemented from TCanvasImp.
Definition at line 682 of file TWebCanvas.cxx.
|
overridevirtual |
Returns kTRUE if web canvas has menu bar.
Reimplemented from TCanvasImp.
Definition at line 690 of file TWebCanvas.cxx.
|
overridevirtual |
Returns kTRUE if web canvas has status bar.
Reimplemented from TCanvasImp.
Definition at line 698 of file TWebCanvas.cxx.
|
inlineoverridevirtual |
Reimplemented from TCanvasImp.
Definition at line 168 of file TWebCanvas.h.
|
overridevirtual |
Returns kTRUE if tooltips are activated in web canvas.
Reimplemented from TCanvasImp.
Definition at line 706 of file TWebCanvas.cxx.
|
overridevirtual |
Initialize window for the web canvas At this place canvas is not yet register to the list of canvases - one cannot call RWebWindow::Show()
Reimplemented from TCanvasImp.
Definition at line 75 of file TWebCanvas.cxx.
|
inlineoverridevirtual |
Reimplemented from TCanvasImp.
Definition at line 205 of file TWebCanvas.h.
|
inline |
Definition at line 198 of file TWebCanvas.h.
Checks if class belongs to custom.
Definition at line 172 of file TWebCanvas.cxx.
|
inlineprotected |
Definition at line 108 of file TWebCanvas.h.
Returns kTRUE when object is fully supported on JSROOT side In ROOT7 Paint function will just return appropriate flag that object can be displayed on JSROOT side.
Definition at line 92 of file TWebCanvas.cxx.
|
inlineoverrideprotectedvirtual |
Reimplemented from TCanvasImp.
Definition at line 88 of file TWebCanvas.h.
|
inlinevirtual |
Definition at line 132 of file TWebCanvas.h.
|
inlineoverrideprotectedvirtual |
Reimplemented from TCanvasImp.
Definition at line 90 of file TWebCanvas.h.
|
inlineoverrideprotectedvirtual |
Reimplemented from TCanvasImp.
Definition at line 86 of file TWebCanvas.h.
|
overrideprotectedvirtual |
if canvas or any subpad was modified, scan all primitives in the TCanvas and subpads and convert them into the structure which will be delivered to JSROOT client
Reimplemented from TCanvasImp.
Definition at line 1136 of file TWebCanvas.cxx.
|
protectedvirtual |
Handle data from web browser Returns kFALSE if message was not processed.
Definition at line 838 of file TWebCanvas.cxx.
|
protected |
Process data for single primitive Returns object pad if object was modified.
Definition at line 1272 of file TWebCanvas.cxx.
|
static |
Create image using batch (headless) capability of Chrome browser Supported png, jpeg, svg, pdf formats.
Definition at line 1256 of file TWebCanvas.cxx.
|
inline |
Definition at line 172 of file TWebCanvas.h.
Definition at line 197 of file TWebCanvas.h.
Definition at line 177 of file TWebCanvas.h.
void TWebCanvas::SetCustomScripts | ( | const std::string & | src | ) |
Configures custom script for canvas.
If started from "load:" or "assert:" prefix will be loaded with JSROOT.AssertPrerequisites function Script should implement custom user classes, which transferred as is to client In the script draw handler for appropriate classes would be assigned
Definition at line 153 of file TWebCanvas.cxx.
|
inline |
Definition at line 189 of file TWebCanvas.h.
|
inline |
Definition at line 175 of file TWebCanvas.h.
|
inline |
Definition at line 173 of file TWebCanvas.h.
|
inline |
Definition at line 174 of file TWebCanvas.h.
|
inline |
Definition at line 183 of file TWebCanvas.h.
|
inline |
Definition at line 186 of file TWebCanvas.h.
|
inline |
Definition at line 180 of file TWebCanvas.h.
|
inline |
Definition at line 171 of file TWebCanvas.h.
|
overridevirtual |
Show canvas in browser window.
Reimplemented from TCanvasImp.
Definition at line 650 of file TWebCanvas.cxx.
|
protected |
Function used to send command to browser to toggle menu, toolbar, editors, ...
Definition at line 660 of file TWebCanvas.cxx.
Reimplemented from TCanvasImp.
Definition at line 142 of file TWebCanvas.h.
Reimplemented from TCanvasImp.
Definition at line 140 of file TWebCanvas.h.
Reimplemented from TCanvasImp.
Definition at line 141 of file TWebCanvas.h.
Reimplemented from TCanvasImp.
Definition at line 143 of file TWebCanvas.h.
Reimplemented from TCanvasImp.
Definition at line 144 of file TWebCanvas.h.
void TWebCanvas::ShowWebWindow | ( | const ROOT::Experimental::RWebDisplayArgs & | args = "" | ) |
Show canvas in specified place.
If parameter args not specified, default ROOT web display will be used
Definition at line 601 of file TWebCanvas.cxx.
|
static |
Create JSON painting output for given canvas and store into the file See TBufferJSON::ExportToFile() method for more details.
Definition at line 1228 of file TWebCanvas.cxx.
|
overridevirtual |
Reimplemented from TCanvasImp.
|
inline |
Definition at line 205 of file TWebCanvas.h.
|
inlineoverrideprotectedvirtual |
Reimplemented from TCanvasImp.
Definition at line 87 of file TWebCanvas.h.
Wait when specified version of canvas was painted and confirmed by browser.
Definition at line 1161 of file TWebCanvas.cxx.
|
protected |
! signal emitted when active pad changed in the canvas
Definition at line 81 of file TWebCanvas.h.
! when true, methods like TCanvas::Update will never block
Definition at line 78 of file TWebCanvas.h.
! indicates if canvas allowed to create extra objects for interactive painting
Definition at line 75 of file TWebCanvas.h.
|
protected |
! actual canvas version, changed with every new Modified() call
Definition at line 66 of file TWebCanvas.h.
|
protected |
! latest status bits from client like editor visible or not
Definition at line 67 of file TWebCanvas.h.
|
protected |
! list of custom classes, which can be delivered as is to client
Definition at line 74 of file TWebCanvas.h.
|
protected |
! custom JavaScript code or URL on JavaScript files to load before start drawing
Definition at line 73 of file TWebCanvas.h.
|
protected |
! has special objects which may require pad ranges
Definition at line 65 of file TWebCanvas.h.
|
protected |
! compression factor for messages send to the client
Definition at line 72 of file TWebCanvas.h.
! when true, make longer polling in blocking operations
Definition at line 76 of file TWebCanvas.h.
|
protected |
! signal emitted when new object selected in the pad
Definition at line 84 of file TWebCanvas.h.
|
protected |
! signal emitted when simple mouse click performed on the pad
Definition at line 82 of file TWebCanvas.h.
|
protected |
! signal emitted when simple mouse click performed on the pad
Definition at line 83 of file TWebCanvas.h.
|
protected |
! colors palette delivery 0:never, 1:once, 2:always, 3:per subpad
Definition at line 70 of file TWebCanvas.h.
|
protected |
! list of lists of primitives, temporary collected during painting
Definition at line 68 of file TWebCanvas.h.
|
protected |
! number of PS primitives, which will be merged together
Definition at line 71 of file TWebCanvas.h.
! flag used to prevent blocking methods when process data is invoked
Definition at line 77 of file TWebCanvas.h.
|
protected |
!< configured display
! in read-only mode canvas cannot be changed from client side
Definition at line 64 of file TWebCanvas.h.
|
protected |
! gStyle delivery to clients: 0:never, 1:once, 2:always
Definition at line 69 of file TWebCanvas.h.
|
protected |
! signal emitted when canvas updated or state is changed
Definition at line 80 of file TWebCanvas.h.
|
protected |
! connections
Definition at line 60 of file TWebCanvas.h.
|
protected |
Definition at line 62 of file TWebCanvas.h.