Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::RPadBase Class Referenceabstract

Base class for graphic containers for RDrawable-s.

Authors
Axel Naumann axel@.nosp@m.cern.nosp@m..ch Sergey Linev s.lin.nosp@m.ev@g.nosp@m.si.de
Date
2019-10-02
Warning
This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

Definition at line 37 of file RPadBase.hxx.

Classes

struct  BoundKindAndValue
 Simple struct representing an axis bound. More...
 

Public Types

using Primitives_t = std::vector< std::shared_ptr< RDrawable > >
 
- Public Types inherited from ROOT::Experimental::RDrawable
using Version_t = uint64_t
 

Public Member Functions

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 RPadBaseFindPadForPrimitiveWithDisplayId (const std::string &display_id) const
 Find subpad which contains primitive with given display id.
 
std::shared_ptr< RDrawableFindPrimitive (const std::string &id) const
 Find primitive with specified id.
 
std::shared_ptr< RDrawableFindPrimitiveByDisplayId (const std::string &display_id) const
 Find primitive with unique id, produce for RDisplayItem Such id used for client-server identification of objects.
 
RPadUserAxisBaseGetAxis (size_t dimension) const
 Get a pad axis from the RFrame.
 
virtual const RCanvasGetCanvas () const =0
 Access to the top-most canvas, if any (const version).
 
virtual RCanvasGetCanvas ()=0
 Access to the top-most canvas, if any (non-const version).
 
std::shared_ptr< RFrameGetFrame ()
 Get a frame object if exists.
 
const std::shared_ptr< RFrameGetFrame () const
 Get a frame object if exists.
 
RPadUserAxisBaseGetOrCreateAxis (size_t dimension)
 Get a pad axis from the RFrame.
 
std::shared_ptr< RFrameGetOrCreateFrame ()
 Get a frame object for the pad.
 
std::shared_ptr< RDrawableGetPrimitive (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
 
virtual std::array< RPadLength::Normal, 2 > PixelsToNormal (const std::array< RPadLength::Pixel, 2 > &pos) const =0
 Convert a Pixel position to Canvas-normalized positions.
 
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)
 

Protected Member Functions

 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< RDisplayItemDisplay (const RDisplayContext &)
 Creates display item for drawable By default item contains drawable data itself.
 
virtual void Execute (const std::string &)
 
RAttrMapGetAttrMap ()
 
const RAttrMapGetAttrMap () 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
 
RDrawableoperator= (const RDrawable &)=delete
 
virtual void PopulateMenu (RMenuItems &)
 

Private Types

using Primitive_t = Internal::RIOShared< RDrawable >
 

Private Member Functions

 RPadBase (const RPadBase &)=delete
 Disable copy construction.
 
RPadBaseoperator= (const RPadBase &)=delete
 Disable assignment.
 
void TestIfFrameRequired (const RDrawable *drawable)
 

Private Attributes

std::vector< Primitive_tfPrimitives
 Content of the pad.
 

#include <ROOT/RPadBase.hxx>

Inheritance diagram for ROOT::Experimental::RPadBase:
[legend]

Member Typedef Documentation

◆ Primitive_t

◆ Primitives_t

using ROOT::Experimental::RPadBase::Primitives_t = std::vector<std::shared_ptr<RDrawable> >

Definition at line 71 of file RPadBase.hxx.

Constructor & Destructor Documentation

◆ RPadBase() [1/2]

ROOT::Experimental::RPadBase::RPadBase ( const RPadBase )
privatedelete

Disable copy construction.

◆ RPadBase() [2/2]

ROOT::Experimental::RPadBase::RPadBase ( )
inlineprotected

Allow derived classes to default construct a RPadBase.

Definition at line 61 of file RPadBase.hxx.

◆ ~RPadBase()

ROOT::Experimental::RPadBase::~RPadBase ( )
virtualdefault

Member Function Documentation

◆ AssignAutoColors()

void ROOT::Experimental::RPadBase::AssignAutoColors ( )

Method collect existing colors and assign new values if required.

Definition at line 108 of file RPadBase.cxx.

◆ CollectShared()

void ROOT::Experimental::RPadBase::CollectShared ( Internal::RIOSharedVector_t vect)
overrideprotectedvirtual

Collect all shared items to resolve shared_ptr after IO.

Reimplemented from ROOT::Experimental::RDrawable.

Definition at line 332 of file RPadBase.cxx.

◆ DisplayPrimitives()

void ROOT::Experimental::RPadBase::DisplayPrimitives ( RPadBaseDisplayItem paditem,
RDisplayContext ctxt 
)
protected

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.

Definition at line 136 of file RPadBase.cxx.

◆ Divide()

std::vector< std::vector< std::shared_ptr< ROOT::Experimental::RPad > > > ROOT::Experimental::RPadBase::Divide ( int  nHoriz,
int  nVert,
const RPadExtent padding = {} 
)

Divide this pad into a grid of subpads with padding in between.

Divide pad on nHoriz X nVert subpads Return array of array of pads.

Parameters
nHorizNumber of horizontal pads.
nVertNumber of vertical pads.
paddingPadding between pads.
Returns
vector of vector (ret[x][y]) of created pads.

Definition at line 164 of file RPadBase.cxx.

◆ Draw() [1/3]

template<class T , class... ARGS>
auto ROOT::Experimental::RPadBase::Draw ( ARGS...  args)
inline

Create drawable of specified class T.

Definition at line 86 of file RPadBase.hxx.

◆ Draw() [2/3]

template<class T , class... ARGS>
auto ROOT::Experimental::RPadBase::Draw ( const std::shared_ptr< T > &  what,
ARGS...  args 
)
inline

Add object to be painted.

Correspondent drawable will be created via GetDrawable() function which should be defined and be accessed at calling time. If required, extra arguments for GetDrawable() function can be provided.

Definition at line 111 of file RPadBase.hxx.

◆ Draw() [3/3]

auto ROOT::Experimental::RPadBase::Draw ( std::shared_ptr< RDrawable > &&  drawable)
inline

Add existing drawable instance to canvas.

Definition at line 98 of file RPadBase.hxx.

◆ FindPadForPrimitiveWithDisplayId()

const ROOT::Experimental::RPadBase * ROOT::Experimental::RPadBase::FindPadForPrimitiveWithDisplayId ( const std::string &  display_id) const

Find subpad which contains primitive with given display id.

Definition at line 85 of file RPadBase.cxx.

◆ FindPrimitive()

std::shared_ptr< ROOT::Experimental::RDrawable > ROOT::Experimental::RPadBase::FindPrimitive ( const std::string &  id) const

Find primitive with specified id.

Definition at line 38 of file RPadBase.cxx.

◆ FindPrimitiveByDisplayId()

std::shared_ptr< ROOT::Experimental::RDrawable > ROOT::Experimental::RPadBase::FindPrimitiveByDisplayId ( const std::string &  display_id) const

Find primitive with unique id, produce for RDisplayItem Such id used for client-server identification of objects.

Definition at line 62 of file RPadBase.cxx.

◆ GetAxis()

ROOT::Experimental::RPadUserAxisBase * ROOT::Experimental::RPadBase::GetAxis ( size_t  dimension) const

Get a pad axis from the RFrame.

Parameters
dimension- Index of the dimension of the RFrame user coordinate system.

Definition at line 244 of file RPadBase.cxx.

◆ GetCanvas() [1/2]

virtual const RCanvas * ROOT::Experimental::RPadBase::GetCanvas ( ) const
pure virtual

Access to the top-most canvas, if any (const version).

Implemented in ROOT::Experimental::RCanvas, and ROOT::Experimental::RPad.

◆ GetCanvas() [2/2]

virtual RCanvas * ROOT::Experimental::RPadBase::GetCanvas ( )
pure virtual

Access to the top-most canvas, if any (non-const version).

Implemented in ROOT::Experimental::RCanvas, and ROOT::Experimental::RPad.

◆ GetFrame() [1/2]

std::shared_ptr< ROOT::Experimental::RFrame > ROOT::Experimental::RPadBase::GetFrame ( )

Get a frame object if exists.

Definition at line 229 of file RPadBase.cxx.

◆ GetFrame() [2/2]

const std::shared_ptr< ROOT::Experimental::RFrame > ROOT::Experimental::RPadBase::GetFrame ( ) const

Get a frame object if exists.

Definition at line 215 of file RPadBase.cxx.

◆ GetOrCreateAxis()

ROOT::Experimental::RPadUserAxisBase * ROOT::Experimental::RPadBase::GetOrCreateAxis ( size_t  dimension)

Get a pad axis from the RFrame.

Parameters
dimension- Index of the dimension of the RFrame user coordinate system.

Definition at line 257 of file RPadBase.cxx.

◆ GetOrCreateFrame()

std::shared_ptr< ROOT::Experimental::RFrame > ROOT::Experimental::RPadBase::GetOrCreateFrame ( )

Get a frame object for the pad.

If frame not exists - creates and add to the end of primitives list

Definition at line 201 of file RPadBase.cxx.

◆ GetPrimitive()

std::shared_ptr< RDrawable > ROOT::Experimental::RPadBase::GetPrimitive ( unsigned  num) const
inline

returns primitive of given number

Definition at line 127 of file RPadBase.hxx.

◆ GetPrimitives()

auto ROOT::Experimental::RPadBase::GetPrimitives ( ) const
inline

Get all primitives contained in the pad.

Definition at line 140 of file RPadBase.hxx.

◆ NumPrimitives()

unsigned ROOT::Experimental::RPadBase::NumPrimitives ( ) const
inline

returns number of primitives in the pad

Definition at line 124 of file RPadBase.hxx.

◆ operator=()

RPadBase & ROOT::Experimental::RPadBase::operator= ( const RPadBase )
privatedelete

Disable assignment.

◆ PixelsToNormal()

virtual std::array< RPadLength::Normal, 2 > ROOT::Experimental::RPadBase::PixelsToNormal ( const std::array< RPadLength::Pixel, 2 > &  pos) const
pure virtual

Convert a Pixel position to Canvas-normalized positions.

Implemented in ROOT::Experimental::RCanvas, and ROOT::Experimental::RPad.

◆ Remove() [1/2]

bool ROOT::Experimental::RPadBase::Remove ( const std::shared_ptr< RDrawable > &  drawable)
inline

Remove drawable from list of primitives.

Definition at line 161 of file RPadBase.hxx.

◆ Remove() [2/2]

bool ROOT::Experimental::RPadBase::Remove ( const std::string &  id)
inline

Remove an object from the list of primitives.

Definition at line 149 of file RPadBase.hxx.

◆ RemoveAt()

bool ROOT::Experimental::RPadBase::RemoveAt ( unsigned  indx)
inline

Remove drawable at specified position.

Definition at line 173 of file RPadBase.hxx.

◆ SetAllAxisAutoBounds()

void ROOT::Experimental::RPadBase::SetAllAxisAutoBounds ( )

Set the range of an axis as bound kind and bound (up or down).

Definition at line 344 of file RPadBase.cxx.

◆ SetAllAxisBound()

void ROOT::Experimental::RPadBase::SetAllAxisBound ( const std::vector< BoundKindAndValue > &  vecBoundAndKind)

Set the range of an axis as bound kind and bound (up or down).

Definition at line 313 of file RPadBase.cxx.

◆ SetAllAxisBounds()

void ROOT::Experimental::RPadBase::SetAllAxisBounds ( const std::vector< std::array< double, 2 > > &  vecBeginAndEnd)

Set the range of an axis as bound kind and bound (up or down).

Definition at line 294 of file RPadBase.cxx.

◆ SetAxisAutoBounds()

void ROOT::Experimental::RPadBase::SetAxisAutoBounds ( int  dimension)

Set the range of an axis as bound kind and bound (up or down).

Definition at line 285 of file RPadBase.cxx.

◆ SetAxisBound()

void ROOT::Experimental::RPadBase::SetAxisBound ( int  dimension,
RPadUserAxisBase::EAxisBoundsKind  boundsKind,
double  bound 
)

Set the range of an axis as bound kind and bound (up or down).

Definition at line 276 of file RPadBase.cxx.

◆ SetAxisBounds()

void ROOT::Experimental::RPadBase::SetAxisBounds ( int  dimension,
double  begin,
double  end 
)

Set the range of an axis as begin, end.

Definition at line 267 of file RPadBase.cxx.

◆ SetDrawableVersion()

void ROOT::Experimental::RPadBase::SetDrawableVersion ( Version_t  vers)
overrideprotectedvirtual

Assign drawable version - for pad itself and all primitives.

Reimplemented from ROOT::Experimental::RDrawable.

Definition at line 366 of file RPadBase.cxx.

◆ TestIfFrameRequired()

void ROOT::Experimental::RPadBase::TestIfFrameRequired ( const RDrawable drawable)
inlineprivate

Definition at line 53 of file RPadBase.hxx.

◆ UserToNormal()

std::array< ROOT::Experimental::RPadLength::Normal, 2 > ROOT::Experimental::RPadBase::UserToNormal ( const std::array< RPadLength::User, 2 > &  pos) const

Convert user coordinates to normal coordinates.

Definition at line 355 of file RPadBase.cxx.

◆ UseStyle()

void ROOT::Experimental::RPadBase::UseStyle ( const std::shared_ptr< RStyle > &  style)
overridevirtual

Use provided style for pad and all primitives inside.

Reimplemented from ROOT::Experimental::RDrawable.

Definition at line 28 of file RPadBase.cxx.

◆ Wipe()

void ROOT::Experimental::RPadBase::Wipe ( )
inline

Wipe the pad by clearing the list of primitives.

Definition at line 182 of file RPadBase.hxx.

Member Data Documentation

◆ fPrimitives

std::vector<Primitive_t> ROOT::Experimental::RPadBase::fPrimitives
private

Content of the pad.

Definition at line 45 of file RPadBase.hxx.

Libraries for ROOT::Experimental::RPadBase:

The documentation for this class was generated from the following files: