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};
85 for (
int iHoriz = 0; iHoriz < nHoriz; ++iHoriz) {
86 ret[iHoriz].resize(nVert);
87 for (
int iVert = 0; iVert < nVert; ++iVert) {
89 subPos *= {1. * iHoriz, 1. * iVert};
90 auto uniqPad = std::make_unique<RPad>(*
this, size);
91 ret[iHoriz][iVert] = uniqPad.get();
92 Draw(std::move(uniqPad), subPos);
102 CreateFrameIfNeeded();
109 fFrame = std::make_unique<ROOT::Experimental::RFrame>();
120 if (fFrame && dimension < fFrame->GetNDimensions())
121 return &fFrame->GetUserAxis(dimension);
131 GetOrCreateFrame()->GrowToDimensions(dimension);
132 return &fFrame->GetUserAxis(dimension);
140 GetOrCreateFrame()->GrowToDimensions(dimension);
141 GetAxis(dimension)->SetBounds(begin, end);
149 GetOrCreateFrame()->GrowToDimensions(dimension);
150 GetAxis(dimension)->SetBound(boundsKind, bound);
158 GetOrCreateFrame()->GrowToDimensions(dimension);
159 GetAxis(dimension)->SetAutoBounds();
167 GetOrCreateFrame()->GrowToDimensions(vecBeginAndEnd.size());
168 if (vecBeginAndEnd.size() != fFrame->GetNDimensions()) {
170 <<
"Array of axis bound has wrong size " << vecBeginAndEnd.size()
171 <<
" versus numer of axes in frame " << fFrame->GetNDimensions();
175 for (
size_t i = 0,
n = fFrame->GetNDimensions(); i <
n; ++i)
176 fFrame->GetUserAxis(i).SetBounds(vecBeginAndEnd[i][0], vecBeginAndEnd[i][1]);
184 GetOrCreateFrame()->GrowToDimensions(vecBoundAndKind.size());
185 if (vecBoundAndKind.size() != fFrame->GetNDimensions()) {
187 <<
"Array of axis bound has wrong size " << vecBoundAndKind.size()
188 <<
" versus numer of axes in frame " << fFrame->GetNDimensions();
192 for (
size_t i = 0,
n = fFrame->GetNDimensions(); i <
n; ++i)
193 fFrame->GetUserAxis(i).SetBound(vecBoundAndKind[i].fKind, vecBoundAndKind[i].fBound);
201 for (
size_t i = 0,
n = GetOrCreateFrame()->GetNDimensions(); i <
n; ++i)
202 fFrame->GetUserAxis(i).SetAutoBounds();
214 : fPad(
std::move(pPad)), fOpts(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(std::shared_ptr< RPad > pPad, const RPadDrawingOpts &opts={})
Move a sub-pad into this (i.e. parent's) list of drawables.
Drawing options for a RPad.
Normal fNormal
The normalized coordinate summand.
EAxisBoundsKind
Types of axis bounds to respect by the painter.
virtual ~RPad()
Destructor to have a vtable.
RPadLength fHoriz
Horizontal position.
RPadLength fVert
Vertical position.
An extent / size (horizontal and vertical) in a RPad.
double fVal
Coordinate value.
A position (horizontal and vertical) in a RPad.