A window's topmost RPad
.
Definition at line 47 of file RCanvas.hxx.
Public Member Functions | |
RCanvas ()=default | |
Create a temporary RCanvas; for long-lived ones please use Create(). | |
~RCanvas ()=default | |
template<class PANEL > | |
bool | AddPanel (std::shared_ptr< PANEL > &panel) |
Insert panel into the canvas, canvas should be shown at this moment. | |
const RCanvas * | GetCanvas () const override |
Access to the top-most canvas, if any (const version). | |
RCanvas * | GetCanvas () override |
Access to the top-most canvas, if any (non-const version). | |
uint64_t | GetModified () const |
const std::array< RPadLength::Pixel, 2 > & | GetSize () const |
Return canvas pixel size as array with two elements - width and height. | |
const std::string & | GetTitle () const |
Get the canvas's title. | |
std::string | GetWindowAddr () const |
Returns window name used to display canvas. | |
void | Hide () |
Hide all canvas displays. | |
bool | IsModified () const |
Returns true is canvas was modified since last painting. | |
void | Modified () |
std::array< RPadLength::Normal, 2 > | PixelsToNormal (const std::array< RPadLength::Pixel, 2 > &pos) const final |
Convert a Pixel position to Canvas-normalized positions. | |
void | Remove () |
Remove canvas from global canvas lists, will be destroyed when shared_ptr will be removed. | |
void | ResolveSharedPtrs () |
To resolve problem with storing of shared pointers Call this method when reading canvas from the file Can be called many times - after reinitialization of shared pointers no changes will be performed. | |
void | Run (double tm=0.) |
Run canvas functionality for given time (in seconds) | |
bool | SaveAs (const std::string &filename) |
Save canvas in image file. | |
RCanvas & | SetSize (const RPadLength::Pixel &width, const RPadLength::Pixel &height) |
Set canvas pixel size - width and height. | |
RCanvas & | SetSize (const std::array< RPadLength::Pixel, 2 > &sz) |
Set canvas pixel size as array with two elements - width and height. | |
RCanvas & | SetTitle (const std::string &title) |
Set the canvas's title. | |
void | Show (const std::string &where="") |
Display the canvas. | |
void | Update (bool async=false, CanvasCallback_t callback=nullptr) |
update drawing | |
Public Member Functions inherited from ROOT::Experimental::RPadBase | |
virtual | ~RPadBase () |
void | AssignAutoColors () |
Method collect existing colors and assign new values if required. | |
std::vector< std::vector< std::shared_ptr< RPad > > > | Divide (int nHoriz, int nVert, const RPadExtent &padding={}) |
Divide this pad into a grid of subpads with padding in between. | |
template<class T , class... ARGS> | |
auto | Draw (ARGS... args) |
Create drawable of specified class T. | |
template<class T , class... ARGS> | |
auto | Draw (const std::shared_ptr< T > &what, ARGS... args) |
Add object to be painted. | |
auto | Draw (std::shared_ptr< RDrawable > &&drawable) |
Add existing drawable instance to canvas. | |
const RPadBase * | FindPadForPrimitiveWithDisplayId (const std::string &display_id) const |
Find subpad which contains primitive with given display id. | |
std::shared_ptr< RDrawable > | FindPrimitive (const std::string &id) const |
Find primitive with specified id. | |
std::shared_ptr< RDrawable > | FindPrimitiveByDisplayId (const std::string &display_id) const |
Find primitive with unique id, produce for RDisplayItem Such id used for client-server identification of objects. | |
RPadUserAxisBase * | GetAxis (size_t dimension) const |
Get a pad axis from the RFrame. | |
std::shared_ptr< RFrame > | GetFrame () |
Get a frame object if exists. | |
const std::shared_ptr< RFrame > | GetFrame () const |
Get a frame object if exists. | |
RPadUserAxisBase * | GetOrCreateAxis (size_t dimension) |
Get a pad axis from the RFrame. | |
std::shared_ptr< RFrame > | GetOrCreateFrame () |
Get a frame object for the pad. | |
std::shared_ptr< RDrawable > | GetPrimitive (unsigned num) const |
returns primitive of given number | |
auto | GetPrimitives () const |
Get all primitives contained in the pad. | |
unsigned | NumPrimitives () const |
returns number of primitives in the pad | |
bool | Remove (const std::shared_ptr< RDrawable > &drawable) |
Remove drawable from list of primitives. | |
bool | Remove (const std::string &id) |
Remove an object from the list of primitives. | |
bool | RemoveAt (unsigned indx) |
Remove drawable at specified position. | |
void | SetAllAxisAutoBounds () |
Set the range of an axis as bound kind and bound (up or down). | |
void | SetAllAxisBound (const std::vector< BoundKindAndValue > &vecBoundAndKind) |
Set the range of an axis as bound kind and bound (up or down). | |
void | SetAllAxisBounds (const std::vector< std::array< double, 2 > > &vecBeginAndEnd) |
Set the range of an axis as bound kind and bound (up or down). | |
void | SetAxisAutoBounds (int dimension) |
Set the range of an axis as bound kind and bound (up or down). | |
void | SetAxisBound (int dimension, RPadUserAxisBase::EAxisBoundsKind boundsKind, double bound) |
Set the range of an axis as bound kind and bound (up or down). | |
void | SetAxisBounds (int dimension, double begin, double end) |
Set the range of an axis as begin, end. | |
std::array< RPadLength::Normal, 2 > | UserToNormal (const std::array< RPadLength::User, 2 > &pos) const |
Convert user coordinates to normal coordinates. | |
void | UseStyle (const std::shared_ptr< RStyle > &style) override |
Use provided style for pad and all primitives inside. | |
void | Wipe () |
Wipe the pad by clearing the list of primitives. | |
Public Member Functions inherited from ROOT::Experimental::RDrawable | |
RDrawable (const std::string &type) | |
virtual | ~RDrawable () |
void | ClearStyle () |
const std::string & | GetCssClass () const |
const std::string & | GetCssType () const |
const std::string & | GetId () const |
void | SetCssClass (const std::string &cl) |
void | SetId (const std::string &id) |
Static Public Member Functions | |
static std::shared_ptr< RCanvas > | Create (const std::string &title) |
Create new canvas instance. | |
static const std::vector< std::shared_ptr< RCanvas > > | GetCanvases () |
Returns list of created canvases. | |
static void | ReleaseHeldCanvases () |
Release list of held canvases pointers If no other shared pointers exists on the canvas, object will be destroyed. | |
Private Member Functions | |
RCanvas (const RCanvas &)=delete | |
Disable copy construction for now. | |
uint64_t | IncModified () |
RCanvas & | operator= (const RCanvas &)=delete |
Disable assignment for now. | |
Private Attributes | |
Version_t | fModified {1} |
Modify counter, incremented every time canvas is changed. | |
std::unique_ptr< Internal::RVirtualCanvasPainter > | fPainter |
The painter of this canvas, bootstrapping the graphics connection. | |
std::array< RPadLength::Pixel, 2 > | fSize |
Size of the canvas in pixels,. | |
std::string | fTitle |
to apply attributes changes | |
Friends | |
class | RCanvasPainter |
use for ID generation | |
class | RChangeAttrRequest |
used for primitives drawing | |
class | RPadBase |
Additional Inherited Members | |
Public Types inherited from ROOT::Experimental::RPadBase | |
using | Primitives_t = std::vector< std::shared_ptr< RDrawable > > |
Public Types inherited from ROOT::Experimental::RDrawable | |
using | Version_t = uint64_t |
Protected Member Functions inherited from ROOT::Experimental::RPadBase | |
RPadBase () | |
Allow derived classes to default construct a RPadBase. | |
void | CollectShared (Internal::RIOSharedVector_t &) override |
Collect all shared items to resolve shared_ptr after IO. | |
void | DisplayPrimitives (RPadBaseDisplayItem &paditem, RDisplayContext &ctxt) |
Create display items for all primitives in the pad Each display item gets its special id, which used later for client-server communication Second parameter is version id which already delivered to the client. | |
void | SetDrawableVersion (Version_t vers) override |
Assign drawable version - for pad itself and all primitives. | |
Protected Member Functions inherited from ROOT::Experimental::RDrawable | |
RDrawable (const RDrawable &)=delete | |
virtual std::unique_ptr< RDisplayItem > | Display (const RDisplayContext &) |
Creates display item for drawable By default item contains drawable data itself. | |
virtual void | Execute (const std::string &) |
RAttrMap & | GetAttrMap () |
const RAttrMap & | GetAttrMap () const |
Version_t | GetVersion () const |
virtual bool | IsFrameRequired () const |
bool | MatchSelector (const std::string &selector) const |
Preliminary method which checks if drawable matches with given selector Following selector are allowed: "type" or "#id" or ".class_name" Here type is drawable kind like 'rect' or 'pad' id is drawable identifier, specified with RDrawable::SetId() method class_name is drawable class name, specified with RDrawable::SetCssClass() method. | |
virtual void | OnDisplayItemDestroyed (RDisplayItem *) const |
RDrawable & | operator= (const RDrawable &)=delete |
virtual void | PopulateMenu (RMenuItems &) |
#include <ROOT/RCanvas.hxx>
|
privatedelete |
Disable copy construction for now.
|
default |
|
default |
|
inline |
Insert panel into the canvas, canvas should be shown at this moment.
Definition at line 120 of file RCanvas.hxx.
|
static |
Create new canvas instance.
Definition at line 103 of file RCanvas.cxx.
|
inlineoverridevirtual |
Access to the top-most canvas, if any (const version).
Implements ROOT::Experimental::RPadBase.
Definition at line 83 of file RCanvas.hxx.
|
inlineoverridevirtual |
Access to the top-most canvas, if any (non-const version).
Implements ROOT::Experimental::RPadBase.
Definition at line 86 of file RCanvas.hxx.
|
static |
Returns list of created canvases.
Definition at line 44 of file RCanvas.cxx.
|
inline |
Definition at line 127 of file RCanvas.hxx.
|
inline |
Return canvas pixel size as array with two elements - width and height.
Definition at line 89 of file RCanvas.hxx.
|
inline |
Get the canvas's title.
Definition at line 145 of file RCanvas.hxx.
std::string ROOT::Experimental::RCanvas::GetWindowAddr | ( | ) | const |
Returns window name used to display canvas.
Returns window name for canvas.
Definition at line 162 of file RCanvas.cxx.
void ROOT::Experimental::RCanvas::Hide | ( | ) |
Hide all canvas displays.
Definition at line 174 of file RCanvas.cxx.
|
inlineprivate |
Definition at line 73 of file RCanvas.hxx.
bool ROOT::Experimental::RCanvas::IsModified | ( | ) | const |
Returns true is canvas was modified since last painting.
Definition at line 69 of file RCanvas.cxx.
|
inline |
Definition at line 130 of file RCanvas.hxx.
Disable assignment for now.
|
inlinefinalvirtual |
Convert a Pixel
position to Canvas-normalized positions.
Implements ROOT::Experimental::RPadBase.
Definition at line 157 of file RCanvas.hxx.
|
static |
Release list of held canvases pointers If no other shared pointers exists on the canvas, object will be destroyed.
Definition at line 55 of file RCanvas.cxx.
void ROOT::Experimental::RCanvas::Remove | ( | ) |
Remove canvas from global canvas lists, will be destroyed when shared_ptr will be removed.
Remove canvas from global canvas lists, will be destroyed once last shared_ptr is disappear.
Definition at line 201 of file RCanvas.cxx.
void ROOT::Experimental::RCanvas::ResolveSharedPtrs | ( | ) |
To resolve problem with storing of shared pointers Call this method when reading canvas from the file Can be called many times - after reinitialization of shared pointers no changes will be performed.
Definition at line 266 of file RCanvas.cxx.
Run canvas functionality for given time (in seconds)
Run canvas functionality for the given time (in seconds) Used to process canvas-related actions in the appropriate thread context.
Must be regularly called when canvas created and used in extra thread. Time parameter specifies minimal execution time in seconds - if default value 0 is used, just all pending actions will be performed. When canvas is not yet displayed - just performs sleep for given time interval.
Example of usage:
Definition at line 252 of file RCanvas.cxx.
bool ROOT::Experimental::RCanvas::SaveAs | ( | const std::string & | filename | ) |
Save canvas in image file.
Create image file for the canvas Supported SVG (extension .svg), JPEG (extension .jpg or .jpeg) and PNG (extension .png)
Definition at line 184 of file RCanvas.cxx.
|
inline |
Set canvas pixel size - width and height.
Definition at line 99 of file RCanvas.hxx.
|
inline |
Set canvas pixel size as array with two elements - width and height.
Definition at line 92 of file RCanvas.hxx.
|
inline |
Set the canvas's title.
Definition at line 148 of file RCanvas.hxx.
void ROOT::Experimental::RCanvas::Show | ( | const std::string & | where = "" | ) |
Display the canvas.
Create new display for the canvas The parameter where
specifies which program could be used for display creation Possible values:
cef
Chromium Embeded Framework, local display, local communicationqt5
Qt5 WebEngine (when running via rootqt5), local display, local communicationbrowser
default system web-browser, communication via random http port from range 8800 - 9800<prog>
any program name which will be started instead of default browser, like firefox or /usr/bin/opera one could also specify $url in program name, which will be replaced with canvas URLnative
either any available local display or default browserCanvas can be displayed in several different places
Definition at line 136 of file RCanvas.cxx.
void ROOT::Experimental::RCanvas::Update | ( | bool | async = false , |
CanvasCallback_t | callback = nullptr |
||
) |
|
friend |
use for ID generation
Definition at line 49 of file RCanvas.hxx.
|
friend |
used for primitives drawing
Definition at line 50 of file RCanvas.hxx.
|
friend |
Definition at line 48 of file RCanvas.hxx.
|
private |
Modify counter, incremented every time canvas is changed.
!
Definition at line 59 of file RCanvas.hxx.
|
private |
The painter of this canvas, bootstrapping the graphics connection.
Unmapped canvases (those that never had Draw()
invoked) might not have a painter. !
Definition at line 64 of file RCanvas.hxx.
|
private |
Size of the canvas in pixels,.
Definition at line 56 of file RCanvas.hxx.
|
private |