Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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/RPad.hxx>
14#include "ROOT/RStyle.hxx"
15
16namespace ROOT {
17namespace Experimental {
18
19
20/** class RPadBaseDisplayItem
21\ingroup GpadROOT7
22\brief Display item for the RPadBase class, includes primitives, attributes and frame
23\author Sergey Linev
24\date 2017-05-31
25\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
26*/
27
29public:
30 // list of snapshot for primitives in pad
31 using PadPrimitives_t = std::vector<std::unique_ptr<RDisplayItem>>;
32
33protected:
34 const RAttrMap *fAttr{nullptr}; ///< temporary pointer on attributes
35 PadPrimitives_t fPrimitives; ///< display items for all primitives in the pad
36 std::vector<std::shared_ptr<RStyle>> fStyles; ///<! locked styles of the objects and pad until streaming is performed
37public:
39 ~RPadBaseDisplayItem() override = default;
40 void SetAttributes(const RAttrMap *f) { fAttr = f; }
41 /// Add display item and style which should be used for it
42 void Add(std::unique_ptr<RDisplayItem> &&item, std::shared_ptr<RStyle> &&style)
43 {
44 if (style) {
45 item->SetStyle(style.get());
46 fStyles.emplace_back(std::move(style));
47 }
48 fPrimitives.push_back(std::move(item));
49 }
50 /// Assign style for the pad
51 void SetPadStyle(std::shared_ptr<RStyle> &&style)
52 {
53 if (style) {
54 SetStyle(style.get());
55 fStyles.emplace_back(std::move(style));
56 }
57 }
58};
59
60/** class RPadDisplayItem
61\ingroup GpadROOT7
62\brief Display item for the RPad class, add pad position and size
63\author Sergey Linev
64\date 2017-05-31
65\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
66*/
67
69
70protected:
71 const RPadPos *fPos{nullptr}; ///< pad position
72 const RPadExtent *fSize{nullptr}; ///< pad size
73public:
74 RPadDisplayItem() = default;
75 ~RPadDisplayItem() override {}
76 void SetPadPosSize(const RPadPos *pos, const RPadExtent *size) { fPos = pos; fSize = size; }
77
78 void BuildFullId(const std::string &prefix) override
79 {
81 std::string subprefix = prefix + std::to_string(GetIndex()) + "_";
82 for (auto &item : fPrimitives)
83 item->BuildFullId(subprefix);
84 }
85};
86
87
88/** class RCanvasDisplayItem
89\ingroup GpadROOT7
90\brief Display item for the RCanvas class, add canvas title and size
91\author Sergey Linev
92\date 2017-05-31
93\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
94*/
95
97
98protected:
99 std::string fTitle; ///< title of the canvas
100 std::array<int, 2> fWinSize; ///< canvas window size
101public:
103 ~RCanvasDisplayItem() override = default;
104 void SetTitle(const std::string &title) { fTitle = title; }
105 void SetWindowSize(int width, int height) { fWinSize[0] = width; fWinSize[1] = height; }
106
107 void BuildFullId(const std::string &prefix) override
108 {
109 for (auto &item : fPrimitives)
110 item->BuildFullId(prefix);
111 }
112};
113
114
115
116} // Experimental
117} // ROOT
118
119#endif
#define f(i)
Definition RSha256.hxx:104
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t width
Option_t Option_t style
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
std::array< int, 2 > fWinSize
canvas window size
std::string fTitle
title of the canvas
void BuildFullId(const std::string &prefix) override
Build full id, including prefix and object index.
void SetTitle(const std::string &title)
void SetWindowSize(int width, int height)
Base class for painting data for JS.
virtual void BuildFullId(const std::string &prefix)
Build full id, including prefix and object index.
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.
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
Build full id, including prefix and object index.
An extent / size (horizontal and vertical) in a RPad.
A position (horizontal and vertical) in a RPad.
Definition RPadPos.hxx:28
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.