21using namespace std::string_literals;
32 drawable->UseStyle(
style);
40 for (
auto &drawable : fPrimitives) {
42 if (drawable->GetId() ==
id)
43 return drawable.get_shared();
64 auto p =
id.find(
"_");
65 if (p == std::string::npos)
68 auto prim = GetPrimitive(std::stoul(
id.substr(0,p)));
72 auto subid =
id.substr(p+1);
77 auto subpad = std::dynamic_pointer_cast<RPadBase>(prim);
79 return subpad ? subpad->FindPrimitiveByDisplayId(subid) :
nullptr;
90 for (
auto &drawable : fPrimitives) {
91 for (
auto &attr: drawable->fAttr) {
93 if (!attr.second->GetBool())
continue;
94 auto pos = attr.first.rfind(
"_color_auto");
95 if ((pos > 0) && (pos == attr.first.length() - 11)) {
102 drawable->fAttr.AddString(attr.first.substr(0,pos) +
"_color_rgb", col.
GetHex());
121 for (
auto &drawable : fPrimitives) {
122 auto item = drawable->Display();
124 item->SetObjectIDAsPtr(drawable.get());
125 item->SetIndex(indx);
127 paditem.
Add(std::move(item), drawable->fStyle.lock());
137std::vector<std::vector<std::shared_ptr<ROOT::Experimental::RPad>>>
140 std::vector<std::vector<std::shared_ptr<RPad>>> ret;
142 R__ERROR_HERE(
"Gpad") <<
"Cannot divide into 0 horizontal sub-pads!";
144 R__ERROR_HERE(
"Gpad") <<
"Cannot divide into 0 vertical sub-pads!";
145 if (!nHoriz || !nVert)
151 offset = (offset + padding);
152 offset *= {1. / nHoriz, 1. / nVert};
155 for (
int iHoriz = 0; iHoriz < nHoriz; ++iHoriz) {
157 for (
int iVert = 0; iVert < nVert; ++iVert) {
159 subPos *= {1. * iHoriz, 1. * iVert};
161 auto subpad = Draw<RPad>(
this, subPos, size);
163 ret.back().emplace_back(subpad);
172 CreateFrameIfNeeded();
179 fFrame = std::make_unique<ROOT::Experimental::RFrame>();
189 if (fFrame && dimension < fFrame->GetNDimensions())
190 return &fFrame->GetUserAxis(dimension);
200 GetOrCreateFrame()->GrowToDimensions(dimension);
201 return &fFrame->GetUserAxis(dimension);
209 GetOrCreateFrame()->GrowToDimensions(dimension);
210 GetAxis(dimension)->SetBounds(begin, end);
218 GetOrCreateFrame()->GrowToDimensions(dimension);
219 GetAxis(dimension)->SetBound(boundsKind, bound);
227 GetOrCreateFrame()->GrowToDimensions(dimension);
228 GetAxis(dimension)->SetAutoBounds();
236 GetOrCreateFrame()->GrowToDimensions(vecBeginAndEnd.size());
237 if (vecBeginAndEnd.size() != fFrame->GetNDimensions()) {
239 <<
"Array of axis bound has wrong size " << vecBeginAndEnd.size()
240 <<
" versus numer of axes in frame " << fFrame->GetNDimensions();
244 for (
size_t i = 0,
n = fFrame->GetNDimensions(); i <
n; ++i)
245 fFrame->GetUserAxis(i).SetBounds(vecBeginAndEnd[i][0], vecBeginAndEnd[i][1]);
253 GetOrCreateFrame()->GrowToDimensions(vecBoundAndKind.size());
254 if (vecBoundAndKind.size() != fFrame->GetNDimensions()) {
256 <<
"Array of axis bound has wrong size " << vecBoundAndKind.size()
257 <<
" versus numer of axes in frame " << fFrame->GetNDimensions();
261 for (
size_t i = 0,
n = fFrame->GetNDimensions(); i <
n; ++i)
262 fFrame->GetUserAxis(i).SetBound(vecBoundAndKind[i].fKind, vecBoundAndKind[i].fBound);
270 for (
auto &handle : fPrimitives) {
271 vect.emplace_back(&handle);
272 auto drawable = handle.get();
273 if (drawable) drawable->CollectShared(vect);
282 for (
size_t i = 0,
n = GetOrCreateFrame()->GetNDimensions(); i <
n; ++i)
283 fFrame->GetUserAxis(i).SetAutoBounds();
#define R__ERROR_HERE(GROUP)
static constexpr RGB_t kRed
static constexpr RGB_t kGreen
std::string GetHex() const
Return color as hex string like 00FF00.
static constexpr RGB_t kBlue
static std::string ObjectIDFromPtr(const void *ptr)
virtual void UseStyle(const std::shared_ptr< RStyle > &style)
Holds a user coordinate system with a palette.
class RPadBaseDisplayItem
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.
void SetAttributes(const RAttrMap *f)
void SetFrame(const RFrame *f)
Base class for graphic containers for RDrawable-s.
void UseStyle(const std::shared_ptr< RStyle > &style) override
Use provided style for pad and all primitives inside.
void CollectShared(Internal::RIOSharedVector_t &) override
Collect all shared items to resolve shared_ptr after IO.
void CreateFrameIfNeeded()
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.
void SetAllAxisBound(const std::vector< BoundKindAndValue > &vecBoundAndKind)
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.
void SetAllAxisAutoBounds()
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).
std::vector< Primitive_t > fPrimitives
Content of the pad.
void SetAllAxisBounds(const std::vector< std::array< double, 2 > > &vecBeginAndEnd)
Set the range of an axis as bound kind and bound (up or down).
RPadUserAxisBase * GetAxis(size_t dimension) const
Get a pad axis from the RFrame.
void AssignAutoColors()
Method collect existing colors and assign new values if required.
RPadUserAxisBase * GetOrCreateAxis(size_t dimension)
Get a pad axis from the RFrame.
void DisplayPrimitives(RPadBaseDisplayItem &paditem) const
Create display items for all primitives in the pad Each display item gets its special id,...
RFrame * GetOrCreateFrame()
std::shared_ptr< RDrawable > FindPrimitiveByDisplayId(const std::string &display_id) const
Find primitive with unique id, produce for RDisplayItem Such id used for client-server identification...
void SetAxisAutoBounds(int dimension)
Set the range of an axis as bound kind and bound (up or down).
std::shared_ptr< RDrawable > FindPrimitive(const std::string &id) const
Find primitive with specified id.
An extent / size (horizontal and vertical) in a RPad.
A position (horizontal and vertical) in a RPad.
Base class for user coordinates (e.g.
EAxisBoundsKind
Types of axis bounds to respect by the painter.
std::vector< RIOSharedBase * > RIOSharedVector_t