Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
ROOT::Experimental::TObjectDrawable Class Referencefinal

Provides v7 drawing facilities for TObject types (TGraph, TH1, TH2, etc).

Author
Sergey Linev
Date
2017-05-31
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 TObjectDrawable.hxx.

Public Types

enum  EKind { kColors = 4 , kStyle = 5 , kPalette = 6 }
using Version_t = uint64_t

Public Member Functions

 TObjectDrawable ()
 Default constructor.
 TObjectDrawable (const std::shared_ptr< TObject > &obj)
 Constructor.
 TObjectDrawable (const std::shared_ptr< TObject > &obj, const std::string &opt)
 Constructor.
 TObjectDrawable (EKind kind, bool persistent=false)
 Creates special kind for for palette or list of colors One can create persistent, which does not updated to actual values.
 TObjectDrawable (TObject *obj, bool isowner=false)
 Constructor, can take ownership over the object is isowner specified.
 TObjectDrawable (TObject *obj, const std::string &opt, bool isowner=false)
 Constructor, can take ownership over the object is isowner specified.
 ~TObjectDrawable () override
 Destructor.
void ClearStyle ()
const TObjectGet ()
 Return assigned object.
const std::string & GetCssClass () const
const char * GetCssType () const
const std::string & GetId () const
void Reset ()
 Reset object.
void Set (TObject *obj, bool isowner=false)
 Set object.
void Set (TObject *obj, const std::string &opt, bool isowner=false)
 Set object.
void SetCssClass (const std::string &cl)
void SetId (const std::string &id)
virtual void UseStyle (const std::shared_ptr< RStyle > &style)

Public Attributes

RAttrFill fill {this, "fill"}
 ! object fill attributes
RAttrLine line {this, "line"}
 ! object line attributes
RAttrMarker marker {this, "marker"}
 ! object marker attributes
RAttrValue< std::string > options {this, "options"}
 ! object draw options
RAttrText text {this, "text"}
 ! object text attributes

Protected Member Functions

void CollectShared (Internal::RIOSharedVector_t &vect) final
std::unique_ptr< RDisplayItemDisplay (const RDisplayContext &) override
 Create display item which will be delivered to the client.
void Execute (const std::string &) final
 Execute object method.
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
void PopulateMenu (RMenuItems &) final
 fill context menu items for the ROOT class
void SetCssType (const char *csstype)
virtual void SetDrawableVersion (Version_t vers)

Static Protected Member Functions

static void CheckOwnership (TObject *obj)
 Checks object ownership - used for TH1 directory handling and TF1 globals lists.
static const char * DetectCssType (const TObject *obj)
 Provide css type.
static void ExtractObjectColors (std::unique_ptr< TObjectDisplayItem > &item, const TObject *obj)
 Check if object has specified color value and store it in display item Ensure that color matches on client side too.

Private Types

enum  { kNone = 0 , kObject = 1 }

Private Member Functions

std::unique_ptr< TObjectCreateSpecials (int kind)
 Create instance of requested special object.

Static Private Member Functions

static std::string GetColorCode (TColor *col)
 Convert TColor to RGB string for using with SVG.

Private Attributes

RAttrMap fAttr
 attributes values
std::string fCssClass
 user-defined CSS class, used for RStyle
const char * fCssType {nullptr}
 ! drawable type, not stored in the root file, must be initialized in constructor
const TObjectfExtObj {nullptr}
 ! external object, managed outside of the drawable, not persistent
std::string fId
 user-defined CSS id, used for RStyle
int fKind {kNone}
 object kind
Internal::RIOShared< TObjectfObj
 The object to be painted, owned by the drawable.
std::weak_ptr< RStylefStyle
 ! style applied for RDrawable, not stored when canvas is saved
Version_t fVersion {1}
 ! drawable version, changed from the canvas

#include <ROOT/TObjectDrawable.hxx>

Inheritance diagram for ROOT::Experimental::TObjectDrawable:
ROOT::Experimental::RDrawable

Member Typedef Documentation

◆ Version_t

using ROOT::Experimental::RDrawable::Version_t = uint64_t
inherited

Definition at line 123 of file RDrawable.hxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
kNone 

empty container

kObject 

plain object

Definition at line 40 of file TObjectDrawable.hxx.

◆ EKind

Enumerator
kColors 

list of ROOT colors

kStyle 

instance of TStyle object

kPalette 

list of colors from palette

Definition at line 71 of file TObjectDrawable.hxx.

Constructor & Destructor Documentation

◆ TObjectDrawable() [1/6]

TObjectDrawable::TObjectDrawable ( )

Default constructor.

Definition at line 66 of file TObjectDrawable.cxx.

◆ TObjectDrawable() [2/6]

TObjectDrawable::TObjectDrawable ( TObject * obj,
bool isowner = false )

Constructor, can take ownership over the object is isowner specified.

Definition at line 73 of file TObjectDrawable.cxx.

◆ TObjectDrawable() [3/6]

TObjectDrawable::TObjectDrawable ( TObject * obj,
const std::string & opt,
bool isowner = false )

Constructor, can take ownership over the object is isowner specified.

Definition at line 87 of file TObjectDrawable.cxx.

◆ TObjectDrawable() [4/6]

TObjectDrawable::TObjectDrawable ( const std::shared_ptr< TObject > & obj)

Constructor.

Definition at line 95 of file TObjectDrawable.cxx.

◆ TObjectDrawable() [5/6]

TObjectDrawable::TObjectDrawable ( const std::shared_ptr< TObject > & obj,
const std::string & opt )

Constructor.

Definition at line 106 of file TObjectDrawable.cxx.

◆ TObjectDrawable() [6/6]

TObjectDrawable::TObjectDrawable ( EKind kind,
bool persistent = false )

Creates special kind for for palette or list of colors One can create persistent, which does not updated to actual values.

Definition at line 115 of file TObjectDrawable.cxx.

◆ ~TObjectDrawable()

TObjectDrawable::~TObjectDrawable ( )
overridedefault

Destructor.

Member Function Documentation

◆ CheckOwnership()

void TObjectDrawable::CheckOwnership ( TObject * obj)
staticprotected

Checks object ownership - used for TH1 directory handling and TF1 globals lists.

Definition at line 35 of file TObjectDrawable.cxx.

◆ ClearStyle()

void ROOT::Experimental::RDrawable::ClearStyle ( )
inlineinherited

Definition at line 213 of file RDrawable.hxx.

◆ CollectShared()

void ROOT::Experimental::TObjectDrawable::CollectShared ( Internal::RIOSharedVector_t & vect)
inlinefinalprotectedvirtual

Reimplemented from ROOT::Experimental::RDrawable.

Definition at line 55 of file TObjectDrawable.hxx.

◆ CreateSpecials()

std::unique_ptr< TObject > TObjectDrawable::CreateSpecials ( int kind)
private

Create instance of requested special object.

Definition at line 197 of file TObjectDrawable.cxx.

◆ DetectCssType()

const char * TObjectDrawable::DetectCssType ( const TObject * obj)
staticprotected

Provide css type.

Definition at line 49 of file TObjectDrawable.cxx.

◆ Display()

std::unique_ptr< RDisplayItem > TObjectDrawable::Display ( const RDisplayContext & ctxt)
overrideprotectedvirtual

Create display item which will be delivered to the client.

Reimplemented from ROOT::Experimental::RDrawable.

Definition at line 282 of file TObjectDrawable.cxx.

◆ Execute()

void TObjectDrawable::Execute ( const std::string & exec)
finalprotectedvirtual

Execute object method.

Reimplemented from ROOT::Experimental::RDrawable.

Definition at line 353 of file TObjectDrawable.cxx.

◆ ExtractObjectColors()

void TObjectDrawable::ExtractObjectColors ( std::unique_ptr< TObjectDisplayItem > & item,
const TObject * obj )
staticprotected

Check if object has specified color value and store it in display item Ensure that color matches on client side too.

Definition at line 239 of file TObjectDrawable.cxx.

◆ Get()

const TObject * TObjectDrawable::Get ( )

Return assigned object.

Definition at line 143 of file TObjectDrawable.cxx.

◆ GetAttrMap() [1/2]

RAttrMap & ROOT::Experimental::RDrawable::GetAttrMap ( )
inlineprotectedinherited

Definition at line 185 of file RDrawable.hxx.

◆ GetAttrMap() [2/2]

const RAttrMap & ROOT::Experimental::RDrawable::GetAttrMap ( ) const
inlineprotectedinherited

Definition at line 186 of file RDrawable.hxx.

◆ GetColorCode()

std::string TObjectDrawable::GetColorCode ( TColor * col)
staticprivate

Convert TColor to RGB string for using with SVG.

Definition at line 185 of file TObjectDrawable.cxx.

◆ GetCssClass()

const std::string & ROOT::Experimental::RDrawable::GetCssClass ( ) const
inlineinherited

Definition at line 218 of file RDrawable.hxx.

◆ GetCssType()

const char * ROOT::Experimental::RDrawable::GetCssType ( ) const
inlineinherited

Definition at line 215 of file RDrawable.hxx.

◆ GetId()

const std::string & ROOT::Experimental::RDrawable::GetId ( ) const
inlineinherited

Definition at line 221 of file RDrawable.hxx.

◆ GetVersion()

Version_t ROOT::Experimental::RDrawable::GetVersion ( ) const
inlineprotectedinherited

Definition at line 197 of file RDrawable.hxx.

◆ IsFrameRequired()

virtual bool ROOT::Experimental::RDrawable::IsFrameRequired ( ) const
inlineprotectedvirtualinherited

Reimplemented in ROOT::Experimental::RPaletteDrawable.

Definition at line 183 of file RDrawable.hxx.

◆ MatchSelector()

bool RDrawable::MatchSelector ( const std::string & selector) const
protectedinherited

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.

Definition at line 59 of file RDrawable.cxx.

◆ OnDisplayItemDestroyed()

virtual void ROOT::Experimental::RDrawable::OnDisplayItemDestroyed ( RDisplayItem * ) const
inlineprotectedvirtualinherited

Definition at line 194 of file RDrawable.hxx.

◆ PopulateMenu()

void TObjectDrawable::PopulateMenu ( RMenuItems & items)
finalprotectedvirtual

fill context menu items for the ROOT class

Reimplemented from ROOT::Experimental::RDrawable.

Definition at line 324 of file TObjectDrawable.cxx.

◆ Reset()

void TObjectDrawable::Reset ( )

Reset object.

Definition at line 132 of file TObjectDrawable.cxx.

◆ Set() [1/2]

void TObjectDrawable::Set ( TObject * obj,
bool isowner = false )

Set object.

Definition at line 158 of file TObjectDrawable.cxx.

◆ Set() [2/2]

void TObjectDrawable::Set ( TObject * obj,
const std::string & opt,
bool isowner = false )

Set object.

Definition at line 176 of file TObjectDrawable.cxx.

◆ SetCssClass()

void ROOT::Experimental::RDrawable::SetCssClass ( const std::string & cl)
inlineinherited

Definition at line 217 of file RDrawable.hxx.

◆ SetCssType()

void ROOT::Experimental::RDrawable::SetCssType ( const char * csstype)
inlineprotectedinherited

Definition at line 192 of file RDrawable.hxx.

◆ SetDrawableVersion()

virtual void ROOT::Experimental::RDrawable::SetDrawableVersion ( Version_t vers)
inlineprotectedvirtualinherited

Reimplemented in ROOT::Experimental::RPadBase.

Definition at line 196 of file RDrawable.hxx.

◆ SetId()

void ROOT::Experimental::RDrawable::SetId ( const std::string & id)
inlineinherited

Definition at line 220 of file RDrawable.hxx.

◆ UseStyle()

virtual void ROOT::Experimental::RDrawable::UseStyle ( const std::shared_ptr< RStyle > & style)
inlinevirtualinherited

Reimplemented in ROOT::Experimental::RPadBase.

Definition at line 212 of file RDrawable.hxx.

Member Data Documentation

◆ fAttr

RAttrMap ROOT::Experimental::RDrawable::fAttr
privateinherited

attributes values

Definition at line 172 of file RDrawable.hxx.

◆ fCssClass

std::string ROOT::Experimental::RDrawable::fCssClass
privateinherited

user-defined CSS class, used for RStyle

Definition at line 175 of file RDrawable.hxx.

◆ fCssType

const char* ROOT::Experimental::RDrawable::fCssType {nullptr}
privateinherited

! drawable type, not stored in the root file, must be initialized in constructor

Definition at line 174 of file RDrawable.hxx.

◆ fExtObj

const TObject* ROOT::Experimental::TObjectDrawable::fExtObj {nullptr}
private

! external object, managed outside of the drawable, not persistent

Definition at line 47 of file TObjectDrawable.hxx.

◆ fId

std::string ROOT::Experimental::RDrawable::fId
privateinherited

user-defined CSS id, used for RStyle

Definition at line 176 of file RDrawable.hxx.

◆ fill

RAttrFill ROOT::Experimental::TObjectDrawable::fill {this, "fill"}

! object fill attributes

Definition at line 78 of file TObjectDrawable.hxx.

◆ fKind

int ROOT::Experimental::TObjectDrawable::fKind {kNone}
private

object kind

Definition at line 45 of file TObjectDrawable.hxx.

◆ fObj

Internal::RIOShared<TObject> ROOT::Experimental::TObjectDrawable::fObj
private

The object to be painted, owned by the drawable.

Definition at line 46 of file TObjectDrawable.hxx.

◆ fStyle

std::weak_ptr<RStyle> ROOT::Experimental::RDrawable::fStyle
privateinherited

! style applied for RDrawable, not stored when canvas is saved

Definition at line 173 of file RDrawable.hxx.

◆ fVersion

Version_t ROOT::Experimental::RDrawable::fVersion {1}
privateinherited

! drawable version, changed from the canvas

Definition at line 177 of file RDrawable.hxx.

◆ line

RAttrLine ROOT::Experimental::TObjectDrawable::line {this, "line"}

! object line attributes

Definition at line 77 of file TObjectDrawable.hxx.

◆ marker

RAttrMarker ROOT::Experimental::TObjectDrawable::marker {this, "marker"}

! object marker attributes

Definition at line 79 of file TObjectDrawable.hxx.

◆ options

RAttrValue<std::string> ROOT::Experimental::TObjectDrawable::options {this, "options"}

! object draw options

Definition at line 81 of file TObjectDrawable.hxx.

◆ text

RAttrText ROOT::Experimental::TObjectDrawable::text {this, "text"}

! object text attributes

Definition at line 80 of file TObjectDrawable.hxx.


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