37 R__ERROR_HERE(
"Gpad") <<
"Cannot access canvas when unique object id should be assigned";
46 for (
auto &&drawable : GetPrimitives()) {
48 if (drawable->GetId() ==
id)
52 if (!pad_draw || !pad_draw->
Get())
continue;
56 if (!subelem)
continue;
64std::vector<std::vector<ROOT::Experimental::RPad *>>
67 std::vector<std::vector<RPad *>> ret;
69 R__ERROR_HERE(
"Gpad") <<
"Cannot divide into 0 horizontal sub-pads!";
71 R__ERROR_HERE(
"Gpad") <<
"Cannot divide into 0 vertical sub-pads!";
72 if (!nHoriz || !nVert)
78 offset = (offset + padding);
79 offset *= {1. / nHoriz, 1. / nVert};
83 for (
int iHoriz = 0; iHoriz < nHoriz; ++iHoriz) {
84 ret[iHoriz].resize(nVert);
85 for (
int iVert = 0; iVert < nVert; ++iVert) {
87 subPos *= {1. * iHoriz, 1. * iVert};
88 auto uniqPad = std::make_unique<RPad>(*
this, subPos, size);
89 ret[iHoriz][iVert] = uniqPad.get();
90 Draw(std::move(uniqPad), subPos, size);
99 CreateFrameIfNeeded();
106 fFrame = std::make_unique<ROOT::Experimental::RFrame>();
117 if (fFrame && dimension < fFrame->GetNDimensions())
118 return &fFrame->GetUserAxis(dimension);
128 GetOrCreateFrame()->GrowToDimensions(dimension);
129 return &fFrame->GetUserAxis(dimension);
137 GetOrCreateFrame()->GrowToDimensions(dimension);
138 GetAxis(dimension)->SetBounds(begin, end);
146 GetOrCreateFrame()->GrowToDimensions(dimension);
147 GetAxis(dimension)->SetBound(boundsKind, bound);
155 GetOrCreateFrame()->GrowToDimensions(dimension);
156 GetAxis(dimension)->SetAutoBounds();
164 GetOrCreateFrame()->GrowToDimensions(vecBeginAndEnd.size());
165 if (vecBeginAndEnd.size() != fFrame->GetNDimensions()) {
167 <<
"Array of axis bound has wrong size " << vecBeginAndEnd.size()
168 <<
" versus numer of axes in frame " << fFrame->GetNDimensions();
172 for (
size_t i = 0,
n = fFrame->GetNDimensions(); i <
n; ++i)
173 fFrame->GetUserAxis(i).SetBounds(vecBeginAndEnd[i][0], vecBeginAndEnd[i][1]);
181 GetOrCreateFrame()->GrowToDimensions(vecBoundAndKind.size());
182 if (vecBoundAndKind.size() != fFrame->GetNDimensions()) {
184 <<
"Array of axis bound has wrong size " << vecBoundAndKind.size()
185 <<
" versus numer of axes in frame " << fFrame->GetNDimensions();
189 for (
size_t i = 0,
n = fFrame->GetNDimensions(); i <
n; ++i)
190 fFrame->GetUserAxis(i).SetBound(vecBoundAndKind[i].fKind, vecBoundAndKind[i].fBound);
198 for (
size_t i = 0,
n = GetOrCreateFrame()->GetNDimensions(); i <
n; ++i)
199 fFrame->GetUserAxis(i).SetAutoBounds();
211 : fPad(std::move(pPad))
214 fPad->GetDrawingOpts() = opts;
#define R__ERROR_HERE(GROUP)
Abstract interface for object painting on the pad/canvas.
void PaintDrawables(const RPadBase &pad)
virtual void AddDisplayItem(std::unique_ptr< RDisplayItem > &&item)
add display item to the canvas
std::unique_ptr< RPadDisplayItem > fPadDisplayItem
! display items for all drawables in the pad
std::string GenerateUniqueId()
Generates unique ID inside the canvas.
Holds a user coordinate system with a palette.
void CreateFrameIfNeeded()
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.
virtual const RCanvas * GetCanvas() const =0
Access to the top-most canvas, if any (const version).
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).
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.
RPadUserAxisBase * GetOrCreateAxis(size_t dimension)
Get a pad axis from the RFrame.
RFrame * GetOrCreateFrame()
void AssignUniqueID(std::shared_ptr< RDrawable > &ptr)
void SetAxisAutoBounds(int dimension)
Set the range of an axis as bound kind and bound (up or down).
std::vector< std::vector< RPad * > > Divide(int nHoriz, int nVert, const RPadExtent &padding={})
Divide this pad into a grid of subpads with padding in between.
std::shared_ptr< RDrawable > FindDrawable(const std::string &id) const
Draw a RPad, by drawing its contained graphical elements at the pad offset in the parent pad.
void Paint(Internal::RPadPainter &) final
Paint primitives from the pad.
RPadDrawable(const std::shared_ptr< RPad > &pPad, const RPad::DrawingOpts &opts={})
Move a sub-pad into this (i.e. parent's) list of drawables.
const std::shared_ptr< RPad > fPad
The pad to be painted.
EAxisBoundsKind
Types of axis bounds to respect by the painter.
Drawing options for a RPad.
virtual ~RPad()
Destructor to have a vtable.
An extent / size (horizontal and vertical) in a RPad.
A position (horizontal and vertical) in a RPad.