51 if (!obj)
return "tobject";
54 if (strncmp(clname,
"TH3", 3) == 0)
return "th3";
55 if (strncmp(clname,
"TH2", 3) == 0)
return "th2";
56 if ((strncmp(clname,
"TH1", 3) == 0) || obj->
InheritsFrom(
"TH1"))
return "th1";
57 if (strncmp(clname,
"TGraph", 6) == 0)
return "tgraph";
58 if (strcmp(clname,
"TLine") == 0)
return "tline";
59 if (strcmp(clname,
"TBox") == 0)
return "tbox";
78 fObj = std::shared_ptr<TObject>(obj);
167 fObj = std::shared_ptr<TObject>(obj);
202 auto arr = std::make_unique<TObjArray>();
203 arr->SetOwner(
kTRUE);
205 auto cols =
gROOT->GetListOfColors();
206 for (
int n = 0;
n <= cols->GetLast(); ++
n) {
207 auto col =
dynamic_cast<TColor *
>(cols->At(
n));
216 return std::make_unique<TStyle>(*
gStyle);
220 auto arr = std::make_unique<TObjArray>();
221 arr->SetOwner(
kTRUE);
224 for (
int n = 0;
n < palette.GetSize(); ++
n) {
225 auto col =
gROOT->GetColor(palette[
n]);
245 auto ExtractColor = [&item, cl, obj](
const char *class_name,
const char *class_member) {
252 if (*icol < 10)
return;
258 ExtractColor(
"TAttLine",
"fLineColor");
259 ExtractColor(
"TAttFill",
"fFillColor");
260 ExtractColor(
"TAttMarker",
"fMarkerColor");
261 ExtractColor(
"TAttText",
"fTextColor");
262 ExtractColor(
"TAttPad",
"fFrameFillColor");
263 ExtractColor(
"TAttPad",
"fFrameLineColor");
264 ExtractColor(
"TAttAxis",
"fAxisColor");
265 ExtractColor(
"TAttAxis",
"fLabelColor");
266 ExtractColor(
"TAttAxis",
"fTitleColor");
289 auto item = std::make_unique<TObjectDisplayItem>(*
this,
fKind, obj);
294 if (strcmp(obj->ClassName(),
"THStack") == 0) {
302 TIter iter(*(
TList **) (((
char *) obj + off2)));
304 while ((hist = iter()) !=
nullptr)
315 return std::make_unique<TObjectDisplayItem>(
fKind, specials.release());
359 std::string sub,
ex = exec;
360 if (
ex.compare(0, 6,
"xaxis#") == 0) {
362 ex.insert(0,
"GetXaxis()->");
363 }
else if (
ex.compare(0, 6,
"yaxis#") == 0) {
365 ex.insert(0,
"GetYaxis()->");
366 }
else if (
ex.compare(0, 6,
"zaxis#") == 0) {
368 ex.insert(0,
"GetZaxis()->");
371 std::stringstream cmd;
372 cmd <<
"((" << obj->ClassName() <<
" *) " << std::hex << std::showbase << (size_t)obj <<
")->" <<
ex <<
";";
373 std::cout <<
"TObjectDrawable::Execute Obj " << obj->GetName() <<
" Cmd " << cmd.str() << std::endl;
374 gROOT->ProcessLine(cmd.str().c_str());
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 Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
R__EXTERN TStyle * gStyle
void SetAlphaFloat(float alpha)
Set alpha as float value from range 0..1.
std::string AsSVG() const
Returns color value as it will be used in SVG drawing It either include hex format #66FF66 or just pl...
Version_t GetLastVersion() const
Base class for drawable entities: objects that can be painted on a RPad.
Version_t GetVersion() const
void SetCssType(const char *csstype)
Provides v7 drawing facilities for TObject types (TGraph, TH1, TH2, etc).
RAttrValue< std::string > options
! object draw options
void Reset()
Reset object.
@ kColors
list of ROOT colors
@ kPalette
list of colors from palette
@ kStyle
instance of TStyle object
TObjectDrawable()
Default constructor.
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 c...
static void CheckOwnership(TObject *obj)
Checks object ownership - used for TH1 directory handling and TF1 globals lists.
Internal::RIOShared< TObject > fObj
The object to be painted, owned by the drawable.
std::unique_ptr< TObject > CreateSpecials(int kind)
Create instance of requested special object.
void PopulateMenu(RMenuItems &) final
fill context menu items for the ROOT class
static std::string GetColorCode(TColor *col)
Convert TColor to RGB string for using with SVG.
void Execute(const std::string &) final
Execute object method.
std::unique_ptr< RDisplayItem > Display(const RDisplayContext &) override
Create display item which will be delivered to the client.
const TObject * Get()
Return assigned object.
static const char * DetectCssType(const TObject *obj)
Provide css type.
const TObject * fExtObj
! external object, managed outside of the drawable, not persistent
void Set(TObject *obj, bool isowner=false)
Set object.
~TObjectDrawable() override
Destructor.
TClass instances represent classes, structs and namespaces in the ROOT type system.
TClass * GetBaseClass(const char *classname)
Return pointer to the base class "classname".
Longptr_t GetDataMemberOffset(const char *membername) const
return offset for member name.
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
TClass * IsA() const override
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
The color creation and management class.
static const TArrayI & GetPalette()
Static function returning the current active palette.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Method or function calling interface.
void Execute(const char *, const char *, int *=nullptr) override
Execute method on this object with the given parameter string, e.g.
Collectable string class.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
@ kNotDeleted
object has not been deleted
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual TClass * IsA() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.