Logo ROOT  
Reference Guide
RPadDisplayItem.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#ifndef ROOT7_RPadDisplayItem
10#define ROOT7_RPadDisplayItem
11
12#include <ROOT/RDisplayItem.hxx>
13#include <ROOT/RFrame.hxx>
14#include <ROOT/RPad.hxx>
15#include "ROOT/RStyle.hxx"
16
17namespace ROOT {
18namespace Experimental {
19
20
21/** class RPadBaseDisplayItem
22\ingroup GpadROOT7
23\brief Display item for the RPadBase class, includes primitives, attributes and frame
24\author Sergey Linev
25\date 2017-05-31
26\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
27*/
28
30public:
31 // list of snapshot for primitives in pad
32 using PadPrimitives_t = std::vector<std::unique_ptr<RDisplayItem>>;
33
34protected:
35 const RFrame *fFrame{nullptr}; ///< temporary pointer on frame object
36 const RAttrMap *fAttr{nullptr}; ///< temporary pointer on attributes
37 PadPrimitives_t fPrimitives; ///< display items for all primitives in the pad
38 std::vector<std::shared_ptr<RStyle>> fStyles; ///<! locked styles of the objects and pad until streaming is performed
39public:
41 virtual ~RPadBaseDisplayItem() = default;
42 void SetFrame(const RFrame *f) { fFrame = f; }
43 void SetAttributes(const RAttrMap *f) { fAttr = f; }
44 /// Add display item and style which should be used for it
45 void Add(std::unique_ptr<RDisplayItem> &&item, std::shared_ptr<RStyle> &&style)
46 {
47 if (style) {
48 item->SetStyle(style.get());
49 fStyles.emplace_back(std::move(style));
50 }
51 fPrimitives.push_back(std::move(item));
52 }
53 /// Assign style for the pad
54 void SetPadStyle(std::shared_ptr<RStyle> &&style)
55 {
56 if (style) {
57 SetStyle(style.get());
58 fStyles.emplace_back(std::move(style));
59 }
60 }
61};
62
63/** class RPadDisplayItem
64\ingroup GpadROOT7
65\brief Display item for the RPad class, add pad position and size
66\author Sergey Linev
67\date 2017-05-31
68\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
69*/
70
72
73protected:
74 const RPadPos *fPos{nullptr}; ///< pad position
75 const RPadExtent *fSize{nullptr}; ///< pad size
76public:
77 RPadDisplayItem() = default;
78 virtual ~RPadDisplayItem() {}
79 void SetPadPosSize(const RPadPos *pos, const RPadExtent *size) { fPos = pos; fSize = size; }
80
81 void BuildFullId(const std::string &prefix) override
82 {
84 std::string subprefix = prefix + std::to_string(GetIndex()) + "_";
85 for (auto &item : fPrimitives)
86 item->BuildFullId(subprefix);
87 }
88};
89
90
91/** class RCanvasDisplayItem
92\ingroup GpadROOT7
93\brief Display item for the RCanvas class, add canvas title and size
94\author Sergey Linev
95\date 2017-05-31
96\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
97*/
98
100
101protected:
102 std::string fTitle; ///< title of the canvas
103 std::array<int, 2> fWinSize; ///< canvas window size
104public:
106 virtual ~RCanvasDisplayItem() = default;
107 void SetTitle(const std::string &title) { fTitle = title; }
108 void SetWindowSize(const std::array<RPadLength::Pixel, 2> &win) { fWinSize[0] = (int) win[0].fVal; fWinSize[1] = (int) win[1].fVal; }
109
110 void BuildFullId(const std::string &prefix) override
111 {
112 for (auto &item : fPrimitives)
113 item->BuildFullId(prefix);
114 }
115};
116
117
118
119} // Experimental
120} // ROOT
121
122#endif
#define f(i)
Definition: RSha256.hxx:104
void SetWindowSize(const std::array< RPadLength::Pixel, 2 > &win)
std::array< int, 2 > fWinSize
canvas window size
std::string fTitle
title of the canvas
void BuildFullId(const std::string &prefix) override
void SetTitle(const std::string &title)
Base class for painting data for JS.
virtual void BuildFullId(const std::string &prefix)
Holds a user coordinate system with a palette.
Definition: RFrame.hxx:31
void SetPadStyle(std::shared_ptr< RStyle > &&style)
Assign style for the pad.
void Add(std::unique_ptr< RDisplayItem > &&item, std::shared_ptr< RStyle > &&style)
Add display item and style which should be used for it.
const RFrame * fFrame
temporary pointer on frame object
std::vector< std::shared_ptr< RStyle > > fStyles
! locked styles of the objects and pad until streaming is performed
const RAttrMap * fAttr
temporary pointer on attributes
std::vector< std::unique_ptr< RDisplayItem > > PadPrimitives_t
PadPrimitives_t fPrimitives
display items for all primitives in the pad
const RPadExtent * fSize
pad size
void SetPadPosSize(const RPadPos *pos, const RPadExtent *size)
const RPadPos * fPos
pad position
void BuildFullId(const std::string &prefix) override
An extent / size (horizontal and vertical) in a RPad.
Definition: RPadExtent.hxx:27
A position (horizontal and vertical) in a RPad.
Definition: RPadPos.hxx:28
VSD Structures.
Definition: StringConv.hxx:21
TCanvas * style()
Definition: style.C:1